| Line 1176... |
Line 1176... |
| 1176 |
|
1176 |
|
| 1177 |
if itemNumbers:
|
1177 |
if itemNumbers:
|
| 1178 |
lineitem.item_number = itemNumbers[0]
|
1178 |
lineitem.item_number = itemNumbers[0]
|
| 1179 |
|
1179 |
|
| 1180 |
if billingType == BillingType.EXTERNAL or billingType == BillingType.OURS_EXTERNAL:
|
1180 |
if billingType == BillingType.EXTERNAL or billingType == BillingType.OURS_EXTERNAL:
|
| 1181 |
if itemNumbers:
|
- |
|
| 1182 |
lineitem.item_number = itemNumbers[0]
|
- |
|
| 1183 |
|
- |
|
| 1184 |
if billedOrdersColorMap.has_key(orderId):
|
1181 |
if billedOrdersColorMap.has_key(orderId):
|
| 1185 |
etpColor = billedOrdersColorMap.get(orderId)
|
1182 |
etpColor = billedOrdersColorMap.get(orderId)
|
| 1186 |
ourColor = order.lineitems[0].color
|
1183 |
ourColor = order.lineitems[0].color
|
| 1187 |
if ourColor and etpColor != ourColor and not authorize:
|
1184 |
if ourColor and etpColor != ourColor and not authorize:
|
| 1188 |
raise TransactionServiceException(777, "ETP color: " + etpColor + " and Order color: " + ourColor)
|
1185 |
raise TransactionServiceException(777, "ETP color: " + etpColor + " and Order color: " + ourColor)
|
| Line 1250... |
Line 1247... |
| 1250 |
catalog_client = CatalogClient().get_client()
|
1247 |
catalog_client = CatalogClient().get_client()
|
| 1251 |
except WarehouseServiceException as e:
|
1248 |
except WarehouseServiceException as e:
|
| 1252 |
print sys.exc_info()[0]
|
1249 |
print sys.exc_info()[0]
|
| 1253 |
print 'Could not scan out orders due to: ' + e.message
|
1250 |
print 'Could not scan out orders due to: ' + e.message
|
| 1254 |
raise TransactionServiceException(110, e.message)
|
1251 |
raise TransactionServiceException(110, e.message)
|
| 1255 |
'''
|
- |
|
| 1256 |
elif billingType == BillingType.OURS_EXTERNAL:
|
1252 |
elif billingType == BillingType.OURS_EXTERNAL:
|
| 1257 |
try:
|
1253 |
try:
|
| 1258 |
serialNumber = serialNumbers[0]
|
1254 |
serialNumber = serialNumbers[0]
|
| 1259 |
warehouse_client = WarehouseClient().get_client()
|
1255 |
warehouse_client = WarehouseClient().get_client()
|
| 1260 |
inventoryItem = warehouse_client.scanForOursExternalSale(lineitem.item_number, serialNumber, invoice_number, order.fulfilmentWarehouseId, lineitem.transfer_price)
|
1256 |
inventoryItem = warehouse_client.scanForOursExternalSale(lineitem.item_number, serialNumber, invoice_number, order.fulfilmentWarehouseId, lineitem.unit_price, order.id)
|
| 1261 |
lineitem.transfer_price = inventoryItem.unitPrice
|
1257 |
lineitem.transfer_price = inventoryItem.unitPrice
|
| 1262 |
order.vendorId = inventoryItem.supplierId
|
1258 |
order.vendorId = inventoryItem.supplierId
|
| 1263 |
except WarehouseServiceException as e:
|
1259 |
except WarehouseServiceException as e:
|
| 1264 |
print sys.exc_info()[0]
|
1260 |
print sys.exc_info()[0]
|
| 1265 |
print 'Could not scan out orders due to: ' + e.message
|
1261 |
print 'Could not scan out orders due to: ' + e.message
|
| 1266 |
raise TransactionServiceException(110, e.message)
|
1262 |
raise TransactionServiceException(110, e.message)
|
| 1267 |
'''
|
- |
|
| 1268 |
else:
|
1263 |
else:
|
| 1269 |
if not warehouse.isAvailabilityMonitored:
|
1264 |
if not warehouse.isAvailabilityMonitored:
|
| 1270 |
inventory_client = InventoryClient().get_client()
|
1265 |
inventory_client = InventoryClient().get_client()
|
| 1271 |
inventory_client.addInventory(item.id, warehouse.id, -1 * lineitem.quantity)
|
1266 |
inventory_client.addInventory(item.id, warehouse.id, -1 * lineitem.quantity)
|
| 1272 |
|
1267 |
|
| Line 2092... |
Line 2087... |
| 2092 |
return False
|
2087 |
return False
|
| 2093 |
|
2088 |
|
| 2094 |
# For OUR warehouses, we need to scan in items for every return
|
2089 |
# For OUR warehouses, we need to scan in items for every return
|
| 2095 |
inventoryClient = InventoryClient().get_client()
|
2090 |
inventoryClient = InventoryClient().get_client()
|
| 2096 |
warehouse = inventoryClient.getWarehouse(order.warehouse_id)
|
2091 |
warehouse = inventoryClient.getWarehouse(order.warehouse_id)
|
| 2097 |
if warehouse.billingType == BillingType.OURS:
|
2092 |
if warehouse.billingType == BillingType.OURS or warehouse.billingType == BillingType.OURS_EXTERNAL:
|
| 2098 |
scanMap = {
|
2093 |
scanMap = {
|
| 2099 |
OrderStatus.RTO_RECEIVED_PRESTINE : ScanType.SALE_RET,
|
2094 |
OrderStatus.RTO_RECEIVED_PRESTINE : ScanType.SALE_RET,
|
| 2100 |
OrderStatus.RTO_RECEIVED_DAMAGED : ScanType.SALE_RET_UNUSABLE,
|
2095 |
OrderStatus.RTO_RECEIVED_DAMAGED : ScanType.SALE_RET_UNUSABLE,
|
| 2101 |
OrderStatus.RTO_LOST_IN_TRANSIT : ScanType.LOST_IN_TRANSIT,
|
2096 |
OrderStatus.RTO_LOST_IN_TRANSIT : ScanType.LOST_IN_TRANSIT,
|
| 2102 |
OrderStatus.DOA_RECEIVED_PRESTINE : ScanType.DOA_IN,
|
2097 |
OrderStatus.DOA_RECEIVED_PRESTINE : ScanType.DOA_IN,
|
| Line 2108... |
Line 2103... |
| 2108 |
scanType = scanMap[order.status]
|
2103 |
scanType = scanMap[order.status]
|
| 2109 |
lineitem = order.lineitems[0]
|
2104 |
lineitem = order.lineitems[0]
|
| 2110 |
catalogClient = CatalogClient().get_client()
|
2105 |
catalogClient = CatalogClient().get_client()
|
| 2111 |
item = catalogClient.getItem(lineitem.item_id)
|
2106 |
item = catalogClient.getItem(lineitem.item_id)
|
| 2112 |
warehouseClient = WarehouseClient().get_client()
|
2107 |
warehouseClient = WarehouseClient().get_client()
|
| - |
|
2108 |
if warehouse.billingType == BillingType.OURS or scanType != ScanType.SALE_RET:
|
| 2113 |
if item.type == ItemType.SERIALIZED:
|
2109 |
if item.type == ItemType.SERIALIZED:
|
| 2114 |
warehouseClient.scanSerializedItemForOrder(lineitem.serial_number, scanType, order.id, order.fulfilmentWarehouseId, lineitem.quantity, order.warehouse_id)
|
2110 |
warehouseClient.scanSerializedItemForOrder(lineitem.serial_number, scanType, order.id, order.fulfilmentWarehouseId, lineitem.quantity, order.warehouse_id)
|
| 2115 |
else:
|
2111 |
else:
|
| 2116 |
warehouseClient.scanForOrder(None, scanType, lineitem.quantity, order.id, order.fulfilmentWarehouseId, order.warehouse_id)
|
2112 |
warehouseClient.scanForOrder(None, scanType, lineitem.quantity, order.id, order.fulfilmentWarehouseId, order.warehouse_id)
|
| - |
|
2113 |
if warehouse.billingType == BillingType.OURS_EXTERNAL and scanType == ScanType.SALE_RET:
|
| - |
|
2114 |
warehouseClient.scanForOursExternalSaleReturn(order.id, lineitem.transfer_price)
|
| 2117 |
|
2115 |
|
| 2118 |
session.commit()
|
2116 |
session.commit()
|
| 2119 |
return True
|
2117 |
return True
|
| 2120 |
|
2118 |
|
| 2121 |
def validate_doa(order_id, is_valid):
|
2119 |
def validate_doa(order_id, is_valid):
|