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 4... Line 4...
4
@author: ashish
4
@author: ashish
5
'''
5
'''
6
from shop2020.thriftpy.logistics.ttypes import Shipment
6
from shop2020.thriftpy.logistics.ttypes import Shipment
7
from shop2020.logistics.service.impl.DataAccessor import add_empty_AWBs, get_empty_AWB,\
7
from shop2020.logistics.service.impl.DataAccessor import add_empty_AWBs, get_empty_AWB,\
8
    get_provider, get_shipment_info, get_shipments, get_todays_shipments, initialize,\
8
    get_provider, get_shipment_info, get_shipments, get_todays_shipments, initialize,\
9
    get_providers, create_shipment, update_shipment_status
9
    get_providers, create_shipment, update_shipment_status, get_logistics_estimation, add_delivery_estimate
10
from shop2020.logistics.service.impl.Converters import to_t_provider,\
10
from shop2020.logistics.service.impl.Converters import to_t_provider,\
11
    to_t_shipment, to_t_shipmentstatusinfo, to_t_shipmentupdate
11
    to_t_shipment, to_t_shipmentstatusinfo, to_t_shipmentupdate, to_t_itemLogistics
12
 
12
 
13
from shop2020.utils.Utils import log_entry, to_py_date
13
from shop2020.utils.Utils import log_entry, to_py_date
-
 
14
 
14
class LogisticsServiceHandler:
15
class LogisticsServiceHandler:
15
    
16
    
16
    def __init__(self):
17
    def __init__(self):
17
        initialize()
18
        initialize()
18
        
19
        
Line 94... Line 95...
94
        for shipment in shipments:
95
        for shipment in shipments:
95
            if shipment:
96
            if shipment:
96
                ret_shipments.append(to_t_shipment(shipment))
97
                ret_shipments.append(to_t_shipment(shipment))
97
        return ret_shipments
98
        return ret_shipments
98
 
99
 
-
 
100
    def getLogisticsEstimation(self, itemId, destination_pin, provider_id):
-
 
101
        """
-
 
102
        Parameters:
-
 
103
         - itemId
-
 
104
         - destination_pin
-
 
105
        """
-
 
106
        
-
 
107
        delivery_estimate = get_logistics_estimation(itemId, destination_pin, provider_id)
-
 
108
        items_in_inventory = 100
-
 
109
        return to_t_itemLogistics(delivery_estimate, items_in_inventory)
99
 
110
 
-
 
111
    def addDeliveryEstimate(self, warahouse_id, destination_pin, provider_id, delivery_time):
-
 
112
        """
-
 
113
        Parameters:
-
 
114
         - warahouse_id
-
 
115
         - destination_pin
-
 
116
         - provider_id
-
 
117
         - delivery_time
-
 
118
        """
-
 
119
        add_delivery_estimate(warahouse_id, destination_pin, provider_id, delivery_time)
-
 
120
        
100
    def getTodaysShipments(self, warehouse_id, provider_id):
121
    def getTodaysShipments(self, warehouse_id, provider_id):
101
        """
122
        """
102
        Parameters:
123
        Parameters:
103
         - warehouse_id
124
         - warehouse_id
104
         - provider_id
125
         - provider_id
Line 129... Line 150...
129
            shipment.shipment_contents = "iPhone 4G"
150
            shipment.shipment_contents = "iPhone 4G"
130
            shipment.shipment_weight = "300 gms"
151
            shipment.shipment_weight = "300 gms"
131
            shipments.append(shipment)
152
            shipments.append(shipment)
132
            i = i+1
153
            i = i+1
133
        return shipments
154
        return shipments
134
'''
155
        '''
-
 
156
        
135
        
157
        
136
158