/// <summary> /// 系统控制初始化 /// </summary> /// <returns></returns> public bool SysCtlInit() { try { mesAcc = new PrcsCtlModelsAoyou.MesAccAoyou(); ctlNodeManager.DevCommManager = devCommManager; // 1加载配置文件 string reStr = ""; XElement root = null; SysCfg.SysCfgModel.cfgFilefullPath = AppDomain.CurrentDomain.BaseDirectory + @"\data\AoyouWCSCfg.xml"; if (!SysCfg.SysCfgModel.LoadCfg(ref root, ref reStr)) { Console.WriteLine("系统配置解析错误,{0}", reStr); return(false); } if (root.Element("sysSet").Element("ExtLogSrc") != null) { string logSrcStr = root.Element("sysSet").Element("ExtLogSrc").Value.ToString(); ExtLogSrc = logSrcStr.Split(new string[] { ",", ";" }, StringSplitOptions.RemoveEmptyEntries); } //2 初始化通信模块 XElement commDevXERoot = root.Element("CommDevCfg"); if (!devCommManager.ParseCommdev(commDevXERoot, ref reStr)) { Console.WriteLine("通信设备配置参数解析设备:" + reStr); return(false); } devCommManager.CommDevConnect(); //3 初始化立库控制系统 XElement asrsRoot = root.Element("AsrsNodes"); if (!asrsPresenter.CtlInit(asrsRoot, ref reStr)) { Console.WriteLine("立库控制系统初始化失败:" + reStr); return(false); } foreach (AsrsControl.AsrsCtlModel asrsCtl in asrsPresenter.AsrsCtls) { asrsCtl.dlgtAsrsOutportBusiness = AsrsOutportBusiness; asrsCtl.dlgtGetLogicArea = AsrsAreaToCheckin; } //4 初始化流水线控制系统 XElement prcsNodeRoot = root.Element("CtlNodes"); if (!prsNodeManager.CtlInit(prcsNodeRoot, ref reStr)) { Console.WriteLine("流水线系统初始化失败:" + reStr); return(false); } //5 注册控制节点 ctlNodeManager.AddCtlNodeRange(prsNodeManager.GetAllCtlNodes()); ctlNodeManager.AddCtlNodeRange(asrsPresenter.GetAllCtlNodes()); foreach (FlowCtlBaseModel.CtlNodeBaseModel node in ctlNodeManager.MonitorNodeList) { node.MesAcc = mesAcc; } foreach (AsrsControl.AsrsCtlModel asrsCtl in asrsPresenter.AsrsCtls) { asrsCtl.MesAcc = mesAcc; } taskRunCtl = new PrcsCtlModelsAoyou.CtlTaskManage(); taskRunCtl.WmsSvc = WmsSvc; taskRunCtl.NodeManager = ctlNodeManager; if (!taskRunCtl.Init()) { Console.WriteLine("任务控制管理初始化失败"); return(false); } XElement wcsPathRoot = root.Element("WCSPath"); if (!taskRunCtl.BuildFlowPath(wcsPathRoot, ref reStr)) { Console.WriteLine("WCS路径配置错误,{0}", reStr); return(false); } //注册限高检测委托 List <string> heightCheckStations = new List <string>(); heightCheckStations.AddRange(new string[] { "12112" }); foreach (string devID in heightCheckStations) { TransDevModel.NodeTransStation transDev = ctlNodeManager.GetNodeByID(devID) as TransDevModel.NodeTransStation; if (transDev == null) { continue; } transDev.dlgtHeightChecked = AsrsHeightChecked; } //6 通信设备分配 ctlNodeManager.AllocateCommdev(); asrsPresenter.DevStatusRestore(); prsNodeManager.DevStatusRestore(); //建立节点路径 // ctlNodeManager.BuildNodePath(); //7 线程分配 XElement threadRoot = root.Element("ThreadAlloc"); if (!ctlNodeManager.ParseTheadNodes(threadRoot, ref reStr)) { Console.WriteLine("分配线程时出现错误"); return(false); } return(true); } catch (Exception ex) { Console.WriteLine("控制系统初始化错误:" + ex.ToString()); return(false); } }
/// <summary> /// 系统控制初始化 /// </summary> /// <returns></returns> public bool SysCtlInit() { try { mesAcc = new PrcsCtlModelsAoyouCp.MesAccAoyou(); ctlNodeManager.DevCommManager = devCommManager; // 1加载配置文件 string reStr = ""; XElement root = null; SysCfg.SysCfgModel.cfgFilefullPath = AppDomain.CurrentDomain.BaseDirectory + @"\data\AoyouCfgCp.xml"; if (!SysCfg.SysCfgModel.LoadCfg(ref root, ref reStr)) { Console.WriteLine("系统配置解析错误,{0}", reStr); return(false); } if (root.Element("sysSet").Element("ExtLogSrc") != null) { string logSrcStr = root.Element("sysSet").Element("ExtLogSrc").Value.ToString(); ExtLogSrc = logSrcStr.Split(new string[] { ",", ";" }, StringSplitOptions.RemoveEmptyEntries); } //2 初始化通信模块 XElement commDevXERoot = root.Element("CommDevCfg"); if (!devCommManager.ParseCommdev(commDevXERoot, ref reStr)) { Console.WriteLine("通信设备配置参数解析设备:" + reStr); return(false); } devCommManager.CommDevConnect(); //3 初始化立库控制系统 XElement asrsRoot = root.Element("AsrsNodes"); if (!asrsPresenter.CtlInit(asrsRoot, ref reStr)) { Console.WriteLine("立库控制系统初始化失败:" + reStr); return(false); } foreach (AsrsControl.AsrsCtlModel asrsCtl in asrsPresenter.AsrsCtls) { asrsCtl.dlgtAsrsOutportBusiness = AsrsOutportBusiness; asrsCtl.dlgtGetLogicArea = AsrsAreaToCheckin; } //4 初始化流水线控制系统 XElement prcsNodeRoot = root.Element("CtlNodes"); if (!prsNodeManager.CtlInit(prcsNodeRoot, ref reStr)) { Console.WriteLine("流水线系统初始化失败:" + reStr); return(false); } //5 注册控制节点 ctlNodeManager.AddCtlNodeRange(prsNodeManager.GetAllCtlNodes()); ctlNodeManager.AddCtlNodeRange(asrsPresenter.GetAllCtlNodes()); foreach (FlowCtlBaseModel.CtlNodeBaseModel node in ctlNodeManager.MonitorNodeList) { node.MesAcc = mesAcc; } foreach (AsrsControl.AsrsCtlModel asrsCtl in asrsPresenter.AsrsCtls) { asrsCtl.MesAcc = mesAcc; } //6 通信设备分配 ctlNodeManager.AllocateCommdev(); asrsPresenter.DevStatusRestore(); prsNodeManager.DevStatusRestore(); //建立节点路径 ctlNodeManager.BuildNodePath(); //7 线程分配 XElement threadRoot = root.Element("ThreadAlloc"); if (!ctlNodeManager.ParseTheadNodes(threadRoot, ref reStr)) { Console.WriteLine("分配线程时出现错误"); return(false); } return(true); } catch (Exception ex) { Console.WriteLine("控制系统初始化错误:" + ex.ToString()); return(false); } }
/// <summary> /// 系统控制初始化 /// </summary> /// <returns></returns> public bool SysCtlInit() { try { mesAcc = new PrcsCtlModelsAoyou.MesAccAoyou(); ctlNodeManager.DevCommManager = devCommManager; // 1加载配置文件 string reStr = ""; XElement root = null; SysCfg.SysCfgModel.cfgFilefullPath = AppDomain.CurrentDomain.BaseDirectory + @"\data\AoyouCfg.xml"; if (!SysCfg.SysCfgModel.LoadCfg(ref root, ref reStr)) { Console.WriteLine("系统配置解析错误,{0}", reStr); return(false); } if (root.Element("sysSet").Element("ExtLogSrc") != null) { string logSrcStr = root.Element("sysSet").Element("ExtLogSrc").Value.ToString(); ExtLogSrc = logSrcStr.Split(new string[] { ",", ";" }, StringSplitOptions.RemoveEmptyEntries); } //2 初始化通信模块 XElement commDevXERoot = root.Element("CommDevCfg"); if (!devCommManager.ParseCommdev(commDevXERoot, ref reStr)) { Console.WriteLine("通信设备配置参数解析设备:" + reStr); return(false); } devCommManager.CommDevConnect(); //3 初始化立库控制系统 XElement asrsRoot = root.Element("AsrsNodes"); if (!asrsPresenter.CtlInit(asrsRoot, ref reStr)) { Console.WriteLine("立库控制系统初始化失败:" + reStr); return(false); } foreach (AsrsControl.AsrsCtlModel asrsCtl in asrsPresenter.AsrsCtls) { asrsCtl.dlgtAsrsOutportBusiness = AsrsOutportBusiness; if (asrsCtl.HouseName == "A1库房" || asrsCtl.HouseName == "A2库房" || asrsCtl.HouseName == "C1库房" || asrsCtl.HouseName == "C2库房" || asrsCtl.HouseName == "C3库房") { asrsCtl.dlgtGetAsrsCheckoutTaskTorun = AsrsCheckoutTaskTorun; } asrsCtl.dlgtGetLogicArea = AsrsAreaToCheckin; if (asrsCtl.HouseName == "B1库房") { asrsCtl.dlgtAsrsOutTaskPost = AsrsOutTaskBusiness; } foreach (AsrsPortalModel port in asrsCtl.Ports) { port.dlgtGroupEnabled = AsrsCheckinGroupEnabled; if (asrsCtl.NodeName == "C1库房" || asrsCtl.NodeName == "C2库房" || asrsCtl.NodeName == "C3库房") { port.dlgtBarcodeCheck = AsrsPortBarcodeCheck;//条码校验 } } } //4 初始化流水线控制系统 XElement prcsNodeRoot = root.Element("CtlNodes"); if (!prsNodeManager.CtlInit(prcsNodeRoot, ref reStr)) { Console.WriteLine("流水线系统初始化失败:" + reStr); return(false); } //5 注册控制节点 ctlNodeManager.AddCtlNodeRange(prsNodeManager.GetAllCtlNodes()); ctlNodeManager.AddCtlNodeRange(asrsPresenter.GetAllCtlNodes()); foreach (FlowCtlBaseModel.CtlNodeBaseModel node in ctlNodeManager.MonitorNodeList) { node.MesAcc = mesAcc; } foreach (AsrsControl.AsrsCtlModel asrsCtl in asrsPresenter.AsrsCtls) { asrsCtl.MesAcc = mesAcc; } (ctlNodeManager.GetNodeByID("4004") as PrcsCtlModelsAoyou.NodeSwitchInput).dlgtGetLogicArea = AsrsAreaToCheckin; //6 通信设备分配 ctlNodeManager.AllocateCommdev(); asrsPresenter.DevStatusRestore(); prsNodeManager.DevStatusRestore(); //建立节点路径 ctlNodeManager.BuildNodePath(); //7 线程分配 XElement threadRoot = root.Element("ThreadAlloc"); if (!ctlNodeManager.ParseTheadNodes(threadRoot, ref reStr)) { Console.WriteLine("分配线程时出现错误"); return(false); } //historyDataClearThread = new ThreadBaseModel("历史数据集清理"); //historyDataClearThread.SetThreadRoutine(ClearHistoryLoop); //historyDataClearThread.LoopInterval = 5000; //historyDataClearThread.TaskInit(); return(true); } catch (Exception ex) { Console.WriteLine("控制系统初始化错误:" + ex.ToString()); return(false); } }