fix 增加PCode条件
This commit is contained in:
@@ -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<DeviceGroupEntity>().FirstAsync(x => x.Name == workplaceName);
|
||||
var workplaceGrp = await _dbContext.Queryable<DeviceGroupEntity>().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<DeviceGroupEntity>().AnyAsync(x => x.Name == factoryName))
|
||||
if (!await _dbContext.Queryable<DeviceGroupEntity>().Where(x => x.PCode == workplaceGrp.Code).AnyAsync(x => x.Name == factoryName))
|
||||
{
|
||||
await _dbContext.InsertAsync(new DeviceGroupEntity
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user