| Line 4856... |
Line 4856... |
| 4856 |
warehouses = inventoryClient.getWarehouses(WarehouseType.OURS, InventoryType.GOOD, None, None, None)
|
4856 |
warehouses = inventoryClient.getWarehouses(WarehouseType.OURS, InventoryType.GOOD, None, None, None)
|
| 4857 |
warehousesMap = {}
|
4857 |
warehousesMap = {}
|
| 4858 |
for warehouse in warehouses:
|
4858 |
for warehouse in warehouses:
|
| 4859 |
warehousesMap[warehouse.id] = warehouse
|
4859 |
warehousesMap[warehouse.id] = warehouse
|
| 4860 |
for order in orders:
|
4860 |
for order in orders:
|
| 4861 |
stateMaster = fetchStateMaster()
|
- |
|
| 4862 |
stateId = -1
|
- |
|
| 4863 |
userClient, isFofo = __is_Fofo(userClient, order.customer_id)
|
- |
|
| 4864 |
if isFofo:
|
- |
|
| 4865 |
for k, v in stateMaster.iteritems():
|
- |
|
| 4866 |
if v.stateName == order.customer_state:
|
- |
|
| 4867 |
stateId = k
|
- |
|
| 4868 |
break
|
- |
|
| 4869 |
lineitem = order.lineitems[0]
|
4861 |
lineitem = order.lineitems[0]
|
| 4870 |
print "order.fulfilmentWarehouseId", order.fulfilmentWarehouseId
|
4862 |
print "order.fulfilmentWarehouseId", order.fulfilmentWarehouseId
|
| 4871 |
fulFilmentWarehouse = warehousesMap.get(order.fulfilmentWarehouseId)
|
4863 |
fulFilmentWarehouse = warehousesMap.get(order.fulfilmentWarehouseId)
|
| 4872 |
if fulFilmentWarehouse.warehouseType==WarehouseType.OURS and fulFilmentWarehouse.inventoryType==InventoryType.GOOD:
|
4864 |
if fulFilmentWarehouse is not None:
|
| 4873 |
continue
|
4865 |
continue
|
| 4874 |
try:
|
4866 |
try:
|
| 4875 |
itemInventory = inventoryClient.getItemInventoryByItemId(lineitem.item_id)
|
4867 |
itemInventory = inventoryClient.getItemInventoryByItemId(lineitem.item_id)
|
| 4876 |
except:
|
4868 |
except:
|
| 4877 |
inventoryClient = InventoryClient().get_client()
|
4869 |
inventoryClient = InventoryClient().get_client()
|
| 4878 |
itemInventory = inventoryClient.getItemInventoryByItemId(lineitem.item_id)
|
4870 |
itemInventory = inventoryClient.getItemInventoryByItemId(lineitem.item_id)
|
| - |
|
4871 |
try:
|
| - |
|
4872 |
fulFilmentWarehouse = inventoryClient.getWarehouse(order.fulfilmentWarehouseId)
|
| - |
|
4873 |
except:
|
| - |
|
4874 |
inventoryClient = InventoryClient().get_client()
|
| - |
|
4875 |
fulFilmentWarehouse = inventoryClient.getWarehouse(order.fulfilmentWarehouseId)
|
| - |
|
4876 |
|
| 4879 |
for warehouseId, availability in itemInventory.availability.iteritems():
|
4877 |
for warehouseId, availability in itemInventory.availability.iteritems():
|
| 4880 |
warehouse = warehouses.get(warehouseId)
|
4878 |
warehouse = warehouses.get(warehouseId)
|
| 4881 |
if warehouse.warehouseType==WarehouseType.THIRD_PARTY:
|
4879 |
if warehouse.warehouseType==WarehouseType.THIRD_PARTY:
|
| 4882 |
continue
|
4880 |
continue
|
| 4883 |
if availability - itemInventory.reserved[warehouseId] >= order.quantity and warehouse.stateId==fulFilmentWarehouse.stateId:
|
4881 |
if availability - itemInventory.reserved[warehouseId] >= order.quantity and warehouse.stateId==fulFilmentWarehouse.stateId:
|