Exemplo n.º 1
0
    private void BindReport(string startTime, string endTime, string id_key, string unitId)
    {
        Bussiness.ThermalTestReport report = new Bussiness.ThermalTestReport();

        DataTable dt = report.GetExpriment(startTime, endTime, id_key, unitId);

        if (dt.Rows.Count == 0)
        {
            dt.Rows.Add(dt.NewRow());
            grvFeeInfo.DataSource = dt;
            grvFeeInfo.DataBind();
            int columnCount = grvFeeInfo.Rows[0].Cells.Count;
            grvFeeInfo.Rows[0].Cells.Clear();
            grvFeeInfo.Rows[0].Cells.Add(new TableCell());
            grvFeeInfo.Rows[0].Cells[0].ColumnSpan      = columnCount;
            grvFeeInfo.Rows[0].Cells[0].BorderColor     = System.Drawing.Color.Black;
            grvFeeInfo.Rows[0].Cells[0].HorizontalAlign = HorizontalAlign.Left;
            grvFeeInfo.Rows[0].Cells[0].Text            = "暂时没有信息";
            grvFeeInfo.Rows[0].Cells[0].Style.Add("text-align", "center");
        }
        else
        {
            this.grvFeeInfo.DataSource = dt;
            this.grvFeeInfo.DataBind();
        }
    }
Exemplo n.º 2
0
 protected void Page_Load(object sender, EventArgs e)
 {
     int reportId = Convert.ToInt32(Request.QueryString["reportid"]);
     if (!IsPostBack)
     {
         Bussiness.ThermalTestReport report = new Bussiness.ThermalTestReport();
         DataTable dt = report.GetTest(reportId);
         this.grvFeeInfo.DataSource = dt;
         this.grvFeeInfo.DataBind();
     }
 }
Exemplo n.º 3
0
    protected void Page_Load(object sender, EventArgs e)
    {
        int reportId = Convert.ToInt32(Request.QueryString["reportid"]);

        if (!IsPostBack)
        {
            Bussiness.ThermalTestReport report = new Bussiness.ThermalTestReport();
            DataTable dt = report.GetTest(reportId);
            this.grvFeeInfo.DataSource = dt;
            this.grvFeeInfo.DataBind();
        }
    }
Exemplo n.º 4
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);
        }
Exemplo n.º 5
0
    //protected void ddlCompute_SelectedIndexChanged(object sender, EventArgs e)
    //{
    //    BindExprimentName();
    //    //ddlExperiment_SelectedIndexChanged(null, null);
    //}
    protected void btnSearch_Click(object sender, EventArgs e)
    {
        if (ddlUnit.SelectedValue == "0")
        {
            JScript.Alert("请选择机组!");
            BindReport(this.calStartTime.Text, this.calEndTime.Text, "0", ddlUnit.SelectedValue.Trim());

            return;
        }
        Bussiness.ThermalTestReport report = new Bussiness.ThermalTestReport();
        //DataTable dt = report.GetFinishExpriment(this.calStartTime.Text, this.calEndTime.Text, Convert.ToInt32(this.ddlExperiment.SelectedValue));
        //DataTable dt = report.GetExpriment(this.calStartTime.Text, this.calEndTime.Text, Convert.ToInt32(this.ddlExperiment.SelectedValue));
        //this.grvFeeInfo.DataSource = dt;
        //this.grvFeeInfo.DataBind();
        Bussiness.ThermalTestTemplate TestTemplate = new Bussiness.ThermalTestTemplate();
        //int templateId = TestTemplate.GetTemplateID(this.ddlExperiment.SelectedValue, this.ddlCompute.SelectedValue);

        DataTable dt = null;

        if (this.ddlExperiment.SelectedValue != "0")
        {
            dt = TestTemplate.GetTemplateIDs(this.ddlExperiment.SelectedValue, this.ddlUnit.SelectedValue);
            string templateId = "";
            if (dt != null && dt.Rows.Count > 0)
            {
                foreach (DataRow dr in dt.Rows)
                {
                    templateId += dr[0].ToString() + ",";
                }
                templateId = templateId.Substring(0, templateId.Length - 1);
            }

            BindReport(this.calStartTime.Text, this.calEndTime.Text, templateId, ddlUnit.SelectedValue.Trim());
        }
        else
        {
            BindReport(this.calStartTime.Text, this.calEndTime.Text, "0", ddlUnit.SelectedValue.Trim());
        }


        //BindReport(this.calStartTime.Text, this.calEndTime.Text, templateId);
    }
Exemplo n.º 6
0
    /// <summary>
    /// 实时更新试验进度
    /// </summary>
    public void UpdateState()
    {
        ThermalTestReport report = new ThermalTestReport();
        report.TestBegin = Convert.ToDateTime(this.calSYStartTime.Text);
        int curReportId = report.GetMaxReportId();
        string state = report.GetTest(curReportId).Rows[0]["TESTSTATE"].ToString();
        double roral = report.GetDiffTime(curReportId) / Convert.ToInt32(this.txtSYTime.Value) * 100;
        if (state != "4" && state != "8" && state != "9" && state != "10" && state != "11")
        {
            this.Label1.Text = this.txtReportName.Value + "试验正在进行已完成" + roral.ToString("0") + "%";
        }
        else if (state == "8")
        {
            this.Timer1.Enabled = false;
            //JScript.Alert("不明泄漏率计算失败,试验终止!");
            ScriptManager.RegisterStartupScript(this.UpdatePanel1, this.GetType(), "updateScript", "alert('不明泄漏率计算失败,试验终止!');", true);
            report.BDEndTest(curReportId,5);
            this.Timer1.Enabled = false;
            //this.btnView.Enabled = true;
            //this.hddMaxReportID.Value = curReportId.ToString();
        }
        else if (state == "10")
        {
            string x = report.GetX(curReportId);
            string y = report.GetY(ddlUnit.SelectedValue.Trim(), ddlSYName.SelectedValue.Trim(),ddlSYGK.SelectedItem.Text.Trim());
            ScriptManager.RegisterStartupScript(this.UpdatePanel1, this.GetType(), "updateScript", "confir('"+x+"','"+y+"')", true);
            //this.ClientScript.RegisterStartupScript(this.GetType(), "msgbox", "return confirm('" + x + "?');", true);
            //return confirm('不明泄漏率为x,超出限值y,是否继续试验?')
            if (hidvalue.Value == "1")
            {
                report.BDEndTest(curReportId, 12);
                this.Timer1.Enabled = false;
            }
            else
            {
                report.BDEndTest(curReportId, 5);
            }
        }
        else if (state == "11")
        {
            ScriptManager.RegisterStartupScript(this.UpdatePanel1, this.GetType(), "updateScript", "alert('数据处理失败,试验终止!');", true);
            report.BDEndTest(curReportId, 5);
            this.Timer1.Enabled = false;
        }
        else if (state == "9")
        {
            string x = report.GetX(curReportId);
            string y = report.GetY(ddlUnit.SelectedValue.Trim(), ddlSYName.SelectedValue.Trim(), ddlSYGK.SelectedItem.Text.Trim());
            ScriptManager.RegisterStartupScript(this.UpdatePanel1, this.GetType(), "updateScript", "alert('不明泄漏率'" + x + "'在限值'" + y + "'范围内,试验继续!');", true);
            report.BDEndTest(curReportId, 12);
        }
        else
        {
            this.Label1.Text = this.txtReportName.Value + "试验已完成100%";
            btnStartEnd.Text = "开始试验";
            this.btnView.Enabled = true;
            this.hddMaxReportID.Value = curReportId.ToString();
            this.Timer1.Enabled = false;

        }
    }
Exemplo n.º 7
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            BindCompany();

            this.Timer1.Enabled = false;
            //BindReportName();
            this.Session["bl"] = 0;

            Bussiness.Config config = new Config();
            DataTable dt = config.ReadConfig();
            if (dt != null && dt.Rows.Count > 0)
            {
                this.hddMinSplitTime.Value = dt.Rows[0][2].ToString();
                this.txtSplitTime.Value = dt.Rows[0][2].ToString();
                this.hddMaxTime.Value = dt.Rows[0][5].ToString();
                this.txtSYTime.Value = dt.Rows[0][4].ToString();
                this.calSYStartTime.Text = DateTime.Now.ToString();
            }

            Bussiness.ThermalTestReport report = new ThermalTestReport();
            if (report.IsDoingExpriment())
                this.btnStartEnd.Enabled = false;

            this.btnView.Enabled = false;
            this.btnView.Attributes.Add("onclick", "linkExpriment()");
        }
    }
Exemplo n.º 8
0
    /// <summary>
    /// 开始试验
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void btnStartEnd_Click(object sender, EventArgs e)
    {
        ThermalTestReport report = new ThermalTestReport();

        if (ddlCompany.SelectedValue == "0")
        {
            ScriptManager.RegisterStartupScript(this.UpdatePanel1, this.GetType(), "msg1", "alert('请选择分公司...');", true);
            return;
        }
        if (ddlPlant.SelectedValue == "0")
        {
            ScriptManager.RegisterStartupScript(this.UpdatePanel1, this.GetType(), "msg1", "alert('请选择电厂...');", true);
            return;
        }
        if (ddlUnit.SelectedValue == "0")
        {
            ScriptManager.RegisterStartupScript(this.UpdatePanel1, this.GetType(), "msg1", "alert('请选择机组...');", true);
            return;
        }
        if (ddlSYName.SelectedValue=="0")
        {
            JScript.Alert("请选择试验名称!");
            return;
        }
        if (txtSYR.Value == "")
        {
            JScript.Alert("请填写试验人!");
            return;
        }
        if (btnStartEnd.Text == "开始试验")
        {
            if (report.IsDoingExpriment())
            {
                ScriptManager.RegisterStartupScript(this.UpdatePanel1, this.GetType(), "msg1", "alert('已有试验正在运行,请稍后运行试验...');", true);
                return;
            }
            this.btnView.Enabled = false;

            ThermalTestTemplate template = new ThermalTestTemplate();
            if (template.GetTemplateID(this.ddlSYName.SelectedItem.Text.Trim(), this.ddlUnit.SelectedValue).ToString() == string.Empty)
            {
                ScriptManager.RegisterStartupScript(this.UpdatePanel1, this.GetType(), "msg1", "alert('该机组尚未配置...');", true);
                return;
            }
            report.TESTTemplateID = template.GetTemplateID(this.ddlSYName.SelectedItem.Text.Trim(), this.ddlUnit.SelectedValue);
            report.TESTCondition = GetCondition();
            report.ReportName = this.txtReportName.Value;
            report.Tester = this.txtSYR.Value;
            report.UNITID = ddlUnit.SelectedValue.Trim();
            report.TestBegin = Convert.ToDateTime(this.calSYStartTime.Text);
            report.TestCalBegin = Convert.ToDateTime(DateTime.Now.ToLongTimeString());
            report.TestDuration = Convert.ToInt32(this.txtSYTime.Value);
            report.SampleInterval = Convert.ToInt32(this.txtSplitTime.Value);
            Bussiness.ThermalTestReport.UserState userState = ThermalTestReport.UserState.New;

            report.InsertTest(userState,report);

            this.Timer1.Interval = 1000;
            this.Timer1.Enabled = true;
            btnStartEnd.Text = "终止试验";

            this.Label1.Text = this.txtReportName.Value + "试验正在进行已完成0%";

        }
        else
        {
            this.Timer1.Enabled = false;
            int curReportId = report.GetMaxReportId();
            report.EndTest(curReportId);
            btnStartEnd.Text = "开始试验";
            report.EndTest(curReportId);
            this.Timer1.Enabled = true;
            btnStartEnd.Enabled = false;
            this.Label1.Text = "试验已中止";
        }
    }
Exemplo n.º 9
0
    private void BindReport(string startTime,string endTime,string id_key,string unitId)
    {
        Bussiness.ThermalTestReport report = new Bussiness.ThermalTestReport();

        DataTable dt = report.GetExpriment(startTime, endTime, id_key,unitId);

        if (dt.Rows.Count == 0)
        {
            dt.Rows.Add(dt.NewRow());
            grvFeeInfo.DataSource = dt;
            grvFeeInfo.DataBind();
            int columnCount = grvFeeInfo.Rows[0].Cells.Count;
            grvFeeInfo.Rows[0].Cells.Clear();
            grvFeeInfo.Rows[0].Cells.Add(new TableCell());
            grvFeeInfo.Rows[0].Cells[0].ColumnSpan = columnCount;
            grvFeeInfo.Rows[0].Cells[0].BorderColor = System.Drawing.Color.Black;
            grvFeeInfo.Rows[0].Cells[0].HorizontalAlign = HorizontalAlign.Left;
            grvFeeInfo.Rows[0].Cells[0].Text = "暂时没有信息";
            grvFeeInfo.Rows[0].Cells[0].Style.Add("text-align", "center");
        }
        else
        {
            this.grvFeeInfo.DataSource = dt;
            this.grvFeeInfo.DataBind();
        }
    }
Exemplo n.º 10
0
    //protected void ddlCompute_SelectedIndexChanged(object sender, EventArgs e)
    //{
    //    BindExprimentName();
    //    //ddlExperiment_SelectedIndexChanged(null, null);
    //}
    protected void btnSearch_Click(object sender, EventArgs e)
    {
        if (ddlUnit.SelectedValue == "0")
        {
            JScript.Alert("请选择机组!");
            BindReport(this.calStartTime.Text, this.calEndTime.Text, "0", ddlUnit.SelectedValue.Trim());

            return;
        }
        Bussiness.ThermalTestReport report = new Bussiness.ThermalTestReport();
        //DataTable dt = report.GetFinishExpriment(this.calStartTime.Text, this.calEndTime.Text, Convert.ToInt32(this.ddlExperiment.SelectedValue));
        //DataTable dt = report.GetExpriment(this.calStartTime.Text, this.calEndTime.Text, Convert.ToInt32(this.ddlExperiment.SelectedValue));
        //this.grvFeeInfo.DataSource = dt;
        //this.grvFeeInfo.DataBind();
        Bussiness.ThermalTestTemplate TestTemplate = new Bussiness.ThermalTestTemplate();
        //int templateId = TestTemplate.GetTemplateID(this.ddlExperiment.SelectedValue, this.ddlCompute.SelectedValue);

        DataTable dt = null;
        if (this.ddlExperiment.SelectedValue != "0")
        {
            dt = TestTemplate.GetTemplateIDs(this.ddlExperiment.SelectedValue, this.ddlUnit.SelectedValue);
            string templateId = "";
            if (dt != null && dt.Rows.Count > 0)
            {
                foreach (DataRow dr in dt.Rows)
                {
                    templateId += dr[0].ToString() + ",";
                }
                templateId = templateId.Substring(0, templateId.Length - 1);
            }

            BindReport(this.calStartTime.Text, this.calEndTime.Text, templateId,ddlUnit.SelectedValue.Trim());
        }
        else
            BindReport(this.calStartTime.Text, this.calEndTime.Text, "0", ddlUnit.SelectedValue.Trim());

        //BindReport(this.calStartTime.Text, this.calEndTime.Text, templateId);
    }
Exemplo n.º 11
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            string   colReportId = Request.QueryString["ReportID"];
            string[] reportIds   = colReportId.Split(',');
            int      isSplit     = colReportId.IndexOf(',');
            int      count       = 1;
            for (int L = 0; L < colReportId.Length; L++)
            {
                string temp = colReportId.Substring(L, 1);
                if (temp == ",")
                {
                    count = count + 1;
                }
            }

            colReportId = "(" + colReportId + ")";
            Bussiness.ThermalTestReport Report = new Bussiness.ThermalTestReport();
            DataTable nameDT = Report.GetTest(colReportId);

            System.Text.StringBuilder builder = new System.Text.StringBuilder();
            builder.Append("<table class=\"grid\" cellspacing=\"0\" rules=\"all\" border=\"1\" id=\"tab\" style=\"width: 100%;border-collapse: collapse; z-index: 100; left: 0px; top: 20px;\">");

            builder.Append("<tr><th scope='col'>序号</th><th scope='col'>参数描述</th>");
            if (nameDT != null && nameDT.Rows.Count > 0)
            {
                for (int n = 0; n < nameDT.Rows.Count; n++)
                {
                    builder.Append(string.Format("<th scope=\"col\">{0}</th>", nameDT.Rows[n]["REPORTNAME"].ToString() + "的实验值"));
                }
            }
            builder.Append("</tr>");

            Bussiness.ThermalTestTemplate TestTemplate = new Bussiness.ThermalTestTemplate();
            Bussiness.TestReport          Test         = new Bussiness.TestReport();
            DataTable dt = Test.GetReportResult(colReportId);
            Bussiness.ThermaltestPara Para = new Bussiness.ThermaltestPara();
            string preReportId             = "";
            int    sortId      = 0;
            int    reportCount = 0;
            int    copycount   = 0;
            System.Collections.ArrayList lstHtml = new ArrayList();
            System.Collections.ArrayList lstDesc = new ArrayList();

            if (!isSplit.Equals(-1))
            {
                if (dt != null && dt.Rows.Count > 0)
                {
                    int    descCount  = 0;
                    string firstValue = "";
                    foreach (string r in reportIds)
                    {
                        DataTable rDT = Test.GetReportResult(Convert.ToInt32(r));
                        DataTable nDT = Report.GetTest(Convert.ToInt32(r));
                        int       Id  = Convert.ToInt32(nDT.Rows[0]["TESTTEMPLATEID"]);
                        System.Collections.ArrayList lstValue = new ArrayList();
                        if (rDT != null && rDT.Rows.Count > 0)
                        {
                            for (int M = 0; M < rDT.Rows.Count; M++)
                            {
                                bool exist = TestTemplate.IsExitTemplatePara(Id, rDT.Rows[M][1].ToString());
                                if (exist)
                                {
                                    try
                                    {
                                        if (descCount == 0)
                                        {
                                            string descript = Para.GetParaDescUnit(rDT.Rows[M][1].ToString());
                                            lstDesc.Add(descript);
                                            lstValue.Add(rDT.Rows[M][2].ToString());
                                            reportCount += 1;
                                        }
                                        else
                                        {
                                            lstValue.Add(rDT.Rows[M][2].ToString());
                                            copycount += 1;
                                        }
                                    }
                                    catch (Exception ex)
                                    {
                                        throw ex;
                                    }
                                }
                            }
                        }

                        if (descCount == 0)
                        {
                            lstHtml.Add(lstDesc);
                        }
                        lstHtml.Add(lstValue);
                        descCount += 1;
                    }

                    for (int rC = 0; rC < reportCount; rC++)
                    {
                        builder.Append("<tr>");
                        builder.Append(string.Format("<td>{0}</td>", rC + 1));
                        for (int N = 0; N < count + 1; N++)
                        {
                            builder.Append(string.Format("<td>{0}</td>", ((System.Collections.ArrayList)lstHtml[N])[rC].ToString()));
                        }

                        builder.Append("</tr>");
                    }


                    #region 旧方法
                    //int allCount = reportCount * (count + 1);
                    //string[] splitHTML = new string[allCount];
                    //splitHTML = colHtml.Split(';');
                    //for (int rC = 0; rC < reportCount; rC++)
                    //{
                    //    builder.Append("<tr>");
                    //    builder.Append(string.Format("<td>{0}</td>", rC + 1));
                    //    for (int N = 0; N < count + 1; N++)
                    //    {
                    //        builder.Append(string.Format("<td>{0}</td>", splitHTML[rC + N * reportCount].ToString()));
                    //    }

                    //    builder.Append("</tr>");
                    //    //builder.Append(string.Format("<td>{0}</td>", desc[0]));

                    ////    foreach (string html in splitHTML)
                    ////    {
                    ////        if (html.IndexOf(":") != -1)
                    ////        {
                    ////            string[] descvalue = html.Split(",");
                    ////            for (int d = 0; d < descvalue.Length; d++)
                    ////            {
                    ////                string[] desc = descvalue[d].Split(':');
                    ////                builder.Append(string.Format("<td>{0}</td>", desc[0]));
                    ////                builder.Append(string.Format("<td>{0}</td>", desc[1]));

                    ////            }
                    ////        }
                    ////    }
                    //}


                    //int rowCount = dt.Rows.Count / count;

                    //for (int i = 0; i < dt.Rows.Count; i++)
                    //{

                    //    int templateId = Convert.ToInt32(nameDT.Rows[0][1]);
                    //    bool falg = TestTemplate.IsExitTemplatePara(templateId, dt.Rows[i][1].ToString());

                    //    if (falg)
                    //    {
                    //        sortId += 1;
                    //        builder.Append("<tr>");
                    //        builder.Append(string.Format("<td>{0}</td>", sortId));
                    //        string desc = Para.GetParaDescUnit(dt.Rows[i][1].ToString());
                    //        builder.Append(string.Format("<td>{0}</td>", desc));
                    //        for (int j = 0; j < count; j++)
                    //        {

                    //            builder.Append(string.Format("<td>{0}</td>", dt.Rows[i + j][2].ToString()));
                    //        }
                    //        builder.Append("</tr>");
                    //        //builder.Append("</td>");
                    //    }

                    //    i = i + count - 1;
                    //}


                    #endregion
                }
            }
            else
            {
                if (dt != null && dt.Rows.Count > 0)
                {
                    for (int k = 0; k < dt.Rows.Count; k++)
                    {
                        if (preReportId != dt.Rows[k][0].ToString())
                        {
                            int  templateId = Convert.ToInt32(nameDT.Rows[0]["TESTTEMPLATEID"]);
                            bool falg       = TestTemplate.IsExitTemplatePara(templateId, dt.Rows[k][1].ToString());
                            if (falg)
                            {
                                sortId += 1;
                                builder.Append("<tr>");
                                builder.Append(string.Format("<td>{0}</td>", sortId));
                                string desc = Para.GetParaDescUnit(dt.Rows[k][1].ToString());
                                builder.Append(string.Format("<td>{0}</td>", desc));
                                builder.Append(string.Format("<td>{0}</td>", dt.Rows[k][2].ToString()));
                                builder.Append("</tr>");
                            }
                        }
                    }
                }
            }
            builder.Append("</table>");

            this.result.InnerHtml = builder.ToString();
        }
    }
Exemplo n.º 12
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);
 }
Exemplo n.º 13
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            string colReportId = Request.QueryString["ReportID"];
            string[] reportIds = colReportId.Split(',');
            int isSplit = colReportId.IndexOf(',');
            int count = 1;
            for (int L = 0; L < colReportId.Length; L++)
            {
                string temp = colReportId.Substring(L, 1);
                if (temp == ",")
                    count = count + 1;
            }

            colReportId = "(" + colReportId + ")";
            Bussiness.ThermalTestReport Report = new Bussiness.ThermalTestReport();
            DataTable nameDT = Report.GetTest(colReportId);

            System.Text.StringBuilder builder = new System.Text.StringBuilder();
            builder.Append("<table class=\"grid\" cellspacing=\"0\" rules=\"all\" border=\"1\" id=\"tab\" style=\"width: 100%;border-collapse: collapse; z-index: 100; left: 0px; top: 20px;\">");

            builder.Append("<tr><th scope='col'>���</th><th scope='col'>��������</th>");
            if (nameDT != null && nameDT.Rows.Count > 0)
            {
                for (int n = 0; n < nameDT.Rows.Count; n++)
                {
                    builder.Append(string.Format("<th scope=\"col\">{0}</th>", nameDT.Rows[n]["TESTCONDITION"].ToString() + "��ʵ��ֵ"));
                }
            }
            builder.Append("</tr>");

            Bussiness.ThermalTestTemplate TestTemplate = new Bussiness.ThermalTestTemplate();
            Bussiness.TestReport Test = new Bussiness.TestReport();
            DataTable dt = Test.GetReportResult(colReportId);
            Bussiness.ThermaltestPara Para = new Bussiness.ThermaltestPara();
            string preReportId = "";
            int sortId = 0;
            int reportCount = 0;
            int copycount = 0;
            System.Collections.ArrayList lstHtml = new ArrayList();
            System.Collections.ArrayList lstDesc = new ArrayList();

            if (!isSplit.Equals(-1))
            {
                if (dt != null && dt.Rows.Count > 0)
                {
                    int descCount = 0;
                    string firstValue = "";
                    foreach (string r in reportIds)
                    {
                        DataTable rDT = Test.GetReportResult(Convert.ToInt32(r));
                        DataTable nDT = Report.GetTest(Convert.ToInt32(r));
                        int Id = Convert.ToInt32(nDT.Rows[0][1]);
                        System.Collections.ArrayList lstValue = new ArrayList();
                        if (rDT != null && rDT.Rows.Count > 0)
                        {
                            for (int M = 0; M < rDT.Rows.Count; M++)
                            {

                                bool exist = TestTemplate.IsExitTemplatePara(Id, rDT.Rows[M][1].ToString());
                                if (exist)
                                {
                                    try
                                    {
                                        if (descCount == 0)
                                        {

                                            string descript = Para.GetParaDescUnit(rDT.Rows[M][1].ToString());
                                            lstDesc.Add(descript);
                                            lstValue.Add(rDT.Rows[M][2].ToString());
                                            reportCount += 1;

                                        }
                                        else
                                        {
                                            lstValue.Add(rDT.Rows[M][2].ToString());
                                            copycount += 1;
                                        }
                                    }
                                    catch (Exception ex)
                                    {
                                        throw ex;
                                    }

                                }

                            }
                        }

                        if (descCount == 0)
                        {
                            lstHtml.Add(lstDesc);
                        }
                        lstHtml.Add(lstValue);
                        descCount += 1;
                    }

                    for (int rC = 0; rC < reportCount; rC++)
                    {

                        builder.Append("<tr>");
                        builder.Append(string.Format("<td>{0}</td>", rC + 1));
                        for (int N = 0; N < count + 1; N++)
                        {
                            builder.Append(string.Format("<td>{0}</td>", ((System.Collections.ArrayList)lstHtml[N])[rC].ToString()));
                        }

                        builder.Append("</tr>");

                    }

                    #region �ɷ���
                    //int allCount = reportCount * (count + 1);
                    //string[] splitHTML = new string[allCount];
                    //splitHTML = colHtml.Split(';');
                    //for (int rC = 0; rC < reportCount; rC++)
                    //{
                    //    builder.Append("<tr>");
                    //    builder.Append(string.Format("<td>{0}</td>", rC + 1));
                    //    for (int N = 0; N < count + 1; N++)
                    //    {
                    //        builder.Append(string.Format("<td>{0}</td>", splitHTML[rC + N * reportCount].ToString()));
                    //    }

                    //    builder.Append("</tr>");
                    //    //builder.Append(string.Format("<td>{0}</td>", desc[0]));

                    ////    foreach (string html in splitHTML)
                    ////    {
                    ////        if (html.IndexOf(":") != -1)
                    ////        {
                    ////            string[] descvalue = html.Split(",");
                    ////            for (int d = 0; d < descvalue.Length; d++)
                    ////            {
                    ////                string[] desc = descvalue[d].Split(':');
                    ////                builder.Append(string.Format("<td>{0}</td>", desc[0]));
                    ////                builder.Append(string.Format("<td>{0}</td>", desc[1]));

                    ////            }
                    ////        }
                    ////    }
                    //}

                    //int rowCount = dt.Rows.Count / count;

                    //for (int i = 0; i < dt.Rows.Count; i++)
                    //{

                    //    int templateId = Convert.ToInt32(nameDT.Rows[0][1]);
                    //    bool falg = TestTemplate.IsExitTemplatePara(templateId, dt.Rows[i][1].ToString());

                    //    if (falg)
                    //    {
                    //        sortId += 1;
                    //        builder.Append("<tr>");
                    //        builder.Append(string.Format("<td>{0}</td>", sortId));
                    //        string desc = Para.GetParaDescUnit(dt.Rows[i][1].ToString());
                    //        builder.Append(string.Format("<td>{0}</td>", desc));
                    //        for (int j = 0; j < count; j++)
                    //        {

                    //            builder.Append(string.Format("<td>{0}</td>", dt.Rows[i + j][2].ToString()));
                    //        }
                    //        builder.Append("</tr>");
                    //        //builder.Append("</td>");
                    //    }

                    //    i = i + count - 1;
                    //}

                    #endregion

                }
            }
            else
            {
                if (dt != null && dt.Rows.Count > 0)
                {
                    for (int k = 0; k < dt.Rows.Count; k++)
                    {
                        if (preReportId != dt.Rows[k][0].ToString())
                        {
                            int templateId = Convert.ToInt32(nameDT.Rows[0]["TESTTEMPLATEID"]);
                            bool falg = TestTemplate.IsExitTemplatePara(templateId, dt.Rows[k][1].ToString());
                            if (falg)
                            {
                                sortId += 1;
                                builder.Append("<tr>");
                                builder.Append(string.Format("<td>{0}</td>", sortId));
                                string desc = Para.GetParaDescUnit(dt.Rows[k][1].ToString());
                                builder.Append(string.Format("<td>{0}</td>", desc));
                                builder.Append(string.Format("<td>{0}</td>", dt.Rows[k][2].ToString()));
                                builder.Append("</tr>");
                            }
                        }
                    }
                }
            }
            builder.Append("</table>");

            this.result.InnerHtml = builder.ToString();
        }
    }
Exemplo n.º 14
0
    /// <summary>
    /// 改变试验状态(点击确认后)
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void btnHelp_Click(object sender, EventArgs e)
    {
        ThermalTestReport report = new ThermalTestReport();
        int curReportId = report.GetMaxReportId();
        if (hidvalue.Value == "0")
        {
            report.BDEndTest(curReportId, 12);
            //this.Timer1.Enabled = false;
        }
        else if (hidvalue.Value == "1")
        {
            report.BDEndTest(curReportId, 5);
            this.Timer1.Enabled = false;

            btnStartEnd.Text = "开始试验";
            btnStartEnd.Enabled = true;
            this.Label1.Text = "试验已中止";
        }
    }