/// <summary> /// 修改全局配置 /// </summary> public void EditConfig(Config info) { string sql = "UPDATE ADMINISTRATOR.THERMALTESTCFG SET DefaultInterval=" + info.DefaultInterval + " ,MinInterval=" + info.MinInterval + ",MaxSampleCondition=" + info.MaxSampleCondition + ",DefaultTestDuration=" + info.DefaultTestDuration + ",MaxTestDuration=" + info.MaxTestDuration + " WHERE ID_KEY =" + info.ID_KEY + ""; DB2Provider.DataLink link = new DB2Provider.DataLink(); link.Excute(sql); }
/// <summary> /// 删除实验报告数据 /// </summary> /// <param name="reportid"></param> public void DeleteReport(int reportid) { string sql = "DELETE FROM ADMINISTRATOR.THERMALTESTREPORT WHERE ReportId=" + reportid; DB2Provider.DataLink link = new DB2Provider.DataLink(); link.Excute(sql); }
public DataTable GetReportResult(string colReportId) { string sql = "SELECT * FROM ADMINISTRATOR.THERMALTESTREPORT WHERE ReportID IN " + colReportId + " ORDER BY PARAID"; DB2Provider.DataLink link = new DB2Provider.DataLink(); DataTable dt = link.ExcuteRetureTable(sql); return dt; }
/// <summary> /// 被动终止实验 /// </summary> /// <param name="reportName">实验报告名</param> public void BDEndTest(int reportId, int value) { string sql = "UPDATE ADMINISTRATOR.ThermalTest SET UserState=" + value + " WHERE ReportID=" + reportId + ""; DB2Provider.DataLink link = new DB2Provider.DataLink(); link.Excute(sql); }
/// <summary> /// 重算实验 /// </summary> public void ReCountTest() { string sql = "UPDATE ADMINISTRATOR.ThermalTest SET UserState=7 WHERE ReportID=" + ReportID + ""; DB2Provider.DataLink link = new DB2Provider.DataLink(); link.Excute(sql); }
public DataTable GetExpriment(string startTime, string endTime, int id_key) { DataTable dt = null; string sql = ""; if (startTime == "") { if (endTime == "") { if (id_key == 0) { sql = "SELECT ReportID,ReportName FROM ADMINISTRATOR.ThermalTest WHERE USERSTATE=4 AND TestState=4 "; } else { sql = "SELECT ReportID,ReportName FROM ADMINISTRATOR.ThermalTest WHERE USERSTATE=4 AND TESTTemplateID=" + id_key + " AND TestState=4 "; } } else { if (id_key == 0) { sql = "SELECT ReportID,ReportName FROM ADMINISTRATOR.ThermalTest WHERE TestCalBegin <= '" + endTime + "' AND USERSTATE=4 AND TestState=4"; } else { sql = "SELECT ReportID,ReportName FROM ADMINISTRATOR.ThermalTest WHERE TestCalBegin <= '" + endTime + "' AND TESTTemplateID=" + id_key + " AND USERSTATE=4 AND TestState=4"; } } } else { if (endTime == "") { if (id_key == 0) { sql = "SELECT ReportID,ReportName FROM ADMINISTRATOR.ThermalTest WHERE TestCalBegin >= '" + startTime + "' AND USERSTATE=4 AND TestState=4"; } else { sql = "SELECT ReportID,ReportName FROM ADMINISTRATOR.ThermalTest WHERE TestCalBegin >= '" + startTime + "' AND TESTTemplateID=" + id_key + " AND USERSTATE=4 AND TestState=4 "; } } else { if (id_key == 0) { sql = "SELECT ReportID,ReportName FROM ADMINISTRATOR.ThermalTest WHERE TestCalBegin BETWEEN '" + startTime + "' AND '" + endTime + "' AND USERSTATE=4 AND TestState=4"; } else { sql = "SELECT ReportID,ReportName FROM ADMINISTRATOR.ThermalTest WHERE TestCalBegin BETWEEN '" + startTime + "' AND '" + endTime + "' AND TESTTemplateID=" + id_key + " AND USERSTATE=4 AND TestState=4"; } } } DB2Provider.DataLink link = new DB2Provider.DataLink(); dt = link.ExcuteRetureTable(sql); return(dt); }
/// <summary> /// 删除实验 /// </summary> /// <param name="reportid"></param> public void DeleteTest(int reportid) { string sql = "DELETE FROM ADMINISTRATOR.ThermalTest WHERE ReportId=" + reportid; DB2Provider.DataLink link = new DB2Provider.DataLink(); link.Excute(sql); }
/// <summary> /// 新增全局配置 /// </summary> public void InsertConfig() { string sql = "INSERT INTO ADMINISTRAIR.THERMALTESTCFG(DefaultInterval,MinInterval,MaxSampleCondition,DefaultTestDuration,MaxTestDuration) VALUES (" + DefaultInterval + "," + MinInterval + "," + MaxSampleCondition + "," + DefaultTestDuration + "," + MaxTestDuration + ")"; DB2Provider.DataLink link = new DB2Provider.DataLink(); link.Excute(sql); }
/// <summary> /// 更新配置参数 /// </summary> /// <param name="id_key"></param> /// <param name="formula"></param> public void Edit(int id_key, string formula) { string sql = "UPDATE ADMINISTRATOR.THERMALTESTPARA SET FORMULA='" + formula + "' WHERE ID_KEY=" + id_key; DB2Provider.DataLink link = new DB2Provider.DataLink(); link.Excute(sql); }
public DataTable GetReportResult(string colReportId) { string sql = "SELECT * FROM ADMINISTRATOR.THERMALTESTREPORT AS R LEFT JOIN THERMALTESTTEMPLATE AS T ON R.PARAID=T.PARAID WHERE R.ReportID IN " + colReportId + " ORDER BY T.SN"; DB2Provider.DataLink link = new DB2Provider.DataLink(); DataTable dt = link.ExcuteRetureTable(sql); return dt; }
/// <summary> /// 主动终止实验 /// </summary> /// <param name="reportName">实验报告名</param> public void EndTest(int reportId) { string sql = "UPDATE ADMINISTRATOR.ThermalTest SET TestState=5,UserState=5 WHERE ReportID=" + reportId + ""; DB2Provider.DataLink link = new DB2Provider.DataLink(); link.Excute(sql); }
public DataTable GetTest(string reportId) { string sql = "SELECT * FROM ADMINISTRATOR.ThermalTest WHERE REPORTID IN " + reportId; DB2Provider.DataLink link = new DB2Provider.DataLink(); DataTable dt = link.ExcuteRetureTable(sql); return(dt); }
public DataTable GetEditPara(string isEdit) { DataTable dt = null; string sql = "SELECT * FROM ADMINISTRATOR.THERMALTESTPARA WHERE ISEDIT='" + isEdit + "'"; DB2Provider.DataLink link = new DB2Provider.DataLink(); dt = link.ExcuteRetureTable(sql); return(dt); }
/// <summary> /// 获取热力试验工况 /// </summary> ///<param name="unitId">机组ID</param> ///<param name="templateId">模板ID</param> /// <returns></returns> public DataTable GetThermalTestRequirement(string unitId, string templateId) { string sql = "SELECT * FROM ADMINISTRATOR.THERMALTESTREQUIREMENT WHERE UNITID='" + unitId + "' and TEMPLATEID=" + templateId + ""; DB2Provider.DataLink link = new DB2Provider.DataLink(); DataTable dt = link.ExcuteRetureTable(sql); return(dt); }
/// <summary> /// 获取所有完成实验 /// </summary> /// <returns></returns> public DataTable GetFinishExpriment() { string sql = "SELECT ReportID,ReportName,TESTER,TESTCALBEGIN,TESTCALEND FROM ADMINISTRATOR.ThermalTest WHERE TESTSTATE=4 AND USERSTATE=4 "; DB2Provider.DataLink link = new DB2Provider.DataLink(); DataTable dt = link.ExcuteRetureTable(sql); return(dt); }
public DataTable GetReportResult(string colReportId) { string sql = "SELECT * FROM ADMINISTRATOR.THERMALTESTREPORT AS R LEFT JOIN THERMALTESTTEMPLATE AS T ON R.PARAID=T.PARAID WHERE R.ReportID IN " + colReportId + " ORDER BY T.SN"; DB2Provider.DataLink link = new DB2Provider.DataLink(); DataTable dt = link.ExcuteRetureTable(sql); return(dt); }
public DataTable ReadConfig() { string sql = "SELECT * FROM ADMINISTRATOR.ThermalTest "; DB2Provider.DataLink link = new DB2Provider.DataLink(); DataTable dt = link.ExcuteRetureTable(sql); return(dt); }
/// <summary> /// 获取实验报告值 /// </summary> /// <param name="reportid"></param> /// <param name="paraid"></param> /// <returns></returns> public string GetReportValue(string reportid, string paraid) { string value = ""; string sql = "SELECT VALUE FROM ADMINISTRATOR.THERMALTESTREPORT WHERE PARAID='" + paraid + "' AND ReportId=" + reportid; DB2Provider.DataLink link = new DB2Provider.DataLink(); object obj = link.GetFirstValue(sql); if (obj != null) value = obj.ToString(); return value; }
/// <summary> /// 模糊查询实验报告 /// </summary> /// <param name="reportName">实验名</param> /// <returns></returns> public DataTable GetReportByLikeName(string reportName) { if (reportName == "") { return(null); } string sql = "SELECT ReportName FROM ADMINISTRATOR.ThermalTest WHERE ReportName LIKE '" + reportName + "'%"; DB2Provider.DataLink link = new DB2Provider.DataLink(); DataTable dt = link.ExcuteRetureTable(sql); return(dt); }
/// <summary> /// 判断实验是否正在进行 /// </summary> /// <returns></returns> public bool IsDoingExpriment() { bool flag = false; string sql = "SELECT * FROM ADMINISTRATOR.ThermalTest WHERE teststate=1 or teststate=2 or teststate=3"; DB2Provider.DataLink link = new DB2Provider.DataLink(); DataTable dt = link.ExcuteRetureTable(sql); if (dt != null && dt.Rows.Count > 0) { flag = true; } return(flag); }
/// <summary> /// 获取配置号 /// </summary> /// <param name="desc"></param> /// <returns></returns> public string GetParaID(string desc) { string paraID = ""; DB2Provider.DataLink link = new DB2Provider.DataLink(); string sql = "SELECT PARAID FROM ADMINISTRATOR.THERMALTESTPARA WHERE DESC='" + desc + "'"; object obj = link.GetFirstValue(sql); if (obj != null && obj.ToString() != "") { paraID = obj.ToString(); } return(paraID); }
/// <summary> /// 获取实验报告值 /// </summary> /// <param name="reportid"></param> /// <param name="paraid"></param> /// <returns></returns> public string GetReportValue(string reportid, string paraid) { string value = ""; string sql = "SELECT VALUE FROM ADMINISTRATOR.THERMALTESTREPORT WHERE PARAID='" + paraid + "' AND ReportId=" + reportid; DB2Provider.DataLink link = new DB2Provider.DataLink(); object obj = link.GetFirstValue(sql); if (obj != null) { value = obj.ToString(); } return(value); }
/// <summary> /// 获取Y值 /// </summary> /// <param name="unitId"></param> /// <param name="templateId"></param> /// <param name="testCondition"></param> /// <returns></returns> public string GetY(string unitId, string templateId, string testCondition) { string value = string.Empty; string sql = "SELECT LEAKTHRESHOLD FROM ADMINISTRATOR.THERMALTESTREQUIREMENT WHERE UNITID='" + unitId + "' and TEMPLATEID=" + templateId + " and TESTCONDITION='" + testCondition + "'"; DB2Provider.DataLink link = new DB2Provider.DataLink(); DataTable dt = link.ExcuteRetureTable(sql); if (dt != null && dt.Rows.Count > 0) { if (dt.Rows[0][0].ToString() != "") { value = dt.Rows[0][0].ToString(); } } return(value); }
/// <summary> /// 获取X值 /// </summary> /// <param name="reportId"></param> /// <returns></returns> public string GetX(int reportId) { string value = string.Empty; string sql = "SELECT VALUE FROM ADMINISTRATOR.THERMALTESTREPORT WHERE REPORTID=" + reportId + " AND PARAID='Rleak_O'"; DB2Provider.DataLink link = new DB2Provider.DataLink(); DataTable dt = link.ExcuteRetureTable(sql); if (dt != null && dt.Rows.Count > 0) { if (dt.Rows[0][0].ToString() != "") { value = dt.Rows[0][0].ToString(); } } return(value); }
public DateTime GetCurTestTime(int reportId) { DateTime dTime = new DateTime(); string sql = "SELECT CurTestTime FROM ADMINISTRATOR.ThermalTest WHERE ReportID=" + reportId + ""; DB2Provider.DataLink link = new DB2Provider.DataLink(); DataTable dt = link.ExcuteRetureTable(sql); if (dt != null && dt.Rows.Count > 0) { if (dt.Rows[0][0].ToString() != "") { dTime = Convert.ToDateTime(dt.Rows[0][0]); } } return(dTime); }
/// <summary> /// 是否存在全局配置 /// </summary> /// <returns></returns> public bool IsExitConfig() { bool flag = true; string sql = "SELECT COUNT(*) FROM ADMINISTRATOR.THERMALTESTCFG "; DB2Provider.DataLink link = new DB2Provider.DataLink(); DataTable dt = link.ExcuteRetureTable(sql); if (dt != null) { if (dt.Rows.Count == 0) { flag = false; } } return(flag); }
/// <summary> /// 开始新实验 /// </summary> public void InsertTest(UserState userState, ThermalTestReport report) { //string sql = "INSERT INTO ADMINISTRATOR.ThermalTestReport(TestTemplateID,ReportName,Tester,TestBegin,TestDuration,SampleInterval,TestCalBegin,TestCalEnd,CurTestTime,TestState,UserState) VALUES ("; //sql += "" + TestTemplateID + ",'" + ReportName + "','" + Tester + "','" + TestBegin + "'," + TestDuration + "," + SampleInterval + ",'" + TestCalBegin + "','" + TestCalEnd + "'," + CurTestTime + ",0,0)"; string sql = "INSERT INTO ADMINISTRATOR.ThermalTest(TESTTemplateID,TESTCONDITION,ReportName,UNITID,Tester,TestBegin,TestDuration,SampleInterval,TestCalBegin,TestState,UserState) VALUES ("; if (userState == UserState.New) { sql += "" + report.TESTTemplateID + ",'" + report.TESTCondition + "','" + report.ReportName + "','" + report.UNITID + "','" + report.Tester + "','" + report.TestBegin.ToString().Replace("/", "-") + "'," + report.TestDuration + "," + report.SampleInterval + ",'" + report.TestCalBegin.ToString().Replace("/", "-") + "',1,6)"; } else if (userState == UserState.Wait) { sql += "" + report.TESTTemplateID + ",'" + report.TESTCondition + "','" + report.ReportName + "','" + report.UNITID + "','" + report.Tester + "','" + report.TestBegin.ToString().Replace("/", "-") + "'," + report.TestDuration + "," + report.SampleInterval + ",'" + report.TestCalBegin.ToString().Replace("/", "-") + "',1,8)"; } DB2Provider.DataLink link = new DB2Provider.DataLink(); link.Excute(sql); }
/// <summary> /// 判断参数是否存在 /// </summary> /// <param name="paraID"></param> /// <returns></returns> public bool IsExitPara(string paraID) { bool flag = true; string sql = "SELECT count(*) FROM ADMINISTRATOR.THERMALTESTPARA WHERE PARAID='" + paraID + "'"; DB2Provider.DataLink link = new DB2Provider.DataLink(); DataTable dt = link.ExcuteRetureTable(sql); if (dt != null && dt.Rows.Count > 0) { if (dt.Rows[0][0].ToString() == "0") { flag = false; } } return(flag); }
/// <summary> /// 获取相同机组相同实验报告次数 /// </summary> /// <param name="templateID">实验报告编号</param> /// <param name="dateTime">实验日期</param> /// <returns></returns> public int GetReportCount(int templateID, string dateTime) { string minTime = dateTime + " 00:00:00.0"; string maxTime = dateTime + " 24:00:00.0"; int reportCount = 0; string sql = "SELECT COUNT(*) FROM ADMINISTRATOR.ThermalTest WHERE TESTTemplateID=" + TESTTemplateID + " AND TestCalBegin BETWEEN '" + minTime + "' AND '" + maxTime + "'"; DB2Provider.DataLink link = new DB2Provider.DataLink(); object obj = link.GetFirstValue(sql); if (obj != null) { reportCount = Convert.ToInt32(obj) + 1; } else { reportCount++; } return(reportCount); }
/// <summary> /// 获取最大报告号 /// </summary> /// <returns></returns> public int GetMaxReportId() { int maxReportId = 0; string sql = "SELECT MAX(REPORTID) FROM ADMINISTRATOR.ThermalTest"; DB2Provider.DataLink link = new DB2Provider.DataLink(); try { object obj = link.GetFirstValue(sql); if (obj != null) { maxReportId = Convert.ToInt32(link.GetFirstValue(sql)); } } catch (Exception ex) { throw ex; } return(maxReportId); }
/// <summary> /// 获取描述与单位 /// </summary> /// <param name="paraID"></param> /// <returns></returns> public string GetParaDescUnit(string paraID) { string desc = ""; DB2Provider.DataLink link = new DB2Provider.DataLink(); //string sql = "SELECT DESC||'('||UNIT||')' FROM ADMINISTRATOR.THERMALTESTPARA WHERE PARAID='" + paraID + "'"; string sql = "SELECT DESC,UNIT FROM ADMINISTRATOR.THERMALTESTPARA WHERE PARAID='" + paraID + "'"; DataTable dt = link.ExcuteRetureTable(sql); if (dt != null && dt.Rows.Count > 0) { if (dt.Rows[0][1].ToString() != "") { desc = dt.Rows[0][0].ToString() + "(" + dt.Rows[0][1].ToString() + ")"; } else { desc = dt.Rows[0][0].ToString(); } } return(desc); }
/// <summary> /// 模糊查询实验报告 /// </summary> /// <param name="reportName">实验名</param> /// <returns></returns> public DataTable GetReportByLikeName(string reportName) { if (reportName == "") return null; string sql = "SELECT ReportName FROM ADMINISTRATOR.ThermalTest WHERE ReportName LIKE '" + reportName + "'%"; DB2Provider.DataLink link = new DB2Provider.DataLink(); DataTable dt = link.ExcuteRetureTable(sql); return dt; }
/// <summary> /// 是否存在全局配置 /// </summary> /// <returns></returns> public bool IsExitConfig() { bool flag=true; string sql = "SELECT COUNT(*) FROM ADMINISTRATOR.THERMALTESTCFG "; DB2Provider.DataLink link = new DB2Provider.DataLink(); DataTable dt = link.ExcuteRetureTable(sql); if (dt != null ) { if (dt.Rows.Count == 0) flag = false; } return flag; }
/// <summary> /// 判断实验是否正在进行 /// </summary> /// <returns></returns> public bool IsDoingExpriment() { bool flag=false; string sql = "SELECT * FROM ADMINISTRATOR.ThermalTest WHERE teststate=1 or teststate=2 or teststate=3"; DB2Provider.DataLink link = new DB2Provider.DataLink(); DataTable dt = link.ExcuteRetureTable(sql); if (dt != null && dt.Rows.Count > 0) flag = true; return flag; }
/// <summary> /// 获取Y值 /// </summary> /// <param name="unitId"></param> /// <param name="templateId"></param> /// <param name="testCondition"></param> /// <returns></returns> public string GetY(string unitId, string templateId, string testCondition) { string value = string.Empty; string sql = "SELECT LEAKTHRESHOLD FROM ADMINISTRATOR.THERMALTESTREQUIREMENT WHERE UNITID='" + unitId + "' and TEMPLATEID=" + templateId + " and TESTCONDITION='"+testCondition+"'"; DB2Provider.DataLink link = new DB2Provider.DataLink(); DataTable dt = link.ExcuteRetureTable(sql); if (dt != null && dt.Rows.Count > 0) if (dt.Rows[0][0].ToString() != "") value = dt.Rows[0][0].ToString(); return value; }
/// <summary> /// 获取热力试验工况 /// </summary> ///<param name="unitId">机组ID</param> ///<param name="templateId">模板ID</param> /// <returns></returns> public DataTable GetThermalTestRequirement(string unitId, string templateId) { string sql = "SELECT * FROM ADMINISTRATOR.THERMALTESTREQUIREMENT WHERE UNITID='" + unitId + "' and TEMPLATEID=" + templateId + ""; DB2Provider.DataLink link = new DB2Provider.DataLink(); DataTable dt = link.ExcuteRetureTable(sql); return dt; }
/// <summary> /// 被动终止实验 /// </summary> /// <param name="reportName">实验报告名</param> public void BDEndTest(int reportId,int value) { string sql = "UPDATE ADMINISTRATOR.ThermalTest SET UserState="+value+" WHERE ReportID=" + reportId + ""; DB2Provider.DataLink link = new DB2Provider.DataLink(); link.Excute(sql); }
/// <summary> /// /// </summary> /// <param name="startTime"></param> /// <param name="endTime"></param> /// <param name="id_key">模板</param> /// <param name="unitId">机组id</param> /// <returns></returns> public DataTable GetExpriment(string startTime, string endTime, string id_key, string unitId) { DataTable dt = null; string sql = ""; if (startTime == "") { if (endTime == "") { if (id_key == "0" || String.IsNullOrEmpty(id_key)) { sql = "SELECT ReportID,ReportName FROM ADMINISTRATOR.ThermalTest WHERE USERSTATE=4 AND TestState=4 "; } else { sql = "SELECT ReportID,ReportName FROM ADMINISTRATOR.ThermalTest WHERE USERSTATE=4 AND TESTTemplateID IN (" + id_key + ") AND TestState=4 "; } } else { if (id_key == "0" || String.IsNullOrEmpty(id_key)) { sql = "SELECT ReportID,ReportName FROM ADMINISTRATOR.ThermalTest WHERE TestCalBegin <= '" + endTime + "' AND USERSTATE=4 AND TestState=4"; } else { sql = "SELECT ReportID,ReportName FROM ADMINISTRATOR.ThermalTest WHERE TestCalBegin <= '" + endTime + "' AND TESTTemplateID IN(" + id_key + ") AND USERSTATE=4 AND TestState=4"; } } } else { if (endTime == "") { if (id_key == "0" || String.IsNullOrEmpty(id_key)) { sql = "SELECT ReportID,ReportName FROM ADMINISTRATOR.ThermalTest WHERE TestCalBegin >= '" + startTime + "' AND USERSTATE=4 AND TestState=4"; } else { sql = "SELECT ReportID,ReportName FROM ADMINISTRATOR.ThermalTest WHERE TestCalBegin >= '" + startTime + "' AND TESTTemplateID IN(" + id_key + ") AND USERSTATE=4 AND TestState=4 "; } } else { if (id_key == "0" || String.IsNullOrEmpty(id_key)) { sql = "SELECT ReportID,ReportName FROM ADMINISTRATOR.ThermalTest WHERE TestCalBegin BETWEEN '" + startTime + "' AND '" + endTime + "' AND USERSTATE=4 AND TestState=4"; } else { sql = "SELECT ReportID,ReportName FROM ADMINISTRATOR.ThermalTest WHERE TestCalBegin BETWEEN '" + startTime + "' AND '" + endTime + "' AND TESTTemplateID IN(" + id_key + ") AND USERSTATE=4 AND TestState=4"; } } } if (unitId != "0" || !String.IsNullOrEmpty(unitId)) { sql += " AND UNITID='" + unitId + "'"; } DB2Provider.DataLink link = new DB2Provider.DataLink(); dt = link.ExcuteRetureTable(sql); return(dt); }
/// <summary> /// 获取相同机组相同实验报告次数 /// </summary> /// <param name="templateID">实验报告编号</param> /// <param name="dateTime">实验日期</param> /// <returns></returns> public int GetReportCount(int templateID,string dateTime) { string minTime = dateTime + " 00:00:00.0"; string maxTime = dateTime + " 24:00:00.0"; int reportCount=0; string sql = "SELECT COUNT(*) FROM ADMINISTRATOR.ThermalTest WHERE TESTTemplateID=" + TESTTemplateID + " AND TestCalBegin BETWEEN '" + minTime + "' AND '" + maxTime + "'"; DB2Provider.DataLink link = new DB2Provider.DataLink(); object obj = link.GetFirstValue(sql); if (obj != null) reportCount = Convert.ToInt32(obj) + 1; else reportCount++; return reportCount; }
public DataTable GetTest(string reportId) { string sql = "SELECT * FROM ADMINISTRATOR.ThermalTest WHERE REPORTID IN " + reportId; DB2Provider.DataLink link = new DB2Provider.DataLink(); DataTable dt = link.ExcuteRetureTable(sql); return dt; }
public DateTime GetCurTestTime(int reportId) { DateTime dTime = new DateTime(); string sql = "SELECT CurTestTime FROM ADMINISTRATOR.ThermalTest WHERE ReportID=" + reportId + ""; DB2Provider.DataLink link = new DB2Provider.DataLink(); DataTable dt = link.ExcuteRetureTable(sql); if (dt != null && dt.Rows.Count > 0) if (dt.Rows[0][0].ToString() != "") dTime = Convert.ToDateTime(dt.Rows[0][0]); return dTime; }
/// <summary> /// 获取X值 /// </summary> /// <param name="reportId"></param> /// <returns></returns> public string GetX(int reportId) { string value = string.Empty; string sql = "SELECT VALUE FROM ADMINISTRATOR.THERMALTESTREPORT WHERE REPORTID=" + reportId + " AND PARAID='Rleak_O'"; DB2Provider.DataLink link = new DB2Provider.DataLink(); DataTable dt = link.ExcuteRetureTable(sql); if (dt != null && dt.Rows.Count > 0) if (dt.Rows[0][0].ToString() != "") value = dt.Rows[0][0].ToString(); return value; }
/// <summary> /// /// </summary> /// <param name="startTime"></param> /// <param name="endTime"></param> /// <param name="id_key">模板</param> /// <param name="unitId">机组id</param> /// <returns></returns> public DataTable GetExpriment(string startTime, string endTime, string id_key,string unitId) { DataTable dt = null; string sql = ""; if (startTime == "") { if (endTime == "") { if (id_key == "0"||String.IsNullOrEmpty(id_key)) sql = "SELECT ReportID,ReportName FROM ADMINISTRATOR.ThermalTest WHERE USERSTATE=4 AND TestState=4 "; else sql = "SELECT ReportID,ReportName FROM ADMINISTRATOR.ThermalTest WHERE USERSTATE=4 AND TESTTemplateID IN (" + id_key + ") AND TestState=4 "; } else { if (id_key == "0" || String.IsNullOrEmpty(id_key)) sql = "SELECT ReportID,ReportName FROM ADMINISTRATOR.ThermalTest WHERE TestCalBegin <= '" + endTime + "' AND USERSTATE=4 AND TestState=4"; else sql = "SELECT ReportID,ReportName FROM ADMINISTRATOR.ThermalTest WHERE TestCalBegin <= '" + endTime + "' AND TESTTemplateID IN(" + id_key + ") AND USERSTATE=4 AND TestState=4"; } } else { if (endTime == "") { if (id_key == "0" || String.IsNullOrEmpty(id_key)) sql = "SELECT ReportID,ReportName FROM ADMINISTRATOR.ThermalTest WHERE TestCalBegin >= '" + startTime + "' AND USERSTATE=4 AND TestState=4"; else sql = "SELECT ReportID,ReportName FROM ADMINISTRATOR.ThermalTest WHERE TestCalBegin >= '" + startTime + "' AND TESTTemplateID IN(" + id_key + ") AND USERSTATE=4 AND TestState=4 "; } else { if (id_key == "0" || String.IsNullOrEmpty(id_key)) sql = "SELECT ReportID,ReportName FROM ADMINISTRATOR.ThermalTest WHERE TestCalBegin BETWEEN '" + startTime + "' AND '" + endTime + "' AND USERSTATE=4 AND TestState=4"; else sql = "SELECT ReportID,ReportName FROM ADMINISTRATOR.ThermalTest WHERE TestCalBegin BETWEEN '" + startTime + "' AND '" + endTime + "' AND TESTTemplateID IN(" + id_key + ") AND USERSTATE=4 AND TestState=4"; } } if (unitId != "0" || !String.IsNullOrEmpty(unitId)) { sql += " AND UNITID='"+unitId+"'"; } DB2Provider.DataLink link = new DB2Provider.DataLink(); dt = link.ExcuteRetureTable(sql); return dt; }
/// <summary> /// 开始新实验 /// </summary> public void InsertTest(UserState userState,ThermalTestReport report) { //string sql = "INSERT INTO ADMINISTRATOR.ThermalTestReport(TestTemplateID,ReportName,Tester,TestBegin,TestDuration,SampleInterval,TestCalBegin,TestCalEnd,CurTestTime,TestState,UserState) VALUES ("; //sql += "" + TestTemplateID + ",'" + ReportName + "','" + Tester + "','" + TestBegin + "'," + TestDuration + "," + SampleInterval + ",'" + TestCalBegin + "','" + TestCalEnd + "'," + CurTestTime + ",0,0)"; string sql = "INSERT INTO ADMINISTRATOR.ThermalTest(TESTTemplateID,TESTCONDITION,ReportName,UNITID,Tester,TestBegin,TestDuration,SampleInterval,TestCalBegin,TestState,UserState) VALUES ("; if (userState == UserState.New) sql += "" + report.TESTTemplateID + ",'" + report.TESTCondition + "','" + report.ReportName + "','" + report.UNITID + "','" + report.Tester + "','" + report.TestBegin.ToString().Replace("/", "-") + "'," + report.TestDuration + "," + report.SampleInterval + ",'" + report.TestCalBegin.ToString().Replace("/", "-") + "',1,6)"; else if (userState == UserState.Wait) sql += "" + report.TESTTemplateID + ",'" + report.TESTCondition + "','" + report.ReportName + "','" + report.UNITID + "','" + report.Tester + "','" + report.TestBegin.ToString().Replace("/", "-") + "'," + report.TestDuration + "," + report.SampleInterval + ",'" + report.TestCalBegin.ToString().Replace("/", "-") + "',1,8)"; DB2Provider.DataLink link = new DB2Provider.DataLink(); link.Excute(sql); }
public DataTable GetFinishExpriment(string startTime, string endTime, int id_key) { string sql = "SELECT ReportID,ReportName FROM ADMINISTRATOR.ThermalTest WHERE TestCalBegin BETWEEN '" + startTime + "' AND '" + endTime + "' AND TESTTemplateID=" + id_key + " AND USERSTATE=4 AND TestState=4"; if (id_key == 0) sql = "SELECT ReportID,ReportName FROM ADMINISTRATOR.ThermalTest WHERE TestCalBegin BETWEEN '" + startTime + "' AND '" + endTime + "' AND USERSTATE=4 AND TestState=4"; DB2Provider.DataLink link = new DB2Provider.DataLink(); DataTable dt = link.ExcuteRetureTable(sql); return dt; }
public DataTable ReadConfig() { string sql = "SELECT * FROM ADMINISTRATOR.ThermalTest "; DB2Provider.DataLink link = new DB2Provider.DataLink(); DataTable dt = link.ExcuteRetureTable(sql); return dt; }
/// <summary> /// 获取所有完成实验 /// </summary> /// <returns></returns> public DataTable GetFinishExpriment() { string sql = "SELECT ReportID,ReportName,TESTER,TESTCALBEGIN,TESTCALEND FROM ADMINISTRATOR.ThermalTest WHERE TESTSTATE=4 AND USERSTATE=4 "; DB2Provider.DataLink link = new DB2Provider.DataLink(); DataTable dt = link.ExcuteRetureTable(sql); return dt; }
/// <summary> /// 新增全局配置 /// </summary> public void InsertConfig() { string sql = "INSERT INTO ADMINISTRAIR.THERMALTESTCFG(DefaultInterval,MinInterval,MaxSampleCondition,DefaultTestDuration,MaxTestDuration) VALUES ("+DefaultInterval+","+MinInterval+","+MaxSampleCondition+","+DefaultTestDuration+","+MaxTestDuration+")"; DB2Provider.DataLink link = new DB2Provider.DataLink(); link.Excute(sql); }
/// <summary> /// 获取最大报告号 /// </summary> /// <returns></returns> public int GetMaxReportId() { int maxReportId=0; string sql = "SELECT MAX(REPORTID) FROM ADMINISTRATOR.ThermalTest"; DB2Provider.DataLink link = new DB2Provider.DataLink(); try { object obj = link.GetFirstValue(sql); if (obj != null) maxReportId = Convert.ToInt32(link.GetFirstValue(sql)); } catch(Exception ex) { throw ex; } return maxReportId; }