/// <summary> /// 更新当前流程 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> public void UpdateFlowChart(CarLocationPanelLib.PushService.CDeviceStatusDto deviceStatus) { try { if (null == deviceStatus || (int)EnmSMGType.Hall != deviceStatus.devicetype) { return; } string strKey = "GbW" + deviceStatus.warehouse + "Hall" + deviceStatus.devicecode; Control control = this.tabPage1.Controls[strKey];// GbW1Hall11 if (null == control) { return; } Control controlE1 = null; Control controlE2 = null; if (1 < control.Controls.Count) { controlE1 = control.Controls[1]; } if (0 < control.Controls.Count) { controlE2 = control.Controls[0]; } if (null == controlE1 || typeof(CUserFlowChartControl) != controlE1.GetType() || null == controlE2 || typeof(CUserFlowChartControl) != controlE2.GetType()) { return; } CUserFlowChartControl cufccTempE1 = (CUserFlowChartControl)controlE1; CUserFlowChartControl cufccTempE2 = (CUserFlowChartControl)controlE2; cufccTempE1.Visible = true; cufccTempE2.Visible = true; // InvokeRequired需要比较调用线程ID和创建线程ID // 如果它们不相同则返回true if (cufccTempE1.InvokeRequired || cufccTempE2.InvokeRequired) { CUserFlowChartControlCallback d = new CUserFlowChartControlCallback(SetHallFlowChart); this.Invoke(d, deviceStatus, cufccTempE1, cufccTempE2); } else { SetHallFlowChart(deviceStatus, cufccTempE1, cufccTempE2); } #region 流程处理 int nPrevNode = 0; int nCurrentNode = 0; int nQueuePrevNode = 0; int nQueueCurrentNode = 0; if (!CBaseMethods.MyBase.IsEmpty(deviceStatus.prevnode)) { nPrevNode = (int)deviceStatus.prevnode; } if (!CBaseMethods.MyBase.IsEmpty(deviceStatus.currentnode)) { nCurrentNode = (int)deviceStatus.currentnode; } if (!CBaseMethods.MyBase.IsEmpty(deviceStatus.queueprevnode)) { nQueuePrevNode = (int)deviceStatus.queueprevnode; } if (!CBaseMethods.MyBase.IsEmpty(deviceStatus.queuecurrentnode)) { nQueueCurrentNode = (int)deviceStatus.queuecurrentnode; } if (CBaseMethods.MyBase.IsEmpty(deviceStatus.tasktype)) { if (EnmFlowTaskType.Init == cufccTempE1.EnumFlowTaskType) { cufccTempE1.SetFlowChartRunStatus(nPrevNode, nCurrentNode); } else { cufccTempE1.EnumFlowTaskType = EnmFlowTaskType.Init; } cufccTempE2.Visible = false; return; } EnmFlowTaskType enmFlow = EnmFlowTaskType.Init; bool IsTower = false;// 塔库标志 if (2 == deviceStatus.warehouse) {// 塔库 IsTower = true; } switch ((EnmTaskType)deviceStatus.tasktype) { case EnmTaskType.EntryTask: { if (IsTower) { enmFlow = EnmFlowTaskType.TowerEnter; } else { enmFlow = EnmFlowTaskType.NormEnter; } cufccTempE2.Visible = false; break; } case EnmTaskType.ExitTask: { if (IsTower) { enmFlow = EnmFlowTaskType.TowerExit; } else { enmFlow = EnmFlowTaskType.NormExit; } // 取车排队处理 if (0 == nQueuePrevNode && 0 == nQueueCurrentNode) { cufccTempE2.Visible = false; } else { cufccTempE2.Visible = true; if (cufccTempE2.EnumFlowTaskType == EnmFlowTaskType.QueueExit) { cufccTempE2.SetFlowChartRunStatus(nQueuePrevNode, nQueueCurrentNode); } else { cufccTempE2.EnumFlowTaskType = EnmFlowTaskType.QueueExit; } } break; } case EnmTaskType.TmpFetch: { enmFlow = EnmFlowTaskType.TmpFetch; cufccTempE2.Visible = false; break; } case EnmTaskType.MoveCarTask: { enmFlow = EnmFlowTaskType.MoveCar; cufccTempE2.Visible = false; break; } case EnmTaskType.MoveEquipTask: { enmFlow = EnmFlowTaskType.MoveEquip; cufccTempE2.Visible = false; break; } default: { cufccTempE2.Visible = false; break; } } if (enmFlow == cufccTempE1.EnumFlowTaskType) { cufccTempE1.SetFlowChartRunStatus(nPrevNode, nCurrentNode); } else { cufccTempE1.EnumFlowTaskType = enmFlow; } #endregion } catch (System.Exception exception) { MessageBox.Show(CStaticClass.GetExceptionInfo(exception), "应用程序异常", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
/// <summary> /// 设置某个车厅的流程图 /// </summary> /// <param name="dr"></param> /// <param name="cufccTempE1"></param> /// <param name="cufccTempE2"></param> private void SetHallFlowChart(CarLocationPanelLib.PushService.CDeviceStatusDto deviceStatus, CUserFlowChartControl cufccTempE1, CUserFlowChartControl cufccTempE2) { int nPrevNode = 0; int nCurrentNode = 0; int nQueuePrevNode = 0; int nQueueCurrentNode = 0; if (!CBaseMethods.MyBase.IsEmpty(deviceStatus.prevnode)) { nPrevNode = (int)deviceStatus.prevnode; } if (!CBaseMethods.MyBase.IsEmpty(deviceStatus.currentnode)) { nCurrentNode = (int)deviceStatus.currentnode; } if (!CBaseMethods.MyBase.IsEmpty(deviceStatus.queueprevnode)) { nQueuePrevNode = (int)deviceStatus.queueprevnode; } if (!CBaseMethods.MyBase.IsEmpty(deviceStatus.queuecurrentnode)) { nQueueCurrentNode = (int)deviceStatus.queuecurrentnode; } if (CBaseMethods.MyBase.IsEmpty(deviceStatus.tasktype)) { if (EnmFlowTaskType.Init != cufccTempE1.EnumFlowTaskType) { cufccTempE1.EnumFlowTaskType = EnmFlowTaskType.Init; } cufccTempE2.Visible = false; return; } EnmFlowTaskType enmFlow = EnmFlowTaskType.Init; bool IsTower = false;// 塔库标志 if (2 == deviceStatus.warehouse) {// 塔库 IsTower = true; } switch ((EnmTaskType)deviceStatus.tasktype) { case EnmTaskType.EntryTask: { if (IsTower) { enmFlow = EnmFlowTaskType.TowerEnter; } else { enmFlow = EnmFlowTaskType.NormEnter; } cufccTempE2.Visible = false; break; } case EnmTaskType.ExitTask: { if (IsTower) { enmFlow = EnmFlowTaskType.TowerExit; } else { enmFlow = EnmFlowTaskType.NormExit; } // 取车排队处理 if (0 == nQueuePrevNode && 0 == nQueueCurrentNode) { cufccTempE2.Visible = false; } else { cufccTempE2.Visible = true; if (cufccTempE2.EnumFlowTaskType == EnmFlowTaskType.QueueExit) { cufccTempE2.SetFlowChartRunStatus(nQueuePrevNode, nQueueCurrentNode); } else { cufccTempE2.EnumFlowTaskType = EnmFlowTaskType.QueueExit; cufccTempE2.SetFlowChartRunStatus(nQueuePrevNode, nQueueCurrentNode); } } break; } case EnmTaskType.TmpFetch: { enmFlow = EnmFlowTaskType.TmpFetch; cufccTempE2.Visible = false; break; } case EnmTaskType.MoveCarTask: { enmFlow = EnmFlowTaskType.MoveCar; cufccTempE2.Visible = false; break; } case EnmTaskType.MoveEquipTask: { enmFlow = EnmFlowTaskType.MoveEquip; cufccTempE2.Visible = false; break; } default: { cufccTempE2.Visible = false; break; } } if (enmFlow == cufccTempE1.EnumFlowTaskType) { if (EnmFlowTaskType.Init != enmFlow) { cufccTempE1.SetFlowChartRunStatus(nPrevNode, nCurrentNode); } } else { cufccTempE1.EnumFlowTaskType = enmFlow; cufccTempE1.SetFlowChartRunStatus(nPrevNode, nCurrentNode); } this.OnResize(null); }
/// <summary> ///WCF回调子函数 /// </summary> /// <param name="e"></param> private void CallBackSubFunction(object e) { if (e.GetType() == typeof(CarLocationPanelLib.PushService.CCarLocationDto)) {// 更新当前某一车位状态 CarLocationPanelLib.PushService.CCarLocationDto carLocation = (CarLocationPanelLib.PushService.CCarLocationDto)e; string strName = carLocation.warehouse.ToString(); CWareHousePanel wareHouseTabPage = (CWareHousePanel)m_ltpWareHouse.Find(a => a.Name == strName); wareHouseTabPage.UpdateCarLocationStatus(carLocation); SetStatusStripValue(); //CLOGException.Trace("CallBackSubFunction, carLocation.carlocaddr:" + carLocation.carlocaddr); //SetStatusStripValue(e); } else if (e.GetType() == typeof(CarLocationPanelLib.PushService.CDeviceStatusDto)) {// 更新当前某一设备状态 CarLocationPanelLib.PushService.CDeviceStatusDto deviceStatus = (CarLocationPanelLib.PushService.CDeviceStatusDto)e; CLOGException.Trace(0, "callback_CallbackEvent, e:", string.Format("deviceStatus.warehouse-{0} deviceStatus.devicecode-{1}", deviceStatus.warehouse, deviceStatus.devicecode)); if ((int)EnmSMGType.ETV == deviceStatus.devicetype) { // 客户端界面ETV位置更新 string strName = deviceStatus.warehouse.ToString(); CWareHousePanel wareHouseTabPage = (CWareHousePanel)m_ltpWareHouse.Find(a => a.Name == strName); wareHouseTabPage.UpdateDeviceStatus(deviceStatus); if (m_formETV.Visible && null != m_formETV.EquipDeviceStatus && m_formETV.EquipDeviceStatus.warehouse == deviceStatus.warehouse && m_formETV.EquipDeviceStatus.devicecode == deviceStatus.devicecode) {// 更新ETV设备信息界面 m_formETV.FillFormEquip(CStaticClass.ConvertDeviceStatus(deviceStatus)); } } else if (m_formHall.Visible && null != m_formHall.EquipDeviceStatus && m_formHall.EquipDeviceStatus.warehouse == deviceStatus.warehouse && m_formHall.EquipDeviceStatus.devicecode == deviceStatus.devicecode) {// 更新车厅设备信息界面 m_formHall.FillFormHall(CStaticClass.ConvertDeviceStatus(deviceStatus)); } List <object> lstETV = CStaticClass.ConfigLstETVOrTVDeviceID(deviceStatus.warehouse); if (null != lstETV && 1 > lstETV.Count) { // 无ETV时,客户端界面ETV颜色更新 string strName = deviceStatus.warehouse.ToString(); CWareHousePanel wareHouseTabPage = (CWareHousePanel)m_ltpWareHouse.Find(a => a.Name == strName); wareHouseTabPage.UpdateDeviceStatus(deviceStatus); } if (null != m_formSystemConfig) { m_formSystemConfig.UpdateDeviceIsable(deviceStatus); } if (null == m_formCIMCWorker) { m_formCIMCWorker = new CFormCIMCWorker(); } m_formCIMCWorker.UpdateFlowChart(deviceStatus); } else if (e.GetType() == typeof(CarLocationPanelLib.PushService.CDeviceFaultDto)) {// 更新当前某一label设备故障 CarLocationPanelLib.PushService.CDeviceFaultDto deviceFault = (CarLocationPanelLib.PushService.CDeviceFaultDto)e; // 客户端界面设备故障状态更新 string strName = deviceFault.warehouse.ToString(); CWareHousePanel wareHouseTabPage = (CWareHousePanel)m_ltpWareHouse.Find(a => a.Name == strName); string str = wareHouseTabPage.UpdateDeviceFault(deviceFault); if (!this.TsslPLC.Text.Contains(str)) {// 获取当前故障设备 this.TsslPLC.Text += str; } // 客户端设备故障界面更新 if (null != m_formDeviceFault) { m_formDeviceFault.UpdateDeviceFault(deviceFault); } } }