| | |
| | | |
| | | //@function: CreatePurchase |
| | | //@description: 创建采购单 |
| | | //@param: e model.Purchase |
| | | //@param: params *purchaserequest.AddPurchase |
| | | //@return: err error |
| | | |
| | | func (exa *PurchaseService) CreatePurchase(params purchaserequest.AddPurchase) (err error) { |
| | |
| | | return err |
| | | } |
| | | |
| | | //@function: DeleteFileChunk |
| | | //@function: DeletePurchase |
| | | //@description: 删除采购单 |
| | | //@param: e model.Purchase |
| | | //@param: id uint |
| | | //@return: err error |
| | | |
| | | func (exa *PurchaseService) DeletePurchase(id uint) (err error) { |
| | |
| | | |
| | | //@function: UpdatePurchase |
| | | //@description: 更新采购单 |
| | | //@param: e *model.Purchase |
| | | //@param: params *purchaserequest.AddPurchase |
| | | //@return: err error |
| | | |
| | | func (exa *PurchaseService) UpdatePurchase(params *purchaserequest.AddPurchase) (err error) { |
| | |
| | | |
| | | //@function: GetPurchaseProductList |
| | | //@description: 分页获取采购单产品列表 |
| | | //@param: sysUserAuthorityID string |
| | | //@param: purchaseId int |
| | | //@return: list interface{}, err error |
| | | |
| | | func (exa *PurchaseService) GetPurchaseProductList(purchaseId uint) (list []*purchase.PurchaseProducts, err error) { |
| | |
| | | err = db.Where("purchase_id = ?", purchaseId).Find(&list).Error |
| | | return list, err |
| | | } |
| | | |
| | | //@function: Submit |
| | | //@description: 提交采购单 |
| | | //@param: id uint |
| | | //@return: err error |
| | | |
| | | func (exa *PurchaseService) Submit(id uint) (err error) { |
| | | err = global.GVA_DB.Transaction(func(tx *gorm.DB) error { |
| | | err = global.GVA_DB.Where("id = ?", id).Model(&purchase.Purchase{}).Updates(map[string]interface{}{"status": 1}).Error |
| | | if err != nil { |
| | | return err |
| | | } |
| | | return global.GVA_DB.Where("purchase_id = ?", id).Delete(&purchase.PurchaseProducts{}).Error |
| | | }) |
| | | return err |
| | | } |