| Line 10... |
Line 10... |
| 10 |
from shop2020.clients.TransactionClient import TransactionClient
|
10 |
from shop2020.clients.TransactionClient import TransactionClient
|
| 11 |
from shop2020.logistics.service.impl import DataService
|
11 |
from shop2020.logistics.service.impl import DataService
|
| 12 |
from shop2020.logistics.service.impl import BluedartService
|
12 |
from shop2020.logistics.service.impl import BluedartService
|
| 13 |
from shop2020.logistics.service.impl.DataService import Awb, AwbUpdate, Provider, \
|
13 |
from shop2020.logistics.service.impl.DataService import Awb, AwbUpdate, Provider, \
|
| 14 |
DeliveryEstimate, WarehouseAllocation, PublicHolidays, \
|
14 |
DeliveryEstimate, WarehouseAllocation, PublicHolidays, \
|
| 15 |
ServiceableLocationDetails, PickupStore, Locations, ProviderCosting
|
15 |
ServiceableLocationDetails, PickupStore, Locations, ProviderCosting, BluedartAttribute
|
| 16 |
from shop2020.thriftpy.logistics.ttypes import LogisticsServiceException, \
|
16 |
from shop2020.thriftpy.logistics.ttypes import LogisticsServiceException, \
|
| 17 |
DeliveryType, LogisticsLocationInfo, LocationInfo, ProviderInfo, DeliveryEstimateAndCosting
|
17 |
DeliveryType, LogisticsLocationInfo, LocationInfo, ProviderInfo, DeliveryEstimateAndCosting
|
| 18 |
from shop2020.thriftpy.model.v1.inventory.ttypes import Warehouse, BillingType, \
|
18 |
from shop2020.thriftpy.model.v1.inventory.ttypes import Warehouse, BillingType, \
|
| 19 |
WarehouseType
|
19 |
WarehouseType
|
| 20 |
from shop2020.utils.Utils import log_entry, to_py_date, to_java_date
|
20 |
from shop2020.utils.Utils import log_entry, to_py_date, to_java_date
|
| Line 384... |
Line 384... |
| 384 |
def get_empty_AWB(provider_id, logisticsTransactionId):
|
384 |
def get_empty_AWB(provider_id, logisticsTransactionId):
|
| 385 |
try:
|
385 |
try:
|
| 386 |
if logisticsTransactionId is None:
|
386 |
if logisticsTransactionId is None:
|
| 387 |
return ""
|
387 |
return ""
|
| 388 |
if provider_id ==1:
|
388 |
if provider_id ==1:
|
| - |
|
389 |
bluedartAttribute = BluedartAttribute.get_by(logisticsTransactionId=logisticsTransactionId,name="awb")
|
| - |
|
390 |
if bluedartAttribute is None:
|
| 389 |
client = TransactionClient().get_client()
|
391 |
client = TransactionClient().get_client()
|
| 390 |
orders_list = client.getGroupOrdersByLogisticsTxnId(logisticsTransactionId)
|
392 |
orders_list = client.getGroupOrdersByLogisticsTxnId(logisticsTransactionId)
|
| 391 |
return BluedartService.generate_awb(orders_list)
|
393 |
bluedartResponse = BluedartService.generate_awb(orders_list)
|
| - |
|
394 |
bluedartAttribute = BluedartAttribute()
|
| - |
|
395 |
bluedartAttribute.logisticsTransactionId = logisticsTransactionId
|
| - |
|
396 |
bluedartAttribute.name = "awb"
|
| - |
|
397 |
bluedartAttribute.value = bluedartResponse.awbNo
|
| - |
|
398 |
bluedartAttribute_destcode = BluedartAttribute()
|
| - |
|
399 |
bluedartAttribute_destcode.logisticsTransactionId = logisticsTransactionId
|
| - |
|
400 |
bluedartAttribute_destcode.name = "destCode"
|
| - |
|
401 |
bluedartAttribute_destcode.value = bluedartResponse.destArea +"/"+ bluedartResponse.destLocation
|
| - |
|
402 |
session.commit()
|
| - |
|
403 |
return bluedartAttribute.value
|
| 392 |
except:
|
404 |
except:
|
| 393 |
traceback.print_exc()
|
405 |
traceback.print_exc()
|
| 394 |
raise LogisticsServiceException(103, "Unable to get an AWB for the given Provider: " + str(provider_id))
|
406 |
raise LogisticsServiceException(103, "Unable to get an AWB for the given Provider: " + str(provider_id))
|
| 395 |
|
407 |
|
| 396 |
|
408 |
|
| Line 830... |
Line 842... |
| 830 |
delEstCostObj.logisticsCost = costingDetails[0]-costingDetails[1]
|
842 |
delEstCostObj.logisticsCost = costingDetails[0]-costingDetails[1]
|
| 831 |
delEstCostObj.codCollectionCharges = costingDetails[1]
|
843 |
delEstCostObj.codCollectionCharges = costingDetails[1]
|
| 832 |
return delEstCostObj
|
844 |
return delEstCostObj
|
| 833 |
else:
|
845 |
else:
|
| 834 |
continue
|
846 |
continue
|
| 835 |
raise LogisticsServiceException(103, "Unable to get Provider for given pincode: " + str(pincode)+" Amount:- "+str(transactionAmount)+" Weight:- "+ str(weight)+".")
|
- |
|
| 836 |
|
847 |
raise LogisticsServiceException(103, "Unable to get Provider for given pincode: " + str(pincode)+" Amount:- "+str(transactionAmount)+" Weight:- "+ str(weight)+".")
|
| - |
|
848 |
|
| - |
|
849 |
def get_bluedart_attributes_for_logistics_txn_id(logisticsTxnId, name):
|
| - |
|
850 |
bluedartAttr = BluedartAttribute.get_by(logisticsTransactionId=logisticsTxnId,name=name)
|
| - |
|
851 |
if bluedartAttr is None:
|
| - |
|
852 |
raise LogisticsServiceException(103, "Unable to get bluedart attributes for logisticsTxnId "+logisticsTxnId+" and name "+name)
|
| - |
|
853 |
return bluedartAttr
|
| - |
|
854 |
|
| 837 |
|
855 |
|