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 7deb32a..dd5f539 100644 --- a/src/YunDa.Application/YunDa.ISAS.Application/GeneralInformation/ProtectionDevice/ProtectionDeviceAppService.cs +++ b/src/YunDa.Application/YunDa.ISAS.Application/GeneralInformation/ProtectionDevice/ProtectionDeviceAppService.cs @@ -102,6 +102,7 @@ namespace YunDa.ISAS.Application.GeneralInformation _manufacturerInfoRepository = manufacturerInfoRepository; _transformerSubstationRepository = transformerSubstationRepository; _imDeviceDzRepository = imDeviceDzRepository; + _imEventTypeRepository = imEventTypeRepository; } public async Task> CreateOrUpdateAsync(EditProtectionDeviceInfoInput input) { @@ -904,7 +905,7 @@ namespace YunDa.ISAS.Application.GeneralInformation { AbnormalComponent abnormalComponent = new AbnormalComponent() { - ComponentName = "", + ComponentName = device.DeviceName, AbnormalReason = imEvent.EvtName, HandlingMeasures ="" }; @@ -920,8 +921,76 @@ namespace YunDa.ISAS.Application.GeneralInformation } return rst; } + /// + /// 获取装置状态 + /// + /// + /// + [ShowApi] + [AbpAllowAnonymous] + [HttpGet] + [DisableAuditing] + [UnitOfWork(isTransactional: false)] - + public async Task> GetDeviceStatusAsync(Guid equipmentInfoId) + { + RequestResult rst = new RequestResult(); + try + { + ProtectionDeviceInfo protectionDeviceInfo = default; + using (var unitOfWork = _unitOfWorkManager.Begin()) + { + protectionDeviceInfo = _protectionDeviceInfoRepository.GetAllIncluding(t=>t.EquipmentInfo).FirstOrDefault(t=>t.EquipmentInfoId == equipmentInfoId); + await unitOfWork.CompleteAsync(); + } + if (protectionDeviceInfo != null) + { + + using (var unitOfWork = _unitOfWorkManager.Begin()) + { + var device = _imProtectDeviceRepository.GetAllIncluding(t=>t.GateWay).FirstOrDefault(t => t.Id == protectionDeviceInfo.ISMS_DeviceId); + if (device != null) + { + DeviceStatus deviceStatus = new DeviceStatus() + { + ConnectionStatus104=0, + EquipmentInfoId = equipmentInfoId, + EquipmentInfoName = protectionDeviceInfo.EquipmentInfo.Name, + FreeMemory = "0KB", + UsedMemory ="0KB", + LcdOperationPassword ="", + ProtectionDeviceId = protectionDeviceInfo.Id, + TotalDisk = "0MB", + UsedDisk ="0MB", + NetworkInterfaces = new List + { + new NetworkInterfaceStatus + { + IpAddress =device.GateWay.GatewayIp1, + InterfaceName ="eth0", + }, + new NetworkInterfaceStatus + { + IpAddress =device.GateWay.GatewayIp2, + InterfaceName ="eth1", + }, + } + }; + rst.ResultData = deviceStatus; + rst.Flag = true; + } + await unitOfWork.CompleteAsync(); + } + } + + } + catch (Exception ex) + { + rst.Message = ex.Message; + Log4Helper.Error(this.GetType(), "线路管理服务", ex); + } + return rst; + } #if DEBUG /// /// 填充出厂编号 diff --git a/src/YunDa.Application/YunDa.ISAS.Application/YunDa.ISAS.Application.xml b/src/YunDa.Application/YunDa.ISAS.Application/YunDa.ISAS.Application.xml index 1a1e64a..615ccac 100644 --- a/src/YunDa.Application/YunDa.ISAS.Application/YunDa.ISAS.Application.xml +++ b/src/YunDa.Application/YunDa.ISAS.Application/YunDa.ISAS.Application.xml @@ -3578,6 +3578,13 @@ + + + 获取装置状态 + + + + 填充出厂编号