| Line 442... |
Line 442... |
| 442 |
session.commit()
|
442 |
session.commit()
|
| 443 |
pending_orders = query.all()
|
443 |
pending_orders = query.all()
|
| 444 |
return pending_orders
|
444 |
return pending_orders
|
| 445 |
|
445 |
|
| 446 |
def order_outofstock(orderId):
|
446 |
def order_outofstock(orderId):
|
| - |
|
447 |
'''
|
| - |
|
448 |
Mark order as out of stock
|
| - |
|
449 |
'''
|
| 447 |
order = get_order(orderId)
|
450 |
order = get_order(orderId)
|
| 448 |
order.status = OrderStatus.INVENTORY_LOW
|
451 |
order.status = OrderStatus.INVENTORY_LOW
|
| 449 |
order.statusDescription = "Low Inventory"
|
452 |
order.statusDescription = "Low Inventory"
|
| 450 |
order.outofstock_timestamp = datetime.datetime.now()
|
453 |
order.outofstock_timestamp = datetime.datetime.now()
|
| 451 |
session.commit()
|
454 |
session.commit()
|
| Line 482... |
Line 485... |
| 482 |
|
485 |
|
| 483 |
def mark_orders_as_delivered(provider_id, delivered_orders):
|
486 |
def mark_orders_as_delivered(provider_id, delivered_orders):
|
| 484 |
for awb, detail in delivered_orders.iteritems():
|
487 |
for awb, detail in delivered_orders.iteritems():
|
| 485 |
order = Order.query.filter_by(airwaybill_no=awb, logistics_provider_id = provider_id).first()
|
488 |
order = Order.query.filter_by(airwaybill_no=awb, logistics_provider_id = provider_id).first()
|
| 486 |
if order == None:
|
489 |
if order == None:
|
| - |
|
490 |
continue
|
| 487 |
raise TransactionServiceException(103, "No order found for the awb:" + awb)
|
491 |
#raise TransactionServiceException(103, "No order found for the awb:" + awb)
|
| 488 |
order.status = OrderStatus.DELIVERY_SUCCESS
|
492 |
order.status = OrderStatus.DELIVERY_SUCCESS
|
| 489 |
order.statusDescription = "Order delivered"
|
493 |
order.statusDescription = "Order delivered"
|
| 490 |
order.delivery_timestamp, order.receiver = detail.split('|')
|
494 |
order.delivery_timestamp, order.receiver = detail.split('|')
|
| 491 |
session.commit()
|
495 |
session.commit()
|
| 492 |
|
496 |
|
| Line 496... |
Line 500... |
| 496 |
if order == None:
|
500 |
if order == None:
|
| 497 |
raise TransactionServiceException(103, "No order found for the awb:" + awb)
|
501 |
raise TransactionServiceException(103, "No order found for the awb:" + awb)
|
| 498 |
order.status = OrderStatus.FAILED
|
502 |
order.status = OrderStatus.FAILED
|
| 499 |
order.delivery_timestamp, reason = detail.split('|')
|
503 |
order.delivery_timestamp, reason = detail.split('|')
|
| 500 |
order.statusDescription = "Order Returned to Origin:" + reason
|
504 |
order.statusDescription = "Order Returned to Origin:" + reason
|
| 501 |
session.commit()
|
505 |
session.commit()
|
| 502 |
|
506 |
|
| 503 |
def update_non_delivery_reason(provider_id, undelivered_orders):
|
507 |
def update_non_delivery_reason(provider_id, undelivered_orders):
|
| 504 |
for awb, reason in undelivered_orders.iteritems():
|
508 |
for awb, reason in undelivered_orders.iteritems():
|
| 505 |
order = Order.query.filter_by(airwaybill_no=awb, logistics_provider_id = provider_id).first()
|
509 |
order = Order.query.filter_by(airwaybill_no=awb, logistics_provider_id = provider_id).first()
|
| 506 |
if order == None:
|
510 |
if order == None:
|