- 处理某些运单没有收到新运单消息的异常情况

This commit is contained in:
gazebo
2019-05-15 21:47:42 +08:00
parent ff152dbd6b
commit 30d4aec63a
2 changed files with 4 additions and 1 deletions

View File

@@ -393,6 +393,7 @@ func (s *DefScheduler) OnWaybillStatusChanged(bill *model.Waybill, isPending boo
} else {
isBillExist := s.updateBillsInfo(savedOrderInfo, bill)
if !isBillExist {
s.addWaybill2Map(savedOrderInfo, bill)
globals.SugarLogger.Debugf("OnWaybillStatusChanged bill not exist! orderID:%s, bill:%v", bill.VendorOrderID, bill)
}
switch bill.Status {
@@ -639,6 +640,7 @@ func (s *DefScheduler) swtich2SelfDeliverWithRetry(savedOrderInfo *WatchOrderInf
s.removeWaybillFromMap(savedOrderInfo, order.VendorID)
}
} else {
s.cancelOtherWaybills(savedOrderInfo, nil, partner.CancelWaybillReasonOther, partner.CancelWaybillReasonStrNotAcceptIntime)
// 进到这里的原因是,在这个时间点,购物平台物流已经抢单(但抢单消息还没有被收到),所以转自送会失败 比如818810379000941更好的做法应该是判断Swtich2SelfDeliver的返回值这种情况下就不得试了
globals.SugarLogger.Infof("swtich2SelfDeliverWithRetry orderID:%s status is wrong(maybe purchase platform accepted waybill)", order.VendorOrderID)
// globals.SugarLogger.Warnf("swtich2SelfDeliverWithRetry orderID:%s status is wrong, order details:%v", order.VendorOrderID, order)

View File

@@ -179,7 +179,6 @@ func (c *DeliveryHandler) CreateWaybill(order *model.GoodsOrder, policy partner.
if globals.EnableStoreWrite {
result, err2 := api.MtpsAPI.CreateOrderByShop(billParams, addParams)
if err = err2; err == nil {
globals.SugarLogger.Debugf("CreateWaybill failed, orderID:%s, billParams:%v, addParams:%v, error:%v", order.VendorOrderID, billParams, addParams, err)
bill = &model.Waybill{
VendorOrderID: order.VendorOrderID,
OrderVendorID: order.VendorID,
@@ -188,6 +187,8 @@ func (c *DeliveryHandler) CreateWaybill(order *model.GoodsOrder, policy partner.
WaybillVendorID: model.VendorIDMTPS,
DesiredFee: deliveryFee,
}
} else {
globals.SugarLogger.Debugf("CreateWaybill failed, orderID:%s, billParams:%v, addParams:%v, error:%v", order.VendorOrderID, billParams, addParams, err)
}
} else {
err = fmt.Errorf("测试环境不能真正创建运单")