예제 #1
0
        /// <summary>
        /// 更新某一ETV当前位置
        /// </summary>
        public override void UpdateDeviceStatus(CarLocationPanelLib.PushService.CDeviceStatusDto deviceStatus)
        {
            Label lblTV = m_lLblETVEquip.Find(s => s.Name == deviceStatus.devicecode.ToString());

            if (null == lblTV)
            {
                return;
            }
            QueryServiceClient proxy = new QueryServiceClient();
            List <CarLocationPanelLib.QueryService.CDeviceFaultDto> lstDeviceFault = proxy.GetDeviceFault(m_wareHouse, deviceStatus.devicecode, string.Empty);

            lstDeviceFault = lstDeviceFault.FindAll(s => s.color == 1);
            proxy.Close();
            if (0 < lstDeviceFault.Count)
            {
                lblTV.BackColor = Color.Red;
            }
            else
            {
                // 正在作业ETV颜色为蓝色、不可用/不可接受指令为黄色、正常绿色
                SetDeviceBackColor(lblTV, deviceStatus);
            }

            #region 根据当前库车位信息设置ETV设备位置
            // 根据当前库车位信息列表设置车位状态
            string strAddr = deviceStatus.deviceaddr;

            DataGridView     dgv  = null;
            DataGridViewCell cell = null;
            GetDgvcIndexByAddr(strAddr, ref dgv, ref cell);
            if (null == dgv || null == cell)
            {
                return;
            }
            // 获取当前单元格相对位置
            int nX = dgv.Location.X;
            int nY = dgv.Location.Y;
            for (int i = 0; i < cell.ColumnIndex && i < dgv.ColumnCount; i++)
            {
                nX += dgv.Columns[i].Width;
            }

            for (int i = 0; i < cell.RowIndex && i < dgv.RowCount; i++)
            {
                nY += dgv.Rows[i].Height;
            }
            // 设置ETV位置
            lblTV.BeginInvoke(new beginInvokeDelegate(SetETVLocation), lblTV, nX, nY);
            #endregion
        }
예제 #2
0
        /// <summary>
        /// 更新某一设备故障报警情况
        /// </summary>
        public override string UpdateDeviceFault(CarLocationPanelLib.PushService.CDeviceFaultDto deviceFault)
        {
            string strResult = string.Empty;

            if (!CStaticClass.GetPushServiceConnectFlag())
            {// 服务器通道断开时
                return(strResult);
            }

            QueryServiceClient proxy = new QueryServiceClient();

            if (null == deviceFault.devicecode)
            {
                return(strResult);
            }

            CarLocationPanelLib.QueryService.CDeviceStatusDto deviceStatus = proxy.GetDeviceStatus(m_wareHouse, (int)deviceFault.devicecode);

            if (null == deviceStatus)
            {
                return(strResult);
            }

            List <CarLocationPanelLib.QueryService.CDeviceFaultDto> lstDeviceFault = proxy.GetDeviceFault(m_wareHouse, deviceStatus.devicecode, string.Empty);

            lstDeviceFault = lstDeviceFault.FindAll(s => s.color == 1);

            if ((int)EnmSMGType.ETV == deviceStatus.devicetype)
            {
                Label lblTV = m_lLblETVEquip.Find(s => s.Name == deviceStatus.devicecode.ToString());
                if (null == lblTV)
                {
                    return(strResult);
                }
                // ETV设备
                if (0 >= lstDeviceFault.Count)
                {// 该设备无报警
                 // 正在作业ETV颜色为蓝色、不可用/不可接受指令为黄色、正常绿色
                    SetDeviceBackColor(lblTV, deviceStatus);
                }
                else
                {
                    lblTV.BackColor = Color.Red;
                    strResult       = CStaticClass.ConvertWareHouse(m_wareHouse) + CStaticClass.ConvertHallDescp(m_wareHouse, deviceStatus.devicecode);//  "   " + m_wareHouse + "#库车厅" + deviceStatus.devicecode;
                }
            }
            else
            {// 车厅
             // 根据当前库车位信息列表设置车位状态
                DataGridView     dgvHall = null;
                DataGridViewCell dgvc    = null;

                List <string> hallsAddrs = new List <string>();
                hallsAddrs.Add(deviceStatus.deviceaddr.Substring(0, 3) + "03");
                hallsAddrs.Add(deviceStatus.deviceaddr.Substring(0, 3) + "02");
                hallsAddrs.Add(deviceStatus.deviceaddr.Substring(0, 3) + "01");
                foreach (string hallAddrs in hallsAddrs)
                {
                    GetDgvcIndexByAddr(hallAddrs, ref dgvHall, ref dgvc);
                    if (null == dgvc || (int)EnmSMGType.Hall != deviceStatus.devicetype)
                    {
                    }
                    else if (0 >= lstDeviceFault.Count)
                    {
                        // 该设备无报警
                        //不可用/不可接受指令为黄色
                        if ((int)EnmModel.Automatic != deviceStatus.devicemode)
                        {
                            dgvc.Style.BackColor = Color.LightGray;
                        }
                        else if (deviceStatus.isable == 0)
                        {
                            dgvc.Style.BackColor = Color.Brown;
                        }
                        else if (!CBaseMethods.MyBase.IsEmpty(deviceStatus.tasktype))
                        {
                            dgvc.Style.BackColor = Color.LightPink;
                        }
                        else if (deviceStatus.isavailable == 0)
                        {
                            dgvc.Style.BackColor = Color.Yellow;
                        }
                        else
                        {
                            dgvc.Style.BackColor = Color.PaleGreen;
                        }
                    }
                    else
                    {                                                                                                                                            // 该设备有报警
                        dgvc.Style.BackColor = Color.Red;
                        strResult            = CStaticClass.ConvertWareHouse(m_wareHouse) + CStaticClass.ConvertHallDescp(m_wareHouse, deviceStatus.devicecode); //  "   " + m_wareHouse + "#库车厅" + deviceStatus.devicecode;
                    }
                }
            }
            proxy.Close();
            return(strResult);
        }
예제 #3
0
        /// <summary>
        /// 更新设备故障报警情况
        /// </summary>
        public override List <CarLocationPanelLib.QueryService.CDeviceStatusDto> UpdateDeviceFault()
        {
            if (!CStaticClass.GetPushServiceConnectFlag())
            {// 服务器通道断开时
                return(new List <CarLocationPanelLib.QueryService.CDeviceStatusDto>());
            }

            QueryServiceClient proxy = new QueryServiceClient();
            List <CarLocationPanelLib.QueryService.CDeviceStatusDto> lstDeviceStatus = proxy.GetDeviceStatusList(m_wareHouse);

            foreach (CarLocationPanelLib.QueryService.CDeviceStatusDto deviceStatus in lstDeviceStatus)
            {
                if (null == deviceStatus)
                {
                    continue;
                }

                Label lblTV = m_lLblETVEquip.Find(s => s.Name == deviceStatus.devicecode.ToString());
                if (null == lblTV)
                {
                    continue;
                }

                List <CarLocationPanelLib.QueryService.CDeviceFaultDto> lstDeviceFault = proxy.GetDeviceFault(m_wareHouse, deviceStatus.devicecode, string.Empty);
                lstDeviceFault = lstDeviceFault.FindAll(s => s.color == 1);

                if ((int)EnmSMGType.ETV == deviceStatus.devicetype)
                {     // ETV设备
                    if (0 >= lstDeviceFault.Count)
                    { // 该设备无报警
                     // 正在作业ETV颜色为蓝色、不可用/不可接受指令为黄色、正常绿色
                        SetDeviceBackColor(lblTV, deviceStatus);
                    }
                    else
                    {
                        lblTV.BackColor = Color.Red;
                    }
                }
                else
                {// 车厅
                 // 根据当前库车位信息列表设置车位状态
                    DataGridView     dgvHall = null;
                    DataGridViewCell dgvc    = null;
                    GetDgvcIndexByAddr(deviceStatus.deviceaddr, ref dgvHall, ref dgvc);
                    if (null == dgvc || (int)EnmSMGType.Hall != deviceStatus.devicetype)
                    {
                    }
                    else if (0 >= lstDeviceFault.Count)
                    {
                        // 该设备无报警
                        //不可用/不可接受指令为黄色
                        if ((int)EnmModel.Automatic != deviceStatus.devicemode)
                        {
                            dgvc.Style.BackColor = Color.LightGray;
                        }
                        else if (deviceStatus.isable == 0)
                        {
                            dgvc.Style.BackColor = Color.Brown;
                        }
                        else if (!CBaseMethods.MyBase.IsEmpty(deviceStatus.tasktype))
                        {
                            dgvc.Style.BackColor = Color.LightPink;
                        }
                        else if (deviceStatus.isavailable == 0)
                        {
                            dgvc.Style.BackColor = Color.Yellow;
                        }
                        else
                        {
                            dgvc.Style.BackColor = Color.PaleGreen;
                        }
                    }
                    else
                    {// 该设备有报警
                        dgvc.Style.BackColor = Color.Red;
                    }
                }
            }
            proxy.Close();
            return(lstDeviceStatus);
        }
예제 #4
0
        /// <summary>
        /// 更新设备故障颜色
        /// </summary>
        /// <param name="tabPage"></param>
        /// <param name="nWareHouse"></param>
        /// <param name="nDeviceID"></param>
        private void UpdateFaultColor(TabPage tabPage, int nWareHouse, int nDeviceID)
        {
            if (!CStaticClass.GetPushServiceConnectFlag())
            {// 服务器通道断开时
                return;
            }

            QueryServiceClient proxy = new QueryServiceClient();
            //try
            //{
            // 根据库号和设备号获取所有故障列表(除内容为“备用”)
            List <CarLocationPanelLib.QueryService.CDeviceFaultDto> lstDeviceFault = proxy.GetDeviceFault(nWareHouse, nDeviceID, "备用");

            if (null == lstDeviceFault)
            {
                //无状态
                MessageBox.Show("无状态", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            foreach (Control label in tabPage.Controls)
            {
                int nPLCAddr;
                int.TryParse(label.Name.Substring(1), out nPLCAddr);
                CarLocationPanelLib.QueryService.CDeviceFaultDto deviceFault = lstDeviceFault.Find(a => a.faultaddress == nPLCAddr);

                if (null != deviceFault)
                {
                    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;
                    }
                }
                else
                {
                    label.BackColor = Color.LightSkyBlue;
                }
            }
            //}
            //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);
            //}
            proxy.Close();
        }
예제 #5
0
        /// <summary>
        /// 设置设备TabPage布局
        /// </summary>
        /// <param name="tabPage"></param>
        /// <param name="nWareHouse"></param>
        /// <param name="nDeviceID"></param>
        private void SetTabPageLayout(TabPage tabPage, int nWareHouse, int nDeviceID)
        {
            if (!CStaticClass.GetPushServiceConnectFlag())
            {// 服务器通道断开时
                return;
            }

            QueryServiceClient proxy = new QueryServiceClient();
            //try
            //{
            int nLabelWidth = CStaticClass.ConfigFaultLabelWidth();
            int nLabelHight = CStaticClass.ConfigFaultLabelHeight();
            int gap         = CStaticClass.ConfigMinGap();
            int nHeight     = System.Windows.Forms.Screen.PrimaryScreen.WorkingArea.Height - 6 * gap;
            int nRowCount   = (nHeight - 2 * gap) / (nLabelHight + gap) - 1;

            //
            // tabPage
            //
            tabPage.Location = new System.Drawing.Point(0, 0);
            tabPage.Padding  = new System.Windows.Forms.Padding(3);
            tabPage.UseVisualStyleBackColor = true;
            tabPage.BackColor = System.Drawing.SystemColors.Control;

            // 根据库号和设备号获取所有故障列表(除内容为“备用”)
            List <CarLocationPanelLib.QueryService.CDeviceFaultDto> lstDeviceFault = proxy.GetDeviceFault(nWareHouse, nDeviceID, "备用");

            for (int i = 0; i < lstDeviceFault.Count; i++)
            {
                CarLocationPanelLib.QueryService.CDeviceFaultDto deviceFault = lstDeviceFault[i];

                if (null == deviceFault)
                {
                    continue;
                }

                int row    = i % nRowCount;
                int column = i / nRowCount;
                //
                // label
                //
                int   nx    = column == 0 ? gap : column * nLabelWidth + (column + 1) * gap;
                int   ny    = row == 0 ? gap : row * nLabelHight + (row + 1) * gap;
                Label label = new Label();
                label.Name      = "L" + deviceFault.faultaddress;
                label.BackColor = System.Drawing.Color.LightSkyBlue;
                label.Location  = new System.Drawing.Point(nx, ny);
                label.Size      = new System.Drawing.Size(nLabelWidth, nLabelHight);
                label.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
                label.Text      = deviceFault.faultdescp;
                m_toolTip.SetToolTip(label, deviceFault.faultdescp);
                tabPage.Controls.Add(label);

                if (this.TabDeviceFault.Width < nx + nLabelWidth + gap)
                {
                    this.TabDeviceFault.Width = nx + nLabelWidth + gap;
                    //this.ClientSize = this.TabDeviceFault.Size;
                }

                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;
                }
            }
            //}
            //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);
            //}
            proxy.Close();
        }