装置版本历史记录查询
This commit is contained in:
parent
cdbb1bf474
commit
8fdc52a8c8
@ -528,7 +528,64 @@ namespace YunDa.ISAS.Application.GeneralInformation
|
||||
|
||||
return rst;
|
||||
}
|
||||
/// <summary>
|
||||
/// 查询板卡历史版本数据
|
||||
/// </summary>
|
||||
/// <param name="equipmentInfoId"></param>
|
||||
/// <returns></returns>
|
||||
[ShowApi]
|
||||
[AbpAllowAnonymous]
|
||||
[DisableAuditing]
|
||||
[HttpGet]
|
||||
public RequestResult<List<BoardCardSolftVersionOutput>> FindHistorySoftVersionByEquipmentInfoId(Guid? equipmentInfoId)
|
||||
{
|
||||
RequestResult<List<BoardCardSolftVersionOutput>> rst = ();
|
||||
try
|
||||
{
|
||||
List<BoardCardSolftVersionOutput> historys = new List<BoardCardSolftVersionOutput>();
|
||||
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<BoardCardSolftVersionOutput>(board.ContentJson);
|
||||
boardCardSolftVersionOutput.RecodeDate = board.RecodeDate;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
boardCardSolftVersionOutput = JsonConvert.DeserializeObject<BoardCardSolftVersionOutput>(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<string> GetProtectionDeviceQRcode(Guid id)
|
||||
{
|
||||
RequestResult<string> rst = new RequestResult<string>();
|
||||
|
@ -24,7 +24,12 @@ namespace YunDa.ISAS.Application.GeneralInformation
|
||||
/// <param name="equipmentInfoId"></param>
|
||||
/// <returns></returns>
|
||||
RequestResult<List<ProtectionDeviceHistoryOutput>> FindHistoryDataByEquipmentInfoId(Guid? equipmentInfoId);
|
||||
|
||||
/// <summary>
|
||||
/// 查询历史保护装置版本信息
|
||||
/// </summary>
|
||||
/// <param name="equipmentInfoId"></param>
|
||||
/// <returns></returns>
|
||||
RequestResult<List<ProtectionDeviceSolfVersionOutput>> FindHistorySoftVersionDataByEquipmentInfoId(Guid? equipmentInfoId);
|
||||
/// <summary>
|
||||
/// 获取所有保护装置
|
||||
/// </summary>
|
||||
|
@ -597,6 +597,69 @@ namespace YunDa.ISAS.Application.GeneralInformation
|
||||
|
||||
return rst;
|
||||
}
|
||||
/// <summary>
|
||||
/// 查询保护装置历史版本信息
|
||||
/// </summary>
|
||||
/// <param name="equipmentInfoId"></param>
|
||||
/// <returns></returns>
|
||||
[ShowApi]
|
||||
[AbpAllowAnonymous]
|
||||
[DisableAuditing]
|
||||
[HttpGet]
|
||||
public RequestResult<List<ProtectionDeviceSolfVersionOutput>> FindHistorySoftVersionDataByEquipmentInfoId(Guid? equipmentInfoId)
|
||||
{
|
||||
RequestResult<List<ProtectionDeviceSolfVersionOutput>> rst = new();
|
||||
try
|
||||
{
|
||||
List<ProtectionDeviceSolfVersionOutput> historys = new List<ProtectionDeviceSolfVersionOutput>();
|
||||
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<ProtectionDeviceInfo>(entity.ContentJson);
|
||||
protectionDeviceSolfVersionOutput.BaselineBoardVersion = history.BaselineBoardVersion;
|
||||
protectionDeviceSolfVersionOutput.HardwareVersion = history.HardwareVersion;
|
||||
protectionDeviceSolfVersionOutput.RecodeDate = entity.RecodeDate;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ProtectionDeviceInfo history = JsonConvert.DeserializeObject<ProtectionDeviceInfo>(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<string> GetProtectionDeviceQRcode(Guid id)
|
||||
{
|
||||
RequestResult<string> rst = new RequestResult<string>();
|
||||
|
@ -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
|
||||
{
|
||||
/// <summary>
|
||||
/// 记录时间
|
||||
/// </summary>
|
||||
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 校验码
|
||||
}
|
||||
}
|
@ -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
|
||||
{
|
||||
/// <summary>
|
||||
/// 记录时间
|
||||
/// </summary>
|
||||
public virtual DateTime? RecodeDate { get; set; }
|
||||
/// <summary>
|
||||
/// 基线版本
|
||||
/// </summary>
|
||||
public virtual string BaselineBoardVersion { get; set; }
|
||||
/// <summary>
|
||||
/// 硬件版本
|
||||
/// </summary>
|
||||
public virtual string HardwareVersion { get; set; }
|
||||
}
|
||||
}
|
@ -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;
|
||||
}
|
||||
|
@ -89,10 +89,11 @@ 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++;
|
||||
@ -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)
|
||||
|
Loading…
x
Reference in New Issue
Block a user