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 }
/// <summary> /// ��ȡ��ͬ״̬����ɫ /// </summary> /// <param name="scanBordAddr"></param> /// <param name="clr"></param> public static void GetSBStatusColorAndStr(ScannerMonitorData monitorData, ref Color clr) { clr = Color.Gray; if (monitorData != null) { if (monitorData.WorkStatus == WorkStatusType.Error) { clr = Color.Red; } else if (monitorData.WorkStatus == WorkStatusType.OK) { if (monitorData.VoltageOfScanCard.IsValid) { if (monitorData.VoltageOfScanCard.Value > StatisticsMonitorInfo.MAXSUPPLYVOLTAGE || monitorData.VoltageOfScanCard.Value < StatisticsMonitorInfo.MINXSUPPLYVOLTAGE) { clr = Color.Yellow; } else { clr = Color.Green; } } else { //��ѹ��Чʱ��Ϊ���� clr = Color.Green; } } } }
public static List<string> GetMCStatusNoticeStr(ScannerMonitorData monitorData) { List<string> valueList = new List<string>(); string valueStr = CommonStaticValue.DisplayTypeStr[(int)MonitorDisplayType.MCStatus] + ":"; if (monitorData == null) { valueStr += CommonStaticValue.StatusNoticeStr[(int)CommonStaticValue.NoticeType.Unkown]; valueList.Add(valueStr); return valueList; } if (monitorData.IsConnectMC) { valueStr += CommonStaticValue.StatusNoticeStr[(int)CommonStaticValue.NoticeType.OK]; valueList.Add(valueStr); valueStr = CommonStaticValue.SupplyVoltage + ": "; if (monitorData.VoltageOfMonitorCardCollection == null || monitorData.VoltageOfMonitorCardCollection.Count < 0) { valueStr += CommonStaticValue.StatusNoticeStr[(int)CommonStaticValue.NoticeType.Unkown]; } else { if (monitorData.VoltageOfMonitorCardCollection[0].IsValid) { valueStr += monitorData.VoltageOfMonitorCardCollection[0].Value.ToString("f2"); } else { valueStr += CommonStaticValue.StatusNoticeStr[(int)CommonStaticValue.NoticeType.Unkown]; } } valueList.Add(valueStr); } else { valueStr += CommonStaticValue.NotConnectMC; valueList.Add(valueStr); } return valueList; }
/// <summary> /// ��ȡ���߹��Ϻ澯��ɫ��Ϣ /// </summary> /// <param name="scanBordAddr"></param> /// <param name="clr"></param> public static void GetRowLineCorAndStr(ScannerMonitorData monitorData, ScanBoardRowLineStatus rowLineStatus, ref Color clr) { clr = Color.Gray; if (monitorData == null || !monitorData.IsConnectMC) { return; } if (rowLineStatus != null && rowLineStatus.SoketRowLineStatusList != null && rowLineStatus.SoketRowLineStatusList.Count > 0) { clr = Color.Green; SoketRowLineInfo soketInfo = null; for (int i = 0; i < rowLineStatus.SoketRowLineStatusList.Count; i++) { soketInfo = rowLineStatus.SoketRowLineStatusList[i]; if (!soketInfo.IsABCDOk || !soketInfo.IsCtrlOk || !soketInfo.IsDCLKOk || !soketInfo.IsLatchOk || !soketInfo.IsOEOk) { clr = Color.Red; return; } if (soketInfo.RGBStatusList != null || soketInfo.RGBStatusList.Count > 0) { for (int j = 0; j < soketInfo.RGBStatusList.Count; j++) { if (!soketInfo.RGBStatusList[j].IsBlueOk || !soketInfo.RGBStatusList[j].IsGreenOk || !soketInfo.RGBStatusList[j].IsRedOk || !soketInfo.RGBStatusList[j].IsVRedOk) { clr = Color.Red; return; } } } } } }
public static void GetGeneralSwitchClr(ScannerMonitorData monitorData, List<bool> generalSwitchCloseList, ref Color clr) { clr = Color.Gray; if (monitorData == null || !monitorData.IsConnectMC) { return; } if (generalSwitchCloseList != null && generalSwitchCloseList.Count > 0) { clr = Color.Green; for (int i = 0; i < StatisticsMonitorInfo.CurCabintDoorCount; i++) { if (!generalSwitchCloseList[i]) { clr = Color.Yellow; return; } } } }
public static string GetHumidityNoticeStr(ScannerMonitorData monitorData) { string valueStr = CommonStaticValue.DisplayTypeStr[(int)MonitorDisplayType.Humidity] + ":"; if (monitorData == null) { valueStr += CommonStaticValue.StatusNoticeStr[(int)CommonStaticValue.NoticeType.Unkown]; return valueStr; } if (monitorData.IsConnectMC) { if (monitorData.HumidityOfMonitorCard.IsValid) { //��ؿ�ʪ����Ч valueStr += ((int)monitorData.HumidityOfMonitorCard.Value).ToString(); } else if (monitorData.HumidityOfScanCard.IsValid) { //��ؿ�ʪ����Ч valueStr += ((int)monitorData.HumidityOfScanCard.Value).ToString(); } else { valueStr += CommonStaticValue.StatusNoticeStr[(int)CommonStaticValue.NoticeType.Unkown]; } } else { valueStr += CommonStaticValue.StatusNoticeStr[(int)CommonStaticValue.NoticeType.Unkown] + "(" + CommonStaticValue.NotConnectMC + ")"; } return valueStr; }
/// <summary> /// /// </summary> /// <param name="monitorData"></param> /// <param name="fanCnt"></param> /// <param name="alarmCnt"></param> /// <param name="hasAlarm"></param> public static void GetFanAlarmInfo(ScannerMonitorData monitorData, uint fanCount, int threshold, out bool hasValidFan, out uint alarmCnt) { alarmCnt = 0; hasValidFan = false; if (monitorData == null || !monitorData.IsConnectMC) { return; } if (fanCount == 0) { hasValidFan = true; return; } if (monitorData.FanSpeedOfMonitorCardCollection != null && monitorData.FanSpeedOfMonitorCardCollection.Count != 0) { MonitorInfoResult oneSwitchRes; ValueInfo valueInfo; for (int n = 0; n < fanCount; n++) { if (n < monitorData.FanSpeedOfMonitorCardCollection.Count) { valueInfo = monitorData.FanSpeedOfMonitorCardCollection[n]; } else { valueInfo = new ValueInfo(); valueInfo.IsValid = false; } GetOneFanOrPowerAlarmInfo(valueInfo, threshold, out oneSwitchRes); if (oneSwitchRes != MonitorInfoResult.Unknown) { hasValidFan = true; if (oneSwitchRes == MonitorInfoResult.Alarm) { alarmCnt++; } } } } }
/// <summary> /// ��ȡ��ͬ�¶ȵ���ɫ /// </summary> /// <param name="scanBordAddr"></param> /// <param name="curScanBordIndex"></param> /// <param name="tempObject"></param> /// <param name="clr"></param> public static bool DetectTempIsValidAndGetInfo(ColorGradePartition clrGradePartition, TemperatureType tempDisplayType, ScannerMonitorData monitorData, ref int value, ref Color clr) { if (monitorData != null) { //ErrorCode -- Error //if (monitorData.TemperatureOfMonitorCard.IsValid) //{ // //��ؿ��¶���Ч // value = monitorData.TemperatureOfMonitorCard.Value; //} //else if (monitorData.TemperatureOfScanCard.IsValid) //{ // //��ؿ��¶���Ч // value = monitorData.TemperatureOfScanCard.Value; //} if (monitorData.TemperatureOfScanCard.IsValid) { //���տ��¶� value = (int)GetDisplayTempValueByCelsius(tempDisplayType, monitorData.TemperatureOfScanCard.Value); } else { clr = Color.Gray; return false; } clrGradePartition.GetGradeColor(value, ref clr); return true; } else { clr = Color.Gray; return false; } }
public static string GetTemperatureNoticeStr(ScannerMonitorData monitorData, TemperatureType tempDisplayType) { string valueStr = CommonStaticValue.DisplayTypeStr[(int)MonitorDisplayType.Temperature] + ":"; if (monitorData == null) { valueStr += CommonStaticValue.StatusNoticeStr[(int)CommonStaticValue.NoticeType.Unkown]; return valueStr; } if (monitorData.TemperatureOfScanCard.IsValid) { //��ؿ��¶� int nValue = (int)GetDisplayTempValueByCelsius(tempDisplayType, monitorData.TemperatureOfScanCard.Value); valueStr += nValue.ToString(); } else { valueStr += CommonStaticValue.StatusNoticeStr[(int)CommonStaticValue.NoticeType.Unkown]; } return valueStr; }
/// <summary> /// ��ȡ�¶ȶ�Ӧ����Ϣ /// </summary> /// <param name="monitorData"></param> /// <param name="curIndex"></param> /// <param name="backClr"></param> /// <param name="displayStr"></param> public static void CaculateTempStatisticsInfo(ScannerMonitorData monitorData, float threshold, out ValueCompareResult valueCompareRes, out MonitorInfoResult resType, ref TempAndHumiStatisticsInfo statisticsInfo) { valueCompareRes = ValueCompareResult.Unknown; resType = MonitorInfoResult.Unknown; if (monitorData != null) { if (monitorData.TemperatureOfScanCard.IsValid) { float fValue = monitorData.TemperatureOfScanCard.Value; int nValue = (int)fValue; if (nValue > threshold) { resType = MonitorInfoResult.Alarm; } else { resType = MonitorInfoResult.Ok; } if (statisticsInfo.ValidScanBoardCnt <= 0) { //��ǰɨ�迨����Ϊ0ʱ����ȡ��ǰ�¶� statisticsInfo.MinValue = nValue; statisticsInfo.MaxValue = nValue; valueCompareRes = ValueCompareResult.IsFirstValidValue; } else { //��ȡ��ǰ��С�¶Ⱥ�����¶� if (statisticsInfo.MinValue > nValue) { valueCompareRes = ValueCompareResult.BelowMinValue; statisticsInfo.MinValue = nValue; } else if (statisticsInfo.MinValue == nValue) { valueCompareRes = ValueCompareResult.EqualsMinValue; } if (statisticsInfo.MaxValue < nValue) { valueCompareRes = ValueCompareResult.AboveMaxValue; statisticsInfo.MaxValue = nValue; } else if (statisticsInfo.MaxValue == nValue) { if (valueCompareRes == ValueCompareResult.EqualsMinValue) { valueCompareRes = ValueCompareResult.EqualsBothValue; } else { valueCompareRes = ValueCompareResult.EqualsMaxValue; } } } statisticsInfo.ValidScanBoardCnt++; statisticsInfo.TotalValue += nValue; statisticsInfo.AllValueList.Add(nValue); } } }
public static string GetSmokeNoticeStr(ScannerMonitorData monitorData) { string valueStr = CommonStaticValue.DisplayTypeStr[(int)MonitorDisplayType.Smoke] + ":"; if (monitorData == null) { valueStr += CommonStaticValue.StatusNoticeStr[(int)CommonStaticValue.NoticeType.Unkown]; return valueStr; } if (monitorData.IsConnectMC) { if (monitorData.SmokeWarn.IsValid) { if (monitorData.SmokeWarn.IsSmokeAlarm) { valueStr += CommonStaticValue.StatusNoticeStr[(int)CommonStaticValue.NoticeType.Alarm]; } else { valueStr += CommonStaticValue.StatusNoticeStr[(int)CommonStaticValue.NoticeType.OK]; } } else { valueStr += CommonStaticValue.StatusNoticeStr[(int)CommonStaticValue.NoticeType.Unkown]; } } else { valueStr += CommonStaticValue.StatusNoticeStr[(int)CommonStaticValue.NoticeType.Unkown] + "(" + CommonStaticValue.NotConnectMC + ")"; } return valueStr; }
/// <summary> /// ��ȡ��ͬ�������״̬����ɫ /// </summary> /// <param name="scanBordAddr"></param> /// <param name="clr"></param> public static void GetSmokeColorAndStr(ScannerMonitorData monitorData, ref Color clr) { clr = Color.Gray; if (monitorData != null && monitorData.IsConnectMC) { if (monitorData.SmokeWarn.IsValid) { if (monitorData.SmokeWarn.IsSmokeAlarm) { clr = Color.Yellow; } else { clr = Color.Green; } } } }
public static List<string> GetSBStatusNoticeStr(ScannerMonitorData monitorData) { List<string> valueList = new List<string>(); string valueStr = CommonStaticValue.DisplayTypeStr[(int)MonitorDisplayType.SBStatus] + ":"; if (monitorData == null) { valueStr += CommonStaticValue.StatusNoticeStr[(int)CommonStaticValue.NoticeType.Unkown]; valueList.Add(valueStr); return valueList; } if (monitorData.WorkStatus == WorkStatusType.Error) { valueStr += CommonStaticValue.StatusNoticeStr[(int)CommonStaticValue.NoticeType.Error]; valueList.Add(valueStr); } else if (monitorData.WorkStatus == WorkStatusType.OK) { valueStr += CommonStaticValue.StatusNoticeStr[(int)CommonStaticValue.NoticeType.OK]; valueList.Add(valueStr); valueStr = CommonStaticValue.SupplyVoltage + ": "; if (monitorData.VoltageOfScanCard.IsValid) { valueStr += monitorData.VoltageOfScanCard.Value.ToString("f2"); } else { valueStr += CommonStaticValue.StatusNoticeStr[(int)CommonStaticValue.NoticeType.Unkown]; } valueList.Add(valueStr); } else { valueStr += CommonStaticValue.StatusNoticeStr[(int)CommonStaticValue.NoticeType.Unkown]; valueList.Add(valueStr); } return valueList; }
/// <summary> /// ��ȡ�¶ȸ澯��Ϣ /// </summary> /// <param name="scanBordAddr"></param> /// <param name="clr"></param> public static void GetTempAlarmInfo(ScannerMonitorData monitorData, float threshold, out MonitorInfoResult resType) { resType = MonitorInfoResult.Unknown; if (monitorData != null) { if (monitorData.TemperatureOfScanCard.IsValid) { int nValue = (int)monitorData.TemperatureOfScanCard.Value; if (nValue > threshold) { //�¶ȳ�����ֵʱ��ΪΪ�澯��Ϣ resType = MonitorInfoResult.Alarm; } else { resType = MonitorInfoResult.Ok; } } } }
/// <summary> /// ��ȡ����״̬�澯����Ϣ /// </summary> /// <param name="generalSwitchCloseList"></param> /// <param name="alarmCnt"></param> /// <returns></returns> public static void GetGeneralSwitcAlarmInfo(ScannerMonitorData monitorData, List<bool> generalSwitchCloseList, out MonitorInfoResult resType) { resType = MonitorInfoResult.Unknown; if (monitorData == null || !monitorData.IsConnectMC) { return; } if (generalSwitchCloseList != null && generalSwitchCloseList.Count > 0) { resType = MonitorInfoResult.Ok; for (int i = 0; i < CurCabintDoorCount; i++) { if (!generalSwitchCloseList[i]) { resType = MonitorInfoResult.Alarm; break; } } } }
/// <summary> /// ��ȡʪ���ַ�����ʪ����ɫ /// </summary> /// <param name="clrGradePartition"></param> /// <param name="monitorData"></param> /// <param name="value"></param> /// <param name="clr"></param> /// <returns></returns> public static bool DetectHumiValidAndGetInfo(ColorGradePartition clrGradePartition, ScannerMonitorData monitorData, ref int value, ref Color clr) { if (monitorData != null) { if (monitorData.IsConnectMC && monitorData.HumidityOfMonitorCard.IsValid) { //��ؿ�ʪ����Ч value = (int)monitorData.HumidityOfMonitorCard.Value; } else if (monitorData.HumidityOfScanCard.IsValid) { //��ؿ�ʪ����Ч value = (int)monitorData.HumidityOfScanCard.Value; } else { clr = Color.Gray; return false; } clrGradePartition.GetGradeColor(value, ref clr); return true; } else { clr = Color.Gray; return false; } }
/// <summary> /// ��ȡʪ�ȸ澯��Ϣ /// </summary> /// <param name="scanBordAddr"></param> /// <param name="clr"></param> public static void GetHumidityAlarmInfo(ScannerMonitorData monitorData, float threshold, out MonitorInfoResult resType) { resType = MonitorInfoResult.Unknown; if (monitorData != null) { ValueInfo valueInf; if (monitorData.IsConnectMC && monitorData.HumidityOfMonitorCard.IsValid) { valueInf = monitorData.HumidityOfMonitorCard; } else if (monitorData.HumidityOfScanCard.IsValid) { valueInf = monitorData.HumidityOfScanCard; } else { return; } if ((int)valueInf.Value > threshold) { //ʪ�ȳ�����ֵʱ��ΪΪ�澯��Ϣ resType = MonitorInfoResult.Alarm; } else { resType = MonitorInfoResult.Ok; } } }
public static List<string> GetFanNoticeStr(ScannerMonitorData monitorData, ScanBdMonitoredParamUpdateInfo mcFanInfo, int fanIndex, string sbCommAddr) { List<string> noticeStrList = new List<string>(); string valueStr = ""; if (monitorData == null) { valueStr = CommonStaticValue.DisplayTypeStr[(int)MonitorDisplayType.Fan] + ":" + CommonStaticValue.StatusNoticeStr[(int)CommonStaticValue.NoticeType.Unkown]; noticeStrList.Add(valueStr); return noticeStrList; } uint fanCnt = GetMonitorFanCnt(mcFanInfo, sbCommAddr); if (fanCnt == 0) { return noticeStrList; } if (!monitorData.IsConnectMC) { valueStr = CommonStaticValue.DisplayTypeStr[(int)MonitorDisplayType.Fan] + ":" + CommonStaticValue.StatusNoticeStr[(int)CommonStaticValue.NoticeType.Unkown] + "(" + CommonStaticValue.NotConnectMC + ")"; noticeStrList.Add(valueStr); return noticeStrList; } #region ��ȡÿ�����ȵ���Ϣ if (monitorData.FanSpeedOfMonitorCardCollection == null) { valueStr = CommonStaticValue.DisplayTypeStr[(int)MonitorDisplayType.Fan] + ":" + CommonStaticValue.StatusNoticeStr[(int)CommonStaticValue.NoticeType.Unkown]; noticeStrList.Add(valueStr); return noticeStrList; } for (int i = 0; i < fanCnt; i++) { if (i == fanIndex) { valueStr = CommonStaticValue.SwitchSignStr[(int)CommonStaticValue.SwitchSignType.Fan] + "(" + CommonStaticValue.SwitchName + " " + (i + 1).ToString() + "): "; if (i >= monitorData.FanSpeedOfMonitorCardCollection.Count) { valueStr += CommonStaticValue.StatusNoticeStr[(int)CommonStaticValue.NoticeType.Unkown]; } else { if (monitorData.FanSpeedOfMonitorCardCollection[i].IsValid) { valueStr += monitorData.FanSpeedOfMonitorCardCollection[i].Value; } else { valueStr += CommonStaticValue.StatusNoticeStr[(int)CommonStaticValue.NoticeType.Unkown]; } } noticeStrList.Add(valueStr); } } #endregion return noticeStrList; }
/// <summary> /// ��ȡ���߸澯���� /// </summary> /// <param name="scanBordAddr"></param> /// <param name="clr"></param> public static void GetMCPowerAlarmInfo(ScannerMonitorData monitorData, uint powerCount, float alarmThreshold,float faultThreshold, out bool hasValidPower, out uint alarmCnt) { alarmCnt = 0; hasValidPower = false; if (monitorData == null || !monitorData.IsConnectMC) { return; } if (powerCount == 0) { hasValidPower = true; return; } if (monitorData.VoltageOfMonitorCardCollection != null && monitorData.VoltageOfMonitorCardCollection.Count != 0) { MonitorInfoResult oneSwitchRes; ValueInfo valueInfo; int powerIndexInList = 0; for (int n = 0; n < powerCount; n++) { powerIndexInList = n + 1; if (powerIndexInList < monitorData.VoltageOfMonitorCardCollection.Count) { valueInfo = monitorData.VoltageOfMonitorCardCollection[powerIndexInList]; } else { valueInfo = new ValueInfo(); valueInfo.IsValid = false; } GetOneFanOrPowerAlarmInfo(valueInfo, alarmThreshold,faultThreshold, out oneSwitchRes); if (oneSwitchRes != MonitorInfoResult.Unknown) { hasValidPower = true; if (oneSwitchRes == MonitorInfoResult.Alarm) { alarmCnt++; } else if (oneSwitchRes == MonitorInfoResult.Fault) { alarmCnt++; } } } } }
public static string GetGeneralSwitchNoticeStr(ScannerMonitorData monitorData, List<bool> generalSwitchCloseList) { string valueStr = CommonStaticValue.DisplayTypeStr[(int)MonitorDisplayType.GeneralSwitch] + ":"; if (monitorData == null) { valueStr += CommonStaticValue.StatusNoticeStr[(int)CommonStaticValue.NoticeType.Unkown]; return valueStr; } if (!monitorData.IsConnectMC) { valueStr += CommonStaticValue.StatusNoticeStr[(int)CommonStaticValue.NoticeType.Unkown] + "(" + CommonStaticValue.NotConnectMC + ")"; } else { if (generalSwitchCloseList != null && generalSwitchCloseList.Count > 0) { bool isOpen = false; for (int i = 0; i < StatisticsMonitorInfo.CurCabintDoorCount; i++) { if (!generalSwitchCloseList[i]) { isOpen = true; break; } } if (isOpen) { valueStr += CommonStaticValue.CabinetDoorStatusStr[(int)CommonStaticValue.CabinetDoorStatusType.Open]; } else { valueStr += CommonStaticValue.CabinetDoorStatusStr[(int)CommonStaticValue.CabinetDoorStatusType.Close]; } } else { valueStr += CommonStaticValue.StatusNoticeStr[(int)CommonStaticValue.NoticeType.Unkown]; } } return valueStr; }
/// <summary> /// ��ȡ���Ϻ澯��Ϣ /// </summary> /// <param name="scanBordAddr"></param> /// <param name="clr"></param> public static void GetMCStatusFaultInfo(ScannerMonitorData monitorData, out MonitorInfoResult resType) { resType = MonitorInfoResult.Unknown; if (monitorData != null) { if (monitorData.IsConnectMC) { if (monitorData.VoltageOfMonitorCardCollection != null && monitorData.VoltageOfMonitorCardCollection.Count > 0 && monitorData.VoltageOfMonitorCardCollection[0].IsValid) { if (monitorData.VoltageOfMonitorCardCollection[0].Value > MAXSUPPLYVOLTAGE || monitorData.VoltageOfMonitorCardCollection[0].Value < MINXSUPPLYVOLTAGE) { resType = MonitorInfoResult.Alarm; } else { resType = MonitorInfoResult.Ok; } } else { //��ѹ��Чʱ��Ϊ���� resType = MonitorInfoResult.Ok; } } else { resType = MonitorInfoResult.Fault; } } }
/// <summary> /// ��ȡ��ͬ״̬����ɫ /// </summary> /// <param name="scanBordAddr"></param> /// <param name="clr"></param> public static void GetMCStatusColorAndStr(ScannerMonitorData monitorData, ref Color clr) { clr = Color.Gray; if (monitorData != null) { if (monitorData.IsConnectMC) { if (monitorData.VoltageOfMonitorCardCollection != null && monitorData.VoltageOfMonitorCardCollection.Count > 0 && monitorData.VoltageOfMonitorCardCollection[0].IsValid) { if (monitorData.VoltageOfMonitorCardCollection[0].Value > StatisticsMonitorInfo.MAXSUPPLYVOLTAGE || monitorData.VoltageOfMonitorCardCollection[0].Value < StatisticsMonitorInfo.MINXSUPPLYVOLTAGE) { clr = Color.Yellow; } else { clr = Color.Green; } } else { //��ѹ��Чʱ��Ϊ���� clr = Color.Green; } } else { clr = Color.Red; } } }
/// <summary> /// ��ȡ���߸澯���� /// </summary> /// <param name="scanBordAddr"></param> /// <param name="clr"></param> public static void GetRowLineFaultInfo(ScannerMonitorData monitorData, ScanBoardRowLineStatus rowLineStatus, out MonitorInfoResult resType) { resType = MonitorInfoResult.Unknown; if (monitorData == null || !monitorData.IsConnectMC) { return; } if (rowLineStatus != null && rowLineStatus.SoketRowLineStatusList != null) { SoketRowLineInfo soketInfo = null; resType = MonitorInfoResult.Ok; for (int i = 0; i < rowLineStatus.SoketRowLineStatusList.Count; i++) { soketInfo = rowLineStatus.SoketRowLineStatusList[i]; if (!soketInfo.IsABCDOk || !soketInfo.IsCtrlOk || !soketInfo.IsDCLKOk || !soketInfo.IsLatchOk || !soketInfo.IsOEOk) { resType = MonitorInfoResult.Fault; return; } if (soketInfo.RGBStatusList != null || soketInfo.RGBStatusList.Count > 0) { for (int j = 0; j < soketInfo.RGBStatusList.Count; j++) { if (!soketInfo.RGBStatusList[j].IsBlueOk || !soketInfo.RGBStatusList[j].IsGreenOk || !soketInfo.RGBStatusList[j].IsRedOk || !soketInfo.RGBStatusList[j].IsVRedOk) { resType = MonitorInfoResult.Fault; return; } } } } } }
public static List<string> GetPowerNoticeStr(ScannerMonitorData monitorData, ScanBdMonitoredPowerInfo mcPowerInfo, int powerIndex, string sbCommAddr) { List<string> noticeStrList = new List<string>(); string valueStr = ""; if (monitorData == null) { valueStr = CommonStaticValue.DisplayTypeStr[(int)MonitorDisplayType.Power] + ":" + CommonStaticValue.StatusNoticeStr[(int)CommonStaticValue.NoticeType.Unkown]; noticeStrList.Add(valueStr); return noticeStrList; } uint powerCnt = GetMonitorPowerCnt(mcPowerInfo, sbCommAddr); if (powerCnt == 0) { return noticeStrList; } valueStr = ""; if (!monitorData.IsConnectMC) { valueStr = CommonStaticValue.SwitchSignStr[(int)CommonStaticValue.SwitchSignType.MCOtherPower] + ":" + CommonStaticValue.StatusNoticeStr[(int)CommonStaticValue.NoticeType.Unkown] + "(" + CommonStaticValue.NotConnectMC + ")"; noticeStrList.Add(valueStr); return noticeStrList; } #region ��ȡ��ؿ�ÿ·�ĵ�ѹ if (monitorData.VoltageOfMonitorCardCollection == null) { valueStr = CommonStaticValue.SwitchSignStr[(int)CommonStaticValue.SwitchSignType.MCOtherPower] + ":" + CommonStaticValue.StatusNoticeStr[(int)CommonStaticValue.NoticeType.Unkown]; noticeStrList.Add(valueStr); return noticeStrList; } int powerIndexInList = 0; for (int i = 0; i < powerCnt; i++) { powerIndexInList = i + 1; if (i == powerIndex) { valueStr = CommonStaticValue.SwitchSignStr[(int)CommonStaticValue.SwitchSignType.MCOtherPower] + "(" + CommonStaticValue.SwitchName + " " + powerIndexInList.ToString() + "): "; if (powerIndexInList >= monitorData.VoltageOfMonitorCardCollection.Count) { valueStr += CommonStaticValue.StatusNoticeStr[(int)CommonStaticValue.NoticeType.Unkown]; } else { if (monitorData.VoltageOfMonitorCardCollection[powerIndexInList].IsValid) { valueStr += monitorData.VoltageOfMonitorCardCollection[powerIndexInList].Value.ToString("f2"); } else { valueStr += CommonStaticValue.StatusNoticeStr[(int)CommonStaticValue.NoticeType.Unkown]; } } noticeStrList.Add(valueStr); break; } } #endregion return noticeStrList; }
/// <summary> /// ��ȡ���Ϻ澯��Ϣ /// </summary> /// <param name="scanBordAddr"></param> /// <param name="clr"></param> public static void GetSBStatusFaultInfo(ScannerMonitorData monitorData, out MonitorInfoResult resType) { resType = MonitorInfoResult.Unknown; if (monitorData != null) { if (monitorData.WorkStatus == WorkStatusType.OK) { if (monitorData.VoltageOfScanCard.IsValid) { if (monitorData.VoltageOfScanCard.Value > MAXSUPPLYVOLTAGE || monitorData.VoltageOfScanCard.Value < MINXSUPPLYVOLTAGE) { resType = MonitorInfoResult.Alarm; } else { resType = MonitorInfoResult.Ok; } } else { //��ѹ��Чʱ��Ϊ���� resType = MonitorInfoResult.Ok; } } else { resType = MonitorInfoResult.Fault; } } }
public static List<string> GetRowLineNoticeStr(ScannerMonitorData monitorData, ScanBoardRowLineStatus rowLineStatus) { List<string> noticeStrList = new List<string>(); string valueStr = ""; if (monitorData == null) { valueStr = CommonStaticValue.DisplayTypeStr[(int)MonitorDisplayType.RowLine] + ":" + CommonStaticValue.StatusNoticeStr[(int)CommonStaticValue.NoticeType.Unkown]; noticeStrList.Add(valueStr); return noticeStrList; } if (!monitorData.IsConnectMC) { valueStr = CommonStaticValue.DisplayTypeStr[(int)MonitorDisplayType.RowLine] + ":" + CommonStaticValue.StatusNoticeStr[(int)CommonStaticValue.NoticeType.Unkown] + "(" + CommonStaticValue.NotConnectMC + ")"; noticeStrList.Add(valueStr); return noticeStrList; } if (rowLineStatus == null) { valueStr = CommonStaticValue.DisplayTypeStr[(int)MonitorDisplayType.RowLine] + ":" + CommonStaticValue.StatusNoticeStr[(int)CommonStaticValue.NoticeType.Unkown]; noticeStrList.Add(valueStr); return noticeStrList; } bool bRGBHasFault = false; bool bAllHasFault = false; bool bIsOneGroupHasFault = false; bool bCtrlIsHasFault = false; List<string> groupAlarmListStr = null; List<string> soketAlarmListStr = null; if (rowLineStatus != null && rowLineStatus.SoketRowLineStatusList != null) { SoketRowLineInfo soketInfo = null; soketAlarmListStr = new List<string>(); for (int i = 0; i < rowLineStatus.SoketRowLineStatusList.Count; i++) { valueStr = ""; bRGBHasFault = false; bCtrlIsHasFault = false; groupAlarmListStr = new List<string>(); soketInfo = rowLineStatus.SoketRowLineStatusList[i]; #region ��ȡ�����ź��ַ��� if (!soketInfo.IsABCDOk) { bCtrlIsHasFault = true; valueStr = CommonStaticValue.ScanSignalName; } if (!soketInfo.IsCtrlOk) { if (bCtrlIsHasFault) { valueStr += ","; } valueStr += "Ctrl"; bCtrlIsHasFault = true; } if (!soketInfo.IsDCLKOk) { if (bCtrlIsHasFault) { valueStr += ","; } valueStr += "DCLK"; bCtrlIsHasFault = true; } if (!soketInfo.IsLatchOk) { if (bCtrlIsHasFault) { valueStr += ","; } bCtrlIsHasFault = true; valueStr += "Latch"; } if (!soketInfo.IsOEOk) { if (bCtrlIsHasFault) { valueStr += ","; } valueStr += "OE"; bCtrlIsHasFault = true; } #endregion if (bCtrlIsHasFault) { bAllHasFault = true; soketAlarmListStr.Add(CommonStaticValue.SoketName + (i + 1).ToString() + ":"); soketAlarmListStr.Add(" " + valueStr + CommonStaticValue.SignalName); } #region ��ȡRGB�źŵ��ַ��� if (soketInfo.RGBStatusList != null || soketInfo.RGBStatusList.Count > 0) { groupAlarmListStr = new List<string>(); for (int j = 0; j < soketInfo.RGBStatusList.Count; j++) { valueStr = ""; bIsOneGroupHasFault = false; if (!soketInfo.RGBStatusList[j].IsRedOk) { bIsOneGroupHasFault = true; valueStr = "R"; } if (!soketInfo.RGBStatusList[j].IsGreenOk) { if (bIsOneGroupHasFault) { valueStr += ","; } valueStr += "G"; bIsOneGroupHasFault = true; } if (!soketInfo.RGBStatusList[j].IsBlueOk) { if (bIsOneGroupHasFault) { valueStr += ","; } valueStr += "B"; bIsOneGroupHasFault = true; } if (!soketInfo.RGBStatusList[j].IsVRedOk) { if (bIsOneGroupHasFault) { valueStr += ","; } valueStr += "VR"; bIsOneGroupHasFault = true; } if (bIsOneGroupHasFault) { bRGBHasFault = true; groupAlarmListStr.Add(" " + CommonStaticValue.GroupName + (j + 1).ToString() + ":" + valueStr + CommonStaticValue.SignalName); } } if (bRGBHasFault) { bAllHasFault = true; if (!bCtrlIsHasFault) { soketAlarmListStr.Add(CommonStaticValue.SoketName + (i + 1).ToString() + ":"); } soketAlarmListStr.AddRange(groupAlarmListStr); } } #endregion } } if (bAllHasFault) { noticeStrList.Add(CommonStaticValue.FaultInformation + ":"); noticeStrList.AddRange(soketAlarmListStr); } else { noticeStrList.Add(CommonStaticValue.DisplayTypeStr[(int)MonitorDisplayType.RowLine] + ":" + CommonStaticValue.StatusNoticeStr[(int)CommonStaticValue.NoticeType.OK]); } return noticeStrList; }
/// <summary> /// ��ȡ���Ϻ澯��Ϣ /// </summary> /// <param name="scanBordAddr"></param> /// <param name="clr"></param> public static void GetSmokeAlarmInfo(ScannerMonitorData monitorData, out MonitorInfoResult resType) { resType = MonitorInfoResult.Unknown; if (monitorData != null && monitorData.IsConnectMC) { if (monitorData.SmokeWarn.IsValid) { if (monitorData.SmokeWarn.IsSmokeAlarm) { resType = MonitorInfoResult.Alarm; } else { resType = MonitorInfoResult.Ok; } } } }
/// <summary> /// ��ȡ�¶ȶ�Ӧ����Ϣ /// </summary> /// <param name="monitorData"></param> /// <param name="curIndex"></param> /// <param name="backClr"></param> /// <param name="displayStr"></param> private void CaculateTempStatisticsInfo(ScannerMonitorData monitorData) { ValueCompareResult valueCompareRes = ValueCompareResult.Unknown; StatisticsMonitorInfo.CaculateTempStatisticsInfo(monitorData, _curMonitorConfigInfo.TempAlarmThreshold, out valueCompareRes, out _monitorResType, ref _tempStatisInfo); if (_monitorResType == MonitorInfoResult.Alarm) { _curAlarmInfo.TemperatureAlarmCount++; } if (valueCompareRes == ValueCompareResult.AboveMaxValue) { _curTempMaxMinIndexInfo.MaxSBIndexList.Clear(); _curTempMaxMinIndexInfo.MaxSBIndexList.Add(_curScanBoardIndex); } else if (valueCompareRes == ValueCompareResult.EqualsMaxValue) { _curTempMaxMinIndexInfo.MaxSBIndexList.Add(_curScanBoardIndex); } else if (valueCompareRes == ValueCompareResult.BelowMinValue) { _curTempMaxMinIndexInfo.MinSBIndexList.Clear(); _curTempMaxMinIndexInfo.MinSBIndexList.Add(_curScanBoardIndex); } else if (valueCompareRes == ValueCompareResult.EqualsMinValue) { _curTempMaxMinIndexInfo.MinSBIndexList.Add(_curScanBoardIndex); } else if (valueCompareRes == ValueCompareResult.IsFirstValidValue || valueCompareRes == ValueCompareResult.EqualsBothValue) { _curTempMaxMinIndexInfo.MaxSBIndexList.Add(_curScanBoardIndex); _curTempMaxMinIndexInfo.MinSBIndexList.Add(_curScanBoardIndex); } }
protected override void DrawGrid(Graphics drawZoonGraphic, RectangularGridInfo curGird) { if (curGird == null) { return; } if (_isDisplayAll) { return; } IGridBiningObject customObj = (IGridBiningObject)curGird.CustomObj; Color backColor = Color.Gray; int nValue = 0; bool bTempOrHumiInvalid = false; if (customObj.Type == GridType.ScanBoardGird) { ScanBoardGridBindObj scanBoardGridObj = (ScanBoardGridBindObj)customObj; #region 获取格子背景颜色 if (customObj != null) { switch (_curType) { case MonitorDisplayType.SBStatus: GetMonitorColorAndValue.GetSBStatusColorAndStr(scanBoardGridObj.ScanBoardAndMonitorInfo.MonitorData, ref backColor); curGird.Style.BackColor = backColor; break; case MonitorDisplayType.MCStatus: GetMonitorColorAndValue.GetMCStatusColorAndStr(scanBoardGridObj.ScanBoardAndMonitorInfo.MonitorData, ref backColor); curGird.Style.BackColor = backColor; break; case MonitorDisplayType.Smoke: GetMonitorColorAndValue.GetSmokeColorAndStr(scanBoardGridObj.ScanBoardAndMonitorInfo.MonitorData, ref backColor); curGird.Style.BackColor = backColor; break; case MonitorDisplayType.Temperature: bTempOrHumiInvalid = !GetMonitorColorAndValue.DetectTempIsValidAndGetInfo(_clrGradePartition, _curMonitorConfigInfo.TempDisplayType, scanBoardGridObj.ScanBoardAndMonitorInfo.MonitorData, ref nValue, ref backColor); curGird.Style.BackColor = backColor; break; case MonitorDisplayType.Humidity: bTempOrHumiInvalid = !GetMonitorColorAndValue.DetectHumiValidAndGetInfo(_clrGradePartition, scanBoardGridObj.ScanBoardAndMonitorInfo.MonitorData, ref nValue, ref backColor); curGird.Style.BackColor = backColor; break; case MonitorDisplayType.Fan: curGird.Style.BackColor = Color.Gray; break; case MonitorDisplayType.Power: curGird.Style.BackColor = Color.Gray; break; case MonitorDisplayType.RowLine: GetMonitorColorAndValue.GetRowLineCorAndStr(scanBoardGridObj.ScanBoardAndMonitorInfo.MonitorData, scanBoardGridObj.ScanBoardAndMonitorInfo.RowLineStatus, ref backColor); curGird.Style.BackColor = backColor; break; case MonitorDisplayType.GeneralSwitch: GetMonitorColorAndValue.GetGeneralSwitchClr(scanBoardGridObj.ScanBoardAndMonitorInfo.MonitorData, scanBoardGridObj.ScanBoardAndMonitorInfo.GeneralSwitchList, ref backColor); curGird.Style.BackColor = backColor; break; } } #endregion base.DrawGrid(drawZoonGraphic, curGird); #region 绘制格子上的字符串和图标 if (scanBoardGridObj.ScanBoardAndMonitorInfo.MonitorData == null) { return; } RectangleF drawRect = new RectangleF(curGird.DrawRegion.X + this.DefaultStyle.BoardWidth / 2, curGird.DrawRegion.Y + this.DefaultStyle.BoardWidth / 2, curGird.DrawRegion.Width - this.DefaultStyle.BoardWidth, curGird.DrawRegion.Height - this.DefaultStyle.BoardWidth); ScannerMonitorData monitorInfo = (ScannerMonitorData)scanBoardGridObj.ScanBoardAndMonitorInfo.MonitorData.Clone(); if (customObj != null && monitorInfo != null) { if (_curType == MonitorDisplayType.Temperature || _curType == MonitorDisplayType.Humidity) { #region 绘制温湿度字符串 if (bTempOrHumiInvalid) { return; } _strSize = GetStrSize(drawZoonGraphic, nValue.ToString()); if (_strSize.Width > drawRect.Width || _strSize.Height > drawRect.Height) { //不能将字符串绘制出来 return; } DrawStrForCenter(drawZoonGraphic, nValue.ToString(), drawRect); #endregion } else if (_curType == MonitorDisplayType.Fan || _curType == MonitorDisplayType.Power) { ValueInfo valueInfo = new ValueInfo(); float fSwitchHeight = 0; Image drawImage = null; bool isDrawStr = false; float drawImageHeight = 0; float imageSize = 0; if (_curType == MonitorDisplayType.Fan) { #region 绘制风扇分割线 _curMCFanCnt = GetMonitorColorAndValue.GetMonitorFanCnt(_curMonitorConfigInfo.MCFanInfo, curGird.Key); if (_curMCFanCnt <= 0) { return; } if ((curGird.DrawRegion.Height - DrawOffset * 2) < _curMCFanCnt * _switchPen.Width || _curMCFanCnt <= 0) { //获取实际绘制的风扇个数失败 return; } fSwitchHeight = (float)drawRect.Height / _curMCFanCnt; drawImageHeight = fSwitchHeight - ImageAndStrInterval * 2; for (int i = 0; i < _curMCFanCnt; i++) { isDrawStr = true; if (monitorInfo.FanSpeedOfMonitorCardCollection == null || i >= monitorInfo.FanSpeedOfMonitorCardCollection.Count) { valueInfo = new ValueInfo(); valueInfo.IsValid = false; } else { valueInfo = monitorInfo.FanSpeedOfMonitorCardCollection[i]; } //获取风扇的图片和字符串绘制大小 GetImageAndStrSize(drawZoonGraphic, drawRect, valueInfo, fSwitchHeight, drawImageHeight, out imageSize, out _strSize, out isDrawStr); //获取绘制的图片 GetDrawImage(valueInfo, PicType.Fan, _curMonitorConfigInfo.MCFanInfo.AlarmThreshold, ref drawImage); //绘制图片和字符串 DrawImageAndStr(drawZoonGraphic, drawImage, valueInfo, drawRect, fSwitchHeight, imageSize, _strSize, isDrawStr, i); #region 废弃代码 #region 获取字符串和图片绘制的大小 //if (!valueInfo.IsValid) //{ // isDrawStr = false; // _strSize.Width = 0; //} //else //{ // _strSize = GetStrSize(drawZoonGraphic, valueInfo.Value.ToString()); //} //if (_strSize.Height > fSwitchHeight // || _strSize.Width + ImageAndStrInterval * 3 > drawRect.Width) //{ // isDrawStr = false; // _strSize.Width = 0; //} //imageWidth = drawRect.Width - _strSize.Width - ImageAndStrInterval * 3; //imageSize = Math.Min(imageWidth, drawImageHeight); //if (imageSize < MinImageSize) //{ // isDrawStr = false; // _strSize.Width = 0; // imageWidth = drawRect.Width - _strSize.Width - ImageAndStrInterval * 2; // imageSize = Math.Min(imageWidth, drawImageHeight); //} //if (imageSize < 0) //{ // imageSize = 0; //} #endregion #region 绘制字符串和图片 //imageRectF = new RectangleF(fRegionStartX + ImageAndStrInterval, // fRegionStartY + fSwitchHeight * i + (fSwitchHeight - imageSize) / 2, // imageSize, imageSize); //lineStartPoint = new PointF(fRegionStartX, fRegionStartY + fSwitchHeight * i); //lineEndPoint = new PointF(fRegionEndX, fRegionStartY + fSwitchHeight * i); ////绘制背景 //drawZoonGraphic.FillRectangle(_switchBrush, fRegionStartX, fRegionStartY + fSwitchHeight * i, // drawRect.Width - DrawOffset, fSwitchHeight); //drawZoonGraphic.DrawImage(drawImage, imageRectF); //if (i > 0) //{ // drawZoonGraphic.DrawLine(_switchPen, lineStartPoint, lineEndPoint); //} //if (isDrawStr) //{ // strRectF = new RectangleF(fRegionStartX + imageSize + ImageAndStrInterval * 2, // fRegionStartY + fSwitchHeight * i, // drawRect.Width - imageSize - ImageAndStrInterval * 2, // fSwitchHeight); // DrawStrForLeft(drawZoonGraphic, valueInfo.Value.ToString(), strRectF); //} #endregion #endregion } #endregion } else if (_curType == MonitorDisplayType.Power) { #region 绘制电源分割线 _curMCPowerCnt = GetMonitorColorAndValue.GetMonitorPowerCnt(_curMonitorConfigInfo.MCPowerInfo, curGird.Key); if (_curMCPowerCnt <= 0) { return; } if ((drawRect.Height - DrawOffset * 2) < _curMCPowerCnt * _switchPen.Width) { return; } fSwitchHeight = (float)drawRect.Height / _curMCPowerCnt; drawImageHeight = fSwitchHeight - ImageAndStrInterval * 2; int powerIndexInList = 0; for (int i = 0; i < _curMCPowerCnt; i++) { powerIndexInList = i + 1; isDrawStr = true; if (monitorInfo.VoltageOfMonitorCardCollection == null || powerIndexInList >= monitorInfo.VoltageOfMonitorCardCollection.Count) { valueInfo = new ValueInfo(); valueInfo.IsValid = false; } else { valueInfo = monitorInfo.VoltageOfMonitorCardCollection[powerIndexInList]; } //获取电源的图片和字符串绘制大小 GetImageAndStrSize(drawZoonGraphic, drawRect, valueInfo, fSwitchHeight, drawImageHeight, out imageSize, out _strSize, out isDrawStr); //获取绘制的图片 GetDrawImage(valueInfo, PicType.Power, _curMonitorConfigInfo.MCPowerInfo.AlarmThreshold, ref drawImage); //绘制图片和字符串 DrawImageAndStr(drawZoonGraphic, drawImage, valueInfo, drawRect, fSwitchHeight, imageSize, _strSize, isDrawStr, i); #region 废弃代码 #region 获取字符串和图片绘制的大小 //if (!valueInfo.IsValid) //{ // isDrawStr = false; // _strSize.Width = 0; //} //else //{ // _strSize = GetStrSize(drawZoonGraphic, valueInfo.Value.ToString("#0.00")); //} //if (_strSize.Height > fSwitchHeight // || _strSize.Width + ImageAndStrInterval * 3 > drawRect.Width) //{ // isDrawStr = false; // _strSize.Width = 0; //} //imageWidth = drawRect.Width - _strSize.Width - ImageAndStrInterval * 3; //imageSize = Math.Min(imageWidth, drawImageHeight); //if (imageSize < MinImageSize) //{ // isDrawStr = false; // _strSize.Width = 0; // imageWidth = drawRect.Width - _strSize.Width - ImageAndStrInterval * 2; // imageSize = Math.Min(imageWidth, drawImageHeight); //} //if (imageSize < 0) //{ // imageSize = 0; //} #endregion #region 绘制字符串和图片 //imageRectF = new RectangleF(fRegionStartX + ImageAndStrInterval, // fRegionStartY + fSwitchHeight * i + (fSwitchHeight - imageSize) / 2, // imageSize, imageSize); //lineStartPoint = new PointF(fRegionStartX, fRegionStartY + fSwitchHeight * i); //lineEndPoint = new PointF(fRegionEndX, fRegionStartY + fSwitchHeight * i); //GetDrawImage(valueInfo, PicType.Power, // _curMonitorConfigInfo.MCPowerInfo.AlarmThreshold, // ref drawImage); ////绘制背景 //drawZoonGraphic.FillRectangle(_switchBrush, fRegionStartX, fRegionStartY + fSwitchHeight * i, // drawRect.Width - DrawOffset, fSwitchHeight); //drawZoonGraphic.DrawImage(drawImage, imageRectF); //if (i > 0 && i < _curMCPowerCnt) //{ // drawZoonGraphic.DrawLine(_switchPen, lineStartPoint, lineEndPoint); //} //if (isDrawStr) //{ // strRectF = new RectangleF(fRegionStartX + imageSize + ImageAndStrInterval * 2, // fRegionStartY + fSwitchHeight * i, // drawRect.Width - imageSize - ImageAndStrInterval * 2, // fSwitchHeight); // DrawStrForLeft(drawZoonGraphic, valueInfo.Value.ToString("#0.00"), strRectF); //} #endregion #endregion } #endregion } } } #endregion } else if (customObj.Type == GridType.ComplexScreenGrid) { ComplexScreenGridBindObj complexScreenGridObj = (ComplexScreenGridBindObj)customObj; #region 获取格子背景颜色 backColor = Color.Gray; if (complexScreenGridObj.ComplexScreenLayout.IsAllMonitorDataIsValid) { switch (_curType) { case MonitorDisplayType.SBStatus: if (complexScreenGridObj.ComplexScreenLayout.FaultInfo.SBStatusErrCount > 0 || complexScreenGridObj.ComplexScreenLayout.AlarmInfo.SBStatusErrCount > 0) { backColor = Color.Red; } else { backColor = Color.Green; } break; case MonitorDisplayType.MCStatus: if (complexScreenGridObj.ComplexScreenLayout.FaultInfo.MCStatusErrCount > 0 || complexScreenGridObj.ComplexScreenLayout.AlarmInfo.MCStatusErrCount > 0) { backColor = Color.Red; } else { backColor = Color.Green; } break; case MonitorDisplayType.Smoke: if (complexScreenGridObj.ComplexScreenLayout.FaultInfo.SmokeAlarmCount > 0) { backColor = Color.Red; } else if (complexScreenGridObj.ComplexScreenLayout.AlarmInfo.SmokeAlarmCount > 0) { backColor = Color.Yellow; } else { backColor = Color.Green; } break; case MonitorDisplayType.Temperature: if (complexScreenGridObj.ComplexScreenLayout.FaultInfo.TemperatureAlarmCount > 0) { backColor = Color.Red; } else if (complexScreenGridObj.ComplexScreenLayout.AlarmInfo.TemperatureAlarmCount > 0) { backColor = Color.Yellow; } else { backColor = Color.Green; } break; case MonitorDisplayType.Humidity: if (complexScreenGridObj.ComplexScreenLayout.FaultInfo.HumidityAlarmCount > 0) { backColor = Color.Red; } else if (complexScreenGridObj.ComplexScreenLayout.AlarmInfo.HumidityAlarmCount > 0) { backColor = Color.Yellow; } else { backColor = Color.Green; } break; case MonitorDisplayType.Fan: if (complexScreenGridObj.ComplexScreenLayout.FaultInfo.FanAlarmSwitchCount > 0) { backColor = Color.Red; } else if (complexScreenGridObj.ComplexScreenLayout.AlarmInfo.FanAlarmSwitchCount > 0) { backColor = Color.Yellow; } else { backColor = Color.Green; } break; case MonitorDisplayType.Power: if (complexScreenGridObj.ComplexScreenLayout.FaultInfo.PowerAlarmSwitchCount > 0) { backColor = Color.Red; } else if (complexScreenGridObj.ComplexScreenLayout.AlarmInfo.PowerAlarmSwitchCount > 0) { backColor = Color.Yellow; } else { backColor = Color.Green; } break; case MonitorDisplayType.RowLine: if (complexScreenGridObj.ComplexScreenLayout.FaultInfo.SoketAlarmCount > 0) { backColor = Color.Red; } else if (complexScreenGridObj.ComplexScreenLayout.AlarmInfo.SoketAlarmCount > 0) { backColor = Color.Yellow; } else { backColor = Color.Green; } break; case MonitorDisplayType.GeneralSwitch: if (complexScreenGridObj.ComplexScreenLayout.FaultInfo.GeneralSwitchErrCount > 0) { backColor = Color.Red; } else if (complexScreenGridObj.ComplexScreenLayout.AlarmInfo.GeneralSwitchErrCount > 0) { backColor = Color.Yellow; } else { backColor = Color.Green; } break; } } curGird.Style.BackColor = backColor; #endregion base.DrawGrid(drawZoonGraphic, curGird); #region 绘制复杂屏的边界 //drawZoonGraphic.DrawRectangle(_screenBoarderPen, // curGird.DrawRegion.X + _screenBoarderPen.Width / 2, // curGird.DrawRegion.Y + _screenBoarderPen.Width / 2, // curGird.DrawRegion.Width - _screenBoarderPen.Width, // curGird.DrawRegion.Height - _screenBoarderPen.Width); #endregion } else if (customObj.Type == GridType.ScreenGrid) { ScreenGridBindObj screenGridObj = (ScreenGridBindObj)customObj; if (!screenGridObj.ScreenIsValid) { curGird.Style.BackColor = Color.Gray; base.DrawGrid(drawZoonGraphic, curGird); } #region 绘制格子边界 --- 显示屏边界 drawZoonGraphic.DrawRectangle(_screenBoarderPen, curGird.DrawRegion.X + _screenBoarderPen.Width / 2, curGird.DrawRegion.Y + _screenBoarderPen.Width / 2, curGird.DrawRegion.Width - _screenBoarderPen.Width, curGird.DrawRegion.Height - _screenBoarderPen.Width); #endregion } }