diff --git a/src/YunDa.Application/YunDa.ISAS.Application/GeneralInformation/ProtectionDevice/BoardCardDevice/BoardCardInfoAppService.cs b/src/YunDa.Application/YunDa.ISAS.Application/GeneralInformation/ProtectionDevice/BoardCardDevice/BoardCardInfoAppService.cs
index ea7280a..c666256 100644
--- a/src/YunDa.Application/YunDa.ISAS.Application/GeneralInformation/ProtectionDevice/BoardCardDevice/BoardCardInfoAppService.cs
+++ b/src/YunDa.Application/YunDa.ISAS.Application/GeneralInformation/ProtectionDevice/BoardCardDevice/BoardCardInfoAppService.cs
@@ -528,7 +528,64 @@ namespace YunDa.ISAS.Application.GeneralInformation
return rst;
}
+ ///
+ /// 查询板卡历史版本数据
+ ///
+ ///
+ ///
+ [ShowApi]
+ [AbpAllowAnonymous]
+ [DisableAuditing]
+ [HttpGet]
+ public RequestResult> FindHistorySoftVersionByEquipmentInfoId(Guid? equipmentInfoId)
+ {
+ RequestResult> rst = ();
+ try
+ {
+ List historys = new List();
+ var protectionDevice = _protectionDeviceInfoRepository.GetAllIncluding(t => t.EquipmentInfo)
+ .FirstOrDefault(t => t.EquipmentInfoId == equipmentInfoId);
+ if (protectionDevice != null)
+ {
+ var boards = _boardCardHistoryRepository.GetAll()
+ .Where(t => t.ProtectionDeviceInfoId == protectionDevice.Id)
+ .OrderByDescending(t => t.RecodeDate);
+ foreach ( var board in boards)
+ {
+ BoardCardSolftVersionOutput boardCardSolftVersionOutput = new BoardCardSolftVersionOutput();
+ if (string.IsNullOrEmpty( board.ContentNewJson))
+ {
+ if (!string.IsNullOrEmpty(board.ContentJson))
+ {
+ boardCardSolftVersionOutput = JsonConvert.DeserializeObject(board.ContentJson);
+ boardCardSolftVersionOutput.RecodeDate = board.RecodeDate;
+ }
+ }
+ else
+ {
+ boardCardSolftVersionOutput = JsonConvert.DeserializeObject(board.ContentNewJson);
+ boardCardSolftVersionOutput.RecodeDate = board.RecodeDate;
+ }
+ if (boardCardSolftVersionOutput.RecodeDate.HasValue)
+ {
+ historys.Add(boardCardSolftVersionOutput);
+ }
+ }
+ rst.Flag = true;
+ rst.ResultData = historys;
+ rst.TotalCount = historys.Count;
+ }
+ }
+ catch (Exception ex)
+ {
+ rst.Message = ex.Message;
+ rst.Flag = false;
+ Log4Helper.Error(this.GetType(), "保护装置信息管理服务", ex);
+ }
+
+ return rst;
+ }
public RequestResult GetProtectionDeviceQRcode(Guid id)
{
RequestResult rst = new RequestResult();
diff --git a/src/YunDa.Application/YunDa.ISAS.Application/GeneralInformation/ProtectionDevice/IProtectionDeviceAppService.cs b/src/YunDa.Application/YunDa.ISAS.Application/GeneralInformation/ProtectionDevice/IProtectionDeviceAppService.cs
index a482b08..5ae3aca 100644
--- a/src/YunDa.Application/YunDa.ISAS.Application/GeneralInformation/ProtectionDevice/IProtectionDeviceAppService.cs
+++ b/src/YunDa.Application/YunDa.ISAS.Application/GeneralInformation/ProtectionDevice/IProtectionDeviceAppService.cs
@@ -24,7 +24,12 @@ namespace YunDa.ISAS.Application.GeneralInformation
///
///
RequestResult> FindHistoryDataByEquipmentInfoId(Guid? equipmentInfoId);
-
+ ///
+ /// 查询历史保护装置版本信息
+ ///
+ ///
+ ///
+ RequestResult> FindHistorySoftVersionDataByEquipmentInfoId(Guid? equipmentInfoId);
///
/// 获取所有保护装置
///
diff --git a/src/YunDa.Application/YunDa.ISAS.Application/GeneralInformation/ProtectionDevice/ProtectionDeviceAppService.cs b/src/YunDa.Application/YunDa.ISAS.Application/GeneralInformation/ProtectionDevice/ProtectionDeviceAppService.cs
index 692405b..2083683 100644
--- a/src/YunDa.Application/YunDa.ISAS.Application/GeneralInformation/ProtectionDevice/ProtectionDeviceAppService.cs
+++ b/src/YunDa.Application/YunDa.ISAS.Application/GeneralInformation/ProtectionDevice/ProtectionDeviceAppService.cs
@@ -597,6 +597,69 @@ namespace YunDa.ISAS.Application.GeneralInformation
return rst;
}
+ ///
+ /// 查询保护装置历史版本信息
+ ///
+ ///
+ ///
+ [ShowApi]
+ [AbpAllowAnonymous]
+ [DisableAuditing]
+ [HttpGet]
+ public RequestResult> FindHistorySoftVersionDataByEquipmentInfoId(Guid? equipmentInfoId)
+ {
+ RequestResult> rst = new();
+ try
+ {
+ List historys = new List();
+ var protectionDevice = _protectionDeviceInfoRepository.GetAllIncluding(t => t.EquipmentInfo)
+ .FirstOrDefault(t => t.EquipmentInfoId == equipmentInfoId);
+ if (protectionDevice != null)
+ {
+ var entitys = _protectionDeviceHistoryRepository.GetAll()
+ .Where(t => t.ProtectionDeviceInfoId == protectionDevice.Id)
+ .OrderBy(t => t.RecodeDate)
+ ;
+ foreach ( var entity in entitys )
+ {
+ ProtectionDeviceSolfVersionOutput protectionDeviceSolfVersionOutput = new();
+ if (string.IsNullOrWhiteSpace(entity.ContentNewJson))
+ {
+ if (!string.IsNullOrWhiteSpace(entity.ContentJson))
+ {
+ ProtectionDeviceInfo history = JsonConvert.DeserializeObject(entity.ContentJson);
+ protectionDeviceSolfVersionOutput.BaselineBoardVersion = history.BaselineBoardVersion;
+ protectionDeviceSolfVersionOutput.HardwareVersion = history.HardwareVersion;
+ protectionDeviceSolfVersionOutput.RecodeDate = entity.RecodeDate;
+ }
+ }
+ else
+ {
+ ProtectionDeviceInfo history = JsonConvert.DeserializeObject(entity.ContentNewJson);
+ protectionDeviceSolfVersionOutput.BaselineBoardVersion = history.BaselineBoardVersion;
+ protectionDeviceSolfVersionOutput.HardwareVersion = history.HardwareVersion;
+ protectionDeviceSolfVersionOutput.RecodeDate = entity.RecodeDate;
+ }
+ if (!string.IsNullOrWhiteSpace( protectionDeviceSolfVersionOutput.BaselineBoardVersion))
+ {
+ historys.Add(protectionDeviceSolfVersionOutput);
+ }
+ }
+ rst.Flag = true;
+ rst.ResultData = historys;
+ }
+ }
+ catch (Exception ex)
+ {
+ rst.Message = ex.Message;
+ rst.Flag = false;
+ Log4Helper.Error(this.GetType(), "保护装置信息管理服务", ex);
+ }
+
+ return rst;
+ }
+
+
public RequestResult GetProtectionDeviceQRcode(Guid id)
{
RequestResult rst = new RequestResult();
diff --git a/src/YunDa.Application/YunDa.ISAS.DataTransferObject/GeneralInformation/ProtectionDeviceInfoDto/HistoryData/BoardCardSolftVersionOutput.cs b/src/YunDa.Application/YunDa.ISAS.DataTransferObject/GeneralInformation/ProtectionDeviceInfoDto/HistoryData/BoardCardSolftVersionOutput.cs
new file mode 100644
index 0000000..405ffa3
--- /dev/null
+++ b/src/YunDa.Application/YunDa.ISAS.DataTransferObject/GeneralInformation/ProtectionDeviceInfoDto/HistoryData/BoardCardSolftVersionOutput.cs
@@ -0,0 +1,40 @@
+using Abp.AutoMapper;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using YunDa.SOMS.Entities.GeneralInformation;
+
+namespace YunDa.SOMS.DataTransferObject.GeneralInformation.ProtectionDeviceInfoDto.HistoryData
+{
+ [AutoMapFrom(typeof(BoardCardInfo))]
+ public class BoardCardSolftVersionOutput
+ {
+ ///
+ /// 记录时间
+ ///
+ public virtual DateTime? RecodeDate { get; set; }
+ public string HardwareVersion { get; set; } // 硬件版本
+
+ public string InterfaceVersion { get; set; } // 接口程序版本
+
+ public string InterfaceChecksum { get; set; } // 接口程序校验码
+
+ public string DatabaseVersion { get; set; } // 数据库版本
+
+ public string ProtectionVersion { get; set; } // 保护程序版本
+
+ public string ProtectionChecksum { get; set; } // 保护程序校验码
+
+ public string BootVersion { get; set; } // BOOT 版本
+
+ public string Iec61850Version { get; set; } // IEC 61850 版本
+
+ public string FpgaVersion { get; set; } // FPGA 版本
+
+ public string CidChecksum { get; set; } // CID 校验码
+
+ public string CcdChecksum { get; set; } // CCD 校验码
+ }
+}
diff --git a/src/YunDa.Application/YunDa.ISAS.DataTransferObject/GeneralInformation/ProtectionDeviceInfoDto/HistoryData/ProtectionDeviceSolfVersionOutput.cs b/src/YunDa.Application/YunDa.ISAS.DataTransferObject/GeneralInformation/ProtectionDeviceInfoDto/HistoryData/ProtectionDeviceSolfVersionOutput.cs
new file mode 100644
index 0000000..e018164
--- /dev/null
+++ b/src/YunDa.Application/YunDa.ISAS.DataTransferObject/GeneralInformation/ProtectionDeviceInfoDto/HistoryData/ProtectionDeviceSolfVersionOutput.cs
@@ -0,0 +1,24 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace YunDa.SOMS.DataTransferObject.GeneralInformation.ProtectionDeviceInfoDto.HistoryData
+{
+ public class ProtectionDeviceSolfVersionOutput
+ {
+ ///
+ /// 记录时间
+ ///
+ public virtual DateTime? RecodeDate { get; set; }
+ ///
+ /// 基线版本
+ ///
+ public virtual string BaselineBoardVersion { get; set; }
+ ///
+ /// 硬件版本
+ ///
+ public virtual string HardwareVersion { get; set; }
+ }
+}
diff --git a/src/YunDa.Server/Yunda.ISAS.DataMonitoringServer/ProtectionDeviceHandle/ProtectionDeviceDataCenter.cs b/src/YunDa.Server/Yunda.ISAS.DataMonitoringServer/ProtectionDeviceHandle/ProtectionDeviceDataCenter.cs
index 3247484..59c050d 100644
--- a/src/YunDa.Server/Yunda.ISAS.DataMonitoringServer/ProtectionDeviceHandle/ProtectionDeviceDataCenter.cs
+++ b/src/YunDa.Server/Yunda.ISAS.DataMonitoringServer/ProtectionDeviceHandle/ProtectionDeviceDataCenter.cs
@@ -97,6 +97,7 @@ namespace Yunda.SOMS.DataMonitoringServer.ProtectionDeviceHandle
MonitoringEventBus.LogHandler($"装置地址:{device.DeviceAddr},ip:{device.GatewayIP1} 启动成功", "装置定值");
_processes.Add(process);
}
+ device.IsOnline = true;
}
else if(IsDeviceOnline(device.GatewayIP2))
@@ -112,13 +113,14 @@ namespace Yunda.SOMS.DataMonitoringServer.ProtectionDeviceHandle
MonitoringEventBus.LogHandler($"装置地址:{device.DeviceAddr},ip:{device.GatewayIP2} 启动成功", "装置定值");
_processes.Add(process);
}
+ device.IsOnline = true;
+
}
else
{
device.IsOnline = false;
MonitoringEventBus.LogHandler($"装置地址:{device.DeviceAddr},ip1:{device.GatewayIP1},ip2:{device.GatewayIP2} {(online ? "在线" : "离线")}", "装置状态");
}
- device.IsOnline = true;
}
catch (Exception ex)
@@ -180,7 +182,7 @@ namespace Yunda.SOMS.DataMonitoringServer.ProtectionDeviceHandle
{
try
{
- if (ipAddress == "127.0.0.1"|| ipAddress == "localhost")
+ if (ipAddress == "127.0.0.1"|| ipAddress == "localhost" || string.IsNullOrWhiteSpace(ipAddress))
{
return false;
}
diff --git a/src/YunDa.Server/Yunda.ISAS.DataMonitoringServer/ProtectionDeviceHandle/ProtectionDeviceRunInfoHandle.cs b/src/YunDa.Server/Yunda.ISAS.DataMonitoringServer/ProtectionDeviceHandle/ProtectionDeviceRunInfoHandle.cs
index 3662931..dd13bb1 100644
--- a/src/YunDa.Server/Yunda.ISAS.DataMonitoringServer/ProtectionDeviceHandle/ProtectionDeviceRunInfoHandle.cs
+++ b/src/YunDa.Server/Yunda.ISAS.DataMonitoringServer/ProtectionDeviceHandle/ProtectionDeviceRunInfoHandle.cs
@@ -89,12 +89,13 @@ namespace Yunda.SOMS.DataMonitoringServer.ProtectionDeviceHandle
device.LastComTime = DateTime.Now;
if (!device.IsOnline)
{
+ device.IsOnline = true;
await _protectionDeviceCommInfoRedis.HashSetUpdateOneAsync(protectionDeviceCommInfoRedisKey, device.DeviceAddr.ToString(), device);
- await _protectionDeviceCommInfoRedis.PublishAsync(protectionDeviceCommInfoRedisChannel, device);
}
- device.IsOnline = true;
+ await _protectionDeviceCommInfoRedis.PublishAsync(protectionDeviceCommInfoRedisChannel, device);
+
}
-
+
_commCount++;
if (_commCount == 10)
{
@@ -110,6 +111,11 @@ namespace Yunda.SOMS.DataMonitoringServer.ProtectionDeviceHandle
await _protectionDeviceCommInfoRedis.HashSetUpdateOneAsync(protectionDeviceCommInfoRedisKey, item.DeviceAddr.ToString(), item);
await _protectionDeviceCommInfoRedis.PublishAsync(protectionDeviceCommInfoRedisChannel, item);
}
+//#if DEBUG
+
+// item.IsOnline = true;
+// await _protectionDeviceCommInfoRedis.PublishAsync(protectionDeviceCommInfoRedisChannel, item);
+//#endif
}
}
catch (Exception ex)