| Line 11... |
Line 11... |
| 11 |
from reportlab.rl_config import defaultPageSize
|
11 |
from reportlab.rl_config import defaultPageSize
|
| 12 |
from shop2020.clients.CatalogClient import CatalogClient
|
12 |
from shop2020.clients.CatalogClient import CatalogClient
|
| 13 |
from shop2020.clients.HelperClient import HelperClient
|
13 |
from shop2020.clients.HelperClient import HelperClient
|
| 14 |
from shop2020.clients.LogisticsClient import LogisticsClient
|
14 |
from shop2020.clients.LogisticsClient import LogisticsClient
|
| 15 |
from shop2020.clients.PaymentClient import PaymentClient
|
15 |
from shop2020.clients.PaymentClient import PaymentClient
|
| 16 |
from shop2020.clients.TransactionClient import TransactionClient
|
- |
|
| 17 |
from shop2020.clients.UserClient import UserClient
|
16 |
from shop2020.clients.UserClient import UserClient
|
| 18 |
from shop2020.clients.WarehouseClient import WarehouseClient
|
17 |
from shop2020.clients.WarehouseClient import WarehouseClient
|
| 19 |
from shop2020.model.v1 import order
|
18 |
from shop2020.model.v1 import order
|
| 20 |
from shop2020.model.v1.order.impl.DataService import Transaction, LineItem, \
|
19 |
from shop2020.model.v1.order.impl.DataService import Transaction, LineItem, \
|
| 21 |
Alerts, Order, BatchNoGenerator, InvoiceIDGenerator, \
|
20 |
Order, BatchNoGenerator, InvoiceIDGenerator, \
|
| 22 |
TransactionRequiringExtraProcessing, OrderInventory
|
21 |
TransactionRequiringExtraProcessing, OrderInventory, Alert
|
| 23 |
from shop2020.model.v1.order.impl.model.ReturnOrder import ReturnOrder
|
22 |
from shop2020.model.v1.order.impl.model.ReturnOrder import ReturnOrder
|
| 24 |
from shop2020.thriftpy.logistics.ttypes import DeliveryType
|
23 |
from shop2020.thriftpy.logistics.ttypes import DeliveryType
|
| 25 |
from shop2020.thriftpy.model.v1.catalog.ttypes import BillingType
|
24 |
from shop2020.thriftpy.model.v1.catalog.ttypes import BillingType
|
| 26 |
from shop2020.thriftpy.model.v1.order.ttypes import Transaction as T_Transaction, \
|
25 |
from shop2020.thriftpy.model.v1.order.ttypes import \
|
| 27 |
TransactionServiceException, TransactionStatus, OrderStatus, DelayReason, \
|
26 |
TransactionServiceException, TransactionStatus, OrderStatus, DelayReason, \
|
| 28 |
ExtraTransactionProcessingType, HotspotAction, TimeoutSummary
|
27 |
ExtraTransactionProcessingType, HotspotAction, TimeoutSummary
|
| 29 |
from shop2020.thriftpy.warehouse.ttypes import PurchaseOrder, \
|
28 |
from shop2020.thriftpy.warehouse.ttypes import PurchaseOrder, \
|
| 30 |
LineItem as POLineItem, ScanType
|
29 |
LineItem as POLineItem, ScanType
|
| 31 |
from shop2020.utils.EmailAttachmentSender import mail, get_attachment_part
|
30 |
from shop2020.utils.EmailAttachmentSender import mail, get_attachment_part
|
| Line 753... |
Line 752... |
| 753 |
continue
|
752 |
continue
|
| 754 |
#raise TransactionServiceException(103, "No order found for the awb:" + awb)
|
753 |
#raise TransactionServiceException(103, "No order found for the awb:" + awb)
|
| 755 |
order.statusDescription = reason
|
754 |
order.statusDescription = reason
|
| 756 |
session.commit()
|
755 |
session.commit()
|
| 757 |
|
756 |
|
| 758 |
def get_alerts(order_id, all):
|
757 |
def get_alerts(type, status, timestamp):
|
| 759 |
query = Alerts.query.filter_by(order_id=order_id)
|
758 |
query = Alert.query.filter(Alert.type == type)
|
| - |
|
759 |
query = query.filter(Alert.status == status)
|
| 760 |
if not all:
|
760 |
if timestamp:
|
| 761 |
query = query.filter_by(valid=True)
|
761 |
query = query.filter(Alert.timestamp >= to_py_date(timestamp))
|
| 762 |
return query.all()
|
762 |
return query.all()
|
| 763 |
|
763 |
|
| 764 |
def set_alert(order_id, unset, type, comment):
|
764 |
def add_alert(type, description):
|
| 765 |
#get existing alert
|
- |
|
| 766 |
if unset:
|
- |
|
| 767 |
query = Alerts.query.filter_by(order_id=order_id)
|
- |
|
| 768 |
query = query.filter_by(type=type)
|
- |
|
| 769 |
alerts = query.all()
|
- |
|
| 770 |
for alert in alerts:
|
- |
|
| 771 |
if alert.valid:
|
- |
|
| 772 |
alert.valid = False
|
- |
|
| 773 |
alert.comment = comment
|
- |
|
| 774 |
alert.time_unset = datetime.datetime.now()
|
- |
|
| 775 |
else:
|
- |
|
| 776 |
alert = Alerts()
|
765 |
alert = Alert()
|
| 777 |
alert.order_id = order_id
|
- |
|
| 778 |
alert.valid = True
|
766 |
alert.type = type
|
| 779 |
alert.type = type
|
767 |
alert.status = 1
|
| 780 |
alert.comment = comment
|
768 |
alert.description = description
|
| 781 |
alert.time_set = datetime.datetime.now()
|
769 |
alert.timestamp = datetime.datetime.now()
|
| 782 |
session.commit()
|
770 |
session.commit()
|
| 783 |
|
771 |
|
| 784 |
def get_valid_order_count():
|
772 |
def get_valid_order_count():
|
| 785 |
'''
|
773 |
'''
|
| 786 |
Returns the number of orders which we processed. The reshipped orders are not
|
774 |
Returns the number of orders which we processed. The reshipped orders are not
|