From 0a1f644804e884ed2d612b78a916e59a6d320011 Mon Sep 17 00:00:00 2001 From: ningshuxia <ningshuxia0927@outlook.com> Date: 星期五, 28 十月 2022 09:37:21 +0800 Subject: [PATCH] 修改 南通对接程序 --- Application/IStation.Application.Monitor/monitor_control/MonitorControlNTConfigure_Controller.cs | 46 +++++++++++++++++++++++++++++++++++----------- 1 files changed, 35 insertions(+), 11 deletions(-) diff --git a/Application/IStation.Application.Monitor/monitor_control/MonitorControlNTConfigure_Controller.cs b/Application/IStation.Application.Monitor/monitor_control/MonitorControlNTConfigure_Controller.cs index 5654864..9f22c0e 100644 --- a/Application/IStation.Application.Monitor/monitor_control/MonitorControlNTConfigure_Controller.cs +++ b/Application/IStation.Application.Monitor/monitor_control/MonitorControlNTConfigure_Controller.cs @@ -7,7 +7,7 @@ using Furion.DynamicApiController; using System.ComponentModel.DataAnnotations; using Mapster; - +using Furion.FriendlyException; namespace IStation.Application { @@ -18,17 +18,35 @@ [ApiDescriptionSettings("Monitor", Name = "鐩戞祴鍗楅�氭帶鍒�", Order = 400)] public class MonitorControlNT_Controller : IDynamicApiController { - /// <summary> /// 娴嬭瘯鍚姩 /// </summary> [Route("TestStart@V1.0")] [HttpPost] - public string TestStart() + public string TestStart([Required] NTStartInput input) { + if (input.Password != Settings.Operating.NT.Password) + { + throw Oops.Oh("瀵嗙爜閿欒!"); + } + double operatingValue = 0; + /* switch (input.OperatingMode) + { + case Model.MonitorTestControlParas.eOperatingMode.Timing: + { + operatingValue = input.OperatingValue * 3600; + } + break; + case Model.MonitorTestControlParas.eOperatingMode.ConstantFlow: + break; + default: + break; + }*/ + operatingValue = input.OperatingValue * 3600; + var context = new Model.MonitorTestControlParas.StartContext(input.HZ, input.OperatingMode, operatingValue); var paras = new Model.MonitorTestControlParas(); - paras.Type = 1; - paras.Paras = string.Empty; + paras.ControlType = Model.MonitorTestControlParas.eControlType.Start; + paras.Context = context.ToJson(); var runQueue = new RabbitMqExChangeHelper(); runQueue.Push("NTTEST", paras); @@ -40,17 +58,23 @@ /// </summary> [Route("TestStop@V1.0")] [HttpPost] - public string TestStop() + public string TestStop([Required] NTStopInput input) { + if (input.Password != Settings.Operating.NT.Password) + { + throw Oops.Oh("瀵嗙爜閿欒!"); + } var paras = new Model.MonitorTestControlParas(); - paras.Type = 0; - paras.Paras = string.Empty; + paras.ControlType = Model.MonitorTestControlParas.eControlType.Stop; + paras.Context = string.Empty; var runQueue = new RabbitMqExChangeHelper(); runQueue.Push("NTTEST", paras); return "OK"; } + +/* /// <summary> /// 娴嬭瘯鍙橀 /// </summary> @@ -59,14 +83,14 @@ public string TestChange(NTTestChangeInput input) { var paras = new Model.MonitorTestControlParas(); - paras.Type = -1; - paras.Paras = input.HZ.ToString(); + paras.ControlType = -1; + paras.Context = input.HZ.ToString(); var runQueue = new RabbitMqExChangeHelper(); runQueue.Push("NTTEST", paras); return "OK"; } - +*/ -- Gitblit v1.9.3