| Line 7... |
Line 7... |
| 7 |
from shop2020.logistics.service.impl import DataService
|
7 |
from shop2020.logistics.service.impl import DataService
|
| 8 |
from shop2020.logistics.service.impl.DataService import Awb, AwbUpdate, Provider, \
|
8 |
from shop2020.logistics.service.impl.DataService import Awb, AwbUpdate, Provider, \
|
| 9 |
DeliveryEstimate, WarehouseAllocation, \
|
9 |
DeliveryEstimate, WarehouseAllocation, \
|
| 10 |
PublicHolidays, ServiceableLocationDetails, PickupStore
|
10 |
PublicHolidays, ServiceableLocationDetails, PickupStore
|
| 11 |
from shop2020.thriftpy.logistics.ttypes import LogisticsServiceException,\
|
11 |
from shop2020.thriftpy.logistics.ttypes import LogisticsServiceException,\
|
| 12 |
DeliveryType
|
12 |
DeliveryType, LogisticsLocationInfo
|
| 13 |
from shop2020.utils.Utils import log_entry, to_py_date, to_java_date
|
13 |
from shop2020.utils.Utils import log_entry, to_py_date, to_java_date
|
| 14 |
from sqlalchemy.sql import or_
|
14 |
from sqlalchemy.sql import or_
|
| 15 |
from elixir import session
|
15 |
from elixir import session
|
| 16 |
import datetime, time
|
16 |
import datetime, time
|
| 17 |
import sys
|
17 |
import sys
|
| Line 298... |
Line 298... |
| 298 |
if providerId == 1:
|
298 |
if providerId == 1:
|
| 299 |
return max(sp.minAdvancePrice, sp.recommendedPrice - storeCodLimit), True
|
299 |
return max(sp.minAdvancePrice, sp.recommendedPrice - storeCodLimit), True
|
| 300 |
else:
|
300 |
else:
|
| 301 |
return sp.recommendedPrice, False
|
301 |
return sp.recommendedPrice, False
|
| 302 |
#Start:- Added by Manish Sharma for Multiple Pincode Updation on 05-Jul-2013
|
302 |
#Start:- Added by Manish Sharma for Multiple Pincode Updation on 05-Jul-2013
|
| 303 |
def get_Serviceable_Location_As_Per_ProviderId_And_Pincode(providerId, pincode):
|
- |
|
| 304 |
serviceableLocationDetails = ServiceableLocationDetails.get_by(provider_id = providerId, dest_pincode = pincode)
|
- |
|
| 305 |
session.commit()
|
- |
|
| 306 |
if serviceableLocationDetails:
|
- |
|
| 307 |
return True
|
- |
|
| 308 |
else:
|
- |
|
| 309 |
return False
|
- |
|
| 310 |
|
303 |
|
| - |
|
304 |
def run_Logistics_Location_Info_Update(logisticsLocationInfoList, runCompleteUpdate):
|
| 311 |
def run_Complete_Update_For_Pincode():
|
305 |
if runCompleteUpdate == True :
|
| 312 |
serviceableLocationDetails = ServiceableLocationDetails.query.all()
|
306 |
serviceableLocationDetails = ServiceableLocationDetails.query.all()
|
| 313 |
for serviceableLocationDetail in serviceableLocationDetails:
|
307 |
for serviceableLocationDetail in serviceableLocationDetails:
|
| 314 |
if serviceableLocationDetail.exp :
|
308 |
if serviceableLocationDetail.exp :
|
| 315 |
serviceableLocationDetail.exp = False
|
309 |
serviceableLocationDetail.exp = False
|
| 316 |
if serviceableLocationDetail.cod :
|
310 |
if serviceableLocationDetail.cod :
|
| 317 |
serviceableLocationDetail.cod = False
|
311 |
serviceableLocationDetail.cod = False
|
| 318 |
if serviceableLocationDetail.otgAvailable :
|
312 |
if serviceableLocationDetail.otgAvailable :
|
| 319 |
serviceableLocationDetail.otgAvailable = False
|
313 |
serviceableLocationDetail.otgAvailable = False
|
| - |
|
314 |
for logisticsLocationInfo in logisticsLocationInfoList:
|
| - |
|
315 |
serviceableLocationDetail = ServiceableLocationDetails.get_by(provider_id = logisticsLocationInfo.providerId, dest_pincode = logisticsLocationInfo.pinCode)
|
| - |
|
316 |
provider = Provider().query.filter_by(id = logisticsLocationInfo.providerId).one()
|
| - |
|
317 |
if serviceableLocationDetail:
|
| - |
|
318 |
serviceableLocationDetail.exp = logisticsLocationInfo.expAvailable
|
| - |
|
319 |
serviceableLocationDetail.cod = logisticsLocationInfo.codAvailable
|
| - |
|
320 |
serviceableLocationDetail.otgAvailable = logisticsLocationInfo.otgAvailable
|
| - |
|
321 |
serviceableLocationDetail.providerCodLimit = logisticsLocationInfo.codLimit
|
| - |
|
322 |
serviceableLocationDetail.providerPrepaidLimit = logisticsLocationInfo.prepaidLimit
|
| - |
|
323 |
serviceableLocationDetail.storeCodLimit = logisticsLocationInfo.codLimit
|
| - |
|
324 |
serviceableLocationDetail.websiteCodLimit = logisticsLocationInfo.codLimit
|
| - |
|
325 |
else:
|
| - |
|
326 |
serviceableLocationDetail= ServiceableLocationDetails()
|
| - |
|
327 |
serviceableLocationDetail.provider = provider
|
| - |
|
328 |
serviceableLocationDetail.dest_pincode = logisticsLocationInfo.pinCode
|
| - |
|
329 |
serviceableLocationDetail.dest_code = logisticsLocationInfo.destinationCode
|
| - |
|
330 |
serviceableLocationDetail.exp = logisticsLocationInfo.expAvailable
|
| - |
|
331 |
serviceableLocationDetail.cod = logisticsLocationInfo.codAvailable
|
| - |
|
332 |
serviceableLocationDetail.station_type = 0
|
| - |
|
333 |
serviceableLocationDetail.otgAvailable = logisticsLocationInfo.otgAvailable
|
| - |
|
334 |
serviceableLocationDetail.providerCodLimit = logisticsLocationInfo.codLimit
|
| - |
|
335 |
serviceableLocationDetail.providerPrepaidLimit = logisticsLocationInfo.prepaidLimit
|
| - |
|
336 |
serviceableLocationDetail.storeCodLimit = logisticsLocationInfo.codLimit
|
| - |
|
337 |
serviceableLocationDetail.websiteCodLimit = logisticsLocationInfo.codLimit
|
| - |
|
338 |
deliveryEstimate = DeliveryEstimate.get_by(provider_id = logisticsLocationInfo.providerId, destination_pin = logisticsLocationInfo.pinCode)
|
| - |
|
339 |
if deliveryEstimate:
|
| - |
|
340 |
deliveryEstimate.warehouse_location= logisticsLocationInfo.warehouseId
|
| - |
|
341 |
deliveryEstimate.delivery_time= logisticsLocationInfo.deliveryTime
|
| - |
|
342 |
deliveryEstimate.delivery_delay= logisticsLocationInfo.delivery_delay
|
| - |
|
343 |
else:
|
| - |
|
344 |
deliveryEstimate = DeliveryEstimate()
|
| - |
|
345 |
deliveryEstimate.destination_pin= logisticsLocationInfo.pinCode
|
| - |
|
346 |
deliveryEstimate.provider = provider
|
| - |
|
347 |
deliveryEstimate.warehouse_location= logisticsLocationInfo.warehouseId
|
| - |
|
348 |
deliveryEstimate.delivery_time= logisticsLocationInfo.deliveryTime
|
| - |
|
349 |
deliveryEstimate.delivery_delay= logisticsLocationInfo.delivery_delay
|
| 320 |
session.commit()
|
350 |
session.commit()
|
| - |
|
351 |
|
| 321 |
#End:- Added by Manish Sharma for Multiple Pincode Updation on 05-Jul-2013
|
352 |
#End:- Added by Manish Sharma for Multiple Pincode Updation on 05-Jul-2013
|
| 322 |
|
353 |
|