From 9f5c2398329285b35b6b3a6b6140aed476b80d9a Mon Sep 17 00:00:00 2001 From: liguoyang Date: Thu, 22 Feb 2024 15:00:21 +0800 Subject: [PATCH] =?UTF-8?q?fix=20=E8=80=83=E5=8B=A4=E4=BB=BB=E5=8A=A1?= =?UTF-8?q?=E7=94=9F=E6=88=90=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Src/Dlhis.ScheduledTask/Packs/JobPack.cs | 2 ++ .../TaskAssignment/Job/CreateGetAttendanceJob.cs | 9 ++++++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/Src/Dlhis.ScheduledTask/Packs/JobPack.cs b/Src/Dlhis.ScheduledTask/Packs/JobPack.cs index ec5b214d..5bccbd46 100644 --- a/Src/Dlhis.ScheduledTask/Packs/JobPack.cs +++ b/Src/Dlhis.ScheduledTask/Packs/JobPack.cs @@ -24,11 +24,13 @@ public class JobPack : BaseAppPack TimeZone = TimeZoneInfo.Local }); + //创建设备同步时间任务 RecurringJob.AddOrUpdate("SyncServerDateTime", s => s.RunAsync(), "0 0 0/1 * * ?", new RecurringJobOptions { TimeZone = TimeZoneInfo.Local }); + //创建设备获取考勤的任务 RecurringJob.AddOrUpdate("CreateGetAttendance", s => s.RunAsync(), "0 0/1 * * * ?", new RecurringJobOptions { TimeZone = TimeZoneInfo.Local diff --git a/Src/Dlhis.ScheduledTask/TaskAssignment/Job/CreateGetAttendanceJob.cs b/Src/Dlhis.ScheduledTask/TaskAssignment/Job/CreateGetAttendanceJob.cs index 90a1703a..2e57474d 100644 --- a/Src/Dlhis.ScheduledTask/TaskAssignment/Job/CreateGetAttendanceJob.cs +++ b/Src/Dlhis.ScheduledTask/TaskAssignment/Job/CreateGetAttendanceJob.cs @@ -23,16 +23,19 @@ public class CreateGetAttendanceJob _dbContext.Client.QueryFilter.ClearAndBackup(); try { - var devices = await _dbContext.Queryable().Where(x => x.Enable).ToListAsync(); - devices = devices.Where(x => x.Funcs.Contains(DeviceFuncEnumType.Attendance)).ToList(); + var devices = await _dbContext.Queryable() + .Where(x => x.Enable) + .Where(x => x.Type == DeviceTypeEnumType.Attendance || (x.Type == DeviceTypeEnumType.Door && x.AsAttendance)) + .ToListAsync(); var ds = devices.Select(x => x.UniqueNo).ToList(); - var b = await _dbContext.Queryable() + var b = await _dbContext.Queryable() .Where(x => ds.Contains(x.DeviceUniqueNo)) .Where(x => x.Type == DeviceTaskEnumType.UploadRecord) .Where(x => x.Status == DeviceTaskStatusEnumType.Process) .AnyAsync(); + if (b) { return;