Subversion Repositories SmartDukaan

Rev

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

Rev 5719 Rev 5767
Line 2... Line 2...
2
Created on 05-Aug-2010
2
Created on 05-Aug-2010
3
 
3
 
4
@author: ashish
4
@author: ashish
5
'''
5
'''
6
from shop2020.thriftpy.logistics.ttypes import LogisticsInfo,\
6
from shop2020.thriftpy.logistics.ttypes import LogisticsInfo,\
7
    LogisticsServiceException, DeliveryType
7
    LogisticsServiceException, DeliveryType, PickUpType
8
from shop2020.logistics.service.impl.DataAccessor import get_empty_AWB,\
8
from shop2020.logistics.service.impl.DataAccessor import get_empty_AWB,\
9
    get_shipment_info, initialize, get_logistics_estimation, get_provider,\
9
    get_shipment_info, initialize, get_logistics_estimation, get_provider,\
10
    get_providers, close_session, get_free_awb_count, get_holidays,\
10
    get_providers, close_session, get_free_awb_count, get_holidays,\
11
    is_alive, get_provider_for_pickup_type, get_pickup_store, get_all_pickup_stores,\
11
    is_alive, get_provider_for_pickup_type, get_pickup_store, get_all_pickup_stores,\
12
    get_pickup_store_by_hotspot_id
12
    get_pickup_store_by_hotspot_id
Line 58... Line 58...
58
        try:
58
        try:
59
            return [to_t_provider(provider) for provider in get_providers()]
59
            return [to_t_provider(provider) for provider in get_providers()]
60
        finally:
60
        finally:
61
            close_session()
61
            close_session()
62
            
62
            
63
    def getLogisticsInfo(self, destination_pincode, itemId, type):
63
    def getLogisticsInfo(self, destination_pincode, itemId, type, pickUp):
64
        """
64
        """
65
        Parameters:
65
        Parameters:
66
         - destination_pincode
66
         - destination_pincode
67
         - item_id
67
         - item_id
68
         - type
68
         - type
69
        """
69
        """
70
        try:
70
        try:
71
            logistics_info = self.get_logistics_estimation_with_type(itemId, destination_pincode, type)
71
            logistics_info = self.get_logistics_estimation_with_type(itemId, destination_pincode, type)
-
 
72
            if pickUp == PickUpType.RUNNER or pickUp == PickUpType.SELF:
-
 
73
                logistics_info.providerId = get_provider_for_pickup_type(pickUp)
72
            logistics_info.airway_billno = get_empty_AWB(logistics_info.providerId, type)
74
            logistics_info.airway_billno = get_empty_AWB(logistics_info.providerId, type)
73
            return logistics_info
75
            return logistics_info
74
        finally:
76
        finally:
75
            close_session()
77
            close_session()
76
            
78