From 80f31e3f14d0a7126251830cf3e89800c6ba0310 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=83=AD=E7=9D=BF?= <774114798@qq.com> Date: Mon, 2 Dec 2024 15:35:03 +0800 Subject: [PATCH] =?UTF-8?q?=E8=87=AA=E6=A3=80=E4=BF=A1=E6=81=AF=E8=8E=B7?= =?UTF-8?q?=E5=8F=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ProtectionDeviceAppService.cs | 43 ++++++++++++++++++- .../ISMS_BASEContext.cs | 2 +- .../Models/ImEventType.cs | 11 +++-- 3 files changed, 51 insertions(+), 5 deletions(-) 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!;