private void btStart_Click(object sender, EventArgs e) { JFWorkCmdResult ret = cmdWorker.Start(); if (ret != JFWorkCmdResult.Success) { MessageBox.Show("启动失败,ret = " + ret.ToString()); } }
private void btSendCmd_Click(object sender, EventArgs e) { if (cbCmds.SelectedIndex < 0) { MessageBox.Show("请先选择需要发送的指令"); return; } JFWorkCmdResult ret = cmdWorker.SendCmd(cmdWorker.AllCmds[cbCmds.SelectedIndex], 1000); if (ret != JFWorkCmdResult.Success) { MessageBox.Show("发送指令失败,ret = " + ret.ToString()); } }
/// <summary>从暂停中恢复运行</summary> public virtual bool Resume(out string errorInfo) { errorInfo = "Unknown Error"; if (WorkStatus == JFWorkStatus.Running) { errorInfo = "当前正在运行!恢复运行指令将被忽略"; return(true); } if (WorkStatus != JFWorkStatus.Pausing) { errorInfo = "当前状态 = " + WorkStatus + ",不能响应恢复运行指令"; return(false); } JFStationManager stationMgr = JFHubCenter.Instance.StationMgr; string[] allEnableStationNames = stationMgr.AllEnabledStationNames(); if (null == allEnableStationNames || 0 == allEnableStationNames.Length) { errorInfo = "无使能工站"; return(false); } foreach (string sn in allEnableStationNames) { IJFStation station = stationMgr.GetStation(sn); JFWorkCmdResult ret = station.Resume(1000); if (ret != JFWorkCmdResult.Success) { errorInfo = "工站:" + station.Name + "恢复运行失败:" + ret.ToString(); return(false); } } errorInfo = "Success"; WorkStatus = JFWorkStatus.Running; return(true); }
/// <summary>暂停</summary> public virtual bool Pause(out string errorInfo) { errorInfo = "Unknown Error"; if (WorkStatus != JFWorkStatus.Running) { errorInfo = "设备当前状态:" + WorkStatus.ToString(); return(false); } if (WorkStatus == JFWorkStatus.Pausing) { errorInfo = "Success"; return(true); } JFStationManager stationMgr = JFHubCenter.Instance.StationMgr; string[] allEnableStationNames = stationMgr.AllEnabledStationNames(); if (null == allEnableStationNames || 0 == allEnableStationNames.Length) { errorInfo = "无使能工站"; return(false); } foreach (string sn in allEnableStationNames) { IJFStation station = stationMgr.GetStation(sn); JFWorkCmdResult ret = station.Pause(-1); if (ret != JFWorkCmdResult.Success) { errorInfo = "工站:" + station.Name + " 暂停失败:" + ret.ToString(); return(false); } } WorkStatus = JFWorkStatus.Pausing; errorInfo = "Success"; return(true); }
public virtual bool Start(out string errorInfo)//开始运行 { errorInfo = "Unknown Error"; if (IsAlarming) { errorInfo = "当前处于报警状态"; return(false); } if (IsStationRunning(WorkStatus)) { errorInfo = "Success"; return(true); } JFStationManager stationMgr = JFHubCenter.Instance.StationMgr; string[] allEnableStationNames = stationMgr.AllEnabledStationNames(); if (null == allEnableStationNames || 0 == allEnableStationNames.Length) { errorInfo = "不存在使能的工站"; return(false); } foreach (string stationName in allEnableStationNames) // 先检查有没有正在运行的工站 { IJFStation station = stationMgr.GetStation(stationName); if (IsStationRunning(station.CurrWorkStatus)) { errorInfo = "启动失败,工站:" + station.Name + " 当前状态:" + station.CurrWorkStatus.ToString(); return(false); } } int failedIndex = -1; //启动失败的工站号 foreach (string stationName in allEnableStationNames) { IJFStation station = stationMgr.GetStation(stationName); JFWorkCmdResult ret = station.Start(); if (ret != JFWorkCmdResult.Success) { errorInfo = "工站:" + station.Name + " 启动失败,Error:" + ret.ToString(); break; } } if (failedIndex > -1) { for (int i = 0; i < failedIndex + 1; i++) { IJFStation station = stationMgr.GetStation(allEnableStationNames[i]); if (JFWorkCmdResult.Success != station.Stop(100)) { station.Abort(); } } return(false); } WorkStatus = JFWorkStatus.Running; errorInfo = "Success"; return(true); }
public virtual bool Start(out string errorInfo)//开始运行 { errorInfo = "Unknown Error"; if (IsAlarming) { errorInfo = "当前处于报警状态"; return(false); } if (IsStationRunning(WorkStatus)) { errorInfo = "Success"; return(true); } JFDLAFRecipeManager rm = JFHubCenter.Instance.RecipeManager as JFDLAFRecipeManager; if (null == rm) { errorInfo = "配方管理器未创建!"; return(false); } if (!rm.IsInitOK) { errorInfo = "配方管理器初始化未完成,ErrorInfo:" + rm.GetInitErrorInfo(); return(false); } JFStationManager stationMgr = JFHubCenter.Instance.StationMgr; string[] allEnableStationNames = stationMgr.AllEnabledStationNames(); if (null == allEnableStationNames || 0 == allEnableStationNames.Length) { errorInfo = "不存在使能的工站"; return(false); } foreach (string stationName in allEnableStationNames) // 先检查有没有正在运行的工站 { IJFStation station = stationMgr.GetStation(stationName); if (IsStationRunning(station.CurrWorkStatus)) { errorInfo = "启动失败,工站:" + station.Name + " 当前状态:" + station.CurrWorkStatus.ToString(); return(false); } } ///检查当前RecipeID 和 LotID if (string.IsNullOrEmpty(CurrRecipeID)) { errorInfo = "启动失败:当前产品ID未设置"; return(false); } string[] allRecipeIDs = rm.AllRecipeIDsInCategoty(SCN_CategotyProd); if (null == allRecipeIDs || !allRecipeIDs.Contains(CurrRecipeID)) { errorInfo = "启动失败,当前产品ID:" + CurrRecipeID + " 在配方管理器中不存在"; return(false); } if (string.IsNullOrEmpty(CurrLotID)) { errorInfo = "启动失败:当前批次号未设置!"; return(false); } int failedIndex = -1; //启动失败的工站号 foreach (string stationName in allEnableStationNames) { IJFStation station = stationMgr.GetStation(stationName); JFWorkCmdResult ret = station.Start(); if (ret != JFWorkCmdResult.Success) { errorInfo = "工站:" + station.Name + " 启动失败,Error:" + ret.ToString(); break; } } if (failedIndex > -1) { for (int i = 0; i < failedIndex + 1; i++) { IJFStation station = stationMgr.GetStation(allEnableStationNames[i]); if (JFWorkCmdResult.Success != station.Stop(100)) { station.Abort(); } } return(false); } WorkStatus = JFWorkStatus.Running; errorInfo = "Success"; return(true); }