Merge branch 'jdshop' of https://e.coding.net/rosydev/jx-callback into jdshop
This commit is contained in:
@@ -142,21 +142,26 @@ func (c *BaseScheduler) SelfDeliverDelivering(order *model.GoodsOrder, userName
|
||||
localBill, _ := partner.CurOrderManager.LoadWaybill(order.VendorWaybillID, order.WaybillVendorID)
|
||||
// 获取抖音配送状态
|
||||
tiktokWayBillStatus, _ := partner.GetPurchasePlatformFromVendorID(order.VendorID).OrderLogisticsStatus(order.VendorOrderID)
|
||||
if tiktokWayBillStatus.LogisticsStatus >= tiktokShop.ShipmentStatusReceived {
|
||||
//取消抖音配送转自送
|
||||
err = c.CancelWaybill(localBill, partner.CancelWaybillReasonDYPSCancel, partner.CancelWaybillReasonStrDYPSCancel)
|
||||
partner.CurOrderManager.OnOrderMsg(order, "取消抖音配送,转用门店自配送/三方配送", "抖音骑手已经接单,无法取消")
|
||||
return err
|
||||
} else if tiktokWayBillStatus.LogisticsStatus == -1 { // 先转自送,自送不成功取消平台配送.
|
||||
if err := partner.GetPurchaseOrderHandlerFromVendorID(order.VendorID).SelfDeliverDelivering(order, userName); err != nil {
|
||||
partner.CurOrderManager.OnOrderMsg(order, "抖音转自送,平台无运力", "tiktokWayBillStatus = -1")
|
||||
if tiktokWayBillStatus != nil {
|
||||
if tiktokWayBillStatus.LogisticsStatus >= tiktokShop.ShipmentStatusReceived {
|
||||
//取消抖音配送转自送
|
||||
err = c.CancelWaybill(localBill, partner.CancelWaybillReasonDYPSCancel, partner.CancelWaybillReasonStrDYPSCancel)
|
||||
partner.CurOrderManager.OnOrderMsg(order, "取消抖音配送,转用门店自配送/三方配送", "抖音骑手已经接单,无法取消")
|
||||
return err
|
||||
} else if tiktokWayBillStatus.LogisticsStatus == -1 { // 先转自送,自送不成功取消平台配送.
|
||||
if err := partner.GetPurchaseOrderHandlerFromVendorID(order.VendorID).SelfDeliverDelivering(order, userName); err != nil {
|
||||
partner.CurOrderManager.OnOrderMsg(order, "抖音转自送,平台无运力", "tiktokWayBillStatus = -1")
|
||||
}
|
||||
}
|
||||
} else if err = partner.GetPurchasePlatformFromVendorID(order.VendorID).CancelLogisticsByWmOrderId(order, "", "", order.VendorStoreID, order.VendorOrderID); err != nil {
|
||||
err = c.CancelWaybill(localBill, partner.CancelWaybillReasonDYPSCancel, partner.CancelWaybillReasonStrDYPSCancel)
|
||||
partner.CurOrderManager.OnOrderMsg(order, "取消抖音平台运单错误,无法转自送", err.Error())
|
||||
return err
|
||||
} else {
|
||||
partner.GetPurchasePlatformFromVendorID(order.VendorID).SelfDeliverDelivering(order, "")
|
||||
if err = partner.GetPurchasePlatformFromVendorID(order.VendorID).CancelLogisticsByWmOrderId(order, "", "", order.VendorStoreID, order.VendorOrderID); err != nil {
|
||||
if err = c.CancelWaybill(localBill, partner.CancelWaybillReasonDYPSCancel, partner.CancelWaybillReasonStrDYPSCancel); err != nil {
|
||||
partner.CurOrderManager.OnOrderMsg(order, "取消抖音平台运单错误,无法转自送", err.Error())
|
||||
return err
|
||||
}
|
||||
} else {
|
||||
partner.GetPurchasePlatformFromVendorID(order.VendorID).SelfDeliverDelivering(order, "")
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if err := partner.GetPurchaseOrderHandlerFromVendorID(order.VendorID).SelfDeliverDelivering(order, userName); err != nil && (err != scheduler.ErrOrderStatusAlreadySatisfyCurOperation) {
|
||||
|
||||
@@ -152,11 +152,17 @@ func (c *PurchaseHandler) onAfsOrderMsg(msg *mtwmapi.CallbackMsg) (retVal *mtwma
|
||||
if err := partner.CurOrderManager.OnAfsOrderStatusChanged(orderStatus); err == nil {
|
||||
// 订单回调全额退款接口时,将订单状态修改为取消
|
||||
refundData := msg.Data.(*mtwmapi.CallbackRefundInfo)
|
||||
if refundData.NotifyType == "agree" && msg.Cmd == mtwmapi.MsgTypeOrderRefund {
|
||||
if refundData.NotifyType == mtwmapi.MsgTypeOrderAgree && msg.Cmd == mtwmapi.MsgTypeOrderRefund {
|
||||
order, _ := partner.CurOrderManager.LoadOrder(orderStatus.RefVendorOrderID, model.VendorIDMTWM)
|
||||
order.Status = model.OrderStatusCanceled
|
||||
dao.UpdateEntity(dao.GetDB(), order, "Status")
|
||||
}
|
||||
|
||||
// 新订单平台自动同意退单,某一些情况下产生的运单没退!这个处理一下!
|
||||
//if refundData.NotifyType == mtwmapi.MsgTypeOrderAgree && (msg.Cmd == mtwmapi.MsgTypeOrderRefund || msg.Cmd == mtwmapi.MsgTypeOrderAgree) {
|
||||
// partner.CurOrderManager.+
|
||||
// defsch.FixedScheduler.CancelAll3rdWaybills(jxcontext.AdminCtx, orderStatus.RefVendorOrderID, orderStatus.VendorID, true)
|
||||
//}
|
||||
}
|
||||
}
|
||||
return mtwmapi.Err2CallbackResponse(err, "")
|
||||
|
||||
@@ -984,15 +984,15 @@ func (c *PurchaseHandler) CancelLogisticsByWmOrderId(order *model.GoodsOrder, re
|
||||
}
|
||||
|
||||
// OrderLogisticsStatus 获取订单配送状态
|
||||
func (c *PurchaseHandler) OrderLogisticsStatus(orderId string) (*utils.RiderInfo, error) {
|
||||
func (c *PurchaseHandler) OrderLogisticsStatus(orderId string) (data *utils.RiderInfo, err error) {
|
||||
orderInfo, err := dao.GetSimpleOrder(dao.GetDB(), orderId)
|
||||
if err != nil {
|
||||
return nil, errors.New("获取本地门店账号信息失败,请重试")
|
||||
return data, errors.New("获取本地门店账号信息失败,请重试")
|
||||
}
|
||||
|
||||
waybill, err := getAPI(orderInfo.VendorOrgCode, 0, "").GetShipmentInfo(utils.Str2Int64(orderInfo.VendorOrderID), 0, tiktokShop.ShipmentTypeInvoice)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
return data, err
|
||||
}
|
||||
|
||||
result := &utils.RiderInfo{
|
||||
|
||||
Reference in New Issue
Block a user