This commit is contained in:
苏尹岚
2021-03-26 17:31:10 +08:00
parent d56beac926
commit 8cb61ef62d
5 changed files with 69 additions and 45 deletions

View File

@@ -587,7 +587,9 @@ func (s *DefScheduler) OnWaybillStatusChanged(bill *model.Waybill, isPending boo
s.solutionJdsOrder(bill)
}
//门店发单的门店,需要根据实际运费更新账户(多退少补)
s.updateStoreAccount(order, bill)
if savedOrderInfo.storeDetail.CreateDeliveryType == model.YES {
s.updateStoreAccount(order, bill)
}
//订单已经是结束状态之后来的运单143945553920000001
if order.Status > model.OrderStatusEndBegin {
s.ProxyCancelWaybill(order, bill, partner.CancelWaybillReasonNotAcceptIntime, partner.CancelWaybillReasonStrNotAcceptIntime)
@@ -1321,7 +1323,20 @@ func (s *DefScheduler) updateOrderByBill(order *model.GoodsOrder, bill *model.Wa
}
func (s *DefScheduler) updateStoreAccount(order *model.GoodsOrder, bill *model.Waybill) {
realDesiredFee := bill.DesiredFee
if expend, lastFee, err := partner.CurStoreAcctManager.GetStoreAcctExpendLastCreateWayBillFee(order.VendorOrderID); err == nil {
lastFee64 := int64(lastFee)
if lastFee64 != realDesiredFee {
var diffFee int64
if lastFee64 > realDesiredFee {
diffFee = lastFee64 - realDesiredFee
partner.CurStoreAcctManager.InsertStoreAcctIncomeAndUpdateStoreAcctBalance(jxcontext.AdminCtx, jxutils.GetSaleStoreIDFromOrder(order), int(diffFee), partner.StoreAcctTypeRealFeeIncome, order.VendorOrderID, expend.ID)
} else {
diffFee = realDesiredFee - lastFee64
partner.CurStoreAcctManager.InsertStoreAcctIncomeAndUpdateStoreAcctBalance(jxcontext.AdminCtx, jxutils.GetSaleStoreIDFromOrder(order), int(diffFee), partner.StoreAcctTypeRealFeeExpend, order.VendorOrderID, expend.ID)
}
}
}
}
func (s *DefScheduler) updateBillsInfo(savedOrderInfo *WatchOrderInfo, bill *model.Waybill) (isBillExist bool) {