| Line 7... |
Line 7... |
| 7 |
from shop2020.config.client.ConfigClient import ConfigClient
|
7 |
from shop2020.config.client.ConfigClient import ConfigClient
|
| 8 |
|
8 |
|
| 9 |
|
9 |
|
| 10 |
config_client = ConfigClient()
|
10 |
config_client = ConfigClient()
|
| 11 |
host = config_client.get_property('transaction_service_db_hostname')
|
11 |
host = config_client.get_property('transaction_service_db_hostname')
|
| - |
|
12 |
print "Selecting host: ",host
|
| 12 |
DataService.initialize(db_hostname=host)
|
13 |
DataService.initialize(db_hostname=host)
|
| 13 |
directory = "/tmp/amazon.xls"
|
14 |
directory = "/tmp/Amazon-shipping.xls"
|
| 14 |
amazonOrder = [[]]
|
15 |
amazonOrder = [[]]
|
| 15 |
sheet = xlrd.open_workbook(directory)
|
16 |
sheet = xlrd.open_workbook(directory)
|
| 16 |
sh = sheet.sheet_by_index(0)
|
17 |
sh = sheet.sheet_by_index(0)
|
| - |
|
18 |
def get_seconds(t_delta):
|
| - |
|
19 |
return ((t_delta.microseconds + (t_delta.seconds + t_delta.days * 24 * 3600) * 10**6) / 10**6)
|
| 17 |
for i in range (0,sh.nrows):
|
20 |
for i in range (0,sh.nrows):
|
| 18 |
amazonOrder.append([sh.cell_value(i,0),sh.cell_value(i,1),sh.cell_value(i,2)])
|
21 |
amazonOrder.append([sh.cell_value(i,0),sh.cell_value(i,1),sh.cell_value(i,2)])
|
| 19 |
for row in amazonOrder:
|
22 |
for row in amazonOrder:
|
| 20 |
if not len(row) == 0:
|
23 |
if not len(row) == 0:
|
| 21 |
amazonOrderCode = row[0]
|
24 |
amazonOrderCode = row[0]
|
| Line 65... |
Line 68... |
| 65 |
print "New Promised Delivery Time : ",newPromisedDeliveryTime
|
68 |
print "New Promised Delivery Time : ",newPromisedDeliveryTime
|
| 66 |
print "New Expected Shipping Time : ",newExpectedShippingTime
|
69 |
print "New Expected Shipping Time : ",newExpectedShippingTime
|
| 67 |
print "New Promised Shipping Time : ",newPromisedShippingTime
|
70 |
print "New Promised Shipping Time : ",newPromisedShippingTime
|
| 68 |
|
71 |
|
| 69 |
client = TransactionClient().get_client()
|
72 |
client = TransactionClient().get_client()
|
| 70 |
client.updateTimestampForAmazonOrder(order.orderId, ((newExpectedDeliveryTime-datetime(1970,1,1))-timedelta(hours = 5,minutes=30)).total_seconds(), ((newPromisedDeliveryTime-datetime(1970,1,1))-timedelta(hours = 5,minutes=30)).total_seconds(), ((newExpectedShippingTime-datetime(1970,1,1))-timedelta(hours = 5,minutes=30)).total_seconds(), ((newPromisedShippingTime-datetime(1970,1,1))-timedelta(hours = 5,minutes=30)).total_seconds())
|
73 |
client.updateTimestampForAmazonOrder(order.orderId, get_seconds((newExpectedDeliveryTime-datetime(1970,1,1))-timedelta(hours = 5,minutes=30)), get_seconds((newPromisedDeliveryTime-datetime(1970,1,1))-timedelta(hours = 5,minutes=30)), get_seconds((newExpectedShippingTime-datetime(1970,1,1))-timedelta(hours = 5,minutes=30)), get_seconds((newPromisedShippingTime-datetime(1970,1,1))-timedelta(hours = 5,minutes=30)))
|
| - |
|
74 |
|
| 71 |
|
75 |
|
| 72 |
|
76 |
|
| 73 |
|
77 |
|
| 74 |
|
78 |
|
| 75 |
|
79 |
|
| 76 |
|
- |
|
| 77 |
|
80 |
|
| - |
|
81 |
|