| Line 501... |
Line 501... |
| 501 |
##Check risky status for the source
|
501 |
##Check risky status for the source
|
| 502 |
__check_risky_item(item_id, source_id)
|
502 |
__check_risky_item(item_id, source_id)
|
| 503 |
return get_item_availability_for_location(item_id, source_id)
|
503 |
return get_item_availability_for_location(item_id, source_id)
|
| 504 |
|
504 |
|
| 505 |
def clear_item_availability_cache(item_id = None):
|
505 |
def clear_item_availability_cache(item_id = None):
|
| - |
|
506 |
if type(item_id)==list:
|
| - |
|
507 |
ItemAvailabilityCache.query.filter(ItemAvailabilityCache.itemId.in_(item_id)).delete()
|
| - |
|
508 |
session.commit()
|
| - |
|
509 |
print True
|
| 506 |
if item_id:
|
510 |
if item_id:
|
| 507 |
ItemAvailabilityCache.query.filter_by(itemId = item_id).delete()
|
511 |
ItemAvailabilityCache.query.filter_by(itemId = item_id).delete()
|
| 508 |
session.commit()
|
512 |
session.commit()
|
| 509 |
else:
|
513 |
else:
|
| 510 |
ItemAvailabilityCache.query.delete()
|
514 |
ItemAvailabilityCache.query.delete()
|
| Line 987... |
Line 991... |
| 987 |
else:
|
991 |
else:
|
| 988 |
raise InventoryServiceException(101, 'VendorMapping not found for: ' + itemKey)
|
992 |
raise InventoryServiceException(101, 'VendorMapping not found for: ' + itemKey)
|
| 989 |
session.commit()
|
993 |
session.commit()
|
| 990 |
|
994 |
|
| 991 |
def reset_availability_for_warehouse(warehouseId):
|
995 |
def reset_availability_for_warehouse(warehouseId):
|
| - |
|
996 |
itemIds = []
|
| 992 |
for currentInventorySnapshot in CurrentInventorySnapshot.query.filter_by(warehouse_id=warehouseId).all():
|
997 |
for currentInventorySnapshot in CurrentInventorySnapshot.query.filter_by(warehouse_id=warehouseId).all():
|
| 993 |
currentInventorySnapshot.availability = 0
|
998 |
currentInventorySnapshot.availability = 0
|
| 994 |
clear_item_availability_cache(currentInventorySnapshot.item_id)
|
999 |
itemIds.append(currentInventorySnapshot.item_id)
|
| - |
|
1000 |
clear_item_availability_cache(itemIds)
|
| 995 |
session.commit()
|
1001 |
session.commit()
|
| 996 |
|
1002 |
|
| 997 |
def get_our_warehouse_id_for_vendor(vendor_id, billing_warehouse_id):
|
1003 |
def get_our_warehouse_id_for_vendor(vendor_id, billing_warehouse_id):
|
| 998 |
try:
|
1004 |
try:
|
| 999 |
warehouse = Warehouse.query.filter_by(vendor_id = vendor_id, warehouseType = 'OURS', inventoryType = 'GOOD', billingWarehouseId = billing_warehouse_id).first()
|
1005 |
warehouse = Warehouse.query.filter_by(vendor_id = vendor_id, warehouseType = 'OURS', inventoryType = 'GOOD', billingWarehouseId = billing_warehouse_id).first()
|