From 7a145b9e47cded04f537be4cec3bed87eb781baa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=83=AD=E7=9D=BFAMD7950X?= <774114798@qq.com> Date: Mon, 2 Dec 2024 16:28:51 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A3=85=E7=BD=AE=E7=8A=B6=E6=80=81=20?= =?UTF-8?q?=E6=9F=A5=E8=AF=A2=E8=A3=85=E7=BD=AE=E8=87=AA=E6=A3=80=E4=BB=A3?= =?UTF-8?q?=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ProtectionDeviceAppService.cs | 73 ++++++++++++++++++- .../YunDa.ISAS.Application.xml | 7 ++ 2 files changed, 78 insertions(+), 2 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 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 @@ + + + 获取装置状态 + + + + 填充出厂编号