京东订单转移
This commit is contained in:
@@ -1176,6 +1176,7 @@ func TransferJdsOrder(ctx *jxcontext.Context, vendorOrderID string, storeID int)
|
||||
func SendJdwlForJdsOrder(ctx *jxcontext.Context, vendorOrderID string) (err error) {
|
||||
order, err := partner.CurOrderManager.LoadOrder(vendorOrderID, model.VendorIDJDShop)
|
||||
handler := partner.DeliveryPlatformHandlers[model.VendorIDJDWL]
|
||||
_, err = handler.Handler.CreateWaybill(order, 0)
|
||||
waybill, err := handler.Handler.CreateWaybill(order, 0)
|
||||
jdshop.CurPurchaseHandler.OrderTransfer(ctx, vendorOrderID, waybill.VendorWaybillID, false)
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -538,9 +538,9 @@ func (s *DefScheduler) OnWaybillStatusChanged(bill *model.Waybill, isPending boo
|
||||
}
|
||||
s.updateOrderByBill(order, bill, false)
|
||||
s.cancelOtherWaybillsCheckOrderDeliveryFlag(savedOrderInfo, bill, partner.CancelWaybillReasonNotAcceptIntime, partner.CancelWaybillReasonStrNotAcceptIntime)
|
||||
//京东商城的话,需要去把订单出库
|
||||
//京东商城的话,需要去把订单出库,如果是转移过的订单,则需要修改转移订单号
|
||||
if order.VendorID == model.VendorIDJDShop {
|
||||
err = jdshop.CurPurchaseHandler.OrderExport(jxcontext.AdminCtx, bill.VendorOrderID, bill.VendorWaybillID, true)
|
||||
s.solutionJdsOrder(bill)
|
||||
}
|
||||
if model.IsWaybillPlatformOwn(bill) {
|
||||
if bill.Status == model.WaybillStatusDelivering && order.Status < model.OrderStatusEndBegin {
|
||||
@@ -756,6 +756,18 @@ func (s *DefScheduler) cancelOtherWaybillsCheckOrderDeliveryFlag(savedOrderInfo
|
||||
return err
|
||||
}
|
||||
|
||||
func (s *DefScheduler) solutionJdsOrder(bill *model.Waybill) (err error) {
|
||||
//表示此订单是京东商城转移的订单,不用出库,但要去修改运单号
|
||||
if len(bill.VendorOrderID) > 12 {
|
||||
if utils.Str2Int(bill.VendorOrderID[12:len(bill.VendorOrderID)]) > 1 {
|
||||
err = jdshop.CurPurchaseHandler.OrderTransfer(jxcontext.AdminCtx, bill.VendorOrderID, bill.VendorWaybillID, true)
|
||||
} else {
|
||||
err = jdshop.CurPurchaseHandler.OrderExport(jxcontext.AdminCtx, bill.VendorOrderID, bill.VendorWaybillID, true)
|
||||
}
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
func (s *DefScheduler) cancelOtherWaybills(savedOrderInfo *WatchOrderInfo, bill2Keep *model.Waybill, cancelReasonID int, cancelReason string) (err error) {
|
||||
globals.SugarLogger.Debugf("cancelOtherWaybills, orderID:%s, bill:%v", savedOrderInfo.order.VendorOrderID, bill2Keep)
|
||||
for _, v := range savedOrderInfo.waybills {
|
||||
|
||||
@@ -76,7 +76,7 @@ func (c *DeliveryHandler) CreateWaybill(order *model.GoodsOrder, maxDeliveryFee
|
||||
DeliveryFlag: model.OrderDeliveryFlagMaskScheduleDisabled,
|
||||
}
|
||||
dao.CreateEntity(dao.GetDB(), waybill)
|
||||
return bill, err
|
||||
return waybill, err
|
||||
}
|
||||
func (c *DeliveryHandler) CancelWaybill(bill *model.Waybill, cancelReasonID int, cancelReason string) (err error) {
|
||||
err = api.JdEclpAPI.CancelWayBill(&jdeclpapi.CancelWayBillParam{
|
||||
|
||||
@@ -143,3 +143,13 @@ func (p *PurchaseHandler) OrderExport(ctx *jxcontext.Context, vendorOrderID, ven
|
||||
err = api.JdShopAPI.OrderShipment(utils.Str2Int64(vendorOrderID[:12]), companyID, vendorWaybillID)
|
||||
return err
|
||||
}
|
||||
|
||||
func (p *PurchaseHandler) OrderTransfer(ctx *jxcontext.Context, vendorOrderID, vendorWaybillID string, isAuto bool) (err error) {
|
||||
companyID := jdshopapi.JdsDeliveryCompany3rd
|
||||
//表示是门店手动发京东
|
||||
if !isAuto {
|
||||
companyID = jdshopapi.JdsDeliveryCompanyJD
|
||||
}
|
||||
err = api.JdShopAPI.UpdateWaybill(vendorOrderID[:12], companyID, vendorWaybillID)
|
||||
return err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user