...
|
...
|
@@ -1007,6 +1007,8 @@ func (dividendsReturnedOrderService *DividendsReturnedOrderService) BatchRemoveD |
|
|
defer func() {
|
|
|
_ = transactionContext.RollbackTransaction()
|
|
|
}()
|
|
|
|
|
|
// 分红退货单仓储初始化
|
|
|
var dividendsReturnedOrderRepository domain.DividendsReturnedOrderRepository
|
|
|
if value, err := factory.CreateDividendsReturnedOrderRepository(map[string]interface{}{
|
|
|
"transactionContext": transactionContext,
|
...
|
...
|
@@ -1149,6 +1151,16 @@ func (dividendsReturnedOrderService *DividendsReturnedOrderService) UpdateDivide |
|
|
cooperationContractRepository = value
|
|
|
}
|
|
|
|
|
|
// 产品仓储初始化
|
|
|
var orderGoodRepository domain.OrderGoodRepository
|
|
|
if value, err := factory.CreateOrderGoodRepository(map[string]interface{}{
|
|
|
"transactionContext": transactionContext,
|
|
|
}); err != nil {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
} else {
|
|
|
orderGoodRepository = value
|
|
|
}
|
|
|
|
|
|
// 查找合约
|
|
|
cooperationContractsMap := make(map[string]*domain.CooperationContract)
|
|
|
if count, cooperationContracts, err := cooperationContractRepository.Find(map[string]interface{}{
|
...
|
...
|
@@ -1175,6 +1187,14 @@ func (dividendsReturnedOrderService *DividendsReturnedOrderService) UpdateDivide |
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err3.Error())
|
|
|
}
|
|
|
|
|
|
// 获取产品
|
|
|
orderGoodFound, err4 := orderGoodRepository.FindOne(map[string]interface{}{
|
|
|
"orderGoodId": orderGoodId,
|
|
|
})
|
|
|
if err4 != nil {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err4.Error())
|
|
|
}
|
|
|
|
|
|
// 退货产品金额计算
|
|
|
orderGoodAmount, _ := decimal.NewFromFloat(orderGood.OrderGoodPrice).Mul(decimal.NewFromFloat(orderGood.OrderGoodQuantity)).Float64()
|
|
|
|
...
|
...
|
@@ -1209,6 +1229,7 @@ func (dividendsReturnedOrderService *DividendsReturnedOrderService) UpdateDivide |
|
|
DividendsReturnedOrderNumber: dividendsReturnedOrder.DividendsReturnedOrderNumber,
|
|
|
CooperationContractNumber: orderGood.CooperationContractNumber,
|
|
|
OrderGoodExpense: orderGood.OrderGoodExpense,
|
|
|
OrderGoodDividendsStatus: orderGoodFound.OrderGoodDividendsStatus,
|
|
|
OrgId: updateDividendsReturnedOrderCommand.OrgId,
|
|
|
CompanyId: updateDividendsReturnedOrderCommand.CompanyId,
|
|
|
CreatedAt: time.Time{},
|
...
|
...
|
|