Subversion Repositories SmartDukaan

Rev

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

Rev Author Line No. Line
85 ashish 1
namespace java in.shop2020.model.v1.catalog
95 ashish 2
namespace py shop2020.thriftpy.model.v1.catalog
85 ashish 3
 
3374 rajveer 4
include "GenericService.thrift"
5
 
85 ashish 6
/**
7
	Objects
8
*/
9
 
123 ashish 10
/**
1330 chandransh 11
Caution :- Never ever change the numbers in it. Please confirm from @Chandranshu or @Rajveer before any changes in enum and other entries in file.
123 ashish 12
**/
103 ashish 13
enum status{
123 ashish 14
	PHASED_OUT = 0,		//Item is no longer selling
15
	DELETED = 1,		//Item has been deliberately deleted 
3009 chandransh 16
	PAUSED = 2,			//Item's sale has been paused manually.
123 ashish 17
	ACTIVE = 3,			//Item is available for sale as of now
2984 rajveer 18
	IN_PROCESS = 4,		//Item has been added, but content is not available for the same
19
	CONTENT_COMPLETE = 5,  //The content for this item has been completed. We can start selling the item now.
3009 chandransh 20
	PAUSED_BY_RISK = 6    //Item's sale has been automatically paused since it was marked as risky
103 ashish 21
}
22
 
646 chandransh 23
enum WarehouseLocation{
1330 chandransh 24
	Mumbai = 0,
25
	Delhi = 1,
646 chandransh 26
	Bangalore = 2,
27
	Kolkata = 3
28
}
29
 
1330 chandransh 30
struct Vendor{
31
	1:i64 id,
32
	2:string name
33
}
34
 
2841 chandransh 35
enum BillingType {
36
	OURS = 0,
37
	EXTERNAL = 1
38
}
39
 
4979 rajveer 40
enum HolidayType {
41
	WEEKLY = 0,
42
	MONTHLY = 1,
43
	SPECIFIC = 2
44
}
45
 
46
 
483 rajveer 47
/* 
48
Warehouse fields details
49
location: it is full address
50
vendorString: some key for the warehouse
51
*/
85 ashish 52
struct Warehouse{
53
	1:i64 id,
752 chandransh 54
	2:string displayName,
55
	3:string location,
56
	4:status warehouseStatus,
57
	5:i64 addedOn,
58
	6:i64 lastCheckedOn,
59
	7:string tinNumber,
60
	8:string pincode,
61
	9:string vendorString,
2824 chandransh 62
	10:WarehouseLocation logisticsLocation,
63
	11:string vendor,
4375 anupam.sin 64
	12:BillingType billingType
85 ashish 65
}
4024 chandransh 66
 
115 ashish 67
/* */
85 ashish 68
struct ItemInventory{
69
	1:i64 id,
4431 phani.kuma 70
	2:map<i64,i64> availability,
71
	3:map<i64,i64> reserved
85 ashish 72
}
73
 
483 rajveer 74
 
85 ashish 75
struct ItemInventoryHistory{
76
	1:i64 item_id,
77
	2:i64 warehouse_id,
78
	3:i64 timestamp,
79
	4:i64 availability
80
}
81
 
82
struct Item{
83
	1:i64 id,
956 chandransh 84
	2:string productGroup
85
	3:string brand,
86
	4:string modelNumber,
2128 ankur.sing 87
	5:string modelName,
88
	6:string color,
89
	7:i64 category,
90
	8:string comments,
91
	9:i64 catalogItemId,
92
	10:i64 featureId,
93
	11:string featureDescription,
94
	12:ItemInventory itemInventory,
2127 ankur.sing 95
	13:optional double mrp, //maxmimum retail price
4762 phani.kuma 96
	14:optional double sellingPrice, //Selling price
97
	15:optional double weight,
98
	16:i64 addedOn,
99
	17:optional i64 startDate,
100
	18:optional i64 retireDate,
101
	19:status itemStatus,
102
	20:string status_description,
103
	21:map<string,string> otherInfo,
104
	22:string bestDealText,
105
	23:optional double bestDealValue,
106
	24:bool defaultForEntity,
107
	25:i64 updatedOn,
108
	26:optional i64 bestSellingRank,
109
	27:bool risky,
110
	28:optional i32 expectedDelay,
111
	29:optional i64 preferredWarehouse,
112
	30:optional i64 defaultWarehouse,
113
	31:optional bool isWarehousePreferenceSticky,
114
	32:i32 warrantyPeriod,
115
	33:optional i64 preferredVendor
85 ashish 116
}
117
 
1343 chandransh 118
struct VendorItemPricing{
1349 chandransh 119
	1:i64 vendorId,
120
	2:i64 itemId,
1343 chandransh 121
	3:double transferPrice,
122
	4:double mop,
123
	5:double dealerPrice
124
}
125
 
1967 rajveer 126
struct Category{
127
	1:i64 id,
128
	2:string label,
129
	3:string description,
130
	4:i64 parent_category_id,
131
	/**
132
	* This field should not be used.
133
	*/
134
	5:list<i64> children_category_ids
4762 phani.kuma 135
	6:string display_name
1967 rajveer 136
}
2113 ankur.sing 137
 
138
struct VendorItemMapping{
139
	1:i64 vendorId,
140
	2:string itemKey,
4762 phani.kuma 141
	3:i64 itemId
2113 ankur.sing 142
}
2983 chandransh 143
 
144
struct ItemShippingInfo{
145
	1:bool isActive,
146
	2:optional bool isRisky,
147
	3:optional i64 quantity
148
}
149
 
3556 rajveer 150
struct Source{
151
	1:i64 id,
152
	2:string name,
153
	3:string identifier
154
}
155
 
156
struct SourceItemPricing{
157
	1:i64 sourceId,
158
	2:i64 itemId,
159
	3:double mrp,
160
	4:double sellingPrice
161
}
162
 
4024 chandransh 163
struct AvailableAndReservedStock {
164
	1:i64 itemId,
165
	2:i64 available,
166
	3:i64 reserved,
167
	4:i64 minimumStock
168
}
169
 
4295 varun.gupt 170
struct ProductNotificationRequest	{
171
	1:Item item,
172
	2:string email,
173
	3:i64 addedOn
174
}
175
 
176
struct ProductNotificationRequestCount	{
177
	1:Item item,
178
	2:i64 count
179
}
180
 
121 ashish 181
exception InventoryServiceException{
85 ashish 182
	1:i64 id,
183
	2:string message
184
}
185
 
3374 rajveer 186
service InventoryService extends GenericService.GenericService{
763 rajveer 187
 
85 ashish 188
/**
189
	Availability and inventory attributes	
190
*/
191
	//all add and update methods - added by Ashish
123 ashish 192
	i64 addItem(1:Item item) throws (1:InventoryServiceException cex),
193
	i64 updateItem(1:Item item) throws (1:InventoryServiceException cex),
121 ashish 194
	i64 addWarehouse(1:Warehouse warehouse) throws (1:InventoryServiceException cex),
2983 chandransh 195
 
196
	/**
4332 anupam.sin 197
	add a new vendor
198
	*/
199
	i64 addVendor(1:Vendor vendor) throws (1:InventoryServiceException cex),
200
	bool addWarehouseVendorMapping(1:i64 warehouse_id, 2:i64 vendorId),
201
	list<Vendor> getVendorsForWarehouse(1:i64 warehouse_id),
202
	list<Warehouse> getWarehousesForVendor(1:i64 vendorId),
203
 
204
	/**
2983 chandransh 205
	Checks if the item given to the corresponding itemId is active. If it's active,
206
	whether it's risky and if it's risky, its inventory position.
207
	*/
208
	ItemShippingInfo isActive(1:i64 itemId) throws (1:InventoryServiceException isex),
209
 
2033 rajveer 210
	string getItemStatusDescription(1:i64 itemId) throws (1:InventoryServiceException isex),
3323 chandransh 211
 
212
	/**
213
	Stores the incremental warehouse updates of items.
214
	*/
215
	void updateInventoryHistory(1:i64 warehouse_id, 2:string timestamp, 3:map<string, i64> availability) throws (1:InventoryServiceException cex),
216
 
217
	/**
218
	Stores the final inventory stocks of items.
219
	*/
483 rajveer 220
	void updateInventory(1:i64 warehouse_id, 2:string timestamp, 3:map<string, i64> availability) throws (1:InventoryServiceException cex),
2983 chandransh 221
 
4320 rajveer 222
	/**
223
	Add the inventory to existing stock.
224
	*/
225
	void addInventory(1:i64 itemId, 2:i64 warehouseId, 3:i64 quantity) throws (1:InventoryServiceException cex),
226
 
103 ashish 227
	//all delete methods
121 ashish 228
	void retireWarehouse(1:i64 warehouse_id) throws (1:InventoryServiceException cex),
103 ashish 229
 
230
	//Item management apis
121 ashish 231
	void startItemOn(1:i64 item_id, 2:i64 timestamp) throws (1:InventoryServiceException cex),
232
	void retireItemOn(1:i64 item_id, 2:i64 timestamp) throws (1:InventoryServiceException cex),
233
	void changeItemStatus(1:i64 item_id, 2:i64 timestamp, 3:status newstatus) throws (1:InventoryServiceException cex),
85 ashish 234
	//Other accessor methods - added by Ashish
121 ashish 235
	Item getItem(1:i64 item_id) throws (1:InventoryServiceException cex),
632 rajveer 236
	list<Item> getItemsByCatalogId(1:i64 catalog_item_id) throws  (1:InventoryServiceException cex),
4934 amit.gupta 237
	list<Item> getValidItemsByCatalogId(1:i64 catalog_item_id) throws  (1:InventoryServiceException cex),
121 ashish 238
	list<Item> getAllItems(1:bool isActive) throws (1:InventoryServiceException cex),
239
	list<Item> getAllItemsByStatus(1:status itemStatus) throws (1:InventoryServiceException cex),
4431 phani.kuma 240
	//ItemInventory getItemInventory(1:i64 item_id) throws (1:InventoryServiceException cex),
632 rajveer 241
	ItemInventory getItemInventoryByItemId(1:i64 item_id) throws (1:InventoryServiceException cex),
242
	//ItemInventory getItemInventoryByCatalogId(1:i64 item_id) throws (1:InventoryServiceException cex),
121 ashish 243
	i64 getItemAvailibilityAtWarehouse(1:i64 warehouse_id, 2:i64 item_id) throws (1:InventoryServiceException cex),
2076 rajveer 244
	bool markItemAsContentComplete(1:i64 entityId, 2:i64 category, 3:string brand, 4:string modelName, 5:string modelNumber) throws (1:InventoryServiceException cex),
646 chandransh 245
 
3355 chandransh 246
	/**
3848 chandransh 247
	Gets at most 'limit' items starting at the given offset. Returns an empty list if there are no more items at the given offset.
248
	*/
249
	list<Item> getAllItemsInRange(1:i64 offset, 2:i64 limit) throws (1:InventoryServiceException cex),
250
 
251
	/**
252
	Gets at most 'limit' items starting at the given offset in the given status. Returns an empty list if there are no more items at the given offset.
253
	*/
254
	list<Item> getAllItemsByStatusInRange(1:status itemStatus, 2:i64 offset, 3:i64 limit) throws (1:InventoryServiceException cex),
255
 
256
	/**
257
	Gets a count of all items by status
258
	*/
259
	i32 getItemCountByStatus(1:bool useStatus, 2:status itemStatus),
260
	/**
3355 chandransh 261
	Determines the warehouse that should be used to fulfil an order for the given item.
262
	It first checks all the warehouses which are in the logistics location given by the
263
	warehouse_loc parameter. If none of the warehouses there have any inventory, then the
264
	preferred warehouse for the item is used. 
1157 rajveer 265
 
3355 chandransh 266
	Returns an ordered list of size 4 with following elements in the given order:
267
	1. Logistics location of the warehouse which was finally picked up to ship the order.  
268
	2. Id of the warehouse which was finally picked up.
269
	3. Inventory size in the selected warehouse.
270
	4. Expected delay added by the category manager.
646 chandransh 271
	 */
272
	list<i64> getItemAvailabilityAtLocation(1:i64 warehouse_loc, 2:i64 item_id) throws (1:InventoryServiceException isex),
3355 chandransh 273
 
121 ashish 274
	list<Warehouse> getAllWarehouses(1:bool isActive) throws (1:InventoryServiceException cex),
1343 chandransh 275
 
276
	/**
277
	 Returns the warehouse with the given id.
278
	*/
121 ashish 279
	Warehouse getWarehouse(1:i64 warehouse_id) throws (1:InventoryServiceException cex),
280
	list<Warehouse> getAllWarehousesForItem(1:i64 item_id) throws (1:InventoryServiceException cex),
502 rajveer 281
	list<Item> getAllItemsForWarehouse(1:i64 warehouse_id) throws (1:InventoryServiceException cex),
282
 
862 chandransh 283
	/**
284
	 Increases the reservation count for an item in a warehouse. Should always succeed normally.
285
	*/
286
	bool reserveItemInWarehouse(1:i64 itemId, 2:i64 warehouseId, 3:double quantity) throws (1:InventoryServiceException cex),
287
 
288
	/**
289
	 Decreases the reservation count for an item in a warehouse. Should always succeed normally.
290
	*/
291
	bool reduceReservationCount(1:i64 itemId, 2:i64 warehouseId, 3:double quantity) throws (1:InventoryServiceException cex),
292
 
502 rajveer 293
	// for home page .... best deals, best sellers and latest arrivals
588 chandransh 294
	list<Item> getBestSellers() throws (1:InventoryServiceException isex),
1924 rajveer 295
	list<i64> getBestSellersCatalogIds(1:i64 beginIndex, 2:i64 totalItems, 3:string brand, 4:i64 category) throws (1:InventoryServiceException cex),
588 chandransh 296
	i64 getBestSellersCount() throws (1:InventoryServiceException cex),
297
 
298
	list<Item> getBestDeals() throws (1:InventoryServiceException isex),
1924 rajveer 299
	list<i64> getBestDealsCatalogIds(1:i64 beginIndex, 2:i64 totalItems, 3:string brand, 4:i64 category) throws (1:InventoryServiceException cex),
588 chandransh 300
	i64 getBestDealsCount() throws (1:InventoryServiceException cex),
301
 
2975 chandransh 302
	/**
303
	Returns a list of items sorted in the descending order by start date.
304
	The list is limited to the 'latest_arrivals_count' configuraiton parameter.
305
	*/
588 chandransh 306
	list<Item> getLatestArrivals() throws (1:InventoryServiceException isex),
2975 chandransh 307
 
308
	/**
309
	Returns the list of catalog ids of latest arrivals in the given categories of the given brand.
310
	To ignore the categories, pass the list as empty. To ignore brand, pass it as null.   
311
	*/
312
	list<i64> getLatestArrivalsCatalogIds(1:i64 beginIndex, 2:i64 totalItems, 3:string brand, 4:list<i64> categories) throws (1:InventoryServiceException cex),
313
 
314
	/**
315
	Get the total number of latest arrivals we are willing to show.
316
	The count's upper bound is the 'latest_arrivals_count' configuraiton parameter.
317
	*/
632 rajveer 318
	i64 getLatestArrivalsCount() throws (1:InventoryServiceException cex),
319
 
1157 rajveer 320
 
321
	i64 generateNewEntityID(),
322
 
323
	/**
1343 chandransh 324
	Returns the pricing information of an item associated with the vendor of the given warehouse.
325
	Raises an exception if either the item, vendor or the associated pricing information can't be found.
326
	*/
4283 anupam.sin 327
	VendorItemPricing getItemPricing(1:i64 itemId, 2:i64 vendorId) throws (1:InventoryServiceException cex),
1343 chandransh 328
 
329
	/**
1157 rajveer 330
	* Store category object and retrieve it
331
	*/
1967 rajveer 332
	/**
632 rajveer 333
	bool putCategoryObject(1:binary object),
334
	binary getCategoryObject()
1967 rajveer 335
	*/
336
 
337
	/**
338
	* All category related functions
339
	*/
340
	bool addCategory(1:Category category),
341
	Category getCategory(1:i64 id),
1990 ankur.sing 342
	list<Category> getAllCategories(),
1967 rajveer 343
 
1990 ankur.sing 344
	/**
345
	Returns the list of vendor pricing information of an item.
346
	Raises an exception if item not found corresponding to itemId
347
	*/
348
	list<VendorItemPricing> getAllItemPricing(1:i64 itemId) throws (1:InventoryServiceException cex),
349
 
350
 
351
	/**
2113 ankur.sing 352
	Adds vendor prices corresponding to the item. If pricing already exists then updates the prices. 
1990 ankur.sing 353
	Raises an exception if either the item or vendor can't be found corresponding to their ids.
354
	*/
2113 ankur.sing 355
	void addVendorItemPricing(1:VendorItemPricing vendorItemPricing) throws (1:InventoryServiceException cex),
1990 ankur.sing 356
 
2063 ankur.sing 357
	/**
358
	Return list of all vendors
359
	*/
2113 ankur.sing 360
	list<Vendor> getAllVendors(), 
2063 ankur.sing 361
 
2113 ankur.sing 362
	/**
4423 phani.kuma 363
	Returns the list of similar items.
364
	*/
365
	list<Item> getAllSimilarItems(1:i64 itemId),
366
 
367
	/**
368
	Adds similar item.
369
	*/
370
	Item addSimilarItem(1:i64 itemId, 2:i64 catalogItemId) throws (1:InventoryServiceException cex),
371
 
372
	/**
373
	Delete similar item.
374
	*/
375
	bool deleteSimilarItem(1:i64 itemId, 2:i64 catalogItemId) throws (1:InventoryServiceException cex),
376
 
377
	/**
2356 ankur.sing 378
	Adds VendorItemMapping. Updates VendorItemMapping if exists corresponding to the item key.  
2113 ankur.sing 379
	*/
2356 ankur.sing 380
	void addVendorItemMapping(1:string key, 2:VendorItemMapping vendorItemMapping) throws (1:InventoryServiceException cex),
2113 ankur.sing 381
 
382
	/**
383
	Returns the list of vendor item mapping corresponding to itemId passed as parameter.
384
	Raises an exception if item not found corresponding to itemId
385
	*/
386
	list<VendorItemMapping> getVendorItemMappings(1:i64 itemId) throws (1:InventoryServiceException cex),
387
 
388
	/**
4725 phani.kuma 389
	Checks if similar item exists (with same Brand, ModelNumber, ModelName, Color)
2113 ankur.sing 390
	If yes, returns the itemId else returns 0
391
	*/
4725 phani.kuma 392
	i64 checkSimilarItem(1:string brand, 2:string modelNumber, 3:string modelName, 4:string color),
2284 ankur.sing 393
 
394
	/**
395
	Marks/Unmarks an item as risky. This flag is used for automatic marking of an item as INACTIVE in case of zero inventory.
396
	*/
2356 ankur.sing 397
	void changeItemRiskyFlag(1:i64 itemId, 2:bool risky),
398
 
399
	/**
400
	Returns list of items marked as risky.
401
	*/
402
	list<Item> getItemsByRiskyFlag(),
403
 
404
	/**
4957 phani.kuma 405
	Returns list of items with any status except PHASED_OUT and filtered by category, brand.
2356 ankur.sing 406
	*/
4957 phani.kuma 407
	list<Item> getItemsForMasterSheet(1:string category, 2:string brand),
2807 rajveer 408
 
409
	/**
410
	Returns list of catalog ids of items with same similarity index as of the given itemId 
411
	*/
412
	list<i64> getSimilarItemsCatalogIds(1:i64 beginIndex, 2:i64 totalItems, 3:i64 itemId),
3079 rajveer 413
 
414
	/**
415
	Add user requests for out of stock items. Once user will ask for notify me an entry will 
416
	*/
3086 rajveer 417
	bool addProductNotification(i64 itemId, string email),
3079 rajveer 418
 
3086 rajveer 419
	/**
420
		Send the product notifications to the users for items which has stock.
421
	*/
3348 varun.gupt 422
	bool sendProductNotifications(),
3079 rajveer 423
 
3348 varun.gupt 424
	/**
425
		Returns list of brand names for a given category Id
426
	*/
3556 rajveer 427
	list<string> getAllBrandsByCategory(1:i64 categoryId),
4957 phani.kuma 428
 
429
    /**
430
		Returns list of brand names
431
	*/
432
	list<string> getAllBrands(),
433
 
3556 rajveer 434
	/**
435
	Return list of all sources
436
	*/
437
	list<Source> getAllSources(), 
438
 
439
	/**
440
	Returns the pricing information of an item. If no information is found, exception will be thrown.
441
	*/
442
	SourceItemPricing getItemPricingBySource(1:i64 itemId, 2:i64 sourceId) throws (1:InventoryServiceException cex),
443
 
444
	/**
445
	Adds prices to be displayed corresponding to the item if user comes from a source.
446
	If item is not found or source is not found, it will throw exception.
447
	*/
448
	void addSourceItemPricing(1:SourceItemPricing sourceItemPricing) throws (1:InventoryServiceException cex),
449
 
450
	/**
451
	Returns the list of source pricing information of an item.
452
	Raises an exception if item not found corresponding to itemId
453
	*/
454
	list<SourceItemPricing> getAllSourcePricing(1:i64 itemId) throws (1:InventoryServiceException cex),
455
 
456
	/**
457
	Get the item for a given itemId and sourceId. MRP and sellingPrice will be updated for source if we have different prices for source.
458
	*/
3872 chandransh 459
	Item getItemForSource(1:i64 item_id, 2:optional i64  sourceId) throws (1:InventoryServiceException cex),
460
 
461
	/**
462
	Searches items matching the the given terms in the catalog and returns results within the specified range.
463
	*/
464
	list<Item> searchItemsInRange(1:list<string> searchTerms, 2:i64 offset, 3:i64 limit),
465
 
466
	/**
467
	Gets the count of search results for the given search terms so that the user can go through all the pages.
468
	*/
4024 chandransh 469
	i32 getSearchResultCount(1:list<string> searchTerms),
470
 
471
	/**
4063 chandransh 472
	Returns a list of inventory stock for items for which there are pending orders for the given vendor.
4024 chandransh 473
	*/
4295 varun.gupt 474
	list<AvailableAndReservedStock> getPendingOrdersInventory(1:i64 vendorid),
475
 
476
	/**
477
	Returns a list of product notifications added after a supplied datetime
478
	*/
479
	list<ProductNotificationRequest> getProductNotifications(1:i64 startDateTime),
480
 
481
	/**
482
	Returns a list of count of requests for product notification against each item
483
	*/
484
	list<ProductNotificationRequestCount> getProductNotificationRequestCount(1:i64 startDateTime)
4370 anupam.sin 485
 
486
	/**
487
	This method creates a purchase order from an excel sheet containing Item Id and Quantity column and returns the PO Id.
488
	*/
489
	string processPurchaseOrder(1:string filename 2:i32 vendorId) throws (1:InventoryServiceException cex)
4649 phani.kuma 490
 
491
	/**
492
	This method adds a log to authorize table with Item Id, username who authorized the change, reason.
493
	*/
494
	bool addAuthorizationLog(1:i64 itemId, 2:string username, 3:string reason) throws (1:InventoryServiceException cex)
4985 mandeep.dh 495
 
496
    /**
497
     * Resets availability of an item to the quantity mentioned in a warehouse.
498
     */
499
    void resetAvailability(1:string itemKey, 2:i64 vendorId, 3:i64 quantity, 4:i64 warehouseId) throws (1:InventoryServiceException cex);
500
 
501
    /**
502
     * Returns the list of item keys which need to be processed for a given warehouse.
503
     * This is currently used by Support application to send item keys whose inventory needs 
504
     * to be updated from PLB
505
     */
506
    list<string> getItemKeysToBeProcessed(1:i64 warehouseId);
507
 
508
    /**
509
     * Marks/Deletes missed inventory updates for a given key and warehouse.
510
     * This generally happens when updates from PLB are applied on the currentinventorysnapshot for an item
511
     */
512
    void markMissedInventoryUpdatesAsProcessed(1:string itemKey, 2:i64 warehouseId);	
4295 varun.gupt 513
}