Subversion Repositories SmartDukaan

Rev

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