点检添加设备null值判断
This commit is contained in:
@@ -35,15 +35,17 @@ namespace ZR.Service.MES.dev
|
|||||||
.Where(it => it.Id == parm.FkDeviceType)
|
.Where(it => it.Id == parm.FkDeviceType)
|
||||||
.Where(it => it.Status == 1)
|
.Where(it => it.Status == 1)
|
||||||
.First();
|
.First();
|
||||||
int[] typeIds = Array.Empty<int>();
|
List<int> typeIds = new();
|
||||||
// 二级菜单
|
// 二级菜单
|
||||||
if (typeItem != null && typeItem.ParentId == 1)
|
if (typeItem != null && typeItem.ParentId == 1)
|
||||||
{
|
{
|
||||||
|
// 提取三级子类id
|
||||||
typeIds = Context.Queryable<DeviceType>()
|
typeIds = Context.Queryable<DeviceType>()
|
||||||
.Where(it => it.ParentId == parm.FkDeviceType)
|
.Where(it => it.ParentId == parm.FkDeviceType)
|
||||||
.Where(it => it.Status == 1)
|
.Where(it => it.Status == 1)
|
||||||
.Select(it => it.Id)
|
.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.DeviceName), it => it.DeviceName.Contains(parm.DeviceName))
|
||||||
.AndIF(!string.IsNullOrEmpty(parm.DeviceSpecification), it => it.DeviceSpecification.Contains(parm.DeviceSpecification))
|
.AndIF(!string.IsNullOrEmpty(parm.DeviceSpecification), it => it.DeviceSpecification.Contains(parm.DeviceSpecification))
|
||||||
.AndIF(parm.Status > -1, it => it.Status == parm.Status)
|
.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 => it.FkDeviceType == parm.FkDeviceType)
|
||||||
|
// 点击二级
|
||||||
.AndIF(typeItem != null && typeItem.ParentId == 1, it => typeIds.Contains(it.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)
|
public int AddRelationPointAccount(DeviceAccount_pointinspect_Dto parm, string CreatedBy)
|
||||||
{
|
{
|
||||||
List<DeviceRelPpAt> DeviceRelRpAt_list = new List<DeviceRelPpAt>();
|
List<DeviceRelPpAt> DeviceRelRpAt_list = new List<DeviceRelPpAt>();
|
||||||
|
if (parm.FkDeviceAccountIdList == null)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
if (parm.FkDeviceAccountIdList.Length > 0)
|
if (parm.FkDeviceAccountIdList.Length > 0)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user