private void StopReason_Click(object sender, EventArgs e) { StopReason dlg = new StopReason(); dlg.ShowDialog(); }
private void tBtnStopTest_Click(object sender, EventArgs e) { tmrAutoStopTest.Enabled = false; StopReason dlg = new StopReason(); dlg.ShowDialog(); if (dlg.selectindex == 0) { DataOperate.MyTable.Rows[GlobalData.DataRowIndex]["实验结果"] = "发火"; } if (dlg.selectindex == 1) { DataOperate.MyTable.Rows[GlobalData.DataRowIndex]["实验结果"] = "瞎火"; } if (dlg.selectindex == 2) { DataOperate.MyTable.Rows[GlobalData.DataRowIndex]["实验结果"] = "废样"; } if (dlg.selectindex == 3) { System.Windows.Forms.MessageBox.Show("样品数据最少25个,正式实验已经结束!", "操作提示"); } DataOperate.MyTable.Rows[GlobalData.DataRowIndex]["温度变化"] = GlobalData.TemperatureMax; //2014/6/30 2、解决原 温度变化和烟雾变化 在数据列中位置错误的问题。 DataOperate.MyTable.Rows[GlobalData.DataRowIndex]["气体变化"] = GlobalData.SmokeSensorMax; //{ // if (DataOperate.isHYGD) DataOperate.MyTable.Rows[GlobalData.DataRowIndex]["实验结果"] = "发火"; // else DataOperate.MyTable.Rows[GlobalData.DataRowIndex]["实验结果"] = "爆炸"; //} // //{ // if (DataOperate.isHYGD) // DataOperate.MyTable.Rows[GlobalData.DataRowIndex]["实验结果"] = "瞎火"; // else // DataOperate.MyTable.Rows[GlobalData.DataRowIndex]["实验结果"] = "不爆"; //} GlobalData.SmokeSensorMax = 0; GlobalData.TemperatureMax = 0; GlobalData.DataRowIndex++; frmDebugInfo.StopTest(); GlobalData.SystemStatus = SystemStatuses.SystemReady; //GlobalData.serialPort.TxdCommand(SerialPortControl.Command_Fall); if (GlobalData.DataRowIndex > 10) { try { DataOperate.UpdateTestData(); menuOpenDatabase_Click(null, null); NewTestData(); GlobalData.DataRowIndex = 0; } catch (Exception err) { GlobalData.frmStatus.WriteLog("tBtnStopTest_Click: " + err.Message, false); } } }
private void tBtnStopTest_Click(object sender, EventArgs e) { if (GlobalData.SystemStatus == SystemStatuses.Preparing) { btnDispStop_Click(null, null); return; } float oldoldTarget = 0; GlobalData.serialPort.TxdCommand(SerialPortControl.Command_Stop_Fire); if (GlobalCofigData.SystemConfig.ControlType == ControlTypes.PLC) { plc.DianhuoStop(); } tmrAutoStopFire.Enabled = false; StopReason dlg = new StopReason(); dlg.ShowDialog(); if (dlg.selectindex == 0) { if (GlobalCofigData.SystemConfig.TestType == TestTypes.撞击感度) { GlobalCofigData.SystemConfig.TargetDistance = GlobalCofigData.SystemConfig.TargetDistance + GlobalCofigData.SystemConfig.Step; } else { if (GlobalCofigData.SystemConfig.SerialNo == 1) { GlobalCofigData.SystemConfig.TargetDistance = GlobalCofigData.SystemConfig.TargetDistance * 2; } else { int aa = GlobalData.DataRowIndex - 1; if (aa >= 0) { oldoldTarget = (float)DataOperate.MyTable.Rows[aa][DataOperate.点火高度]; } GlobalCofigData.SystemConfig.TargetDistance = GlobalCofigData.SystemConfig.TargetDistance + Math.Abs(GlobalCofigData.SystemConfig.TargetDistance - oldoldTarget) / 2; } } DataOperate.MyTable.Rows[GlobalData.DataRowIndex]["实验结果"] = "发火"; GlobalCofigData.SystemConfig.SerialNo++;////V1.03.02LY } if (dlg.selectindex == 1) { if (GlobalCofigData.SystemConfig.TestType == TestTypes.撞击感度) { GlobalCofigData.SystemConfig.TargetDistance = GlobalCofigData.SystemConfig.TargetDistance - GlobalCofigData.SystemConfig.Step; } else { if (GlobalCofigData.SystemConfig.SerialNo == 1) { GlobalCofigData.SystemConfig.TargetDistance = GlobalCofigData.SystemConfig.TargetDistance / 2; } else { int aa = GlobalData.DataRowIndex - 1; if (aa >= 0) { oldoldTarget = (float)DataOperate.MyTable.Rows[aa][DataOperate.点火高度]; } GlobalCofigData.SystemConfig.TargetDistance = GlobalCofigData.SystemConfig.TargetDistance - Math.Abs(GlobalCofigData.SystemConfig.TargetDistance - oldoldTarget) / 2; GlobalCofigData.SystemConfig.TargetDistance = (int)GlobalCofigData.SystemConfig.TargetDistance;//V1.14 只取整数,(如果精度为正负1mm,自动调节高度不能自动退出) } } DataOperate.MyTable.Rows[GlobalData.DataRowIndex]["实验结果"] = "瞎火"; GlobalCofigData.SystemConfig.SerialNo++;//V1.14CS } if (dlg.selectindex == 2) { DataOperate.MyTable.Rows[GlobalData.DataRowIndex]["实验结果"] = "废样"; } if (dlg.selectindex == 3) { if (GlobalCofigData.SystemConfig.TestType == TestTypes.摩擦感度) { //DataOperate.MyTable.Rows[GlobalData.DataRowIndex]["实验结果"] = "预置实验结束"; System.Windows.Forms.MessageBox.Show("预置测试已经结束!", "操作提示"); GlobalCofigData.SystemConfig.TestType = TestTypes.撞击感度; NewTestData(); } else { //DataOperate.MyTable.Rows[GlobalData.DataRowIndex]["实验结果"] = "正式实验结束"; System.Windows.Forms.MessageBox.Show("样品数据最少25个,正式实验已经结束!", "操作提示"); GlobalCofigData.SystemConfig.SerialNo = 1;//V1.14CS } } if (GlobalData.SystemStatus == SystemStatuses.BeTesting) //区分预置停止还是实验停止 { DataOperate.MyTable.Rows[GlobalData.DataRowIndex]["温度变化"] = GlobalData.TemperatureMax; //2014/6/30 2、解决原 温度变化和烟雾变化 在数据列中位置错误的问题。 DataOperate.MyTable.Rows[GlobalData.DataRowIndex]["气体变化"] = GlobalData.SmokeSensorMax; //{ // if (DataOperate.isHYGD) DataOperate.MyTable.Rows[GlobalData.DataRowIndex]["实验结果"] = "发火"; // else DataOperate.MyTable.Rows[GlobalData.DataRowIndex]["实验结果"] = "爆炸"; //} // //{ // if (DataOperate.isHYGD) // DataOperate.MyTable.Rows[GlobalData.DataRowIndex]["实验结果"] = "瞎火"; // else // DataOperate.MyTable.Rows[GlobalData.DataRowIndex]["实验结果"] = "不爆"; //} GlobalData.SmokeSensorMax = 0; GlobalData.TemperatureMax = 0; GlobalData.DataRowIndex++; } frmDebugInfo.StopTest(); GlobalData.SystemStatus = SystemStatuses.SystemReady; GlobalData.DispCotrol.Stop(); //GlobalData.serialPort.TxdCommand(SerialPortControl.Command_Fall); if (GlobalData.DataRowIndex > 10) { try { DataOperate.UpdateTestData(); menuOpenDatabase_Click(null, null); NewTestData(); GlobalData.DataRowIndex = 0; } catch (Exception err) { GlobalData.frmStatus.WriteLog("tBtnStopTest_Click: " + err.Message, false); } } if (dlg.selectindex < 2) { menuPrepare_Click(null, null); } }