Subversion Repositories SmartDukaan

Rev

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