...
|
...
|
@@ -1096,6 +1096,16 @@ func (dividendsOrderService *DividendsOrderService) BatchRemoveDividendsOrder(ba |
|
|
dividendsReturnedOrderRepository = value
|
|
|
}
|
|
|
|
|
|
// 分红预算单仓储初始化
|
|
|
var dividendsEstimateRepository domain.DividendsEstimateRepository
|
|
|
if value, err := factory.CreateDividendsEstimateRepository(map[string]interface{}{
|
|
|
"transactionContext": transactionContext,
|
|
|
}); err != nil {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
} else {
|
|
|
dividendsEstimateRepository = value
|
|
|
}
|
|
|
|
|
|
dividendsOrderIds, err := utils.SliceAtoi(batchRemoveDividendsOrderCommand.DividendsOrderIds)
|
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "分红订单ID类型错误")
|
...
|
...
|
@@ -1120,9 +1130,22 @@ func (dividendsOrderService *DividendsOrderService) BatchRemoveDividendsOrder(ba |
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, fmt.Sprintf("分红订单%s有关联的退货单,不可删除", dividendsOrder.DividendsOrderNumber))
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
// TODO 校验分红订单是否有分红预算
|
|
|
// 校验分红订单是否有分红预算
|
|
|
if countRelative, _, err2 := dividendsEstimateRepository.Find(map[string]interface{}{
|
|
|
"companyId": dividendsOrder.Company.CompanyId,
|
|
|
"orgId": dividendsOrder.Org.OrgId,
|
|
|
"orderOrReturnedOrderNum": dividendsOrder.DividendsOrderNumber,
|
|
|
"offsetLimit": false,
|
|
|
"isCanceled": false,
|
|
|
}); err2 != nil {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err2.Error())
|
|
|
} else {
|
|
|
if countRelative > 0 {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, fmt.Sprintf("分红订单%s有关联的预算单,不可删除", dividendsOrder.DividendsOrderNumber))
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
dividendsOrdersRemoved, err := dividendsOrderRepository.BatchRemove(dividendsOrders)
|
|
|
if err != nil {
|
...
|
...
|
|