点检添加设备null值判断

This commit is contained in:
2025-09-26 17:31:41 +08:00
parent 5c87bccb26
commit 038fdd1133

View File

@@ -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<int>();
List<int> typeIds = new();
// 二级菜单
if (typeItem != null && typeItem.ParentId == 1)
{
// 提取三级子类id
typeIds = Context.Queryable<DeviceType>()
.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<DeviceRelPpAt> DeviceRelRpAt_list = new List<DeviceRelPpAt>();
if (parm.FkDeviceAccountIdList == null)
{
return 0;
}
if (parm.FkDeviceAccountIdList.Length > 0)
{