Subversion Repositories SmartDukaan

Rev

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

Rev 13146 Rev 13151
Line 39... Line 39...
39
    BlockedIpRange, DeniedIpAddress, InsuranceDetailForOrder, DocumentStore, \
39
    BlockedIpRange, DeniedIpAddress, InsuranceDetailForOrder, DocumentStore, \
40
    RechargeTransaction, HotspotStore, WalletForCompany, WalletHistoryForCompany, \
40
    RechargeTransaction, HotspotStore, WalletForCompany, WalletHistoryForCompany, \
41
    FRC, OperatorSeries, SourceDetail, Company, EbayOrder, AmazonFbaSalesSnapshot, \
41
    FRC, OperatorSeries, SourceDetail, Company, EbayOrder, AmazonFbaSalesSnapshot, \
42
    AmazonOrder, StoreOrderDetail, EdcBank, StoreOrderCollection, \
42
    AmazonOrder, StoreOrderDetail, EdcBank, StoreOrderCollection, \
43
    HotspotServiceMatrix, SnapdealOrder, FlipkartOrder, DataInsuranceDetailForOrder, \
43
    HotspotServiceMatrix, SnapdealOrder, FlipkartOrder, DataInsuranceDetailForOrder, \
44
    AmazonFbaOrderReturns, FlipkartAdvantageOrder, InvoiceCounterGenerator
44
    AmazonFbaOrderReturns, FlipkartAdvantageOrder, InvoiceCounterGenerator, \
-
 
45
    TransactionShipmentSequence
45
from shop2020.model.v1.order.impl.model.BaseOrder import BaseOrder
46
from shop2020.model.v1.order.impl.model.BaseOrder import BaseOrder
46
from shop2020.model.v1.order.impl.model.DTHRechargeOrder import DTHRechargeOrder
47
from shop2020.model.v1.order.impl.model.DTHRechargeOrder import DTHRechargeOrder
47
from shop2020.model.v1.order.impl.model.MobileRechargeOrder import \
48
from shop2020.model.v1.order.impl.model.MobileRechargeOrder import \
48
    MobileRechargeOrder
49
    MobileRechargeOrder
49
from shop2020.model.v1.order.impl.model.RechargeDenomination import \
50
from shop2020.model.v1.order.impl.model.RechargeDenomination import \
Line 1489... Line 1490...
1489
                order.cod = False                
1490
                order.cod = False                
1490
            session.commit()
1491
            session.commit()
1491
            return "True"
1492
            return "True"
1492
        __amend_fulfilment_warehouse(order)
1493
        __amend_fulfilment_warehouse(order)
1493
        __update_transfer_price(order, order.fulfilmentWarehouseId)
1494
        __update_transfer_price(order, order.fulfilmentWarehouseId)
-
 
1495
        txnSeqRequired = 0
-
 
1496
        txnShipSeq = TransactionShipmentSequence.query.filter(TransactionShipmentSequence.transactionId==order.transaction_id).order_by(desc(TransactionShipmentSequence.id,TransactionShipmentSequence.createdTimestamp)).first()
-
 
1497
        if txnShipSeq is None:
-
 
1498
            txnShipSeq = TransactionShipmentSequence()
-
 
1499
            txnShipSeq.transactionId = order.transaction_id
-
 
1500
            txnShipSeq.createdTimestamp = datetime.datetime.now()
-
 
1501
            txnShipSeq.sequence = 1
-
 
1502
            txnSeqRequired = 1
-
 
1503
        else:
-
 
1504
            txnShipSeqNew = TransactionShipmentSequence()
-
 
1505
            txnShipSeqNew.transactionId = txnShipSeq.transactionId
-
 
1506
            txnShipSeqNew.createdTimestamp = datetime.datetime.now()
-
 
1507
            txnShipSeqNew.sequence = txnShipSeq.sequence + 1
-
 
1508
            txnSeqRequired = txnShipSeq.sequence + 1
1494
        session.commit()
1509
            session.commit()
1495
        '''
1510
        '''
1496
        if order.logistics_provider_id != 7 and order.airwaybill_no is None or order.airwaybill_no == "null":
1511
        if order.logistics_provider_id != 7 and order.airwaybill_no is None or order.airwaybill_no == "null":
1497
            logistics_client = LogisticsClient().get_client()
1512
            logistics_client = LogisticsClient().get_client()
1498
            if order.cod and order.total_amount > 1:
1513
            if order.cod and order.total_amount > 1:
1499
                airwaybillNo= logistics_client.getEmptyAWB(order.logistics_provider_id, DeliveryType.COD)
1514
                airwaybillNo= logistics_client.getEmptyAWB(order.logistics_provider_id, DeliveryType.COD)
Line 6533... Line 6548...
6533
#Start:- Added by Manish Sharma for FedEx Integration- Shipment Creation on 31-Jul-2013
6548
#Start:- Added by Manish Sharma for FedEx Integration- Shipment Creation on 31-Jul-2013
6534
def update_order_AWB(orderId, airwayBillNo):
6549
def update_order_AWB(orderId, airwayBillNo):
6535
    order = Order.get_by(id = orderId)
6550
    order = Order.get_by(id = orderId)
6536
    order.airwaybill_no=airwayBillNo
6551
    order.airwaybill_no=airwayBillNo
6537
    order.tracking_id=airwayBillNo
6552
    order.tracking_id=airwayBillNo
6538
    order.logisticsTransactionId = str(order.transaction_id)+airwayBillNo
6553
    #order.logisticsTransactionId = str(order.transaction_id)+airwayBillNo
6539
    session.commit()
6554
    session.commit()
6540
    return order
6555
    return order
6541
#End:- Added by Manish Sharma for FedEx Integration- Shipment Creation on 31-Jul-2013
6556
#End:- Added by Manish Sharma for FedEx Integration- Shipment Creation on 31-Jul-2013
6542
 
6557
 
6543
def get_hotspot_service_matrices():
6558
def get_hotspot_service_matrices():
Line 7605... Line 7620...
7605
                    itemPricing = cursor.fetchone()
7620
                    itemPricing = cursor.fetchone()
7606
                except Exception as e:
7621
                except Exception as e:
7607
                    print "Error: unable to fetch data 3"
7622
                    print "Error: unable to fetch data 3"
7608
                    
7623
                    
7609
                if itemPricing is None:
7624
                if itemPricing is None:
7610
                    raise TransactionServiceException(214, "Vendor Item Pricing Missing For Item Id "+itemId+ " and Fulfillment Warehouse "+ orderFulfillmentWarehouse[1])
7625
                    raise TransactionServiceException(214, "Vendor Item Pricing Missing For Item Id "+str(itemId)+ " and Fulfillment Warehouse "+ str(orderFulfillmentWarehouse[1]))
7611
                else:
7626
                else:
7612
                    order.lineitems[0].transfer_price = itemPricing[4]
7627
                    order.lineitems[0].transfer_price = itemPricing[4]
7613
                    order.lineitems[0].nlc = itemPricing[5]
7628
                    order.lineitems[0].nlc = itemPricing[5]
7614
                
7629
        else:
-
 
7630
            raise TransactionServiceException(216, "Order in Unacceptable Status.. "+str(order.id))
7615
    try:
7631
    try:
7616
        conn.commit()
7632
        conn.commit()
7617
    except:
7633
    except:
7618
        conn.close()
7634
        conn.close()
7619
        
7635
        
Line 7624... Line 7640...
7624
    if ordersList[0].cod:
7640
    if ordersList[0].cod:
7625
        deltype = DeliveryType.COD
7641
        deltype = DeliveryType.COD
7626
    if not logistics_client.isAlive():
7642
    if not logistics_client.isAlive():
7627
        logistics_client = LogisticsClient().get_client()
7643
        logistics_client = LogisticsClient().get_client()
7628
    awbNumber = logistics_client.getNewEmptyAwb(provider.id, deltype, totalOrderQuantity)
7644
    awbNumber = logistics_client.getNewEmptyAwb(provider.id, deltype, totalOrderQuantity)
-
 
7645
    
-
 
7646
    txnSeqRequired = 0
-
 
7647
    txnShipSeq = TransactionShipmentSequence.query.filter(TransactionShipmentSequence.transactionId==ordersList[0].transaction_id).order_by(desc(TransactionShipmentSequence.id,TransactionShipmentSequence.createdTimestamp)).first()
-
 
7648
    if txnShipSeq is None:
-
 
7649
        txnShipSeq = TransactionShipmentSequence()
-
 
7650
        txnShipSeq.transactionId = ordersList[0].transaction_id
-
 
7651
        txnShipSeq.createdTimestamp = datetime.datetime.now()
-
 
7652
        txnShipSeq.sequence = 1
7629
                
7653
        txnSeqRequired = 1
7630
    session.commit()
7654
    else:
-
 
7655
        txnShipSeqNew = TransactionShipmentSequence()
-
 
7656
        txnShipSeqNew.transactionId = txnShipSeq.transactionId
-
 
7657
        txnShipSeqNew.createdTimestamp = datetime.datetime.now()
-
 
7658
        txnShipSeqNew.sequence = txnShipSeq.sequence + 1
-
 
7659
        txnSeqRequired = txnShipSeq.sequence + 1    
7631
    
7660
    
7632
    for order in ordersList:
7661
    for order in ordersList:
7633
        update_order_AWB(order.id, awbNumber)
7662
        update_order_AWB(order.id, awbNumber)
-
 
7663
        order.logisticsTransactionId = str(order.transaction_id)+"-"+str(txnSeqRequired)
-
 
7664
                
-
 
7665
    session.commit()
7634
         
7666
         
7635
    return True
7667
    return True
7636
 
7668
 
7637
def get_group_orders_by_logistics_txn_id(logisticsTxnId):
7669
def get_group_orders_by_logistics_txn_id(logisticsTxnId):
7638
    orders = Order.query.filter(Order.logisticsTransactionId==logisticsTxnId).all()
7670
    orders = Order.query.filter(Order.logisticsTransactionId==logisticsTxnId).all()