diff --git a/Tiobon.Core.Services/Ghre/Ghre_StudyRuleServices.cs b/Tiobon.Core.Services/Ghre/Ghre_StudyRuleServices.cs index bafb4fed..3a5976e7 100644 --- a/Tiobon.Core.Services/Ghre/Ghre_StudyRuleServices.cs +++ b/Tiobon.Core.Services/Ghre/Ghre_StudyRuleServices.cs @@ -343,7 +343,33 @@ public class Ghre_StudyRuleServices : BaseServices x.StaffId).ToList(); + #region 抓取新入职员工 + var inStaffIds = new List(); + if (rule.TrainType == "NewStaff") + { + int month = 3; + var config = await Db.Queryable().Where(x => x.ConfigCode == "New_Staff_Month").FirstAsync(); + if (config != null) + { + try + { + month = Convert.ToInt32(config.ConfigValue); + } + catch (Exception) + { + + } + var dateTime = DateTime.Now.AddMonths(-month); + + inStaffIds = await Db.Queryable() + .Where(x => x.OutDate == null || (x.OutDate != null && x.Indate != null && x.Indate.Value.Date >= dateTime.Date && x.Indate.Value.Date <= DateTime.Now.Date)) + .Select(x => x.StaffID).ToListAsync(); + } + } + #endregion + var staffs = await Db.Queryable() + .WhereIF(inStaffIds.Any(), x => inStaffIds.Contains(x.StaffID)) .Where(x => x.OutDate == null || (x.OutDate != null && x.Indate != null && x.Indate.Value.Date <= DateTime.Now.Date && x.Indate.Value.Date >= DateTime.Now.Date)) .WhereIF(ZoneIds.Any(), x => ZoneIds.Contains(x.ZoneID)) .WhereIF(DeptIds.Any(), x => DeptIds.Contains(x.DeptID)) @@ -355,7 +381,7 @@ public class Ghre_StudyRuleServices : BaseServices().FirstAsync(x => x.CourseId == rule.CourseId); if (staffs.Any()) @@ -413,7 +439,7 @@ public class Ghre_StudyRuleServices : BaseServices o == staff.StaffID).Any() ? $"生成成功,{month}月内入职员工" : "生成成功" }); if (exam != null) diff --git a/Tiobon.Core.Services/ReportServices.cs b/Tiobon.Core.Services/ReportServices.cs index 6b14f85f..d346b482 100644 --- a/Tiobon.Core.Services/ReportServices.cs +++ b/Tiobon.Core.Services/ReportServices.cs @@ -45,7 +45,7 @@ public partial class ReportServices : BaseServices>, IReport if (filter.orderBy.IsNotEmptyOrNull()) filter.orderBy = "Indate DESC"; - condition = $"Indate >= '{DateTimeHelper.ConvertToDayString(dateTime)}' AND OutDate IS NULL"; + condition = $"Indate >= '{DateTimeHelper.ConvertToDayString(dateTime)}' AND Indate <= '{DateTimeHelper.ConvertToDayString(DateTime.Now)}' AND OutDate IS NULL"; var result = await _staffServices.QueryFilterPage(filter, condition, IsEnable); return result;