| Line 721... |
Line 721... |
| 721 |
try:
|
721 |
try:
|
| 722 |
warehouse_client = WarehouseClient().get_client()
|
722 |
warehouse_client = WarehouseClient().get_client()
|
| 723 |
# Fetching GOOD w/h corresponding to the virtual one here
|
723 |
# Fetching GOOD w/h corresponding to the virtual one here
|
| 724 |
if warehouse.billingWarehouseId is None:
|
724 |
if warehouse.billingWarehouseId is None:
|
| 725 |
warehouse = catalog_client.getWarehouses(None, InventoryType.GOOD, warehouse.vendor.id, order.warehouse_id, 0)[0]
|
725 |
warehouse = catalog_client.getWarehouses(None, InventoryType.GOOD, warehouse.vendor.id, order.warehouse_id, 0)[0]
|
| 726 |
order.fulfilmentWarehouseId = warehouse.id
|
- |
|
| 727 |
|
726 |
|
| 728 |
if ItemType.SERIALIZED == item.type:
|
727 |
if ItemType.SERIALIZED == item.type:
|
| 729 |
inventoryItem = warehouse_client.getInventoryItem(serialNumber)
|
728 |
inventoryItem = warehouse_client.getInventoryItem(serialNumber)
|
| 730 |
else:
|
729 |
else:
|
| 731 |
inventoryItem = warehouse_client.getNonSeralizedInventoryItem(itemNumbers[index], item_id, order.fulfilmentWarehouseId)
|
730 |
inventoryItem = warehouse_client.getNonSeralizedInventoryItem(itemNumbers[index], item_id, warehouse.id)
|
| 732 |
|
731 |
|
| 733 |
if (inventoryItem.itemId != item_id):
|
732 |
if (inventoryItem.itemId != item_id):
|
| 734 |
catalog_client = CatalogClient().get_client()
|
733 |
catalog_client = CatalogClient().get_client()
|
| 735 |
item = catalog_client.getItem(inventoryItem.itemId)
|
734 |
item = catalog_client.getItem(inventoryItem.itemId)
|
| 736 |
scanItemString = " ".join([str(item.brand), str(item.modelName), str(item.modelNumber), str(item.color)])
|
735 |
scanItemString = " ".join([str(item.brand), str(item.modelName), str(item.modelNumber), str(item.color)])
|
| 737 |
lineItemString = " ".join([str(lineitem.brand), str(lineitem.model_name), str(lineitem.model_number), str(lineitem.color)])
|
736 |
lineItemString = " ".join([str(lineitem.brand), str(lineitem.model_name), str(lineitem.model_number), str(lineitem.color)])
|
| 738 |
raise TransactionServiceException(110, 'Trying to scan ' + scanItemString + ' instead of ' + lineItemString)
|
737 |
raise TransactionServiceException(110, 'Trying to scan ' + scanItemString + ' instead of ' + lineItemString)
|
| 739 |
|
738 |
|
| 740 |
if ItemType.SERIALIZED == item.type:
|
739 |
if ItemType.SERIALIZED == item.type:
|
| 741 |
inventoryItem = warehouse_client.scanSerializedItemForOrder(serialNumber, ScanType.SALE, orderId, order.fulfilmentWarehouseId, 1, order.warehouse_id)
|
740 |
inventoryItem = warehouse_client.scanSerializedItemForOrder(serialNumber, ScanType.SALE, orderId, warehouse.id, 1, order.warehouse_id)
|
| 742 |
else:
|
741 |
else:
|
| 743 |
inventoryItem = warehouse_client.scanForOrder(inventoryItem, ScanType.SALE, 1, order.id, order.fulfilmentWarehouseId, order.warehouse_id)
|
742 |
inventoryItem = warehouse_client.scanForOrder(inventoryItem, ScanType.SALE, 1, order.id, warehouse.id, order.warehouse_id)
|
| 744 |
|
743 |
|
| 745 |
lineitem.transfer_price = inventoryItem.unitPrice
|
744 |
lineitem.transfer_price = inventoryItem.unitPrice
|
| 746 |
order.vendorId = inventoryItem.supplierId
|
745 |
order.vendorId = inventoryItem.supplierId
|
| 747 |
catalog_client = CatalogClient().get_client()
|
- |
|
| 748 |
except WarehouseServiceException as e:
|
746 |
except WarehouseServiceException as e:
|
| 749 |
print sys.exc_info()[0]
|
747 |
print sys.exc_info()[0]
|
| 750 |
print 'Could not scan out orders due to: ' + e.message
|
748 |
print 'Could not scan out orders due to: ' + e.message
|
| 751 |
raise TransactionServiceException(110, e.message)
|
749 |
raise TransactionServiceException(110, e.message)
|
| 752 |
else:
|
750 |
else:
|
| 753 |
if not warehouse.isAvailabilityMonitored:
|
751 |
if not warehouse.isAvailabilityMonitored:
|
| 754 |
catalog_client = CatalogClient().get_client()
|
752 |
catalog_client = CatalogClient().get_client()
|
| 755 |
catalog_client.addInventory(item.id, warehouse.id, -1 * lineitem.quantity)
|
753 |
catalog_client.addInventory(item.id, warehouse.id, -1 * lineitem.quantity)
|
| 756 |
|
754 |
|
| 757 |
__update_inventory_reservation(order)
|
755 |
__update_inventory_reservation(order)
|
| - |
|
756 |
order.fulfilmentWarehouseId = warehouse.id
|
| 758 |
session.commit()
|
757 |
session.commit()
|
| 759 |
return True
|
758 |
return True
|
| 760 |
else:
|
759 |
else:
|
| 761 |
return False
|
760 |
return False
|
| 762 |
|
761 |
|