Subversion Repositories SmartDukaan

Rev

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