|
@@ -84,6 +84,29 @@ func (domainService *CancelDividendsEstimateService) CancelEstimate(dividendsEst |
|
@@ -84,6 +84,29 @@ func (domainService *CancelDividendsEstimateService) CancelEstimate(dividendsEst |
|
84
|
dividendsEstimatesCanceled = append(dividendsEstimatesCanceled, dividendsEstimatesRelativeCanceled...)
|
84
|
dividendsEstimatesCanceled = append(dividendsEstimatesCanceled, dividendsEstimatesRelativeCanceled...)
|
|
85
|
}
|
85
|
}
|
|
86
|
}
|
86
|
}
|
|
|
|
87
|
+ } else if dividendsEstimate.DividendsType == 3 {
|
|
|
|
88
|
+ // 根据当前分红预算单的分红订单号或退货单号获取相关的分红预算单
|
|
|
|
89
|
+ if countRelative, dividendsEstimatesRelative, err2 := dividendsEstimateRepository.Find(map[string]interface{}{
|
|
|
|
90
|
+ "companyId": dividendsEstimate.Company.CompanyId,
|
|
|
|
91
|
+ "orgId": dividendsEstimate.Org.OrgId,
|
|
|
|
92
|
+ "cooperationContractNumber": dividendsEstimate.CooperationContractNumber,
|
|
|
|
93
|
+ "dividendsType": int32(3),
|
|
|
|
94
|
+ "offsetLimit": false,
|
|
|
|
95
|
+ }); err2 != nil {
|
|
|
|
96
|
+ return nil, err2
|
|
|
|
97
|
+ } else {
|
|
|
|
98
|
+ if countRelative > 0 {
|
|
|
|
99
|
+ for i, _ := range dividendsEstimatesRelative {
|
|
|
|
100
|
+ dividendsEstimatesRelative[i].IsCanceled = true
|
|
|
|
101
|
+ dividendsEstimatesRelative[i].Operator = operator
|
|
|
|
102
|
+ }
|
|
|
|
103
|
+ dividendsEstimatesRelativeCanceled, err3 := dividendsEstimateRepository.UpdateMany(dividendsEstimatesRelative)
|
|
|
|
104
|
+ if err3 != nil {
|
|
|
|
105
|
+ return nil, err3
|
|
|
|
106
|
+ }
|
|
|
|
107
|
+ dividendsEstimatesCanceled = append(dividendsEstimatesCanceled, dividendsEstimatesRelativeCanceled...)
|
|
|
|
108
|
+ }
|
|
|
|
109
|
+ }
|
|
87
|
}
|
110
|
}
|
|
88
|
}
|
111
|
}
|
|
89
|
|
112
|
|
|
@@ -102,7 +125,7 @@ func (domainService *CancelDividendsEstimateService) CancelEstimate(dividendsEst |
|
@@ -102,7 +125,7 @@ func (domainService *CancelDividendsEstimateService) CancelEstimate(dividendsEst |
|
102
|
}
|
125
|
}
|
|
103
|
}
|
126
|
}
|
|
104
|
|
127
|
|
|
105
|
- // 获取分红订单
|
128
|
+ // 获取分红订单并更新分红订单产品的状态
|
|
106
|
if len(orderNums) > 0 {
|
129
|
if len(orderNums) > 0 {
|
|
107
|
if countDividendsOrder, orders, err4 := dividendsOrderRepository.Find(map[string]interface{}{
|
130
|
if countDividendsOrder, orders, err4 := dividendsOrderRepository.Find(map[string]interface{}{
|
|
108
|
"companyId": dividendsEstimates[0].Company.CompanyId,
|
131
|
"companyId": dividendsEstimates[0].Company.CompanyId,
|
|
@@ -147,7 +170,7 @@ func (domainService *CancelDividendsEstimateService) CancelEstimate(dividendsEst |
|
@@ -147,7 +170,7 @@ func (domainService *CancelDividendsEstimateService) CancelEstimate(dividendsEst |
|
147
|
}
|
170
|
}
|
|
148
|
}
|
171
|
}
|
|
149
|
|
172
|
|
|
150
|
- // 获取分红退货单
|
173
|
+ // 获取分红退货单并更新订单产品的状态
|
|
151
|
if len(returnedOrderNums) > 0 {
|
174
|
if len(returnedOrderNums) > 0 {
|
|
152
|
if countDividendsReturnedOrder, returnedOrders, err5 := dividendsReturnedOrderRepository.Find(map[string]interface{}{
|
175
|
if countDividendsReturnedOrder, returnedOrders, err5 := dividendsReturnedOrderRepository.Find(map[string]interface{}{
|
|
153
|
"companyId": dividendsEstimates[0].Company.CompanyId,
|
176
|
"companyId": dividendsEstimates[0].Company.CompanyId,
|