Subversion Repositories SmartDukaan

Rev

Rev 17990 | Rev 19413 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
5945 mandeep.dh 1
namespace java in.shop2020.model.v1.inventory
2
namespace py shop2020.thriftpy.model.v1.inventory
3
 
4
include "GenericService.thrift"
5
 
11173 vikram.rag 6
enum AmazonFCWarehouseLocation {
7
	Mumbai = 0,
12872 amit.gupta 8
	Bangalore = 1,
17990 kshitij.so 9
	Gurgaon = 2,
10
	Delhi = 3
11173 vikram.rag 11
}
12
 
5945 mandeep.dh 13
enum WarehouseLocation {
7808 anupam.sin 14
	Delhi = 0,
15
	Mumbai = 1,
12783 manish.sha 16
	Karnataka = 2,
17
	Haryana = 3,
18
	Rajasthan = 4,
12913 manish.sha 19
	Telangana = 5,
20
	Gujrat = 6
5945 mandeep.dh 21
}
22
 
23
struct Vendor {
24
	1:i64 id,
25
	2:string name
26
}
27
 
12280 amit.gupta 28
enum VatType {
29
	SP = 0,
30
	MRP = 1
31
}
32
 
5945 mandeep.dh 33
enum BillingType {
34
	OURS = 0,
6725 rajveer 35
	EXTERNAL = 1,
36
	OURS_EXTERNAL = 2
5945 mandeep.dh 37
}
38
 
39
enum WarehouseType {
40
    OURS = 0,
7410 amar.kumar 41
    THIRD_PARTY = 1,
42
    OURS_THIRDPARTY = 2
5945 mandeep.dh 43
}
44
 
45
enum InventoryType {
46
    GOOD = 0,
47
    BAD = 1,
48
    VIRTUAL = 2
49
}
50
 
51
enum HolidayType {
52
	WEEKLY = 0,
53
	MONTHLY = 1,
54
	SPECIFIC = 2
55
}
56
 
57
/* 
58
Warehouse fields details
59
location: it is full address
60
vendorString: some key for the warehouse
61
*/
62
struct Warehouse {
63
	1:i64 id,
64
	2:string displayName,
65
	3:string location,
66
	5:i64 addedOn,
67
	6:i64 lastCheckedOn,
68
	7:string tinNumber,
69
	8:string pincode,
70
	9:string vendorString,
71
	10:WarehouseLocation logisticsLocation,
72
	12:BillingType billingType,
73
	13:WarehouseType warehouseType,
74
	14:InventoryType inventoryType,
75
	15:Vendor vendor,
76
	16:i64 shippingWarehouseId,
77
	17:i64 billingWarehouseId,
78
	18:bool isAvailabilityMonitored,
7330 amit.gupta 79
	19:i64 transferDelayInHours,
12357 manish.sha 80
	20:i64 stateId,
81
	21:i64 source
5945 mandeep.dh 82
}
83
 
12280 amit.gupta 84
struct StateInfo{
85
	1:i64 id,
86
	2:string stateName,
87
	3:VatType vatType
88
}
89
 
90
 
5945 mandeep.dh 91
/* */
92
struct ItemInventory{
93
	1:i64 id,
94
	2:map<i64,i64> availability,
8182 amar.kumar 95
	3:map<i64,i64> reserved,
96
	4:map<i64,i64> held
5945 mandeep.dh 97
}
98
 
99
struct ItemInventoryHistory{
100
	1:i64 item_id,
101
	2:i64 warehouse_id,
102
	3:i64 timestamp,
103
	4:i64 availability
104
}
105
 
106
struct VendorItemPricing{
107
	1:i64 vendorId,
108
	2:i64 itemId,
109
	3:double transferPrice,
110
	4:double mop,
6747 amar.kumar 111
	5:double dealerPrice,
112
	6:double nlc
5945 mandeep.dh 113
}
114
 
115
struct VendorItemMapping{
116
	1:i64 vendorId,
117
	2:string itemKey,
118
	3:i64 itemId
119
}
120
 
121
struct AvailableAndReservedStock {
122
	1:i64 itemId,
123
	2:i64 available,
124
	3:i64 reserved,
125
	4:i64 minimumStock
126
}
127
 
6531 vikram.rag 128
struct IgnoredInventoryUpdateItems {
129
	1:i64 itemId,
130
	2:i64 warehouseId
6821 amar.kumar 131
}
132
 
133
struct ItemStockPurchaseParams{
134
	1:i64 item_id,
135
	2:i32 numOfDaysStock,
136
	3:i64 minStockLevel
137
}
138
 
5945 mandeep.dh 139
exception InventoryServiceException{
140
	1:i64 id,
141
	2:string message
142
}
143
 
6821 amar.kumar 144
struct OOSStatus {
145
	1:i64 item_id
146
	2:i64 date
147
	3:bool is_oos
148
	4:i64 num_orders
8182 amar.kumar 149
	5:i64 rto_orders
10126 amar.kumar 150
	6:i32 sourceId
6821 amar.kumar 151
}
7281 kshitij.so 152
 
153
struct AmazonInventorySnapshot {
154
    1:i64 item_id
155
    2:i64 availability
156
    3:i64 reserved
10450 vikram.rag 157
    4:bool is_oos
7281 kshitij.so 158
} 
159
 
8282 kshitij.so 160
struct AmazonFbaInventorySnapshot {
161
    1:i64 item_id
162
    2:i64 availability
11173 vikram.rag 163
    3:AmazonFCWarehouseLocation location
164
    4:i64 unfulfillable
165
    5:i64 reserved
166
    6:i64 inbound
8282 kshitij.so 167
}
168
 
8182 amar.kumar 169
struct HoldInventoryDetail {
170
	1:i64 item_id
171
	2:i64 warehouse_id
172
	3:i64 held
173
	4:i64 source
174
}
175
 
9404 vikram.rag 176
struct SnapdealInventoryItem{
177
	1:i64 item_id
178
	2:i64 availability
179
	3:i64 lastUpdatedOnSnapdeal
9495 vikram.rag 180
	4:i64 pendingOrders
10450 vikram.rag 181
	5:bool is_oos
9404 vikram.rag 182
}
183
 
10050 vikram.rag 184
struct FlipkartInventorySnapshot{
185
	1:i64 item_id
186
	2:i64 availability
187
	3:i64 createdOrders
188
	4:i64 heldOrders
10450 vikram.rag 189
	5:bool is_oos
10050 vikram.rag 190
}
9404 vikram.rag 191
 
10547 vikram.rag 192
struct SnapdealStockAtEOD{
193
	1:i64 item_id
194
	2:i64 availability
195
	3:i64 date
196
}
10050 vikram.rag 197
 
10547 vikram.rag 198
struct FlipkartStockAtEOD{
199
	1:i64 item_id
200
	2:i64 availability
201
	3:i64 date
202
}
203
 
12357 manish.sha 204
struct StockWeightedNlcInfo{
205
	1:i64 itemId,
206
	2:i64 source,
207
	3:i64 updatedTimestamp,
208
	4:i64 stockQuantity,
209
	5:string grnDetail,
210
	6:double avgWeightedNlc
211
}
10547 vikram.rag 212
 
19247 kshitij.so 213
struct BulkAddInventory{
214
	1:i64 item_id,
215
	2:i64 warehouse_id,
216
	3:i64 inventory
217
}
10547 vikram.rag 218
 
19247 kshitij.so 219
 
5945 mandeep.dh 220
service InventoryService extends GenericService.GenericService{
221
 
222
	i64 addWarehouse(1:Warehouse warehouse) throws (1:InventoryServiceException cex),
223
 
224
	/**
225
	add a new vendor
226
	*/
227
	i64 addVendor(1:Vendor vendor) throws (1:InventoryServiceException cex),
228
 
229
	/**
230
	Stores the incremental warehouse updates of items.
231
	*/
232
	void updateInventoryHistory(1:i64 warehouse_id, 2:string timestamp, 3:map<string, i64> availability) throws (1:InventoryServiceException cex),
233
 
234
	/**
235
	Stores the final inventory stocks of items.
236
	*/
237
	void updateInventory(1:i64 warehouse_id, 2:string timestamp, 3:map<string, i64> availability) throws (1:InventoryServiceException cex),
238
 
239
	/**
240
	Add the inventory to existing stock.
241
	*/
242
	void addInventory(1:i64 itemId, 2:i64 warehouseId, 3:i64 quantity) throws (1:InventoryServiceException cex),
243
 
244
	//all delete methods
245
	void retireWarehouse(1:i64 warehouse_id) throws (1:InventoryServiceException cex),
246
 
247
	ItemInventory getItemInventoryByItemId(1:i64 item_id) throws (1:InventoryServiceException cex),
248
	i64 getItemAvailibilityAtWarehouse(1:i64 warehouse_id, 2:i64 item_id) throws (1:InventoryServiceException cex),
249
 
250
	/**
251
	Determines the warehouse that should be used to fulfil an order for the given item.
252
	It first checks all the warehouses which are in the logistics location given by the
253
	warehouse_loc parameter. If none of the warehouses there have any inventory, then the
254
	preferred warehouse for the item is used. 
255
 
256
	Returns an ordered list of size 4 with following elements in the given order:
257
	1. Id of the fulfillment warehouse which was finally picked up.
258
	2. Expected delay added by the category manager.
259
	3. Id of the billing warehouse which was finally picked up.
260
	 */
5978 rajveer 261
	list<i64> getItemAvailabilityAtLocation(1:i64 itemId, 2:i64 sourceId) throws (1:InventoryServiceException isex),
5945 mandeep.dh 262
 
263
	list<Warehouse> getAllWarehouses(1:bool isActive) throws (1:InventoryServiceException cex),
264
 
265
	/**
266
	 Returns the warehouse with the given id.
267
	*/
268
	Warehouse getWarehouse(1:i64 warehouse_id) throws (1:InventoryServiceException cex),
269
	list<i64> getAllItemsForWarehouse(1:i64 warehouse_id) throws (1:InventoryServiceException cex),
270
 
271
	/**
5966 rajveer 272
	Depending on reservation in the table, verify if we can bill this order or not.
273
	*/
274
	bool isOrderBillable(1:i64 itemId, 2:i64 warehouseId, 3:i64 sourceId, 4:i64 orderId),
275
 
276
	/**
5945 mandeep.dh 277
	 Increases the reservation count for an item in a warehouse. Should always succeed normally.
278
	*/
5966 rajveer 279
	bool reserveItemInWarehouse(1:i64 itemId, 2:i64 warehouseId, 3:i64 sourceId, 4:i64 orderId, 5:i64 createdTimestamp, 6:i64 promisedShippingTimestamp, 7:double quantity) throws (1:InventoryServiceException cex),
5945 mandeep.dh 280
 
281
	/**
7968 amar.kumar 282
	 Updates the reservation for Order
283
	*/
284
	bool updateReservationForOrder(1:i64 itemId, 2:i64 warehouseId, 3:i64 sourceId, 4:i64 orderId, 5:i64 createdTimestamp, 6:i64 promisedShippingTimestamp, 7:double quantity) throws (1:InventoryServiceException cex),
285
 
286
	/**
5945 mandeep.dh 287
	 Decreases the reservation count for an item in a warehouse. Should always succeed normally.
288
	*/
5966 rajveer 289
	bool reduceReservationCount(1:i64 itemId, 2:i64 warehouseId, 3:i64 sourceId, 4:i64 orderId, 5:double quantity) throws (1:InventoryServiceException cex),
5945 mandeep.dh 290
 
291
	/**
292
	Returns the pricing information of an item associated with the vendor of the given warehouse.
293
	Raises an exception if either the item, vendor or the associated pricing information can't be found.
294
	*/
295
	VendorItemPricing getItemPricing(1:i64 itemId, 2:i64 vendorId) throws (1:InventoryServiceException cex),
296
 
297
	/**
298
	Returns the list of vendor pricing information of an item.
299
	Raises an exception if item not found corresponding to itemId
300
	*/
301
	list<VendorItemPricing> getAllItemPricing(1:i64 itemId) throws (1:InventoryServiceException cex),
302
 
303
 
304
	/**
305
	Adds vendor prices corresponding to the item. If pricing already exists then updates the prices. 
306
	Raises an exception if either the item or vendor can't be found corresponding to their ids.
307
	*/
308
	void addVendorItemPricing(1:VendorItemPricing vendorItemPricing) throws (1:InventoryServiceException cex),
309
 
310
	/**
311
	Returns a vendor given its id
312
	*/
313
	Vendor getVendor(1:i64 vendorId), 
314
 
315
    /**
316
    Return list of all vendors
317
    */
318
    list<Vendor> getAllVendors(), 
319
 
320
	/**
321
	Adds VendorItemMapping. Updates VendorItemMapping if exists corresponding to the item key.  
322
	*/
323
	void addVendorItemMapping(1:string key, 2:VendorItemMapping vendorItemMapping) throws (1:InventoryServiceException cex),
324
 
325
	/**
326
	Returns the list of vendor item mapping corresponding to itemId passed as parameter.
327
	Raises an exception if item not found corresponding to itemId
328
	*/
329
	list<VendorItemMapping> getVendorItemMappings(1:i64 itemId) throws (1:InventoryServiceException cex),
330
 
331
	/**
332
	Returns a list of inventory stock for items for which there are pending orders for the given vendor.
333
	*/
334
	list<AvailableAndReservedStock> getPendingOrdersInventory(1:i64 vendorid),
335
 
336
	/**
337
	 This method returns all warehouses for a given warehosueType, inventoryType, vendor, billingWarehouse and shippingWarehouse.
338
	 getWarehouses(WarehouseType.OURS, InventoryType.GOOD, 3, 7, 7) would return ours warehouse with GOOD type inventory for vendor 1 for billing warehouse 7 and shipping warehouse 7
339
	 getWarehouses(WarehouseType.OURS, InventoryType.GOOD, 3, 7, 7) would return ours warehouse with GOOD type inventory for vendor 3 for billing warehouse 7 and shipping warehouse 7
340
     getWarehouses(null, null, 3, 7, 7) would return all type warehouses with all type inventory for vendor 3 for billing warehouse 7 and shipping warehouse 7
341
     getWarehouses(null, null, 0, 0, 7) would return all type warehouses with all type inventory for all vendors for all billing warehouses at shipping warehouse 7
342
	 */
343
	list<Warehouse> getWarehouses(1:WarehouseType warehouseType, 2:InventoryType inventoryType, 3:i64 vendorId, 4:i64 billingWarehouseId, 5:i64 shippingWarehouseId);
344
 
345
    /**
346
     * Resets availability of an item to the quantity mentioned in a warehouse.
347
     */
348
    void resetAvailability(1:string itemKey, 2:i64 vendorId, 3:i64 quantity, 4:i64 warehouseId) throws (1:InventoryServiceException cex);
349
 
350
    /**
351
     * Resets availability of a warehouse to zero.
352
     */
353
    void resetAvailabilityForWarehouse(1:i64 warehouseId) throws (1:InventoryServiceException cex);
354
 
355
    /**
356
     * Returns the list of item keys which need to be processed for a given warehouse.
357
     * This is currently used by Support application to send item keys whose inventory needs 
358
     * to be updated from PLB
359
     */
360
    list<string> getItemKeysToBeProcessed(1:i64 warehouseId);
361
 
362
    /**
363
     * Marks/Deletes missed inventory updates for a given key and warehouse.
364
     * This generally happens when updates from PLB are applied on the currentinventorysnapshot for an item
365
     */
366
    void markMissedInventoryUpdatesAsProcessed(1:string itemKey, 2:i64 warehouseId);
367
 
368
    /**
369
     * Returns all the item key mappings that have been ignored until date. Value of map has the warehouse id
370
     * and the timestamp from where alert was raised.
371
     */
372
    map<string, map<i64, i64>> getIgnoredItemKeys();
373
 
374
    /**
375
    Add the BAD type inventory to existing stock.
376
    */
377
    void addBadInventory(1:i64 itemId, 2:i64 warehouseId, 3:i64 quantity) throws (1:InventoryServiceException cex);
378
 
379
    /**
380
    Returns all shipping locations
381
    */    
382
    list<Warehouse> getShippingLocations();
383
 
384
    /**
385
     * Fetches all the vendor item mappings present.
386
     */    
387
    list<VendorItemMapping> getAllVendorItemMappings();
388
 
389
    /**
390
     * Gets items' inventory for a warehouse
391
     * If warehouse is passed as zero, items' inventory across all warehouses is sent
392
     */
393
    map<i64, ItemInventory> getInventorySnapshot(1:i64 warehouseId);
394
 
395
    /**
396
    * Clear item availability cache.
397
    */
398
    void clearItemAvailabilityCache();
399
 
400
    void updateVendorString(1:i64 warehouseId, 2:string vendorString);
6096 amit.gupta 401
 
402
    void clearItemAvailabilityCacheForItem(1:i64 item_id);
6467 amar.kumar 403
 
7718 amar.kumar 404
    i64 getOurWarehouseIdForVendor(1:i64 vendorId, 2:i64 billingWarehouseId);
6484 amar.kumar 405
 
406
    map<i64, i64> getItemAvailabilitiesAtOurWarehouses(1:list<i64> item_ids);
6531 vikram.rag 407
 
408
    list<i64> getMonitoredWarehouseForVendors(1:list<i64> vendorIds);
409
 
410
    list<IgnoredInventoryUpdateItems> getIgnoredWarehouseidsAndItemids();
411
 
412
    bool insertItemtoIgnoreInventoryUpdatelist(1:i64 item_id,2:i64 warehouse_id);
413
 
414
    bool deleteItemFromIgnoredInventoryUpdateList(1:i64 item_id,2:i64 warehouse_id);
415
 
416
    i32 getAllIgnoredInventoryupdateItemsCount();
417
 
418
    list<i64> getIgnoredInventoryUpdateItemids(1:i32 offset,2:i32 limit);
419
 
6821 amar.kumar 420
    void updateItemStockPurchaseParams(1:i64 item_id, 2:i32 numOfDaysStock, 3:i64 minStockLevel);
421
 
422
    ItemStockPurchaseParams getItemStockPurchaseParams(1:i64 itemId);
423
 
424
    void addOosStatusForItem(1:map<i64, bool> oosStatusMap, 2: i64 date);
6832 amar.kumar 425
 
9665 rajveer 426
    list<OOSStatus> getOosStatusesForXDaysForItem(1:i64 itemId, 2:i32 sourceId, 3:i32 days);
6857 amar.kumar 427
 
10126 amar.kumar 428
    list<OOSStatus> getOosStatusesForXDays(1:i32 sourceId, 2:i32 days);
429
 
430
    list<VendorItemPricing> getAllVendorItemPricing(1:i64 itemId, 2:i64 vendorId);
431
 
6857 amar.kumar 432
    list<ItemStockPurchaseParams> getNonZeroItemStockPurchaseParams();
7149 amar.kumar 433
 
434
    /**
435
	Returns a list of inventory stock for items for which there are pending orders or have billable inventory.
436
	*/
437
	list<AvailableAndReservedStock> getBillableInventoryAndPendingOrders();
7281 kshitij.so 438
 
439
	string getWarehouseName(1:i64 warehouse_id);
440
 
441
	AmazonInventorySnapshot getAmazonInventoryForItem(1:i64 item_id);
442
 
443
	list<AmazonInventorySnapshot> getAllAmazonInventory();
444
 
10450 vikram.rag 445
	void addOrUpdateAmazonInventoryForItem(1:AmazonInventorySnapshot amazonInventorySnapshot,2:i64 time);
7281 kshitij.so 446
 
7972 amar.kumar 447
	string getLastNdaySaleForItem(1:i64 itemId, 2:i64 numberOfDays);
448
 
8282 kshitij.so 449
	void addOrUpdateAmazonFbaInventory(1:AmazonFbaInventorySnapshot amazonfbainventorysnapshot);
9482 vikram.rag 450
 
9762 amar.kumar 451
	void addUpdateHoldInventory(1:i64 itemId, 2:i64 warehouseId, 3:i64 holdQuantity, 4:i64 source)  throws (1:InventoryServiceException cex);
8182 amar.kumar 452
 
11173 vikram.rag 453
	list<AmazonFbaInventorySnapshot> getAmazonFbaItemInventory(1:i64 itemId);
8282 kshitij.so 454
 
9404 vikram.rag 455
	list<AmazonFbaInventorySnapshot> getAllAmazonFbaItemInventory();
8282 kshitij.so 456
 
9404 vikram.rag 457
	list<i64> getOursGoodWarehouseIdsForLocation(1:i64 state_id);
8363 vikram.rag 458
 
9404 vikram.rag 459
	i64 getHoldInventoryDetailForItemForWarehouseIdExceptSource(1:i64 id,2:i64 warehouse_id,3:i64 source);
8959 vikram.rag 460
 
9404 vikram.rag 461
	SnapdealInventoryItem getSnapdealInventoryForItem(1:i64 item_id);
462
 
463
	void addOrUpdateSnapdealInventoryForItem(1:SnapdealInventoryItem snapdealinventoryitem)
464
 
465
	double getNlcForWarehouse(1:i64 warehouse_id,2:i64 item_id)
466
 
9640 amar.kumar 467
	map<i32, i64> getHeldInventoryMapForItem(1:i64 item_id, 2:i64 warehouse_id)
468
 
9495 vikram.rag 469
	void addOrUpdateAllAmazonFbaInventory(list<AmazonFbaInventorySnapshot> allamazonfbainventorysnapshot)
9456 vikram.rag 470
 
9495 vikram.rag 471
	void addOrUpdateAllSnapdealInventory(list<SnapdealInventoryItem> allsnapdealinventorysnapshot)
9482 vikram.rag 472
 
9495 vikram.rag 473
	list<SnapdealInventoryItem> getSnapdealInventorySnapshot()
474
 
9761 amar.kumar 475
	list<HoldInventoryDetail> getHoldInventoryDetails(1:i64 itemId, 2:i64 warehouseId, 3:i64 source)
476
 
10450 vikram.rag 477
	void addOrUpdateFlipkartInventorySnapshot(1:list<FlipkartInventorySnapshot> flipkartInventorySnapshot,2:i64 time)
10050 vikram.rag 478
 
479
	list<FlipkartInventorySnapshot> getFlipkartInventorySnapshot()
480
 
10097 kshitij.so 481
	FlipkartInventorySnapshot getFlipkartlInventoryForItem(1:i64 item_id)
482
 
12280 amit.gupta 483
	map<i64,StateInfo> getStateMaster()
10485 vikram.rag 484
 
10547 vikram.rag 485
	void updateSnapdealStockAtEOD(list<SnapdealStockAtEOD> allsnapdealstock)
486
 
487
	void updateFlipkartStockAtEOD(list<FlipkartStockAtEOD> allflipkartstock)
488
 
12363 kshitij.so 489
	double getWanNlcForSource(1:i64 item_id,2:i64 source)
490
 
491
	list<AmazonFbaInventorySnapshot> getAllAvailableAmazonFbaItemInventory();
492
 
17990 kshitij.so 493
	bool updateItemAvailabilityForItemIds(1:list<i64> itemIds)
494
 
19247 kshitij.so 495
	list<i64> addVendorItemPricingInBulk(1:list<VendorItemPricing> vendorItemPricingList)
496
 
497
	void addInventoryInBulk (1:list<BulkAddInventory> bulkInventoryList) throws (1:InventoryServiceException cex);
12363 kshitij.so 498
}