| Line 16... |
Line 16... |
| 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, adjust_delivery_time, get_min_advance_amount, \
|
17 |
add_pincode, store_shipment_info, adjust_delivery_time, get_min_advance_amount, \
|
| 18 |
add_new_awbs, run_Logistics_Location_Info_Update, \
|
18 |
add_new_awbs, run_Logistics_Location_Info_Update, \
|
| 19 |
get_first_delivery_estimate_for_wh_location, \
|
19 |
get_first_delivery_estimate_for_wh_location, \
|
| 20 |
get_provider_limit_details_for_pincode, get_new_empty_awb, \
|
20 |
get_provider_limit_details_for_pincode, get_new_empty_awb, \
|
| 21 |
get_logistics_locations
|
21 |
get_logistics_locations, get_costing_and_delivery_estimate_for_pincode
|
| 22 |
from shop2020.logistics.service.impl.DataService import \
|
22 |
from shop2020.logistics.service.impl.DataService import \
|
| 23 |
ServiceableLocationDetails
|
23 |
ServiceableLocationDetails
|
| 24 |
from shop2020.thriftpy.logistics.ttypes import ItemText, LogisticsInfo, \
|
24 |
from shop2020.thriftpy.logistics.ttypes import ItemText, LogisticsInfo, \
|
| 25 |
LogisticsServiceException, DeliveryType, PickUpType
|
25 |
LogisticsServiceException, DeliveryType, PickUpType
|
| 26 |
from shop2020.thriftpy.model.v1.catalog.ttypes import status
|
26 |
from shop2020.thriftpy.model.v1.catalog.ttypes import status
|
| Line 413... |
Line 413... |
| 413 |
def getNewEmptyAwb(self, providerId, type, orderQuantity):
|
413 |
def getNewEmptyAwb(self, providerId, type, orderQuantity):
|
| 414 |
try:
|
414 |
try:
|
| 415 |
return get_new_empty_awb(providerId, type, orderQuantity)
|
415 |
return get_new_empty_awb(providerId, type, orderQuantity)
|
| 416 |
finally:
|
416 |
finally:
|
| 417 |
close_session()
|
417 |
close_session()
|
| - |
|
418 |
|
| 418 |
def getLocationInfoMap(self, destinationPin, sellingPriceList):
|
419 |
def getLocationInfoMap(self, destinationPin, sellingPriceList):
|
| 419 |
try:
|
420 |
try:
|
| 420 |
return get_logistics_locations(destinationPin, sellingPriceList)
|
421 |
return get_logistics_locations(destinationPin, sellingPriceList)
|
| 421 |
finally:
|
422 |
finally:
|
| 422 |
close_session()
|
- |
|
| 423 |
|
423 |
close_session()
|
| - |
|
424 |
|
| - |
|
425 |
def getCostingAndDeliveryEstimateForPincode(self, pincode, transactionAmount, isCod, weight, billingWarehouseId):
|
| - |
|
426 |
try:
|
| - |
|
427 |
costingAndDeliveryEstimateObj = get_costing_and_delivery_estimate_for_pincode(pincode, transactionAmount, isCod, weight, billingWarehouseId)
|
| - |
|
428 |
delivery_time = 24 * (costingAndDeliveryEstimateObj.deliveryTime + costingAndDeliveryEstimateObj.delivery_delay)
|
| - |
|
429 |
shipping_delay = 0
|
| - |
|
430 |
|
| - |
|
431 |
#Further increase the estimate if it's late in the day
|
| - |
|
432 |
current_hour = datetime.datetime.now().hour
|
| - |
|
433 |
if not isCod and self.cutoff_time <= current_hour:
|
| - |
|
434 |
shipping_delay = shipping_delay + 24
|
| - |
|
435 |
|
| - |
|
436 |
#In case of COD,increase delay by one more day
|
| - |
|
437 |
if isCod:
|
| - |
|
438 |
shipping_delay = shipping_delay + 24
|
| - |
|
439 |
costingAndDeliveryEstimateObj.otgAvailable = False
|
| - |
|
440 |
|
| - |
|
441 |
delivery_time = delivery_time + shipping_delay
|
| - |
|
442 |
|
| - |
|
443 |
shipping_delay = int(math.ceil(shipping_delay/24.0))
|
| - |
|
444 |
delivery_time = int(math.ceil(delivery_time/24.0))
|
| - |
|
445 |
|
| - |
|
446 |
costingAndDeliveryEstimateObj.deliveryTime = delivery_time
|
| - |
|
447 |
costingAndDeliveryEstimateObj.shippingTime = shipping_delay
|
| - |
|
448 |
return costingAndDeliveryEstimateObj
|
| - |
|
449 |
finally:
|
| - |
|
450 |
close_session()
|
| - |
|
451 |
|
| - |
|
452 |
|
| 424 |
|
453 |
|