| Line 5069... |
Line 5069... |
| 5069 |
logistics_client = LogisticsClient().get_client()
|
5069 |
logistics_client = LogisticsClient().get_client()
|
| 5070 |
logistics_info = logistics_client.getLogisticsEstimation(lineitem.item_id, order.customer_pincode, order.cod)
|
5070 |
logistics_info = logistics_client.getLogisticsEstimation(lineitem.item_id, order.customer_pincode, order.cod)
|
| 5071 |
if order.fulfilmentWarehouseId != logistics_info.fulfilmentWarehouseId:
|
5071 |
if order.fulfilmentWarehouseId != logistics_info.fulfilmentWarehouseId:
|
| 5072 |
if not inventoryClient or not inventoryClient.isAlive():
|
5072 |
if not inventoryClient or not inventoryClient.isAlive():
|
| 5073 |
inventoryClient = InventoryClient().get_client()
|
5073 |
inventoryClient = InventoryClient().get_client()
|
| 5074 |
itemInventory = inventoryClient.getItemInventoryByItemId(order.lineitems[0].item_id)
|
5074 |
netavailability = inventoryClient.getItemAvailibilityAtWarehouse(logistics_info.fulfilmentWarehouseId, lineitem.item_id)
|
| 5075 |
netavailability = itemInventory.availability[order.fulfilmentWarehouseId] - (itemInventory.reserved[order.fulfilmentWarehouseId]+itemInventory.held[order.fulfilmentWarehouseId])
|
- |
|
| 5076 |
if order.lineitems[0].quantity<=netavailability:
|
5075 |
if netavailability >= lineitem.quantity:
|
| 5077 |
try:
|
5076 |
try:
|
| 5078 |
print "++++" + str(order.id) + "=" + str(order.fulfilmentWarehouseId) + "->"+ str(logistics_info.fulfilmentWarehouseId)
|
5077 |
print "++++" + str(order.id) + "=" + str(order.fulfilmentWarehouseId) + "->"+ str(logistics_info.fulfilmentWarehouseId)
|
| 5079 |
change_warehouse(order.id, logistics_info.fulfilmentWarehouseId)
|
5078 |
change_warehouse(order.id, logistics_info.fulfilmentWarehouseId)
|
| 5080 |
completedOrders.append(order.id)
|
5079 |
completedOrders.append(order.id)
|
| 5081 |
except:
|
5080 |
except:
|