| Line 1254... |
Line 1254... |
| 1254 |
session.commit()
|
1254 |
session.commit()
|
| 1255 |
return True
|
1255 |
return True
|
| 1256 |
return False
|
1256 |
return False
|
| 1257 |
|
1257 |
|
| 1258 |
def mark_order_as_rto_in_transit(order_id):
|
1258 |
def mark_order_as_rto_in_transit(order_id):
|
| 1259 |
order = get_order(order_id)
|
1259 |
selectedOrder = get_order(order_id)
|
| 1260 |
if order == None or order.status not in [OrderStatus.SHIPPED_FROM_WH, OrderStatus.DELIVERED_AT_STORE, OrderStatus.SHIPPED_TO_LOGST, OrderStatus.SHIPPED_TO_DESTINATION_CITY, OrderStatus.REACHED_DESTINATION_CITY, OrderStatus.FIRST_DELIVERY_ATTEMPT_MADE, OrderStatus.DELIVERY_SUCCESS]:
|
1260 |
if selectedOrder.logisticsTransactionId:
|
| - |
|
1261 |
orders = get_group_orders_by_logistics_txn_id(selectedOrder.logisticsTransactionId)
|
| - |
|
1262 |
for order in orders:
|
| 1261 |
return False
|
1263 |
if order == None or order.status not in [OrderStatus.SHIPPED_FROM_WH, OrderStatus.DELIVERED_AT_STORE, OrderStatus.SHIPPED_TO_LOGST, OrderStatus.SHIPPED_TO_DESTINATION_CITY, OrderStatus.REACHED_DESTINATION_CITY, OrderStatus.FIRST_DELIVERY_ATTEMPT_MADE, OrderStatus.DELIVERY_SUCCESS]:
|
| - |
|
1264 |
return False
|
| 1262 |
order.status = OrderStatus.RTO_IN_TRANSIT
|
1265 |
order.status = OrderStatus.RTO_IN_TRANSIT
|
| 1263 |
order.delivery_timestamp = datetime.datetime.now()
|
1266 |
order.delivery_timestamp = datetime.datetime.now()
|
| 1264 |
order.statusDescription = "Order Returned to Origin"
|
1267 |
order.statusDescription = "Order Returned to Origin"
|
| - |
|
1268 |
update_trust_level(order)
|
| - |
|
1269 |
session.commit()
|
| - |
|
1270 |
try:
|
| - |
|
1271 |
alert_client = AlertClient().get_client()
|
| - |
|
1272 |
alert_client.endMonitoringEntity(EntityType.COURIER, "orderId = " + str(order.id))
|
| - |
|
1273 |
except Exception as e:
|
| - |
|
1274 |
print "Exception in ending alert in MarkOrderAsRTO method"
|
| - |
|
1275 |
print e
|
| - |
|
1276 |
else:
|
| 1265 |
update_trust_level(order)
|
1277 |
if selectedOrder == None or order.status not in [OrderStatus.SHIPPED_FROM_WH, OrderStatus.DELIVERED_AT_STORE, OrderStatus.SHIPPED_TO_LOGST, OrderStatus.SHIPPED_TO_DESTINATION_CITY, OrderStatus.REACHED_DESTINATION_CITY, OrderStatus.FIRST_DELIVERY_ATTEMPT_MADE, OrderStatus.DELIVERY_SUCCESS]:
|
| - |
|
1278 |
return False
|
| - |
|
1279 |
selectedOrder.status = OrderStatus.RTO_IN_TRANSIT
|
| - |
|
1280 |
selectedOrder.delivery_timestamp = datetime.datetime.now()
|
| - |
|
1281 |
selectedOrder.statusDescription = "Order Returned to Origin"
|
| - |
|
1282 |
update_trust_level(selectedOrder)
|
| 1266 |
session.commit()
|
1283 |
session.commit()
|
| 1267 |
try:
|
1284 |
try:
|
| 1268 |
alert_client = AlertClient().get_client()
|
1285 |
alert_client = AlertClient().get_client()
|
| 1269 |
alert_client.endMonitoringEntity(EntityType.COURIER, "orderId = " + str(order.id))
|
1286 |
alert_client.endMonitoringEntity(EntityType.COURIER, "orderId = " + str(selectedOrder.id))
|
| 1270 |
except Exception as e:
|
1287 |
except Exception as e:
|
| 1271 |
print "Exception in ending alert in MarkOrderAsRTO method"
|
1288 |
print "Exception in ending alert in MarkOrderAsRTO method"
|
| 1272 |
print e
|
1289 |
print e
|
| 1273 |
return True
|
1290 |
return True
|
| 1274 |
|
1291 |
|
| 1275 |
def get_order(order_id):
|
1292 |
def get_order(order_id):
|
| 1276 |
order = Order.get_by(id=order_id)
|
1293 |
order = Order.get_by(id=order_id)
|
| 1277 |
if not order:
|
1294 |
if not order:
|
| Line 2677... |
Line 2694... |
| 2677 |
current_time = datetime.datetime.now()
|
2694 |
current_time = datetime.datetime.now()
|
| 2678 |
to_datetime = datetime.datetime(current_time.year, current_time.month, current_time.day)
|
2695 |
to_datetime = datetime.datetime(current_time.year, current_time.month, current_time.day)
|
| 2679 |
orders_not_picked_up = Order.query.filter_by(doa_logistics_provider_id = provider_id).filter_by(status=OrderStatus.RET_PICKUP_CONFIRMED).filter(Order.doa_auth_timestamp <= to_datetime).all()
|
2696 |
orders_not_picked_up = Order.query.filter_by(doa_logistics_provider_id = provider_id).filter_by(status=OrderStatus.RET_PICKUP_CONFIRMED).filter(Order.doa_auth_timestamp <= to_datetime).all()
|
| 2680 |
return orders_not_picked_up
|
2697 |
return orders_not_picked_up
|
| 2681 |
|
2698 |
|
| 2682 |
def receive_return(order_id, receiveCondition, receiveFreebie):
|
2699 |
def receive_return(order_id, receiveCondition, receiveFreebie, serialNumbers):
|
| 2683 |
order = get_order(order_id)
|
2700 |
order = get_order(order_id)
|
| 2684 |
scanFreebie = False
|
2701 |
scanFreebie = False
|
| 2685 |
|
2702 |
|
| 2686 |
if order.status in [OrderStatus.DOA_PICKUP_CONFIRMED, OrderStatus.DOA_RETURN_IN_TRANSIT]:
|
2703 |
if order.status in [OrderStatus.DOA_PICKUP_CONFIRMED, OrderStatus.DOA_RETURN_IN_TRANSIT]:
|
| 2687 |
if receiveCondition == 0:
|
2704 |
if receiveCondition == 0:
|
| Line 2743... |
Line 2760... |
| 2743 |
catalogClient = CatalogClient().get_client()
|
2760 |
catalogClient = CatalogClient().get_client()
|
| 2744 |
item = catalogClient.getItem(lineitem.item_id)
|
2761 |
item = catalogClient.getItem(lineitem.item_id)
|
| 2745 |
warehouseClient = WarehouseClient().get_client()
|
2762 |
warehouseClient = WarehouseClient().get_client()
|
| 2746 |
if warehouse.billingType == BillingType.OURS or scanType != ScanType.SALE_RET:
|
2763 |
if warehouse.billingType == BillingType.OURS or scanType != ScanType.SALE_RET:
|
| 2747 |
if item.type == ItemType.SERIALIZED:
|
2764 |
if item.type == ItemType.SERIALIZED:
|
| - |
|
2765 |
if lineitem.quantity > 1:
|
| - |
|
2766 |
if serialNumbers is None or len(serialNumbers)==0:
|
| - |
|
2767 |
return False
|
| - |
|
2768 |
else:
|
| - |
|
2769 |
serialNoList = serialNumbers.split(',')
|
| - |
|
2770 |
for serialNumber in serialNoList:
|
| - |
|
2771 |
warehouseClient.scanSerializedItemForOrder(serialNumber, scanType, order.id, order.fulfilmentWarehouseId, 1, order.warehouse_id)
|
| - |
|
2772 |
else:
|
| 2748 |
warehouseClient.scanSerializedItemForOrder(lineitem.serial_number, scanType, order.id, order.fulfilmentWarehouseId, lineitem.quantity, order.warehouse_id)
|
2773 |
warehouseClient.scanSerializedItemForOrder(lineitem.serial_number, scanType, order.id, order.fulfilmentWarehouseId, lineitem.quantity, order.warehouse_id)
|
| 2749 |
else:
|
2774 |
else:
|
| 2750 |
warehouseClient.scanForOrder(None, scanType, lineitem.quantity, order.id, order.fulfilmentWarehouseId, order.warehouse_id)
|
2775 |
warehouseClient.scanForOrder(None, scanType, lineitem.quantity, order.id, order.fulfilmentWarehouseId, order.warehouse_id)
|
| 2751 |
if warehouse.billingType == BillingType.OURS_EXTERNAL and scanType == ScanType.SALE_RET:
|
2776 |
if warehouse.billingType == BillingType.OURS_EXTERNAL and scanType == ScanType.SALE_RET:
|
| 2752 |
warehouseClient.scanForOursExternalSaleReturn(order.id, lineitem.transfer_price)
|
2777 |
warehouseClient.scanForOursExternalSaleReturn(order.id, lineitem.transfer_price)
|
| 2753 |
if scanFreebie:
|
2778 |
if scanFreebie:
|
| Line 4254... |
Line 4279... |
| 4254 |
orderInv.delete()
|
4279 |
orderInv.delete()
|
| 4255 |
session.commit()
|
4280 |
session.commit()
|
| 4256 |
return ret_timeouts
|
4281 |
return ret_timeouts
|
| 4257 |
|
4282 |
|
| 4258 |
def get_order_for_awb(awb):
|
4283 |
def get_order_for_awb(awb):
|
| 4259 |
order = Order.get_by(airwaybill_no=awb)
|
4284 |
orders = Order.query.filter(Order.airwaybill_no==awb).all()
|
| 4260 |
if not order:
|
4285 |
if not orders:
|
| 4261 |
raise TransactionServiceException(108, "no such order")
|
4286 |
orders = []
|
| 4262 |
|
4287 |
|
| 4263 |
return order
|
4288 |
return orders
|
| 4264 |
|
4289 |
|
| 4265 |
def get_orders_for_provider_for_status(provider_id, order_status_list):
|
4290 |
def get_orders_for_provider_for_status(provider_id, order_status_list):
|
| 4266 |
if not provider_id or not order_status_list:
|
4291 |
if not provider_id or not order_status_list:
|
| 4267 |
raise TransactionServiceException(101, "bad provider id or order status")
|
4292 |
raise TransactionServiceException(101, "bad provider id or order status")
|
| 4268 |
doa_provider = False
|
4293 |
doa_provider = False
|
| Line 6868... |
Line 6893... |
| 6868 |
order.expected_shipping_time = to_py_date(date)
|
6893 |
order.expected_shipping_time = to_py_date(date)
|
| 6869 |
order.promised_shipping_time = to_py_date(date)
|
6894 |
order.promised_shipping_time = to_py_date(date)
|
| 6870 |
session.commit()
|
6895 |
session.commit()
|
| 6871 |
|
6896 |
|
| 6872 |
def get_order_for_airwayBillNo(airwaybillNo):
|
6897 |
def get_order_for_airwayBillNo(airwaybillNo):
|
| 6873 |
order = Order.get_by(airwaybill_no=airwaybillNo)
|
6898 |
orders = Order.query.filter(Order.airwaybill_no==airwaybillNo).all()
|
| 6874 |
if not order:
|
6899 |
if not orders:
|
| 6875 |
print "Not found order for airwayBillNo " + str(airwaybillNo)
|
- |
|
| 6876 |
raise TransactionServiceException(108, "no such order")
|
6900 |
orders = []
|
| 6877 |
|
6901 |
|
| 6878 |
return order
|
6902 |
return orders
|
| 6879 |
|
6903 |
|
| 6880 |
|
6904 |
|
| 6881 |
def get_orders_count_created_after_timestamp_for_source(timestamp,source):
|
6905 |
def get_orders_count_created_after_timestamp_for_source(timestamp,source):
|
| 6882 |
item_ordercount = dict()
|
6906 |
item_ordercount = dict()
|
| 6883 |
status=[15,18,34,0,1]
|
6907 |
status=[15,18,34,0,1]
|
| Line 7633... |
Line 7657... |
| 7633 |
raise TransactionServiceException(214, "Vendor Item Pricing Missing For Item Id "+str(itemId)+ " and Fulfillment Warehouse "+ str(orderFulfillmentWarehouse[1]))
|
7657 |
raise TransactionServiceException(214, "Vendor Item Pricing Missing For Item Id "+str(itemId)+ " and Fulfillment Warehouse "+ str(orderFulfillmentWarehouse[1]))
|
| 7634 |
else:
|
7658 |
else:
|
| 7635 |
order.lineitems[0].transfer_price = itemPricing[4]
|
7659 |
order.lineitems[0].transfer_price = itemPricing[4]
|
| 7636 |
order.lineitems[0].nlc = itemPricing[5]
|
7660 |
order.lineitems[0].nlc = itemPricing[5]
|
| 7637 |
else:
|
7661 |
else:
|
| - |
|
7662 |
conn.close()
|
| 7638 |
raise TransactionServiceException(216, "Order in Unacceptable Status.. "+str(order.id))
|
7663 |
raise TransactionServiceException(216, "Order in Unacceptable Status.. "+str(order.id))
|
| 7639 |
try:
|
7664 |
try:
|
| 7640 |
conn.commit()
|
7665 |
conn.commit()
|
| 7641 |
except:
|
7666 |
except:
|
| 7642 |
conn.close()
|
7667 |
conn.close()
|
| Line 7678... |
Line 7703... |
| 7678 |
orders = Order.query.filter(Order.logisticsTransactionId==logisticsTxnId).all()
|
7703 |
orders = Order.query.filter(Order.logisticsTransactionId==logisticsTxnId).all()
|
| 7679 |
if not orders:
|
7704 |
if not orders:
|
| 7680 |
orders = []
|
7705 |
orders = []
|
| 7681 |
return orders
|
7706 |
return orders
|
| 7682 |
|
7707 |
|
| 7683 |
def add_billing_details_for_groupped_orders(orderIds, invoice_number, itemNumbersMap, serialNumbersMap, freebieWarehouseIdMap, billed_by, jacketNumber, billingType, authorize):
|
7708 |
def add_billing_details_for_groupped_orders(orderIds, invoice_number, itemNumbersMap, serialNumbersMap, freebieWarehouseIdMap, billed_by, jacketNumber, billingType, authorize, invoiceType):
|
| 7684 |
''' Check for Biller'''
|
7709 |
''' Check for Biller'''
|
| 7685 |
if billed_by is None or billed_by.strip() == "":
|
7710 |
if billed_by is None or billed_by.strip() == "":
|
| 7686 |
raise TransactionServiceException(110, "Invalid Biller")
|
7711 |
raise TransactionServiceException(110, "Invalid Biller")
|
| 7687 |
|
7712 |
|
| 7688 |
ordersList = []
|
7713 |
ordersList = []
|
| Line 7703... |
Line 7728... |
| 7703 |
raise TransactionServiceException(302, "Unable to connect to Warehouse System")
|
7728 |
raise TransactionServiceException(302, "Unable to connect to Warehouse System")
|
| 7704 |
inventory_client = InventoryClient().get_client()
|
7729 |
inventory_client = InventoryClient().get_client()
|
| 7705 |
warehouse_client = WarehouseClient().get_client()
|
7730 |
warehouse_client = WarehouseClient().get_client()
|
| 7706 |
catalog_client = CatalogClient().get_client()
|
7731 |
catalog_client = CatalogClient().get_client()
|
| 7707 |
whStateId = None
|
7732 |
whStateId = None
|
| - |
|
7733 |
lineItemSize = 0
|
| - |
|
7734 |
individualInvoice = True
|
| 7708 |
for order in ordersList:
|
7735 |
for order in ordersList:
|
| 7709 |
newTaxType = __getOrderTaxType(order)
|
7736 |
newTaxType = __getOrderTaxType(order)
|
| 7710 |
if order.taxType == 2:
|
7737 |
if order.taxType == 2:
|
| 7711 |
if newTaxType == 0:
|
7738 |
if newTaxType == 0:
|
| 7712 |
raise TransactionServiceException(302, "C-Form billing is not allowed for same state for Order" + str(order.id))
|
7739 |
raise TransactionServiceException(302, "C-Form billing is not allowed for same state for Order" + str(order.id))
|
| Line 7752... |
Line 7779... |
| 7752 |
raise TransactionServiceException(307,'Parent order for this is COD and is still undelivered')
|
7779 |
raise TransactionServiceException(307,'Parent order for this is COD and is still undelivered')
|
| 7753 |
|
7780 |
|
| 7754 |
if not catalog_client.isAlive():
|
7781 |
if not catalog_client.isAlive():
|
| 7755 |
catalog_client = CatalogClient().get_client()
|
7782 |
catalog_client = CatalogClient().get_client()
|
| 7756 |
item = catalog_client.getItem(item_id)
|
7783 |
item = catalog_client.getItem(item_id)
|
| - |
|
7784 |
|
| - |
|
7785 |
if ItemType.SERIALIZED == item.type and lineitem.quantity>2:
|
| - |
|
7786 |
individualInvoice=False
|
| - |
|
7787 |
|
| - |
|
7788 |
if order.type== OrderType.B2B:
|
| - |
|
7789 |
individualInvoice=False
|
| - |
|
7790 |
|
| - |
|
7791 |
lineItemSize = lineItemSize+1
|
| - |
|
7792 |
|
| 7757 |
if order.status == OrderStatus.ACCEPTED:
|
7793 |
if order.status == OrderStatus.ACCEPTED:
|
| 7758 |
if order.source == 6:
|
7794 |
if order.source == 6:
|
| 7759 |
order.jacket_number = "600"+str(orderId)
|
7795 |
order.jacket_number = "600"+str(orderId)
|
| 7760 |
elif order.source == 7:
|
7796 |
elif order.source == 7:
|
| 7761 |
order.jacket_number = "700"+str(orderId)
|
7797 |
order.jacket_number = "700"+str(orderId)
|
| Line 7806... |
Line 7842... |
| 7806 |
order.vendorId = warehouse.vendor.id
|
7842 |
order.vendorId = warehouse.vendor.id
|
| 7807 |
whStateId = warehouse.stateId
|
7843 |
whStateId = warehouse.stateId
|
| 7808 |
except InventoryServiceException as e:
|
7844 |
except InventoryServiceException as e:
|
| 7809 |
print sys.exc_info()[0]
|
7845 |
print sys.exc_info()[0]
|
| 7810 |
print e.message
|
7846 |
print e.message
|
| - |
|
7847 |
if warehouseDbConnection.open:
|
| - |
|
7848 |
warehouseDbConnection.close()
|
| 7811 |
raise TransactionServiceException(110, 'Transfer price missing for itemId: ' + str(item_id) + ' and vendor: ' + str(warehouse.vendor.id))
|
7849 |
raise TransactionServiceException(110, 'Transfer price missing for itemId: ' + str(item_id) + ' and vendor: ' + str(warehouse.vendor.id))
|
| 7812 |
|
7850 |
|
| 7813 |
if order.orderType == OrderType.B2B:
|
7851 |
if order.orderType == OrderType.B2B:
|
| 7814 |
tinNumber = Attribute.query.filter(Attribute.orderId == order.id).filter(Attribute.name == "tinNumber").first()
|
7852 |
tinNumber = Attribute.query.filter(Attribute.orderId == order.id).filter(Attribute.name == "tinNumber").first()
|
| 7815 |
if tinNumber is None:
|
7853 |
if tinNumber is None:
|
| - |
|
7854 |
if warehouseDbConnection.open:
|
| - |
|
7855 |
warehouseDbConnection.close()
|
| 7816 |
raise TransactionServiceException(308, "Tin Number is Missing for B2B Order. Please contact engineering Team" + str(orderId))
|
7856 |
raise TransactionServiceException(308, "Tin Number is Missing for B2B Order. Please contact engineering Team" + str(orderId))
|
| 7817 |
if newTaxType != 0:
|
7857 |
if newTaxType != 0:
|
| 7818 |
order.orderType = OrderType.B2C
|
7858 |
order.orderType = OrderType.B2C
|
| 7819 |
|
7859 |
|
| 7820 |
if billingType == BillingType.OURS:
|
7860 |
if billingType == BillingType.OURS:
|
| Line 7831... |
Line 7871... |
| 7831 |
for serialNumber in serialNumbers:
|
7871 |
for serialNumber in serialNumbers:
|
| 7832 |
invItemSql = "select i.id, i.itemId, i.itemNumber, i.serialNumber, i.initialQuantity, i.currentQuantity, i.purchaseId, i.purchaseReturnId, i.currentWarehouseId, i.lastScanType, i.transferStatus, physicalWarehouseId, po.supplierId, l.unitPrice, l.nlc from inventoryItem i join purchase p on i.purchaseId = p.id join purchaseorder po on p.purchaseOrder_id = po.id join lineitem l on (i.itemId = l.itemId and po.id =l.purchaseOrder_id) where i.serialNumber ='%s' order by i.id desc limit 1"%(serialNumber)
|
7872 |
invItemSql = "select i.id, i.itemId, i.itemNumber, i.serialNumber, i.initialQuantity, i.currentQuantity, i.purchaseId, i.purchaseReturnId, i.currentWarehouseId, i.lastScanType, i.transferStatus, physicalWarehouseId, po.supplierId, l.unitPrice, l.nlc from inventoryItem i join purchase p on i.purchaseId = p.id join purchaseorder po on p.purchaseOrder_id = po.id join lineitem l on (i.itemId = l.itemId and po.id =l.purchaseOrder_id) where i.serialNumber ='%s' order by i.id desc limit 1"%(serialNumber)
|
| 7833 |
whCursor.execute(invItemSql)
|
7873 |
whCursor.execute(invItemSql)
|
| 7834 |
invItem = whCursor.fetchone()
|
7874 |
invItem = whCursor.fetchone()
|
| 7835 |
if invItem is None:
|
7875 |
if invItem is None:
|
| - |
|
7876 |
if warehouseDbConnection.open:
|
| - |
|
7877 |
warehouseDbConnection.close()
|
| 7836 |
raise TransactionServiceException(309, "No Item in the inventory with this serial number " + serialNumber+" and Order Id:- "+str(order.id))
|
7878 |
raise TransactionServiceException(309, "No Item in the inventory with this serial number " + serialNumber+" and Order Id:- "+str(order.id))
|
| 7837 |
if item.id!=invItem[1]:
|
7879 |
if item.id!=invItem[1]:
|
| 7838 |
if not catalog_client.isAlive():
|
7880 |
if not catalog_client.isAlive():
|
| 7839 |
catalog_client = CatalogClient().get_client()
|
7881 |
catalog_client = CatalogClient().get_client()
|
| 7840 |
sritem = catalog_client.getItem(invItem[1])
|
7882 |
sritem = catalog_client.getItem(invItem[1])
|
| 7841 |
scanItemString = " ".join([str(sritem.brand), str(sritem.modelName), str(sritem.modelNumber), str(sritem.color)])
|
7883 |
scanItemString = " ".join([str(sritem.brand), str(sritem.modelName), str(sritem.modelNumber), str(sritem.color)])
|
| 7842 |
lineItemString = " ".join([str(lineitem.brand), str(lineitem.model_name), str(lineitem.model_number), str(lineitem.color)])
|
7884 |
lineItemString = " ".join([str(lineitem.brand), str(lineitem.model_name), str(lineitem.model_number), str(lineitem.color)])
|
| - |
|
7885 |
if warehouseDbConnection.open:
|
| - |
|
7886 |
warehouseDbConnection.close()
|
| 7843 |
raise TransactionServiceException(310, "Trying to scan " + scanItemString + " instead of " + lineItemString+" Order Id- "+order.id)
|
7887 |
raise TransactionServiceException(310, "Trying to scan " + scanItemString + " instead of " + lineItemString+" Order Id- "+order.id)
|
| 7844 |
if order.warehouse_id!= invItem[11]:
|
7888 |
if order.warehouse_id!= invItem[11]:
|
| - |
|
7889 |
if warehouseDbConnection.open:
|
| - |
|
7890 |
warehouseDbConnection.close()
|
| 7845 |
raise TransactionServiceException(311, "No Item residing in Billing Warehouse with this serial number " + serialNumber+" and Order Id:- "+str(order.id))
|
7891 |
raise TransactionServiceException(311, "No Item residing in Billing Warehouse with this serial number " + serialNumber+" and Order Id:- "+str(order.id))
|
| 7846 |
if invItem[10] is not None and invItem[10]=='IN_TRANSIT':
|
7892 |
if invItem[10] is not None and invItem[10]=='IN_TRANSIT':
|
| - |
|
7893 |
if warehouseDbConnection.open:
|
| - |
|
7894 |
warehouseDbConnection.close()
|
| 7847 |
raise TransactionServiceException(312, "Trying to Scan In-Transit Inventory " + serialNumber+" and Order Id:- "+str(order.id))
|
7895 |
raise TransactionServiceException(312, "Trying to Scan In-Transit Inventory " + serialNumber+" and Order Id:- "+str(order.id))
|
| 7848 |
if invItem[9]=='MARKED_BAD' or invItem[9]=='DOA_IN' or invItem[9]=='DOA_OUT' or invItem[9]=='DOA_REJECTED' or invItem[9]=='SALE_RET_UNUSABLE' or invItem[9]=='BAD_SALE':
|
7896 |
if invItem[9]=='MARKED_BAD' or invItem[9]=='DOA_IN' or invItem[9]=='DOA_OUT' or invItem[9]=='DOA_REJECTED' or invItem[9]=='SALE_RET_UNUSABLE' or invItem[9]=='BAD_SALE':
|
| - |
|
7897 |
if warehouseDbConnection.open:
|
| - |
|
7898 |
warehouseDbConnection.close()
|
| 7849 |
raise TransactionServiceException(313, "Trying to Scan Bad Inventory Serial Number:- " + serialNumber+" and Order Id:- "+str(order.id))
|
7899 |
raise TransactionServiceException(313, "Trying to Scan Bad Inventory Serial Number:- " + serialNumber+" and Order Id:- "+str(order.id))
|
| 7850 |
scanSql = "select * from scanNew where inventoryItemId =%d"%(invItem[0])
|
7900 |
scanSql = "select * from scanNew where inventoryItemId =%d"%(invItem[0])
|
| 7851 |
whCursor.execute(scanSql)
|
7901 |
whCursor.execute(scanSql)
|
| 7852 |
scans = whCursor.fetchall()
|
7902 |
scans = whCursor.fetchall()
|
| 7853 |
if scans is None:
|
7903 |
if scans is None:
|
| - |
|
7904 |
if warehouseDbConnection.open:
|
| - |
|
7905 |
warehouseDbConnection.close()
|
| 7854 |
raise TransactionServiceException(314, "Item with Serial Number:- " + serialNumber+" never scanned in the system")
|
7906 |
raise TransactionServiceException(314, "Item with Serial Number:- " + serialNumber+" never scanned in the system")
|
| 7855 |
lastScan = scans[len(scans)-1]
|
7907 |
lastScan = scans[len(scans)-1]
|
| 7856 |
if lastScan[3]=='SALE':
|
7908 |
if lastScan[3]=='SALE':
|
| - |
|
7909 |
if warehouseDbConnection.open:
|
| - |
|
7910 |
warehouseDbConnection.close()
|
| 7857 |
raise TransactionServiceException(315, "Inventory Item with serial number- "+ serialNumber+" already scanned against order id- "+str(lastScan[6]))
|
7911 |
raise TransactionServiceException(315, "Inventory Item with serial number- "+ serialNumber+" already scanned against order id- "+str(lastScan[6]))
|
| 7858 |
if warehouse.id!=invItem[8]:
|
7912 |
if warehouse.id!=invItem[8]:
|
| - |
|
7913 |
if warehouseDbConnection.open:
|
| - |
|
7914 |
warehouseDbConnection.close()
|
| 7859 |
raise TransactionServiceException(316, "Inventory Item scanning from vendor warehouse "+str(invItem[8])+" instead of order fulfillment warehouse "+str(warehouse.id)+" order id- "+str(order.id))
|
7915 |
raise TransactionServiceException(316, "Inventory Item scanning from vendor warehouse "+str(invItem[8])+" instead of order fulfillment warehouse "+str(warehouse.id)+" order id- "+str(order.id))
|
| 7860 |
|
7916 |
|
| 7861 |
current_time = datetime.datetime.now()
|
7917 |
current_time = datetime.datetime.now()
|
| 7862 |
insertScanSql = "insert into scanNew(inventoryItemId, warehouseId, type, scannedAt, quantity, orderId) values(%d,%d,'%s','%s',%d,%d)"%(invItem[0],warehouse.id,'SALE',current_time.strftime('%Y-%m-%d %H:%M:%S'),1,order.id)
|
7918 |
insertScanSql = "insert into scanNew(inventoryItemId, warehouseId, type, scannedAt, quantity, orderId) values(%d,%d,'%s','%s',%d,%d)"%(invItem[0],warehouse.id,'SALE',current_time.strftime('%Y-%m-%d %H:%M:%S'),1,order.id)
|
| 7863 |
whCursor.execute(insertScanSql)
|
7919 |
whCursor.execute(insertScanSql)
|
| 7864 |
updateInvItemSql = "update inventoryItem set currentQuantity = currentQuantity-1, lastScanType='SALE' where id=%d and serialnumber ='%s'"%(invItem[0],serialNumber)
|
7920 |
updateInvItemSql = "update inventoryItem set currentQuantity = currentQuantity-1, lastScanType='SALE' where id=%d and serialnumber ='%s'"%(invItem[0],serialNumber)
|
| 7865 |
whCursor.execute(updateInvItemSql)
|
7921 |
whCursor.execute(updateInvItemSql)
|
| Line 7878... |
Line 7934... |
| 7878 |
invItemSql = "select i.id, i.itemId, i.itemNumber, i.serialNumber, i.initialQuantity, i.currentQuantity, i.purchaseId, i.purchaseReturnId, i.currentWarehouseId, i.lastScanType, i.transferStatus, physicalWarehouseId, po.supplierId, l.unitPrice, l.nlc from inventoryItem i join purchase p on i.purchaseId = p.id join purchaseorder po on p.purchaseOrder_id = po.id join lineitem l on (i.itemId = l.itemId and po.id =l.purchaseOrder_id) where i.itemId = %d AND i.currentQuantity > 0 AND i.currentWarehouseId = %d AND i.physicalWarehouseId = %d AND i.lastScanType not in ('MARKED_BAD','DOA_IN','DOA_REJECTED','DOA_REPLACED') AND (i.transferStatus is NULL or i.transferStatus != 'IN_TRANSIT') AND i.itemNumber ='%s'"%(item.id,order.fulfilmentWarehouseId,order.warehouse_id,itemNumbers[0])
|
7934 |
invItemSql = "select i.id, i.itemId, i.itemNumber, i.serialNumber, i.initialQuantity, i.currentQuantity, i.purchaseId, i.purchaseReturnId, i.currentWarehouseId, i.lastScanType, i.transferStatus, physicalWarehouseId, po.supplierId, l.unitPrice, l.nlc from inventoryItem i join purchase p on i.purchaseId = p.id join purchaseorder po on p.purchaseOrder_id = po.id join lineitem l on (i.itemId = l.itemId and po.id =l.purchaseOrder_id) where i.itemId = %d AND i.currentQuantity > 0 AND i.currentWarehouseId = %d AND i.physicalWarehouseId = %d AND i.lastScanType not in ('MARKED_BAD','DOA_IN','DOA_REJECTED','DOA_REPLACED') AND (i.transferStatus is NULL or i.transferStatus != 'IN_TRANSIT') AND i.itemNumber ='%s'"%(item.id,order.fulfilmentWarehouseId,order.warehouse_id,itemNumbers[0])
|
| 7879 |
whCursor.execute(invItemSql)
|
7935 |
whCursor.execute(invItemSql)
|
| 7880 |
invItems = whCursor.fetchall()
|
7936 |
invItems = whCursor.fetchall()
|
| 7881 |
if invItems is None:
|
7937 |
if invItems is None:
|
| 7882 |
raise TransactionServiceException(317, "No Item in the inventory with this item number " + itemNumbers[0]+" in Vendor Warehouse Id- "+str(warehouse.id)+" Order Id:- "+str(order.id))
|
7938 |
raise TransactionServiceException(317, "No Item in the inventory with this item number " + itemNumbers[0]+" in Vendor Warehouse Id- "+str(warehouse.id)+" Order Id:- "+str(order.id))
|
| - |
|
7939 |
warehouseDbConnection.close()
|
| 7883 |
totalCurrentQuantity =0
|
7940 |
totalCurrentQuantity =0
|
| 7884 |
for invItem in invItems:
|
7941 |
for invItem in invItems:
|
| 7885 |
totalCurrentQuantity = totalCurrentQuantity + invItem[5]
|
7942 |
totalCurrentQuantity = totalCurrentQuantity + invItem[5]
|
| 7886 |
|
7943 |
|
| 7887 |
orderQuantity = lineitem.quantity
|
7944 |
orderQuantity = lineitem.quantity
|
| 7888 |
if totalCurrentQuantity < lineitem.quantity:
|
7945 |
if totalCurrentQuantity < lineitem.quantity:
|
| - |
|
7946 |
if warehouseDbConnection.open:
|
| - |
|
7947 |
warehouseDbConnection.close()
|
| 7889 |
raise TransactionServiceException(318, "Unsufficient Quantity with this item number " + itemNumbers[0]+" in Vendor Warehouse Id- "+str(warehouse.id)+" Order Id:- "+str(order.id))
|
7948 |
raise TransactionServiceException(318, "Unsufficient Quantity with this item number " + itemNumbers[0]+" in Vendor Warehouse Id- "+str(warehouse.id)+" Order Id:- "+str(order.id))
|
| 7890 |
|
7949 |
|
| 7891 |
for invItem in invItems:
|
7950 |
for invItem in invItems:
|
| 7892 |
scanSql = "select * from scanNew where inventoryItemId =%d"%(invItem[0])
|
7951 |
scanSql = "select * from scanNew where inventoryItemId =%d"%(invItem[0])
|
| 7893 |
whCursor.execute(scanSql)
|
7952 |
whCursor.execute(scanSql)
|
| 7894 |
scans = whCursor.fetchall()
|
7953 |
scans = whCursor.fetchall()
|
| 7895 |
|
7954 |
|
| 7896 |
if scans is None:
|
7955 |
if scans is None:
|
| - |
|
7956 |
if warehouseDbConnection.open:
|
| - |
|
7957 |
warehouseDbConnection.close()
|
| 7897 |
raise TransactionServiceException(319, "Item with Item Number:- " + itemNumbers[0]+" never scanned in the system")
|
7958 |
raise TransactionServiceException(319, "Item with Item Number:- " + itemNumbers[0]+" never scanned in the system")
|
| 7898 |
|
7959 |
|
| 7899 |
|
7960 |
|
| 7900 |
currentQuantity = invItem[5]
|
7961 |
currentQuantity = invItem[5]
|
| 7901 |
scanQuantity = 0
|
7962 |
scanQuantity = 0
|
| Line 7939... |
Line 8000... |
| 7939 |
for serialNumber in serialNumbers:
|
8000 |
for serialNumber in serialNumbers:
|
| 7940 |
invItemSql = "select i.id, i.itemId, i.itemNumber, i.serialNumber, i.initialQuantity, i.currentQuantity, i.purchaseId, i.purchaseReturnId, i.currentWarehouseId, i.lastScanType, i.transferStatus, physicalWarehouseId, po.supplierId, l.unitPrice, l.nlc from inventoryItem i join purchase p on i.purchaseId = p.id join purchaseorder po on p.purchaseOrder_id = po.id join lineitem l on (i.itemId = l.itemId and po.id =l.purchaseOrder_id) where i.serialNumber ='%s' order by i.id desc limit 1"%(serialNumber)
|
8001 |
invItemSql = "select i.id, i.itemId, i.itemNumber, i.serialNumber, i.initialQuantity, i.currentQuantity, i.purchaseId, i.purchaseReturnId, i.currentWarehouseId, i.lastScanType, i.transferStatus, physicalWarehouseId, po.supplierId, l.unitPrice, l.nlc from inventoryItem i join purchase p on i.purchaseId = p.id join purchaseorder po on p.purchaseOrder_id = po.id join lineitem l on (i.itemId = l.itemId and po.id =l.purchaseOrder_id) where i.serialNumber ='%s' order by i.id desc limit 1"%(serialNumber)
|
| 7941 |
whCursor.execute(invItemSql)
|
8002 |
whCursor.execute(invItemSql)
|
| 7942 |
invItem = whCursor.fetchone()
|
8003 |
invItem = whCursor.fetchone()
|
| 7943 |
if invItem is None:
|
8004 |
if invItem is None:
|
| - |
|
8005 |
if warehouseDbConnection.open:
|
| - |
|
8006 |
warehouseDbConnection.close()
|
| 7944 |
raise TransactionServiceException(110, "No Item in the inventory with this serial number " + serialNumber+" and Order Id:- "+str(order.id))
|
8007 |
raise TransactionServiceException(110, "No Item in the inventory with this serial number " + serialNumber+" and Order Id:- "+str(order.id))
|
| 7945 |
if item.id!=invItem[1]:
|
8008 |
if item.id!=invItem[1]:
|
| 7946 |
if not catalog_client.isAlive():
|
8009 |
if not catalog_client.isAlive():
|
| 7947 |
catalog_client = CatalogClient().get_client()
|
8010 |
catalog_client = CatalogClient().get_client()
|
| 7948 |
sritem = catalog_client.getItem(invItem[1])
|
8011 |
sritem = catalog_client.getItem(invItem[1])
|
| 7949 |
scanItemString = " ".join([str(sritem.brand), str(sritem.modelName), str(sritem.modelNumber), str(sritem.color)])
|
8012 |
scanItemString = " ".join([str(sritem.brand), str(sritem.modelName), str(sritem.modelNumber), str(sritem.color)])
|
| 7950 |
lineItemString = " ".join([str(lineitem.brand), str(lineitem.model_name), str(lineitem.model_number), str(lineitem.color)])
|
8013 |
lineItemString = " ".join([str(lineitem.brand), str(lineitem.model_name), str(lineitem.model_number), str(lineitem.color)])
|
| - |
|
8014 |
if warehouseDbConnection.open:
|
| - |
|
8015 |
warehouseDbConnection.close()
|
| 7951 |
raise TransactionServiceException(110, "Trying to scan " + scanItemString + " instead of " + lineItemString+" Order Id- "+order.id)
|
8016 |
raise TransactionServiceException(110, "Trying to scan " + scanItemString + " instead of " + lineItemString+" Order Id- "+order.id)
|
| 7952 |
if order.warehouse_id!= invItem[11]:
|
8017 |
if order.warehouse_id!= invItem[11]:
|
| - |
|
8018 |
if warehouseDbConnection.open:
|
| - |
|
8019 |
warehouseDbConnection.close()
|
| 7953 |
raise TransactionServiceException(110, "No Item residing in Billing Warehouse with this serial number " + serialNumber+" and Order Id:- "+str(order.id))
|
8020 |
raise TransactionServiceException(110, "No Item residing in Billing Warehouse with this serial number " + serialNumber+" and Order Id:- "+str(order.id))
|
| 7954 |
if invItem[10] is not None and invItem[10]=='IN_TRANSIT':
|
8021 |
if invItem[10] is not None and invItem[10]=='IN_TRANSIT':
|
| - |
|
8022 |
if warehouseDbConnection.open:
|
| - |
|
8023 |
warehouseDbConnection.close()
|
| 7955 |
raise TransactionServiceException(110, "Trying to Scan In-Transit Inventory " + serialNumber+" and Order Id:- "+str(order.id))
|
8024 |
raise TransactionServiceException(110, "Trying to Scan In-Transit Inventory " + serialNumber+" and Order Id:- "+str(order.id))
|
| 7956 |
if invItem[9]!='MARKED_BAD' or invItem[9]!='DOA_IN' or invItem[9]!='DOA_REJECTED' or invItem[9]!='SALE_RET_UNUSABLE':
|
8025 |
if invItem[9]!='MARKED_BAD' or invItem[9]!='DOA_IN' or invItem[9]!='DOA_REJECTED' or invItem[9]!='SALE_RET_UNUSABLE':
|
| - |
|
8026 |
if warehouseDbConnection.open:
|
| - |
|
8027 |
warehouseDbConnection.close()
|
| 7957 |
raise TransactionServiceException(110, "Trying to Scan Good Inventory Serial Number:- " + serialNumber+" and Order Id:- "+str(order.id))
|
8028 |
raise TransactionServiceException(110, "Trying to Scan Good Inventory Serial Number:- " + serialNumber+" and Order Id:- "+str(order.id))
|
| - |
|
8029 |
|
| 7958 |
scanSql = "select * from scanNew where inventoryItemId =%d"%(invItem[0])
|
8030 |
scanSql = "select * from scanNew where inventoryItemId =%d"%(invItem[0])
|
| 7959 |
whCursor.execute(scanSql)
|
8031 |
whCursor.execute(scanSql)
|
| 7960 |
scans = whCursor.fetchall()
|
8032 |
scans = whCursor.fetchall()
|
| 7961 |
if scans is None:
|
8033 |
if scans is None:
|
| - |
|
8034 |
if warehouseDbConnection.open:
|
| - |
|
8035 |
warehouseDbConnection.close()
|
| 7962 |
raise TransactionServiceException(110, "Item with Serial Number:- " + serialNumber+" never scanned in the system")
|
8036 |
raise TransactionServiceException(110, "Item with Serial Number:- " + serialNumber+" never scanned in the system")
|
| 7963 |
lastScan = scans[len(scans)-1]
|
8037 |
lastScan = scans[len(scans)-1]
|
| 7964 |
if lastScan[3]=='BAD_SALE':
|
8038 |
if lastScan[3]=='BAD_SALE':
|
| - |
|
8039 |
if warehouseDbConnection.open:
|
| - |
|
8040 |
warehouseDbConnection.close()
|
| 7965 |
raise TransactionServiceException(110, "Inventory Item with serial number- "+ serialNumber+" already scanned against order id- "+str(lastScan[6]))
|
8041 |
raise TransactionServiceException(110, "Inventory Item with serial number- "+ serialNumber+" already scanned against order id- "+str(lastScan[6]))
|
| 7966 |
if warehouse.id!=invItem[8]:
|
8042 |
if warehouse.id!=invItem[8]:
|
| - |
|
8043 |
if warehouseDbConnection.open:
|
| - |
|
8044 |
warehouseDbConnection.close()
|
| 7967 |
raise TransactionServiceException(110, "Inventory Item scanning from vendor warehouse "+str(invItem[8])+" instead of order fulfillment warehouse "+str(warehouse.id)+" order id- "+str(order.id))
|
8045 |
raise TransactionServiceException(110, "Inventory Item scanning from vendor warehouse "+str(invItem[8])+" instead of order fulfillment warehouse "+str(warehouse.id)+" order id- "+str(order.id))
|
| 7968 |
current_time = datetime.datetime.now()
|
8046 |
current_time = datetime.datetime.now()
|
| 7969 |
insertScanSql = "insert into scanNew(inventoryItemId, warehouseId, type, scannedAt, quantity, orderId) values(%d,%d,'%s','%s',%d,%d)"%(invItem[0],warehouse.id,'BAD_SALE',current_time.strftime('%Y-%m-%d %H:%M:%S'),1,order.id)
|
8047 |
insertScanSql = "insert into scanNew(inventoryItemId, warehouseId, type, scannedAt, quantity, orderId) values(%d,%d,'%s','%s',%d,%d)"%(invItem[0],warehouse.id,'BAD_SALE',current_time.strftime('%Y-%m-%d %H:%M:%S'),1,order.id)
|
| 7970 |
whCursor.execute(insertScanSql)
|
8048 |
whCursor.execute(insertScanSql)
|
| 7971 |
updateInvItemSql = "update inventoryItem set currentQuantity = currentQuantity-1, lastScanType='BAD_SALE' where id=%d and serialnumber ='%s'"%(invItem[0],serialNumber)
|
8049 |
updateInvItemSql = "update inventoryItem set currentQuantity = currentQuantity-1, lastScanType='BAD_SALE' where id=%d and serialnumber ='%s'"%(invItem[0],serialNumber)
|
| Line 7978... |
Line 8056... |
| 7978 |
else:
|
8056 |
else:
|
| 7979 |
invItemSql = "select i.id, i.itemId, i.itemNumber, i.serialNumber, i.initialQuantity, i.currentQuantity, i.purchaseId, i.purchaseReturnId, i.currentWarehouseId, i.lastScanType, i.transferStatus, physicalWarehouseId, po.supplierId, l.unitPrice, l.nlc from inventoryItem i join purchase p on i.purchaseId = p.id join purchaseorder po on p.purchaseOrder_id = po.id join lineitem l on (i.itemId = l.itemId and po.id =l.purchaseOrder_id) where i.itemNumber = '%s' AND itemId = %d AND i.physicalWarehouseId = %d AND i.currentWarehouseId =%d AND lastScanType in ('BAD_SALE', 'MARKED_BAD', 'SALE_RET_UNUSABLE', 'DOA_REJECTED', 'DOA_IN') AND (i.transferStatus is NULL or i.transferStatus != 'IN_TRANSIT')"%(itemNumbers[0],item.id,order.warehouse_id,order.fulfilmentWarehouseId)
|
8057 |
invItemSql = "select i.id, i.itemId, i.itemNumber, i.serialNumber, i.initialQuantity, i.currentQuantity, i.purchaseId, i.purchaseReturnId, i.currentWarehouseId, i.lastScanType, i.transferStatus, physicalWarehouseId, po.supplierId, l.unitPrice, l.nlc from inventoryItem i join purchase p on i.purchaseId = p.id join purchaseorder po on p.purchaseOrder_id = po.id join lineitem l on (i.itemId = l.itemId and po.id =l.purchaseOrder_id) where i.itemNumber = '%s' AND itemId = %d AND i.physicalWarehouseId = %d AND i.currentWarehouseId =%d AND lastScanType in ('BAD_SALE', 'MARKED_BAD', 'SALE_RET_UNUSABLE', 'DOA_REJECTED', 'DOA_IN') AND (i.transferStatus is NULL or i.transferStatus != 'IN_TRANSIT')"%(itemNumbers[0],item.id,order.warehouse_id,order.fulfilmentWarehouseId)
|
| 7980 |
whCursor.execute(invItemSql)
|
8058 |
whCursor.execute(invItemSql)
|
| 7981 |
invItems = whCursor.fetchall()
|
8059 |
invItems = whCursor.fetchall()
|
| 7982 |
if invItems is None:
|
8060 |
if invItems is None:
|
| - |
|
8061 |
if warehouseDbConnection.open:
|
| - |
|
8062 |
warehouseDbConnection.close()
|
| 7983 |
raise TransactionServiceException(110, "No Item in the inventory with this item number " + itemNumbers[0]+" in Vendor Warehouse Id- "+str(warehouse.id)+" Order Id:- "+str(order.id))
|
8063 |
raise TransactionServiceException(110, "No Item in the inventory with this item number " + itemNumbers[0]+" in Vendor Warehouse Id- "+str(warehouse.id)+" Order Id:- "+str(order.id))
|
| - |
|
8064 |
|
| 7984 |
totalCurrentQuantity =0
|
8065 |
totalCurrentQuantity =0
|
| 7985 |
for invItem in invItems:
|
8066 |
for invItem in invItems:
|
| 7986 |
totalCurrentQuantity = totalCurrentQuantity + invItem[5]
|
8067 |
totalCurrentQuantity = totalCurrentQuantity + invItem[5]
|
| 7987 |
|
8068 |
|
| 7988 |
orderQuantity = lineitem.quantity
|
8069 |
orderQuantity = lineitem.quantity
|
| 7989 |
if totalCurrentQuantity < lineitem.quantity:
|
8070 |
if totalCurrentQuantity < lineitem.quantity:
|
| - |
|
8071 |
if warehouseDbConnection.open:
|
| - |
|
8072 |
warehouseDbConnection.close()
|
| 7990 |
raise TransactionServiceException(110, "Unsufficient Quantity with this item number " + itemNumbers[0]+" in Vendor Warehouse Id- "+str(warehouse.id)+" Order Id:- "+str(order.id))
|
8073 |
raise TransactionServiceException(110, "Unsufficient Quantity with this item number " + itemNumbers[0]+" in Vendor Warehouse Id- "+str(warehouse.id)+" Order Id:- "+str(order.id))
|
| 7991 |
|
8074 |
|
| 7992 |
for invItem in invItems:
|
8075 |
for invItem in invItems:
|
| 7993 |
scanSql = "select * from scanNew where inventoryItemId =%d"%(invItem[0])
|
8076 |
scanSql = "select * from scanNew where inventoryItemId =%d"%(invItem[0])
|
| 7994 |
whCursor.execute(scanSql)
|
8077 |
whCursor.execute(scanSql)
|
| 7995 |
scans = whCursor.fetchall()
|
8078 |
scans = whCursor.fetchall()
|
| 7996 |
|
8079 |
|
| 7997 |
if scans is None:
|
8080 |
if scans is None:
|
| - |
|
8081 |
if warehouseDbConnection.open:
|
| - |
|
8082 |
warehouseDbConnection.close()
|
| 7998 |
raise TransactionServiceException(110, "Item with Item Number:- " + itemNumbers[0]+" never scanned in the system")
|
8083 |
raise TransactionServiceException(110, "Item with Item Number:- " + itemNumbers[0]+" never scanned in the system")
|
| 7999 |
if warehouse.billingType == BillingType.OURS:
|
8084 |
if warehouse.billingType == BillingType.OURS:
|
| 8000 |
if not inventory_client.isAlive():
|
8085 |
if not inventory_client.isAlive():
|
| 8001 |
inventory_client = InventoryClient().get_client()
|
8086 |
inventory_client = InventoryClient().get_client()
|
| 8002 |
inventory_client.addInventory(item.id, warehouse.id, long(-1.0*lineitem.quantity))
|
8087 |
inventory_client.addInventory(item.id, warehouse.id, long(-1.0*lineitem.quantity))
|
| Line 8082... |
Line 8167... |
| 8082 |
inventory_client.reduceReservationCount(lineitem.item_id, order.fulfilmentWarehouseId, sourceId, order.id, lineitem.quantity)
|
8167 |
inventory_client.reduceReservationCount(lineitem.item_id, order.fulfilmentWarehouseId, sourceId, order.id, lineitem.quantity)
|
| 8083 |
except:
|
8168 |
except:
|
| 8084 |
print "Unable to reduce reservation count"
|
8169 |
print "Unable to reduce reservation count"
|
| 8085 |
|
8170 |
|
| 8086 |
warehouseDbConnection.commit()
|
8171 |
warehouseDbConnection.commit()
|
| - |
|
8172 |
if warehouseDbConnection.open:
|
| 8087 |
warehouseDbConnection.close()
|
8173 |
warehouseDbConnection.close()
|
| 8088 |
session.commit()
|
8174 |
session.commit()
|
| 8089 |
|
8175 |
|
| 8090 |
if billingType == BillingType.OURS or billingType == BillingType.OURS_EXTERNAL:
|
8176 |
if billingType == BillingType.OURS or billingType == BillingType.OURS_EXTERNAL:
|
| 8091 |
invoiceNumber = get_next_invoice_counter(ordersList[0].orderType, whStateId)
|
8177 |
invoiceNumber = get_next_invoice_counter(ordersList[0].orderType, whStateId)
|
| - |
|
8178 |
|
| - |
|
8179 |
invoiceTypeVal = 1
|
| - |
|
8180 |
if not individualInvoice:
|
| - |
|
8181 |
invoiceTypeVal = 2
|
| - |
|
8182 |
if lineItemSize >20:
|
| - |
|
8183 |
invoiceTypeVal = 2
|
| - |
|
8184 |
if lineItemSize < 20 and invoiceType =="BulkInvoice" :
|
| - |
|
8185 |
invoiceTypeVal = 2
|
| - |
|
8186 |
|
| - |
|
8187 |
transactionShipSeqValues = ordersList[0].logisticsTransactionId.split('-')
|
| - |
|
8188 |
|
| 8092 |
|
8189 |
txnShipSeq = TransactionShipmentSequence.query.filter(TransactionShipmentSequence.transactionId==int(transactionShipSeqValues[0])).filter(TransactionShipmentSequence.sequence==int(transactionShipSeqValues[1])).order_by(desc(TransactionShipmentSequence.id)).first()
|
| - |
|
8190 |
txnShipSeq.invoiceFormat = invoiceTypeVal
|
| - |
|
8191 |
|
| 8093 |
for order in ordersList:
|
8192 |
for order in ordersList:
|
| 8094 |
order.invoice_number = invoiceNumber
|
8193 |
order.invoice_number = invoiceNumber
|
| 8095 |
session.commit()
|
8194 |
session.commit()
|
| 8096 |
|
8195 |
|
| 8097 |
return True
|
8196 |
return True
|
| - |
|
8197 |
|
| - |
|
8198 |
def get_invoice_format_logistics_txn_id(transactionId, shipementSeq):
|
| - |
|
8199 |
txnShipSeq = TransactionShipmentSequence.query.filter(TransactionShipmentSequence.transactionId==transactionId).filter(TransactionShipmentSequence.sequence==int(transactionShipSeqValues[1])).order_by(desc(TransactionShipmentSequence.id)).first()
|
| - |
|
8200 |
if txnShipSeq.invoiceFormat == 2:
|
| - |
|
8201 |
return 'Bulk'
|
| 8098 |
|
8202 |
else:
|
| - |
|
8203 |
return 'Individual'
|
| - |
|
8204 |
|
| 8099 |
if __name__ == '__main__':
|
8205 |
if __name__ == '__main__':
|
| 8100 |
print get_orders_by_mobile_number("9650889334")
|
8206 |
print get_orders_by_mobile_number("9650889334")
|