This commit is contained in:
郭睿 2024-12-13 11:06:00 +08:00
commit d9fbfdd938
8 changed files with 216 additions and 161 deletions

View File

@ -610,84 +610,6 @@ namespace YunDa.ISAS.Application.GeneralInformation
}
}
/// <summary>
/// 获取遥信数据
/// </summary>
/// <param name="stationName">所亭名称</param>
/// <returns></returns>
[HttpGet, AbpAllowAnonymous]
[ShowApi]
[DisableAuditing]
public async Task<RequestResult<List<IEC104YXOutput>>> GetYXData(string stationName)
{
string rediskey = "telesignalisationModelList";
RequestResult<List<IEC104YXOutput>> rst = new RequestResult<List<IEC104YXOutput>>();
try
{
var data = await _telesignalisationModelListRedis.HashSetGetAllAsync(rediskey);
if (data != null && data.Count > 0)
{
rst.ResultData = data.Select(t => new IEC104YXOutput
{
YXValue = t.ResultValue,
DateTime = t.ResultTime,
ISMSYXId = t.ismsbaseYXId,
Name = t.Name,
}).ToList();
}
rst.Flag = true;
}
catch (Exception ex)
{
Log4Helper.Error(this.GetType(), "", ex);
rst.Message = ex.Message;
}
return rst;
}
/// <summary>
/// 获取遥测数据
/// </summary>
/// <param name="stationName">所亭名称</param>
/// <returns></returns>
[HttpGet, AbpAllowAnonymous]
[ShowApi]
[DisableAuditing]
public async Task<RequestResult<List<IEC104YCOutput>>> GetYCData(string stationName)
{
string rediskey = "telemeteringModelList";
RequestResult<List<IEC104YCOutput>> rst = new RequestResult<List<IEC104YCOutput>>();
try
{
var data = await _telemeteringModelListRedis.HashSetGetAllAsync(rediskey);
if (data != null && data.Count > 0)
{
rst.ResultData = data.Select(t => new IEC104YCOutput
{
YCValue = t.ResultValue,
DateTime = t.ResultTime,
ISMSYCId = t.ismsbaseYCId,
Name = t.Name,
}).ToList();
}
//else
//{
// InitYXList();
//}
rst.Flag = true;
}
catch (Exception ex)
{
Log4Helper.Error(this.GetType(), "", ex);
rst.Message = ex.Message;
}
return rst;
}
}
}

View File

@ -111,7 +111,6 @@ namespace YunDa.ISAS.Application.GeneralInformation
deviceDatas = _imDeviceDatumRepository.GetAllIncluding(t => t.Device).ToList();
ImDeviceYcs = _imDeviceYcRepository.GetAll().ToList();
ImDeviceYxs = _imDeviceYxRepository.GetAll().ToList();
unitOfWork.Complete();
}
using (var unitOfWork = _unitOfWorkManager.Begin())
@ -120,6 +119,7 @@ namespace YunDa.ISAS.Application.GeneralInformation
dmalarmCategories = _dmalarmCategoryRepository.GetAll().ToList();
unitOfWork.Complete();
}
// 将设备数据和设备映射到字典中
var equipmentDict = equipments.ToDictionary(e => e.Name);
var telemeteringConfigIds = new HashSet<string>(_telemeteringConfigurationRepository.GetAll().Select(t => t.ismsbaseYCId));
@ -135,9 +135,43 @@ namespace YunDa.ISAS.Application.GeneralInformation
continue; // 未匹配到设备,跳过
}
if (deviceData.DataType == "YC" && !telemeteringConfigIds.Contains(deviceData.Id))
if (deviceData.DataType == "YC")
{
var yc = ImDeviceYcs.FirstOrDefault(t => t.Id == deviceData.Id);
if (telemeteringConfigIds.Contains(deviceData.Id))
{
// 更新已有的 Telemetering 配置
var existingTelemeteringConfig = _telemeteringConfigurationRepository
.FirstOrDefault(t => t.ismsbaseYCId == deviceData.Id);
if (existingTelemeteringConfig != null)
{
existingTelemeteringConfig.Coefficient = (float)yc.Cof;
existingTelemeteringConfig.DecimalDigits = (int)yc.Precise;
existingTelemeteringConfig.Name = deviceData.DataName;
existingTelemeteringConfig.Unit = yc.Unit;
existingTelemeteringConfig.IsSelfCheckingValue = false; // 假设这是需要更新的字段
existingTelemeteringConfig.EquipmentInfoId = equipment.Id; // 更新设备信息ID
existingTelemeteringConfig.EquipmentTypeId = equipment.EquipmentTypeId; // 更新设备类型ID
existingTelemeteringConfig.TransformerSubstationId = equipment.TransformerSubstationId; // 更新变电站ID
existingTelemeteringConfig.IsVirtualDevice = false; // 假设这是需要更新的字段
existingTelemeteringConfig.IsEnvironmentTemp = false; // 假设这是需要更新的字段
existingTelemeteringConfig.InfoAddress = deviceData.InfoAddr; // 更新信息地址
existingTelemeteringConfig.DispatcherAddress = deviceData.InfoAddr; // 更新调度器地址
existingTelemeteringConfig.IsActive = true; // 更新是否激活
existingTelemeteringConfig.IsSave = true; // 更新是否保存
existingTelemeteringConfig.IsVisible = true; // 更新是否可见
existingTelemeteringConfig.SeqNo = 0; // 假设这是需要更新的字段
existingTelemeteringConfig.CPUSector = 0; ; // 更新CPU扇区
existingTelemeteringConfig.InfoCPUSector = deviceData.CpuIndex; ; // 更新信息CPU扇区
existingTelemeteringConfig.CreatorUserId = default; // 更新创建用户ID如果需要
existingTelemeteringConfig.LastModificationTime = DateTime.Now; // 更新创建时间
// 这里可以添加更多的更新字段
// 保存到数据库
_telemeteringConfigurationRepository.Update(existingTelemeteringConfig);
}
}
else
{
if (yc != null)
{
telemeteringConfigurations.Add(new TelemeteringConfiguration
@ -150,6 +184,7 @@ namespace YunDa.ISAS.Application.GeneralInformation
DeviceAddress = 1,
DecimalDigits = (int)yc.Precise,
DispatcherAddress = deviceData.InfoAddr,
InfoAddress = deviceData.InfoAddr,
InfoCPUSector = 0,
IsSelfCheckingValue = false,
EquipmentInfoId = equipment.Id,
@ -168,9 +203,54 @@ namespace YunDa.ISAS.Application.GeneralInformation
telemeteringConfigIds.Add(deviceData.Id); // 添加到已存在集合中
}
}
else if (deviceData.DataType == "YX" && !telesignalisationConfigIds.Contains(deviceData.Id))
}
else if (deviceData.DataType == "YX")
{
var yx = ImDeviceYxs.FirstOrDefault(t => t.Id == deviceData.Id);
if (telesignalisationConfigIds.Contains(deviceData.Id))
{
// 更新已有的 Telesignalisation 配置
var existingTelesignalisationConfig = _telesignalisationConfigurationRepository
.FirstOrDefault(t => t.ismsbaseYXId == deviceData.Id);
if (existingTelesignalisationConfig != null)
{
// 处理 AlertLevel 字段
string levelStr = Regex.Match(yx.AlertLevel, @"\d+")?.Value;
if (string.IsNullOrWhiteSpace(levelStr))
{
levelStr = "4"; // 默认值
}
var defaultDma = dmalarmCategories.FirstOrDefault(t => t.Level == int.Parse(levelStr));
// 更新 Telesignalisation 配置的各个字段
existingTelesignalisationConfig.YesContent = yx.SwOnStr ?? ""; // 如果为空,设置为默认值
existingTelesignalisationConfig.NoContent = yx.SwOffStr ?? ""; // 如果为空,设置为默认值
existingTelesignalisationConfig.UnsurenessContent = yx.SwUncertStr ?? "不定"; // 如果为空,设置为默认值
existingTelesignalisationConfig.DMAlarmCategoryId = defaultDma?.Id; // 更新报警分类ID
existingTelesignalisationConfig.Name = deviceData.DataName; // 更新名称
existingTelesignalisationConfig.InfoAddress = deviceData.InfoAddr; // 更新信息地址
existingTelesignalisationConfig.DispatcherAddress = deviceData.InfoAddr; // 更新调度器地址
existingTelesignalisationConfig.EquipmentInfoId = equipment.Id; // 更新设备信息ID
existingTelesignalisationConfig.EquipmentTypeId = equipment.EquipmentTypeId; // 更新设备类型ID
existingTelesignalisationConfig.TransformerSubstationId = equipment.TransformerSubstationId; // 更新变电站ID
existingTelesignalisationConfig.IsActive = true; // 更新是否激活
existingTelesignalisationConfig.IsSave = true; // 更新是否保存
existingTelesignalisationConfig.IsVisible = true; // 更新是否可见
existingTelesignalisationConfig.SeqNo = 0; // 假设需要设置序号
existingTelesignalisationConfig.CPUSector = 0; // 更新CPU扇区
existingTelesignalisationConfig.InfoCPUSector = deviceData.CpuIndex; // 更新信息CPU扇区
existingTelesignalisationConfig.IsVirtualDevice = false; // 更新虚拟设备标志
existingTelesignalisationConfig.CreatorUserId = default; // 更新创建用户ID
existingTelesignalisationConfig.LastModificationTime = DateTime.Now; // 更新创建时间
// 这里可以继续添加其他字段更新的代码
// 保存到数据库
_telesignalisationConfigurationRepository.Update(existingTelesignalisationConfig);
}
}
else
{
if (yx != null)
{
string levelStr = Regex.Match(yx.AlertLevel, @"\d+")?.Value;
@ -187,6 +267,7 @@ namespace YunDa.ISAS.Application.GeneralInformation
CreationTime = DateTime.Now,
CreatorUserId = default,
DispatcherAddress = deviceData.InfoAddr,
InfoAddress = deviceData.InfoAddr,
DeviceAddress = 1,
InfoCPUSector = 0,
IsSelfCheckingValue = false,
@ -209,21 +290,21 @@ namespace YunDa.ISAS.Application.GeneralInformation
}
}
}
}
// 批量插入
// 批量插入或更新数据库
using (var unitOfWork = _unitOfWorkManager.Begin())
{
if (telemeteringConfigurations.Any())
await _telemeteringConfigurationRepository.InsertRangeAsync(telemeteringConfigurations);
if (telesignalisationConfigurations.Any())
await _telesignalisationConfigurationRepository.InsertRangeAsync(telesignalisationConfigurations);
unitOfWork.Complete();
// 完成数据库操作
await unitOfWork.CompleteAsync();
}
rst.Flag = true;
rst.Message = "批量插入成功!";
}
catch (Exception ex)
{
@ -235,6 +316,7 @@ namespace YunDa.ISAS.Application.GeneralInformation
}
//[HttpGet]
//[AbpAllowAnonymous]
//[ShowApi]

View File

@ -577,9 +577,22 @@ namespace YunDa.ISAS.Application.GeneralInformation
}
if (boardCardSolftVersionOutput.RecodeDate.HasValue)
{
// 检查至少一个版本字符串不为空
bool check = !string.IsNullOrEmpty(boardCardSolftVersionOutput.HardwareVersion) ||
!string.IsNullOrEmpty(boardCardSolftVersionOutput.InterfaceVersion) ||
!string.IsNullOrEmpty(boardCardSolftVersionOutput.ProtectionDatabaseVersion) ||
!string.IsNullOrEmpty(boardCardSolftVersionOutput.InterfaceDatabaseVersion) ||
!string.IsNullOrEmpty(boardCardSolftVersionOutput.ProtectionVersion) ||
!string.IsNullOrEmpty(boardCardSolftVersionOutput.BootVersion) ||
!string.IsNullOrEmpty(boardCardSolftVersionOutput.Iec61850Version) ||
!string.IsNullOrEmpty(boardCardSolftVersionOutput.FpgaVersion);
if (check)
{
historys.Add(boardCardSolftVersionOutput);
}
}
}
rst.Flag = true;
rst.ResultData = historys;

View File

@ -631,6 +631,7 @@ namespace YunDa.ISAS.Application.GeneralInformation
protectionDeviceSolfVersionOutput.BaselineBoardVersion = history.BaselineBoardVersion;
protectionDeviceSolfVersionOutput.HardwareVersion = history.HardwareVersion;
protectionDeviceSolfVersionOutput.RecodeDate = entity.RecodeDate;
protectionDeviceSolfVersionOutput.Name = entity.Name;
}
}
else
@ -639,8 +640,9 @@ namespace YunDa.ISAS.Application.GeneralInformation
protectionDeviceSolfVersionOutput.BaselineBoardVersion = history.BaselineBoardVersion;
protectionDeviceSolfVersionOutput.HardwareVersion = history.HardwareVersion;
protectionDeviceSolfVersionOutput.RecodeDate = entity.RecodeDate;
protectionDeviceSolfVersionOutput.Name = entity.Name;
}
if (!string.IsNullOrWhiteSpace( protectionDeviceSolfVersionOutput.BaselineBoardVersion))
if (protectionDeviceSolfVersionOutput.RecodeDate.HasValue&&!string.IsNullOrWhiteSpace(protectionDeviceSolfVersionOutput.BaselineBoardVersion))
{
historys.Add(protectionDeviceSolfVersionOutput);
}
@ -935,6 +937,7 @@ namespace YunDa.ISAS.Application.GeneralInformation
}
else
{
porotectionDeviceInfos[item].ISMS_DeviceId = imProtectDevice.Id;
porotectionDeviceInfos[item].DeviceAddress = imProtectDevice.DeviceAddr;
}
}

View File

@ -2717,20 +2717,6 @@
初始化遥信队列
</summary>
</member>
<member name="M:YunDa.ISAS.Application.GeneralInformation.EquipmentInfoExAppService.GetYXData(System.String)">
<summary>
获取遥信数据
</summary>
<param name="stationName">所亭名称</param>
<returns></returns>
</member>
<member name="M:YunDa.ISAS.Application.GeneralInformation.EquipmentInfoExAppService.GetYCData(System.String)">
<summary>
获取遥测数据
</summary>
<param name="stationName">所亭名称</param>
<returns></returns>
</member>
<member name="M:YunDa.ISAS.Application.GeneralInformation.IEquipmentInfoAppService.FindEquipmentInfoForSelect(YunDa.ISAS.DataTransferObject.GeneralInformation.EquipmentInfoDto.SearchCondition.SelectEquipmentInfoSearchConditionInput)">
<summary>
获取可以选择的设备下拉列表
@ -3425,6 +3411,13 @@
<param name="equipmentInfoId"></param>
<returns></returns>
</member>
<member name="M:YunDa.ISAS.Application.GeneralInformation.BoardCardInfoAppService.FindHistorySoftVersionByEquipmentInfoId(System.Nullable{System.Guid})">
<summary>
查询板卡历史版本数据
</summary>
<param name="equipmentInfoId"></param>
<returns></returns>
</member>
<member name="M:YunDa.ISAS.Application.GeneralInformation.BoardCardInfoAppService.GetBoardStateInfo(System.Guid,System.Guid)">
<summary>
获取板卡状态
@ -3513,6 +3506,13 @@
<param name="equipmentInfoId"></param>
<returns></returns>
</member>
<member name="M:YunDa.ISAS.Application.GeneralInformation.IProtectionDeviceAppService.FindHistorySoftVersionDataByEquipmentInfoId(System.Nullable{System.Guid})">
<summary>
查询历史保护装置版本信息
</summary>
<param name="equipmentInfoId"></param>
<returns></returns>
</member>
<member name="M:YunDa.ISAS.Application.GeneralInformation.IProtectionDeviceAppService.FindProtectionDeviceForSelect(System.Guid)">
<summary>
获取所有保护装置
@ -3568,6 +3568,13 @@
<param name="equipmentInfoId"></param>
<returns></returns>
</member>
<member name="M:YunDa.ISAS.Application.GeneralInformation.ProtectionDeviceAppService.FindHistorySoftVersionDataByEquipmentInfoId(System.Nullable{System.Guid})">
<summary>
查询保护装置历史版本信息
</summary>
<param name="equipmentInfoId"></param>
<returns></returns>
</member>
<member name="M:YunDa.ISAS.Application.GeneralInformation.ProtectionDeviceAppService.FindProtectionDeviceForSelect(System.Guid)">
<summary>
获取保护装置列表
@ -3601,7 +3608,7 @@
</member>
<member name="M:YunDa.ISAS.Application.GeneralInformation.ProtectionDeviceAppService.MigreteImGatewayDataFromISMS">
<summary>
从综自后台数据库迁移数据到运维数据库中(保护装置数据)
从综自后台数据库迁移数据到运维数据库中(保护装置网关数据)
</summary>
<returns></returns>
</member>
@ -3681,6 +3688,13 @@
</summary>
<returns></returns>
</member>
<member name="M:YunDa.ISAS.Application.GeneralInformation.ProtectionDevice.ProtecttionDeviceRedisAppService.GetProtectionDeviceCommInfoAsync(System.Guid)">
<summary>
查询保护装置在线情况
</summary>
<param name="stationId"></param>
<returns></returns>
</member>
<member name="M:YunDa.ISAS.Application.GeneralInformation.SecondaryCircuitInfo.IProtectionSettingAppService.FindDZDataByEquipmentInfoId(System.Nullable{System.Guid},System.String)">
<summary>
查询定值信息

View File

@ -11,6 +11,9 @@ namespace YunDa.SOMS.DataTransferObject.GeneralInformation.ProtectionDeviceInfoD
[AutoMapFrom(typeof(BoardCardInfo))]
public class BoardCardSolftVersionOutput
{
public string BoardId { get; set; } // 板卡号
public string BoardType { get; set; } // 板卡类型
/// <summary>
/// 记录时间
/// </summary>
@ -21,7 +24,14 @@ namespace YunDa.SOMS.DataTransferObject.GeneralInformation.ProtectionDeviceInfoD
public string InterfaceChecksum { get; set; } // 接口程序校验码
public string DatabaseVersion { get; set; } // 数据库版本
/// <summary>
/// 接口数据库版本
/// </summary>
public string InterfaceDatabaseVersion { get; set; } // 数据库版本
/// <summary>
/// 保护数据库版本
/// </summary>
public string ProtectionDatabaseVersion { get; set; } // 数据库版本
public string ProgramVersion { get; set; }//程序版本
public string ProgramVersionCrc { get; set; }//程序版本校验码

View File

@ -8,6 +8,7 @@ namespace YunDa.SOMS.DataTransferObject.GeneralInformation.ProtectionDeviceInfoD
{
public class ProtectionDeviceSolfVersionOutput
{
public virtual string Name { get; set; }
/// <summary>
/// 记录时间
/// </summary>

View File

@ -15068,6 +15068,16 @@
记录时间
</summary>
</member>
<member name="P:YunDa.SOMS.DataTransferObject.GeneralInformation.ProtectionDeviceInfoDto.HistoryData.BoardCardSolftVersionOutput.InterfaceDatabaseVersion">
<summary>
接口数据库版本
</summary>
</member>
<member name="P:YunDa.SOMS.DataTransferObject.GeneralInformation.ProtectionDeviceInfoDto.HistoryData.BoardCardSolftVersionOutput.ProtectionDatabaseVersion">
<summary>
保护数据库版本
</summary>
</member>
<member name="P:YunDa.SOMS.DataTransferObject.GeneralInformation.ProtectionDeviceInfoDto.HistoryData.ProtectionDeviceHistoryOutput.SeqNo">
<summary>
顺序号