Subversion Repositories SmartDukaan

Rev

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

Rev 1687 Rev 1730
Line 5... Line 5...
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, close_session, get_free_awb_count
10
    get_providers, close_session, get_free_awb_count, get_holidays
11
from shop2020.logistics.service.impl.Converters import to_t_awbupdate,\
11
from shop2020.logistics.service.impl.Converters import to_t_awbupdate,\
12
    to_t_provider
12
    to_t_provider
13
from shop2020.clients.InventoryClient import InventoryClient
13
from shop2020.clients.InventoryClient import InventoryClient
14
from shop2020.config.client.ConfigClient import ConfigClient
14
from shop2020.config.client.ConfigClient import ConfigClient
15
import datetime
15
import datetime
16
import math
16
import math
17
import sys
17
import sys
18
from shop2020.logistics.service.impl.DataService import ServiceableLocationDetails
18
from shop2020.logistics.service.impl.DataService import ServiceableLocationDetails,\
-
 
19
    PublicHolidays
19
 
20
 
20
class LogisticsServiceHandler:
21
class LogisticsServiceHandler:
21
    
22
    
22
    def __init__(self, dbname='logistics'):
23
    def __init__(self, dbname='logistics'):
23
        initialize(dbname)
24
        initialize(dbname)
Line 162... Line 163...
162
        """
163
        """
163
        try:
164
        try:
164
            return get_free_awb_count(providerId)
165
            return get_free_awb_count(providerId)
165
        finally:
166
        finally:
166
            close_session()
167
            close_session()
-
 
168
 
-
 
169
    def getHolidays(self, fromDate, toDate):
-
 
170
        """
-
 
171
        Returns list of Holiday dates between fromDate and toDate (both inclusive)
-
 
172
        fromDate should be passed as milliseconds corresponding to the start of the day.
-
 
173
        If fromDate is passed as -1, fromDate is not considered for filtering
-
 
174
        If toDate is passed as -1, toDate is not considered for filtering
-
 
175
        
-
 
176
        Parameters:
-
 
177
         - fromDate
-
 
178
         - toDate
-
 
179
        """
-
 
180
        try:
-
 
181
            return get_holidays(fromDate, toDate)
-
 
182
        finally:
-
 
183
            close_session()
167
        
184
        
168
    def closeSession(self, ):
185
    def closeSession(self, ):
169
        close_session()
186
        close_session()