| Line 221... |
Line 221... |
| 221 |
ds_item.mrp = item.mrp
|
221 |
ds_item.mrp = item.mrp
|
| 222 |
if ds_item.sellingPrice or item.sellingPrice:
|
222 |
if ds_item.sellingPrice or item.sellingPrice:
|
| 223 |
if ds_item.sellingPrice != item.sellingPrice:
|
223 |
if ds_item.sellingPrice != item.sellingPrice:
|
| 224 |
amazonItem = (get_amazon_item_details(item.id))[0]
|
224 |
amazonItem = (get_amazon_item_details(item.id))[0]
|
| 225 |
if amazonItem is not None:
|
225 |
if amazonItem is not None:
|
| 226 |
outOfSync = AmazonOutOfSync.get_by(item_id=item.id)
|
226 |
#outOfSync = AmazonOutOfSync.get_by(item_id=item.id)
|
| - |
|
227 |
sync = True
|
| - |
|
228 |
if amazonItem.isFba:
|
| - |
|
229 |
if ds_item.sellingPrice != amazonItem.fbaPrice:
|
| - |
|
230 |
sync = False
|
| 227 |
if outOfSync is None:
|
231 |
if amazonItem.isNonFba:
|
| - |
|
232 |
if ds_item.sellingPrice != amazonItem.sellingPrice:
|
| - |
|
233 |
sync = False
|
| - |
|
234 |
if amazonItem.isFbb:
|
| - |
|
235 |
if ds_item.sellingPrice != amazonItem.fbbPrice:
|
| - |
|
236 |
sync = False
|
| - |
|
237 |
if sync:
|
| 228 |
amazonItem.fbaPrice = item.sellingPrice
|
238 |
amazonItem.fbaPrice = item.sellingPrice
|
| 229 |
amazonItem.sellingPrice=item.sellingPrice
|
239 |
amazonItem.sellingPrice=item.sellingPrice
|
| 230 |
amazonItem.fbbPrice=item.sellingPrice
|
240 |
amazonItem.fbbPrice=item.sellingPrice
|
| 231 |
amazonItem.mfnPriceLastUpdatedOn = datetime.datetime.now()
|
241 |
amazonItem.mfnPriceLastUpdatedOn = datetime.datetime.now()
|
| 232 |
amazonItem.fbaPriceLastUpdatedOn = datetime.datetime.now()
|
242 |
amazonItem.fbaPriceLastUpdatedOn = datetime.datetime.now()
|
| 233 |
amazonItem.fbbPriceLastUpdatedOn = datetime.datetime.now()
|
243 |
amazonItem.fbbPriceLastUpdatedOn = datetime.datetime.now()
|
| 234 |
message +="Amazon Prices Synced."
|
244 |
message +="Amazon Prices Synced."
|
| 235 |
else:
|
245 |
else:
|
| 236 |
if not outOfSync.mfn:
|
- |
|
| 237 |
amazonItem.sellingPrice=item.sellingPrice
|
- |
|
| 238 |
amazonItem.mfnPriceLastUpdatedOn = datetime.datetime.now()
|
- |
|
| 239 |
message +="MFN Price Synced."
|
246 |
message +="Amazon Prices Not Synced."
|
| 240 |
if not outOfSync.fba:
|
- |
|
| 241 |
amazonItem.fbaPrice=item.sellingPrice
|
- |
|
| 242 |
amazonItem.fbaPriceLastUpdatedOn = datetime.datetime.now()
|
- |
|
| 243 |
message +="FBA Price Synced."
|
- |
|
| 244 |
if not outOfSync.fbb:
|
- |
|
| 245 |
amazonItem.fbbPrice=item.sellingPrice
|
- |
|
| 246 |
amazonItem.fbbPriceLastUpdatedOn = datetime.datetime.now()
|
- |
|
| 247 |
message +="FBB Price Synced."
|
- |
|
| 248 |
|
247 |
|
| 249 |
message += "Selling Price is changed from {0} to {1}.\n".format(ds_item.sellingPrice, item.sellingPrice)
|
248 |
message += "Selling Price is changed from {0} to {1}.\n".format(ds_item.sellingPrice, item.sellingPrice)
|
| 250 |
|
249 |
|
| 251 |
ds_item.sellingPrice = item.sellingPrice
|
250 |
ds_item.sellingPrice = item.sellingPrice
|
| 252 |
ds_item.weight = item.weight
|
251 |
ds_item.weight = item.weight
|
| 253 |
ds_item.showSellingPrice = item.showSellingPrice
|
252 |
ds_item.showSellingPrice = item.showSellingPrice
|
| Line 2035... |
Line 2034... |
| 2035 |
elif feedType== 'FullNonFbaPricing':
|
2034 |
elif feedType== 'FullNonFbaPricing':
|
| 2036 |
for sku in skuList:
|
2035 |
for sku in skuList:
|
| 2037 |
amazonItem = Amazonlisted.get_by(itemId=sku)
|
2036 |
amazonItem = Amazonlisted.get_by(itemId=sku)
|
| 2038 |
amazonItem.mfnPriceLastUpdatedOnSc = to_py_date(timestamp)
|
2037 |
amazonItem.mfnPriceLastUpdatedOnSc = to_py_date(timestamp)
|
| 2039 |
session.commit()
|
2038 |
session.commit()
|
| - |
|
2039 |
return True
|
| 2040 |
elif (feedType=='FbaListingFeed'):
|
2040 |
elif (feedType=='FbaListingFeed'):
|
| 2041 |
for sku in skuList:
|
2041 |
for sku in skuList:
|
| 2042 |
amazonItem = Amazonlisted.get_by(itemId=sku)
|
2042 |
amazonItem = Amazonlisted.get_by(itemId=sku)
|
| 2043 |
amazonItem.isFba = True
|
2043 |
amazonItem.isFba = True
|
| 2044 |
session.commit()
|
2044 |
session.commit()
|
| - |
|
2045 |
return True
|
| 2045 |
elif (feedType=='NonFbaListingFeed'):
|
2046 |
elif (feedType=='NonFbaListingFeed'):
|
| 2046 |
for sku in skuList:
|
2047 |
for sku in skuList:
|
| 2047 |
amazonItem = Amazonlisted.get_by(itemId=sku)
|
2048 |
amazonItem = Amazonlisted.get_by(itemId=sku)
|
| 2048 |
amazonItem.isNonFba = True
|
2049 |
amazonItem.isNonFba = True
|
| 2049 |
session.commit()
|
2050 |
session.commit()
|
| - |
|
2051 |
return True
|
| 2050 |
elif (feedType=='FbbListingFeed'):
|
2052 |
elif (feedType=='FbbListingFeed'):
|
| 2051 |
for sku in skuList:
|
2053 |
for sku in skuList:
|
| 2052 |
amazonItem = Amazonlisted.get_by(itemId=sku)
|
2054 |
amazonItem = Amazonlisted.get_by(itemId=sku)
|
| 2053 |
amazonItem.fbbListedOn = to_py_date(timestamp)
|
2055 |
amazonItem.fbbListedOn = to_py_date(timestamp)
|
| 2054 |
session.commit()
|
2056 |
session.commit()
|
| - |
|
2057 |
return True
|
| 2055 |
else:
|
2058 |
else:
|
| 2056 |
return False
|
2059 |
return False
|
| 2057 |
|
2060 |
|
| 2058 |
def get_all_parent_categories():
|
2061 |
def get_all_parent_categories():
|
| 2059 |
return Category.query.filter_by(parent_category_id=10000).all()
|
2062 |
return Category.query.filter_by(parent_category_id=10000).all()
|
| Line 2709... |
Line 2712... |
| 2709 |
|
2712 |
|
| 2710 |
def get_marketplace_history(source,offset,itemId):
|
2713 |
def get_marketplace_history(source,offset,itemId):
|
| 2711 |
return session.query(MarketPlaceHistory).filter(MarketPlaceHistory.item_id==itemId).filter(MarketPlaceHistory.source==source).filter(or_(MarketPlaceHistory.toGroup==True,MarketPlaceHistory.toGroup==None)).order_by(desc(MarketPlaceHistory.timestamp)).limit(11).offset(offset).all()
|
2714 |
return session.query(MarketPlaceHistory).filter(MarketPlaceHistory.item_id==itemId).filter(MarketPlaceHistory.source==source).filter(or_(MarketPlaceHistory.toGroup==True,MarketPlaceHistory.toGroup==None)).order_by(desc(MarketPlaceHistory.timestamp)).limit(11).offset(offset).all()
|
| 2712 |
|
2715 |
|
| 2713 |
def get_all_fbb_listed_items():
|
2716 |
def get_all_fbb_listed_items():
|
| 2714 |
return Amazonlisted.query.filter(Amazonlisted.isFbb==True).filter(Amazonlisted.fbbListedOn==None).all()
|
2717 |
return Amazonlisted.query.filter(Amazonlisted.isFbb==False).filter(Amazonlisted.fbbListedOn==None).all()
|
| 2715 |
|
2718 |
|
| 2716 |
def get_all_fbb_pricing_items():
|
2719 |
def get_all_fbb_pricing_items():
|
| 2717 |
return Amazonlisted.query.filter(Amazonlisted.isFbb==True).filter(Amazonlisted.suppressFbbPriceUpdate==False).filter(Amazonlisted.fbbListedOn != None).all()
|
2720 |
return Amazonlisted.query.filter(Amazonlisted.isFbb==True).filter(Amazonlisted.suppressFbbPriceUpdate==False).filter(Amazonlisted.fbbListedOn != None).all()
|
| 2718 |
|
2721 |
|
| 2719 |
def get_count_for_marketplaceHistory(source,itemId):
|
2722 |
def get_count_for_marketplaceHistory(source,itemId):
|