/// <summary> /// 得到查询零件信息的条件SQL /// </summary> public string GetQueryWhereSql(string codeFileNameStr, string codeNoStr, string codeNameStr, string codeSpecStr, string materialVersionStr, string designerStr, string catgNameStr, int materialInt, string unitStr, string brandStr, int machiningLevelInt, int finishInt, int isPreferredInt, int isLongPeriodInt, int isPreciousInt, int isPreprocessingInt, int isBuyInt, string getTimeBeginStr, string getTimeEndStr, string commonStr) { string sqlStr = " 1=1"; if (codeFileNameStr != "") { sqlStr += string.Format(" and CodeFileName like '%{0}%'", codeFileNameStr); } if (codeNoStr != "") { sqlStr += string.Format(" and CodeNo like '%{0}%'", codeNoStr); } if (codeNameStr != "") { sqlStr += string.Format(" and CodeName like '%{0}%'", codeNameStr); } if (codeSpecStr != "") { sqlStr += string.Format(" and CodeSpec like '%{0}%'", codeSpecStr); } if (materialVersionStr != "") { sqlStr += string.Format(" and MaterialVersion like '%{0}%'", materialVersionStr); } if (designerStr != "") { sqlStr += string.Format(" and Designer like '%{0}%'", designerStr); } if (catgNameStr != "") { sqlStr += string.Format(" and CatgName='{0}'", catgNameStr); } if (materialInt != 0) { sqlStr += string.Format(" and Material={0}", materialInt); } if (unitStr != "") { sqlStr += string.Format(" and Unit='{0}'", unitStr); } if (brandStr != "") { sqlStr += string.Format(" and Brand='{0}'", brandStr); } if (machiningLevelInt != 0) { sqlStr += string.Format(" and MachiningLevel={0}", machiningLevelInt); } if (finishInt != 0) { sqlStr += string.Format(" and Finish={0}", finishInt); } if (isPreferredInt != -1) { sqlStr += string.Format(" and IsPreferred={0}", isPreferredInt); } if (isLongPeriodInt != -1) { sqlStr += string.Format(" and IsLongPeriod={0}", isLongPeriodInt); } if (isPreciousInt != -1) { sqlStr += string.Format(" and IsPrecious={0}", isPreciousInt); } if (isPreprocessingInt != -1) { sqlStr += string.Format(" and IsPreprocessing={0}", isPreprocessingInt); } if (isBuyInt != -1) { sqlStr += string.Format(" and IsNull(IsBuy,0)={0}", isBuyInt); } if (getTimeBeginStr != "") { sqlStr += BaseSQL.GetDateRegion_SingleColumn_WhereSql("GetTime", getTimeBeginStr, getTimeEndStr); } if (commonStr != "") { sqlStr += string.Format(" and (CodeNo like '%{0}%' or CodeFileName like '%{0}%' or CodeName like '%{0}%' or FilePath like '%{0}%' or CatgName like '%{0}%' or CodeSpec like '%{0}%' or Brand like '%{0}%' or Unit like '%{0}%' or Designer like '%{0}%' or Tel like '%{0}%')", commonStr); } return(sqlStr); }