Subversion Repositories SmartDukaan

Rev

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