| Line 631... |
Line 631... |
| 631 |
|
631 |
|
| 632 |
if warehouse.warehouseType == WarehouseType.THIRD_PARTY:
|
632 |
if warehouse.warehouseType == WarehouseType.THIRD_PARTY:
|
| 633 |
expectedDelay = expectedDelay + __get_vendor_holiday_delay(warehouse.vendor_id, expectedDelay)
|
633 |
expectedDelay = expectedDelay + __get_vendor_holiday_delay(warehouse.vendor_id, expectedDelay)
|
| 634 |
|
634 |
|
| 635 |
total_availability = 0
|
635 |
total_availability = 0
|
| 636 |
for entry in CurrentInventorySnapshot.query.filter_by(item_id = item_id).all():
|
636 |
for entry in CurrentInventorySnapshot.query.join(CurrentInventorySnapshot.warehouse).filter_by(item_id = item_id).all():
|
| 637 |
if entry.warehouse_id not in ignoredWhs:
|
637 |
if entry.warehouse_id not in ignoredWhs:
|
| - |
|
638 |
if entry.warehouse_id not in ourGoodWarehouses and entry.warehouse_id not in ourGoodWarehouses:
|
| - |
|
639 |
continue
|
| - |
|
640 |
if entry.warehouse_id in ourGoodWarehouses and ourGoodWarehouses[entry.warehouse_id].billingWarehouseId == billingWarehouseId:
|
| 638 |
total_availability += entry.availability - entry.reserved - entry.held
|
641 |
total_availability += entry.availability - entry.reserved - entry.held
|
| - |
|
642 |
elif entry.warehouse_id in thirdpartyWarehouses:
|
| - |
|
643 |
vendorId = thirdpartyWarehouses[entry.warehouse_id].vendor_id
|
| - |
|
644 |
for goodWarehouse in ourGoodWarehouses.values():
|
| - |
|
645 |
if goodWarehouse.vendor_id==vendorId and goodWarehouse.billingWarehouseId == billingWarehouseId:
|
| - |
|
646 |
total_availability += entry.availability - entry.reserved - entry.held
|
| - |
|
647 |
break
|
| 639 |
|
648 |
|
| 640 |
item_availability_cache = ItemAvailabilityCache.get_by(itemId=item_id, sourceId=source_id)
|
649 |
item_availability_cache = ItemAvailabilityCache.get_by(itemId=item_id, sourceId=source_id)
|
| 641 |
if item_availability_cache is None:
|
650 |
if item_availability_cache is None:
|
| 642 |
item_availability_cache = ItemAvailabilityCache()
|
651 |
item_availability_cache = ItemAvailabilityCache()
|
| 643 |
item_availability_cache.itemId = item_id
|
652 |
item_availability_cache.itemId = item_id
|