| Line 13... |
Line 13... |
| 13 |
from shop2020.model.v1.inventory.impl.DataService import Warehouse, \
|
13 |
from shop2020.model.v1.inventory.impl.DataService import Warehouse, \
|
| 14 |
ItemInventoryHistory, CurrentInventorySnapshot, VendorItemPricing, \
|
14 |
ItemInventoryHistory, CurrentInventorySnapshot, VendorItemPricing, \
|
| 15 |
VendorItemMapping, Vendor, MissedInventoryUpdate, BadInventorySnapshot, \
|
15 |
VendorItemMapping, Vendor, MissedInventoryUpdate, BadInventorySnapshot, \
|
| 16 |
VendorItemProcurementDelay, VendorHolidays, ItemAvailabilityCache, \
|
16 |
VendorItemProcurementDelay, VendorHolidays, ItemAvailabilityCache, \
|
| 17 |
CurrentReservationSnapshot, IgnoredInventoryUpdateItems, ItemStockPurchaseParams, \
|
17 |
CurrentReservationSnapshot, IgnoredInventoryUpdateItems, ItemStockPurchaseParams, \
|
| 18 |
OOSStatus, AmazonInventorySnapshot, StateMaster, HoldInventoryDetail
|
18 |
OOSStatus, AmazonInventorySnapshot, StateMaster, HoldInventoryDetail,AmazonFbaInventorySnapshot
|
| 19 |
from shop2020.thriftpy.model.v1.inventory.ttypes import \
|
19 |
from shop2020.thriftpy.model.v1.inventory.ttypes import \
|
| 20 |
InventoryServiceException, HolidayType, InventoryType, WarehouseType
|
20 |
InventoryServiceException, HolidayType, InventoryType, WarehouseType
|
| 21 |
from shop2020.thriftpy.model.v1.order.ttypes import AlertType
|
21 |
from shop2020.thriftpy.model.v1.order.ttypes import AlertType
|
| 22 |
from shop2020.thriftpy.purchase.ttypes import PurchaseServiceException
|
22 |
from shop2020.thriftpy.purchase.ttypes import PurchaseServiceException
|
| 23 |
from shop2020.utils import EmailAttachmentSender
|
23 |
from shop2020.utils import EmailAttachmentSender
|
| Line 1212... |
Line 1212... |
| 1212 |
current_inventory_snapshot.held = 0
|
1212 |
current_inventory_snapshot.held = 0
|
| 1213 |
current_inventory_snapshot.held = current_inventory_snapshot.held + diffTobeAddedInCIS
|
1213 |
current_inventory_snapshot.held = current_inventory_snapshot.held + diffTobeAddedInCIS
|
| 1214 |
session.commit()
|
1214 |
session.commit()
|
| 1215 |
#**Update item availability cache**#
|
1215 |
#**Update item availability cache**#
|
| 1216 |
clear_item_availability_cache(itemId)
|
1216 |
clear_item_availability_cache(itemId)
|
| - |
|
1217 |
|
| - |
|
1218 |
def add_or_update_amazon_fba_inventory(amazonfbainventorysnapshot):
|
| - |
|
1219 |
inventory = AmazonFbaInventorySnapshot.get_by(item_id = amazonfbainventorysnapshot.item_id)
|
| - |
|
1220 |
if inventory is None:
|
| - |
|
1221 |
amazon_fba_inventory = AmazonFbaInventorySnapshot()
|
| - |
|
1222 |
amazon_fba_inventory.item_id = amazonfbainventorysnapshot.item_id
|
| - |
|
1223 |
amazon_fba_inventory.availability = amazonfbainventorysnapshot.availability
|
| - |
|
1224 |
else:
|
| - |
|
1225 |
inventory.availability = amazonfbainventorysnapshot.availability
|
| - |
|
1226 |
session.commit()
|
| - |
|
1227 |
|
| - |
|
1228 |
|
| - |
|
1229 |
def get_amazon_fba_inventory(itemId):
|
| - |
|
1230 |
row = AmazonFbaInventorySnapshot.get_by(item_id=itemId)
|
| - |
|
1231 |
return row.availability
|
| - |
|
1232 |
|
| - |
|
1233 |
def get_all_non_zero_amazon_fba_inventory():
|
| - |
|
1234 |
return AmazonFbaInventorySnapshot.query.filter_by(AmazonFbaInventorySnapshot.availability!=0).all()
|
| 1217 |
|
1235 |
|