Subversion Repositories SmartDukaan

Rev

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

Rev 7256 Rev 7273
Line 20... Line 20...
20
from shop2020.thriftpy.model.v1.catalog.ttypes import status
20
from shop2020.thriftpy.model.v1.catalog.ttypes import status
21
import datetime
21
import datetime
22
import math
22
import math
23
import sys
23
import sys
24
from shop2020.logistics.service.impl.DataService import ServiceableLocationDetails
24
from shop2020.logistics.service.impl.DataService import ServiceableLocationDetails
-
 
25
from shop2020.utils.Utils import to_java_date
25
 
26
 
26
class LogisticsServiceHandler:
27
class LogisticsServiceHandler:
27
    
28
    
28
    def __init__(self, dbname='logistics', db_hostname='localhost'):
29
    def __init__(self, dbname='logistics', db_hostname='localhost'):
29
        initialize(dbname, db_hostname)
30
        initialize(dbname, db_hostname)
Line 140... Line 141...
140
         - type
141
         - type
141
        """
142
        """
142
        try:
143
        try:
143
            todate = datetime.datetime.now()
144
            todate = datetime.datetime.now()
144
            logistics_info = self.get_logistics_estimation_with_type(itemId, destination_pin, type)
145
            logistics_info = self.get_logistics_estimation_with_type(itemId, destination_pin, type)
145
            logistics_info.deliveryTime = adjust_delivery_time(todate, logistics_info.deliveryTime)
146
            logistics_info.deliveryTime = to_java_date(todate +  datetime.timedelta(days = adjust_delivery_time(todate, logistics_info.deliveryTime)))
146
            logistics_info.shippingTime = adjust_delivery_time(todate, logistics_info.shippingTime)
147
            logistics_info.shippingTime = to_java_date(todate +  datetime.timedelta(days = adjust_delivery_time(todate, logistics_info.shippingTime)))
147
            return logistics_info
148
            return logistics_info
148
        finally:
149
        finally:
149
            close_session()
150
            close_session()
150
            
151
            
151
    def get_logistics_estimation_with_type(self, itemId, destination_pin, type):
152
    def get_logistics_estimation_with_type(self, itemId, destination_pin, type):