自检信息获取

This commit is contained in:
郭睿 2024-12-02 15:35:03 +08:00
parent f93e0c97af
commit 80f31e3f14
3 changed files with 51 additions and 5 deletions

View File

@ -31,6 +31,7 @@ using YunDa.SOMS.DataTransferObject.GeneralInformation.ProtectionDeviceInfoDto;
using YunDa.SOMS.DataTransferObject.GeneralInformation.ProtectionDeviceInfoDto.HistoryData;
using YunDa.SOMS.DataTransferObject.GeneralInformation.ProtectionDeviceInfoDto.SearchCondition;
using YunDa.SOMS.DataTransferObject.GeneralInformation.ProtectionSettingDto;
using YunDa.SOMS.DataTransferObject.MainStationMaintenanceInfo.OperationReport;
using YunDa.SOMS.Entities.GeneralInformation;
using static Google.Protobuf.Reflection.ExtensionRangeOptions.Types;
@ -54,6 +55,7 @@ namespace YunDa.ISAS.Application.GeneralInformation
private readonly IRepository<ImProtectDevice,string> _imProtectDeviceRepository;
private readonly IRepository<ImGateWay, string> _imGateWayRepository;
private readonly IRepository<ImPuCtgy, string> _imPuCtgyRepository;
private readonly IRepository<ImEventType, int> _imEventTypeRepository;
private readonly IRepository<ProtectionDeviceGateway, Guid> _protectionDeviceGatewayRepository;
private readonly IRepository<ProtectionDeviceType, Guid> _protectionDeviceTypeyRepository;
@ -79,6 +81,7 @@ namespace YunDa.ISAS.Application.GeneralInformation
IRepository<ManufacturerInfo, Guid> manufacturerInfoRepository,
IRepository<TransformerSubstation, Guid> transformerSubstationRepository,
IRepository<ImDeviceDz, string> imDeviceDzRepository,
IRepository<ImEventType, int> imEventTypeRepository,
ISessionAppService sessionAppService
) :
base(sessionAppService)
@ -878,7 +881,45 @@ namespace YunDa.ISAS.Application.GeneralInformation
return rst;
}
/// <summary>
/// 获取装置时间类型
/// </summary>
/// <param name="deviceAddr"></param>
/// <param name="eventCode"></param>
/// <returns></returns>
[ShowApi]
[AbpAllowAnonymous]
[HttpGet]
[DisableAuditing]
public RequestResult<AbnormalComponent> GetDeviceEventType(int deviceAddr,int eventCode)
{
RequestResult <AbnormalComponent> rst= new RequestResult<AbnormalComponent>();
try
{
var device = _imProtectDeviceRepository.GetAll().FirstOrDefault(t => t.DeviceAddr == deviceAddr);
if (device!=null)
{
var imEvent = _imEventTypeRepository.GetAll().FirstOrDefault(t=>t.Id == eventCode&&t.PuctgyCode == device.PuctgyCode);
if (imEvent!=null)
{
AbnormalComponent abnormalComponent = new AbnormalComponent()
{
ComponentName = "",
AbnormalReason = imEvent.EvtName,
HandlingMeasures =""
};
rst.ResultData = abnormalComponent;
rst.Flag = true;
}
}
}
catch (Exception ex)
{
rst.Message = ex.Message;
Log4Helper.Error(this.GetType(), "线路管理服务", ex);
}
return rst;
}
#if DEBUG

View File

@ -2724,7 +2724,7 @@ namespace YunDa.ISMS.BASE.Entities
modelBuilder.Entity<ImEventType>(entity =>
{
entity.HasKey(e => new { e.EvtCode, e.PuctgyCode })
entity.HasKey(e => new { e.Id, e.PuctgyCode })
.HasName("PK_EventType");
entity.ToTable("im_EventType");

View File

@ -1,11 +1,16 @@
using System;
using Abp.Domain.Entities;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace YunDa.ISMS.BASE.Entities.Models
{
public partial class ImEventType
public partial class ImEventType : Entity<int>
{
public int EvtCode { get; set; }
[Key]
[Column("EvtCode")]
public override int Id { get; set; }
public int PuctgyCode { get; set; }
public string EvtName { get; set; } = null!;
public string AlertLevel { get; set; } = null!;