作者 陈志颖

fix:重复取消分红预算单

... ... @@ -231,6 +231,11 @@ func (dividendsEstimateService *DividendsEstimateService) CancelDividendsEstimat
return nil, application.ThrowError(application.RES_NO_FIND_ERROR, fmt.Sprintf("%s", strconv.FormatInt(cancelDividendsEstimateCommand.DividendsEstimateId, 10)))
}
// 校验重复取消
if dividendsEstimate.IsCanceled {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "已取消的分红单不能重复取消")
}
// 校验是否能够取消
if dividendsEstimate.DividendsType == domain.ORDER_DIVIDENDS || dividendsEstimate.DividendsType == domain.RETURN_WRITE_OFF { // 订单分红、退货冲销
if count, dividendsEstimatesRelative, err2 := dividendsEstimateRepository.Find(map[string]interface{}{"orderOrReturnedOrderNum": dividendsEstimate.OrderOrReturnedOrderNum}); err2 != nil {
... ... @@ -336,6 +341,11 @@ func (dividendsEstimateService *DividendsEstimateService) BatchCancelDividendsEs
if count > 0 {
// 校验分红预算是否可以取消,已有相关分红预算单已结算,无法取消
for _, dividendsEstimate := range dividendsEstimates {
// 校验重复取消
if dividendsEstimate.IsCanceled {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "已取消的分红单不能重复取消")
}
// 校验是否能够取消
if dividendsEstimate.DividendsType == domain.ORDER_DIVIDENDS || dividendsEstimate.DividendsType == domain.RETURN_WRITE_OFF { // 订单分红、退货冲销
if count, dividendsEstimatesRelative, err2 := dividendsEstimateRepository.Find(map[string]interface{}{"orderOrReturnedOrderNum": dividendsEstimate.OrderOrReturnedOrderNum}); err2 != nil {
... ...