Exemple #1
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 = "试验已中止";
        }
    }
Exemple #2
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;

        }
    }
    /// <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 = "试验已中止";
        }
    }