From c696f654813e565884ec3379dc7c6532318efe8d Mon Sep 17 00:00:00 2001 From: liguoyang Date: Tue, 5 Mar 2024 15:53:40 +0800 Subject: [PATCH] =?UTF-8?q?fix=20=E5=A2=9E=E5=8A=A0PCode=E6=9D=A1=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../CommonJobs/CreateDefinitelyGroupJob.cs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/Src/Dlhis.ScheduledTask/CommonJobs/CreateDefinitelyGroupJob.cs b/Src/Dlhis.ScheduledTask/CommonJobs/CreateDefinitelyGroupJob.cs index 830c8086..af824291 100644 --- a/Src/Dlhis.ScheduledTask/CommonJobs/CreateDefinitelyGroupJob.cs +++ b/Src/Dlhis.ScheduledTask/CommonJobs/CreateDefinitelyGroupJob.cs @@ -1,5 +1,4 @@ -using System.Collections.Generic; -using Dlhis.Entity.Basic.Entity; +using Dlhis.Entity.Basic.Entity; using Dlhis.Entity.Device.Entities; using Dlhis.Entity.Device.Enums; using Dlhis.Sys.Api; @@ -117,7 +116,7 @@ public class CreateDefinitelyGroupJob foreach (var workplace in tenants.Where(x => x.PCode.IsEmpty())) { var workplaceName = $"*{type.GetDescription()}工作地系统组({workplace.Name})"; - var workplaceGrp = await _dbContext.Queryable().FirstAsync(x => x.Name == workplaceName); + var workplaceGrp = await _dbContext.Queryable().Where(x => x.PCode == topGrp.Code).FirstAsync(x => x.Name == workplaceName); if (workplaceGrp == null) { workplaceGrp = new DeviceGroupEntity @@ -140,7 +139,7 @@ public class CreateDefinitelyGroupJob foreach (var factory in tenants.Where(x => x.PCode == workplace.Code)) { var factoryName = $"*{type.GetDescription()}厂区系统组({factory.Name})"; - if (!await _dbContext.Queryable().AnyAsync(x => x.Name == factoryName)) + if (!await _dbContext.Queryable().Where(x => x.PCode == workplaceGrp.Code).AnyAsync(x => x.Name == factoryName)) { await _dbContext.InsertAsync(new DeviceGroupEntity {