| 5944 |
mandeep.dh |
1 |
'''
|
|
|
2 |
Created on 27-Apr-2010
|
|
|
3 |
|
|
|
4 |
@author: ashish
|
|
|
5 |
'''
|
| 11173 |
vikram.rag |
6 |
from elixir import *
|
| 5944 |
mandeep.dh |
7 |
from shop2020.config.client.ConfigClient import ConfigClient
|
|
|
8 |
from shop2020.model.v1.inventory.impl import DataService
|
| 5957 |
mandeep.dh |
9 |
from shop2020.model.v1.inventory.impl.Convertors import to_t_item_inventory, \
|
| 6821 |
amar.kumar |
10 |
to_t_warehouse, to_t_vendor_item_pricing, to_t_vendor, to_t_vendor_item_mapping, \
|
| 8282 |
kshitij.so |
11 |
to_t_item_stock_purchase_params, to_t_oos_status, to_t_amazon_inventory_snapshot, \
|
| 9761 |
amar.kumar |
12 |
to_t_amazon_fba_inventory_snapshot,to_t_snapdeal_inventory_snapshot,\
|
| 10050 |
vikram.rag |
13 |
to_t_hold_inventory_detail, to_t_flipkart_inventory_snapshot
|
| 5944 |
mandeep.dh |
14 |
from shop2020.model.v1.inventory.impl.DataAcessors import add_warehouse, \
|
|
|
15 |
update_inventory, retire_warehouse, get_item_availability_for_warehouse, \
|
|
|
16 |
get_item_availability_for_location, get_all_warehouses_by_status, get_Warehouse, \
|
| 5957 |
mandeep.dh |
17 |
get_all_items_for_warehouse, close_session, add_vendor, \
|
|
|
18 |
get_item_inventory_by_item_id, reserve_item_in_warehouse, \
|
|
|
19 |
reduce_reservation_count, get_all_item_pricing, add_vendor_pricing, \
|
|
|
20 |
get_item_pricing, get_all_vendors, get_item_mappings, add_vendor_item_mapping, \
|
|
|
21 |
update_inventory_history, is_alive, add_inventory, add_bad_inventory, \
|
|
|
22 |
mark_missed_inventory_updates_as_processed, update_vendor_string, \
|
|
|
23 |
get_item_keys_to_be_processed, reset_availability, get_shipping_locations, \
|
| 5944 |
mandeep.dh |
24 |
initialize, get_inventory_snapshot, clear_item_availability_cache, \
|
| 5987 |
rajveer |
25 |
reset_availability_for_warehouse, get_vendor, get_pending_orders_inventory, \
|
| 6531 |
vikram.rag |
26 |
is_order_billable, get_our_warehouse_id_for_vendor, \
|
|
|
27 |
get_item_availability_for_our_warehouses, get_monitored_warehouses_for_vendors, \
|
|
|
28 |
get_ignored_warehouseids_and_itemids,insert_item_to_ignore_inventory_update_list, \
|
|
|
29 |
delete_item_from_ignore_inventory_update_list,get_all_ignored_inventoryupdate_items_count, \
|
| 6821 |
amar.kumar |
30 |
get_ignored_inventoryupdate_itemids, update_item_stock_purchase_params, \
|
| 6857 |
amar.kumar |
31 |
get_item_stock_purchase_params, add_oos_status_for_item, \
|
| 7149 |
amar.kumar |
32 |
get_oos_statuses_for_x_days_for_item, get_non_zero_item_stock_purchase_params, \
|
| 7281 |
kshitij.so |
33 |
get_billable_inventory_and_pending_orders,get_warehouse_name,get_amazon_inventory_for_item,get_all_amazon_inventory, \
|
| 7972 |
amar.kumar |
34 |
add_or_update_amazon_inventory_for_item, update_reservation_for_order, \
|
| 8282 |
kshitij.so |
35 |
get_last_n_day_sale_for_item, add_or_update_amazon_fba_inventory, add_update_hold_inventory,\
|
| 9404 |
vikram.rag |
36 |
get_amazon_fba_inventory,get_all_amazon_fba_inventory, get_oursgood_warehouseids_for_location, \
|
|
|
37 |
get_holdinventorydetail_forItem_forWarehouseId_exceptsource, get_snapdeal_inventory_for_item, \
|
| 9640 |
amar.kumar |
38 |
add_or_update_snapdeal_inventor_for_item, get_nlc_for_warehouse,get_snapdeal_inventory_snapshot, \
|
| 10050 |
vikram.rag |
39 |
get_held_inventory_map_for_item, get_hold_inventory_details, add_or_update_flipkart_inventory_snapshot, \
|
| 10126 |
amar.kumar |
40 |
get_flipkart_inventory_snapshot, get_flipkart_inventory_for_Item, get_oos_statuses_for_x_days, \
|
| 10544 |
vikram.rag |
41 |
get_all_vendor_item_pricing, get_state_master, update_snapdeal_stock_at_eod, update_flipkart_stock_at_eod
|
| 7972 |
amar.kumar |
42 |
|
| 5944 |
mandeep.dh |
43 |
from shop2020.model.v1.inventory.impl.DataService import Warehouse, \
|
|
|
44 |
MissedInventoryUpdate, VendorItemMapping
|
| 5957 |
mandeep.dh |
45 |
from shop2020.thriftpy.model.v1.inventory.ttypes import \
|
|
|
46 |
InventoryServiceException, WarehouseType, InventoryType, \
|
|
|
47 |
AvailableAndReservedStock
|
| 5944 |
mandeep.dh |
48 |
from shop2020.utils.Utils import log_entry, to_java_date
|
|
|
49 |
|
|
|
50 |
class InventoryServiceHandler:
|
|
|
51 |
'''
|
|
|
52 |
classdocs
|
|
|
53 |
'''
|
|
|
54 |
|
|
|
55 |
def __init__(self, dbname='catalog', db_hostname='localhost'):
|
|
|
56 |
'''
|
|
|
57 |
Constructor
|
| 6532 |
amit.gupta |
58 |
u '''
|
| 5944 |
mandeep.dh |
59 |
initialize(dbname, db_hostname)
|
|
|
60 |
try:
|
|
|
61 |
config_client = ConfigClient()
|
|
|
62 |
self.latest_arrivals_limit = int(config_client.get_property("LATEST_ARRIVALS_LIMIT"));
|
|
|
63 |
self.best_sellers_limit = int(config_client.get_property("BEST_SELLERS_LIMIT"))
|
|
|
64 |
except:
|
|
|
65 |
self.latest_arrivals_limit = 50
|
|
|
66 |
self.best_sellers_limit = 50
|
|
|
67 |
|
|
|
68 |
def addWarehouse(self, warehouse):
|
|
|
69 |
"""
|
|
|
70 |
Parameters:
|
|
|
71 |
- warehouse
|
|
|
72 |
"""
|
|
|
73 |
log_entry(self, "addWarehouse called")
|
|
|
74 |
try:
|
|
|
75 |
return add_warehouse(warehouse)
|
|
|
76 |
finally:
|
|
|
77 |
close_session()
|
|
|
78 |
|
|
|
79 |
def updateInventoryHistory(self, warehouse_id, timestamp, availability):
|
|
|
80 |
"""
|
|
|
81 |
Stores the incremental warehouse updates of items.
|
|
|
82 |
|
|
|
83 |
Parameters:
|
|
|
84 |
- warehouse_id
|
|
|
85 |
- timestamp
|
|
|
86 |
- availability
|
|
|
87 |
"""
|
|
|
88 |
try:
|
|
|
89 |
return update_inventory_history(warehouse_id, timestamp, availability)
|
|
|
90 |
finally:
|
|
|
91 |
close_session()
|
|
|
92 |
|
|
|
93 |
def updateInventory(self, warehouse_id, timestamp, availability):
|
|
|
94 |
"""
|
|
|
95 |
Parameters:
|
|
|
96 |
- warehouse_id
|
|
|
97 |
- timestamp
|
|
|
98 |
- availability
|
|
|
99 |
"""
|
|
|
100 |
log_entry(self, "update Inventory called")
|
|
|
101 |
try:
|
|
|
102 |
return update_inventory(warehouse_id, timestamp, availability)
|
|
|
103 |
finally:
|
|
|
104 |
close_session()
|
|
|
105 |
|
|
|
106 |
def addInventory(self, itemId, warehouseId, quantity):
|
|
|
107 |
"""
|
|
|
108 |
Add the inventory to existing stock.
|
|
|
109 |
|
|
|
110 |
Parameters:
|
|
|
111 |
- itemId
|
|
|
112 |
- warehouseId
|
|
|
113 |
- quantity
|
|
|
114 |
"""
|
|
|
115 |
log_entry(self, "add Inventory called")
|
|
|
116 |
try:
|
|
|
117 |
return add_inventory(itemId, warehouseId, quantity)
|
|
|
118 |
finally:
|
|
|
119 |
close_session()
|
|
|
120 |
|
|
|
121 |
def retireWarehouse(self, warehouse_id):
|
|
|
122 |
"""
|
|
|
123 |
Parameters:
|
|
|
124 |
- warehouse_id
|
|
|
125 |
"""
|
|
|
126 |
log_entry(self, "retire warehouse called")
|
|
|
127 |
try:
|
|
|
128 |
return retire_warehouse(warehouse_id)
|
|
|
129 |
finally:
|
|
|
130 |
close_session()
|
|
|
131 |
|
|
|
132 |
|
|
|
133 |
def getItemInventoryByItemId(self, item_id):
|
|
|
134 |
"""
|
|
|
135 |
Parameters:
|
|
|
136 |
- item_id
|
|
|
137 |
"""
|
|
|
138 |
log_entry(self, "item inventory requested")
|
|
|
139 |
try:
|
|
|
140 |
inventory = get_item_inventory_by_item_id(item_id)
|
|
|
141 |
return to_t_item_inventory(inventory, item_id)
|
|
|
142 |
finally:
|
|
|
143 |
close_session()
|
|
|
144 |
|
| 5978 |
rajveer |
145 |
def getItemAvailabilityAtLocation(self, itemId, sourceId):
|
| 5944 |
mandeep.dh |
146 |
"""
|
|
|
147 |
Determines the warehouse that should be used to fulfil an order for the given item.
|
|
|
148 |
It first checks all the warehouses which are in the logistics location given by the
|
|
|
149 |
warehouse_loc parameter. If none of the warehouses there have any inventory, then the
|
|
|
150 |
preferred warehouse for the item is used.
|
|
|
151 |
|
|
|
152 |
Returns an ordered list of size 4 with following elements in the given order:
|
|
|
153 |
1. Logistics location of the warehouse which was finally picked up to ship the order.
|
|
|
154 |
2. Id of the warehouse which was finally picked up.
|
|
|
155 |
3. Inventory size in the selected warehouse.
|
|
|
156 |
4. Expected delay added by the category manager.
|
|
|
157 |
|
|
|
158 |
Parameters:
|
|
|
159 |
- itemId
|
| 5978 |
rajveer |
160 |
- sourceId
|
| 5944 |
mandeep.dh |
161 |
"""
|
|
|
162 |
try:
|
| 5978 |
rajveer |
163 |
return get_item_availability_for_location(itemId, sourceId)
|
| 5944 |
mandeep.dh |
164 |
finally:
|
|
|
165 |
close_session()
|
|
|
166 |
|
|
|
167 |
def getItemAvailibilityAtWarehouse(self, warehouse_id, item_id):
|
|
|
168 |
"""
|
|
|
169 |
Parameters:
|
|
|
170 |
- warehouse_id
|
|
|
171 |
- item_id
|
|
|
172 |
"""
|
|
|
173 |
log_entry(self, "item availability at warehouse requested")
|
|
|
174 |
try:
|
|
|
175 |
return get_item_availability_for_warehouse(warehouse_id, item_id)
|
|
|
176 |
finally:
|
|
|
177 |
close_session()
|
| 6484 |
amar.kumar |
178 |
|
|
|
179 |
def getItemAvailabilitiesAtOurWarehouses(self, item_ids):
|
|
|
180 |
try:
|
|
|
181 |
return get_item_availability_for_our_warehouses(item_ids)
|
|
|
182 |
finally:
|
|
|
183 |
close_session()
|
| 5944 |
mandeep.dh |
184 |
|
|
|
185 |
def getItemInventoryHistory(self, id, item_id, warehouse_id, from_date, to_date):
|
|
|
186 |
"""
|
|
|
187 |
Parameters:
|
|
|
188 |
- id
|
|
|
189 |
- item_id
|
|
|
190 |
- warehouse_id
|
|
|
191 |
- from_date
|
|
|
192 |
- to_date
|
|
|
193 |
"""
|
|
|
194 |
pass
|
|
|
195 |
|
|
|
196 |
def getAllWarehouses(self, isActive):
|
|
|
197 |
"""
|
|
|
198 |
Parameters:
|
|
|
199 |
- isActive
|
|
|
200 |
"""
|
|
|
201 |
try:
|
|
|
202 |
if isActive:
|
|
|
203 |
warehouses = get_all_warehouses_by_status(3)
|
|
|
204 |
else:
|
|
|
205 |
warehouses = get_all_warehouses_by_status(None)
|
|
|
206 |
|
|
|
207 |
ret_warehouses = []
|
|
|
208 |
|
|
|
209 |
for warehouse in warehouses:
|
|
|
210 |
ret_warehouses.append(to_t_warehouse(warehouse))
|
|
|
211 |
return ret_warehouses
|
|
|
212 |
finally:
|
|
|
213 |
close_session()
|
|
|
214 |
|
|
|
215 |
def getWarehouse(self, warehouse_id):
|
|
|
216 |
"""
|
|
|
217 |
Parameters:
|
|
|
218 |
- warehouse_id
|
|
|
219 |
"""
|
|
|
220 |
log_entry(self, "get warehouse call")
|
|
|
221 |
try:
|
|
|
222 |
warehouse = get_Warehouse(warehouse_id)
|
|
|
223 |
if warehouse:
|
|
|
224 |
return to_t_warehouse(warehouse)
|
|
|
225 |
else:
|
|
|
226 |
raise InventoryServiceException(101, "no such warehouse: " + str(warehouse_id))
|
|
|
227 |
finally:
|
|
|
228 |
close_session()
|
|
|
229 |
|
|
|
230 |
def getAllItemsForWarehouse(self, warehouse_id):
|
|
|
231 |
"""
|
|
|
232 |
Parameters:
|
|
|
233 |
- warehouse_id
|
|
|
234 |
"""
|
|
|
235 |
log_entry(self, "getting all items for warehouse")
|
|
|
236 |
try:
|
|
|
237 |
all_items = get_all_items_for_warehouse(warehouse_id)
|
|
|
238 |
t_items = []
|
|
|
239 |
for item in all_items:
|
|
|
240 |
t_items.append(item.id)
|
|
|
241 |
return t_items
|
|
|
242 |
finally:
|
|
|
243 |
close_session()
|
|
|
244 |
|
| 5966 |
rajveer |
245 |
def isOrderBillable(self, itemId, warehouseId, sourceId, orderId):
|
| 5944 |
mandeep.dh |
246 |
"""
|
| 5966 |
rajveer |
247 |
Depending on reservation in the table, verify if we can bill this order or not.
|
|
|
248 |
|
|
|
249 |
Parameters:
|
|
|
250 |
- itemId
|
|
|
251 |
- warehouseId
|
|
|
252 |
- sourceId
|
|
|
253 |
- orderId
|
|
|
254 |
"""
|
|
|
255 |
try:
|
|
|
256 |
return is_order_billable(itemId, warehouseId, sourceId, orderId)
|
|
|
257 |
finally:
|
|
|
258 |
close_session()
|
|
|
259 |
|
|
|
260 |
def reserveItemInWarehouse(self, itemId, warehouseId, sourceId, orderId, createdTimestamp, promisedShippingTimestamp, quantity):
|
|
|
261 |
"""
|
| 5944 |
mandeep.dh |
262 |
Increases the reservation count for an item in a warehouse. Should always succeed normally.
|
|
|
263 |
|
|
|
264 |
Parameters:
|
|
|
265 |
- itemId
|
|
|
266 |
- warehouseId
|
|
|
267 |
"""
|
|
|
268 |
log_entry(self, "reserveItemInWarehouse called")
|
|
|
269 |
try:
|
| 5966 |
rajveer |
270 |
return reserve_item_in_warehouse(itemId, warehouseId, sourceId, orderId, createdTimestamp, promisedShippingTimestamp, quantity)
|
| 5944 |
mandeep.dh |
271 |
finally:
|
|
|
272 |
close_session()
|
| 7968 |
amar.kumar |
273 |
|
| 5944 |
mandeep.dh |
274 |
|
| 7968 |
amar.kumar |
275 |
def updateReservationForOrder(self, itemId, warehouseId, sourceId, orderId, createdTimestamp, promisedShippingTimestamp, quantity):
|
|
|
276 |
"""
|
|
|
277 |
Increases the reservation count for an item in a warehouse. Should always succeed normally.
|
|
|
278 |
|
|
|
279 |
Parameters:
|
|
|
280 |
- itemId
|
|
|
281 |
- warehouseId
|
|
|
282 |
"""
|
|
|
283 |
log_entry(self, "reserveItemInWarehouse called")
|
|
|
284 |
try:
|
|
|
285 |
return update_reservation_for_order(itemId, warehouseId, sourceId, orderId, createdTimestamp, promisedShippingTimestamp, quantity)
|
|
|
286 |
finally:
|
|
|
287 |
close_session()
|
|
|
288 |
|
| 5966 |
rajveer |
289 |
def reduceReservationCount(self, itemId, warehouseId, sourceId, orderId, quantity):
|
| 5944 |
mandeep.dh |
290 |
"""
|
|
|
291 |
Decreases the reservation count for an item in a warehouse. Should always succeed normally.
|
|
|
292 |
|
|
|
293 |
Parameters:
|
|
|
294 |
- itemId
|
|
|
295 |
- warehouseId
|
|
|
296 |
"""
|
|
|
297 |
log_entry(self, "reduceReservationCount called")
|
|
|
298 |
try:
|
| 5966 |
rajveer |
299 |
return reduce_reservation_count(itemId, warehouseId, sourceId, orderId, quantity)
|
| 5944 |
mandeep.dh |
300 |
finally:
|
|
|
301 |
close_session()
|
|
|
302 |
|
|
|
303 |
def getItemPricing(self, itemId, vendorId):
|
|
|
304 |
"""
|
|
|
305 |
Returns the pricing information of an item associated with the vendor of the given warehouse.
|
|
|
306 |
Raises an exception if either the item, vendor or the associated pricing information can't be found.
|
|
|
307 |
|
|
|
308 |
Parameters:
|
|
|
309 |
- itemId
|
|
|
310 |
- warehouseId
|
|
|
311 |
"""
|
|
|
312 |
try:
|
|
|
313 |
return to_t_vendor_item_pricing(get_item_pricing(itemId, vendorId))
|
|
|
314 |
finally:
|
|
|
315 |
close_session()
|
|
|
316 |
|
|
|
317 |
|
|
|
318 |
def getAllItemPricing(self, itemId):
|
|
|
319 |
"""
|
|
|
320 |
Returns list of the pricing information of an item associated an item.
|
|
|
321 |
Raises an exception if the item can't be found.
|
|
|
322 |
|
|
|
323 |
Parameters:
|
|
|
324 |
- itemId
|
|
|
325 |
"""
|
|
|
326 |
try:
|
|
|
327 |
return [to_t_vendor_item_pricing(vid) for vid in get_all_item_pricing(itemId)]
|
|
|
328 |
finally:
|
|
|
329 |
close_session()
|
| 10126 |
amar.kumar |
330 |
|
|
|
331 |
def getAllVendorItemPricing(self, itemId, vendorId):
|
|
|
332 |
"""
|
|
|
333 |
Returns list of all stored pricing information for given itemId and vendorId.
|
|
|
334 |
|
|
|
335 |
Parameters:
|
|
|
336 |
- itemId
|
|
|
337 |
- vendorId
|
|
|
338 |
"""
|
|
|
339 |
try:
|
|
|
340 |
return [to_t_vendor_item_pricing(vid) for vid in get_all_vendor_item_pricing(itemId, vendorId)]
|
|
|
341 |
finally:
|
|
|
342 |
close_session()
|
| 5944 |
mandeep.dh |
343 |
|
|
|
344 |
def addVendorItemPricing(self, vendorItemPricing):
|
|
|
345 |
"""
|
|
|
346 |
Adds vendor prices corresponding to the item. If pricing already exists then updates the prices.
|
|
|
347 |
Raises an exception if either the item or vendor can't be found corresponding to their ids.
|
|
|
348 |
|
|
|
349 |
Parameters:
|
|
|
350 |
- vendorItemPricing
|
|
|
351 |
"""
|
|
|
352 |
log_entry(self, "updateVendorItemPricing called")
|
|
|
353 |
try:
|
|
|
354 |
return add_vendor_pricing(vendorItemPricing)
|
|
|
355 |
finally:
|
|
|
356 |
close_session()
|
|
|
357 |
|
|
|
358 |
def getVendor(self, vendorId):
|
|
|
359 |
"""
|
|
|
360 |
Return a vendor for id
|
|
|
361 |
"""
|
|
|
362 |
try:
|
|
|
363 |
return to_t_vendor(get_vendor(vendorId))
|
|
|
364 |
finally:
|
|
|
365 |
close_session()
|
|
|
366 |
|
|
|
367 |
|
|
|
368 |
def getAllVendors(self, ):
|
|
|
369 |
"""
|
|
|
370 |
Return list of all vendors
|
|
|
371 |
"""
|
|
|
372 |
try:
|
|
|
373 |
return [to_t_vendor(v) for v in get_all_vendors()]
|
|
|
374 |
finally:
|
|
|
375 |
close_session()
|
|
|
376 |
|
|
|
377 |
def addVendorItemMapping(self, key, vendorItemMapping):
|
|
|
378 |
"""
|
|
|
379 |
Adds VendorItemMapping. Updates VendorItemMapping if exists corresponding to the item key.
|
|
|
380 |
|
|
|
381 |
Parameters:
|
|
|
382 |
- key
|
|
|
383 |
- vendorItemMapping
|
|
|
384 |
"""
|
|
|
385 |
log_entry(self, "addVendorItemMapping called")
|
|
|
386 |
try:
|
|
|
387 |
return add_vendor_item_mapping(key, vendorItemMapping)
|
|
|
388 |
finally:
|
|
|
389 |
close_session()
|
|
|
390 |
|
|
|
391 |
def getVendorItemMappings(self, itemId):
|
|
|
392 |
"""
|
|
|
393 |
Returns the list of vendor item mapping corresponding to itemId passed as parameter.
|
|
|
394 |
Raises an exception if item not found corresponding to itemId
|
|
|
395 |
|
|
|
396 |
Parameters:
|
|
|
397 |
- itemId
|
|
|
398 |
"""
|
|
|
399 |
try:
|
|
|
400 |
item_mappings = get_item_mappings(itemId)
|
|
|
401 |
return [to_t_vendor_item_mapping(vim) for vim in item_mappings]
|
|
|
402 |
finally:
|
|
|
403 |
close_session()
|
|
|
404 |
|
|
|
405 |
def isAlive(self, ):
|
|
|
406 |
"""
|
|
|
407 |
For checking weather service is active alive or not. It also checks connectivity with database
|
|
|
408 |
"""
|
|
|
409 |
try:
|
|
|
410 |
return is_alive()
|
|
|
411 |
finally:
|
|
|
412 |
close_session()
|
|
|
413 |
|
|
|
414 |
def closeSession(self, ):
|
|
|
415 |
"""
|
|
|
416 |
For closing the open session in sqlalchemy
|
|
|
417 |
"""
|
|
|
418 |
close_session()
|
|
|
419 |
|
|
|
420 |
def addVendor(self, vendor):
|
|
|
421 |
"""
|
|
|
422 |
add a new vendor
|
|
|
423 |
"""
|
|
|
424 |
try:
|
|
|
425 |
return add_vendor(vendor)
|
|
|
426 |
finally:
|
|
|
427 |
close_session()
|
|
|
428 |
|
|
|
429 |
def getWarehouses(self, warehouseType, inventoryType, vendorId, billingWarehouseId, shippingWarehouseId):
|
|
|
430 |
"""
|
|
|
431 |
This method returns all warehouses for a given warehosueType, inventoryType, vendor, billingWarehouse and shippingWarehouse.
|
|
|
432 |
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
|
|
|
433 |
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
|
|
|
434 |
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
|
|
|
435 |
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
|
|
|
436 |
|
|
|
437 |
Parameters:
|
|
|
438 |
- warehouseType
|
|
|
439 |
- inventoryType
|
|
|
440 |
- vendorId
|
|
|
441 |
- billingWarehouseId
|
|
|
442 |
- shippingWarehouseId
|
|
|
443 |
"""
|
|
|
444 |
try:
|
|
|
445 |
query = Warehouse.query
|
|
|
446 |
if warehouseType is not None:
|
|
|
447 |
query = query.filter_by(warehouseType = WarehouseType._VALUES_TO_NAMES[warehouseType])
|
|
|
448 |
if inventoryType is not None:
|
|
|
449 |
query = query.filter_by(inventoryType = InventoryType._VALUES_TO_NAMES[inventoryType])
|
|
|
450 |
if vendorId:
|
|
|
451 |
query = query.filter_by(vendor_id = vendorId)
|
|
|
452 |
if billingWarehouseId:
|
|
|
453 |
query = query.filter_by(billingWarehouseId = billingWarehouseId)
|
|
|
454 |
if shippingWarehouseId:
|
|
|
455 |
query = query.filter_by(shippingWarehouseId = shippingWarehouseId)
|
|
|
456 |
|
|
|
457 |
return [to_t_warehouse(w) for w in query.all()]
|
|
|
458 |
finally:
|
|
|
459 |
close_session()
|
|
|
460 |
|
|
|
461 |
def getItemKeysToBeProcessed(self, warehouseId):
|
|
|
462 |
"""
|
|
|
463 |
Returns the list of item keys which need to be processed for a given warehouse.
|
|
|
464 |
This is currently used by Support application to send item keys whose inventory needs
|
|
|
465 |
to be updated from PLB
|
|
|
466 |
|
|
|
467 |
Parameters:
|
|
|
468 |
- warehouseId
|
|
|
469 |
"""
|
|
|
470 |
try:
|
|
|
471 |
return get_item_keys_to_be_processed(warehouseId)
|
|
|
472 |
finally:
|
|
|
473 |
close_session()
|
|
|
474 |
|
|
|
475 |
def markMissedInventoryUpdatesAsProcessed(self, itemKey, warehouseId):
|
|
|
476 |
"""
|
|
|
477 |
Marks/Deletes missed inventory updates for a given key and warehouse.
|
|
|
478 |
This generally happens when updates from PLB are applied on the currentinventorysnapshot for an item
|
|
|
479 |
|
|
|
480 |
Parameters:
|
|
|
481 |
- itemKey
|
|
|
482 |
- warehouseId
|
|
|
483 |
"""
|
|
|
484 |
try:
|
|
|
485 |
mark_missed_inventory_updates_as_processed(itemKey, warehouseId)
|
|
|
486 |
finally:
|
|
|
487 |
close_session()
|
|
|
488 |
|
|
|
489 |
def resetAvailability(self, itemKey, vendorId, quantity, warehouseId):
|
|
|
490 |
"""
|
|
|
491 |
Resets availability of an item to the quantity mentioned in a warehouse.
|
|
|
492 |
|
|
|
493 |
Parameters:
|
|
|
494 |
- itemKey
|
|
|
495 |
- vendorId
|
|
|
496 |
- quantity
|
|
|
497 |
- warehouseId
|
|
|
498 |
"""
|
|
|
499 |
try:
|
|
|
500 |
reset_availability(itemKey, vendorId, quantity, warehouseId)
|
|
|
501 |
finally:
|
|
|
502 |
close_session()
|
|
|
503 |
|
|
|
504 |
def resetAvailabilityForWarehouse(self, warehouseId):
|
|
|
505 |
"""
|
|
|
506 |
Resets availability of a warehouse to zero.
|
|
|
507 |
|
|
|
508 |
Parameters:
|
|
|
509 |
- warehouseId
|
|
|
510 |
"""
|
|
|
511 |
try:
|
|
|
512 |
reset_availability_for_warehouse(warehouseId)
|
|
|
513 |
finally:
|
|
|
514 |
close_session()
|
|
|
515 |
|
|
|
516 |
def getIgnoredItemKeys(self, ):
|
|
|
517 |
"""
|
|
|
518 |
Returns all the item key mappings that have been ignored until date. Value of map has the warehouse id
|
|
|
519 |
and the timestamp from where alert was raised.
|
|
|
520 |
"""
|
|
|
521 |
try:
|
|
|
522 |
itemKeysMap = {}
|
|
|
523 |
for key in MissedInventoryUpdate.query.filter_by(isIgnored = 1).all():
|
|
|
524 |
itemKeysMap[key.itemKey] = { key.warehouseId : to_java_date(key.timestamp) }
|
|
|
525 |
|
|
|
526 |
return itemKeysMap
|
|
|
527 |
finally:
|
|
|
528 |
close_session()
|
|
|
529 |
|
|
|
530 |
def addBadInventory(self, itemId, warehouseId, quantity):
|
|
|
531 |
"""
|
|
|
532 |
Add the BAD type inventory to existing stock.
|
|
|
533 |
|
|
|
534 |
Parameters:
|
|
|
535 |
- itemId
|
|
|
536 |
- warehouseId
|
|
|
537 |
- quantity
|
|
|
538 |
"""
|
|
|
539 |
try:
|
|
|
540 |
add_bad_inventory(itemId, warehouseId, quantity)
|
|
|
541 |
finally:
|
|
|
542 |
close_session()
|
|
|
543 |
|
|
|
544 |
def getShippingLocations(self, ):
|
|
|
545 |
"""
|
|
|
546 |
Returns all shipping locations
|
|
|
547 |
"""
|
|
|
548 |
try:
|
|
|
549 |
return [to_t_warehouse(w) for w in get_shipping_locations()]
|
|
|
550 |
finally:
|
|
|
551 |
close_session()
|
|
|
552 |
|
|
|
553 |
def getAllVendorItemMappings(self, ):
|
|
|
554 |
"""
|
|
|
555 |
Fetches all the vendor item mappings present.
|
|
|
556 |
"""
|
|
|
557 |
try:
|
|
|
558 |
return [to_t_vendor_item_mapping(m) for m in VendorItemMapping.query.all()]
|
|
|
559 |
finally:
|
|
|
560 |
close_session()
|
|
|
561 |
|
|
|
562 |
def getInventorySnapshot(self, warehouseId):
|
|
|
563 |
"""
|
|
|
564 |
Gets items' inventory for a warehouse
|
|
|
565 |
If warehouse is passed as zero, items' inventory across all warehouses is sent
|
|
|
566 |
|
|
|
567 |
Parameters:
|
|
|
568 |
- warehouseId
|
|
|
569 |
"""
|
|
|
570 |
try:
|
|
|
571 |
resultMap = {}
|
|
|
572 |
itemInventoryMap = get_inventory_snapshot(warehouseId)
|
|
|
573 |
for key, value in itemInventoryMap.items():
|
|
|
574 |
resultMap[key] = to_t_item_inventory(value, key)
|
|
|
575 |
|
|
|
576 |
return resultMap
|
|
|
577 |
finally:
|
|
|
578 |
close_session()
|
|
|
579 |
|
|
|
580 |
def clearItemAvailabilityCache(self, ):
|
|
|
581 |
"""
|
|
|
582 |
Clear item availability cache.
|
|
|
583 |
"""
|
|
|
584 |
try:
|
|
|
585 |
clear_item_availability_cache()
|
|
|
586 |
finally:
|
|
|
587 |
close_session()
|
| 5957 |
mandeep.dh |
588 |
|
| 6096 |
amit.gupta |
589 |
def clearItemAvailabilityCacheForItem(self, item_id):
|
|
|
590 |
"""
|
|
|
591 |
Clear item availability cache.
|
|
|
592 |
"""
|
|
|
593 |
try:
|
|
|
594 |
clear_item_availability_cache(item_id)
|
|
|
595 |
finally:
|
|
|
596 |
close_session()
|
|
|
597 |
|
| 5957 |
mandeep.dh |
598 |
def getPendingOrdersInventory(self, vendorId):
|
|
|
599 |
"""
|
|
|
600 |
Returns a list of inventory stock for items for which there are pending orders for the given vendor.
|
|
|
601 |
"""
|
|
|
602 |
try:
|
|
|
603 |
pending_items_inventory = get_pending_orders_inventory(vendorId)
|
|
|
604 |
return [AvailableAndReservedStock(itemId = i[0], available=i[1], reserved=i[2], minimumStock=0) for i in pending_items_inventory]
|
|
|
605 |
finally:
|
|
|
606 |
close_session()
|
|
|
607 |
|
| 5944 |
mandeep.dh |
608 |
def updateVendorString(self, warehouseId, vendorString):
|
|
|
609 |
"""
|
|
|
610 |
Parameters:
|
|
|
611 |
- warehouseId
|
|
|
612 |
- vendorString
|
|
|
613 |
"""
|
|
|
614 |
try:
|
|
|
615 |
update_vendor_string(warehouseId, vendorString)
|
|
|
616 |
finally:
|
|
|
617 |
close_session()
|
| 7718 |
amar.kumar |
618 |
def getOurWarehouseIdForVendor(self, vendorId, billingWarehouseId):
|
| 6467 |
amar.kumar |
619 |
"""
|
|
|
620 |
Returns warehouseId for our warehouse for a vendor
|
|
|
621 |
"""
|
|
|
622 |
try:
|
| 7718 |
amar.kumar |
623 |
return get_our_warehouse_id_for_vendor(vendorId, billingWarehouseId)
|
| 6467 |
amar.kumar |
624 |
finally:
|
| 6531 |
vikram.rag |
625 |
close_session()
|
|
|
626 |
def getMonitoredWarehouseForVendors(self, vendorIds):
|
|
|
627 |
"""
|
|
|
628 |
Returns monitored warehouse ids for vendors
|
|
|
629 |
"""
|
|
|
630 |
try:
|
|
|
631 |
return get_monitored_warehouses_for_vendors(vendorIds)
|
|
|
632 |
finally:
|
|
|
633 |
close_session()
|
|
|
634 |
def getIgnoredWarehouseidsAndItemids(self):
|
|
|
635 |
"""
|
|
|
636 |
Returns list of itemid and warehouseId for ignored inventory update
|
|
|
637 |
"""
|
|
|
638 |
try:
|
|
|
639 |
return get_ignored_warehouseids_and_itemids()
|
|
|
640 |
finally:
|
|
|
641 |
close_session()
|
|
|
642 |
|
|
|
643 |
def insertItemtoIgnoreInventoryUpdatelist(self,item_id,warehouse_id):
|
|
|
644 |
"""
|
|
|
645 |
Returns list of itemid and warehouseId for ignored inventory update
|
|
|
646 |
"""
|
|
|
647 |
try:
|
| 6532 |
amit.gupta |
648 |
return insert_item_to_ignore_inventory_update_list(item_id,warehouse_id)
|
| 6531 |
vikram.rag |
649 |
finally:
|
|
|
650 |
close_session()
|
|
|
651 |
def deleteItemFromIgnoredInventoryUpdateList(self,item_id,warehouse_id):
|
|
|
652 |
"""
|
|
|
653 |
Deletes warehouse and item entry from inventory update ignore list
|
|
|
654 |
"""
|
|
|
655 |
try:
|
|
|
656 |
return delete_item_from_ignore_inventory_update_list(item_id,warehouse_id)
|
|
|
657 |
finally:
|
|
|
658 |
close_session()
|
|
|
659 |
def getAllIgnoredInventoryupdateItemsCount(self):
|
|
|
660 |
"""
|
|
|
661 |
Returns all ignored inventory update item count
|
|
|
662 |
"""
|
| 6833 |
amar.kumar |
663 |
try:
|
|
|
664 |
return get_all_ignored_inventoryupdate_items_count()
|
|
|
665 |
finally:
|
|
|
666 |
close_session()
|
| 6531 |
vikram.rag |
667 |
|
|
|
668 |
|
|
|
669 |
def getIgnoredInventoryUpdateItemids(self,offset,limit):
|
|
|
670 |
"""
|
|
|
671 |
Returns all ignored inventory update items
|
|
|
672 |
"""
|
| 6833 |
amar.kumar |
673 |
try:
|
|
|
674 |
return get_ignored_inventoryupdate_itemids(offset,limit)
|
|
|
675 |
finally:
|
|
|
676 |
close_session()
|
| 6821 |
amar.kumar |
677 |
def updateItemStockPurchaseParams(self, item_id, numOfDaysStock, minStockLevel):
|
|
|
678 |
"""
|
|
|
679 |
Update/Add parameters required for heuristic purchase of Items
|
| 6833 |
amar.kumar |
680 |
"""
|
|
|
681 |
try:
|
|
|
682 |
update_item_stock_purchase_params(item_id, numOfDaysStock, minStockLevel)
|
|
|
683 |
finally:
|
|
|
684 |
close_session()
|
|
|
685 |
|
| 6821 |
amar.kumar |
686 |
def getItemStockPurchaseParams(self, item_id):
|
|
|
687 |
"""
|
|
|
688 |
Get parameters required for heuristic purchase of Items
|
| 6833 |
amar.kumar |
689 |
"""
|
|
|
690 |
try:
|
|
|
691 |
return to_t_item_stock_purchase_params(get_item_stock_purchase_params(item_id))
|
|
|
692 |
finally:
|
|
|
693 |
close_session()
|
|
|
694 |
|
| 6821 |
amar.kumar |
695 |
def addOosStatusForItem(self, oosStatusMap, date):
|
|
|
696 |
"""
|
|
|
697 |
Add OOS status for Item
|
|
|
698 |
"""
|
| 6833 |
amar.kumar |
699 |
try:
|
|
|
700 |
add_oos_status_for_item(oosStatusMap, date)
|
|
|
701 |
finally:
|
|
|
702 |
close_session()
|
|
|
703 |
|
| 9665 |
rajveer |
704 |
def getOosStatusesForXDaysForItem(self, itemId, sourceId, days):
|
| 6832 |
amar.kumar |
705 |
"""
|
| 9665 |
rajveer |
706 |
Get OOSStatus Objects for "days" number of days and sourceId for source. If sourceId is zero return for all sources.
|
| 6832 |
amar.kumar |
707 |
"""
|
| 6833 |
amar.kumar |
708 |
try:
|
| 9665 |
rajveer |
709 |
return [to_t_oos_status(oos) for oos in get_oos_statuses_for_x_days_for_item(itemId, sourceId, days)]
|
| 6833 |
amar.kumar |
710 |
finally:
|
| 6857 |
amar.kumar |
711 |
close_session()
|
|
|
712 |
|
| 10126 |
amar.kumar |
713 |
def getOosStatusesForXDays(self, sourceId, days):
|
|
|
714 |
"""
|
|
|
715 |
Get OOSStatus Objects for "days" number of days and sourceId for source. If sourceId is zero return for all sources.
|
|
|
716 |
"""
|
|
|
717 |
try:
|
|
|
718 |
return [to_t_oos_status(oos) for oos in get_oos_statuses_for_x_days(sourceId, days)]
|
|
|
719 |
finally:
|
|
|
720 |
close_session()
|
|
|
721 |
|
| 6857 |
amar.kumar |
722 |
def getNonZeroItemStockPurchaseParams(self):
|
|
|
723 |
"""
|
|
|
724 |
Get All ItemStockPurchaseParam objects where either minStockLevel or minNumOfDaysOfStock is zero
|
|
|
725 |
"""
|
|
|
726 |
try:
|
|
|
727 |
return [to_t_item_stock_purchase_params(ispp) for ispp in get_non_zero_item_stock_purchase_params()]
|
|
|
728 |
finally:
|
| 7149 |
amar.kumar |
729 |
close_session()
|
| 7972 |
amar.kumar |
730 |
|
|
|
731 |
def getLastNdaySaleForItem(self, itemId, numberOfDays):
|
|
|
732 |
"""
|
|
|
733 |
Get Sale for Last N day for an Item
|
|
|
734 |
"""
|
|
|
735 |
try:
|
|
|
736 |
return get_last_n_day_sale_for_item(itemId, numberOfDays)
|
|
|
737 |
finally:
|
|
|
738 |
close_session()
|
| 7149 |
amar.kumar |
739 |
def getBillableInventoryAndPendingOrders(self):
|
|
|
740 |
"""
|
|
|
741 |
Returns a list of inventory stock for items for which there are pending orders or have
|
|
|
742 |
billable inventory.
|
|
|
743 |
"""
|
|
|
744 |
try:
|
|
|
745 |
items_inventory = get_billable_inventory_and_pending_orders()
|
|
|
746 |
return [AvailableAndReservedStock(itemId = i[0], available=i[1], reserved=i[2], minimumStock=0) for i in items_inventory]
|
|
|
747 |
finally:
|
| 7281 |
kshitij.so |
748 |
close_session()
|
|
|
749 |
|
|
|
750 |
def getWarehouseName(self,warehouseId):
|
|
|
751 |
try:
|
|
|
752 |
name = get_warehouse_name(warehouseId)
|
|
|
753 |
return name
|
|
|
754 |
finally:
|
|
|
755 |
close_session()
|
|
|
756 |
|
|
|
757 |
def getAmazonInventoryForItem(self, amazonItemId):
|
| 7316 |
kshitij.so |
758 |
result = []
|
| 7281 |
kshitij.so |
759 |
try:
|
|
|
760 |
result = get_amazon_inventory_for_item(amazonItemId)
|
|
|
761 |
if result is not None:
|
|
|
762 |
result = to_t_amazon_inventory_snapshot(result)
|
|
|
763 |
except:
|
| 7316 |
kshitij.so |
764 |
return result
|
| 7281 |
kshitij.so |
765 |
finally:
|
|
|
766 |
close_session()
|
|
|
767 |
return result
|
|
|
768 |
|
|
|
769 |
def getAllAmazonInventory(self):
|
|
|
770 |
try:
|
|
|
771 |
amazoninventory = []
|
|
|
772 |
all_inventory = get_all_amazon_inventory()
|
|
|
773 |
for inventory in all_inventory:
|
|
|
774 |
amazoninventory.append(to_t_amazon_inventory_snapshot((inventory)))
|
|
|
775 |
return amazoninventory
|
|
|
776 |
finally:
|
|
|
777 |
close_session()
|
|
|
778 |
|
| 10450 |
vikram.rag |
779 |
def addOrUpdateAmazonInventoryForItem(self, amazoninventorysnapshot,time):
|
| 7281 |
kshitij.so |
780 |
try:
|
| 10450 |
vikram.rag |
781 |
add_or_update_amazon_inventory_for_item(amazoninventorysnapshot,time)
|
| 7281 |
kshitij.so |
782 |
finally:
|
| 8182 |
amar.kumar |
783 |
close_session()
|
|
|
784 |
|
| 8282 |
kshitij.so |
785 |
def addOrUpdateAmazonFbaInventory(self,amazonfbainventorysnapshot):
|
|
|
786 |
try:
|
| 11173 |
vikram.rag |
787 |
add_or_update_amazon_fba_inventory(amazonfbainventorysnapshot)
|
|
|
788 |
session.commit()
|
|
|
789 |
return True
|
| 8282 |
kshitij.so |
790 |
finally:
|
|
|
791 |
close_session()
|
|
|
792 |
|
| 8182 |
amar.kumar |
793 |
def addUpdateHoldInventory(self, itemId, warehouseId, holdQuantity, source):
|
|
|
794 |
try:
|
|
|
795 |
add_update_hold_inventory(itemId, warehouseId, holdQuantity, source)
|
|
|
796 |
finally:
|
| 8282 |
kshitij.so |
797 |
close_session()
|
|
|
798 |
|
|
|
799 |
def getAmazonFbaItemInventory(self,itemId):
|
| 11173 |
vikram.rag |
800 |
fba_inventory = []
|
| 8282 |
kshitij.so |
801 |
try:
|
| 11173 |
vikram.rag |
802 |
for inventory in get_amazon_fba_inventory(itemId):
|
|
|
803 |
fba_inventory.append(to_t_amazon_fba_inventory_snapshot(inventory))
|
|
|
804 |
return fba_inventory
|
| 8282 |
kshitij.so |
805 |
finally:
|
|
|
806 |
close_session()
|
|
|
807 |
|
| 8363 |
vikram.rag |
808 |
def getAllAmazonFbaItemInventory(self):
|
|
|
809 |
all_fba_inventory = []
|
| 8282 |
kshitij.so |
810 |
try:
|
| 8363 |
vikram.rag |
811 |
for inventory in get_all_amazon_fba_inventory():
|
|
|
812 |
all_fba_inventory.append(to_t_amazon_fba_inventory_snapshot(inventory))
|
|
|
813 |
return all_fba_inventory
|
| 8282 |
kshitij.so |
814 |
except:
|
|
|
815 |
return None
|
|
|
816 |
finally:
|
| 8363 |
vikram.rag |
817 |
close_session()
|
|
|
818 |
|
|
|
819 |
def getOursGoodWarehouseIdsForLocation(self,state_id):
|
|
|
820 |
ids=[]
|
| 8572 |
vikram.rag |
821 |
try:
|
|
|
822 |
for id in get_oursgood_warehouseids_for_location(state_id):
|
|
|
823 |
ids.append(id[0])
|
|
|
824 |
return ids
|
|
|
825 |
except:
|
|
|
826 |
return None
|
|
|
827 |
finally:
|
| 8954 |
vikram.rag |
828 |
close_session()
|
|
|
829 |
|
|
|
830 |
def getHoldInventoryDetailForItemForWarehouseIdExceptSource(self,item_id,warehouse_id,source):
|
|
|
831 |
try:
|
|
|
832 |
return get_holdinventorydetail_forItem_forWarehouseId_exceptsource(item_id,warehouse_id,source)
|
|
|
833 |
finally:
|
| 9404 |
vikram.rag |
834 |
close_session()
|
|
|
835 |
|
|
|
836 |
def getSnapdealInventoryForItem(self,item_id):
|
|
|
837 |
try:
|
|
|
838 |
return to_t_snapdeal_inventory_snapshot(get_snapdeal_inventory_for_item(item_id))
|
|
|
839 |
finally:
|
|
|
840 |
close_session()
|
|
|
841 |
def addOrUpdateSnapdealInventoryForItem(self,snapdealinventoryitem):
|
|
|
842 |
try:
|
|
|
843 |
add_or_update_snapdeal_inventor_for_item(snapdealinventoryitem)
|
|
|
844 |
finally:
|
|
|
845 |
close_session()
|
|
|
846 |
|
|
|
847 |
def getNlcForWarehouse(self,warehouse_id,item_id):
|
|
|
848 |
try:
|
|
|
849 |
return get_nlc_for_warehouse(warehouse_id,item_id)
|
|
|
850 |
finally:
|
| 9456 |
vikram.rag |
851 |
close_session()
|
|
|
852 |
|
| 9495 |
vikram.rag |
853 |
def addOrUpdateAllAmazonFbaInventory(self,allamazonfbainventorysnapshot):
|
| 11173 |
vikram.rag |
854 |
print 'inside handler'
|
| 9456 |
vikram.rag |
855 |
try:
|
| 9495 |
vikram.rag |
856 |
for amazonfbainventorysnapshot in allamazonfbainventorysnapshot:
|
| 11173 |
vikram.rag |
857 |
print amazonfbainventorysnapshot
|
| 9495 |
vikram.rag |
858 |
add_or_update_amazon_fba_inventory(amazonfbainventorysnapshot)
|
| 11173 |
vikram.rag |
859 |
session.commit()
|
| 9456 |
vikram.rag |
860 |
finally:
|
| 9482 |
vikram.rag |
861 |
close_session()
|
| 9495 |
vikram.rag |
862 |
|
|
|
863 |
def addOrUpdateAllSnapdealInventory(self,allsnapdealinventorysnapshot):
|
|
|
864 |
try:
|
|
|
865 |
for snapdealinventorysnapshot in allsnapdealinventorysnapshot:
|
|
|
866 |
add_or_update_snapdeal_inventor_for_item(snapdealinventorysnapshot)
|
|
|
867 |
finally:
|
|
|
868 |
close_session()
|
| 9456 |
vikram.rag |
869 |
|
| 9495 |
vikram.rag |
870 |
def getSnapdealInventorySnapshot(self):
|
| 9503 |
vikram.rag |
871 |
allsnapdealinventorysnapshot = []
|
|
|
872 |
try:
|
| 9504 |
vikram.rag |
873 |
for inventorysnapshot in get_snapdeal_inventory_snapshot():
|
|
|
874 |
allsnapdealinventorysnapshot.append(to_t_snapdeal_inventory_snapshot(inventorysnapshot))
|
|
|
875 |
return allsnapdealinventorysnapshot
|
| 9495 |
vikram.rag |
876 |
finally:
|
|
|
877 |
close_session()
|
| 9640 |
amar.kumar |
878 |
|
|
|
879 |
def getHeldInventoryMapForItem(self, itemId, warehouseId):
|
|
|
880 |
try:
|
|
|
881 |
return get_held_inventory_map_for_item(itemId, warehouseId)
|
|
|
882 |
finally:
|
|
|
883 |
close_session()
|
| 9761 |
amar.kumar |
884 |
|
|
|
885 |
def getHoldInventoryDetails(self, itemId, warehouseId, source):
|
|
|
886 |
try:
|
|
|
887 |
return [to_t_hold_inventory_detail(holdInventoryDetail) for holdInventoryDetail in get_hold_inventory_details(itemId, warehouseId, source)]
|
|
|
888 |
finally:
|
|
|
889 |
close_session()
|
| 10050 |
vikram.rag |
890 |
|
| 10450 |
vikram.rag |
891 |
def addOrUpdateFlipkartInventorySnapshot(self,flipkartInventorySnapshot,time):
|
| 10050 |
vikram.rag |
892 |
try:
|
| 10450 |
vikram.rag |
893 |
add_or_update_flipkart_inventory_snapshot(flipkartInventorySnapshot,time)
|
| 10050 |
vikram.rag |
894 |
finally:
|
|
|
895 |
close_session()
|
|
|
896 |
|
|
|
897 |
|
|
|
898 |
def getFlipkartInventorySnapshot(self):
|
|
|
899 |
try:
|
|
|
900 |
return [to_t_flipkart_inventory_snapshot(snapshot) for snapshot in get_flipkart_inventory_snapshot()]
|
|
|
901 |
finally:
|
|
|
902 |
close_session()
|
| 10097 |
kshitij.so |
903 |
|
|
|
904 |
def getFlipkartlInventoryForItem(self,item_id):
|
|
|
905 |
try:
|
|
|
906 |
return to_t_flipkart_inventory_snapshot(get_flipkart_inventory_for_Item(item_id))
|
|
|
907 |
finally:
|
|
|
908 |
close_session()
|
| 10485 |
vikram.rag |
909 |
|
|
|
910 |
def getStateMaster(self):
|
|
|
911 |
try:
|
|
|
912 |
return get_state_master()
|
|
|
913 |
finally:
|
| 10544 |
vikram.rag |
914 |
close_session()
|
|
|
915 |
|
|
|
916 |
def updateSnapdealStockAtEOD(self,allsnapdealstock):
|
|
|
917 |
try:
|
|
|
918 |
update_snapdeal_stock_at_eod(allsnapdealstock)
|
|
|
919 |
finally:
|
|
|
920 |
close_session()
|
|
|
921 |
|
|
|
922 |
def updateFlipkartStockAtEOD(self,allflipkartstock):
|
|
|
923 |
try:
|
|
|
924 |
update_flipkart_stock_at_eod(allflipkartstock)
|
|
|
925 |
finally:
|
|
|
926 |
close_session()
|
|
|
927 |
|
|
|
928 |
|
|
|
929 |
|
| 9495 |
vikram.rag |
930 |
|