Subversion Repositories SmartDukaan

Rev

Rev 18590 | Rev 18634 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 18590 Rev 18618
Line 8125... Line 8125...
8125
        if not order:
8125
        if not order:
8126
            raise TransactionServiceException(301, "No order found for the given order id" + str(orderId))
8126
            raise TransactionServiceException(301, "No order found for the given order id" + str(orderId))
8127
        else:
8127
        else:
8128
            ordersList.append(order)
8128
            ordersList.append(order)
8129
            
8129
            
-
 
8130
    singleOrder = ordersList[0]
-
 
8131
    grouppedOrders = get_group_orders_by_logistics_txn_id(singleOrder.logisticsTransactionId)
-
 
8132
    
-
 
8133
    errorString = ""
-
 
8134
    missingString = "Billing Details Missing for following Orders:- "
-
 
8135
    
-
 
8136
    for ordObj in grouppedOrders:
-
 
8137
        if ordObj.id not in orderIds:
-
 
8138
            errorString = errorString + "Order Id:- " +str(ordObj.id) +" "
-
 
8139
    
-
 
8140
    errorString = errorString.strip()
-
 
8141
    if len(errorString)>0:
-
 
8142
        raise TransactionServiceException(301, missingString + errorString)
-
 
8143
            
8130
    
8144
    
8131
    #inventoryDbConnection = getDbConnection("192.168.190.114","root", "shop2020", "inventory") 
8145
    #inventoryDbConnection = getDbConnection("192.168.190.114","root", "shop2020", "inventory") 
8132
    try:
8146
    try:
8133
        warehouseDbConnection = getDbConnection("localhost","root", "shop2020", "warehouse")
8147
        warehouseDbConnection = getDbConnection("localhost","root", "shop2020", "warehouse")
8134
    except:
8148
    except:
Line 8241... Line 8255...
8241
            
8255
            
8242
            try:
8256
            try:
8243
                if not inventory_client.isAlive():
8257
                if not inventory_client.isAlive():
8244
                    inventory_client = InventoryClient().get_client()
8258
                    inventory_client = InventoryClient().get_client()
8245
                warehouse = inventory_client.getWarehouse(order.fulfilmentWarehouseId)
8259
                warehouse = inventory_client.getWarehouse(order.fulfilmentWarehouseId)
8246
                if order.productCondition == ProductCondition.BAD:
8260
                if order.productCondition == ProductCondition.GOOD:
8247
                    item_pricing = inventory_client.getItemPricing(item_id, warehouse.vendor.id)
8261
                    item_pricing = inventory_client.getItemPricing(item_id, warehouse.vendor.id)
8248
                    lineitem.transfer_price = item_pricing.transferPrice
8262
                    lineitem.transfer_price = item_pricing.transferPrice
8249
                    lineitem.nlc = item_pricing.nlc
8263
                    lineitem.nlc = item_pricing.nlc
8250
                if order.taxType == TaxType.CFORM:
8264
                if order.taxType == TaxType.CFORM:
8251
                    lineitem.vatRate = 2
8265
                    lineitem.vatRate = 2
Line 8283... Line 8297...
8283
                        warehouse = inventory_client.getWarehouses(None, InventoryType.GOOD, warehouse.vendor.id, order.warehouse_id, 0)[0]
8297
                        warehouse = inventory_client.getWarehouses(None, InventoryType.GOOD, warehouse.vendor.id, order.warehouse_id, 0)[0]
8284
                    
8298
                    
8285
                    whCursor = warehouseDbConnection.cursor()
8299
                    whCursor = warehouseDbConnection.cursor()
8286
                    ''' Good Serialized'''
8300
                    ''' Good Serialized'''
8287
                    if ItemType.SERIALIZED == item.type:
8301
                    if ItemType.SERIALIZED == item.type:
8288
                        for serialNumber in serialNumbers: 
8302
                        for serialNumber in serialNumbers:
-
 
8303
                            serialNumber = serialNumber.strip()
-
 
8304
                            if len(serialNumber) ==0:
-
 
8305
                                raise TransactionServiceException(315, "Serial Number not Specified. Order Id:- "+str(order.id))  
8289
                            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)
8306
                            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)
8290
                            whCursor.execute(invItemSql)
8307
                            whCursor.execute(invItemSql)
8291
                            invItem = whCursor.fetchone()
8308
                            invItem = whCursor.fetchone()
8292
                            if invItem is None:
8309
                            if invItem is None:
8293
                                if warehouseDbConnection.open:
8310
                                if warehouseDbConnection.open:
Line 8427... Line 8444...
8427
                            inventory_client = InventoryClient().get_client()
8444
                            inventory_client = InventoryClient().get_client()
8428
                        warehouse = inventory_client.getWarehouses(None, InventoryType.GOOD, warehouse.vendor.id, order.warehouse_id, 0)[0]
8445
                        warehouse = inventory_client.getWarehouses(None, InventoryType.GOOD, warehouse.vendor.id, order.warehouse_id, 0)[0]
8429
                    
8446
                    
8430
                    whCursor = warehouseDbConnection.cursor()
8447
                    whCursor = warehouseDbConnection.cursor()
8431
                    if ItemType.SERIALIZED == item.type:
8448
                    if ItemType.SERIALIZED == item.type:
8432
                        for serialNumber in serialNumbers: 
8449
                        for serialNumber in serialNumbers:
-
 
8450
                            serialNumber = serialNumber.strip()
-
 
8451
                            if len(serialNumber) ==0:
-
 
8452
                                raise TransactionServiceException(315, "Serial Number not Specified. Order Id:- "+str(order.id))  
8433
                            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)
8453
                            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)
8434
                            whCursor.execute(invItemSql)
8454
                            whCursor.execute(invItemSql)
8435
                            invItem = whCursor.fetchone()
8455
                            invItem = whCursor.fetchone()
8436
                            if invItem is None:
8456
                            if invItem is None:
8437
                                if warehouseDbConnection.open:
8457
                                if warehouseDbConnection.open: