| Line 14... |
Line 14... |
| 14 |
ItemInventoryHistory, CurrentInventorySnapshot, VendorItemPricing, \
|
14 |
ItemInventoryHistory, CurrentInventorySnapshot, VendorItemPricing, \
|
| 15 |
VendorItemMapping, Vendor, MissedInventoryUpdate, BadInventorySnapshot, \
|
15 |
VendorItemMapping, Vendor, MissedInventoryUpdate, BadInventorySnapshot, \
|
| 16 |
VendorHolidays, ItemAvailabilityCache, \
|
16 |
VendorHolidays, ItemAvailabilityCache, \
|
| 17 |
CurrentReservationSnapshot, IgnoredInventoryUpdateItems, ItemStockPurchaseParams, \
|
17 |
CurrentReservationSnapshot, IgnoredInventoryUpdateItems, ItemStockPurchaseParams, \
|
| 18 |
OOSStatus, AmazonInventorySnapshot, StateMaster, HoldInventoryDetail, AmazonFbaInventorySnapshot, \
|
18 |
OOSStatus, AmazonInventorySnapshot, StateMaster, HoldInventoryDetail, AmazonFbaInventorySnapshot, \
|
| 19 |
SnapdealInventorySnapshot, FlipkartInventorySnapshot, SnapdealStockAtEOD, FlipkartStockAtEOD
|
19 |
SnapdealInventorySnapshot, FlipkartInventorySnapshot, SnapdealStockAtEOD, FlipkartStockAtEOD, StockWeightedNlcInfo
|
| 20 |
from shop2020.thriftpy.model.v1.inventory.ttypes import \
|
20 |
from shop2020.thriftpy.model.v1.inventory.ttypes import \
|
| 21 |
InventoryServiceException, HolidayType, InventoryType, WarehouseType
|
21 |
InventoryServiceException, HolidayType, InventoryType, WarehouseType
|
| 22 |
from shop2020.thriftpy.model.v1.order.ttypes import AlertType
|
22 |
from shop2020.thriftpy.model.v1.order.ttypes import AlertType
|
| 23 |
from shop2020.thriftpy.purchase.ttypes import PurchaseServiceException
|
23 |
from shop2020.thriftpy.purchase.ttypes import PurchaseServiceException
|
| 24 |
from shop2020.utils import EmailAttachmentSender
|
24 |
from shop2020.utils import EmailAttachmentSender
|
| 25 |
from shop2020.utils.EmailAttachmentSender import mail
|
25 |
from shop2020.utils.EmailAttachmentSender import mail
|
| 26 |
from shop2020.utils.Utils import to_py_date, to_java_date
|
26 |
from shop2020.utils.Utils import to_py_date, to_java_date
|
| 27 |
from sqlalchemy.orm.exc import MultipleResultsFound, NoResultFound
|
27 |
from sqlalchemy.orm.exc import MultipleResultsFound, NoResultFound
|
| 28 |
from sqlalchemy.sql import or_
|
28 |
from sqlalchemy.sql import or_
|
| 29 |
from sqlalchemy.sql.expression import and_, func, distinct
|
29 |
from sqlalchemy.sql.expression import and_, func, distinct, desc
|
| 30 |
from sqlalchemy.sql.functions import count
|
30 |
from sqlalchemy.sql.functions import count
|
| 31 |
import calendar
|
31 |
import calendar
|
| 32 |
import datetime
|
32 |
import datetime
|
| 33 |
import sys
|
33 |
import sys
|
| 34 |
import threading
|
34 |
import threading
|
| Line 1416... |
Line 1416... |
| 1416 |
snapdealstockateod.item_id = stockitem.item_id
|
1416 |
snapdealstockateod.item_id = stockitem.item_id
|
| 1417 |
snapdealstockateod.availability = stockitem.availability
|
1417 |
snapdealstockateod.availability = stockitem.availability
|
| 1418 |
snapdealstockateod.date = to_py_date(stockitem.date)
|
1418 |
snapdealstockateod.date = to_py_date(stockitem.date)
|
| 1419 |
session.commit()
|
1419 |
session.commit()
|
| 1420 |
|
1420 |
|
| - |
|
1421 |
def get_wanlc_for_source(item_id,sourceId):
|
| - |
|
1422 |
stockWanlc = StockWeightedNlcInfo.query.filter(StockWeightedNlcInfo.itemId==item_id).filter(StockWeightedNlcInfo.source==sourceId).order_by(desc(StockWeightedNlcInfo.updatedTimestamp)).limit(1).all()
|
| - |
|
1423 |
if stockWanlc is None or len(stockWanlc)==0:
|
| - |
|
1424 |
return 0.0
|
| - |
|
1425 |
else:
|
| - |
|
1426 |
return stockWanlc[0].avgWeightedNlc
|
| - |
|
1427 |
|
| - |
|
1428 |
def get_all_available_amazon_inventory():
|
| - |
|
1429 |
return AmazonFbaInventorySnapshot.query.filter(AmazonFbaInventorySnapshot.availability>0).all()
|
| - |
|
1430 |
|
| 1421 |
|
1431 |
|