| | |
| | | return |
| | | } |
| | | |
| | | func (slf *PurchaseService) GetPurchaseByNumber(number string) (purchase purchase.Purchase, err error) { |
| | | err = global.GVA_DB.Where("number = ?", number).Preload("Supplier").First(&purchase).Error |
| | | return |
| | | } |
| | | |
| | | //@function: GetPurchaseList |
| | | //@description: 分页获取采购单列表 |
| | | //@param: info request.PageInfo |
| | |
| | | return list, err |
| | | } |
| | | |
| | | func (slf *PurchaseService) SavePurchaseQualityInspection(list []*purchase.PurchaseProductConfirm) (err error) { |
| | | func (slf *PurchaseService) SavePurchaseQualityInspection(list []*purchase.PurchaseProductConfirm) ([]*purchase.PurchaseQualityInspection, error) { |
| | | if len(list) == 0 { |
| | | return errors.New("产品列表不能为空") |
| | | return nil, errors.New("产品列表不能为空") |
| | | } |
| | | purchaseNumber := list[0].PurchaseNumber |
| | | qualityList := make([]*purchase.PurchaseQualityInspection, 0) |
| | |
| | | pqi.Type = confirm.Type |
| | | qualityList = append(qualityList, &pqi) |
| | | } |
| | | err = global.GVA_DB.Model(purchase.PurchaseQualityInspection{}).Create(qualityList).Error |
| | | return err |
| | | err := global.GVA_DB.Model(purchase.PurchaseQualityInspection{}).Create(qualityList).Error |
| | | return qualityList, err |
| | | } |
| | | |
| | | func (slf *PurchaseService) GetPurchaseQualityInspection(params purchaserequest.GetQualityInspectionInfo) ([]*purchase.PurchaseQualityInspection, error) { |