Subversion Repositories SmartDukaan

Rev

Rev 442 | Rev 477 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 442 Rev 472
Line 1... Line 1...
1
from shop2020.thriftpy.logistics.ttypes import Provider as TProvider,\
1
from shop2020.thriftpy.logistics.ttypes import Provider as TProvider,\
2
    ShipmentUpdate as TShipmentUpdate, ShipmentStatusInfo as TShipmentStatusInfo,\
2
    ShipmentUpdate as TShipmentUpdate, ShipmentStatusInfo as TShipmentStatusInfo,\
3
    Shipment as TShipment
3
    Shipment as TShipment, ItemLogistics as TItemLogistics
4
from shop2020.logistics.service.impl.DataService import Shipment
4
from shop2020.logistics.service.impl.DataService import Shipment
5
from shop2020.utils.Utils import to_java_date
5
from shop2020.utils.Utils import to_java_date
6
 
6
 
7
 
7
 
8
def to_t_provider(provider):
8
def to_t_provider(provider):
Line 35... Line 35...
35
    
35
    
36
    t_shipment_status.updates = ret_updates
36
    t_shipment_status.updates = ret_updates
37
    
37
    
38
    t_shipment_status.awb = "129102"
38
    t_shipment_status.awb = "129102"
39
    t_shipment_status.provider_id = 1 
39
    t_shipment_status.provider_id = 1 
40
    t_shipment_status.currentUpdate = to_t_shipmentupdate(update)  #last update is added right nuw
40
    t_shipment_status.currentUpdate = to_t_shipmentupdate(update)  #last update is added right now
41
    return t_shipment_status
41
    return t_shipment_status
42
        
42
        
43
def to_t_shipmentupdate(update):
43
def to_t_shipmentupdate(update):
44
    t_update = TShipmentUpdate()
44
    t_update = TShipmentUpdate()
45
    t_update.pin =  update.pin 
45
    t_update.pin =  update.pin 
46
    t_update.description = update.description
46
    t_update.description = update.description
47
    t_update.timestamp = to_java_date(update.timestamp)
47
    t_update.timestamp = to_java_date(update.timestamp)
48
    return t_update
-
 
49
48
    return t_update
-
 
49
 
-
 
50
def to_t_itemLogistics(delivery_estimate, items_in_inventory):
-
 
51
    t_item_logistics = TItemLogistics()
-
 
52
    t_item_logistics.warehouseId = delivery_estimate.warehouse_id
-
 
53
    t_item_logistics.availability = items_in_inventory 
-
 
54
    t_item_logistics.shippingTime = delivery_estimate.delivery_time
-
 
55
    return t_item_logistics
-
 
56
50
57