| Line 220... |
Line 220... |
| 220 |
current_inventory_snapshot.held = 0
|
220 |
current_inventory_snapshot.held = 0
|
| 221 |
# added the difference in the current inventory
|
221 |
# added the difference in the current inventory
|
| 222 |
current_inventory_snapshot.availability = current_inventory_snapshot.availability + quantity
|
222 |
current_inventory_snapshot.availability = current_inventory_snapshot.availability + quantity
|
| 223 |
session.commit()
|
223 |
session.commit()
|
| 224 |
#**Update item availability cache**#
|
224 |
#**Update item availability cache**#
|
| 225 |
clear_item_availability_cache(itemId)
|
225 |
clear_item_availability_cache([itemId])
|
| 226 |
if current_inventory_snapshot.availability < 0:
|
226 |
if current_inventory_snapshot.availability < 0:
|
| 227 |
item = __get_item_from_master(itemId)
|
227 |
item = __get_item_from_master(itemId)
|
| 228 |
__send_alert_for_negative_availability(item, current_inventory_snapshot.availability, get_Warehouse(warehouseId))
|
228 |
__send_alert_for_negative_availability(item, current_inventory_snapshot.availability, get_Warehouse(warehouseId))
|
| 229 |
|
229 |
|
| 230 |
def add_bad_inventory(itemId, warehouseId, quantity):
|
230 |
def add_bad_inventory(itemId, warehouseId, quantity):
|
| Line 828... |
Line 828... |
| 828 |
|
828 |
|
| 829 |
def get_item_mappings(item_id):
|
829 |
def get_item_mappings(item_id):
|
| 830 |
item_mappings = VendorItemMapping.query.filter_by(item_id=item_id).all()
|
830 |
item_mappings = VendorItemMapping.query.filter_by(item_id=item_id).all()
|
| 831 |
return item_mappings
|
831 |
return item_mappings
|
| 832 |
|
832 |
|
| 833 |
def add_vendor_pricing(vendorItemPricing):
|
833 |
def add_vendor_pricing(vendorItemPricing, sendMail = True):
|
| 834 |
if not vendorItemPricing:
|
834 |
if not vendorItemPricing:
|
| 835 |
raise InventoryServiceException(108, "Bad vendorItemPricing in request")
|
835 |
raise InventoryServiceException(108, "Bad vendorItemPricing in request")
|
| 836 |
vendorId = vendorItemPricing.vendorId
|
836 |
vendorId = vendorItemPricing.vendorId
|
| 837 |
itemId = vendorItemPricing.itemId
|
837 |
itemId = vendorItemPricing.itemId
|
| 838 |
|
838 |
|
| Line 876... |
Line 876... |
| 876 |
subject = "Alert:Change in NLC {0} {1} {2} {3} {4}".format(item.brand, item.modelName, item.modelNumber, item.color, itemId)
|
876 |
subject = "Alert:Change in NLC {0} {1} {2} {3} {4}".format(item.brand, item.modelName, item.modelNumber, item.color, itemId)
|
| 877 |
ds_vendorItemPricing.nlc = vendorItemPricing.nlc
|
877 |
ds_vendorItemPricing.nlc = vendorItemPricing.nlc
|
| 878 |
session.commit()
|
878 |
session.commit()
|
| 879 |
client = CatalogClient("catalog_service_server_host_staging", "catalog_service_server_port").get_client()
|
879 |
client = CatalogClient("catalog_service_server_host_staging", "catalog_service_server_port").get_client()
|
| 880 |
client.updateNlcAtMarketplaces(itemId,vendorId,ds_vendorItemPricing.nlc)
|
880 |
client.updateNlcAtMarketplaces(itemId,vendorId,ds_vendorItemPricing.nlc)
|
| 881 |
if subject:
|
881 |
if subject and sendMail:
|
| 882 |
__send_mail(subject, message)
|
882 |
__send_mail(subject, message)
|
| 883 |
return
|
883 |
return
|
| 884 |
|
884 |
|
| 885 |
def add_vendor_item_mapping(key, vendorItemMapping):
|
885 |
def add_vendor_item_mapping(key, vendorItemMapping):
|
| 886 |
if not vendorItemMapping:
|
886 |
if not vendorItemMapping:
|
| Line 1459... |
Line 1459... |
| 1459 |
return 0.0
|
1459 |
return 0.0
|
| 1460 |
else:
|
1460 |
else:
|
| 1461 |
return stockWanlc[0].avgWeightedNlc
|
1461 |
return stockWanlc[0].avgWeightedNlc
|
| 1462 |
|
1462 |
|
| 1463 |
def get_all_available_amazon_inventory():
|
1463 |
def get_all_available_amazon_inventory():
|
| 1464 |
return AmazonFbaInventorySnapshot.query.filter(AmazonFbaInventorySnapshot.availability>0).all()
|
1464 |
return AmazonFbaInventorySnapshot.query.filter(AmazonFbaInventorySnapshot.availability>0).all()
|
| - |
|
1465 |
|
| - |
|
1466 |
def add_vendor_item_pricing_in_bulk(vendorItemPricingList):
|
| - |
|
1467 |
exceptionItems = []
|
| - |
|
1468 |
for vendorItemPricing in vendorItemPricingList:
|
| - |
|
1469 |
try:
|
| - |
|
1470 |
add_vendor_pricing(vendorItemPricing, False)
|
| - |
|
1471 |
except:
|
| - |
|
1472 |
exceptionItems.append(vendorItemPricing.itemId)
|
| - |
|
1473 |
return exceptionItems
|
| - |
|
1474 |
|
| - |
|
1475 |
def add_inventory_in_bulk(bulkInventoryList):
|
| - |
|
1476 |
for item in bulkInventoryList:
|
| - |
|
1477 |
add_inventory(item.item_id, item.warehouse_id, item.inventory)
|
| - |
|
1478 |
|
| - |
|
1479 |
|
| 1465 |
|
1480 |
|
| 1466 |
|
1481 |
|