From ed3410155fed93ea38c11221c27a33b05102ced7 Mon Sep 17 00:00:00 2001 From: lilili Date: Thu, 23 Mar 2023 16:40:10 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4=E6=8B=A3=E6=96=99=E8=A1=A8?= =?UTF-8?q?=E6=9F=A5=E8=AF=A2=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../NFine.Application/WMS/PickMaterialApp.cs | 56 +++++++++---------- 1 file changed, 28 insertions(+), 28 deletions(-) diff --git a/WMS-BS/NFine.Application/WMS/PickMaterialApp.cs b/WMS-BS/NFine.Application/WMS/PickMaterialApp.cs index f4e415d..8bb836d 100644 --- a/WMS-BS/NFine.Application/WMS/PickMaterialApp.cs +++ b/WMS-BS/NFine.Application/WMS/PickMaterialApp.cs @@ -27,46 +27,46 @@ namespace NFine.Application.WMS DataTable dt = new DataTable(); var queryParam = queryJson.ToJObject(); List parameter = new List(); - string sql = ""; + StringBuilder sqlstring = new StringBuilder(); #region [SQL] - - // sql = @"select a.ID,b.MOCode as Code,a.Sequence,a.MTIME,a.MUSERName,a.MUSER,a.WHCode,c.WarehouseName,a.InvCode,d.InvName,d.InvDesc,d.InvStd,d.InvUnit, - //case when e.SourceID is null then '未合并' else '已合并' end as IsNew,a.Quantity - //from ICSMOPick a - //left join ICSMO b on a.MODetailID=b.MODetailID and a.WorkPoint=b.WorkPoint - //left join ICSWarehouse c on a.WHCode=c.WarehouseCode and a.WorkPoint=c.WorkPoint - //left join ICSInventory d on a.InvCode=d.InvCode and a.WorkPoint=d.WorkPoint - //left join ICSMOPickMerge e on a.ID=e.SourceID and a.WorkPoint=e.WorkPoint"; - // sql += " WHERE 1=1 and e.ID is null"; - - sql = @"select - a.MOCode as Code,a.CreateDateTime as MTIME,a.createperson as MUSER,case when max(d.SourceID) is null then '未合并' else '已合并' end as IsNew -,f.Colspan ,f.ProjectCode ,f.BatchCode ,f.Version ,f.Brand ,f.cFree1 ,f.cFree2 ,f.cFree3 ,f.cFree4 ,f.cFree5 ,f.cFree6 ,f.cFree7 ,f.cFree8 ,f.cFree9 ,f.cFree10 - - from ICSMO a - inner join ICSMOPick b on b.MODetailID=a.MODetailID and b.WorkPoint=a.WorkPoint - left join ICSMOPickMerge d on d.SourceID=b.ID and d.WorkPoint=b.WorkPoint - left join ICSExtension f on a.ExtensionID=f.ID and a.WorkPoint=f.WorkPoint - where a.WorkPoint='{0}' - group by a.MOCode, a.WorkPoint,a.CreateDateTime,a.createperson,f.Colspan ,f.ProjectCode ,f.BatchCode ,f.Version ,f.Brand ,f.cFree1 ,f.cFree2 ,f.cFree3 ,f.cFree4 -,f.cFree5 ,f.cFree6 ,f.cFree7 ,f.cFree8 ,f.cFree9 ,f.cFree10"; - sql = string.Format(sql, WorkPoint); - sql = string.Format(sql, DbHelper.GetErpIp(), DbHelper.GetErpName()); - #endregion + + // sql = @"select a.ID,b.MOCode as Code,a.Sequence,a.MTIME,a.MUSERName,a.MUSER,a.WHCode,c.WarehouseName,a.InvCode,d.InvName,d.InvDesc,d.InvStd,d.InvUnit, + //case when e.SourceID is null then '未合并' else '已合并' end as IsNew,a.Quantity + //from ICSMOPick a + //left join ICSMO b on a.MODetailID=b.MODetailID and a.WorkPoint=b.WorkPoint + //left join ICSWarehouse c on a.WHCode=c.WarehouseCode and a.WorkPoint=c.WorkPoint + //left join ICSInventory d on a.InvCode=d.InvCode and a.WorkPoint=d.WorkPoint + //left join ICSMOPickMerge e on a.ID=e.SourceID and a.WorkPoint=e.WorkPoint"; + // sql += " WHERE 1=1 and e.ID is null"; + + sqlstring.Append($@"select a.MOCode as Code,a.CreateDateTime as MTIME,a.createperson as MUSER, + case when max(d.SourceID) is null then '未合并' else '已合并' end as IsNew, + f.Colspan ,f.ProjectCode ,f.BatchCode ,f.Version ,f.Brand ,f.cFree1 , + f.cFree2 ,f.cFree3 ,f.cFree4 ,f.cFree5 ,f.cFree6 ,f.cFree7 ,f.cFree8 ,f.cFree9 ,f.cFree10 + from ICSMO a + inner join ICSMOPick b on b.MODetailID=a.MODetailID and b.WorkPoint=a.WorkPoint + left join ICSMOPickMerge d on d.SourceID=b.ID and d.WorkPoint=b.WorkPoint + left join ICSExtension f on a.ExtensionID=f.ID and a.WorkPoint=f.WorkPoint + where a.WorkPoint='{WorkPoint}' "); if (!string.IsNullOrWhiteSpace(queryJson)) { if (!string.IsNullOrWhiteSpace(queryParam["POCode"].ToString())) { - sql += " and b.MOCode like '%" + queryParam["POCode"].ToString() + "%' "; + sqlstring.Append($" and b.MOCode like '%{queryParam["POCode"]}%' "); } if (!string.IsNullOrWhiteSpace(queryParam["InvCode"].ToString())) { - sql += " and a.InvCode like '%" + queryParam["InvCode"].ToString() + "%' "; + sqlstring.Append($" and a.InvCode like '%{queryParam["InvCode"]}%' "); } } + + sqlstring.Append(@" group by a.MOCode, a.WorkPoint,a.CreateDateTime,a.createperson,f.Colspan,f.ProjectCode, + f.BatchCode ,f.Version ,f.Brand ,f.cFree1 ,f.cFree2 ,f.cFree3 ,f.cFree4, + f.cFree5 ,f.cFree6 ,f.cFree7 ,f.cFree8 ,f.cFree9 ,f.cFree10"); - return Repository().FindTablePageBySql(sql.ToString(), parameter.ToArray(), ref jqgridparam); + #endregion + return Repository().FindTablePageBySql(sqlstring.ToString(), parameter.ToArray(), ref jqgridparam); } //工单备料(工单子件)子表查询