From ab080e6cb3a182ed866e4f8b3b0f51d54b8c9b87 Mon Sep 17 00:00:00 2001 From: xiaochanghai Date: Fri, 17 Jan 2025 16:21:30 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BF=85=E9=80=89=E9=A1=B9=E8=A7=84=E5=88=99?= =?UTF-8?q?=E8=AE=BE=E5=AE=9A=20=E6=96=B0=E4=BA=BA=E5=85=A5=E8=81=8C?= =?UTF-8?q?=E5=9F=B9=E8=AE=AD=EF=BC=8C=E6=96=B0=E5=A2=9E=E5=8F=82=E6=95=B0?= =?UTF-8?q?=E6=8E=A7=E5=88=B6=E8=87=AA=E5=8A=A8=E5=8C=B9=E9=85=8D=E6=96=B0?= =?UTF-8?q?=E5=85=A5=E8=81=8C=E4=BA=BA=E5=91=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Ghre/Ghre_StudyRuleServices.cs | 30 +++++++++++++++++-- Tiobon.Core.Services/ReportServices.cs | 2 +- 2 files changed, 29 insertions(+), 3 deletions(-) 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;