Subversion Repositories SmartDukaan

Rev

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

Rev 7947 Rev 7981
Line 91... Line 91...
91
    except Exception as ex:
91
    except Exception as ex:
92
        print ex
92
        print ex
93
        raise LogisticsServiceException(103, "No Logistics partner listed for this destination pincode and the primary warehouse")
93
        raise LogisticsServiceException(103, "No Logistics partner listed for this destination pincode and the primary warehouse")
94
 
94
 
95
def __get_logistics_provider_for_destination_pincode(destination_pin, item_selling_price, weight, type, billingWarehouseId):
95
def __get_logistics_provider_for_destination_pincode(destination_pin, item_selling_price, weight, type, billingWarehouseId):
96
#    if billingWarehouseId not in [12,13] and serviceable_location_cache.get(6).has_key(destination_pin):
-
 
97
#        if weight < 480 and serviceable_location_cache.get(3).has_key(destination_pin) and (type == DeliveryType.PREPAID or item_selling_price < 3000):
-
 
98
#            dest_code, exp, iscod, otgAvailable, websiteCodLimit, storeCodLimit, providerPrepaidLimit = serviceable_location_cache.get(3).get(destination_pin)
-
 
99
#            if item_selling_price <= providerPrepaidLimit:
-
 
100
#                iscod = iscod and item_selling_price <= websiteCodLimit
-
 
101
#                otgAvailable = otgAvailable and item_selling_price >= 2000
-
 
102
#                return 3, iscod, otgAvailable
-
 
103
#        else:
-
 
104
#            dest_code, exp, iscod, otgAvailable, websiteCodLimit, storeCodLimit, providerPrepaidLimit = serviceable_location_cache.get(6).get(destination_pin)
-
 
105
#            if item_selling_price <= providerPrepaidLimit:
-
 
106
#                iscod = iscod and item_selling_price <= websiteCodLimit
-
 
107
#                otgAvailable = otgAvailable and item_selling_price >= 2000
-
 
108
#                return 6, iscod, otgAvailable
-
 
109
#            
-
 
110
#    if serviceable_location_cache.get(3).has_key(destination_pin):
-
 
111
#        dest_code, exp, iscod, otgAvailable, websiteCodLimit, storeCodLimit, providerPrepaidLimit = serviceable_location_cache.get(3).get(destination_pin)
-
 
112
#        if item_selling_price <= providerPrepaidLimit:
-
 
113
#            iscod = iscod and item_selling_price <= websiteCodLimit
-
 
114
#            otgAvailable = otgAvailable and item_selling_price >= 2000
-
 
115
#            return 3, iscod, otgAvailable
-
 
116
 
-
 
117
    if billingWarehouseId not in [12,13] and serviceable_location_cache.get(6).has_key(destination_pin):
96
    if billingWarehouseId not in [12,13] and serviceable_location_cache.get(6).has_key(destination_pin):
-
 
97
        if weight < 480 and serviceable_location_cache.get(3).has_key(destination_pin) and (type == DeliveryType.PREPAID or item_selling_price < 3000):
-
 
98
            dest_code, exp, iscod, otgAvailable, websiteCodLimit, storeCodLimit, providerPrepaidLimit = serviceable_location_cache.get(3).get(destination_pin)
-
 
99
            if item_selling_price <= providerPrepaidLimit:
-
 
100
                iscod = iscod and item_selling_price <= websiteCodLimit
-
 
101
                otgAvailable = otgAvailable and item_selling_price >= 2000
-
 
102
                return 3, iscod, otgAvailable
-
 
103
        else:
-
 
104
            dest_code, exp, iscod, otgAvailable, websiteCodLimit, storeCodLimit, providerPrepaidLimit = serviceable_location_cache.get(6).get(destination_pin)
-
 
105
            if item_selling_price <= providerPrepaidLimit:
-
 
106
                iscod = iscod and item_selling_price <= websiteCodLimit
-
 
107
                otgAvailable = otgAvailable and item_selling_price >= 2000
-
 
108
                return 6, iscod, otgAvailable
-
 
109
            
-
 
110
    if serviceable_location_cache.get(3).has_key(destination_pin):
118
        dest_code, exp, iscod, otgAvailable, websiteCodLimit, storeCodLimit, providerPrepaidLimit = serviceable_location_cache.get(6).get(destination_pin)
111
        dest_code, exp, iscod, otgAvailable, websiteCodLimit, storeCodLimit, providerPrepaidLimit = serviceable_location_cache.get(3).get(destination_pin)
119
        if item_selling_price <= providerPrepaidLimit:
112
        if item_selling_price <= providerPrepaidLimit:
120
            iscod = iscod and item_selling_price <= websiteCodLimit
113
            iscod = iscod and item_selling_price <= websiteCodLimit
121
            otgAvailable = otgAvailable and item_selling_price >= 2000
114
            otgAvailable = otgAvailable and item_selling_price >= 2000
122
            return 6, iscod, otgAvailable
115
            return 3, iscod, otgAvailable
123
            
116
 
124
    if serviceable_location_cache.get(1).has_key(destination_pin):
117
    if serviceable_location_cache.get(1).has_key(destination_pin):
125
        dest_code, exp, iscod, otgAvailable, websiteCodLimit, storeCodLimit, providerPrepaidLimit = serviceable_location_cache.get(1).get(destination_pin)
118
        dest_code, exp, iscod, otgAvailable, websiteCodLimit, storeCodLimit, providerPrepaidLimit = serviceable_location_cache.get(1).get(destination_pin)
126
        if item_selling_price <= providerPrepaidLimit:
119
        if item_selling_price <= providerPrepaidLimit:
127
            iscod = iscod and item_selling_price <= websiteCodLimit
120
            iscod = iscod and item_selling_price <= websiteCodLimit
128
            otgAvailable = otgAvailable and item_selling_price >= 2000
121
            otgAvailable = otgAvailable and item_selling_price >= 2000
129
            return 1, iscod, otgAvailable
122
            return 1, iscod, otgAvailable
130
       
123
        
131
    #Start:- Added by Manish Sharma for fedex Integration- Shipment Creation on 31-Jul-2013 
124
    #Start:- Added by Manish Sharma for fedex Integration- Shipment Creation on 31-Jul-2013 
132
    elif serviceable_location_cache.get(7).has_key(destination_pin):
125
    if serviceable_location_cache.get(7).has_key(destination_pin):
133
        dest_code, exp, iscod, otgAvailable, websiteCodLimit, storeCodLimit, providerPrepaidLimit = serviceable_location_cache.get(7).get(destination_pin)
126
        dest_code, exp, iscod, otgAvailable, websiteCodLimit, storeCodLimit, providerPrepaidLimit = serviceable_location_cache.get(7).get(destination_pin)
134
        if item_selling_price <= providerPrepaidLimit:
127
        if item_selling_price <= providerPrepaidLimit:
135
            iscod = iscod and item_selling_price <= websiteCodLimit
128
            iscod = iscod and item_selling_price <= websiteCodLimit
136
            otgAvailable = otgAvailable and item_selling_price >= 2000
129
            otgAvailable = otgAvailable and item_selling_price >= 2000
137
            return 7, iscod, otgAvailable
130
            return 7, iscod, otgAvailable
138
    #End:- Added by Manish Sharma for fedex Integration- Shipment Creation on 31-Jul-2013
131
    #End:- Added by Manish Sharma for fedex Integration- Shipment Creation on 31-Jul-2013
-
 
132
    
139
    else:
133
    else:
140
        return None, False, False    
134
        return None, False, False    
141
 
135
 
142
def get_destination_code(providerId, pinCode):
136
def get_destination_code(providerId, pinCode):
143
    serviceableLocationDetail = ServiceableLocationDetails.query.filter_by(provider_id = providerId, dest_pincode = pinCode).one()
137
    serviceableLocationDetail = ServiceableLocationDetails.query.filter_by(provider_id = providerId, dest_pincode = pinCode).one()