Subversion Repositories SmartDukaan

Rev

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

Rev 7187 Rev 7256
Line 12... Line 12...
12
from shop2020.logistics.service.impl.DataAccessor import get_empty_AWB, \
12
from shop2020.logistics.service.impl.DataAccessor import get_empty_AWB, \
13
    get_shipment_info, initialize, get_logistics_estimation, get_provider, \
13
    get_shipment_info, initialize, get_logistics_estimation, get_provider, \
14
    get_providers, close_session, get_free_awb_count, get_holidays, is_alive, \
14
    get_providers, close_session, get_free_awb_count, get_holidays, is_alive, \
15
    get_provider_for_pickup_type, get_pickup_store, get_all_pickup_stores, \
15
    get_provider_for_pickup_type, get_pickup_store, get_all_pickup_stores, \
16
    get_pickup_store_by_hotspot_id, get_destination_code, update_pincode, \
16
    get_pickup_store_by_hotspot_id, get_destination_code, update_pincode, \
17
    add_pincode, store_shipment_info
17
    add_pincode, store_shipment_info, adjust_delivery_time
18
from shop2020.thriftpy.logistics.ttypes import LogisticsInfo, \
18
from shop2020.thriftpy.logistics.ttypes import LogisticsInfo, \
19
    LogisticsServiceException, DeliveryType, PickUpType
19
    LogisticsServiceException, DeliveryType, PickUpType
20
from shop2020.thriftpy.model.v1.catalog.ttypes import status
20
from shop2020.thriftpy.model.v1.catalog.ttypes import status
21
import datetime
21
import datetime
22
import math
22
import math
Line 129... Line 129...
129
        try:
129
        try:
130
            return self.get_logistics_estimation_with_type(itemId, destination_pin, type)
130
            return self.get_logistics_estimation_with_type(itemId, destination_pin, type)
131
        finally:
131
        finally:
132
            close_session()
132
            close_session()
133
    
133
    
-
 
134
 
-
 
135
    def getLogisticsEstimationForStore(self, itemId, destination_pin, type):
-
 
136
        """
-
 
137
        Parameters:
-
 
138
         - itemId
-
 
139
         - destination_pin
-
 
140
         - type
-
 
141
        """
-
 
142
        try:
-
 
143
            todate = datetime.datetime.now()
-
 
144
            logistics_info = self.get_logistics_estimation_with_type(itemId, destination_pin, type)
-
 
145
            logistics_info.deliveryTime = adjust_delivery_time(todate, logistics_info.deliveryTime)
-
 
146
            logistics_info.shippingTime = adjust_delivery_time(todate, logistics_info.shippingTime)
-
 
147
            return logistics_info
-
 
148
        finally:
-
 
149
            close_session()
-
 
150
            
134
    def get_logistics_estimation_with_type(self, itemId, destination_pin, type):
151
    def get_logistics_estimation_with_type(self, itemId, destination_pin, type):
135
        try:
152
        try:
136
            #Get the id and location of actual warehouse that'll be used to fulfil this order.
153
            #Get the id and location of actual warehouse that'll be used to fulfil this order.
137
            client = InventoryClient().get_client()
154
            client = InventoryClient().get_client()
138
            fulfilmentWarehouseId, expected_delay, billingWarehouseId, sellingPrice, totalAvailability = client.getItemAvailabilityAtLocation(itemId, self.sourceId)
155
            fulfilmentWarehouseId, expected_delay, billingWarehouseId, sellingPrice, totalAvailability = client.getItemAvailabilityAtLocation(itemId, self.sourceId)