Browse Source

插入单条artdemandlst检查对应的article是否存在

pull/77/head
zhangxin 3 years ago
parent
commit
e76c7af0ff
1 changed files with 8 additions and 0 deletions
  1. +8
    -0
      services/log/implments/ArtDemandLst.service.impl.go

+ 8
- 0
services/log/implments/ArtDemandLst.service.impl.go View File

@ -134,6 +134,14 @@ func (impl *ArtDemandLstServiceImplement) InsertOne(user *models.Usertab, entity
if record != nil {
return grmi.NewBusinessError("已经存在相同主键的记录!")
}
baseDao := baseDal.NewArticleDAO(session, user.Pid, user.Userid)
article, err := baseDao.SelectOne(entity.ArtId)
if err != nil {
return err
}
if article == nil {
return grmi.NewBusinessError("不存在对应的物料,请检查")
}
demandTime := entity.DemandTime.Restore()
entity.DemandYear = demandTime.Year()
entity.DemandMonth = int(demandTime.Month())


Loading…
Cancel
Save