| Line 342... |
Line 342... |
| 342 |
|
342 |
|
| 343 |
order.otg = logistics_info.otgAvailable
|
343 |
order.otg = logistics_info.otgAvailable
|
| 344 |
order.warehouse_id = logistics_info.warehouseId
|
344 |
order.warehouse_id = logistics_info.warehouseId
|
| 345 |
order.fulfilmentWarehouseId = logistics_info.fulfilmentWarehouseId
|
345 |
order.fulfilmentWarehouseId = logistics_info.fulfilmentWarehouseId
|
| 346 |
order.logistics_provider_id = logistics_info.providerId
|
346 |
order.logistics_provider_id = logistics_info.providerId
|
| - |
|
347 |
#Start:- Added by Manish Sharma for FedEx Integration - Shipment Creation on 31-Jul-2013
|
| 347 |
order.airwaybill_no = logistics_info.airway_billno
|
348 |
#order.airwaybill_no = logistics_info.airway_billno
|
| 348 |
order.tracking_id = order.airwaybill_no
|
349 |
#order.tracking_id = order.airwaybill_no
|
| - |
|
350 |
#End:- Added by Manish Sharma for FedEx Integration- Shipment Creation on 31-Jul-2013
|
| - |
|
351 |
|
| 349 |
order.courier_delivery_time = (current_time + datetime.timedelta(days=logistics_info.deliveryDelay)).replace(hour=PREPAID_SHIPPING_CUTOFF_TIME, minute=0, second=0)
|
352 |
order.courier_delivery_time = (current_time + datetime.timedelta(days=logistics_info.deliveryDelay)).replace(hour=PREPAID_SHIPPING_CUTOFF_TIME, minute=0, second=0)
|
| 350 |
order.expected_shipping_time = (current_time + datetime.timedelta(days=logistics_info.shippingTime)).replace(hour=PREPAID_SHIPPING_CUTOFF_TIME, minute=0, second=0)
|
353 |
order.expected_shipping_time = (current_time + datetime.timedelta(days=logistics_info.shippingTime)).replace(hour=PREPAID_SHIPPING_CUTOFF_TIME, minute=0, second=0)
|
| 351 |
order.promised_shipping_time = order.expected_shipping_time
|
354 |
order.promised_shipping_time = order.expected_shipping_time
|
| 352 |
order.expected_delivery_time = (current_time + datetime.timedelta(days=logistics_info.deliveryTime)).replace(hour=PREPAID_SHIPPING_CUTOFF_TIME, minute=0, second=0)
|
355 |
order.expected_delivery_time = (current_time + datetime.timedelta(days=logistics_info.deliveryTime)).replace(hour=PREPAID_SHIPPING_CUTOFF_TIME, minute=0, second=0)
|
| 353 |
order.promised_delivery_time = order.expected_delivery_time
|
356 |
order.promised_delivery_time = order.expected_delivery_time
|
| Line 386... |
Line 389... |
| 386 |
#FIXME line item is only one now. If multiple will come, need to fix.
|
389 |
#FIXME line item is only one now. If multiple will come, need to fix.
|
| 387 |
item_id = order.lineitems[0].item_id
|
390 |
item_id = order.lineitems[0].item_id
|
| 388 |
if order.pickupStoreId:
|
391 |
if order.pickupStoreId:
|
| 389 |
# Need to send prepaid awb number for store pick up orders
|
392 |
# Need to send prepaid awb number for store pick up orders
|
| 390 |
logistics_info = logistics_client.getLogisticsEstimation(item_id, order.customer_pincode, DeliveryType.COD)
|
393 |
logistics_info = logistics_client.getLogisticsEstimation(item_id, order.customer_pincode, DeliveryType.COD)
|
| - |
|
394 |
#//Start:- Added by Manish Sharma for FedEx Integration- Shipment Creation on 31-Jul-2013
|
| 391 |
prepaid_logistics_info = logistics_client.getLogisticsInfo(order.customer_pincode, item_id, DeliveryType.PREPAID, pickUp)
|
395 |
#prepaid_logistics_info = logistics_client.getLogisticsInfo(order.customer_pincode, item_id, DeliveryType.PREPAID, pickUp)
|
| 392 |
logistics_info.airway_billno = prepaid_logistics_info.airway_billno
|
396 |
#logistics_info.airway_billno = prepaid_logistics_info.airway_billno
|
| 393 |
logistics_info.providerId = prepaid_logistics_info.providerId
|
397 |
#logistics_info.providerId = prepaid_logistics_info.providerId
|
| - |
|
398 |
#End:- Added by Manish Sharma for FedEx Integration- Shipment Creation on 31-Jul-2013
|
| 394 |
# Will not provide OTG in pickup store
|
399 |
# Will not provide OTG in pickup store
|
| 395 |
order.otg = False
|
400 |
order.otg = False
|
| 396 |
else:
|
401 |
else:
|
| 397 |
logistics_info = logistics_client.getLogisticsInfo(order.customer_pincode, item_id, DeliveryType.COD, pickUp)
|
402 |
logistics_info = logistics_client.getLogisticsInfo(order.customer_pincode, item_id, DeliveryType.COD, pickUp)
|
| 398 |
order.otg = logistics_info.otgAvailable
|
403 |
order.otg = logistics_info.otgAvailable
|
| Line 403... |
Line 408... |
| 403 |
logistics_info.deliveryDelay = adjust_delivery_time(current_time, (logistics_info.shippingTime+logistics_info.deliveryDelay))
|
408 |
logistics_info.deliveryDelay = adjust_delivery_time(current_time, (logistics_info.shippingTime+logistics_info.deliveryDelay))
|
| 404 |
|
409 |
|
| 405 |
order.warehouse_id = logistics_info.warehouseId
|
410 |
order.warehouse_id = logistics_info.warehouseId
|
| 406 |
order.fulfilmentWarehouseId = logistics_info.fulfilmentWarehouseId
|
411 |
order.fulfilmentWarehouseId = logistics_info.fulfilmentWarehouseId
|
| 407 |
order.logistics_provider_id = logistics_info.providerId
|
412 |
order.logistics_provider_id = logistics_info.providerId
|
| - |
|
413 |
#Start:- Added by Manish Sharma for FedEx Integration- Shipment Creation on 31-Jul-2013
|
| 408 |
order.airwaybill_no = logistics_info.airway_billno
|
414 |
#order.airwaybill_no = logistics_info.airway_billno
|
| 409 |
order.tracking_id = order.airwaybill_no
|
415 |
#order.tracking_id = order.airwaybill_no
|
| - |
|
416 |
#End:- Added by Manish Sharma for FedEx Integration- Shipment Creation on 31-Jul-2013
|
| 410 |
order.courier_delivery_time = (current_time + datetime.timedelta(days=logistics_info.deliveryDelay)).replace(hour=COD_SHIPPING_CUTOFF_TIME, minute=0, second=0)
|
417 |
order.courier_delivery_time = (current_time + datetime.timedelta(days=logistics_info.deliveryDelay)).replace(hour=COD_SHIPPING_CUTOFF_TIME, minute=0, second=0)
|
| 411 |
order.expected_shipping_time = (current_time + datetime.timedelta(days=logistics_info.shippingTime)).replace(hour=COD_SHIPPING_CUTOFF_TIME, minute=0, second=0)
|
418 |
order.expected_shipping_time = (current_time + datetime.timedelta(days=logistics_info.shippingTime)).replace(hour=COD_SHIPPING_CUTOFF_TIME, minute=0, second=0)
|
| 412 |
order.promised_shipping_time = order.expected_shipping_time
|
419 |
order.promised_shipping_time = order.expected_shipping_time
|
| 413 |
order.expected_delivery_time = (current_time + datetime.timedelta(days=logistics_info.deliveryTime)).replace(hour=COD_SHIPPING_CUTOFF_TIME, minute=0, second=0)
|
420 |
order.expected_delivery_time = (current_time + datetime.timedelta(days=logistics_info.deliveryTime)).replace(hour=COD_SHIPPING_CUTOFF_TIME, minute=0, second=0)
|
| 414 |
order.promised_delivery_time = order.expected_delivery_time
|
421 |
order.promised_delivery_time = order.expected_delivery_time
|
| Line 3187... |
Line 3194... |
| 3187 |
|
3194 |
|
| 3188 |
if order.logistics_provider_id == provider_id:
|
3195 |
if order.logistics_provider_id == provider_id:
|
| 3189 |
raise TransactionServiceException(121, "Provider Id entered by you is same as provider assigned to order.")
|
3196 |
raise TransactionServiceException(121, "Provider Id entered by you is same as provider assigned to order.")
|
| 3190 |
|
3197 |
|
| 3191 |
logistics_client = LogisticsClient().get_client()
|
3198 |
logistics_client = LogisticsClient().get_client()
|
| - |
|
3199 |
if provider_id != 7:
|
| 3192 |
awb_number = logistics_client.getEmptyAWB(provider_id, order.cod)
|
3200 |
awb_number = logistics_client.getEmptyAWB(provider_id, order.cod)
|
| 3193 |
order.logistics_provider_id = provider_id
|
3201 |
order.logistics_provider_id = provider_id
|
| - |
|
3202 |
if provider_id != 7:
|
| 3194 |
order.airwaybill_no = awb_number
|
3203 |
order.airwaybill_no = awb_number
|
| 3195 |
order.track_id = awb_number
|
3204 |
order.track_id = awb_number
|
| 3196 |
session.commit()
|
3205 |
session.commit()
|
| 3197 |
|
3206 |
|
| 3198 |
return order
|
3207 |
return order
|
| 3199 |
|
3208 |
|
| 3200 |
def change_product(order_id, item_id):
|
3209 |
def change_product(order_id, item_id):
|
| Line 3440... |
Line 3449... |
| 3440 |
if not logistics_info.codAllowed:
|
3449 |
if not logistics_info.codAllowed:
|
| 3441 |
raise TransactionServiceException(2, 'COD service not available')
|
3450 |
raise TransactionServiceException(2, 'COD service not available')
|
| 3442 |
|
3451 |
|
| 3443 |
if logistics_info.providerId != order.logistics_provider_id:
|
3452 |
if logistics_info.providerId != order.logistics_provider_id:
|
| 3444 |
logistics_info = logistics_client.getLogisticsInfo(address.pin, order.lineitems[0].item_id, type, PickUpType.COURIER)
|
3453 |
logistics_info = logistics_client.getLogisticsInfo(address.pin, order.lineitems[0].item_id, type, PickUpType.COURIER)
|
| - |
|
3454 |
#Start:- Added by Manish Sharma for FedEx Integration- Shipment Creation on 31-Jul-2013
|
| 3445 |
order.tracking_id = logistics_info.airway_billno
|
3455 |
#order.tracking_id = logistics_info.airway_billno
|
| 3446 |
order.airwaybill_no = logistics_info.airway_billno
|
3456 |
#order.airwaybill_no = logistics_info.airway_billno
|
| - |
|
3457 |
if logistics_info.providerId !=7:
|
| - |
|
3458 |
awb_number = logistics_client.getEmptyAWB(logistics_info.providerId, type)
|
| - |
|
3459 |
order.tracking_id = awb_number
|
| - |
|
3460 |
order.airwaybill_no = awb_number
|
| - |
|
3461 |
#End:- Added by Manish Sharma for FedEx Integration- Shipment Creation on 31-Jul-2013
|
| 3447 |
order.logistics_provider_id = logistics_info.providerId
|
3462 |
order.logistics_provider_id = logistics_info.providerId
|
| 3448 |
|
3463 |
|
| 3449 |
order.otg = logistics_info.otgAvailable
|
3464 |
order.otg = logistics_info.otgAvailable
|
| 3450 |
current_time = datetime.datetime.now()
|
3465 |
current_time = datetime.datetime.now()
|
| 3451 |
logistics_info.deliveryTime = adjust_delivery_time(current_time, logistics_info.deliveryTime)
|
3466 |
logistics_info.deliveryTime = adjust_delivery_time(current_time, logistics_info.deliveryTime)
|
| Line 4996... |
Line 5011... |
| 4996 |
if order.cod:
|
5011 |
if order.cod:
|
| 4997 |
if not logistics_info.codAllowed:
|
5012 |
if not logistics_info.codAllowed:
|
| 4998 |
raise TransactionServiceException(2, 'COD service not available')
|
5013 |
raise TransactionServiceException(2, 'COD service not available')
|
| 4999 |
|
5014 |
|
| 5000 |
logistics_info_new = logistics_client.getLogisticsInfo(pin, order.lineitems[0].item_id, type, PickUpType.COURIER)
|
5015 |
logistics_info_new = logistics_client.getLogisticsInfo(pin, order.lineitems[0].item_id, type, PickUpType.COURIER)
|
| - |
|
5016 |
#Start:- Added by Manish Sharma for FedEx Integration- Shipment Creation on 31-Jul-2013
|
| 5001 |
order.tracking_id = logistics_info_new.airway_billno
|
5017 |
#order.tracking_id = logistics_info_new.airway_billno
|
| 5002 |
order.airwaybill_no = logistics_info_new.airway_billno
|
5018 |
#order.airwaybill_no = logistics_info_new.airway_billno
|
| - |
|
5019 |
if logistics_info_new.providerId !=7:
|
| - |
|
5020 |
awb_number = logistics_client.getEmptyAWB(logistics_info_new.providerId, type)
|
| - |
|
5021 |
order.tracking_id = awb_number
|
| - |
|
5022 |
order.airwaybill_no = awb_number
|
| - |
|
5023 |
#End:- Added by Manish Sharma for FedEx Integration- Shipment Creation on 31-Jul-2013
|
| 5003 |
order.logistics_provider_id = logistics_info_new.providerId
|
5024 |
order.logistics_provider_id = logistics_info_new.providerId
|
| 5004 |
current_time = datetime.datetime.now()
|
5025 |
current_time = datetime.datetime.now()
|
| 5005 |
|
5026 |
|
| 5006 |
logistics_info.deliveryTime = adjust_delivery_time(current_time, logistics_info.deliveryTime)
|
5027 |
logistics_info.deliveryTime = adjust_delivery_time(current_time, logistics_info.deliveryTime)
|
| 5007 |
logistics_info.shippingTime = adjust_delivery_time(current_time, logistics_info.shippingTime)
|
5028 |
logistics_info.shippingTime = adjust_delivery_time(current_time, logistics_info.shippingTime)
|
| Line 5900... |
Line 5921... |
| 5900 |
order = Order.get_by(id = orderId)
|
5921 |
order = Order.get_by(id = orderId)
|
| 5901 |
order.freebieItemId = newFreebieItemId
|
5922 |
order.freebieItemId = newFreebieItemId
|
| 5902 |
session.commit()
|
5923 |
session.commit()
|
| 5903 |
return order
|
5924 |
return order
|
| 5904 |
|
5925 |
|
| - |
|
5926 |
#Start:- Added by Manish Sharma for FedEx Integration- Shipment Creation on 31-Jul-2013
|
| - |
|
5927 |
def update_order_AWB(orderId, airwayBillNo):
|
| - |
|
5928 |
order = Order.get_by(id = orderId)
|
| - |
|
5929 |
order.airwaybill_no=airwayBillNo
|
| - |
|
5930 |
order.tracking_id = airwayBillNo
|
| - |
|
5931 |
session.commit()
|
| - |
|
5932 |
return order
|
| - |
|
5933 |
#End:- Added by Manish Sharma for FedEx Integration- Shipment Creation on 31-Jul-2013
|
| - |
|
5934 |
|
| - |
|
5935 |
|
| 5905 |
if __name__ == '__main__':
|
5936 |
if __name__ == '__main__':
|
| 5906 |
print get_orders_by_mobile_number("9650889334")
|
5937 |
print get_orders_by_mobile_number("9650889334")
|
| 5907 |
|
5938 |
|