| Line 7... |
Line 7... |
| 7 |
from shop2020.clients.InventoryClient import InventoryClient
|
7 |
from shop2020.clients.InventoryClient import InventoryClient
|
| 8 |
from shop2020.config.client.ConfigClient import ConfigClient
|
8 |
from shop2020.config.client.ConfigClient import ConfigClient
|
| 9 |
from shop2020.logistics.service.impl import DataAccessor
|
9 |
from shop2020.logistics.service.impl import DataAccessor
|
| 10 |
from shop2020.logistics.service.impl.Converters import to_t_awbupdate, \
|
10 |
from shop2020.logistics.service.impl.Converters import to_t_awbupdate, \
|
| 11 |
to_t_provider, to_t_pickup_store
|
11 |
to_t_provider, to_t_pickup_store
|
| 12 |
#Start:- Added by Manish Sharma for Multiple Pincode Updation on 05-Jul-2013
|
- |
|
| 13 |
from shop2020.logistics.service.impl.DataAccessor import get_empty_AWB, \
|
12 |
from shop2020.logistics.service.impl.DataAccessor import get_empty_AWB, \
|
| 14 |
get_shipment_info, initialize, get_logistics_estimation, get_provider, \
|
13 |
get_shipment_info, initialize, get_logistics_estimation, get_provider, \
|
| 15 |
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, \
|
| 16 |
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, \
|
| 17 |
get_pickup_store_by_hotspot_id, get_destination_code, update_pincode, \
|
16 |
get_pickup_store_by_hotspot_id, get_destination_code, update_pincode, \
|
| 18 |
add_pincode, store_shipment_info, adjust_delivery_time,\
|
17 |
add_pincode, store_shipment_info, adjust_delivery_time, get_min_advance_amount, \
|
| 19 |
get_min_advance_amount, add_new_awbs, run_Logistics_Location_Info_Update
|
18 |
add_new_awbs, run_Logistics_Location_Info_Update
|
| 20 |
#End:- Added by Manish Sharma for Multiple Pincode Updation on 05-Jul-2013
|
19 |
from shop2020.logistics.service.impl.DataService import \
|
| - |
|
20 |
ServiceableLocationDetails
|
| 21 |
from shop2020.thriftpy.logistics.ttypes import LogisticsInfo, \
|
21 |
from shop2020.thriftpy.logistics.ttypes import LogisticsInfo, \
|
| 22 |
LogisticsServiceException, DeliveryType, PickUpType
|
22 |
LogisticsServiceException, DeliveryType, PickUpType
|
| 23 |
from shop2020.thriftpy.model.v1.catalog.ttypes import status
|
23 |
from shop2020.thriftpy.model.v1.catalog.ttypes import status
|
| - |
|
24 |
from shop2020.thriftpy.logistics.ttypes import ItemText
|
| - |
|
25 |
from shop2020.utils.Utils import to_java_date, to_py_date
|
| - |
|
26 |
import collections
|
| 24 |
import datetime
|
27 |
import datetime
|
| 25 |
import math
|
28 |
import math
|
| 26 |
import sys
|
29 |
import sys
|
| 27 |
from shop2020.logistics.service.impl.DataService import ServiceableLocationDetails
|
30 |
#Start:- Added by Manish Sharma for Multiple Pincode Updation on 05-Jul-2013
|
| 28 |
from shop2020.utils.Utils import to_java_date, to_py_date
|
31 |
#End:- Added by Manish Sharma for Multiple Pincode Updation on 05-Jul-2013
|
| 29 |
|
32 |
|
| 30 |
class LogisticsServiceHandler:
|
33 |
class LogisticsServiceHandler:
|
| 31 |
|
34 |
|
| 32 |
def __init__(self, dbname='logistics', db_hostname='localhost'):
|
35 |
def __init__(self, dbname='logistics', db_hostname='localhost'):
|
| 33 |
initialize(dbname, db_hostname)
|
36 |
initialize(dbname, db_hostname)
|
| Line 316... |
Line 319... |
| 316 |
estimateList = []
|
319 |
estimateList = []
|
| 317 |
|
320 |
|
| 318 |
for item in items:
|
321 |
for item in items:
|
| 319 |
estimationInfo = self.get_logistics_estimation_with_type(item.id, destination_pin, type)
|
322 |
estimationInfo = self.get_logistics_estimation_with_type(item.id, destination_pin, type)
|
| 320 |
if item.itemStatus == status.ACTIVE:
|
323 |
if item.itemStatus == status.ACTIVE:
|
| 321 |
estimateList.append((0, estimationInfo.deliveryTime, item.id))
|
324 |
estimateList.append((0, estimationInfo.deliveryTime, "BUY NOW", item.id))
|
| 322 |
elif item.itemStatus == status.PAUSED:
|
325 |
elif item.itemStatus == status.PAUSED:
|
| 323 |
estimateList.append((1, estimationInfo.deliveryTime, item.id))
|
326 |
estimateList.append((1, estimationInfo.deliveryTime, "NOTIFY ME", item.id))
|
| 324 |
elif item.itemStatus == status.PAUSED_BY_RISK:
|
327 |
elif item.itemStatus == status.PAUSED_BY_RISK:
|
| 325 |
estimateList.append((2, estimationInfo.deliveryTime, item.id))
|
328 |
estimateList.append((2, estimationInfo.deliveryTime, "NOTIFY ME", item.id))
|
| 326 |
elif item.itemStatus == status.COMING_SOON:
|
329 |
elif item.itemStatus == status.COMING_SOON:
|
| 327 |
estimateList.append((3, estimationInfo.deliveryTime, item.id))
|
330 |
estimateList.append((3, estimationInfo.deliveryTime, "COMING SOON", item.id))
|
| 328 |
|
331 |
|
| 329 |
estimateList.sort()
|
332 |
estimateList.sort()
|
| 330 |
try:
|
333 |
try:
|
| 331 |
return [estimate[-1] for estimate in estimateList]
|
334 |
return [ ItemText(estimate[-1], estimate[-2]) for estimate in estimateList]
|
| 332 |
finally:
|
335 |
finally:
|
| 333 |
close_session()
|
336 |
close_session()
|
| 334 |
|
337 |
|
| 335 |
def getAllPickupStores(self):
|
338 |
def getAllPickupStores(self):
|
| 336 |
try:
|
339 |
try:
|