| 442 |
rajveer |
1 |
'''
|
|
|
2 |
Created on 13-Sep-2010
|
|
|
3 |
|
|
|
4 |
@author: rajveer
|
|
|
5 |
'''
|
|
|
6 |
|
|
|
7 |
from shop2020.clients.LogisticsClient import LogisticsClient
|
|
|
8 |
from shop2020.thriftpy.logistics.ttypes import *
|
|
|
9 |
import datetime
|
|
|
10 |
|
|
|
11 |
|
|
|
12 |
logistic_client = LogisticsClient()
|
|
|
13 |
|
|
|
14 |
logistic_client.__start__()
|
|
|
15 |
|
|
|
16 |
client = logistic_client.get_client()
|
|
|
17 |
|
| 477 |
rajveer |
18 |
#client.addPincodeWarehouseMapping("332301", 1, "303030")
|
|
|
19 |
|
|
|
20 |
#client.addDeliveryEstimate(1, "332301", 1, 3, 80)
|
|
|
21 |
|
| 494 |
rajveer |
22 |
now = datetime.datetime.now()
|
| 477 |
rajveer |
23 |
|
| 494 |
rajveer |
24 |
test = now.hour
|
|
|
25 |
print test, now.hour
|
|
|
26 |
itemlogistics = client.getLogisticsEstimation(1, "332301", 1)
|
| 472 |
rajveer |
27 |
print itemlogistics.warehouseId
|
|
|
28 |
print itemlogistics.availability
|
|
|
29 |
print itemlogistics.shippingTime
|
| 442 |
rajveer |
30 |
|
| 477 |
rajveer |
31 |
|
|
|
32 |
|
| 442 |
rajveer |
33 |
|
|
|
34 |
|
| 472 |
rajveer |
35 |
"""
|
| 442 |
rajveer |
36 |
numbers = ["129102","121823","138123"]
|
|
|
37 |
provider_id = 1
|
|
|
38 |
|
|
|
39 |
|
|
|
40 |
client.addEmptyAWBs(numbers, provider_id)
|
|
|
41 |
awb = client.getEmptyAWB(provider_id)
|
|
|
42 |
print awb
|
|
|
43 |
|
|
|
44 |
provider = client.getProvider(provider_id)
|
|
|
45 |
print provider.id
|
|
|
46 |
print provider.name
|
|
|
47 |
|
|
|
48 |
providers = []
|
|
|
49 |
providers = client.getProviders()
|
|
|
50 |
for prov in providers:
|
|
|
51 |
print prov.id
|
|
|
52 |
print prov.name
|
|
|
53 |
|
|
|
54 |
|
|
|
55 |
shipment = Shipment()
|
|
|
56 |
shipment.awb = awb
|
|
|
57 |
shipment.destination = "Jaipur"
|
|
|
58 |
shipment.origin = "Delhi"
|
|
|
59 |
shipment.recepient_address = "Malviya Nagar, Delhi"
|
|
|
60 |
shipment.recepient_name = "Rajveer"
|
|
|
61 |
shipment.recepient_phone = "985983524"
|
|
|
62 |
shipment.recepient_pincode = "1727123"
|
|
|
63 |
shipment.shipment_contents = "Mobile Phone"
|
|
|
64 |
shipment.shipment_weight = "10 KGs"
|
|
|
65 |
shipment.warehouse_name = "Noida Warehouse"
|
|
|
66 |
#shipment.timestamp = datetime.datetime.today()
|
|
|
67 |
client.createShipment(shipment)
|
|
|
68 |
|
|
|
69 |
shipment_update = ShipmentUpdate()
|
|
|
70 |
shipment_update.pin = "912313123"
|
|
|
71 |
shipment_update.description = "On Delhi airport"
|
|
|
72 |
#shipment_update.timestamp = datetime.datetime.today()
|
|
|
73 |
client.updateShipmentStatus(awb, shipment_update)
|
|
|
74 |
|
|
|
75 |
|
|
|
76 |
shipment_status_info = client.getShipmentInfo(awb)
|
|
|
77 |
print shipment_status_info.awb
|
|
|
78 |
print shipment_status_info.provider_id
|
|
|
79 |
print shipment_status_info.currentUpdate.pin
|
|
|
80 |
print shipment_status_info.currentUpdate.description
|
|
|
81 |
print shipment_status_info.currentUpdate.timestamp
|
|
|
82 |
|
|
|
83 |
#shipments = client.getShipments(1, datetime.datetime.today(), datetime.datetime.today(), provider_id)
|
|
|
84 |
|
|
|
85 |
shipments = client.getTodaysShipments(1, provider_id)
|
|
|
86 |
|
|
|
87 |
for shipment in shipments:
|
|
|
88 |
print shipment.recepient_address
|
|
|
89 |
print shipment.recepient_name
|
|
|
90 |
print shipment.recepient_pincode
|
|
|
91 |
print shipment.shipment_contents
|
|
|
92 |
print shipment.shipment_weight
|
|
|
93 |
print shipment.warehouse_name
|
|
|
94 |
print shipment.recepient_phone
|
|
|
95 |
print shipment.origin
|
|
|
96 |
print shipment.destination
|
| 472 |
rajveer |
97 |
print shipment.awb
|
|
|
98 |
|
|
|
99 |
"""
|