| | |
| | | } |
| | | |
| | | m := make(map[string]interface{}) |
| | | newList := make([]*purchase.PurchaseProductConfirm, 0) |
| | | if first { |
| | | m["status"] = purchase.OrderStatusWaitReceive |
| | | newList = list |
| | | } else { |
| | | yu := int64(0) |
| | | for _, confirm := range list { |
| | |
| | | confirm.NotReceiveAmount = confirm.Amount.Sub(confirm.OverReceiveAmount) |
| | | if !confirm.SurplusReceiveAmount.IsZero() { |
| | | yu = confirm.SurplusReceiveAmount.IntPart() |
| | | } |
| | | //过滤本次收货数量为0的数据 |
| | | if !confirm.NowReceiveAmount.IsZero() { |
| | | newList = append(newList, confirm) |
| | | } |
| | | } |
| | | if yu > 0 { |
| | |
| | | return err |
| | | } |
| | | |
| | | err = tx.Create(newList).Error |
| | | err = tx.Create(list).Error |
| | | if err != nil { |
| | | return err |
| | | } |
| | |
| | | purchaseNumber := list[0].PurchaseNumber |
| | | qualityList := make([]*purchase.PurchaseQualityInspection, 0) |
| | | for _, confirm := range list { |
| | | if confirm.NowReceiveAmount.IsZero() { |
| | | continue |
| | | } |
| | | var pqi purchase.PurchaseQualityInspection |
| | | pqi.PurchaseNumber = purchaseNumber |
| | | pqi.Principal = confirm.Principal |