Subversion Repositories SmartDukaan

Rev

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