| Line 19... |
Line 19... |
| 19 |
warehouses[0] = 'YusufSarai'
|
19 |
warehouses[0] = 'YusufSarai'
|
| 20 |
warehouses[3] = 'Gurgaon'
|
20 |
warehouses[3] = 'Gurgaon'
|
| 21 |
warehouses[4] = 'Ghaziabad'
|
21 |
warehouses[4] = 'Ghaziabad'
|
| 22 |
warehouses[7] = 'Mahipalpur'
|
22 |
warehouses[7] = 'Mahipalpur'
|
| 23 |
|
23 |
|
| - |
|
24 |
to_addresses = {}
|
| 24 |
to_addresses = ["ajays@bluedart.com","samns@bluedart.com","shambhum@bluedart.com","mukesh.exchnet@bluedart.com",
|
25 |
to_addresses[1] = ["ajays@bluedart.com","samns@bluedart.com","shambhum@bluedart.com","mukesh.exchnet@bluedart.com",
|
| 25 |
"sanjeevy.exchnet@bluedart.com","Satishkkumar.EXCHNET@bluedart.com","SarbjitS@bluedart.com",
|
26 |
"sanjeevy.exchnet@bluedart.com","Satishkkumar.EXCHNET@bluedart.com","SarbjitS@bluedart.com",
|
| 26 |
"ShahnawazM.EXCHNET@bluedart.com","smanoj@bluedart.com","kNarendra.EXCHNET@bluedart.com",
|
27 |
"ShahnawazM.EXCHNET@bluedart.com","smanoj@bluedart.com","kNarendra.EXCHNET@bluedart.com",
|
| 27 |
"BittooN.EXCHNET@bluedart.com","AmitT.EXCHNET@bluedart.com","sandeep.sachdeva@shop2020.in"]
|
28 |
"BittooN.EXCHNET@bluedart.com","AmitT.EXCHNET@bluedart.com","sandeep.sachdeva@shop2020.in","manoj.kumar@shop2020.in"]
|
| - |
|
29 |
to_addresses[3] = ["dispatch@delhivery.com", "bhavesh.manglani@delhivery.com", "milind.sharma@delhivery.com",
|
| - |
|
30 |
"divya.jyoti@delhivery.com","sandeep.sachdeva@shop2020.in","manoj.kumar@shop2020.in"]
|
| 28 |
from_user = "cnc.center@shop2020.in"
|
31 |
from_user = "cnc.center@shop2020.in"
|
| 29 |
from_pwd = "5h0p2o2o"
|
32 |
from_pwd = "5h0p2o2o"
|
| 30 |
|
33 |
|
| - |
|
34 |
def send_report(providerId):
|
| - |
|
35 |
filenames = []
|
| 31 |
def send_report(warehouseId, warehouseName, providerId, isCod):
|
36 |
for warehouseId in warehouses.keys():
|
| 32 |
today = datetime.date.today()
|
37 |
today = datetime.date.today()
|
| 33 |
datestr = str(today.year) + "-" + str(today.month) + "-" + str(today.day)
|
38 |
datestr = str(today.year) + "-" + str(today.month) + "-" + str(today.day)
|
| 34 |
filename = "/CourierDetailReports/courier-details-"
|
- |
|
| 35 |
if isCod:
|
39 |
|
| 36 |
subject = "Saholic: COD Soft Data - " + warehouseName + " - Date:" + datestr
|
40 |
subject = "Saholic: Soft Data - All Warehouses - Date:" + datestr
|
| 37 |
text = "Find attached file for COD data"
|
41 |
text = "Find attached file for All Warehouses pickup data"
|
| - |
|
42 |
|
| - |
|
43 |
filename = "/CourierDetailReports/courier-details-" + "cod" + "-" + str(warehouseId) + "-" + str(providerId) + "-" + datestr + ".xls";
|
| - |
|
44 |
print filename
|
| - |
|
45 |
if os.path.exists(filename):
|
| 38 |
filename = filename + "cod"
|
46 |
filenames.append(filename)
|
| 39 |
else:
|
47 |
|
| 40 |
subject = "Saholic: Prepaid Soft Data - " + warehouseName + " - Date:" + datestr
|
48 |
filename = "/CourierDetailReports/courier-details-" + "prepaid" + "-" + str(warehouseId) + "-" + str(providerId) + "-" + datestr + ".xls";
|
| - |
|
49 |
print filename
|
| 41 |
text = "Find attached file for Prepaid data"
|
50 |
if os.path.exists(filename):
|
| 42 |
filename = filename + "prepaid"
|
51 |
filenames.append(filename)
|
| - |
|
52 |
mail(from_user, from_pwd, to_addresses[providerId], subject, text, [get_attachment_part(filename) for filename in filenames])
|
| 43 |
|
53 |
|
| 44 |
|
54 |
|
| 45 |
filename = filename + "-" + str(warehouseId) + "-" + str(providerId) + "-" + datestr + ".xls";
|
- |
|
| 46 |
|
- |
|
| 47 |
print filename
|
- |
|
| 48 |
if os.path.exists(filename):
|
- |
|
| 49 |
mail(from_user, from_pwd, to_addresses, subject, text, [get_attachment_part(filename)])
|
- |
|
| 50 |
|
- |
|
| 51 |
|
- |
|
| 52 |
def main():
|
55 |
def main():
|
| 53 |
'''
|
56 |
'''
|
| 54 |
parser = optparse.OptionParser()
|
57 |
parser = optparse.OptionParser()
|
| 55 |
parser.add_option("-p", "--provider", dest="provider",
|
58 |
parser.add_option("-p", "--provider", dest="provider",
|
| 56 |
default="1", type="int",
|
59 |
default="1", type="int",
|
| Line 68... |
Line 71... |
| 68 |
if len(args) != 0:
|
71 |
if len(args) != 0:
|
| 69 |
parser.error("You've supplied extra arguments. Are you sure you want to run this program?")
|
72 |
parser.error("You've supplied extra arguments. Are you sure you want to run this program?")
|
| 70 |
'''
|
73 |
'''
|
| 71 |
|
74 |
|
| 72 |
|
75 |
|
| 73 |
for i in warehouses.keys():
|
76 |
for i in (1,3):
|
| 74 |
send_report(i, warehouses.get(i), 1, True)
|
77 |
send_report(i)
|
| 75 |
send_report(i, warehouses.get(i), 1, False)
|
- |
|
| 76 |
|
78 |
|
| 77 |
if __name__ == '__main__':
|
79 |
if __name__ == '__main__':
|
| 78 |
main()
|
80 |
main()
|
| 79 |
|
81 |
|