Subversion Repositories SmartDukaan

Rev

Rev 10215 | Rev 10489 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
2820 chandransh 1
namespace java in.shop2020.warehouse
2
namespace py shop2020.thriftpy.warehouse
3
 
3374 rajveer 4
include "GenericService.thrift"
5
 
5185 mandeep.dh 6
enum ScanType {
7
    PURCHASE = 0,   // Scan-in at the time of purchase
8
    SALE = 1,       // Scan-out for sale
9
    SALE_RET = 2,   // Scan-in when an item is returned undelivered
10
    DOA_IN = 3,     // Scan-in when an item is returned by the customer with the DOA certificate
11
    DOA_OUT = 4,     // Scan-out to return an item to the supplier
12
    PURCHASE_RETURN = 5, // Scan-out to return an item to the supplier (a Non-DOA case)
13
    SALE_RET_UNUSABLE = 6,
14
    LOST_IN_TRANSIT = 7,
6548 amar.kumar 15
    DOA_REPLACED = 8,
7185 amit.gupta 16
    LOST_IN_WAREHOUSE = 9,
17
    MARKED_USED	= 10,
18
  	MARKED_BAD = 11,
19
  	MARKED_GOOD = 12;
7410 amar.kumar 20
  	WAREHOUSE_TRANSFER_IN = 13;
21
  	WAREHOUSE_TRANSFER_OUT = 14;
8565 amar.kumar 22
  	BAD_SALE = 15;
10308 amar.kumar 23
  	DOA_REJECTED = 16;
5185 mandeep.dh 24
}
25
 
7410 amar.kumar 26
enum TransferLotStatus {
27
	IN_TRANSIT = 1,
28
	PARTIAL_TRANSFER = 2,
29
	TRANSFER_COMPLETE = 3
30
}
31
 
32
enum TransferType {
33
	OURS_OURS = 1,
34
	OURS_THIRDPARTY = 2
35
}
36
 
4496 mandeep.dh 37
struct InventoryItem {
5185 mandeep.dh 38
    // primary fields
4496 mandeep.dh 39
    1:i64 id,
40
    2:i64 itemId,
41
    3:string itemNumber,
42
    4:string serialNumber,
43
    5:i64 initialQuantity,
44
    6:i64 currentQuantity,
4555 mandeep.dh 45
    7:i64 purchaseId,
6467 amar.kumar 46
    8:i64 purchaseReturnId,
7410 amar.kumar 47
    9:i64 physicalWarehouseId,
48
    10:TransferLotStatus transferStatus,
4555 mandeep.dh 49
    // derived fields for  efficient lookups
7410 amar.kumar 50
    11:i64 supplierId,
51
    12:double unitPrice,
52
    13:i64 currentWarehouseId,
7672 rajveer 53
    14:ScanType lastScanType,
54
    15:double nlc
2820 chandransh 55
}
56
 
4496 mandeep.dh 57
struct Scan {
58
    1:i64 id,
59
    2:i64 inventoryItemId,
60
    3:optional i64 quantity, // ignored in case of serialized items
7410 amar.kumar 61
    4:optional i64 orderId, // The order that was fulfilled with this scan!
4496 mandeep.dh 62
    5:i64 warehouseId,
63
    6:ScanType type,
7190 amar.kumar 64
    7:i64 scannedAt,
7410 amar.kumar 65
    8:i64 transferLotId,
66
    9:string remarks
2820 chandransh 67
}
68
 
5372 mandeep.dh 69
struct DetailedPurchaseScan {
70
    1:i64 purchaseOrderId,
71
    2:i64 poCreatedAt,
72
    3:string supplierName,
73
    4:string invoiceNumbers,
6494 amar.kumar 74
    5:string receivedBy,
75
    6:i64 itemId,
76
    7:string brand,
77
    8:string modelName,
78
    9:string modelNumber,
79
   10:string color,
80
   11:double unitPrice,
81
   12:i64 quantity,
82
   13:i64 purchaseId,
7672 rajveer 83
   14:i64 purchasedAt,
8580 amar.kumar 84
   15:double nlc,
9433 amar.kumar 85
   16:i64 warehouseId,
86
   17:i64 taxType
5372 mandeep.dh 87
}
88
 
5496 mandeep.dh 89
struct InvoiceScan {
90
    1:string invoiceNumber,
91
    2:i64 numItems,
92
    3:string supplierName,
93
    4:i64 date,
94
    5:i64 scannedQuantity
95
}
96
 
7613 amar.kumar 97
struct InTransitInventory {
98
	1:i64 itemId,
99
	2:i64 originWarehouseId,
100
	3:i64 destinationWarehouseId,
101
	4:i64 quantity,
102
	5:i64 transferDate,
103
}
104
 
6548 amar.kumar 105
struct InventoryAvailability{
106
	1:i64 itemId,
107
	2:string brand,
108
	3:string modelName,
109
	4:string modelNumber,
110
	5:string color,
111
	6:i64 quantity
112
}
113
 
6762 amar.kumar 114
struct InventoryMovement{
115
	1:i64 itemId,
116
	2:string brand,
117
	3:string modelName,
118
	4:string modelNumber,
119
	5:string color,
120
	6:ScanType type
121
	7:i64 quantity
122
}
123
 
5711 mandeep.dh 124
struct InventoryAge {
125
    1:i64 itemId,
126
    2:string brand,
127
    3:string modelName,
128
    4:string modelNumber,
129
    5:string color,
130
    6:i64 freshCount,
131
    7:i64 oneToTwoCount,
132
    8:i64 TwoToThreeCount,
133
    9:i64 ThreeToFourCount,
5768 mandeep.dh 134
   10:i64 FourPlusCount,
8626 amar.kumar 135
   11:i64 threeMonthPlusCount,
136
   12:i64 sixMonthPlusCount,
137
   13:i64 ZeroPlusCount,
138
   14:i64 OnePlusCount,
139
   15:i64 ZeroPlusCost,
140
   16:i64 OnePlusCost,
141
   17:string category
5711 mandeep.dh 142
}
143
 
7410 amar.kumar 144
struct PossibleWarehouseMovement {
145
	1:i64 fromWarehouseId,
146
	2:i64 toWarehouseId
147
}
148
 
149
struct TransferLot {
150
	1:i64 id,
151
	2:i64 originWarehouseId,
152
	3:i64 destinationWarehouseId,
153
	4:TransferLotStatus status,
154
	5:i64 transferDate,
155
	6:TransferType type,
156
	7:string transitCompletionReferenceNumber,
157
	8:i64 referenceUpdationDate
158
	9:string remarks,
159
}
160
 
4496 mandeep.dh 161
exception WarehouseServiceException {
162
    1:GenericService.ExceptionType exceptionType,
163
    2:string message
2820 chandransh 164
}
165
 
6548 amar.kumar 166
 
4496 mandeep.dh 167
service WarehouseService extends GenericService.GenericService {
168
    /**
169
     * Retrieves serialized inventory item given a serial number
170
     */
4541 mandeep.dh 171
    InventoryItem getInventoryItem(1:string serialNumber) throws (1:WarehouseServiceException wex);
2820 chandransh 172
 
4496 mandeep.dh 173
    /**
5361 mandeep.dh 174
     * Retrieves non-serialized inventory item from a given supplier
4496 mandeep.dh 175
     */
8565 amar.kumar 176
    InventoryItem getNonSeralizedInventoryItem(1:string itemNumber, 2:i64 itemId, 3:i64 fulfilmentWarehouseId, 4:i64 billingWarehouseId) throws (1:WarehouseServiceException wex);
3383 chandransh 177
 
4496 mandeep.dh 178
    /**
179
     * Scan non-serialized items.
180
     */
7410 amar.kumar 181
    void scan(1:InventoryItem inventoryItem, 2:ScanType type, 3:i64 quantity, 4:i64 billingWarehouseId, 5:i64 transferLotId) throws (1:WarehouseServiceException wex);
4496 mandeep.dh 182
 
183
    /**
184
     * Scan serialized items linked with an order. Returns its price.
185
     */
5110 mandeep.dh 186
    InventoryItem scanSerializedItemForOrder(1:string serialNumber, 2:ScanType type, 3:i64 orderId, 4:i64 fulfilmentWarehouseId, 5:double quantity, 6:i64 billingWarehouseId) throws (1:WarehouseServiceException wex);
4496 mandeep.dh 187
 
188
    /**
189
     * Scan non-serialized items linked with an order.
190
     */
5361 mandeep.dh 191
    InventoryItem scanForOrder(1:InventoryItem inventoryItem, 2:ScanType type, 3:i64 quantity, 4:i64 orderId, 5:i64 fulfilmentWarehouseId, 6:i64 billingWarehouseId) throws (1:WarehouseServiceException wex);
4496 mandeep.dh 192
 
193
    /**
194
     * Created item number to item id mapping
195
     */
196
    void createItemNumberMapping(1:string itemNumber, 2:i64 itemId);
4618 amit.gupta 197
 
198
    /**
199
     * Get itemNumber mappings for itemId 
200
     */
201
    list<string> getItemNumbers(1:i64 itemId);
5110 mandeep.dh 202
 
203
    /**
204
     * Gets item ids for a given item number
205
     */
206
    list<i64> getItemIds(1:string itemNumber);
5185 mandeep.dh 207
 
208
    /**
209
     * Retrieves all inventory items given a last scan type
210
     */
211
    list<InventoryItem> getInventoryItemsFromLastScanType(1:ScanType lastScanType) throws (1:WarehouseServiceException wex);
212
 
213
    /**
214
     * Retrieves inventory item given a inventoryItem id
215
     */
5372 mandeep.dh 216
    InventoryItem getInventoryItemFromId(1:i64 inventoryItemId) throws (1:WarehouseServiceException wex);
217
 
218
    /**
219
     * Returns the purchase scans grouped by items for Purchase register reconciliation
220
     */
221
    list<DetailedPurchaseScan> getPurchaseScans(1:i64 startDate, 2:i64 endDate);
5496 mandeep.dh 222
 
223
    /**
7210 amar.kumar 224
     * Returns the purchase scans between grn dates grouped by items for Purchase register reconciliation 
225
     */
226
    list<DetailedPurchaseScan> getPurchaseScansByGrnDate(1:i64 startDate, 2:i64 endDate);
10215 amar.kumar 227
 
228
    /**
229
     * Returns the empty grn-ids between grn dates 
230
     */
231
    list<i64> getEmptyGrnsByDate(1:i64 startDate, 2:i64 endDate);
7210 amar.kumar 232
 
233
    /**
5496 mandeep.dh 234
     * Returns the invoices and the count of scans against on a given day.
235
     */
236
     list<InvoiceScan> fetchScansPerInvoiceNumber(1:i64 date);
5620 mandeep.dh 237
 
238
     /**
239
      * Returns inventory item for a given order
240
      */
241
     InventoryItem getInventoryItemFromOrder(1:i64 orderId) throws (1:WarehouseServiceException we);
5711 mandeep.dh 242
 
243
     /**
244
      * Fetches the stock inventory age week-wise
245
      */
246
     list<InventoryAge> getInventoryAge();
6322 amar.kumar 247
 
248
	 /**
249
      * Fetches the scanRecords for a given item for a given time interval 
250
      */
251
     list<Scan> getInventoryScansForItem(1:i64 itemId, 2:i64 fromDate, 3:i64 toDate);
252
 
253
     /**
254
      * Fetches the scanRecords for a given serialNumber for a given time interval 
255
      */
7410 amar.kumar 256
     list<Scan> getScanRecordsForSerialNumber(1:string serialNumber);
6322 amar.kumar 257
 
6467 amar.kumar 258
     /**
6548 amar.kumar 259
      * Inserts outgoing scans for Returned Items and updates returnId in InventoryItems
6467 amar.kumar 260
      */
7718 amar.kumar 261
     void scanForPurchaseReturn(1:list<InventoryItem> saleReturnItems, 2:i64 vendorId, 3:i64 billingWarehouseId) throws (1:WarehouseServiceException ex);
6322 amar.kumar 262
 
6548 amar.kumar 263
     /**
264
      * Inserts scans for lost Items and updates lastScanType in InventoryItems
265
      */
7718 amar.kumar 266
     void scanForLostItem(1:list<InventoryItem> lostItems, 2:i64 vendorId, 3:i64 billingWarehouseId) throws (1:WarehouseServiceException ex);
6548 amar.kumar 267
 
268
     /**
269
      * Get inventory count for available Serialized items in our warehouses using entries in ScanNew table
270
      */
7676 amar.kumar 271
     list<InventoryAvailability> getCurrentSerializedInventoryByScans(1:i64 physicalWarehouseId);
6630 amar.kumar 272
 
273
      /**
274
      * Get inventory count for available Serialized items in our warehouses using entries in ScanNew table
275
      */
7676 amar.kumar 276
     list<InventoryAvailability> getCurrentNonSerializedInventoryByScans(1:i64 physicalWarehouseId);
6630 amar.kumar 277
 
6762 amar.kumar 278
     /**
279
      * Get inventory for Serialized items in our warehouses at a given date using entries in ScanNew table
280
      */
281
     list<InventoryAvailability> getHistoricSerializedInventoryByScans(1:i64 date);
282
 
283
      /**
284
      * Get inventory for Non Serialized items in our warehouses at a given date using entries in ScanNew table
285
      */
286
     list<InventoryAvailability> getHistoricNonSerializedInventoryByScans(1:i64 date);
10308 amar.kumar 287
 
288
     /**
289
      * Get inventory for Serialized items in our warehouses at a given date using entries in ScanNew table
290
      */
291
     list<InventoryAvailability> getOurHistoricSerializedInventoryByScans(1:i64 date);
6762 amar.kumar 292
 
293
     /**
10308 amar.kumar 294
      * Get inventory for Non Serialized items in our warehouses at a given date using entries in ScanNew table
295
      */
296
     list<InventoryAvailability> getOurHistoricNonSerializedInventoryByScans(1:i64 date);
297
 
298
     /**
6880 amar.kumar 299
      * Insert Purchase/Sale Entries for product billed by Hotspot using OURS_EXTERNAL Billing
6762 amar.kumar 300
      */
7672 rajveer 301
     InventoryItem scanForOursExternalSale(1:i64 itemId, 2:string serialNumber, 3:string itemNumber, 4:string invoiceNumber, 5:i64 warehouseId, 6:double unitPrice, 7:double nlc, 8:i64 orderId)throws (1:WarehouseServiceException ex);
6762 amar.kumar 302
 
303
     /**
6880 amar.kumar 304
      * Insert Purchase_Ret/Sale_Ret Entries for product billed by Hotspot using OURS_EXTERNAL Billing
6762 amar.kumar 305
      */
7410 amar.kumar 306
     void scanForOursExternalSaleReturn(1:i64 orderId, 2:double unitPrice) throws (1:WarehouseServiceException ex);
6762 amar.kumar 307
 
10308 amar.kumar 308
     /**
309
      * This returns movement for each non serialized item in the specified window.(Doesn't include Hotspot and Amazon w/h)	
310
      */
6880 amar.kumar 311
     list<InventoryMovement> getMovementNonSerializedInventoryByScans(1:i64 startDate, 2:i64 endDate);
6762 amar.kumar 312
 
10308 amar.kumar 313
     /**
314
      * This returns movement for each serialized item in the specified window.(Doesn't include Hotspot and Amazon w/h)	
315
      */
6880 amar.kumar 316
     list<InventoryMovement> getMovementSerializedInventoryByScans(1:i64 startDate, 2:i64 endDate);
6762 amar.kumar 317
 
10308 amar.kumar 318
     /**
319
      * This returns movement for each serialized item in the specified window.(Doesn't include Amazon w/h)	
320
      */
7216 amar.kumar 321
     list<InventoryMovement> getCompleteMovementSerializedInventoryByScans(1:i64 startDate, 2:i64 endDate);
322
 
10308 amar.kumar 323
     /**
324
      * This returns movement for each non serialized item in the specified window.(Doesn't include Amazon w/h)	
325
      */
7216 amar.kumar 326
     list<InventoryMovement> getCompleteMovementNonSerializedInventoryByScans(1:i64 startDate, 2:i64 endDate);
327
 
7190 amar.kumar 328
     InventoryItem scanfreebie(1:i64 orderId, 2:i64 freebieItemId, 3:i64 freebieWarehouseId, 4:ScanType scanType) throws (1:WarehouseServiceException wex);
329
 
7199 amar.kumar 330
     void reshipfreebie(1:i64 oldOrderId, 2:i64 newOrderId, 3:i64 freebieItemId, 4:ScanType scanType) throws (1:WarehouseServiceException wex);
331
 
7410 amar.kumar 332
     bool isItemTransferAllowed(1:i64 warehouseId, 2:i64 transferWarehouseId);
333
 
334
     i64 createTransferLot(1:i64 originWarehouseId, 2:i64 destWarehouseId) throws (1:WarehouseServiceException wex);
335
 
336
     TransferLot getTransferLot(1:i64 transferLotId) throws (1:WarehouseServiceException wex);
337
 
338
	 void markTransferLotAsReceived(1:i64 id, 2:string remoteTransferRefNumber) throws (1:WarehouseServiceException wex);
339
 
340
	 list<TransferLot> getTransferLotsByDate(1:i64 fromDate, 2:i64 toDate) throws (1:WarehouseServiceException wex);
341
 
342
	 list<i64> getAllowedDestinationWarehousesForTransfer(1:i64 warehouseId);
343
 
344
	 map<i64, i64> getItemsInTransferLot(1:i64 transferLotId);
345
 
346
	 void markItemsAsReceivedForTransferLot(1:i64 id) throws (1:WarehouseServiceException wex);
347
 
348
	 TransferLotStatus updateTransferLotAfterItemReceive(1:i64 id) throws (1:WarehouseServiceException wex);
349
 
7453 amar.kumar 350
	 void scanForTransferOut(1:list<InventoryItem> inventoryItems, 2:ScanType type, 3:i64 transferLotId) throws (1:WarehouseServiceException wex);
351
 
352
	 void scanForTransferIn(1:list<InventoryItem> inventoryItems, 2:ScanType type, 3:i64 transferLotId) throws (1:WarehouseServiceException wex);
353
 
7574 amar.kumar 354
	 void scanForOursThirdPartyReceive(1:list<InventoryItem>inventoryItems, 2:i64 id) throws (1:WarehouseServiceException wex);
355
 
7613 amar.kumar 356
	 i64 getCurrentQuantityForNonSerializedInTransitItemInPhysicalWarehouse(1:i64 itemId, 2:i64 physicalWarehouseId) throws (1:WarehouseServiceException wex);
357
 
358
	 list<InTransitInventory> getInTransitInventory(1:i64 originWarehouseId);
7957 amar.kumar 359
 
7968 amar.kumar 360
	 bool isItemAvailableForSale(1:i64 itemId, 2:string serialNumber, 3:i64 warehouseId) throws (1:WarehouseServiceException wex);
7957 amar.kumar 361
 
362
	 /**
363
	 * Get inventory for Non Serialized items in our warehouses at a given date using entries in ScanNew table
364
	 */
365
     list<InventoryAvailability> getHistoricBadInventoryByScans(1:i64 date) throws (1:WarehouseServiceException wex);
8565 amar.kumar 366
 
8717 amar.kumar 367
     InventoryItem scanForBadSale(1:string serialNumber, 2:string itemNumber, 3:i64 itemId, 4:i64 orderId, 5:i64 fulfilmentWarehouseId, 6:i64 quantity, 7:i64 billingWarehouseId) throws (1:WarehouseServiceException wex);
10120 manish.sha 368
 
369
	 list<InventoryItem> getTransferLotItemsForMarkReceive(1:i64 transferLotId, 2:ScanType scanType) throws (1:WarehouseServiceException wex);
370
 
371
	 void markItemsAsReceivedForTransferLotPartial(1:list<InventoryItem> inventoryItems, 2:i64 transferLotId) throws (1:WarehouseServiceException wex);
372
 
373
	 void markTransferLotAsReceivedPartial(1:i64 id, 2:string remoteTransferRefNumber) throws (1:WarehouseServiceException wex);
374
 
7574 amar.kumar 375
}
376