/// <summary> /// 初始化函数 /// </summary> public void Init() { try { #region Led绑定 for (int nCounter = 0; nCounter < m_lstPLCID.Count; nCounter++) { Dictionary <int, CLedShower> dicHallHasLED = new Dictionary <int, CLedShower>(); Dictionary <int, struHallEquips> dictHallID = (Dictionary <int, struHallEquips>)CConfigManagement.myPara.DicHallIDDictionary[m_lstPLCID[nCounter]];//.GetHallIDDictionary(m_nPLCID); foreach (KeyValuePair <int, struHallEquips> pair in dictHallID) { struHallEquips hallEquip = pair.Value; if (hallEquip.nLEDAddress != 0) { CLedShower led = new CLedShower(hallEquip.nLEDAddress); dicHallHasLED.Add(pair.Key, led); CLOGException.Trace("AddLEDDevice", string.Format("Info- warehouse:{0},hallID:{1},ledCom:{2}", nCounter + 1, pair.Key, hallEquip.nLEDAddress)); } } m_dicLEDdevieLst.Add(m_lstPLCID[nCounter], dicHallHasLED); } #endregion for (int nCounter = 0; nCounter < m_lstPLCID.Count; nCounter++) { m_PLCThreads[nCounter] = new Thread(StartThread);//启动业务线程 if (null != m_PLCThreads[nCounter]) { CLOGException.Trace(m_lstPLCID[nCounter], "IEG_AP_Proc", "Start programme...(Ver:AutoParkingV200R001C01SPC100|AutoParkingV200R001C01SPC100)"); m_PLCThreads[nCounter].IsBackground = true;//后台线程在主线程关闭时,子线程随之关闭,速度很快。 m_PLCThreads[nCounter].Start(m_lstPLCID[nCounter]); } } } catch (Exception ex) { CLOGException.Trace("WorkFlowLib.CMainEntrance.Init 异常", CBaseMethods.MyBase.GetExceptionInfo(ex)); } }
private void LedShowMsg() { #region while (isStartLed) { List <CDeviceStatusDto> hallDevs = CCommonMethods.myMethods.GetDeviceStatusList(m_nPLCID, EnmSMGType.Hall); foreach (CDeviceStatusDto hall in hallDevs) { #region CLedShower led = null; if (m_dicLEDDevice.ContainsKey(hall.devicecode)) { led = m_dicLEDDevice[hall.devicecode]; } if (led != null) { string message = ""; switch ((EnmModel)hall.devicemode) { case EnmModel.Automatic: int freeLctns = CCommonMethods.myMethods.GetFreeCarPOSN(hall.warehouse); message = "空余" + freeLctns.ToString().PadRight(5, ' '); break; case EnmModel.Manual: message = "手动模式"; break; case EnmModel.StandAlone: message = "单机自动"; break; case EnmModel.Maintenance: message = "维修模式"; break; default: message = " " + (hall.devicecode - 10).ToString() + "号车厅"; break; } if (hall.tasktype != (int)EnmTaskType.Init) { switch ((EnmTaskType)hall.tasktype) { case EnmTaskType.EntryTask: message = "存车 "; break; case EnmTaskType.ExitTask: message = "取车 "; break; case EnmTaskType.TmpFetch: message = "取物 "; break; default: message = "作业 "; break; } if (!CBaseMethods.MyBase.IsEmpty(hall.iccode)) { message = message.Trim(); message += hall.iccode; } } led.ConnectLed(); led.DisplayMessagge(message); led.disConnectLed(); } #endregion } Thread.Sleep(1000); } #endregion }