必选修规则新增 唯亚威新人培训不校验必选项

master
xiaochanghai 2 months ago
parent 7ef05ac7fd
commit 103a47fda0
  1. 2
      Tiobon.Core.Model/Insert/Ghre/Ghre_StudyRule.Dto.InsertInput.cs
  2. 25
      Tiobon.Core.Services/Ghre/Ghre_StudyRuleServices.cs

@ -22,7 +22,7 @@ namespace Tiobon.Core.Model.Models;
/// </summary>
public class InsertGhre_StudyRuleInput : Ghre_StudyRuleBase
{
public List<int> Staffs { get; set; }
public List<int> Staffs { get; set; }
public List<int> ZoneIds { get; set; }

@ -203,6 +203,19 @@ public class Ghre_StudyRuleServices : BaseServices<Ghre_StudyRule, Ghre_StudyRul
if (!entity.JobIds.IsNull() && entity.JobIds.Any())
entity.JobId = JsonHelper.ObjToJson(entity.JobIds);
var companyCode = await QueryCompanyCode();
if (companyCode != "Viavi")
if (entity.TrainType == "NewStaff")
{
if (!entity.ZoneIds.Any() &&
!entity.DeptIds.Any() &&
!entity.TitleIds.Any() &&
!entity.GradeIds.Any() &&
!entity.JobIds.Any())
throw new Exception("厂区、部门、职称、职等、岗位,至少填写任一个才能保存!");
}
var result = await base.Add(entity);
if (entity.Staffs != null && entity.Staffs.Any())
@ -239,6 +252,18 @@ public class Ghre_StudyRuleServices : BaseServices<Ghre_StudyRule, Ghre_StudyRul
if (!entity.JobIds.IsNull())
entity.JobId = JsonHelper.ObjToJson(entity.JobIds);
var companyCode = await QueryCompanyCode();
if (companyCode != "Viavi")
if (entity.TrainType == "NewStaff")
{
if (!entity.ZoneIds.Any() &&
!entity.DeptIds.Any() &&
!entity.TitleIds.Any() &&
!entity.GradeIds.Any() &&
!entity.JobIds.Any())
throw new Exception("厂区、部门、职称、职等、岗位,至少填写任一个才能保存!");
}
var result = await base.Update(Id, entity);
await _ghre_StudyRuleStaffServices.Delete(x => x.StudyRuleId == Id);

Loading…
Cancel
Save