/// <summary> /// 开始单工站运行 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void toolStripMenuItemStart_Click(object sender, EventArgs e) { if (null == _station) { MessageBox.Show("无效操作,工站未设置"); return; } JFWorkStatus ws = _station.CurrWorkStatus; if (ws == JFWorkStatus.Running || ws == JFWorkStatus.Pausing || ws == JFWorkStatus.Interactiving) { JFTipsDelayClose.Show("无效操作,工站当前正在运行:" + ws, 1); return; } //EnableStationMsgReceive = true; JFWorkCmdResult ret = _station.Start(); if (ret != JFWorkCmdResult.Success) { MessageBox.Show("启动工站失败,错误代码:" + ret); //EnableStationMsgReceive = false; } else { JFTipsDelayClose.Show("操作信息:工站已启动", 1); } }
private void FormMain_FormClosing(object sender, FormClosingEventArgs e) { JFWorkStatus ws = JFHubCenter.Instance.StationMgr.MainStation.WorkStatus; if (ws == JFWorkStatus.Running || ws == JFWorkStatus.Pausing || ws == JFWorkStatus.Interactiving) { if (DialogResult.OK == MessageBox.Show("设备正在运行,是否停止并退出?", "警告", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning)) { string errorInfo; if (!JFHubCenter.Instance.StationMgr.MainStation.Stop(out errorInfo)) { MessageBox.Show("停止设备发生错误:" + errorInfo); //日后在此处添加日志 } JFHubCenter.Instance.StationMgr.Stop(); //停止所有工站(比如正在单站测试中) } else { e.Cancel = true; return; } } if (DialogResult.OK == MessageBox.Show("是否退出程序?", "警告", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning)) { JFHubCenter.Instance.StationMgr.Stop(); e.Cancel = false; } else { e.Cancel = true; } }
/// <summary> /// 结批操作 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void toolStripMenuItemEndBatch_Click(object sender, EventArgs e) { if (null == _station) { MessageBox.Show("无效操作,工站未设置"); return; } JFWorkStatus ws = _station.CurrWorkStatus; if (!JFStationBase.IsWorkingStatus(ws)) { JFTipsDelayClose.Show("无效操作,工站当前未运行:" + ws, 1); return; } JFWorkCmdResult ret = _station.EndBatch(2000); if (ret != JFWorkCmdResult.Success) { MessageBox.Show("发送结批指令失败,错误代码:" + ret); } else { ShowTips("操作信息:结批指令已发送"); JFTipsDelayClose.Show("结批指令已发送", 1); } }
/// <summary> /// 工站归零 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void toolStripMenuItemReset_Click(object sender, EventArgs e) { if (null == _station) { MessageBox.Show("无效操作,工站未设置"); return; } JFWorkStatus ws = _station.CurrWorkStatus; if (ws == JFWorkStatus.Running || ws == JFWorkStatus.Pausing || ws == JFWorkStatus.Interactiving) { JFTipsDelayClose.Show("无效操作,工站当前正在运行:" + ws, 1); return; } JFWorkCmdResult ret = _station.Reset(); if (ret != JFWorkCmdResult.Success) { MessageBox.Show("启动复位失败,错误代码:" + ret); } else { ShowTips("操作信息:复位已启动"); JFTipsDelayClose.Show("复位已启动", 1); } }
/// <summary> /// 工站恢复 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void toolStripMenuItemResume_Click(object sender, EventArgs e) { if (null == _station) { MessageBox.Show("无效操作,工站未设置"); return; } JFWorkStatus ws = _station.CurrWorkStatus; if (!JFStationBase.IsWorkingStatus(ws)) { JFTipsDelayClose.Show("无效操作,工站当前未运行:" + ws, 1); return; } if (ws != JFWorkStatus.Pausing) { JFTipsDelayClose.Show("无效操作,工站当前非暂停状态:" + ws, 1); return; } JFWorkCmdResult ret = _station.Resume(2000); if (ret != JFWorkCmdResult.Success) { MessageBox.Show("恢复运行失败,错误代码:" + ret); } else { ShowTips("操作信息:工站已恢复运行"); JFTipsDelayClose.Show("工站已恢复运行", 1); } }
void OnStationWorkStatusChanged(object sender, JFWorkStatus currWorkStatus) { if (InvokeRequired) { Invoke(new dgWorkStatusChanged(OnStationWorkStatusChanged), new object[] { sender, currWorkStatus }); return; } IJFStation station = sender as IJFStation; _dctStationForms[station].OnWorkStatusChanged(sender, currWorkStatus); if (_dctTestingForms.ContainsKey(station)) { JFWorkStatus ws = station.CurrWorkStatus; if (!JFStationBase.IsWorkingStatus(ws) && ws != JFWorkStatus.CommandExit && ws != JFWorkStatus.AbortExit) { _dctTestingForms.Remove(station); StopTest(); JFTipsDelayClose.Show("工站:" + station.Name + " " + JFStationBase.WorkStatusName(ws) + " ,停止测试运行!", -1); return; } } }
/// <summary> /// 处理工站状态改变 /// 未提供JustRealTimeUI的工站通过此函数刷新界面 /// 以提供JustRealTimeUI的工站 只是通过此函数向MainStation发送消息,相关界面更新功能由工站自身维护 /// </summary> /// <param name="station"></param> /// <param name="currWorkStatus"></param> void _StationWorkStatusChanged(IJFStation station, JFWorkStatus currWorkStatus, bool isSynchMode = true) //异步模式有问题(异步线程未运行'),待日后改进 { if (isSynchMode) { if (_StationMsgReciever.ContainsKey(station)) { List <IJFStationMsgReceiver> uis = _StationMsgReciever[station]; foreach (IJFStationMsgReceiver ui in uis) { ui.OnWorkStatusChanged(currWorkStatus); } } ///将消息发送到MainStaion处理 MainStation.OnStationWorkStatusChanged(station, currWorkStatus); EventStationWorkStatusChanged?.Invoke(station, currWorkStatus); } else { Task t = new Task(() => /*日后可能改成固定线程,性能是否可优化存疑*/ { if (_StationMsgReciever.ContainsKey(station)) { List <IJFStationMsgReceiver> uis = _StationMsgReciever[station]; foreach (IJFStationMsgReceiver ui in uis) { ui.OnWorkStatusChanged(currWorkStatus); } } ///将消息发送到MainStaion处理 MainStation.OnStationWorkStatusChanged(station, currWorkStatus); EventStationWorkStatusChanged?.Invoke(station, currWorkStatus); }); } }
void OnStationWorkStatusChanged(object station, JFWorkStatus currWorkStatus) { if (InvokeRequired) { Invoke(new dgWorkStatusChanged(OnStationWorkStatusChanged), new object[] { station, currWorkStatus }); return; } }
/// <summary> /// 工作状态发生改变 /// </summary> /// <param name="sender"></param> /// <param name="currWorkStatus"></param> void OnMFWorkStatusChanged(object sender, JFWorkStatus currWorkStatus) { if (!Created) { return; } /*Begin*/ Invoke(new dgMFWorkStatusChanged(_onMFWorkStatusChanged), new object[] { currWorkStatus }); }
/// <summary> /// 处理工站状态改变 /// </summary> /// <param name="station"></param> /// <param name="currWorkStatus"></param> public virtual void OnStationWorkStatusChanged(IJFStation station, JFWorkStatus currWorkStatus) { if (station.GetType().Name.Contains("DLAFDetectStation")) { _uiPanel.OnWorkStatusChanged(currWorkStatus); } ///继续添加其他工站发过来的消息 }
protected override bool ActionGenuine() { if (!IsInitOK) { ActionErrorInfo = "初始化未完成:" + InitErrorInfo; return(false); } string axisID = GetInitParamValue("轴名称") as string; int timeoutMilSeconds = (int)GetInitParamValue("等待超时毫秒"); JFDevChannel axisChn = new JFDevChannel(JFDevCellType.Axis, axisID); string avalidInfo; if (!axisChn.CheckAvalid(out avalidInfo)) { ActionErrorInfo = avalidInfo; return(false); } if (!_thread.SetAxis(axisChn)) { ActionErrorInfo = _thread.ActionErrorInfo; return(false); } _thread.TimeoutMilliSeconds = timeoutMilSeconds; if (JFWorkCmdResult.Success != _thread.Start()) { ActionErrorInfo = _thread.ActionErrorInfo; return(false); } while (true) { JFWorkStatus status = _thread.CurrWorkStatus; if (status == JFWorkStatus.NormalEnd) { ActionErrorInfo = "Success"; return(true); } if (status == JFWorkStatus.CommandExit || status == JFWorkStatus.AbortExit) { ActionErrorInfo = "收到退出指令"; return(false); } if (status == JFWorkStatus.ErrorExit) { ActionErrorInfo = _thread.ActionErrorInfo; return(false); } if (status == JFWorkStatus.ExceptionExit) { ActionErrorInfo = "线程内部异常!"; return(false); } Thread.Sleep(100); } }
void OnWorkStatusChange(IJFWork worker, JFWorkStatus status, string info) { if (InvokeRequired) { BeginInvoke(new dgWorkStatusChange(OnWorkStatusChange), new object[] { worker, status, info }); //Invoke(new dgWorkStatusChange(OnWorkStatusChange), new object[] { worker, status, info }); return; } lbWorkStatus.Text = status.ToString(); ShowTips(string.Format("Worker: \"{0}\" 工作状态变化: \"{1}\" info:{2}", worker.Name, status.ToString(), info)); }
/// <summary> /// 线程函数内部调用 /// 工作状态变化时,需要调用此函数 /// </summary> /// <param name="ws"></param> /// <param name="info"></param> protected void ChangeWorkStatus(JFWorkStatus ws) { lock (WorkStatusLocker) { if (CurrWorkStatus == ws) { return; } CurrWorkStatus = ws; } WorkStatusChanged?.Invoke(this, CurrWorkStatus); }
private void btReset_Click(object sender, EventArgs e) { if (_station == null) { MessageBox.Show("归零操作失败!工站未设置/空值"); return; } JFWorkStatus ws = _station.CurrWorkStatus; if (ws == JFWorkStatus.Running || ws == JFWorkStatus.Pausing || ws == JFWorkStatus.Interactiving) { MessageBox.Show("归零操作失败!工站当前正在运行"); return; } JFWorkCmdResult ret = _station.Reset(); }
public void OnWorkStatusChanged(JFWorkStatus currWorkStatus) //工作状态变化 { BeginInvoke(new Action(() => { if (_station.IsWorking()) { ParamEditEnabled = false; btEditSave.Enabled = false; btUpdateInspect.Enabled = false; rchDetectInfo.AppendText(DateTime.Now.ToString("HH:mm:ss.fff") + " 开始离线检测\n"); } else { btUpdateInspect.Enabled = true; btEditSave.Enabled = true; } })); }
/// <summary> /// 工站手动运行模式 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void toolStripMenuItemManual_Click(object sender, EventArgs e) { JFWorkStatus ws = _station.CurrWorkStatus; if (ws == JFWorkStatus.Running || ws == JFWorkStatus.Pausing || ws == JFWorkStatus.Interactiving) { MessageBox.Show("工站正在运行,不能修改运行模式"); return; } bool isOK = _station.SetRunMode(JFStationRunMode.Manual); if (isOK) { toolStripMenuItemAuto.Checked = false; toolStripMenuItemManual.Checked = true; } else { MessageBox.Show("设置手动/调试模式 失败"); } }
void OnStationWorkStatusChanged(object station, JFWorkStatus currWorkStatus) { if (_isAdjusting) { return; } if (!Created) { return; } if (!_dctStationInfos.ContainsKey(station as IJFStation)) { return; } if (InvokeRequired) { Invoke(new dgOnStationWorkStatusChanged(OnStationWorkStatusChanged), new object[] { station, currWorkStatus }); return; } string timeTxt = DateTime.Now.ToString("HH:mm:ss.fff"); string info = "运行状态:" + JFStationBase.WorkStatusName(currWorkStatus); RichTextBox rchStation = _dctStationInfos[station as IJFStation]; rchStation.AppendText(timeTxt + " " + info + "\n"); if (rchStation.Text.Length >= _stationTipsMaxBytes) { rchStation.Text = rchStation.Text.Substring(_stationTipsMaxBytes / 2); } // string[] lines = rbTips.Text.Split('\n'); //if (lines.Length >= maxTips) //{ // int rmvChars = 0; // for (int i = 0; i < lines.Length - maxTips; i++) // rmvChars += lines[i].Length + 1; // rbTips.Text = rbTips.Text.Substring(rmvChars); //} rchStation.Select(rchStation.TextLength, 0); //滚到最后一行 rchStation.ScrollToCaret(); //滚动到控件光标处 }
protected bool IsStationRunning(JFWorkStatus ws) { return(ws == JFWorkStatus.Running || ws == JFWorkStatus.Pausing || ws == JFWorkStatus.Interactiving); }
//响应工作状态改变消息,由MainStation发过来 public void OnWorkStatusChanged(JFWorkStatus ws) { BeginInvoke(new Action(() => { switch (ws) { case JFWorkStatus.UnStart: // = 0, //线程未开始运行 _workStatusTxt = "未开始"; lbRunStatus.ForeColor = Color.Black; lbRunStatus.Text = _workStatusTxt; break; case JFWorkStatus.Running: //, //线程正在运行,未退出 _workStatusTxt = "运行中"; lbRunStatus.ForeColor = Color.Green; lbRunStatus.Text = _workStatusTxt + " " + _currCustomStatus; break; case JFWorkStatus.Pausing: //, //线程暂停中 _workStatusTxt = "已暂停"; lbRunStatus.ForeColor = Color.Yellow; lbRunStatus.Text = _workStatusTxt + " " + _currCustomStatus; return; case JFWorkStatus.Interactiving: //, //人机交互 , 等待人工干预指令 _workStatusTxt = "等待输入"; lbRunStatus.ForeColor = Color.Yellow; lbRunStatus.Text = _workStatusTxt + " " + _currCustomStatus; break; case JFWorkStatus.NormalEnd: //, //线程正常完成后退出 _workStatusTxt = "正常结束"; lbRunStatus.ForeColor = Color.Black; lbRunStatus.Text = _workStatusTxt; break; case JFWorkStatus.CommandExit: //, //收到退出指令 _workStatusTxt = "指令结束"; lbRunStatus.ForeColor = Color.Black; lbRunStatus.Text = _workStatusTxt; break; case JFWorkStatus.ErrorExit: //, //发生错误退出,(重启或人工消除错误后可恢复) _workStatusTxt = "错误停止"; lbRunStatus.ForeColor = Color.Red; lbRunStatus.Text = _workStatusTxt + " " + _currCustomStatus; break; case JFWorkStatus.ExceptionExit: //, //发生异常退出 , (不可恢复的错误) _workStatusTxt = "异常停止"; lbRunStatus.ForeColor = Color.Red; lbRunStatus.Text = _workStatusTxt + " " + _currCustomStatus; break; case JFWorkStatus.AbortExit: //, //由调用者强制退出 _workStatusTxt = "强制退出"; lbRunStatus.ForeColor = Color.Red; lbRunStatus.Text = _workStatusTxt + " " + _currCustomStatus; break; default: _workStatusTxt = ws.ToString(); lbRunStatus.ForeColor = Color.Red; lbRunStatus.Text = _workStatusTxt + " " + _currCustomStatus; break; } fmTips.AddOneTips("运行状态改变为:" + _workStatusTxt); return; })); }
public void OnWorkStatusChanged(JFWorkStatus currWorkStatus) //工作状态变化 { }
void _onMFWorkStatusChanged(JFWorkStatus currWorkStatus) { UpdatePoolValues(); switch (currWorkStatus) { case JFWorkStatus.Running: lbWorkStatus.Text = "运行中"; btStop.Enabled = true; btPause.Enabled = true; btReset.Enabled = false; btAction.Enabled = false; if (_methodFlow.RunningMode != JFMethodFlow.RunMode.Step) { btStep.Enabled = false; } else { btAction.Enabled = false; btAction.Text = "运行"; btStep.Enabled = true; } break; case JFWorkStatus.Pausing: lbWorkStatus.Text = "暂停中"; ShowTips("已暂停..."); btAction.Enabled = true; btPause.Enabled = false; btAction.Text = "恢复"; break; case JFWorkStatus.Interactiving: lbWorkStatus.Text = "交互中"; ShowTips("人机交互中..."); break; case JFWorkStatus.NormalEnd: lbWorkStatus.Text = "正常结束"; btAction.Enabled = true; btAction.Text = "运行"; btPause.Enabled = false; btReset.Enabled = true; btStop.Enabled = true; btStep.Enabled = true; ShowTips("已正常结束"); break; case JFWorkStatus.AbortExit: lbWorkStatus.Text = "强制终止"; btAction.Enabled = true; btAction.Text = "运行"; btPause.Enabled = false; btReset.Enabled = true; btStop.Enabled = true; btStep.Enabled = true; ShowTips("已强制终止"); break; case JFWorkStatus.CommandExit: lbWorkStatus.Text = "指令停止"; btAction.Enabled = true; btAction.Text = "运行"; btPause.Enabled = false; btReset.Enabled = true; btStop.Enabled = true; btStep.Enabled = true; ShowTips("已指令退出"); break; case JFWorkStatus.ErrorExit: lbWorkStatus.Text = "错误停止"; btAction.Enabled = true; btAction.Text = "运行"; btPause.Enabled = false; btReset.Enabled = true; btStop.Enabled = true; btStep.Enabled = true; ShowTips("已错误停止"); ShowTips("错误信息:" + _methodFlow.ActionErrorInfo()); break; case JFWorkStatus.ExceptionExit: lbWorkStatus.Text = "异常停止"; btAction.Enabled = true; btAction.Text = "运行"; btPause.Enabled = false; btReset.Enabled = true; btStop.Enabled = true; btStep.Enabled = true; ShowTips("错误信息:" + _methodFlow.ActionErrorInfo()); break; case JFWorkStatus.UnStart: lbWorkStatus.Text = "未运行"; btAction.Enabled = true; btAction.Text = "运行"; btPause.Enabled = false; btReset.Enabled = true; btStop.Enabled = true; btStep.Enabled = true; break; } }
public static bool IsWorkingStatus(JFWorkStatus ws) { return(ws == JFWorkStatus.Running || ws == JFWorkStatus.Pausing || ws == JFWorkStatus.Interactiving); }
private void timerFlush_Tick(object sender, EventArgs e) //主界面刷新 { IJFMainStation ms = JFHubCenter.Instance.StationMgr.MainStation; if (ms.IsAlarming != _isLastAlarming) { _isLastAlarming = !_isLastAlarming; if (_isLastAlarming) { btAlarm.Enabled = true; btAlarm.ImageKey = "Alarm_On.png"; statusLabelDevStatus.Text = "已报警:" + ms.GetAlarmInfo(); BackColor = Color.Red; } else //报警状态转为正常 { btAlarm.ImageKey = "Alarm_Off.png"; statusLabelDevStatus.Text = "未报警"; btAlarm.Enabled = false; _lastStatus = ms.WorkStatus; //添加代码 ... switch (_lastStatus) { case JFWorkStatus.UnStart: // = 0, //线程未开始运行 BackColor = Color.White; statusLabelDevStatus.Text = "未运行/已停止"; break; case JFWorkStatus.Running: //, //线程正在运行,未退出 BackColor = Color.Green; statusLabelDevStatus.Text = "运行中..."; break; case JFWorkStatus.Pausing: //, //线程暂停中 BackColor = Color.Yellow; statusLabelDevStatus.Text = "暂停中..."; break; case JFWorkStatus.Interactiving: //, //人机交互 , 等待人工干预指令 BackColor = Color.OrangeRed; statusLabelDevStatus.Text = "等待人工确认中..."; break; case JFWorkStatus.NormalEnd: //, //线程正常完成后退出 BackColor = Color.White; statusLabelDevStatus.Text = "已停止/正常结束"; break; case JFWorkStatus.CommandExit: //, //收到退出指令 BackColor = Color.White; statusLabelDevStatus.Text = "已停止/指令结束"; break; case JFWorkStatus.ErrorExit: //, //发生错误退出,(重启或人工消除错误后可恢复) BackColor = Color.DarkRed; statusLabelDevStatus.Text = "已停止/发生错误"; break; case JFWorkStatus.ExceptionExit: //, //发生异常退出 , (不可恢复的错误) BackColor = Color.DarkRed; statusLabelDevStatus.Text = "已停止/发生异常"; break; case JFWorkStatus.AbortExit: //, //由调用者强制退出 BackColor = Color.DarkRed; statusLabelDevStatus.Text = "已停止/指令强制"; break; default: //statusLabelDevStatus.Text = "状态未知:" + ws.ToString(); break; } } } if (_isLastAlarming) { return; } JFWorkStatus currWs = ms.WorkStatus; if (currWs == _lastStatus) { return; } _lastStatus = currWs; switch (_lastStatus) { case JFWorkStatus.UnStart: // = 0, //线程未开始运行 BackColor = Color.White; statusLabelDevStatus.Text = "未运行/已停止"; break; case JFWorkStatus.Running: //, //线程正在运行,未退出 BackColor = Color.Green; statusLabelDevStatus.Text = "运行中..."; break; case JFWorkStatus.Pausing: //, //线程暂停中 BackColor = Color.Yellow; statusLabelDevStatus.Text = "暂停中..."; break; case JFWorkStatus.Interactiving: //, //人机交互 , 等待人工干预指令 BackColor = Color.OrangeRed; statusLabelDevStatus.Text = "等待人工确认中..."; break; case JFWorkStatus.NormalEnd: //, //线程正常完成后退出 BackColor = Color.White; statusLabelDevStatus.Text = "已停止/正常结束"; break; case JFWorkStatus.CommandExit: //, //收到退出指令 BackColor = Color.White; statusLabelDevStatus.Text = "已停止/指令结束"; break; case JFWorkStatus.ErrorExit: //, //发生错误退出,(重启或人工消除错误后可恢复) BackColor = Color.DarkRed; statusLabelDevStatus.Text = "已停止/发生错误"; break; case JFWorkStatus.ExceptionExit: //, //发生异常退出 , (不可恢复的错误) BackColor = Color.DarkRed; statusLabelDevStatus.Text = "已停止/发生异常"; break; case JFWorkStatus.AbortExit: //, //由调用者强制退出 BackColor = Color.DarkRed; statusLabelDevStatus.Text = "已停止/指令强制"; break; default: //statusLabelDevStatus.Text = "状态未知:" + ws.ToString(); break; } }
bool _isStationWorking(JFWorkStatus status) { return(status == JFWorkStatus.Running || status == JFWorkStatus.Pausing || status == JFWorkStatus.Interactiving); }
/// <summary> /// 处理工站状态改变 /// </summary> /// <param name="station"></param> /// <param name="currWorkStatus"></param> public virtual void OnStationWorkStatusChanged(IJFStation station, JFWorkStatus currWorkStatus) { }
/// <summary> /// /// </summary> /// <param name="currWorkStatus"></param> public void OnWorkStatusChanged(object station, JFWorkStatus currWorkStatus) { if (!Created) { return; } if (InvokeRequired) { Invoke(new dgWorkStatusChanged(OnWorkStatusChanged), new object[] { station, currWorkStatus }); return; } string wsName = ""; switch (currWorkStatus) { case JFWorkStatus.UnStart: // = 0, //线程未开始运行 wsName = "未开始"; break; case JFWorkStatus.Running: //, //线程正在运行,未退出 wsName = "运行中"; break; case JFWorkStatus.Pausing: //, //线程暂停中 wsName = "已暂停"; break; case JFWorkStatus.Interactiving: //, //人机交互 , 等待人工干预指令 wsName = "人工干预"; break; case JFWorkStatus.NormalEnd: // //线程正常完成后退出 wsName = "正常结束"; break; case JFWorkStatus.CommandExit: //, //收到退出指令 wsName = "指令结束"; break; case JFWorkStatus.ErrorExit: //, //发生错误退出,(重启或人工消除错误后可恢复) wsName = "错误退出"; break; case JFWorkStatus.ExceptionExit: //, //发生异常退出 , (不可恢复的错误) wsName = "异常退出"; break; case JFWorkStatus.AbortExit: //, //由调用者强制退出 wsName = "强制终止"; break; default: wsName = currWorkStatus.ToString(); break; } if (_stationUI is IJFStationMsgReceiver) { (_stationUI as IJFStationMsgReceiver).OnWorkStatusChanged(currWorkStatus); } toolStripTextBoxWorkStatus.Text = "运行状态:" + wsName; ShowTips("运行状态:" + wsName); }
void StationWorkStatusChanged(object sender, JFWorkStatus currWorkStatus) { _StationWorkStatusChanged(sender as IJFStation, currWorkStatus, true); }
/// <summary> /// 处理工站状态改变 /// </summary> /// <param name="station"></param> /// <param name="currWorkStatus"></param> public void OnWorkStatusChanged(JFWorkStatus currWorkStatus) { if (InvokeRequired) { Invoke(new dgWorkStatusChanged(OnWorkStatusChanged), new object[] { currWorkStatus }); return; } switch (currWorkStatus) { case JFWorkStatus.UnStart: // = 0, //线程未开始运行 lampWorkStatus.LampColor = JFUI.LampButton.LColor.Gray; lampWorkStatus.Text = "未运行"; break; case JFWorkStatus.Running: //, //线程正在运行,未退出 if (!_isStationStartRunning) { _isStationStartRunning = true; _startTime = DateTime.Now; tbStartTime.Text = _startTime.ToString("yy-MM-dd HH:mm:ss"); timer1.Start(); //启动计时器 } lampWorkStatus.LampColor = JFUI.LampButton.LColor.Green; lampWorkStatus.Text = "运行中"; break; case JFWorkStatus.Pausing: //, //线程暂停中 lampWorkStatus.LampColor = JFUI.LampButton.LColor.Yellow; lampWorkStatus.Text = "暂停中"; break; case JFWorkStatus.Interactiving: //人机交互 ,需要人工干预的情况 lampWorkStatus.LampColor = JFUI.LampButton.LColor.Yellow; lampWorkStatus.Text = "人工干预"; break; case JFWorkStatus.NormalEnd: //, //线程正常完成后退出 _isStationStartRunning = false; timer1.Stop(); lampWorkStatus.LampColor = JFUI.LampButton.LColor.Gray; lampWorkStatus.Text = "正常结束"; break; case JFWorkStatus.CommandExit: //, //收到退出指令 _isStationStartRunning = false; timer1.Stop(); lampWorkStatus.LampColor = JFUI.LampButton.LColor.Gray; lampWorkStatus.Text = "命令结束"; break; case JFWorkStatus.ErrorExit: //, //发生错误退出 _isStationStartRunning = false; timer1.Stop(); lampWorkStatus.LampColor = JFUI.LampButton.LColor.Red; lampWorkStatus.Text = "错误退出"; break; case JFWorkStatus.ExceptionExit: //, //发生异常退出 _isStationStartRunning = false; timer1.Stop(); lampWorkStatus.LampColor = JFUI.LampButton.LColor.Red; lampWorkStatus.Text = "异常退出"; break; case JFWorkStatus.AbortExit: //由调用者强制退出 _isStationStartRunning = false; timer1.Stop(); lampWorkStatus.LampColor = JFUI.LampButton.LColor.Red; lampWorkStatus.Text = "强制退出"; break; default: lampWorkStatus.LampColor = JFUI.LampButton.LColor.Red; lampWorkStatus.Text = "未知状态"; break; } }
bool IsStationRunning(IJFStation station) { JFWorkStatus ws = station.CurrWorkStatus; return(ws == JFWorkStatus.Running || ws == JFWorkStatus.Pausing || ws == JFWorkStatus.Interactiving); }