Subversion Repositories SmartDukaan

Rev

Rev 10308 | Rev 10689 | 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
 
7410 amar.kumar 145
struct PossibleWarehouseMovement {
146
	1:i64 fromWarehouseId,
147
	2:i64 toWarehouseId
148
}
149
 
150
struct TransferLot {
151
	1:i64 id,
152
	2:i64 originWarehouseId,
153
	3:i64 destinationWarehouseId,
154
	4:TransferLotStatus status,
155
	5:i64 transferDate,
156
	6:TransferType type,
157
	7:string transitCompletionReferenceNumber,
158
	8:i64 referenceUpdationDate
159
	9:string remarks,
160
}
161
 
4496 mandeep.dh 162
exception WarehouseServiceException {
163
    1:GenericService.ExceptionType exceptionType,
164
    2:string message
2820 chandransh 165
}
166
 
6548 amar.kumar 167
 
4496 mandeep.dh 168
service WarehouseService extends GenericService.GenericService {
169
    /**
170
     * Retrieves serialized inventory item given a serial number
171
     */
4541 mandeep.dh 172
    InventoryItem getInventoryItem(1:string serialNumber) throws (1:WarehouseServiceException wex);
2820 chandransh 173
 
4496 mandeep.dh 174
    /**
5361 mandeep.dh 175
     * Retrieves non-serialized inventory item from a given supplier
4496 mandeep.dh 176
     */
8565 amar.kumar 177
    InventoryItem getNonSeralizedInventoryItem(1:string itemNumber, 2:i64 itemId, 3:i64 fulfilmentWarehouseId, 4:i64 billingWarehouseId) throws (1:WarehouseServiceException wex);
3383 chandransh 178
 
4496 mandeep.dh 179
    /**
180
     * Scan non-serialized items.
181
     */
7410 amar.kumar 182
    void scan(1:InventoryItem inventoryItem, 2:ScanType type, 3:i64 quantity, 4:i64 billingWarehouseId, 5:i64 transferLotId) throws (1:WarehouseServiceException wex);
10489 amar.kumar 183
 
184
    /**
185
     * Scan non-serialized items.
186
     */
187
    void genericScan(1:InventoryItem inventoryItem, 2:Scan scan) throws (1:WarehouseServiceException wex);
4496 mandeep.dh 188
 
189
    /**
190
     * Scan serialized items linked with an order. Returns its price.
191
     */
5110 mandeep.dh 192
    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 193
 
194
    /**
195
     * Scan non-serialized items linked with an order.
196
     */
5361 mandeep.dh 197
    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 198
 
199
    /**
200
     * Created item number to item id mapping
201
     */
202
    void createItemNumberMapping(1:string itemNumber, 2:i64 itemId);
4618 amit.gupta 203
 
204
    /**
205
     * Get itemNumber mappings for itemId 
206
     */
207
    list<string> getItemNumbers(1:i64 itemId);
5110 mandeep.dh 208
 
209
    /**
210
     * Gets item ids for a given item number
211
     */
212
    list<i64> getItemIds(1:string itemNumber);
5185 mandeep.dh 213
 
214
    /**
215
     * Retrieves all inventory items given a last scan type
216
     */
217
    list<InventoryItem> getInventoryItemsFromLastScanType(1:ScanType lastScanType) throws (1:WarehouseServiceException wex);
218
 
219
    /**
220
     * Retrieves inventory item given a inventoryItem id
221
     */
5372 mandeep.dh 222
    InventoryItem getInventoryItemFromId(1:i64 inventoryItemId) throws (1:WarehouseServiceException wex);
223
 
224
    /**
225
     * Returns the purchase scans grouped by items for Purchase register reconciliation
226
     */
227
    list<DetailedPurchaseScan> getPurchaseScans(1:i64 startDate, 2:i64 endDate);
5496 mandeep.dh 228
 
229
    /**
7210 amar.kumar 230
     * Returns the purchase scans between grn dates grouped by items for Purchase register reconciliation 
231
     */
232
    list<DetailedPurchaseScan> getPurchaseScansByGrnDate(1:i64 startDate, 2:i64 endDate);
10215 amar.kumar 233
 
234
    /**
235
     * Returns the empty grn-ids between grn dates 
236
     */
237
    list<i64> getEmptyGrnsByDate(1:i64 startDate, 2:i64 endDate);
7210 amar.kumar 238
 
239
    /**
5496 mandeep.dh 240
     * Returns the invoices and the count of scans against on a given day.
241
     */
242
     list<InvoiceScan> fetchScansPerInvoiceNumber(1:i64 date);
5620 mandeep.dh 243
 
244
     /**
245
      * Returns inventory item for a given order
246
      */
247
     InventoryItem getInventoryItemFromOrder(1:i64 orderId) throws (1:WarehouseServiceException we);
5711 mandeep.dh 248
 
249
     /**
250
      * Fetches the stock inventory age week-wise
251
      */
252
     list<InventoryAge> getInventoryAge();
6322 amar.kumar 253
 
254
	 /**
255
      * Fetches the scanRecords for a given item for a given time interval 
256
      */
257
     list<Scan> getInventoryScansForItem(1:i64 itemId, 2:i64 fromDate, 3:i64 toDate);
258
 
259
     /**
260
      * Fetches the scanRecords for a given serialNumber for a given time interval 
261
      */
7410 amar.kumar 262
     list<Scan> getScanRecordsForSerialNumber(1:string serialNumber);
6322 amar.kumar 263
 
6467 amar.kumar 264
     /**
6548 amar.kumar 265
      * Inserts outgoing scans for Returned Items and updates returnId in InventoryItems
6467 amar.kumar 266
      */
7718 amar.kumar 267
     void scanForPurchaseReturn(1:list<InventoryItem> saleReturnItems, 2:i64 vendorId, 3:i64 billingWarehouseId) throws (1:WarehouseServiceException ex);
6322 amar.kumar 268
 
6548 amar.kumar 269
     /**
270
      * Inserts scans for lost Items and updates lastScanType in InventoryItems
271
      */
7718 amar.kumar 272
     void scanForLostItem(1:list<InventoryItem> lostItems, 2:i64 vendorId, 3:i64 billingWarehouseId) throws (1:WarehouseServiceException ex);
6548 amar.kumar 273
 
274
     /**
275
      * Get inventory count for available Serialized items in our warehouses using entries in ScanNew table
276
      */
7676 amar.kumar 277
     list<InventoryAvailability> getCurrentSerializedInventoryByScans(1:i64 physicalWarehouseId);
6630 amar.kumar 278
 
279
      /**
280
      * Get inventory count for available Serialized items in our warehouses using entries in ScanNew table
281
      */
7676 amar.kumar 282
     list<InventoryAvailability> getCurrentNonSerializedInventoryByScans(1:i64 physicalWarehouseId);
6630 amar.kumar 283
 
6762 amar.kumar 284
     /**
285
      * Get inventory for Serialized items in our warehouses at a given date using entries in ScanNew table
286
      */
287
     list<InventoryAvailability> getHistoricSerializedInventoryByScans(1:i64 date);
288
 
289
      /**
290
      * Get inventory for Non Serialized items in our warehouses at a given date using entries in ScanNew table
291
      */
292
     list<InventoryAvailability> getHistoricNonSerializedInventoryByScans(1:i64 date);
10308 amar.kumar 293
 
294
     /**
295
      * Get inventory for Serialized items in our warehouses at a given date using entries in ScanNew table
296
      */
297
     list<InventoryAvailability> getOurHistoricSerializedInventoryByScans(1:i64 date);
6762 amar.kumar 298
 
299
     /**
10308 amar.kumar 300
      * Get inventory for Non Serialized items in our warehouses at a given date using entries in ScanNew table
301
      */
302
     list<InventoryAvailability> getOurHistoricNonSerializedInventoryByScans(1:i64 date);
303
 
304
     /**
6880 amar.kumar 305
      * Insert Purchase/Sale Entries for product billed by Hotspot using OURS_EXTERNAL Billing
6762 amar.kumar 306
      */
7672 rajveer 307
     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 308
 
309
     /**
6880 amar.kumar 310
      * Insert Purchase_Ret/Sale_Ret Entries for product billed by Hotspot using OURS_EXTERNAL Billing
6762 amar.kumar 311
      */
7410 amar.kumar 312
     void scanForOursExternalSaleReturn(1:i64 orderId, 2:double unitPrice) throws (1:WarehouseServiceException ex);
6762 amar.kumar 313
 
10308 amar.kumar 314
     /**
315
      * This returns movement for each non serialized item in the specified window.(Doesn't include Hotspot and Amazon w/h)	
316
      */
6880 amar.kumar 317
     list<InventoryMovement> getMovementNonSerializedInventoryByScans(1:i64 startDate, 2:i64 endDate);
6762 amar.kumar 318
 
10308 amar.kumar 319
     /**
320
      * This returns movement for each serialized item in the specified window.(Doesn't include Hotspot and Amazon w/h)	
321
      */
6880 amar.kumar 322
     list<InventoryMovement> getMovementSerializedInventoryByScans(1:i64 startDate, 2:i64 endDate);
6762 amar.kumar 323
 
10308 amar.kumar 324
     /**
325
      * This returns movement for each serialized item in the specified window.(Doesn't include Amazon w/h)	
326
      */
7216 amar.kumar 327
     list<InventoryMovement> getCompleteMovementSerializedInventoryByScans(1:i64 startDate, 2:i64 endDate);
328
 
10308 amar.kumar 329
     /**
330
      * This returns movement for each non serialized item in the specified window.(Doesn't include Amazon w/h)	
331
      */
7216 amar.kumar 332
     list<InventoryMovement> getCompleteMovementNonSerializedInventoryByScans(1:i64 startDate, 2:i64 endDate);
333
 
7190 amar.kumar 334
     InventoryItem scanfreebie(1:i64 orderId, 2:i64 freebieItemId, 3:i64 freebieWarehouseId, 4:ScanType scanType) throws (1:WarehouseServiceException wex);
335
 
7199 amar.kumar 336
     void reshipfreebie(1:i64 oldOrderId, 2:i64 newOrderId, 3:i64 freebieItemId, 4:ScanType scanType) throws (1:WarehouseServiceException wex);
337
 
7410 amar.kumar 338
     bool isItemTransferAllowed(1:i64 warehouseId, 2:i64 transferWarehouseId);
339
 
340
     i64 createTransferLot(1:i64 originWarehouseId, 2:i64 destWarehouseId) throws (1:WarehouseServiceException wex);
341
 
342
     TransferLot getTransferLot(1:i64 transferLotId) throws (1:WarehouseServiceException wex);
343
 
344
	 void markTransferLotAsReceived(1:i64 id, 2:string remoteTransferRefNumber) throws (1:WarehouseServiceException wex);
345
 
346
	 list<TransferLot> getTransferLotsByDate(1:i64 fromDate, 2:i64 toDate) throws (1:WarehouseServiceException wex);
347
 
348
	 list<i64> getAllowedDestinationWarehousesForTransfer(1:i64 warehouseId);
349
 
350
	 map<i64, i64> getItemsInTransferLot(1:i64 transferLotId);
351
 
352
	 void markItemsAsReceivedForTransferLot(1:i64 id) throws (1:WarehouseServiceException wex);
353
 
354
	 TransferLotStatus updateTransferLotAfterItemReceive(1:i64 id) throws (1:WarehouseServiceException wex);
355
 
7453 amar.kumar 356
	 void scanForTransferOut(1:list<InventoryItem> inventoryItems, 2:ScanType type, 3:i64 transferLotId) throws (1:WarehouseServiceException wex);
357
 
358
	 void scanForTransferIn(1:list<InventoryItem> inventoryItems, 2:ScanType type, 3:i64 transferLotId) throws (1:WarehouseServiceException wex);
359
 
7574 amar.kumar 360
	 void scanForOursThirdPartyReceive(1:list<InventoryItem>inventoryItems, 2:i64 id) throws (1:WarehouseServiceException wex);
361
 
7613 amar.kumar 362
	 i64 getCurrentQuantityForNonSerializedInTransitItemInPhysicalWarehouse(1:i64 itemId, 2:i64 physicalWarehouseId) throws (1:WarehouseServiceException wex);
363
 
364
	 list<InTransitInventory> getInTransitInventory(1:i64 originWarehouseId);
7957 amar.kumar 365
 
7968 amar.kumar 366
	 bool isItemAvailableForSale(1:i64 itemId, 2:string serialNumber, 3:i64 warehouseId) throws (1:WarehouseServiceException wex);
7957 amar.kumar 367
 
368
	 /**
369
	 * Get inventory for Non Serialized items in our warehouses at a given date using entries in ScanNew table
370
	 */
371
     list<InventoryAvailability> getHistoricBadInventoryByScans(1:i64 date) throws (1:WarehouseServiceException wex);
8565 amar.kumar 372
 
8717 amar.kumar 373
     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 374
 
375
	 list<InventoryItem> getTransferLotItemsForMarkReceive(1:i64 transferLotId, 2:ScanType scanType) throws (1:WarehouseServiceException wex);
376
 
377
	 void markItemsAsReceivedForTransferLotPartial(1:list<InventoryItem> inventoryItems, 2:i64 transferLotId) throws (1:WarehouseServiceException wex);
378
 
379
	 void markTransferLotAsReceivedPartial(1:i64 id, 2:string remoteTransferRefNumber) throws (1:WarehouseServiceException wex);
380
 
7574 amar.kumar 381
}
382