From e6d2dda71cb0f134d92906e24e96b7d922ba3d45 Mon Sep 17 00:00:00 2001 From: zhoukeda <1315948824@qq.com> Date: Wed, 19 Jul 2023 13:37:36 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E4=BB=BB=E5=8A=A1=E5=8D=95?= =?UTF-8?q?=E8=B0=83=E6=95=B4=E5=88=97=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ProductionMgr/Tnb.ProductionMgr/PrdMoTaskService.cs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/ProductionMgr/Tnb.ProductionMgr/PrdMoTaskService.cs b/ProductionMgr/Tnb.ProductionMgr/PrdMoTaskService.cs index b53f0461..b73e6164 100644 --- a/ProductionMgr/Tnb.ProductionMgr/PrdMoTaskService.cs +++ b/ProductionMgr/Tnb.ProductionMgr/PrdMoTaskService.cs @@ -1642,6 +1642,14 @@ namespace Tnb.ProductionMgr Dictionary queryJson = !string.IsNullOrEmpty(input.queryJson) ? JsonConvert.DeserializeObject>(input.queryJson) : new Dictionary(); string moTaskCode = queryJson.ContainsKey("mo_task_code") ? queryJson["mo_task_code"].ToString() : ""; string eqpId = queryJson.ContainsKey("eqp_id") ? queryJson["eqp_id"].ToString() : ""; + List worklineIds = new List(); + List equipIds = new List(); + if (!string.IsNullOrEmpty(eqpId)) + { + worklineIds = await db.Queryable().Where(x => x.ParentId == eqpId && x.Category==DictConst.RegionCategoryWorklineCode && x.DeleteMark==null).Select(x=>x.Id).ToListAsync(); + equipIds = await db.Queryable().Where(x => x.equip_type_id == eqpId).Select(x => x.id).ToListAsync(); + } + var result = await db.Queryable() .LeftJoin((a, b) => a.material_id == b.id) .LeftJoin((a, b, c) => c.EnCode == DictConst.TaskStatus) @@ -1651,7 +1659,9 @@ namespace Tnb.ProductionMgr .LeftJoin((a,b,c,d,e,f,g)=>a.workline_id==g.Id) .LeftJoin((a,b,c,d,e,f,g,h)=>a.eqp_id==h.id) .WhereIF(!string.IsNullOrEmpty(moTaskCode), (a, b, c, d) => a.mo_task_code.Contains(moTaskCode)) - .WhereIF(!string.IsNullOrEmpty(eqpId), (a, b, c, d) => a.workline_id==eqpId || a.eqp_id==eqpId) + .WhereIF(!string.IsNullOrEmpty(eqpId) && equipIds.Count<=0 && worklineIds.Count<=0, (a, b, c, d) => a.workline_id==eqpId || a.eqp_id==eqpId) + .WhereIF(worklineIds.Count>0,(a, b, c, d)=>worklineIds.Contains(a.workline_id)) + .WhereIF(equipIds.Count>0,(a, b, c, d)=>equipIds.Contains(a.eqp_id)) .Select((a, b, c, d,e,f,g,h) => new WorkOrderAdjustmentListOutput { id = a.id,