Exemple #1
0
        /// <summary>
        /// 更新单个label设备故障
        /// </summary>
        /// <param name="deviceFault"></param>
        public void UpdateDeviceFault(CarLocationPanelLib.PushService.CDeviceFaultDto deviceFault)
        {
            int     nWareHouse = (int)deviceFault.warehouse;
            int     nDeviceID  = (int)deviceFault.devicecode;
            string  strName    = CStaticClass.ConvertWareHouse(nWareHouse) + nDeviceID + "#";// nWareHouse + "#库" + nDeviceID + "#";
            TabPage selectTab  = m_ltpWareHouse.Find(a => a.Name.Contains(strName));

            if (null == selectTab)
            {
                TabPage tp = new TabPage();
                tp.AutoScroll = true;
                tp.Font       = new System.Drawing.Font("宋体", 9F);
                tp.Name       = strName;
                if (0 < nDeviceID && 10 > nDeviceID)
                {
                    tp.Text = strName + "ETV";
                }
                else if (10 < nDeviceID && 20 > nDeviceID)
                {
                    tp.Text = strName + "车厅";
                }
                else if (20 < nDeviceID && 30 > nDeviceID)
                {
                    tp.Text = strName + "TV";
                }

                SetTabPageLayout(tp, nWareHouse, nDeviceID);
                m_ltpWareHouse.Add(tp);
                this.TabDeviceFault.Controls.Add(tp);
                selectTab = tp;
                //this.TabDeviceFault.SelectTab(tp);
            }

            UpdateFaultColor(selectTab, deviceFault);
        }
Exemple #2
0
        /// <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);
                }
            }
        }
Exemple #3
0
        /// <summary>
        /// 更新单个label设备故障颜色
        /// </summary>
        /// <param name="tabPage"></param>
        /// <param name="deviceFault"></param>
        private void UpdateFaultColor(TabPage tabPage, CarLocationPanelLib.PushService.CDeviceFaultDto deviceFault)
        {
            //try
            //{
            if (null == deviceFault || null == tabPage)
            {
                return;
            }

            foreach (Control label in tabPage.Controls)
            {
                int nPLCAddr;
                int.TryParse(label.Name.Substring(1), out nPLCAddr);
                if (deviceFault.faultaddress != nPLCAddr)
                {
                    continue;
                }

                switch (deviceFault.color)
                {
                case 4:
                    label.BackColor = Color.Cyan;
                    break;

                case 1:
                    label.BackColor = Color.Red;
                    break;

                case 2:
                    label.BackColor = Color.Yellow;
                    break;

                case 3:
                    label.BackColor = Color.Green;
                    break;

                default:
                    label.BackColor = Color.LightSkyBlue;
                    break;
                }

                return;
            }
            //}
            //catch (TimeoutException)
            //{
            //    MessageBox.Show("The service operation timed out. ", "超时", MessageBoxButtons.OK, MessageBoxIcon.Error);
            //}
            //catch (FaultException exception)
            //{
            //    MessageBox.Show(CStaticClass.GetExceptionInfo(exception), "SOAP错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
            //}
            //catch (CommunicationException exception)
            //{
            //    MessageBox.Show("There was a communication problem. " + CStaticClass.GetExceptionInfo(exception), "通信错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
            //}
            //catch (Exception exception)
            //{
            //    MessageBox.Show(CStaticClass.GetExceptionInfo(exception), "应用程序异常", MessageBoxButtons.OK, MessageBoxIcon.Error);
            //}
        }