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) {