- purchase platform waybill has highest priority.
- CancelWaybill in Swtich2SelfDeliver should update order waybill state.
This commit is contained in:
@@ -162,9 +162,9 @@ func (s *DefScheduler) OnWaybillStatusChanged(bill *model.Waybill, isPending boo
|
|||||||
switch bill.Status {
|
switch bill.Status {
|
||||||
case model.WaybillStatusAccepted:
|
case model.WaybillStatusAccepted:
|
||||||
if !isPending {
|
if !isPending {
|
||||||
if order.WaybillVendorID == model.VendorIDUnknown {
|
if order.WaybillVendorID == model.VendorIDUnknown || bill.WaybillVendorID == order.VendorID { // 购买平台的运单,优先级最高
|
||||||
s.cancelOtherWaybills(savedOrderInfo, bill)
|
|
||||||
s.updateOrderByBill(order, bill, false)
|
s.updateOrderByBill(order, bill, false)
|
||||||
|
s.cancelOtherWaybills(savedOrderInfo, bill)
|
||||||
} else if !(order.WaybillVendorID == bill.WaybillVendorID && order.VendorWaybillID == bill.VendorWaybillID) && bill.WaybillVendorID != order.VendorID {
|
} else if !(order.WaybillVendorID == bill.WaybillVendorID && order.VendorWaybillID == bill.VendorWaybillID) && bill.WaybillVendorID != order.VendorID {
|
||||||
// todo 当前逻辑,加载PENDING的ORDER时,正常状态也可能进这里
|
// todo 当前逻辑,加载PENDING的ORDER时,正常状态也可能进这里
|
||||||
s.CancelWaybill(bill)
|
s.CancelWaybill(bill)
|
||||||
@@ -310,7 +310,13 @@ func (s *DefScheduler) swtich2SelfDeliverWithRetry(order *model.GoodsOrder, bill
|
|||||||
// 当前先不加RETRY逻辑
|
// 当前先不加RETRY逻辑
|
||||||
if err := s.Swtich2SelfDeliver(order); err != nil {
|
if err := s.Swtich2SelfDeliver(order); err != nil {
|
||||||
globals.SugarLogger.Infof("swtich2SelfDeliverWithRetry failed, cancel bill:%v, err:%v", bill, err)
|
globals.SugarLogger.Infof("swtich2SelfDeliverWithRetry failed, cancel bill:%v, err:%v", bill, err)
|
||||||
s.CancelWaybill(bill)
|
if s.CancelWaybill(bill) == nil {
|
||||||
|
// 转自送失败的取消,要将订单中的运单状态更新
|
||||||
|
if order.WaybillVendorID == bill.WaybillVendorID && order.VendorWaybillID == bill.VendorWaybillID {
|
||||||
|
bill.WaybillVendorID = model.VendorIDUnknown
|
||||||
|
s.updateOrderByBill(order, bill, false)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -505,10 +511,11 @@ func (s *DefScheduler) isOrderSupportAutoPickup(order *model.GoodsOrder) (retVal
|
|||||||
db := orm.NewOrm()
|
db := orm.NewOrm()
|
||||||
utils.CallFuncLogError(func() error {
|
utils.CallFuncLogError(func() error {
|
||||||
err := db.Read(storefeature, "Id")
|
err := db.Read(storefeature, "Id")
|
||||||
if err == nil {
|
if err == nil || err == orm.ErrNoRows {
|
||||||
if storefeature.Autopickup == 0 {
|
if storefeature.Autopickup == 0 {
|
||||||
retVal = false
|
retVal = false
|
||||||
}
|
}
|
||||||
|
err = nil
|
||||||
}
|
}
|
||||||
return err
|
return err
|
||||||
}, "isOrderSupportAutoPickup")
|
}, "isOrderSupportAutoPickup")
|
||||||
|
|||||||
Reference in New Issue
Block a user