Subversion Repositories SmartDukaan

Rev

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