| Line 16... |
Line 16... |
| 16 |
from shop2020.model.v1.catalog.impl.DataService import Item, ItemChangeLog, \
|
16 |
from shop2020.model.v1.catalog.impl.DataService import Item, ItemChangeLog, \
|
| 17 |
Category, EntityIDGenerator, SimilarItems, ProductNotification, Source, \
|
17 |
Category, EntityIDGenerator, SimilarItems, ProductNotification, Source, \
|
| 18 |
SourceItemPricing, AuthorizationLog, VoucherItemMapping, CategoryVatMaster, \
|
18 |
SourceItemPricing, AuthorizationLog, VoucherItemMapping, CategoryVatMaster, \
|
| 19 |
OOSTracker, EntityTag, ItemInsurerMapping, Insurer, Banner, BannerMap, \
|
19 |
OOSTracker, EntityTag, ItemInsurerMapping, Insurer, Banner, BannerMap, \
|
| 20 |
FreebieItem, BrandInfo, Amazonlisted, StorePricing, ItemVatMaster, \
|
20 |
FreebieItem, BrandInfo, Amazonlisted, StorePricing, ItemVatMaster, \
|
| 21 |
PageViewEvents, CartEvents, EbayItem, BannerUriMapping, Campaign
|
21 |
PageViewEvents, CartEvents, EbayItem, BannerUriMapping, Campaign, SnapdealItem
|
| 22 |
from shop2020.thriftpy.model.v1.catalog.ttypes import status, ItemShippingInfo, \
|
22 |
from shop2020.thriftpy.model.v1.catalog.ttypes import status, ItemShippingInfo, \
|
| 23 |
ItemType, PremiumType, FreebieItem as t_FreebieItem, \
|
23 |
ItemType, PremiumType, FreebieItem as t_FreebieItem, \
|
| 24 |
StorePricing as tStorePricing, CatalogServiceException
|
24 |
StorePricing as tStorePricing, CatalogServiceException
|
| 25 |
from shop2020.thriftpy.model.v1.inventory.ttypes import \
|
25 |
from shop2020.thriftpy.model.v1.inventory.ttypes import \
|
| 26 |
InventoryServiceException, IgnoredInventoryUpdateItems
|
26 |
InventoryServiceException, IgnoredInventoryUpdateItems
|
| Line 2025... |
Line 2025... |
| 2025 |
return query.count()
|
2025 |
return query.count()
|
| 2026 |
|
2026 |
|
| 2027 |
def get_count_for_amazonlisted_items():
|
2027 |
def get_count_for_amazonlisted_items():
|
| 2028 |
return session.query(func.count(Amazonlisted.itemId)).scalar()
|
2028 |
return session.query(func.count(Amazonlisted.itemId)).scalar()
|
| 2029 |
|
2029 |
|
| - |
|
2030 |
def add_or_update_snapdeal_item(snapdealitem):
|
| - |
|
2031 |
item = SnapdealItem.get_by(item_id=snapdealitem.item_id)
|
| - |
|
2032 |
catalogitem = Item.get_by(id=snapdealitem.item_id)
|
| - |
|
2033 |
try:
|
| - |
|
2034 |
if item is not None:
|
| - |
|
2035 |
if snapdealitem.exceptionPrice is not None:
|
| - |
|
2036 |
item.exceptionPrice = snapdealitem.exceptionPrice
|
| - |
|
2037 |
if snapdealitem.warehouseId is not None:
|
| - |
|
2038 |
item.warehouseId = snapdealitem.warehouseId
|
| - |
|
2039 |
if snapdealitem.isListedOnSnapdeal is not None:
|
| - |
|
2040 |
catalogitem.isListedOnSnapdeal = snapdealitem.isListedOnSnapdeal
|
| - |
|
2041 |
else:
|
| - |
|
2042 |
item = SnapdealItem()
|
| - |
|
2043 |
if snapdealitem.item_id is not None:
|
| - |
|
2044 |
item.item_id = snapdealitem.item_id
|
| - |
|
2045 |
if snapdealitem.exceptionPrice is not None:
|
| - |
|
2046 |
item.exceptionPrice = snapdealitem.exceptionPrice
|
| - |
|
2047 |
if snapdealitem.warehouseId is not None:
|
| - |
|
2048 |
item.warehouseId = snapdealitem.warehouseId
|
| - |
|
2049 |
if snapdealitem.isListedOnSnapdeal is not None:
|
| - |
|
2050 |
catalogitem.isListedOnSnapdeal = snapdealitem.isListedOnSnapdeal
|
| - |
|
2051 |
session.commit()
|
| - |
|
2052 |
return True
|
| - |
|
2053 |
except:
|
| - |
|
2054 |
return False
|
| - |
|
2055 |
|
| - |
|
2056 |
|
| - |
|
2057 |
def get_snapdeal_item(itemid):
|
| - |
|
2058 |
items = session.query(SnapdealItem,Item.isListedOnSnapdeal).filter(SnapdealItem.item_id==Item.id).filter(SnapdealItem.item_id==itemid).all()
|
| - |
|
2059 |
print items
|
| - |
|
2060 |
return items
|
| - |
|
2061 |
|
| - |
|
2062 |
def get_all_snapdeal_items():
|
| - |
|
2063 |
items = session.query(SnapdealItem,Item.isListedOnSnapdeal).filter(SnapdealItem.item_id==Item.id).all()
|
| - |
|
2064 |
print items
|
| - |
|
2065 |
return items
|
| - |
|
2066 |
|
| 2030 |
def update_asin(amazonAsinMap):
|
2067 |
def update_asin(amazonAsinMap):
|
| 2031 |
for item_id,t_item in amazonAsinMap.iteritems():
|
2068 |
for item_id,t_item in amazonAsinMap.iteritems():
|
| 2032 |
item = get_item(item_id)
|
2069 |
item = get_item(item_id)
|
| 2033 |
item.asin=t_item.asin
|
2070 |
item.asin=t_item.asin
|
| 2034 |
item.defaultInventory = t_item.defaultInventory
|
2071 |
item.defaultInventory = t_item.defaultInventory
|
| 2035 |
item.holdInventory = t_item.holdInventory
|
2072 |
item.holdInventory = t_item.holdInventory
|
| 2036 |
item.updatedOn = datetime.datetime.now()
|
2073 |
item.updatedOn = datetime.datetime.now()
|
| 2037 |
session.commit()
|
2074 |
session.commit()
|
| 2038 |
|
- |
|
| 2039 |
|
- |
|
| 2040 |
|
- |
|
| 2041 |
|
- |
|
| 2042 |
|
- |
|
| 2043 |
|
- |
|
| 2044 |
|
- |
|
| 2045 |
|
- |
|
| 2046 |
|
- |
|
| 2047 |
|
- |
|
| 2048 |
|
- |
|