Subversion Repositories SmartDukaan

Rev

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