Subversion Repositories SmartDukaan

Rev

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