| Line 242... |
Line 242... |
| 242 |
raise InventoryServiceException(108, "warehouse id not present")
|
242 |
raise InventoryServiceException(108, "warehouse id not present")
|
| 243 |
warehouse.status = 0;
|
243 |
warehouse.status = 0;
|
| 244 |
session.commit()
|
244 |
session.commit()
|
| 245 |
|
245 |
|
| 246 |
def get_item_availability_for_warehouse(warehouse_id, item_id):
|
246 |
def get_item_availability_for_warehouse(warehouse_id, item_id):
|
| 247 |
ignore = IgnoredInventoryUpdateItems.query.filter_by(item_id=item_id).filter_by(warehouse_id = warehouse_id).one()
|
247 |
ignore = IgnoredInventoryUpdateItems.query.filter_by(item_id=item_id).filter_by(warehouse_id = warehouse_id).all()
|
| 248 |
if ignore:
|
248 |
if ignore:
|
| 249 |
return 0
|
249 |
return 0
|
| 250 |
|
250 |
|
| 251 |
try:
|
251 |
try:
|
| 252 |
current_inventory_snapshot = CurrentInventorySnapshot.query.filter_by(warehouse_id = warehouse_id).filter_by(item_id = item_id).one()
|
252 |
current_inventory_snapshot = CurrentInventorySnapshot.query.filter_by(warehouse_id = warehouse_id).filter_by(item_id = item_id).one()
|
| Line 486... |
Line 486... |
| 486 |
if warehouse.transferDelayInHours:
|
486 |
if warehouse.transferDelayInHours:
|
| 487 |
expectedDelay = expectedDelay + warehouse.transferDelayInHours / 24
|
487 |
expectedDelay = expectedDelay + warehouse.transferDelayInHours / 24
|
| 488 |
|
488 |
|
| 489 |
total_availability = 0
|
489 |
total_availability = 0
|
| 490 |
for entry in CurrentInventorySnapshot.query.filter_by(item_id = item_id).all():
|
490 |
for entry in CurrentInventorySnapshot.query.filter_by(item_id = item_id).all():
|
| - |
|
491 |
if entry.warehouse_id not in ignoredWhs:
|
| 491 |
total_availability += entry.availability - entry.reserved
|
492 |
total_availability += entry.availability - entry.reserved
|
| 492 |
|
493 |
|
| 493 |
item_availability_cache = ItemAvailabilityCache.get_by(itemId=item_id, sourceId=source_id)
|
494 |
item_availability_cache = ItemAvailabilityCache.get_by(itemId=item_id, sourceId=source_id)
|
| 494 |
if item_availability_cache is None:
|
495 |
if item_availability_cache is None:
|
| 495 |
item_availability_cache = ItemAvailabilityCache()
|
496 |
item_availability_cache = ItemAvailabilityCache()
|
| 496 |
item_availability_cache.itemId = item_id
|
497 |
item_availability_cache.itemId = item_id
|