Subversion Repositories SmartDukaan

Rev

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

Rev 669 Rev 675
Line 4... Line 4...
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
7
    LogisticsServiceException
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
10
from shop2020.logistics.service.impl.Converters import to_t_awbupdate,\
11
from shop2020.logistics.service.impl.Converters import to_t_awbupdate,\
11
    to_t_provider
12
    to_t_provider
12
from shop2020.clients.InventoryClient import InventoryClient
13
from shop2020.clients.InventoryClient import InventoryClient
13
from shop2020.config.client.ConfigClient import ConfigClient
14
from shop2020.config.client.ConfigClient import ConfigClient
14
import datetime
15
import datetime
Line 22... Line 23...
22
        self.cutoff_time = int(config_client.get_property('delivery_cutoff_time'))
23
        self.cutoff_time = int(config_client.get_property('delivery_cutoff_time'))
23
        self.stock_threshold = int(config_client.get_property('inventory_stock_threshold'))
24
        self.stock_threshold = int(config_client.get_property('inventory_stock_threshold'))
24
        self.time_to_producre = int(config_client.get_property('inventory_time_to_procure'))
25
        self.time_to_producre = int(config_client.get_property('inventory_time_to_procure'))
25
 
26
 
26
    def getProvider(self, providerId):
27
    def getProvider(self, providerId):
27
      """
28
        """
28
      Returns a provider for a given provider ID. Throws an exception if none found.
29
        Returns a provider for a given provider ID. Throws an exception if none found.
29
      
30
        
30
      Parameters:
31
        Parameters:
31
       - providerId
32
         - providerId
32
      """
33
        """
33
      return to_t_provider(get_provider(providerId))
34
        return to_t_provider(get_provider(providerId))
-
 
35
 
-
 
36
    def getAllProviders(self, ):
-
 
37
        """
-
 
38
        Returns a list containing all the providers.
-
 
39
        """
-
 
40
        return [to_t_provider(provider) for provider in get_providers()]
34
 
41
 
35
    def getLogisticsInfo(self, destination_pincode, itemId):
42
    def getLogisticsInfo(self, destination_pincode, itemId):
36
        """
43
        """
37
        Parameters:
44
        Parameters:
38
         - destination_pincode
45
         - destination_pincode