| Line 10... |
Line 10... |
| 10 |
from shop2020.clients.InventoryClient import InventoryClient
|
10 |
from shop2020.clients.InventoryClient import InventoryClient
|
| 11 |
from shop2020.config.client.ConfigClient import ConfigClient
|
11 |
from shop2020.config.client.ConfigClient import ConfigClient
|
| 12 |
from shop2020.model.v1.catalog.impl import DataService
|
12 |
from shop2020.model.v1.catalog.impl import DataService
|
| 13 |
from shop2020.model.v1.catalog.impl.CategoryManager import CategoryManager
|
13 |
from shop2020.model.v1.catalog.impl.CategoryManager import CategoryManager
|
| 14 |
from shop2020.model.v1.catalog.impl.Convertors import to_t_item, to_t_source, \
|
14 |
from shop2020.model.v1.catalog.impl.Convertors import to_t_item, to_t_source, \
|
| 15 |
to_t_brand_info, to_t_private_deal, to_t_exclusive_affiliate_item_info
|
15 |
to_t_brand_info, to_t_private_deal, to_t_exclusive_affiliate_item_info, to_t_bulk_pricing
|
| 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, \
|
| Line 22... |
Line 22... |
| 22 |
ProductFeedSubmit, MarketplaceItems, MarketPlaceItemPrice, \
|
22 |
ProductFeedSubmit, MarketplaceItems, MarketPlaceItemPrice, \
|
| 23 |
SourcePercentageMaster, SourceItemPercentage, FlipkartItem, \
|
23 |
SourcePercentageMaster, SourceItemPercentage, FlipkartItem, \
|
| 24 |
MarketPlaceUpdateHistory, SourceCategoryPercentage, MarketPlaceHistory, \
|
24 |
MarketPlaceUpdateHistory, SourceCategoryPercentage, MarketPlaceHistory, \
|
| 25 |
PrivateDeals, AmazonOutOfSync, PrivateDealsPriceComparison, \
|
25 |
PrivateDeals, AmazonOutOfSync, PrivateDealsPriceComparison, \
|
| 26 |
SourceReturnPercentage, CompetitorPricing, CompetitorPricingRequest, \
|
26 |
SourceReturnPercentage, CompetitorPricing, CompetitorPricingRequest, \
|
| 27 |
AmazonPromotion, ExclusiveAffiliateItemInfo, OutboundAffiliateMaster, HsItem
|
27 |
AmazonPromotion, ExclusiveAffiliateItemInfo, OutboundAffiliateMaster, HsItem, BulkItemPricing
|
| 28 |
from shop2020.thriftpy.model.v1.catalog.ttypes import status, ItemShippingInfo, \
|
28 |
from shop2020.thriftpy.model.v1.catalog.ttypes import status, ItemShippingInfo, \
|
| 29 |
ItemType, PremiumType, FreebieItem as t_FreebieItem, \
|
29 |
ItemType, PremiumType, FreebieItem as t_FreebieItem, \
|
| 30 |
StorePricing as tStorePricing, CatalogServiceException, BannerType, InsurerType, \
|
30 |
StorePricing as tStorePricing, CatalogServiceException, BannerType, InsurerType, \
|
| 31 |
Banner as t_banner, CompetitorPricing as TCompetitorPricing, AmazonPromotionType
|
31 |
Banner as t_banner, CompetitorPricing as TCompetitorPricing, AmazonPromotionType
|
| 32 |
from shop2020.thriftpy.model.v1.inventory.ttypes import VatType, \
|
32 |
from shop2020.thriftpy.model.v1.inventory.ttypes import VatType, \
|
| Line 353... |
Line 353... |
| 353 |
|
353 |
|
| 354 |
|
354 |
|
| 355 |
ds_item.activeOnStore = item.activeOnStore
|
355 |
ds_item.activeOnStore = item.activeOnStore
|
| 356 |
|
356 |
|
| 357 |
ds_item.packQuantity = item.packQuantity
|
357 |
ds_item.packQuantity = item.packQuantity
|
| - |
|
358 |
ds_item.quantityStep = item.quantityStep
|
| - |
|
359 |
ds_item.minimumBuyQuantity = item.minimumBuyQuantity
|
| 358 |
|
360 |
|
| 359 |
session.commit();
|
361 |
session.commit();
|
| 360 |
|
362 |
|
| 361 |
subject = "Item '{0}' is updated in Catalog. Id is {1}".format(__get_product_name(ds_item),ds_item.id)
|
363 |
subject = "Item '{0}' is updated in Catalog. Id is {1}".format(__get_product_name(ds_item),ds_item.id)
|
| 362 |
if message:
|
364 |
if message:
|
| Line 3274... |
Line 3276... |
| 3274 |
return Amazonlisted.query.filter(Amazonlisted.isFbd==False).filter(or_(Amazonlisted.fbdtaxCode!=None,Amazonlisted.fbdtaxCode!="")).all()
|
3276 |
return Amazonlisted.query.filter(Amazonlisted.isFbd==False).filter(or_(Amazonlisted.fbdtaxCode!=None,Amazonlisted.fbdtaxCode!="")).all()
|
| 3275 |
|
3277 |
|
| 3276 |
def get_all_fbd_listed_items():
|
3278 |
def get_all_fbd_listed_items():
|
| 3277 |
return Amazonlisted.query.filter(Amazonlisted.isFbd==True).all()
|
3279 |
return Amazonlisted.query.filter(Amazonlisted.isFbd==True).all()
|
| 3278 |
|
3280 |
|
| - |
|
3281 |
def get_bulk_pricing_for_items(itemIds):
|
| - |
|
3282 |
itemMap = {}
|
| - |
|
3283 |
items = BulkItemPricing.query.filter(BulkItemPricing.item_id.in_(itemIds)).all()
|
| - |
|
3284 |
for item in items:
|
| - |
|
3285 |
if not itemMap.has_key(item.item_id):
|
| - |
|
3286 |
itemMap[item.item_id] = [to_t_bulk_pricing(item)]
|
| - |
|
3287 |
else:
|
| - |
|
3288 |
(itemMap.get(item.item_id)).append(to_t_bulk_pricing(item))
|
| - |
|
3289 |
return itemMap
|
| - |
|
3290 |
|
| - |
|
3291 |
def add_bulk_pricing_for_item(bulkItemPricing):
|
| - |
|
3292 |
exist = BulkItemPricing.query.filter(BulkItemPricing.item_id==bulkItemPricing.item_id).filter(BulkItemPricing.quantity==bulkItemPricing.quantity).all()
|
| - |
|
3293 |
if len(exist) > 0:
|
| - |
|
3294 |
raise
|
| - |
|
3295 |
d_BulkItemPricing = BulkItemPricing()
|
| - |
|
3296 |
d_BulkItemPricing.item_id = bulkItemPricing.item_id
|
| - |
|
3297 |
d_BulkItemPricing.quantity = bulkItemPricing.quantity
|
| - |
|
3298 |
d_BulkItemPricing.price = bulkItemPricing.price
|
| - |
|
3299 |
session.commit()
|
| - |
|
3300 |
return d_BulkItemPricing
|
| - |
|
3301 |
|
| - |
|
3302 |
def get_bulk_pricing_by_item_id(itemId):
|
| - |
|
3303 |
bulkPricingItems = BulkItemPricing.query.filter(BulkItemPricing.item_id==itemId).all()
|
| - |
|
3304 |
return bulkPricingItems
|
| - |
|
3305 |
|
| - |
|
3306 |
def delete_bulk_pricing_for_item_by_id(id):
|
| - |
|
3307 |
bulkPricingItems = BulkItemPricing.query.filter(BulkItemPricing.id==id).all()
|
| - |
|
3308 |
if len(bulkPricingItems) > 0:
|
| - |
|
3309 |
bulkPricingItems[0].delete()
|
| - |
|
3310 |
session.commit()
|
| - |
|
3311 |
return True
|
| - |
|
3312 |
else:
|
| - |
|
3313 |
return False
|
| - |
|
3314 |
|
| - |
|
3315 |
def delete_bulk_pricing_for_item(itemId):
|
| - |
|
3316 |
session.query(BulkItemPricing).filter_by(item_id=itemId).delete()
|
| - |
|
3317 |
session.commit()
|
| - |
|
3318 |
return True
|
| - |
|
3319 |
|
| 3279 |
if __name__=='__main__':
|
3320 |
if __name__=='__main__':
|
| 3280 |
DataService.initialize()
|
3321 |
DataService.initialize()
|
| 3281 |
get_all_items_to_list_on_fbd()
|
- |
|
| 3282 |
|
3322 |
|
| - |
|
3323 |
|
| 3283 |
|
3324 |
|