Subversion Repositories SmartDukaan

Rev

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