From a587eb8d7c3b7626780d4dfb9a40a5a1ffa4f343 Mon Sep 17 00:00:00 2001 From: "qianhao.xu" Date: Wed, 19 Jun 2024 10:30:05 +0800 Subject: [PATCH] =?UTF-8?q?=E7=82=B9=E6=A3=80=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ZR.Service/MES/dev/DeviceAccountService.cs | 52 +++++++++++++--------- 1 file changed, 30 insertions(+), 22 deletions(-) diff --git a/ZR.Service/MES/dev/DeviceAccountService.cs b/ZR.Service/MES/dev/DeviceAccountService.cs index 2274b83..81146fd 100644 --- a/ZR.Service/MES/dev/DeviceAccountService.cs +++ b/ZR.Service/MES/dev/DeviceAccountService.cs @@ -99,6 +99,35 @@ namespace ZR.Service.MES.dev } + public PagedInfo GetList_Point(DeviceAccountQueryDto3 parm) + { + var predicate = Expressionable.Create() + .AndIF(!string.IsNullOrEmpty(parm.DeviceName), (a, r) => a.DeviceName.Contains(parm.DeviceName)) + .AndIF(!string.IsNullOrEmpty(parm.DeviceSpecification), (a, r) => a.DeviceSpecification.Contains(parm.DeviceSpecification)) + .And((a, r) => a.Status == 1) + .AndIF(parm.FkDeviceType > 0, (a, r) => a.FkDeviceType == parm.FkDeviceType) + .And((a, r) => r.FkPointInspectionPlanId == parm.fkPointInspectionPlanId) + ; + + + var temp = Context.Queryable() + .LeftJoin((a, r) => a.Id == r.FkDeviceAccountId) + .Where(predicate.ToExpression()).Select((a, r) => a); + + + if (parm.Flag == 0) + { + int[] exist = temp.Select(a => a.Id).ToArray(); + temp = Context.Queryable().Where(it => !exist.Contains(it.Id)).Distinct(); + } + + + var reponse = temp + .ToPage(parm); + + return reponse; + } + /// /// 获取详情 @@ -238,28 +267,7 @@ namespace ZR.Service.MES.dev } #region 点检和设备绑定关系 - public PagedInfo GetList_Point(DeviceAccountQueryDto3 parm) - { - var predicate = Expressionable.Create() - .AndIF(!string.IsNullOrEmpty(parm.DeviceName), (a, r) => a.DeviceName.Contains(parm.DeviceName)) - .AndIF(!string.IsNullOrEmpty(parm.DeviceSpecification), (a, r) => a.DeviceSpecification.Contains(parm.DeviceSpecification)) - .And((a, r) => a.Status == 1) - .AndIF(parm.FkDeviceType > 0, (a, r) => a.FkDeviceType == parm.FkDeviceType) - .AndIF(parm.Flag == 1, (a, r) => r.FkPointInspectionPlanId == parm.fkPointInspectionPlanId) - .AndIF(parm.Flag == 0, (a, r) => r.FkPointInspectionPlanId != parm.fkPointInspectionPlanId || r.FkPointInspectionPlanId == null) - ; - - - var response = Context.Queryable() - .LeftJoin((a, r) => a.Id == r.FkDeviceAccountId) - .Where(predicate.ToExpression()) - .Select((a, r) => a) - .ToPage(parm); - - - return response; - } - + /// /// 添加绑定关系 巡检计划和设备台账