| Line 81... |
Line 81... |
| 81 |
autoDecrementItems = MarketplaceItems.query.filter(MarketplaceItems.autoDecrement==True).filter(MarketplaceItems.source==OrderSource.SNAPDEAL).all()
|
81 |
autoDecrementItems = MarketplaceItems.query.filter(MarketplaceItems.autoDecrement==True).filter(MarketplaceItems.source==OrderSource.SNAPDEAL).all()
|
| 82 |
inventory_client = InventoryClient().get_client()
|
82 |
inventory_client = InventoryClient().get_client()
|
| 83 |
inventoryMap = inventory_client.getInventorySnapshot(0)
|
83 |
inventoryMap = inventory_client.getInventorySnapshot(0)
|
| 84 |
for autoDecrementItem in autoDecrementItems:
|
84 |
for autoDecrementItem in autoDecrementItems:
|
| 85 |
mpHistory = MarketPlaceHistory.get_by(source=OrderSource.SNAPDEAL,item_id=autoDecrementItem.itemId,timestamp=time)
|
85 |
mpHistory = MarketPlaceHistory.get_by(source=OrderSource.SNAPDEAL,item_id=autoDecrementItem.itemId,timestamp=time)
|
| - |
|
86 |
if not mpHistory.competitiveCategory == CompetitionCategory.COMPETITIVE:
|
| - |
|
87 |
markReasonForMpItem(mpHistory,'Category is '+CompetitionCategory._VALUES_TO_NAMES.get(mpHistory.competitiveCategory),Decision.AUTO_DECREMENT_FAILED)
|
| - |
|
88 |
continue
|
| 86 |
if not mpHistory.risky:
|
89 |
if not mpHistory.risky:
|
| 87 |
markReasonForMpItem(mpHistory,'Item is not risky',Decision.AUTO_DECREMENT_FAILED)
|
90 |
markReasonForMpItem(mpHistory,'Item is not risky',Decision.AUTO_DECREMENT_FAILED)
|
| 88 |
continue
|
91 |
continue
|
| 89 |
if mpHistory.proposedSellingPrice >= mpHistory.ourSellingPrice:
|
92 |
if mpHistory.proposedSellingPrice >= mpHistory.ourSellingPrice:
|
| 90 |
markReasonForMpItem(mpHistory,'Proposed SP greater than current SP',Decision.AUTO_DECREMENT_FAILED)
|
93 |
markReasonForMpItem(mpHistory,'Proposed SP greater than current SP',Decision.AUTO_DECREMENT_FAILED)
|
| 91 |
continue
|
94 |
continue
|
| 92 |
if not mpHistory.competitiveCategory == CompetitionCategory.COMPETITIVE:
|
- |
|
| 93 |
markReasonForMpItem(mpHistory,'Category is '+CompetitionCategory._VALUES_TO_NAMES.get(mpHistory.competitiveCategory),Decision.AUTO_DECREMENT_FAILED)
|
- |
|
| 94 |
continue
|
- |
|
| 95 |
if mpHistory.otherInventory < 3:
|
95 |
if mpHistory.otherInventory < 3:
|
| 96 |
markReasonForMpItem(mpHistory,'Competition stock is not enough',Decision.AUTO_DECREMENT_FAILED)
|
96 |
markReasonForMpItem(mpHistory,'Competition stock is not enough',Decision.AUTO_DECREMENT_FAILED)
|
| 97 |
continue
|
97 |
continue
|
| 98 |
oosStatus = inventory_client.getOosStatusesForXDaysForItem(autoDecrementItem.itemId,0,3)
|
98 |
oosStatus = inventory_client.getOosStatusesForXDaysForItem(autoDecrementItem.itemId,0,3)
|
| 99 |
count,sale,daysOfStock = 0,0,0
|
99 |
count,sale,daysOfStock = 0,0,0
|