Esempio n. 1
0
        /// <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);
        }
Esempio n. 2
0
        /// <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);
        }
Esempio n. 3
0
 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;
 }
Esempio n. 4
0
        /// <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);
        }
Esempio n. 5
0
        /// <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);
        }
Esempio n. 6
0
        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);
        }
Esempio n. 7
0
        /// <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);
        }
Esempio n. 8
0
        /// <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);
        }
Esempio n. 9
0
        /// <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);
        }
Esempio n. 10
0
 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;
 }
Esempio n. 11
0
        /// <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);
        }
Esempio n. 12
0
        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);
        }
Esempio n. 13
0
        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);
        }
Esempio n. 14
0
        /// <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);
        }
Esempio n. 15
0
        /// <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);
        }
Esempio n. 16
0
        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);
        }
Esempio n. 17
0
        public DataTable ReadConfig()
        {
            string sql = "SELECT * FROM ADMINISTRATOR.ThermalTest ";

            DB2Provider.DataLink link = new DB2Provider.DataLink();
            DataTable            dt   = link.ExcuteRetureTable(sql);

            return(dt);
        }
Esempio n. 18
0
 /// <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;
 }
Esempio n. 19
0
        /// <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);
        }
Esempio n. 20
0
        /// <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);
        }
Esempio n. 21
0
        /// <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);
        }
Esempio n. 22
0
        /// <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);
        }
Esempio n. 23
0
        /// <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);
        }
Esempio n. 24
0
        /// <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);
        }
Esempio n. 25
0
        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);
        }
Esempio n. 26
0
        /// <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);
        }
Esempio n. 27
0
        /// <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);
        }
Esempio n. 28
0
        /// <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);
        }
Esempio n. 29
0
        /// <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);
        }
Esempio n. 30
0
        /// <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);
        }
Esempio n. 31
0
        /// <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);
        }
Esempio n. 32
0
        /// <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;
        }
Esempio n. 33
0
 /// <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);
 }
Esempio n. 34
0
 /// <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;
 }
Esempio n. 35
0
 /// <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);
 }
Esempio n. 36
0
 /// <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;
 }
Esempio n. 37
0
 /// <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;
 }
Esempio n. 38
0
 /// <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;
 }
Esempio n. 39
0
 /// <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);
 }
Esempio n. 40
0
        /// <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);
        }
Esempio n. 41
0
 /// <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;
 }
Esempio n. 42
0
 /// <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);
 }
Esempio n. 43
0
 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;
 }
Esempio n. 44
0
 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;
 }
Esempio n. 45
0
 /// <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;
 }
Esempio n. 46
0
        /// <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;
        }
Esempio n. 47
0
 /// <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);
 }
Esempio n. 48
0
 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;
 }
Esempio n. 49
0
 public DataTable ReadConfig()
 {
     string sql = "SELECT * FROM ADMINISTRATOR.ThermalTest ";
     DB2Provider.DataLink link = new DB2Provider.DataLink();
     DataTable dt = link.ExcuteRetureTable(sql);
     return dt;
 }
Esempio n. 50
0
 /// <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;
 }
Esempio n. 51
0
 /// <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);
 }
Esempio n. 52
0
        /// <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;
        }
Esempio n. 53
0
 /// <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);
 }
Esempio n. 54
0
 /// <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);
 }