| Line 1879... |
Line 1879... |
| 1879 |
if vendorItemMapping:
|
1879 |
if vendorItemMapping:
|
| 1880 |
itemId = vendorItemMapping.item_id
|
1880 |
itemId = vendorItemMapping.item_id
|
| 1881 |
currentInventorySnapshot = CurrentInventorySnapshot.get_by(item_id = itemId, warehouse_id = warehouseId)
|
1881 |
currentInventorySnapshot = CurrentInventorySnapshot.get_by(item_id = itemId, warehouse_id = warehouseId)
|
| 1882 |
if currentInventorySnapshot:
|
1882 |
if currentInventorySnapshot:
|
| 1883 |
currentInventorySnapshot.availability = quantity
|
1883 |
currentInventorySnapshot.availability = quantity
|
| - |
|
1884 |
__update_item_availability_cache(itemId)
|
| - |
|
1885 |
check_risky_item(currentInventorySnapshot.item)
|
| 1884 |
else:
|
1886 |
else:
|
| 1885 |
add_inventory(itemId, warehouseId, quantity)
|
1887 |
add_inventory(itemId, warehouseId, quantity)
|
| 1886 |
else:
|
1888 |
else:
|
| 1887 |
raise InventoryServiceException(101, 'VendorMapping not found for: ' + itemKey)
|
1889 |
raise InventoryServiceException(101, 'VendorMapping not found for: ' + itemKey)
|
| 1888 |
session.commit()
|
1890 |
session.commit()
|
| 1889 |
|
1891 |
|
| 1890 |
def reset_availability_for_warehouse(warehouseId):
|
1892 |
def reset_availability_for_warehouse(warehouseId):
|
| 1891 |
for currentInventorySnapshot in CurrentInventorySnapshot.query.filter_by(warehouse_id=warehouseId).all():
|
1893 |
for currentInventorySnapshot in CurrentInventorySnapshot.query.filter_by(warehouse_id=warehouseId).all():
|
| 1892 |
currentInventorySnapshot.availability = 0
|
1894 |
currentInventorySnapshot.availability = 0
|
| - |
|
1895 |
__update_item_availability_cache(currentInventorySnapshot.item_id)
|
| - |
|
1896 |
check_risky_item(currentInventorySnapshot.item)
|
| 1893 |
session.commit()
|
1897 |
session.commit()
|
| 1894 |
|
1898 |
|
| 1895 |
def __send_mail(subject, message):
|
1899 |
def __send_mail(subject, message):
|
| 1896 |
try:
|
1900 |
try:
|
| 1897 |
thread = threading.Thread(target=partial(mail, from_user, from_pwd, to_addresses, subject, message))
|
1901 |
thread = threading.Thread(target=partial(mail, from_user, from_pwd, to_addresses, subject, message))
|