- 后台主动取消运单后不会再重新创建
This commit is contained in:
@@ -490,12 +490,7 @@ func (c *OrderManager) loadOrderFinancial(vendorOrderID, vendorOrderID2 string,
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (c *OrderManager) UpdateOrderStatusAndFlag(order *model.GoodsOrder) (err error) {
|
func (c *OrderManager) UpdateOrderStatusAndFlag(order *model.GoodsOrder) (err error) {
|
||||||
db := orm.NewOrm()
|
return c.UpdateOrderFields(order, []string{"Status", "DeliveryFlag"})
|
||||||
utils.CallFuncLogError(func() error {
|
|
||||||
_, err = db.Update(order, "Status", "DeliveryFlag")
|
|
||||||
return err
|
|
||||||
}, "UpdateOrderStatusAndFlag orderID:%s failed with error:%v", order.VendorOrderID, err)
|
|
||||||
return err
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *OrderManager) UpdateOrderFields(order *model.GoodsOrder, fieldList []string) (err error) {
|
func (c *OrderManager) UpdateOrderFields(order *model.GoodsOrder, fieldList []string) (err error) {
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import (
|
|||||||
"git.rosy.net.cn/jx-callback/business/jxcallback/scheduler"
|
"git.rosy.net.cn/jx-callback/business/jxcallback/scheduler"
|
||||||
"git.rosy.net.cn/jx-callback/business/jxutils"
|
"git.rosy.net.cn/jx-callback/business/jxutils"
|
||||||
"git.rosy.net.cn/jx-callback/business/model"
|
"git.rosy.net.cn/jx-callback/business/model"
|
||||||
|
"git.rosy.net.cn/jx-callback/business/model/dao"
|
||||||
"git.rosy.net.cn/jx-callback/business/partner"
|
"git.rosy.net.cn/jx-callback/business/partner"
|
||||||
"git.rosy.net.cn/jx-callback/globals"
|
"git.rosy.net.cn/jx-callback/globals"
|
||||||
)
|
)
|
||||||
@@ -170,6 +171,8 @@ func (c *BaseScheduler) CancelWaybill(bill *model.Waybill, cancelReasonID int, c
|
|||||||
return handlerInfo.Handler.CancelWaybill(bill, cancelReasonID, cancelReason)
|
return handlerInfo.Handler.CancelWaybill(bill, cancelReasonID, cancelReason)
|
||||||
}, "CancelWaybill bill:%v", bill); err == nil {
|
}, "CancelWaybill bill:%v", bill); err == nil {
|
||||||
bill.Status = model.WaybillStatusCanceled
|
bill.Status = model.WaybillStatusCanceled
|
||||||
|
bill.DeliveryFlag |= model.WaybillDeliveryFlagMaskActiveCancel
|
||||||
|
_, err = dao.UpdateEntity(nil, bill, "Status", "DeliveryFlag")
|
||||||
}
|
}
|
||||||
globals.SugarLogger.Debugf("CancelWaybill bill:%v canceled by myself", bill)
|
globals.SugarLogger.Debugf("CancelWaybill bill:%v canceled by myself", bill)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -390,9 +390,6 @@ func (s *DefScheduler) OnWaybillStatusChanged(bill *model.Waybill, isPending boo
|
|||||||
if !isPending {
|
if !isPending {
|
||||||
bill.WaybillVendorID = model.VendorIDUnknown
|
bill.WaybillVendorID = model.VendorIDUnknown
|
||||||
s.updateOrderByBill(order, bill, false)
|
s.updateOrderByBill(order, bill, false)
|
||||||
|
|
||||||
// 取消抢单应该不需要发3方运单
|
|
||||||
// s.createWaybillOn3rdProviders(savedOrderInfo, bill)
|
|
||||||
}
|
}
|
||||||
} else if s.IsOrderHasWaybill(order) {
|
} else if s.IsOrderHasWaybill(order) {
|
||||||
s.ProxyCancelWaybill(order, bill, partner.CancelWaybillReasonNotAcceptIntime, partner.CancelWaybillReasonStrNotAcceptIntime)
|
s.ProxyCancelWaybill(order, bill, partner.CancelWaybillReasonNotAcceptIntime, partner.CancelWaybillReasonStrNotAcceptIntime)
|
||||||
@@ -420,11 +417,13 @@ func (s *DefScheduler) OnWaybillStatusChanged(bill *model.Waybill, isPending boo
|
|||||||
// 现在发现饿百取消订单后不会再创建运单了,所以饿百运单取消也允许直接创建三方运单
|
// 现在发现饿百取消订单后不会再创建运单了,所以饿百运单取消也允许直接创建三方运单
|
||||||
// 之前的条件是order.Status < model.OrderStatusDelivering,但像订单902322817000122确实有在配送中取消状态,改成非订单结束状态都可以
|
// 之前的条件是order.Status < model.OrderStatusDelivering,但像订单902322817000122确实有在配送中取消状态,改成非订单结束状态都可以
|
||||||
// OrderStatusFinishedPickup状态的订单依赖于TIMER重新建运单
|
// OrderStatusFinishedPickup状态的订单依赖于TIMER重新建运单
|
||||||
|
if bill.DeliveryFlag&model.WaybillDeliveryFlagMaskActiveCancel == 0 {
|
||||||
if order.Status >= model.OrderStatusFinishedPickup && order.Status < model.OrderStatusEndBegin && (bill.WaybillVendorID != order.VendorID || order.VendorID == model.VendorIDEBAI) {
|
if order.Status >= model.OrderStatusFinishedPickup && order.Status < model.OrderStatusEndBegin && (bill.WaybillVendorID != order.VendorID || order.VendorID == model.VendorIDEBAI) {
|
||||||
s.createWaybillOn3rdProviders(savedOrderInfo, nil)
|
s.createWaybillOn3rdProviders(savedOrderInfo, nil)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
// case model.WaybillStatusDelivering:
|
// case model.WaybillStatusDelivering:
|
||||||
// s.resetTimer(savedOrderInfo, bill, isPending)
|
// s.resetTimer(savedOrderInfo, bill, isPending)
|
||||||
// if s.isBillCandidate(order, bill) {
|
// if s.isBillCandidate(order, bill) {
|
||||||
|
|||||||
@@ -268,6 +268,10 @@ const (
|
|||||||
OrderDeliveryFlagMaskPurcahseDisabled = 2 // 购物平台已不配送(一般为门店配送类型本身为自配送,或已经转自配送)
|
OrderDeliveryFlagMaskPurcahseDisabled = 2 // 购物平台已不配送(一般为门店配送类型本身为自配送,或已经转自配送)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
WaybillDeliveryFlagMaskActiveCancel = 1 // 主动取消
|
||||||
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
OrderFlagMaskPrinted = 1 // 已经打印
|
OrderFlagMaskPrinted = 1 // 已经打印
|
||||||
|
|
||||||
|
|||||||
@@ -124,6 +124,7 @@ type Waybill struct {
|
|||||||
ActualFee int64 `json:"actualFee"` // 实际要支付给快递公司的费用
|
ActualFee int64 `json:"actualFee"` // 实际要支付给快递公司的费用
|
||||||
DesiredFee int64 `json:"desiredFee"` // 运单总费用
|
DesiredFee int64 `json:"desiredFee"` // 运单总费用
|
||||||
DuplicatedCount int `json:"-"` // 重复新订单消息数,这个一般不是由于消息重发造成的(消息重发由OrderStatus过滤),一般是业务逻辑造成的
|
DuplicatedCount int `json:"-"` // 重复新订单消息数,这个一般不是由于消息重发造成的(消息重发由OrderStatus过滤),一般是业务逻辑造成的
|
||||||
|
DeliveryFlag int8 `json:"deliveryFlag"`
|
||||||
WaybillCreatedAt time.Time `orm:"type(datetime);index" json:"waybillCreatedAt"`
|
WaybillCreatedAt time.Time `orm:"type(datetime);index" json:"waybillCreatedAt"`
|
||||||
WaybillFinishedAt time.Time `orm:"type(datetime)" json:"waybillFinishedAt"`
|
WaybillFinishedAt time.Time `orm:"type(datetime)" json:"waybillFinishedAt"`
|
||||||
StatusTime time.Time `orm:"type(datetime)" json:"-"` // last status time
|
StatusTime time.Time `orm:"type(datetime)" json:"-"` // last status time
|
||||||
|
|||||||
Reference in New Issue
Block a user