From 038fdd1133d9903bdccbd55fb83767c656b12f21 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B5=B5=E6=AD=A3=E6=98=93?= Date: Fri, 26 Sep 2025 17:31:41 +0800 Subject: [PATCH] =?UTF-8?q?=E7=82=B9=E6=A3=80=E6=B7=BB=E5=8A=A0=E8=AE=BE?= =?UTF-8?q?=E5=A4=87null=E5=80=BC=E5=88=A4=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ZR.Service/mes/Device/DeviceAccountService.cs | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/ZR.Service/mes/Device/DeviceAccountService.cs b/ZR.Service/mes/Device/DeviceAccountService.cs index 6f963287..aa28e87c 100644 --- a/ZR.Service/mes/Device/DeviceAccountService.cs +++ b/ZR.Service/mes/Device/DeviceAccountService.cs @@ -35,15 +35,17 @@ namespace ZR.Service.MES.dev .Where(it => it.Id == parm.FkDeviceType) .Where(it => it.Status == 1) .First(); - int[] typeIds = Array.Empty(); + List typeIds = new(); // 二级菜单 if (typeItem != null && typeItem.ParentId == 1) { + // 提取三级子类id typeIds = Context.Queryable() .Where(it => it.ParentId == parm.FkDeviceType) .Where(it => it.Status == 1) .Select(it => it.Id) - .ToArray(); + .ToList(); + typeIds.Add(parm.FkDeviceType); } // 非全部设备 @@ -53,7 +55,9 @@ namespace ZR.Service.MES.dev .AndIF(!string.IsNullOrEmpty(parm.DeviceName), it => it.DeviceName.Contains(parm.DeviceName)) .AndIF(!string.IsNullOrEmpty(parm.DeviceSpecification), it => it.DeviceSpecification.Contains(parm.DeviceSpecification)) .AndIF(parm.Status > -1, it => it.Status == parm.Status) + // 点击三级 .AndIF(typeItem != null && typeItem.ParentId > 1, it => it.FkDeviceType == parm.FkDeviceType) + // 点击二级 .AndIF(typeItem != null && typeItem.ParentId == 1, it => typeIds.Contains(it.FkDeviceType)) ; @@ -410,7 +414,10 @@ namespace ZR.Service.MES.dev public int AddRelationPointAccount(DeviceAccount_pointinspect_Dto parm, string CreatedBy) { List DeviceRelRpAt_list = new List(); - + if (parm.FkDeviceAccountIdList == null) + { + return 0; + } if (parm.FkDeviceAccountIdList.Length > 0) {