Merge branch 'development' of https://git.dlhis.com/liguoyang/jinko.yikatong into development

This commit is contained in:
cheche
2024-03-05 16:03:59 +08:00

View File

@@ -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.Entities;
using Dlhis.Entity.Device.Enums; using Dlhis.Entity.Device.Enums;
using Dlhis.Sys.Api; using Dlhis.Sys.Api;
@@ -117,7 +116,7 @@ public class CreateDefinitelyGroupJob
foreach (var workplace in tenants.Where(x => x.PCode.IsEmpty())) foreach (var workplace in tenants.Where(x => x.PCode.IsEmpty()))
{ {
var workplaceName = $"*{type.GetDescription()}工作地系统组({workplace.Name})"; 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) if (workplaceGrp == null)
{ {
workplaceGrp = new DeviceGroupEntity workplaceGrp = new DeviceGroupEntity
@@ -140,7 +139,7 @@ public class CreateDefinitelyGroupJob
foreach (var factory in tenants.Where(x => x.PCode == workplace.Code)) foreach (var factory in tenants.Where(x => x.PCode == workplace.Code))
{ {
var factoryName = $"*{type.GetDescription()}厂区系统组({factory.Name})"; 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 await _dbContext.InsertAsync(new DeviceGroupEntity
{ {