| Line 57... |
Line 57... |
| 57 |
traceback.print_exc()
|
57 |
traceback.print_exc()
|
| 58 |
|
58 |
|
| 59 |
defaultUndeliveredAsssigneeId = 19
|
59 |
defaultUndeliveredAsssigneeId = 19
|
| 60 |
from_user = 'cnc.center@shop2020.in'
|
60 |
from_user = 'cnc.center@shop2020.in'
|
| 61 |
from_pwd = '5h0p2o2o'
|
61 |
from_pwd = '5h0p2o2o'
|
| 62 |
to = ['cnc.center@shop2020.in', "suraj.sharma@shop2020.in", "sandeep.sachdeva@shop2020.in", "manoj.kumar@shop2020.in", "pankaj.kankar@shop2020.in"]
|
62 |
#to = ['cnc.center@shop2020.in', "suraj.sharma@shop2020.in", "sandeep.sachdeva@shop2020.in", "manoj.kumar@shop2020.in", "pankaj.kankar@shop2020.in"]
|
| 63 |
|
- |
|
| - |
|
63 |
to = ['phani.kumar@shop2020.in']
|
| 64 |
def process_dao_pickup_orders(provider):
|
64 |
def process_dao_pickup_orders(provider):
|
| 65 |
try:
|
65 |
try:
|
| 66 |
doas_tobe_picked_up = fetch_data(provider.id, [OrderStatus.DOA_PICKUP_CONFIRMED])
|
66 |
doas_tobe_picked_up = fetch_data(provider.id, [OrderStatus.DOA_PICKUP_CONFIRMED])
|
| 67 |
doa_pickup_details = read_dao_return_pickup_orders(doas_tobe_picked_up)
|
67 |
doa_pickup_details = read_dao_return_pickup_orders(doas_tobe_picked_up)
|
| 68 |
if doa_pickup_details:
|
68 |
if doa_pickup_details:
|
| Line 152... |
Line 152... |
| 152 |
|
152 |
|
| 153 |
try:
|
153 |
try:
|
| 154 |
if doas_not_picked_up:
|
154 |
if doas_not_picked_up:
|
| 155 |
print "DOAs not Picked up:"
|
155 |
print "DOAs not Picked up:"
|
| 156 |
print doas_not_picked_up
|
156 |
print doas_not_picked_up
|
| 157 |
mismatch_file = "/tmp/DoaPickupMismatch.csv"
|
157 |
mismatch_file = "/tmp/BlueDart_DoaPickupMismatch.csv"
|
| 158 |
print "Some of our DOA orders were not picked up. Printing report to:" + mismatch_file
|
158 |
print "Some of our DOA orders were not picked up. Printing report to:" + mismatch_file
|
| 159 |
print_dao_return_pickup_mismatch_report(mismatch_file, doas_not_picked_up)
|
159 |
print_dao_return_pickup_mismatch_report(mismatch_file, doas_not_picked_up)
|
| 160 |
pickup_mismatch_part = [get_attachment_part(mismatch_file)]
|
160 |
pickup_mismatch_part = [get_attachment_part(mismatch_file)]
|
| 161 |
mail(from_user, from_pwd, to,\
|
161 |
mail(from_user, from_pwd, to,\
|
| 162 |
"DOA Pickup Mismatch for " + provider.name,\
|
162 |
"DOA Pickup Mismatch for " + provider.name,\
|
| Line 175... |
Line 175... |
| 175 |
|
175 |
|
| 176 |
try:
|
176 |
try:
|
| 177 |
if returns_not_picked_up:
|
177 |
if returns_not_picked_up:
|
| 178 |
print "Return Orders not Picked up:"
|
178 |
print "Return Orders not Picked up:"
|
| 179 |
print returns_not_picked_up
|
179 |
print returns_not_picked_up
|
| 180 |
mismatch_file = "/tmp/ReturnsPickupMismatch.csv"
|
180 |
mismatch_file = "/tmp/BlueDart_ReturnsPickupMismatch.csv"
|
| 181 |
print "Some of our Return orders were not picked up. Printing report to:" + mismatch_file
|
181 |
print "Some of our Return orders were not picked up. Printing report to:" + mismatch_file
|
| 182 |
print_dao_return_pickup_mismatch_report(mismatch_file, returns_not_picked_up)
|
182 |
print_dao_return_pickup_mismatch_report(mismatch_file, returns_not_picked_up)
|
| 183 |
pickup_mismatch_part = [get_attachment_part(mismatch_file)]
|
183 |
pickup_mismatch_part = [get_attachment_part(mismatch_file)]
|
| 184 |
mail(from_user, from_pwd, to,\
|
184 |
mail(from_user, from_pwd, to,\
|
| 185 |
"Return orders Pickup Mismatch for " + provider.name,\
|
185 |
"Return orders Pickup Mismatch for " + provider.name,\
|
| Line 198... |
Line 198... |
| 198 |
|
198 |
|
| 199 |
try:
|
199 |
try:
|
| 200 |
if orders_not_picked_up:
|
200 |
if orders_not_picked_up:
|
| 201 |
print "Orders not Picked up:"
|
201 |
print "Orders not Picked up:"
|
| 202 |
print orders_not_picked_up
|
202 |
print orders_not_picked_up
|
| 203 |
mismatch_file = "/tmp/PickupMismatch.csv"
|
203 |
mismatch_file = "/tmp/BlueDart_PickupMismatch.csv"
|
| 204 |
print "Some of our orders were not picked up. Printing report to:" + mismatch_file
|
204 |
print "Some of our orders were not picked up. Printing report to:" + mismatch_file
|
| 205 |
print_pickup_mismatch_report(mismatch_file, orders_not_picked_up)
|
205 |
print_pickup_mismatch_report(mismatch_file, orders_not_picked_up)
|
| 206 |
pickup_mismatch_part = [get_attachment_part(mismatch_file)]
|
206 |
pickup_mismatch_part = [get_attachment_part(mismatch_file)]
|
| 207 |
mail(from_user, from_pwd, to,\
|
207 |
mail(from_user, from_pwd, to,\
|
| 208 |
"Order Pickup Mismatch for " + provider.name,\
|
208 |
"Order Pickup Mismatch for " + provider.name,\
|
| Line 221... |
Line 221... |
| 221 |
|
221 |
|
| 222 |
try:
|
222 |
try:
|
| 223 |
if orders_pending_local_connection:
|
223 |
if orders_pending_local_connection:
|
| 224 |
print "Local Connection Pending Orders:"
|
224 |
print "Local Connection Pending Orders:"
|
| 225 |
print orders_pending_local_connection
|
225 |
print orders_pending_local_connection
|
| 226 |
mismatch_file = "/tmp/LocalConnectionPendingOrders.csv"
|
226 |
mismatch_file = "/tmp/BlueDart_LocalConnectionPendingOrders.csv"
|
| 227 |
print "Some of our Orders were not Shipped to Destination yet. Printing report to:" + mismatch_file
|
227 |
print "Some of our Orders were not Shipped to Destination yet. Printing report to:" + mismatch_file
|
| 228 |
print_undelivered_orders_report(mismatch_file, orders_pending_local_connection)
|
228 |
print_undelivered_orders_report(mismatch_file, orders_pending_local_connection)
|
| 229 |
pickup_mismatch_part = [get_attachment_part(mismatch_file)]
|
229 |
pickup_mismatch_part = [get_attachment_part(mismatch_file)]
|
| 230 |
mail(from_user, from_pwd, to,\
|
230 |
mail(from_user, from_pwd, to,\
|
| 231 |
"Orders that are not Shipped to Destination yet for " + provider.name,\
|
231 |
"Orders that are not Shipped to Destination yet for " + provider.name,\
|
| Line 244... |
Line 244... |
| 244 |
|
244 |
|
| 245 |
try:
|
245 |
try:
|
| 246 |
if returned_orders:
|
246 |
if returned_orders:
|
| 247 |
print "Returned Orders:"
|
247 |
print "Returned Orders:"
|
| 248 |
print returned_orders
|
248 |
print returned_orders
|
| 249 |
returned_orders_file = "/tmp/ReturnedOrders.csv"
|
249 |
returned_orders_file = "/tmp/BlueDart_ReturnedOrders.csv"
|
| 250 |
print "Some of our Orders were returned by logistics provider. Printing report to:" + returned_orders_file
|
250 |
print "Some of our Orders were returned by logistics provider. Printing report to:" + returned_orders_file
|
| 251 |
print_rto_orders_report(returned_orders_file, returned_orders)
|
251 |
print_rto_orders_report(returned_orders_file, returned_orders)
|
| 252 |
returned_orders_report = [get_attachment_part(returned_orders_file)]
|
252 |
returned_orders_report = [get_attachment_part(returned_orders_file)]
|
| 253 |
mail(from_user, from_pwd, to,\
|
253 |
mail(from_user, from_pwd, to,\
|
| 254 |
"Returned Orders Report for " + provider.name,\
|
254 |
"Returned Orders Report for " + provider.name,\
|
| Line 267... |
Line 267... |
| 267 |
|
267 |
|
| 268 |
try:
|
268 |
try:
|
| 269 |
if orders_not_delivered:
|
269 |
if orders_not_delivered:
|
| 270 |
print "Undelivered Orders:"
|
270 |
print "Undelivered Orders:"
|
| 271 |
print orders_not_delivered
|
271 |
print orders_not_delivered
|
| 272 |
mismatch_file = "/tmp/UndeliveredOrders.csv"
|
272 |
mismatch_file = "/tmp/BlueDart_UndeliveredOrders.csv"
|
| 273 |
print "Some of our Orders were not delivered. Printing report to:" + mismatch_file
|
273 |
print "Some of our Orders were not delivered. Printing report to:" + mismatch_file
|
| 274 |
print_undelivered_orders_report(mismatch_file, orders_not_delivered)
|
274 |
print_undelivered_orders_report(mismatch_file, orders_not_delivered)
|
| 275 |
pickup_mismatch_part = [get_attachment_part(mismatch_file)]
|
275 |
pickup_mismatch_part = [get_attachment_part(mismatch_file)]
|
| 276 |
mail(from_user, from_pwd, to,\
|
276 |
mail(from_user, from_pwd, to,\
|
| 277 |
"Orders that are undelivered but picked up or shipped four days ago for " + provider.name,\
|
277 |
"Orders that are undelivered but picked up or shipped four days ago for " + provider.name,\
|
| Line 381... |
Line 381... |
| 381 |
for child in children:
|
381 |
for child in children:
|
| 382 |
child_number = child_number + 1
|
382 |
child_number = child_number + 1
|
| 383 |
nodes = child.findall('Scans/ScanDetail')
|
383 |
nodes = child.findall('Scans/ScanDetail')
|
| 384 |
orderstatus = None
|
384 |
orderstatus = None
|
| 385 |
for element in nodes:
|
385 |
for element in nodes:
|
| 386 |
if element.findtext('ScanType', '') == 'UD' and (getTrimedString(element.findtext('Scan', '')) == getTrimedString('Shipment Inscan') or getTrimedString(element.findtext('Scan', '')) == getTrimedString('Shipment-Autoscan')):
|
386 |
if element.findtext('ScanType', '') == 'UD' and (getTrimedString(element.findtext('Scan', '')) == getTrimedString('Shipment Inscan') or getTrimedString(element.findtext('Scan', '')) == getTrimedString('Shipment-Autoscan')) and element.findtext('ScannedLocation', '') == child.findtext('Destination', ''):
|
| 387 |
datestring = element.findtext('ScanDate', '')
|
387 |
datestring = element.findtext('ScanDate', '')
|
| 388 |
timestring = element.findtext('ScanTime', '')
|
388 |
timestring = element.findtext('ScanTime', '')
|
| 389 |
delivery_date = get_py_datetime(datestring, timestring)
|
389 |
delivery_date = get_py_datetime(datestring, timestring)
|
| 390 |
destination_city_reached_orders[order.airwaybill_no] = str(delivery_date)
|
390 |
destination_city_reached_orders[order.airwaybill_no] = str(delivery_date)
|
| 391 |
orderstatus = 'UD'
|
391 |
orderstatus = 'UD'
|