- 添加正在创建运单中的标志,标识创建运单成功到收到新运单事件这个状态
This commit is contained in:
@@ -155,6 +155,9 @@ func (c *BaseScheduler) CreateWaybill(platformVendorID int, order *model.GoodsOr
|
||||
bill, err = handlerInfo.Handler.CreateWaybill(order, policy)
|
||||
if err != nil {
|
||||
globals.SugarLogger.Infof("CreateWaybill failed orderID:%s vendorID:%d with error:%v", order.VendorOrderID, platformVendorID, err)
|
||||
} else {
|
||||
order.DeliveryFlag |= model.WaybillVendorID2Mask(platformVendorID)
|
||||
err = partner.CurOrderManager.UpdateOrderStatusAndFlag(order)
|
||||
}
|
||||
} else {
|
||||
err = scheduler.ErrDeliverProviderWrong
|
||||
|
||||
@@ -342,6 +342,8 @@ func (s *DefScheduler) OnWaybillStatusChanged(bill *model.Waybill, isPending boo
|
||||
s.ProxyCancelWaybill(order, bill, partner.CancelWaybillReasonNotAcceptIntime, partner.CancelWaybillReasonStrNotAcceptIntime)
|
||||
}
|
||||
}
|
||||
order.DeliveryFlag &= ^model.WaybillVendorID2Mask(bill.WaybillVendorID)
|
||||
err = partner.CurOrderManager.UpdateOrderStatusAndFlag(order)
|
||||
}
|
||||
// 只有购物平台的新运单消息才会启动抢单TIMER
|
||||
if s.IsOrderPlatformWaybill(bill) {
|
||||
|
||||
@@ -266,6 +266,9 @@ const (
|
||||
const (
|
||||
OrderDeliveryFlagMaskScheduleDisabled = 1 // 禁止三方配送调度
|
||||
OrderDeliveryFlagMaskPurcahseDisabled = 2 // 购物平台已不配送(一般为门店配送类型本身为自配送,或已经转自配送)
|
||||
|
||||
OrderDeliveryFlagMaskDada = 16 // 创建达达运单中
|
||||
OrderDeliveryFlagMaskMtps = 32 // 创建美团配送运单中
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -321,3 +324,12 @@ func IsOrderFinalStatus(status int) bool {
|
||||
func IsOrderImportantStatus(status int) bool {
|
||||
return IsOrderMainStatus(status) || IsOrderLockStatus(status) || IsOrderUnlockStatus(status)
|
||||
}
|
||||
|
||||
func WaybillVendorID2Mask(vendorID int) (mask int8) {
|
||||
if vendorID == VendorIDDada {
|
||||
mask = OrderDeliveryFlagMaskDada
|
||||
} else if vendorID == VendorIDMTPS {
|
||||
mask = OrderDeliveryFlagMaskMtps
|
||||
}
|
||||
return mask
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user