| Line 45... |
Line 45... |
| 45 |
from_user = 'cnc.center@shop2020.in'
|
45 |
from_user = 'cnc.center@shop2020.in'
|
| 46 |
from_pwd = '5h0p2o2o'
|
46 |
from_pwd = '5h0p2o2o'
|
| 47 |
to = ['cnc.center@shop2020.in', "suraj.sharma@shop2020.in", "sandeep.sachdeva@shop2020.in", "parmod.kumar@shop2020.in"]
|
47 |
to = ['cnc.center@shop2020.in', "suraj.sharma@shop2020.in", "sandeep.sachdeva@shop2020.in", "parmod.kumar@shop2020.in"]
|
| 48 |
|
48 |
|
| 49 |
def process_dao_pickup_orders(provider):
|
49 |
def process_dao_pickup_orders(provider):
|
| 50 |
doas_tobe_picked_up = fetch_data(provider.id, OrderStatus.DOA_PICKUP_CONFIRMED)
|
- |
|
| 51 |
doa_pickup_details = read_dao_pickup_orders(doas_tobe_picked_up)
|
- |
|
| 52 |
doas_not_picked_up = update_picked_doas(provider.id, doa_pickup_details)
|
- |
|
| 53 |
try:
|
50 |
try:
|
| - |
|
51 |
doas_tobe_picked_up = fetch_data(provider.id, OrderStatus.DOA_PICKUP_CONFIRMED)
|
| - |
|
52 |
doa_pickup_details = read_dao_pickup_orders(doas_tobe_picked_up)
|
| - |
|
53 |
doas_not_picked_up = update_picked_doas(provider.id, doa_pickup_details)
|
| - |
|
54 |
try:
|
| 54 |
if doas_not_picked_up:
|
55 |
if doas_not_picked_up:
|
| 55 |
print "DOAs not Picked up:"
|
56 |
print "DOAs not Picked up:"
|
| 56 |
print doas_not_picked_up
|
57 |
print doas_not_picked_up
|
| 57 |
mismatch_file = "/tmp/DoaPickupMismatch.csv"
|
58 |
mismatch_file = "/tmp/DoaPickupMismatch.csv"
|
| 58 |
print "Some of our DOA orders were not picked up. Printing report to:" + mismatch_file
|
59 |
print "Some of our DOA orders were not picked up. Printing report to:" + mismatch_file
|
| 59 |
print_pickup_mismatch_report(mismatch_file, doas_not_picked_up)
|
60 |
print_pickup_mismatch_report(mismatch_file, doas_not_picked_up)
|
| 60 |
pickup_mismatch_part = [get_attachment_part(mismatch_file)]
|
61 |
pickup_mismatch_part = [get_attachment_part(mismatch_file)]
|
| 61 |
mail(from_user, from_pwd, to,\
|
62 |
mail(from_user, from_pwd, to,\
|
| 62 |
"DOA Pickup Mismatch for " + provider.name,\
|
63 |
"DOA Pickup Mismatch for " + provider.name,\
|
| 63 |
"This is a system generated email.Please don't reply to it.",\
|
64 |
"This is a system generated email.Please don't reply to it.",\
|
| 64 |
pickup_mismatch_part)
|
65 |
pickup_mismatch_part)
|
| 65 |
except Exception:
|
66 |
except Exception:
|
| 66 |
print "Some issue sending the DOA mismatch report"
|
67 |
print "Some issue sending the DOA mismatch report"
|
| - |
|
68 |
traceback.print_exc()
|
| - |
|
69 |
except:
|
| - |
|
70 |
print "Some issue while processing the orders in DOA_PICKUP_CONFIRMED status"
|
| 67 |
traceback.print_exc()
|
71 |
traceback.print_exc()
|
| 68 |
|
72 |
|
| 69 |
def process_pickup_records(provider):
|
73 |
def process_pickup_records(provider):
|
| 70 |
orders_tobe_picked_up = fetch_data(provider.id, OrderStatus.SHIPPED_FROM_WH)
|
- |
|
| 71 |
pickup_details = read_pickup_orders(orders_tobe_picked_up)
|
- |
|
| 72 |
orders_not_picked_up = update_picked_orders(provider.id, pickup_details)
|
- |
|
| 73 |
try:
|
74 |
try:
|
| - |
|
75 |
orders_tobe_picked_up = fetch_data(provider.id, OrderStatus.SHIPPED_FROM_WH)
|
| - |
|
76 |
pickup_details = read_pickup_orders(orders_tobe_picked_up)
|
| - |
|
77 |
orders_not_picked_up = update_picked_orders(provider.id, pickup_details)
|
| - |
|
78 |
try:
|
| 74 |
if orders_not_picked_up:
|
79 |
if orders_not_picked_up:
|
| 75 |
print "Orders not Picked up:"
|
80 |
print "Orders not Picked up:"
|
| 76 |
print orders_not_picked_up
|
81 |
print orders_not_picked_up
|
| 77 |
mismatch_file = "/tmp/PickupMismatch.csv"
|
82 |
mismatch_file = "/tmp/PickupMismatch.csv"
|
| 78 |
print "Some of our orders were not picked up. Printing report to:" + mismatch_file
|
83 |
print "Some of our orders were not picked up. Printing report to:" + mismatch_file
|
| 79 |
print_pickup_mismatch_report(mismatch_file, orders_not_picked_up)
|
84 |
print_pickup_mismatch_report(mismatch_file, orders_not_picked_up)
|
| 80 |
pickup_mismatch_part = [get_attachment_part(mismatch_file)]
|
85 |
pickup_mismatch_part = [get_attachment_part(mismatch_file)]
|
| 81 |
mail(from_user, from_pwd, to,\
|
86 |
mail(from_user, from_pwd, to,\
|
| 82 |
"Order Pickup Mismatch for " + provider.name,\
|
87 |
"Order Pickup Mismatch for " + provider.name,\
|
| 83 |
"This is a system generated email.Please don't reply to it.",\
|
88 |
"This is a system generated email.Please don't reply to it.",\
|
| 84 |
pickup_mismatch_part)
|
89 |
pickup_mismatch_part)
|
| 85 |
except Exception:
|
90 |
except Exception:
|
| 86 |
print "Some issue sending the pickup mismatch report"
|
91 |
print "Some issue sending the pickup mismatch report"
|
| - |
|
92 |
traceback.print_exc()
|
| - |
|
93 |
except:
|
| - |
|
94 |
print "Some issue while processing the orders in SHIPPED_FROM_WH status"
|
| 87 |
traceback.print_exc()
|
95 |
traceback.print_exc()
|
| 88 |
|
96 |
|
| 89 |
def process_delivery_report(provider):
|
97 |
def process_delivery_report(provider):
|
| 90 |
try:
|
98 |
try:
|
| 91 |
orders_tobe_delivered = fetch_data(provider.id, OrderStatus.SHIPPED_TO_LOGST)
|
99 |
orders_tobe_delivered = fetch_data(provider.id, OrderStatus.SHIPPED_TO_LOGST)
|