Subversion Repositories SmartDukaan

Rev

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