张松男 1 year ago
parent
commit
760c56f8c3
  1. 25
      APPQ5/QMAPP.FJC.DAL/Operation/ProductEndDAL.cs

25
APPQ5/QMAPP.FJC.DAL/Operation/ProductEndDAL.cs

@ -218,7 +218,7 @@ namespace QMAPP.FJC.DAL.Operation
sqlBuilder.Append("SELECT M.PID "); sqlBuilder.Append("SELECT M.PID ");
sqlBuilder.AppendLine(" ,M.PRODUCTTYPE "); sqlBuilder.AppendLine(" ,M.PRODUCTTYPE ");
sqlBuilder.AppendLine(" ,M.PRODUCTCODE "); 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.MACHINENAME ");
sqlBuilder.AppendLine(" ,M.MACHINECODDE "); sqlBuilder.AppendLine(" ,M.MACHINECODDE ");
sqlBuilder.AppendLine(" ,M.MATERIAL_CODE "); 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_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_MD_WORKCENTER W ON W.WORKCENTER_CODE=M.WORKCENTER_CODE ");
sqlBuilder.Append(" LEFT JOIN T_AW_MAIN main ON main.EPIDERMISCODE=M.PRODUCTCODE "); sqlBuilder.Append(" LEFT JOIN T_AW_MAIN main ON main.EPIDERMISCODE=M.PRODUCTCODE ");
#region 查询条件
//查询条件 //查询条件
whereBuilder.Append(" AND MC.MATERIAL_ATTRIBUTE ='2'"); whereBuilder.Append(" AND MC.MATERIAL_ATTRIBUTE ='2'");
@ -310,16 +313,22 @@ namespace QMAPP.FJC.DAL.Operation
if (string.IsNullOrEmpty(condition.VIN) == false) 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 }); //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); whereBuilder.AppendFormat(" AND M.PLAN_NO_REV LIKE '{0}%' ", new string(condition.PLAN_NO.Reverse().ToArray()));
//parameters.Add(new DataParameter { ParameterName = "KIN", DataType = DbType.String, Value = condition.KIN }); //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) if (string.IsNullOrEmpty(condition.STARTCREATEDATE) == false)
{ {
whereBuilder.Append(" AND M.CREATEDATE >= @STARTCREATEDATE"); whereBuilder.Append(" AND M.CREATEDATE >= @STARTCREATEDATE");
@ -334,7 +343,12 @@ namespace QMAPP.FJC.DAL.Operation
{ {
sqlBuilder.Append(" WHERE " + whereBuilder.ToString().Substring(4)); sqlBuilder.Append(" WHERE " + whereBuilder.ToString().Substring(4));
} }
return sqlBuilder.ToString(); return sqlBuilder.ToString();
#endregion
} }
catch (Exception ex) catch (Exception ex)
{ {
@ -695,6 +709,7 @@ namespace QMAPP.FJC.DAL.Operation
using (IDataSession session = AppDataFactory.CreateMainSession()) using (IDataSession session = AppDataFactory.CreateMainSession())
{ {
dt = session.GetTable(sql, parameters.ToArray()); dt = session.GetTable(sql, parameters.ToArray());
dt.TableName = "T_AW_PRODUCT"; dt.TableName = "T_AW_PRODUCT";
} }
return dt; return dt;

Loading…
Cancel
Save