Subversion Repositories SmartDukaan

Rev

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

Rev 7564 Rev 7566
Line 3476... Line 3476...
3476
def move_orders_to_correct_warehouse():
3476
def move_orders_to_correct_warehouse():
3477
    orders = Order.query.filter(Order.status.in_(tuple([OrderStatus.SUBMITTED_FOR_PROCESSING, OrderStatus.INVENTORY_LOW, OrderStatus.LOW_INV_PO_RAISED, OrderStatus.LOW_INV_REVERSAL_IN_PROCESS]))).order_by(Order.promised_shipping_time).all()
3477
    orders = Order.query.filter(Order.status.in_(tuple([OrderStatus.SUBMITTED_FOR_PROCESSING, OrderStatus.INVENTORY_LOW, OrderStatus.LOW_INV_PO_RAISED, OrderStatus.LOW_INV_REVERSAL_IN_PROCESS]))).order_by(Order.promised_shipping_time).all()
3478
    logistics_client = LogisticsClient().get_client()
3478
    logistics_client = LogisticsClient().get_client()
3479
    for order in orders:
3479
    for order in orders:
3480
        lineitem = order.lineitems[0]
3480
        lineitem = order.lineitems[0]
3481
        logistics_info = logistics_client.getLogisticsInfo(order.customer_pincode, lineitem.item_id, order.cod, PickUpType.COURIER)
3481
        logistics_info = logistics_client.getLogisticsEstimation(lineitem.item_id, order.customer_pincode, order.cod)
3482
        if order.fulfilmentWarehouseId != logistics_info.fulfilmentWarehouseId:
3482
        if order.fulfilmentWarehouseId != logistics_info.fulfilmentWarehouseId:
3483
            try:
3483
            try:
3484
                print "++++" + str(order.id) + "=" + str(order.fulfilmentWarehouseId) + "->"+ str(logistics_info.fulfilmentWarehouseId)
3484
                print "++++" + str(order.id) + "=" + str(order.fulfilmentWarehouseId) + "->"+ str(logistics_info.fulfilmentWarehouseId)
3485
                change_warehouse(order.id, logistics_info.fulfilmentWarehouseId)
3485
                change_warehouse(order.id, logistics_info.fulfilmentWarehouseId)
3486
            except:
3486
            except: