Subversion Repositories SmartDukaan

Rev

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