private void HWStatusMonitor_Exec_CompleteRefreshCommPortEvent(object sender, CompleteRefreshAllCommPortEventArgs e, bool isRetry)
        {
            _stopwatch.Stop();
            _fLogService.Info("读取监控常规数据完成,开始解析..." + _stopwatch.ElapsedMilliseconds);
            _stopwatch.Start();
            SendStatusMsg("GetScannerDataFinish");
            #region 监控数据处理
            if (_allComBaseInfo == null || _allComBaseInfo.AllInfoDict == null)
            {
                SendStatusMsg("ParsingScannerDataFinish");
                if (isRetry)
                {
                    _fLogService.Info("读取监控常规数据完成,重读通知...");
                    NotifyCompleteAllMonitor();
                }
                else
                {
                    _fLogService.Info("读取监控常规数据完成,开始读取多功能卡外设数据...");
                    _funcMonitor.ReadAllOutDevice(ReadAllOutDeviceCallback);
                }
                return;
            }
            foreach (string comName in _allComBaseInfo.AllInfoDict.Keys)
            {
                OneCOMHWBaseInfo baseInfo = _allComBaseInfo.AllInfoDict[comName];
                if (baseInfo == null || baseInfo.LEDDisplayInfoList == null)
                {
                    _fLogService.Debug("回调接收卡:得到串口的数据为什么会没有屏:" + comName);
                    continue;
                }
                //枚举每个显示屏
                for (int i = 0; i < baseInfo.LEDDisplayInfoList.Count; i++)
                {
                    string sn = GetScreenUdid(baseInfo.FirstSenderSN, i);
                    if (!_hwConfigs.ContainsKey(sn))
                    {
                        _hwConfigs.Add(sn, new MarsHWConfig());
                    }
                    //从所有硬件数据中找出当前显示屏的数据
                    ScreenModnitorData monitorData = FindScreenMonitorDataFromList(_allMonitorData.AllScreenMonitorCollection, sn);

                    ILEDDisplayInfo displayInfo = baseInfo.LEDDisplayInfoList[i];
                    int scnanerCount = displayInfo.ScannerCount;
                    for (int scannerOffset = 0; scannerOffset < scnanerCount; scannerOffset++)
                    {
                        ScanBoardRegionInfo regionInfo = displayInfo[scannerOffset];
                        if (regionInfo.SenderIndex == ConstValue.BLANK_SCANNER)
                        {
                            if (isRetry)
                            {
                                _allMonitorData.AllScreenMonitorCollection.Remove(monitorData);
                            }
                            continue;
                        }
                        int scanBoardCols = 0;
                        int scanBoardRows = 0;
                        bool isisComplex = false;
                        GetScanBoardInPosition(displayInfo, regionInfo, ref scanBoardCols, ref scanBoardRows, ref isisComplex);
                        SendStatusMsg("ParsingScannerData");
                        #region 接收卡监控数据
                        ScannerMonitorInfo scannerMInfo = new ScannerMonitorInfo();
                        scannerMInfo.DeviceRegInfo = new DeviceRegionInfo();
                        scannerMInfo.DeviceRegInfo.CommPort = comName;
                        scannerMInfo.DeviceRegInfo.SenderIndex = regionInfo.SenderIndex;
                        scannerMInfo.DeviceRegInfo.PortIndex = regionInfo.PortIndex;
                        scannerMInfo.DeviceRegInfo.ConnectIndex = regionInfo.ConnectIndex;

                        scannerMInfo.DeviceRegInfo.IsComplex = isisComplex;
                        scannerMInfo.DeviceRegInfo.ScanBoardCols = scanBoardCols;
                        scannerMInfo.DeviceRegInfo.ScanBoardRows = scanBoardRows;

                        scannerMInfo.DeviceStatus = DeviceWorkStatus.OK;
                        scannerMInfo.MappingList = GetScannerSearchMapping(i, regionInfo.SenderIndex, regionInfo.PortIndex, regionInfo.ConnectIndex);
                        ScannerMonitorData scannerMData = new ScannerMonitorData();
                        if (!e.ScannerMonitorDataDicDic.ContainsKey(comName))
                        {
                            scannerMInfo.DeviceStatus = DeviceWorkStatus.Unknown;
                        }
                        else
                        {
                            scannerMData = GetScannerMonitorDataFromScannerMDict(e.ScannerMonitorDataDicDic[comName], regionInfo);
                            if (scannerMData != null)
                            {
                                if (!_allMonitorData.MonitorDataDic.ContainsKey(sn))
                                {
                                    _allMonitorData.MonitorDataDic.Add(sn, new SerializableDictionary<string, ScannerMonitorData>());
                                }
                                if (!_allMonitorData.MonitorDataDic[sn].ContainsKey(GetScannerNameFlag(regionInfo)))
                                {
                                    _allMonitorData.MonitorDataDic[sn].Add(GetScannerNameFlag(regionInfo), scannerMData);
                                }
                                if (e.ReadStatusResultDic.ContainsKey(comName))
                                {
                                    if (!_allMonitorData.MonitorResInfDic.ContainsKey(sn))
                                    {
                                        _allMonitorData.MonitorResInfDic.Add(sn, e.ReadStatusResultDic[comName].CompleteTime);
                                    }
                                    else
                                    {
                                        _allMonitorData.MonitorResInfDic[sn] = e.ReadStatusResultDic[comName].CompleteTime;
                                    }
                                }

                                if (scannerMData.WorkStatus == WorkStatusType.OK)
                                {
                                    scannerMInfo.TemperatureIsVaild = scannerMData.TemperatureOfScanCard.IsValid;
                                    scannerMInfo.Temperature = scannerMData.TemperatureOfScanCard.Value;
                                    scannerMInfo.Voltage = scannerMData.VoltageOfScanCard.Value;
                                }
                                else
                                {
                                    scannerMInfo.TemperatureIsVaild = false;
                                    scannerMInfo.DeviceStatus = DeviceWorkStatus.Error;
                                }
                            }
                            else
                            {
                                scannerMInfo.TemperatureIsVaild = false;
                                scannerMInfo.DeviceStatus = DeviceWorkStatus.Error;
                            }
                        }
                        monitorData.ScannerMonitorCollection.Add(scannerMInfo);
                        #endregion

                        SendStatusMsg("ParsingMonitorData");
                        #region 监控卡监控数据
                        MonitorCardMonitorInfo monitorCardMInfo = new MonitorCardMonitorInfo();
                        monitorCardMInfo.DeviceStatus = DeviceWorkStatus.OK;
                        monitorCardMInfo.MappingList = GetMonitorCardSearchMapping(i, regionInfo.SenderIndex, regionInfo.PortIndex, regionInfo.ConnectIndex, 0);
                        monitorCardMInfo.DeviceRegInfo = (DeviceRegionInfo)scannerMInfo.DeviceRegInfo.Clone();
                        if (!IsHWScreenConfigExist(sn) || _hwConfigs[sn].IsUpdateMCStatus == false)
                        {
                            continue;
                        }
                        else if (scannerMInfo.DeviceStatus != DeviceWorkStatus.OK ||
                            !IsHWScreenConfigExist(sn))
                        {
                            if (scannerMInfo.DeviceStatus == DeviceWorkStatus.Error)
                            {
                                monitorCardMInfo.DeviceStatus = DeviceWorkStatus.Error;
                            }
                            else
                            {
                                monitorCardMInfo.DeviceStatus = DeviceWorkStatus.Unknown;
                            }
                        }
                        else if (scannerMData.IsConnectMC)
                        {
                            #region 湿度状态
                            if (IsHWScreenConfigExist(sn) && _hwConfigs[sn].IsUpdateHumidity)
                            {
                                MCHumidityUpdateInfo humidityUInfo = new MCHumidityUpdateInfo()
                                {
                                    IsUpdate = true,
                                    Humidity = scannerMData.HumidityOfMonitorCard.Value
                                };
                                monitorCardMInfo.HumidityUInfo = humidityUInfo;
                            }
                            #endregion

                            #region 烟雾状态
                            if (IsHWScreenConfigExist(sn) && _hwConfigs[sn].IsUpdateSmoke)
                            {
                                MCSmokeUpdateInfo smokeUInfo = new MCSmokeUpdateInfo()
                                {
                                    IsUpdate = true,
                                    IsSmokeAlarm = scannerMData.SmokeWarn.IsSmokeAlarm
                                };
                                monitorCardMInfo.SmokeUInfo = smokeUInfo;
                            }
                            #endregion

                            #region 监控卡本板温度状态
                            MCTemperatureUpdateInfo tempUInfo = new MCTemperatureUpdateInfo()
                            {
                                IsUpdate = true, //_monitorSysData.SameMonitorSysData.IsUpdateTemperature,
                                Temperature = scannerMData.TemperatureOfMonitorCard.Value
                            };
                            monitorCardMInfo.TemperatureUInfo = tempUInfo;
                            #endregion

                            #region 风扇状态
                            if (IsHWScreenConfigExist(sn) && _hwConfigs[sn].IsUpdateFan && _hwConfigs[sn].FanInfoObj != null)
                            {
                                SerializableDictionary<int, int> fansMonitorInfoCollection = new SerializableDictionary<int, int>();
                                for (int fansIndex = 0; fansIndex < scannerMData.FanSpeedOfMonitorCardCollection.Count; fansIndex++)
                                {
                                    ValueInfo valInfo = scannerMData.FanSpeedOfMonitorCardCollection[fansIndex];
                                    if (scannerMData != null)
                                    {
                                        scannerMData.FanSpeedOfMonitorCardCollection[fansIndex] = new ValueInfo()
                                        {
                                            IsValid = valInfo.IsValid,
                                            Value = valInfo.Value / _hwConfigs[sn].FanInfoObj.FanPulseCount
                                        };
                                    }
                                    if (_hwConfigs[sn].FanInfoObj.isSame)
                                    {
                                        if (fansIndex < _hwConfigs[sn].FanInfoObj.FanCount && valInfo.IsValid)
                                        {
                                            fansMonitorInfoCollection.Add(fansIndex, (int)valInfo.Value / _hwConfigs[sn].FanInfoObj.FanPulseCount);
                                        }
                                    }
                                    else
                                    {
                                        OneFanInfo oneInfo = _hwConfigs[sn].FanInfoObj.FanList.Find(a =>
                                            a.ScanIndex == regionInfo.ConnectIndex && a.SenderIndex == regionInfo.SenderIndex
                                            && a.PortIndex == regionInfo.PortIndex);
                                        if (oneInfo != null && fansIndex < oneInfo.FanCount && valInfo.IsValid)
                                        {
                                            fansMonitorInfoCollection.Add(fansIndex, (int)valInfo.Value / _hwConfigs[sn].FanInfoObj.FanPulseCount);
                                        }
                                    }
                                }
                                monitorCardMInfo.FansUInfo = new MCFansUpdateInfo()
                                {
                                    IsUpdate = true,
                                    FansMonitorInfoCollection = fansMonitorInfoCollection
                                };
                            }
                            #endregion

                            #region 电源状态
                            if (IsHWScreenConfigExist(sn) && _hwConfigs[sn].IsUpdateMCVoltage && _hwConfigs[sn].PowerInfoObj != null)
                            {
                                SerializableDictionary<int, float> powerMonitorInfoCollection = new SerializableDictionary<int, float>();
                                for (int powerIndex = 0; powerIndex < scannerMData.VoltageOfMonitorCardCollection.Count; powerIndex++)
                                {
                                    ValueInfo valInfo = scannerMData.VoltageOfMonitorCardCollection[powerIndex];

                                    if (_hwConfigs[sn].PowerInfoObj.isSame)
                                    {
                                        if (powerIndex <= _hwConfigs[sn].PowerInfoObj.PowerCount)
                                        {
                                            powerMonitorInfoCollection.Add(powerIndex, valInfo.Value);
                                        }
                                    }
                                    else
                                    {
                                        OnePowerInfo oneInfo = _hwConfigs[sn].PowerInfoObj.PowerList.Find(a =>
                                            a.ScanIndex == regionInfo.ConnectIndex && a.SenderIndex == regionInfo.SenderIndex
                                            && a.PortIndex == regionInfo.PortIndex);
                                        if (oneInfo != null && powerIndex <= oneInfo.PowerCount)
                                        {
                                            powerMonitorInfoCollection.Add(powerIndex, valInfo.Value);
                                        }
                                    }
                                }
                                monitorCardMInfo.PowerUInfo = new MCPowerUpdateInfo()
                                {
                                    IsUpdate = true,
                                    PowerMonitorInfoCollection = powerMonitorInfoCollection
                                };
                            }
                            #endregion

                            #region 箱门状态
                            if (IsHWScreenConfigExist(sn) && _hwConfigs[sn].IsUpdateGeneralStatus)
                            {
                                byte generalStatus = scannerMData.GeneralStatusData;
                                List<bool> swithStatus = null;
                                ParseGeneralSwitch.ParseMCGeneralSwitchStatus(generalStatus, scannerMData.IsConnectMC, out swithStatus);

                                monitorCardMInfo.CabinetDoorUInfo = new MCDoorUpdateInfo()
                                {
                                    IsUpdate = true,
                                    IsDoorOpen = (!swithStatus[0])
                                };
                            }
                            #endregion

                            #region 排线状态
                            if (IsHWScreenConfigExist(sn) && _hwConfigs[sn].IsUpdateRowLine)
                            {
                                byte[] moduleBytes = scannerMData.ModuleStatusBytes;
                                ScanBoardRowLineStatus rowLineStatus = null;
                                List<SocketCableMonitorInfo> socketCableInfoCollection = new List<SocketCableMonitorInfo>();
                                if (ParseRowLineData.ParseScanBoardRowLineData(moduleBytes, scannerMData.IsConnectMC, displayInfo.VirtualMode, out rowLineStatus))
                                {
                                    //插座的列表
                                    for (int socketIndex = 0; socketIndex < rowLineStatus.SoketRowLineStatusList.Count; socketIndex++)
                                    {
                                        SocketCableMonitorInfo socketCableInfo = new SocketCableMonitorInfo();
                                        socketCableInfo.DeviceStatus = DeviceWorkStatus.OK;
                                        socketCableInfo.MappingList = GetSocketCableStatus(i, regionInfo.SenderIndex, regionInfo.PortIndex, regionInfo.ConnectIndex, 0, socketIndex);

                                        SoketRowLineInfo socketOriginalInfo = rowLineStatus.SoketRowLineStatusList[socketIndex];
                                        for (int rgbGroupIndex = 0; rgbGroupIndex < socketOriginalInfo.RGBStatusList.Count; rgbGroupIndex++)
                                        {
                                            OneGroupRGBStatus orStatus = socketOriginalInfo.RGBStatusList[rgbGroupIndex];
                                            List<SocketCableStatus> allGroupStatusList = new List<SocketCableStatus>();

                                            SocketCableStatus cableStatus = new SocketCableStatus();
                                            cableStatus.CableType = SocketCableType.ABCD_Signal;
                                            cableStatus.IsCableOK = socketOriginalInfo.IsABCDOk;
                                            allGroupStatusList.Add(cableStatus);

                                            cableStatus = new SocketCableStatus();
                                            cableStatus.CableType = SocketCableType.CTRL_Signal;
                                            cableStatus.IsCableOK = socketOriginalInfo.IsCtrlOk;
                                            allGroupStatusList.Add(cableStatus);

                                            cableStatus = new SocketCableStatus();
                                            cableStatus.CableType = SocketCableType.DCLK_Signal;
                                            cableStatus.IsCableOK = socketOriginalInfo.IsDCLKOk;
                                            allGroupStatusList.Add(cableStatus);

                                            cableStatus = new SocketCableStatus();
                                            cableStatus.CableType = SocketCableType.LAT_Signal;
                                            cableStatus.IsCableOK = socketOriginalInfo.IsLatchOk;
                                            allGroupStatusList.Add(cableStatus);

                                            cableStatus = new SocketCableStatus();
                                            cableStatus.CableType = SocketCableType.OE_Signal;
                                            cableStatus.IsCableOK = socketOriginalInfo.IsOEOk;
                                            allGroupStatusList.Add(cableStatus);

                                            cableStatus = new SocketCableStatus();
                                            cableStatus.CableType = SocketCableType.Red_Signal;
                                            cableStatus.IsCableOK = orStatus.IsRedOk;
                                            allGroupStatusList.Add(cableStatus);

                                            cableStatus = new SocketCableStatus();
                                            cableStatus.CableType = SocketCableType.Green_Signal;
                                            cableStatus.IsCableOK = orStatus.IsGreenOk;
                                            allGroupStatusList.Add(cableStatus);

                                            cableStatus = new SocketCableStatus();
                                            cableStatus.CableType = SocketCableType.Blue_Signal;
                                            cableStatus.IsCableOK = orStatus.IsBlueOk;
                                            allGroupStatusList.Add(cableStatus);

                                            if (displayInfo.VirtualMode == VirtualModeType.Led4Mode1 ||
                                                displayInfo.VirtualMode == VirtualModeType.Led4Mode2)
                                            {
                                                cableStatus = new SocketCableStatus();
                                                cableStatus.CableType = SocketCableType.VRed_Signal;
                                                cableStatus.IsCableOK = orStatus.IsVRedOk;
                                                allGroupStatusList.Add(cableStatus);
                                            }
                                            socketCableInfo.SocketCableInfoDict.Add(rgbGroupIndex, allGroupStatusList);
                                        }
                                        socketCableInfoCollection.Add(socketCableInfo);
                                    }
                                }

                                monitorCardMInfo.SocketCableUInfo = new MCSocketCableUpdateInfo()
                                {
                                    IsUpdate = true,
                                    SocketCableInfoCollection = socketCableInfoCollection
                                };
                            }
                            #endregion
                        }
                        else
                        {
                            monitorCardMInfo.DeviceStatus = DeviceWorkStatus.Error;
                        }
                        monitorData.MonitorCardInfoCollection.Add(monitorCardMInfo);
                        #endregion
                    }
                }
            }
            _stopwatch.Stop();
            _fLogService.Info("读取监控常规数据完成,开始读取多功能卡外设数据..." + _stopwatch.ElapsedMilliseconds);
            _stopwatch.Restart();
            SendStatusMsg("ParsingScannerDataFinish");
            if (_funcMonitor == null || isRetry)
            {
                NotifyCompleteAllMonitor();
            }
            else
            {
                _funcMonitor.ReadAllOutDevice(ReadAllOutDeviceCallback);
            }
            #endregion
        }
 public object Clone()
 {
     MCTemperatureUpdateInfo data = new MCTemperatureUpdateInfo();
     if (!this.CopyTo(data))
     {
         return null;
     }
     return data;
 }