| Line 597... |
Line 597... |
| 597 |
total_availability = 0
|
597 |
total_availability = 0
|
| 598 |
for warehouse_id in warehouse_ids:
|
598 |
for warehouse_id in warehouse_ids:
|
| 599 |
try:
|
599 |
try:
|
| 600 |
current_inventory_snapshot = CurrentInventorySnapshot.query.filter_by(warehouse_id = warehouse_id, item_id = item_id).one()
|
600 |
current_inventory_snapshot = CurrentInventorySnapshot.query.filter_by(warehouse_id = warehouse_id, item_id = item_id).one()
|
| 601 |
availability = current_inventory_snapshot.availibility - current_inventory_snapshot.reserved
|
601 |
availability = current_inventory_snapshot.availibility - current_inventory_snapshot.reserved
|
| - |
|
602 |
except Exception as e:
|
| 602 |
except:
|
603 |
print e
|
| 603 |
availability = 0
|
604 |
availability = 0
|
| 604 |
if availability > max_availability:
|
605 |
if availability > max_availability:
|
| 605 |
warehouse_retid = warehouse_id
|
606 |
warehouse_retid = warehouse_id
|
| 606 |
max_availability = availability
|
607 |
max_availability = availability
|
| 607 |
total_availability = total_availability + availability
|
608 |
total_availability = total_availability + availability
|
| Line 614... |
Line 615... |
| 614 |
warehouse_retid = int(item.preferredWarehouse)
|
615 |
warehouse_retid = int(item.preferredWarehouse)
|
| 615 |
warehouse = Warehouse.get_by(id=warehouse_retid)
|
616 |
warehouse = Warehouse.get_by(id=warehouse_retid)
|
| 616 |
try:
|
617 |
try:
|
| 617 |
current_inventory_snapshot = CurrentInventorySnapshot.query.filter_by(warehouse_id = warehouse_retid, item_id = item_id).one()
|
618 |
current_inventory_snapshot = CurrentInventorySnapshot.query.filter_by(warehouse_id = warehouse_retid, item_id = item_id).one()
|
| 618 |
max_availability = current_inventory_snapshot.availibility - current_inventory_snapshot.reserved
|
619 |
max_availability = current_inventory_snapshot.availibility - current_inventory_snapshot.reserved
|
| - |
|
620 |
except Exception as e:
|
| 619 |
except:
|
621 |
print e
|
| 620 |
max_availability = 0
|
622 |
max_availability = 0
|
| 621 |
total_availability = max_availability
|
623 |
total_availability = max_availability
|
| 622 |
|
624 |
|
| - |
|
625 |
if item.expectedDelay is None:
|
| - |
|
626 |
print 'expectedDelay field for this item was Null. Resetting it to 0'
|
| - |
|
627 |
item.expectedDelay = 0
|
| - |
|
628 |
|
| 623 |
return [warehouse.logisticsLocation, warehouse_retid, total_availability, item.expectedDelay]
|
629 |
return [warehouse.logisticsLocation, warehouse_retid, total_availability, item.expectedDelay]
|
| 624 |
|
630 |
|
| 625 |
def get_warehouses_for_item(item_id):
|
631 |
def get_warehouses_for_item(item_id):
|
| 626 |
|
632 |
|
| 627 |
if not item_id:
|
633 |
if not item_id:
|