private void btnStart_Click(object sender, EventArgs e) { if (!_isExistActions) { MessageBox.Show("未定义自动化操作!"); return; } //初始化泵状态 m_pumpState = new Cls.Model_State(); if (DialogResult.OK == MessageBox.Show("请检查管路是否安装正确! 然后点击 “确定” 继续冲洗!", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning)) { //创建自动预冲任务 m_taskCustomAction = new Task(RunFlush, m_queueCustSendCmd, TaskCreationOptions.LongRunning); btnStart.Enabled = false; btnContinue.Enabled = true; btnFinish.Enabled = false; btnReturn.Enabled = false; btnAddFlush.Enabled = false; this.lblTime.Text = "00:00:00"; int timefull = (int)(m_lstCust[m_lstCust.Count - 1].timeCount + m_lstCust[m_lstCust.Count - 1].timeSpan);// (int)modCust.timeCount + (int)modCust.timeSpan; this.lblFullTime.Text = Cls.utils.SecondsToTime(timefull); if (m_taskCustomAction.Status == TaskStatus.Running) { MessageBox.Show("正在执行自动预冲,请稍候...", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } else { m_isFlush = true; this.dgvStep.Enabled = false; for (int i = 0; i < dgvStep.Rows.Count; i++) { DataGridViewCheckBoxCell checkBox = (DataGridViewCheckBoxCell)this.dgvStep.Rows[i].Cells["selAdd"]; checkBox.Value = 0; dgvStep.Rows[i].Selected = false; } m_taskCustomAction.Start(); if (btnStartFlush != null) { btnStartFlush(sender, e); } } } }
/// <summary> /// 设置单个泵状态 /// </summary> /// <param name="_modelPumpState"></param> public static void SetSinglePumpState(Cls.Model_State pumpstate, int _pumpID, double _speed, bool _isRuning, bool _direction) { switch (_pumpID) { case 1: pumpstate.BPState.PumpID = 1; pumpstate.BPState.Direction = _direction; pumpstate.BPState.Runing = _isRuning; pumpstate.BPState.Speed = _speed; break; case 2: pumpstate.BPState.PumpID = 2; pumpstate.FPState.Direction = _direction; pumpstate.FPState.Runing = _isRuning; pumpstate.FPState.Speed = _speed; break; case 3: pumpstate.BPState.PumpID = 3; pumpstate.DPState.Direction = _direction; pumpstate.DPState.Runing = _isRuning; pumpstate.DPState.Speed = _speed; break; case 4: pumpstate.BPState.PumpID = 4; pumpstate.RPState.Direction = _direction; pumpstate.RPState.Runing = _isRuning; pumpstate.RPState.Speed = _speed; break; case 5: pumpstate.BPState.PumpID = 5; pumpstate.FP2State.Direction = _direction; pumpstate.FP2State.Runing = _isRuning; pumpstate.FP2State.Speed = _speed; break; case 6: pumpstate.BPState.PumpID = 6; pumpstate.CPState.Direction = _direction; pumpstate.CPState.Runing = _isRuning; pumpstate.CPState.Speed = _speed; break; } }
public void SetButtonState(Cls.Model_State _modPumpState) { if (_modPumpState != null) { if (_modPumpState.BPState.Runing) { this.btnRun1.Text = "停止"; this.btnRun1.Image = Properties.Resources.spstop; this.btnRun1.ForeColor = Color.Red; } else { this.btnRun1.Text = "运转"; this.btnRun1.Image = Properties.Resources.spstart; this.btnRun1.ForeColor = Color.FromArgb(15, 8, 100); } if (_modPumpState.FPState.Runing) { this.btnRun2.Text = "停止"; this.btnRun2.Image = Properties.Resources.spstop; this.btnRun2.ForeColor = Color.Red; } else { this.btnRun2.Text = "运转"; this.btnRun2.Image = Properties.Resources.spstart; this.btnRun2.ForeColor = Color.FromArgb(15, 8, 100); } if (_modPumpState.DPState.Runing) { this.btnRun3.Text = "停止"; this.btnRun3.Image = Properties.Resources.spstop; this.btnRun3.ForeColor = Color.Red; } else { this.btnRun3.Text = "运转"; this.btnRun3.Image = Properties.Resources.spstart; this.btnRun3.ForeColor = Color.FromArgb(15, 8, 100); } if (_modPumpState.RPState.Runing) { this.btnRun4.Text = "停止"; this.btnRun4.Image = Properties.Resources.spstop; this.btnRun4.ForeColor = Color.Red; } else { this.btnRun4.Text = "运转"; this.btnRun4.Image = Properties.Resources.spstart; this.btnRun4.ForeColor = Color.FromArgb(15, 8, 100); } if (_modPumpState.FP2State.Runing) { this.btnRun5.Text = "停止"; this.btnRun5.Image = Properties.Resources.spstop; this.btnRun5.ForeColor = Color.Red; } else { this.btnRun5.Text = "运转"; this.btnRun5.Image = Properties.Resources.spstart; this.btnRun5.ForeColor = Color.FromArgb(15, 8, 100); } if (_modPumpState.CPState.Runing) { this.btnRun6.Text = "停止"; this.btnRun6.Image = Properties.Resources.spstop; this.btnRun6.ForeColor = Color.Red; } else { this.btnRun6.Text = "运转"; this.btnRun6.Image = Properties.Resources.spstart; this.btnRun6.ForeColor = Color.FromArgb(15, 8, 100); } } }
public void ReadVState(Cls.Model_State _state) { if (_state.VState[0] == 1) { chkV1.Image = global::ALS.Properties.Resources.clipclose; chkV1.Checked = true; //chkV1.Text = "松开"; } else { chkV1.Image = global::ALS.Properties.Resources.clipopen; chkV1.Checked = false; //chkV1.Text = "夹管"; } if (_state.VState[1] == 1) { chkV2.Image = global::ALS.Properties.Resources.clipclose; chkV2.Checked = true; //chkV2.Text = "松开"; } else { chkV2.Image = global::ALS.Properties.Resources.clipopen; chkV2.Checked = false; //chkV2.Text = "夹管"; } if (_state.VState[2] == 1) { chkV3.Image = global::ALS.Properties.Resources.clipclose; chkV3.Checked = true; //chkV3.Text = "松开"; } else { chkV3.Image = global::ALS.Properties.Resources.clipopen; chkV3.Checked = false; //chkV3.Text = "夹管"; } if (_state.VState[3] == 1) { chkV4.Image = global::ALS.Properties.Resources.clipclose; chkV4.Checked = true; //chkV4.Text = "松开"; } else { chkV4.Image = global::ALS.Properties.Resources.clipopen; chkV4.Checked = false; //chkV4.Text = "夹管"; } if (_state.VState[4] == 1) { chkV5.Image = global::ALS.Properties.Resources.clipclose; chkV5.Checked = true; //chkV5.Text = "松开"; } else { chkV5.Image = global::ALS.Properties.Resources.clipopen; chkV5.Checked = false; //chkV5.Text = "夹管"; } if (_state.VState[5] == 1) { chkV6.Image = global::ALS.Properties.Resources.clipclose; chkV6.Checked = true; //chkV6.Text = "松开"; } else { chkV6.Image = global::ALS.Properties.Resources.clipopen; chkV6.Checked = false; //chkV6.Text = "夹管"; } }
public void SetButtonState(Cls.Model_State _modPumpState) { if (_modPumpState != null) { if (_modPumpState.BPState.Runing) { this.btnRun1.Text = "停止"; this.btnRun1.Image = Properties.Resources.spstop; this.btnRun1.ForeColor = Color.Red; //this.lblBP.Text = _modelPumpState.BPState.Speed.ToString(); this.lblBP.Enabled = false; } else { this.btnRun1.Text = "运转"; this.btnRun1.Image = Properties.Resources.spstart; this.btnRun1.ForeColor = Color.FromArgb(15, 8, 100); //this.lblBP.Text = _modelPumpState.BPState.Speed.ToString(); this.lblBP.Enabled = true; } if (_modPumpState.FPState.Runing) { this.btnRun2.Text = "停止"; this.btnRun2.Image = Properties.Resources.spstop; this.btnRun2.ForeColor = Color.Red; //this.lblFP.Text = _modelPumpState.FPState.Speed.ToString(); this.lblFP.Enabled = false; } else { this.btnRun2.Text = "运转"; this.btnRun2.Image = Properties.Resources.spstart; this.btnRun2.ForeColor = Color.FromArgb(15, 8, 100); //this.lblFP.Text = _modelPumpState.FPState.Speed.ToString(); this.lblFP.Enabled = true; } if (_modPumpState.DPState.Runing) { this.btnRun3.Text = "停止"; this.btnRun3.Image = Properties.Resources.spstop; this.btnRun3.ForeColor = Color.Red; //this.lblDP.Text = _modelPumpState.DPState.Speed.ToString(); this.lblDP.Enabled = false; } else { this.btnRun3.Text = "运转"; this.btnRun3.Image = Properties.Resources.spstart; this.btnRun3.ForeColor = Color.FromArgb(15, 8, 100); //this.lblDP.Text = _modelPumpState.DPState.Speed.ToString(); this.lblDP.Enabled = true; } if (_modPumpState.RPState.Runing) { this.btnRun4.Text = "停止"; this.btnRun4.Image = Properties.Resources.spstop; this.btnRun4.ForeColor = Color.Red; //this.lblRP.Text = _modelPumpState.RPState.Speed.ToString(); this.lblRP.Enabled = false; } else { this.btnRun4.Text = "运转"; this.btnRun4.Image = Properties.Resources.spstart; this.btnRun4.ForeColor = Color.FromArgb(15, 8, 100); //this.lblRP.Text = _modelPumpState.RPState.Speed.ToString(); this.lblRP.Enabled = false; } if (_modPumpState.FP2State.Runing) { this.btnRun5.Text = "停止"; this.btnRun5.Image = Properties.Resources.spstop; this.btnRun5.ForeColor = Color.Red; } else { this.btnRun5.Text = "运转"; this.btnRun5.Image = Properties.Resources.spstart; this.btnRun5.ForeColor = Color.FromArgb(15, 8, 100); } if (_modPumpState.CPState.Runing) { this.btnRun6.Text = "停止"; this.btnRun6.Image = Properties.Resources.spstop; this.btnRun6.ForeColor = Color.Red; } else { this.btnRun6.Text = "运转"; this.btnRun6.Image = Properties.Resources.spstart; this.btnRun6.ForeColor = Color.FromArgb(15, 8, 100); } } }
public void SetButtonState(Cls.Model_State _modPumpState) { if (_modPumpState != null) { if (_modelTreat.BPValid) { if (_modPumpState.BPState.Runing) { this.btnRun1.Text = "停止"; this.btnRun1.Image = Properties.Resources.spstop; this.btnRun1.ForeColor = Color.Red; this.txtBP.Text = _modelPumpState.BPState.Speed.ToString(); this.txtBP.Enabled = false; } else { this.btnRun1.Text = "运转"; this.btnRun1.Image = Properties.Resources.spstart; this.btnRun1.ForeColor = Color.White; this.txtBP.Text = _modelPumpState.BPState.Speed.ToString(); this.txtBP.Enabled = true; } this.btnRun1.Enabled = true; } else { this.btnRun1.Enabled = this.txtBP.Enabled = false; } if (_modelTreat.FPValid) { if (_modPumpState.FPState.Runing) { this.btnRun2.Text = "停止"; this.btnRun2.Image = Properties.Resources.spstop; this.btnRun2.ForeColor = Color.Red; //this.lblFP.Text = _modelPumpState.FPState.Speed.ToString(); this.txtFP.Enabled = false; } else { this.btnRun2.Text = "运转"; this.btnRun2.Image = Properties.Resources.spstart; this.btnRun2.ForeColor = Color.White; //this.lblFP.Text = _modelPumpState.FPState.Speed.ToString(); this.txtFP.Enabled = true; } this.btnRun2.Enabled = true; } else { this.btnRun2.Enabled = this.txtFP.Enabled = false; } if (_modelTreat.DPValid) { if (_modPumpState.DPState.Runing) { this.btnRun3.Text = "停止"; this.btnRun3.Image = Properties.Resources.spstop; this.btnRun3.ForeColor = Color.Red; //this.lblDP.Text = _modelPumpState.DPState.Speed.ToString(); this.txtDP.Enabled = false; } else { this.btnRun3.Text = "运转"; this.btnRun3.Image = Properties.Resources.spstart; this.btnRun3.ForeColor = Color.White; //this.lblDP.Text = _modelPumpState.DPState.Speed.ToString(); this.txtDP.Enabled = true; } this.btnRun3.Enabled = true; } else { this.btnRun3.Enabled = this.txtDP.Enabled = false; } if (_modelTreat.RPValid) { if (_modPumpState.RPState.Runing) { this.btnRun4.Text = "停止"; this.btnRun4.Image = Properties.Resources.spstop; this.btnRun4.ForeColor = Color.Red; //this.lblRP.Text = _modelPumpState.RPState.Speed.ToString(); this.txtRP.Enabled = false; } else { this.btnRun4.Text = "运转"; this.btnRun4.Image = Properties.Resources.spstart; this.btnRun4.ForeColor = Color.White; //this.lblRP.Text = _modelPumpState.RPState.Speed.ToString(); this.txtRP.Enabled = true; } this.btnRun4.Enabled = true; } else { this.btnRun4.Enabled = this.txtRP.Enabled = false; } if (_modelTreat.FP2Valid) { if (_modPumpState.FP2State.Runing) { this.btnRun5.Text = "停止"; this.btnRun5.Image = Properties.Resources.spstop; this.btnRun5.ForeColor = Color.Red; this.txtFP2.Text = _modelPumpState.FP2State.Speed.ToString(); this.txtFP2.Enabled = false; } else { this.btnRun5.Text = "运转"; this.btnRun5.Image = Properties.Resources.spstart; this.btnRun5.ForeColor = Color.White; //this.lblFP2.Text = _modelPumpState.FP2State.Speed.ToString(); this.txtFP2.Enabled = true; } this.btnRun5.Enabled = true; } else { this.btnRun5.Enabled = this.txtFP2.Enabled = false; } if (_modelTreat.CPValid) { if (_modPumpState.CPState.Runing) { this.btnRun6.Text = "停止"; this.btnRun6.Image = Properties.Resources.spstop; this.btnRun6.ForeColor = Color.Red; //this.lblCP.Text = _modelPumpState.CPState.Speed.ToString(); this.txtCP.Enabled = false; } else { this.btnRun6.Text = "运转"; this.btnRun6.Image = Properties.Resources.spstart; this.btnRun6.ForeColor = Color.White; //this.lblCP.Text = _modelPumpState.CPState.Speed.ToString(); this.txtCP.Enabled = true; } this.btnRun6.Enabled = true; } else { this.btnRun6.Enabled = this.txtCP.Enabled = false; } } }