From e8181a7e073d8c734f07ffdf01395590fb8fba62 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E6=9D=BE=E7=94=B7?= <446507344@qq.com> Date: Tue, 26 Sep 2023 13:04:22 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4=E6=88=90=E9=83=BD=E6=88=90?= =?UTF-8?q?=E5=93=81=E4=BF=A1=E6=81=AF=E6=9F=A5=E8=AF=A2=E5=AF=BC=E5=87=BA?= =?UTF-8?q?=E4=BF=A1=E6=81=AF=E4=B8=8D=E5=85=A8=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../QMAPP.FJC.DAL/Operation/ProductEndDAL.cs | 25 +++++++++++++++---- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/APPQ5/QMAPP.FJC.DAL/Operation/ProductEndDAL.cs b/APPQ5/QMAPP.FJC.DAL/Operation/ProductEndDAL.cs index 51cfe21..0f6e379 100644 --- a/APPQ5/QMAPP.FJC.DAL/Operation/ProductEndDAL.cs +++ b/APPQ5/QMAPP.FJC.DAL/Operation/ProductEndDAL.cs @@ -218,7 +218,7 @@ namespace QMAPP.FJC.DAL.Operation sqlBuilder.Append("SELECT M.PID "); sqlBuilder.AppendLine(" ,M.PRODUCTTYPE "); sqlBuilder.AppendLine(" ,M.PRODUCTCODE "); - sqlBuilder.AppendLine(" ,main.MAINCODE "); + sqlBuilder.AppendLine(" ,CASE WHEN main.MAINCODE is null THEN M.PLAN_NO ELSE main.MAINCODE END as 'MAINCODE' "); sqlBuilder.AppendLine(" ,M.MACHINENAME "); sqlBuilder.AppendLine(" ,M.MACHINECODDE "); sqlBuilder.AppendLine(" ,M.MATERIAL_CODE "); @@ -261,6 +261,9 @@ namespace QMAPP.FJC.DAL.Operation sqlBuilder.Append(" LEFT JOIN T_MD_MATERIAL_CLASS MC ON MC.MATERIAL_TYPE_CODE=MA.MATERIAL_TYPE_CODE "); sqlBuilder.Append(" LEFT JOIN T_MD_WORKCENTER W ON W.WORKCENTER_CODE=M.WORKCENTER_CODE "); sqlBuilder.Append(" LEFT JOIN T_AW_MAIN main ON main.EPIDERMISCODE=M.PRODUCTCODE "); + + #region 查询条件 + //查询条件 whereBuilder.Append(" AND MC.MATERIAL_ATTRIBUTE ='2'"); @@ -310,16 +313,22 @@ namespace QMAPP.FJC.DAL.Operation if (string.IsNullOrEmpty(condition.VIN) == false) { - whereBuilder.AppendFormat(" AND M.VIN LIKE '%{0}%' ",condition.VIN); + whereBuilder.AppendFormat(" AND M.VIN_REV LIKE '{0}%' ", new string(condition.VIN.Reverse().ToArray())); //parameters.Add(new DataParameter { ParameterName = "VIN", DataType = DbType.String, Value = condition.VIN }); } - if (string.IsNullOrEmpty(condition.KIN) == false) + if (string.IsNullOrEmpty(condition.PLAN_NO) == false) { - whereBuilder.AppendFormat(" AND M.KIN LIKE '%{0}%' ",condition.KIN); - //parameters.Add(new DataParameter { ParameterName = "KIN", DataType = DbType.String, Value = condition.KIN }); + whereBuilder.AppendFormat(" AND M.PLAN_NO_REV LIKE '{0}%' ", new string(condition.PLAN_NO.Reverse().ToArray())); + //parameters.Add(new DataParameter { ParameterName = "VIN", DataType = DbType.String, Value = condition.VIN }); } + //if (string.IsNullOrEmpty(condition.KIN) == false) + //{ + // whereBuilder.AppendFormat(" AND M.KIN LIKE '%{0}%' ", condition.KIN); + // //parameters.Add(new DataParameter { ParameterName = "KIN", DataType = DbType.String, Value = condition.KIN }); + //} + if (string.IsNullOrEmpty(condition.STARTCREATEDATE) == false) { whereBuilder.Append(" AND M.CREATEDATE >= @STARTCREATEDATE"); @@ -334,7 +343,12 @@ namespace QMAPP.FJC.DAL.Operation { sqlBuilder.Append(" WHERE " + whereBuilder.ToString().Substring(4)); } + return sqlBuilder.ToString(); + + #endregion + + } catch (Exception ex) { @@ -695,6 +709,7 @@ namespace QMAPP.FJC.DAL.Operation using (IDataSession session = AppDataFactory.CreateMainSession()) { dt = session.GetTable(sql, parameters.ToArray()); + dt.TableName = "T_AW_PRODUCT"; } return dt;