| Line 49... |
Line 49... |
| 49 |
pincodePricingServiceabilityMap = {}
|
49 |
pincodePricingServiceabilityMap = {}
|
| 50 |
warehouseMap = {}
|
50 |
warehouseMap = {}
|
| 51 |
logisticsLocationWarehouseMap = {}
|
51 |
logisticsLocationWarehouseMap = {}
|
| 52 |
|
52 |
|
| 53 |
OOS_CALCULATION_TIME = 23
|
53 |
OOS_CALCULATION_TIME = 23
|
| - |
|
54 |
|
| - |
|
55 |
#right now these warehouse ids are ignored.
|
| 54 |
physicalWarehouseIdsForFofo = [7678, 7681]
|
56 |
physicalWarehouseIdsForFofo = [7678, 7681]
|
| 55 |
vendorWarehouseIdsForFofo = []
|
57 |
vendorWarehouseIdsForFofo = []
|
| 56 |
|
58 |
|
| 57 |
last_date = datetime.date.today()
|
59 |
last_date = datetime.date.today()
|
| 58 |
adjusted_dates={}
|
60 |
adjusted_dates={}
|
| Line 318... |
Line 320... |
| 318 |
print e
|
320 |
print e
|
| 319 |
raise PurchaseServiceException(101, 'Exception while fetching availability of items in our warehouses')
|
321 |
raise PurchaseServiceException(101, 'Exception while fetching availability of items in our warehouses')
|
| 320 |
|
322 |
|
| 321 |
return availability_map
|
323 |
return availability_map
|
| 322 |
|
324 |
|
| - |
|
325 |
#As of now as warehouse can be managed independently we just need to return itemavailability cache for the item ids provided
|
| 323 |
def get_fofo_availability(item_ids):
|
326 |
def get_fofo_availability(item_ids):
|
| 324 |
#TODO: Amit Should be removed physicalWarehouseIdsForFofo
|
- |
|
| 325 |
returnMap = {}
|
327 |
returnMap = {}
|
| 326 |
if not item_ids:
|
328 |
if not item_ids:
|
| 327 |
return returnMap
|
329 |
return returnMap
|
| 328 |
snapshots = CurrentInventorySnapshot.query.filter(CurrentInventorySnapshot.warehouse_id.in_(vendorWarehouseIdsForFofo)).filter(CurrentInventorySnapshot.item_id.in_(item_ids)).all()
|
- |
|
| 329 |
for snapshot in snapshots:
|
330 |
for item_id in item_ids:
|
| 330 |
if returnMap.has_key(snapshot.item_id):
|
- |
|
| 331 |
returnMap[snapshot.item_id] += snapshot.availability - snapshot.reserved - snapshot.held
|
- |
|
| 332 |
else:
|
- |
|
| 333 |
returnMap[snapshot.item_id] = snapshot.availability - snapshot.reserved - snapshot.held
|
331 |
returnMap[item_id] = get_item_availability_for_location(item_id, 1)[4]
|
| 334 |
return returnMap
|
332 |
return returnMap
|
| - |
|
333 |
#TODO: Amit Should be removed physicalWarehouseIdsForFofo
|
| - |
|
334 |
# returnMap = {}
|
| - |
|
335 |
# if not item_ids:
|
| - |
|
336 |
# return returnMap
|
| - |
|
337 |
# snapshots = CurrentInventorySnapshot.query.filter(CurrentInventorySnapshot.warehouse_id.in_(vendorWarehouseIdsForFofo)).filter(CurrentInventorySnapshot.item_id.in_(item_ids)).all()
|
| - |
|
338 |
# for snapshot in snapshots:
|
| - |
|
339 |
# if returnMap.has_key(snapshot.item_id):
|
| - |
|
340 |
# returnMap[snapshot.item_id] += snapshot.availability - snapshot.reserved - snapshot.held
|
| - |
|
341 |
# else:
|
| - |
|
342 |
# returnMap[snapshot.item_id] = snapshot.availability - snapshot.reserved - snapshot.held
|
| - |
|
343 |
# return returnMap
|
| 335 |
|
344 |
|
| 336 |
def get_fofo_fulfilment_warehouse_map(itemIds):
|
345 |
def get_fofo_fulfilment_warehouse_map(itemIds):
|
| 337 |
returnMap = {}
|
346 |
returnMap = {}
|
| 338 |
snapshots = CurrentInventorySnapshot.query.filter(CurrentInventorySnapshot.warehouse_id.in_(vendorWarehouseIdsForFofo)).filter(CurrentInventorySnapshot.item_id.in_(itemIds)).all()
|
347 |
snapshots = CurrentInventorySnapshot.query.filter(CurrentInventorySnapshot.warehouse_id.in_(vendorWarehouseIdsForFofo)).filter(CurrentInventorySnapshot.item_id.in_(itemIds)).all()
|
| 339 |
for snapshot in snapshots:
|
348 |
for snapshot in snapshots:
|