diff --git a/Src/Dlhis.Canteen/Voucher/Services/Implements/BirthdayVoucherService.cs b/Src/Dlhis.Canteen/Voucher/Services/Implements/BirthdayVoucherService.cs index fd818319..cd819005 100644 --- a/Src/Dlhis.Canteen/Voucher/Services/Implements/BirthdayVoucherService.cs +++ b/Src/Dlhis.Canteen/Voucher/Services/Implements/BirthdayVoucherService.cs @@ -245,6 +245,7 @@ public class BirthdayVoucherService : BaseVoucherService, IVoucherService .Where(x => x.Birthday.HasValue) //.Where(x => !string.IsNullOrEmpty(x.CostId)) // 正常情况:匹配当天生日 + // 注意:LW 劳务派遣工号统一在下方返回前过滤,不能在此处 SQL 过滤,否则留痕事件无法写入 .WhereIF(isToday && !includeLeapDayBirthday, x => SqlFunc.DateValue(x.Birthday.Value, DateType.Month) == begin.Month && SqlFunc.DateValue(x.Birthday.Value, DateType.Day) == begin.Day) // 特殊情况:非闰年的2月28日,同时匹配当天生日和2月29日生日 .WhereIF(isToday && includeLeapDayBirthday, x => @@ -272,12 +273,17 @@ public class BirthdayVoucherService : BaseVoucherService, IVoucherService { events.Add(new UserBusinessEventEntity { UserCode = gainfo.Code, EventType = "GenerateBirthdayVoucher", Content = "成本中心为空" }); } + else if (gainfo.Code.StartsWith("LW", StringComparison.OrdinalIgnoreCase)) + { + events.Add(new UserBusinessEventEntity { UserCode = gainfo.Code, EventType = "GenerateBirthdayVoucher", Content = "LW工号劳务不发放生日券" }); + } } return (gainfos .Where(x => x.DepartmentNo.IsPresent()) .Where(x => !excludePositionNos.Contains(x.PositionNo)) .Where(x => x.CostId.IsPresent()) + .Where(x => !x.Code.StartsWith("LW", StringComparison.OrdinalIgnoreCase))//排除劳务派遣工号(LW 开头) .ToList(), events); } diff --git a/Src/Dlhis.ScheduledTask/Jobs/BirthdayCostUploadJob.cs b/Src/Dlhis.ScheduledTask/Jobs/BirthdayCostUploadJob.cs index 72379328..d3c8b036 100644 --- a/Src/Dlhis.ScheduledTask/Jobs/BirthdayCostUploadJob.cs +++ b/Src/Dlhis.ScheduledTask/Jobs/BirthdayCostUploadJob.cs @@ -33,7 +33,6 @@ public class BirthdayCostUploadJob : BaseJob var endDayOfMonth = e.AddDays(-1); var userCodeAll = await DbContext.Queryable() - .Where(x => !x.UserCode.StartsWith("LW")) .Select(x => x.UserCode) .Distinct() .ToListAsync();