From 10cc93cf7639fdf3ffbf181a17c05d236a4df52b Mon Sep 17 00:00:00 2001 From: liguoyang Date: Thu, 29 Feb 2024 13:43:53 +0800 Subject: [PATCH] =?UTF-8?q?fix=20=E8=BF=87=E6=BB=A4=E6=AD=A3=E5=9C=A8?= =?UTF-8?q?=E5=A4=84=E7=90=86=E7=9A=84=E4=B8=8A=E4=BC=A0=E4=BB=BB=E5=8A=A1?= =?UTF-8?q?=E8=AE=BE=E5=A4=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../TaskAssignment/Job/CreateGetUploadRecordJob.cs | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/Src/Dlhis.ScheduledTask/TaskAssignment/Job/CreateGetUploadRecordJob.cs b/Src/Dlhis.ScheduledTask/TaskAssignment/Job/CreateGetUploadRecordJob.cs index 4b2b9062..3a53294b 100644 --- a/Src/Dlhis.ScheduledTask/TaskAssignment/Job/CreateGetUploadRecordJob.cs +++ b/Src/Dlhis.ScheduledTask/TaskAssignment/Job/CreateGetUploadRecordJob.cs @@ -29,16 +29,14 @@ public class CreateGetUploadRecordJob || x.Type == DeviceTypeEnumType.Door) .ToListAsync(); - var uniqueNos = devices.Select(x => x.UniqueNo).ToList(); //过滤处理中的任务 - uniqueNos = await _dbContext.Queryable() - .Where(x => !uniqueNos.Contains(x.DeviceUniqueNo)) - .Where(x => x.Type == DeviceTaskEnumType.UploadRecord) - .Where(x => x.Status == DeviceTaskStatusEnumType.Process || x.Status == DeviceTaskStatusEnumType.Wait) - .Select(x => x.DeviceUniqueNo) - .ToListAsync(); + var currentUniqueNos = await _dbContext.Queryable() + .Where(x => x.Type == DeviceTaskEnumType.UploadRecord) + .Where(x => x.Status == DeviceTaskStatusEnumType.Process || x.Status == DeviceTaskStatusEnumType.Wait) + .Select(x => x.DeviceUniqueNo) + .ToListAsync(); - var tasks = devices.Where(x => uniqueNos.Contains(x.UniqueNo)).Select(x => new DeviceTaskEntity + var tasks = devices.Where(x => !currentUniqueNos.Contains(x.UniqueNo)).Select(x => new DeviceTaskEntity { DeviceUniqueNo = x.UniqueNo, Status = DeviceTaskStatusEnumType.Wait,