From c19fff931b4507ada470f2f0149486c4566eaf82 Mon Sep 17 00:00:00 2001 From: xjl <2595686544@qq.com> Date: Mon, 5 Aug 2024 17:46:53 +0800 Subject: [PATCH] =?UTF-8?q?=E5=90=AF=E5=8A=A8=E6=8D=A2=E7=94=B5=E5=92=8C?= =?UTF-8?q?=E5=8D=B7=E5=B8=98=E9=97=A8=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Entity/Api/Resp/SwapModelResp.cs | 6 ++- Entity/Constant/StationConstant.cs | 19 ++++++-- Service/Plc/Client/PlcMgr.cs | 4 +- Service/Station/MonitorService.cs | 3 +- .../Controllers/SwapMonitorController.cs | 43 +++++++++++++++++++ 5 files changed, 66 insertions(+), 9 deletions(-) diff --git a/Entity/Api/Resp/SwapModelResp.cs b/Entity/Api/Resp/SwapModelResp.cs index 6d72d34..0609853 100644 --- a/Entity/Api/Resp/SwapModelResp.cs +++ b/Entity/Api/Resp/SwapModelResp.cs @@ -21,7 +21,9 @@ public class SwapModelResp /// 换电站状态: 1:营运中 2:歇业中 3:设备维护状态 4:暂停营业 /// public int? StationStatus { get; set; } - - + /// + /// 启动方式: 1:自动启动;2:拍按钮启动 + /// + public byte? SwapInitiateMode { get; set; } } \ No newline at end of file diff --git a/Entity/Constant/StationConstant.cs b/Entity/Constant/StationConstant.cs index fa1ea4e..bad1c0f 100644 --- a/Entity/Constant/StationConstant.cs +++ b/Entity/Constant/StationConstant.cs @@ -46,8 +46,19 @@ public class StationConstant Remote, } - - - - + + /// + /// 启动方式:1:自动换电 2:手动换电 + /// + public enum SwapInitiateMode + { + + [Description("自动启动")] + Auto = 1, + [Description("手动启动")] + Manual, + + } + + } \ No newline at end of file diff --git a/Service/Plc/Client/PlcMgr.cs b/Service/Plc/Client/PlcMgr.cs index 8aa0e35..d9cd708 100644 --- a/Service/Plc/Client/PlcMgr.cs +++ b/Service/Plc/Client/PlcMgr.cs @@ -405,7 +405,7 @@ public class PlcMgr /// public static bool WriteRollerShutter(ushort pollerShutter) { - bool bResult = false; + bool bResult = true; if (PlcClient != null) { HostToPlc writeHostToPlc = new HostToPlc(); @@ -428,7 +428,7 @@ public class PlcMgr } else { - return false; + return true; } } /// diff --git a/Service/Station/MonitorService.cs b/Service/Station/MonitorService.cs index 6bed8a4..788ae5d 100644 --- a/Service/Station/MonitorService.cs +++ b/Service/Station/MonitorService.cs @@ -152,7 +152,8 @@ public class MonitorService { StationStatus = StaticStationInfo.StationStatus, StationWay = StaticStationInfo.StationWay, - StationModel = StaticStationInfo.StationModel + StationModel = StaticStationInfo.StationModel, + SwapInitiateMode = StaticStationInfo.SwapInitiateMode, }; return Result.Success(resp); diff --git a/WebStarter/Controllers/SwapMonitorController.cs b/WebStarter/Controllers/SwapMonitorController.cs index a7d5c95..6f0729f 100644 --- a/WebStarter/Controllers/SwapMonitorController.cs +++ b/WebStarter/Controllers/SwapMonitorController.cs @@ -252,6 +252,7 @@ public class SwapMonitorController : ControllerBase return Result.Success(); } + /// /// 切换成 营业状态 /// 换电站状态: 1:营运中 2:歇业中 3:设备维护状态 4:暂停营业 @@ -320,4 +321,46 @@ public class SwapMonitorController : ControllerBase return Result.Success(); } + + /// + /// 切换成 自动启动 + /// + [HttpPost("AutoInitiate")] + public Result AutoInitiate() + { + StaticStationInfo.SwapInitiateMode = (byte)StationConstant.SwapInitiateMode.Auto; + return Result.Success(); + } + /// + /// 切换成 手动启动 + /// + [HttpPost("ManualInitiate")] + public Result ManualInitiate() + { + StaticStationInfo.SwapInitiateMode = (byte)StationConstant.SwapInitiateMode.Manual; + return Result.Success(); + } + + + /// + /// 卷帘门控制:1000:请求开启 1010:请求关闭 + /// + /// + [HttpPost("RollerShutter")] + public async Task> RollerShutter(ushort value) + { + return PlcMgr.WriteRollerShutter(value) ? Result.Success(true) : Result.Fail(); + } + + /// + /// 卷帘门是否开启 + /// + /// true:开启状态;false:关闭状态 + [HttpPost("GetRollerShutter")] + public async Task> GetRollerShutter() + { + return PlcMgr.RollerShutterRadar() ? Result.Success(true) : Result.Fail(); + + } + } \ No newline at end of file