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 451d3d7..ccaf017 100644 --- a/src/YunDa.Application/YunDa.ISAS.Application/GeneralInformation/ProtectionDevice/ProtectionDeviceAppService.cs +++ b/src/YunDa.Application/YunDa.ISAS.Application/GeneralInformation/ProtectionDevice/ProtectionDeviceAppService.cs @@ -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 _imProtectDeviceRepository; private readonly IRepository _imGateWayRepository; private readonly IRepository _imPuCtgyRepository; + private readonly IRepository _imEventTypeRepository; private readonly IRepository _protectionDeviceGatewayRepository; private readonly IRepository _protectionDeviceTypeyRepository; @@ -79,6 +81,7 @@ namespace YunDa.ISAS.Application.GeneralInformation IRepository manufacturerInfoRepository, IRepository transformerSubstationRepository, IRepository imDeviceDzRepository, + IRepository imEventTypeRepository, ISessionAppService sessionAppService ) : base(sessionAppService) @@ -878,7 +881,45 @@ namespace YunDa.ISAS.Application.GeneralInformation return rst; } - + /// + /// 获取装置时间类型 + /// + /// + /// + /// + [ShowApi] + [AbpAllowAnonymous] + [HttpGet] + [DisableAuditing] + public RequestResult GetDeviceEventType(int deviceAddr,int eventCode) + { + RequestResult rst= new RequestResult(); + 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 diff --git a/src/YunDa.Domain/YunDa.ISMS.BASE.Entities/ISMS_BASEContext.cs b/src/YunDa.Domain/YunDa.ISMS.BASE.Entities/ISMS_BASEContext.cs index ee8330f..a75d55f 100644 --- a/src/YunDa.Domain/YunDa.ISMS.BASE.Entities/ISMS_BASEContext.cs +++ b/src/YunDa.Domain/YunDa.ISMS.BASE.Entities/ISMS_BASEContext.cs @@ -2724,7 +2724,7 @@ namespace YunDa.ISMS.BASE.Entities modelBuilder.Entity(entity => { - entity.HasKey(e => new { e.EvtCode, e.PuctgyCode }) + entity.HasKey(e => new { e.Id, e.PuctgyCode }) .HasName("PK_EventType"); entity.ToTable("im_EventType"); diff --git a/src/YunDa.Domain/YunDa.ISMS.BASE.Entities/Models/ImEventType.cs b/src/YunDa.Domain/YunDa.ISMS.BASE.Entities/Models/ImEventType.cs index 3dff91c..b134f80 100644 --- a/src/YunDa.Domain/YunDa.ISMS.BASE.Entities/Models/ImEventType.cs +++ b/src/YunDa.Domain/YunDa.ISMS.BASE.Entities/Models/ImEventType.cs @@ -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 { - 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!;