Subversion Repositories SmartDukaan

Rev

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