/// <summary> /// 更新ETV当前位置 /// </summary> public override void UpdateDeviceStatus() { if (!CStaticClass.GetPushServiceConnectFlag()) {// 服务器通道断开时 return; } QueryServiceClient proxy = new QueryServiceClient(); List <QueryService.CDeviceStatusDto> lstDeviceStatus = proxy.GetDeviceStatusList(m_wareHouse); foreach (QueryService.CDeviceStatusDto deviceStatus in lstDeviceStatus) { Label lblTV = m_lLblETVEquip.Find(s => s.Name == deviceStatus.devicecode.ToString()); if (null == lblTV) { return; } // 正在作业ETV颜色为蓝色、不可用/不可接受指令为黄色、正常绿色 SetDeviceBackColor(lblTV, deviceStatus); #region 根据当前库车位信息设置ETV设备位置 // 根据当前库车位信息列表设置车位状态 string strAddr = deviceStatus.deviceaddr; DataGridView dgv = null; DataGridViewCell cell = null; GetDgvcIndexByAddr(strAddr, ref dgv, ref cell); if (null == cell || null == dgv) { 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.Location = new System.Drawing.Point(nX, lblTV.Location.Y); #endregion } proxy.Close(); }
/// <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); }