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 f6e9e98..d3bb13c 100644 --- a/src/YunDa.Application/YunDa.ISAS.Application/GeneralInformation/ProtectionDevice/ProtectionDeviceAppService.cs +++ b/src/YunDa.Application/YunDa.ISAS.Application/GeneralInformation/ProtectionDevice/ProtectionDeviceAppService.cs @@ -66,8 +66,8 @@ namespace YunDa.ISAS.Application.GeneralInformation private readonly IRepository _imDeviceDzRepository; private readonly IRedisRepository _imDeviceDzRedis; private readonly IUnitOfWorkManager _unitOfWorkManager; - - public ProtectionDeviceAppService( + private readonly IRedisRepository _bcodeAndNTP; + public ProtectionDeviceAppService( IRepository protectionDeviceInfoRepository, IUnitOfWorkManager unitOfWorkManager, IRepository imProtectDeviceRepository, @@ -88,6 +88,7 @@ namespace YunDa.ISAS.Application.GeneralInformation IRepository transformerSubstationRepository, IRepository imDeviceDzRepository, IRepository imEventTypeRepository, + IRedisRepository bcodeAndNTP, ISessionAppService sessionAppService ) : base(sessionAppService) @@ -111,6 +112,7 @@ namespace YunDa.ISAS.Application.GeneralInformation _imEventTypeRepository = imEventTypeRepository; _telemeteringConfigurationRepository = telemeteringConfigurationRepository; _telesignalisationConfigurationRepository = telesignalisationConfigurationRepository; + _bcodeAndNTP = bcodeAndNTP; } public async Task> CreateOrUpdateAsync(EditProtectionDeviceInfoInput input) { @@ -1070,6 +1072,30 @@ namespace YunDa.ISAS.Application.GeneralInformation } return rst; } + [AbpAllowAnonymous] + [HttpGet] + [DisableAuditing] + public async Task> GetDeviceBCondeAndNTP(Guid equipmentInfoId) + { + RequestResult rst = new(); + try + { + var device = _protectionDeviceInfoRepository.GetAll().FirstOrDefault(t => t.EquipmentInfoId == equipmentInfoId); + if (device!=null) + { + var entity =await _bcodeAndNTP.HashSetGetOneAsync(nameof(BCodeAndNTP), device.DeviceAddress.ToString()); + rst.ResultData = entity; + rst.Flag = true; + } + } + catch (Exception ex) + { + rst.Message = ex.Message; + + Log4Helper.Error(this.GetType(), "线路管理服务", ex); + } + return rst; + } #if DEBUG /// /// 填充出厂编号