Subversion Repositories SmartDukaan

Rev

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