Browse Source

修复计算时间没有写入到字段上,修复插入单条报错的bug

pull/108/head
zhangxin 3 years ago
parent
commit
edfb01f36c
1 changed files with 12 additions and 6 deletions
  1. +12
    -6
      services/base/implments/DayModel.service.impl.go

+ 12
- 6
services/base/implments/DayModel.service.impl.go View File

@ -148,8 +148,8 @@ func (impl *DayModelServiceImplement) InsertOne(user *models.Usertab, entity *mo
return grmi.NewBusinessError("已经存在相同主键的记录!")
}
dependOnDao := dal.NewWorkShiftDAO(session, user.Pid, user.Userid)
if record.S1WorkShiftNr != 0 {
workShift, err := dependOnDao.SelectOne(record.S1WorkShiftNr)
if entity.S1WorkShiftNr != 0 {
workShift, err := dependOnDao.SelectOne(entity.S1WorkShiftNr)
if err != nil {
return err
}
@ -157,8 +157,8 @@ func (impl *DayModelServiceImplement) InsertOne(user *models.Usertab, entity *mo
return grmi.NewBusinessError("S1WorkShiftNr不存在对应的人员班组信息,请检查")
}
}
if record.S2WorkShiftNr != 0 {
workShift, err := dependOnDao.SelectOne(record.S2WorkShiftNr)
if entity.S2WorkShiftNr != 0 {
workShift, err := dependOnDao.SelectOne(entity.S2WorkShiftNr)
if err != nil {
return err
}
@ -166,8 +166,8 @@ func (impl *DayModelServiceImplement) InsertOne(user *models.Usertab, entity *mo
return grmi.NewBusinessError("S2WorkShiftNr不存在对应的人员班组信息,请检查")
}
}
if record.S3WorkShiftNr != 0 {
workShift, err := dependOnDao.SelectOne(record.S3WorkShiftNr)
if entity.S3WorkShiftNr != 0 {
workShift, err := dependOnDao.SelectOne(entity.S3WorkShiftNr)
if err != nil {
return err
}
@ -196,6 +196,7 @@ func (impl *DayModelServiceImplement) InsertOne(user *models.Usertab, entity *mo
if entity.S1B5End > entity.S1B5Beg {
duration -= entity.S1B5End - entity.S1B5Beg
}
entity.S1Len = duration
}
}
if entity.S2Toggle {
@ -219,6 +220,7 @@ func (impl *DayModelServiceImplement) InsertOne(user *models.Usertab, entity *mo
if entity.S2B5End > entity.S2B5Beg {
duration -= entity.S2B5End - entity.S2B5Beg
}
entity.S2Len = duration
}
}
if entity.S3Toggle {
@ -242,6 +244,7 @@ func (impl *DayModelServiceImplement) InsertOne(user *models.Usertab, entity *mo
if entity.S3B5End > entity.S3B5Beg {
duration -= entity.S3B5End - entity.S3B5Beg
}
entity.S3Len = duration
}
}
err = dao.InsertOne(entity)
@ -368,6 +371,7 @@ func (impl *DayModelServiceImplement) UpdateOne(user *models.Usertab, entity *mo
if entity.S1B5End > entity.S1B5Beg {
duration -= entity.S1B5End - entity.S1B5Beg
}
entity.S1Len = duration
}
}
if entity.S2Toggle {
@ -391,6 +395,7 @@ func (impl *DayModelServiceImplement) UpdateOne(user *models.Usertab, entity *mo
if entity.S2B5End > entity.S2B5Beg {
duration -= entity.S2B5End - entity.S2B5Beg
}
entity.S2Len = duration
}
}
if entity.S3Toggle {
@ -414,6 +419,7 @@ func (impl *DayModelServiceImplement) UpdateOne(user *models.Usertab, entity *mo
if entity.S3B5End > entity.S3B5Beg {
duration -= entity.S3B5End - entity.S3B5Beg
}
entity.S3Len = duration
}
}
err = dao.UpdateOne(entity)


Loading…
Cancel
Save