...
|
...
|
@@ -447,12 +447,29 @@ func (repository *DividendsReturnedOrderRepository) Remove(dividendsReturnedOrde |
|
|
return dividendsReturnedOrder, err
|
|
|
} else {
|
|
|
// 删除分红退货单产品
|
|
|
//var orderGoodModels []*models.OrderGood
|
|
|
//if _, err := tx.Model(&orderGoodModels).
|
|
|
// Where("company_id = ?", dividendsReturnedOrder.Company.CompanyId).
|
|
|
// Where("org_id = ?", dividendsReturnedOrder.Org.OrgId).
|
|
|
// Where("dividends_returned_order_number = ?", dividendsReturnedOrder.DividendsReturnedOrderNumber).Delete(); err != nil {
|
|
|
// return nil, err
|
|
|
//}
|
|
|
|
|
|
// 删除分红退货单产品
|
|
|
var orderGoodModels []*models.OrderGood
|
|
|
if _, err := tx.Model(&orderGoodModels).
|
|
|
orderGoodQuery := tx.Model(&orderGoodModels)
|
|
|
if err := orderGoodQuery.
|
|
|
Where("company_id = ?", dividendsReturnedOrder.Company.CompanyId).
|
|
|
Where("org_id = ?", dividendsReturnedOrder.Org.OrgId).
|
|
|
Where("dividends_returned_order_number = ?", dividendsReturnedOrder.DividendsReturnedOrderNumber).Delete(); err != nil {
|
|
|
Where("dividends_returned_order_number = ?", dividendsReturnedOrder.DividendsReturnedOrderNumber).
|
|
|
Select(); err != nil {
|
|
|
return nil, err
|
|
|
} else {
|
|
|
if len(orderGoodModels) > 0 {
|
|
|
if _, err := tx.Model(&orderGoodModels).WherePK().Delete(); err != nil {
|
|
|
return nil, err
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
return dividendsReturnedOrder, nil
|
...
|
...
|
|