| | |
| | | using Furion.DynamicApiController; |
| | | using System.ComponentModel.DataAnnotations; |
| | | using Mapster; |
| | | |
| | | using Furion.FriendlyException; |
| | | |
| | | namespace IStation.Application |
| | | { |
| | |
| | | [ApiDescriptionSettings("Monitor", Name = "监测南通控制", Order = 400)] |
| | | public class MonitorControlNT_Controller : IDynamicApiController |
| | | { |
| | | |
| | | /// <summary> |
| | | /// 测试启动 |
| | | /// </summary> |
| | | [Route("TestStart@V1.0")] |
| | | [HttpPost] |
| | | public bool TestStart() |
| | | public string TestStart([Required] NTStartInput input) |
| | | { |
| | | return true; |
| | | 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.ControlType = Model.MonitorTestControlParas.eControlType.Start; |
| | | paras.Context = context.ToJson(); |
| | | |
| | | var runQueue = new RabbitMqExChangeHelper(); |
| | | runQueue.Push("NTTEST", paras); |
| | | return "OK"; |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | /// </summary> |
| | | [Route("TestStop@V1.0")] |
| | | [HttpPost] |
| | | public bool TestStop() |
| | | public string TestStop([Required] NTStopInput input) |
| | | { |
| | | return true; |
| | | if (input.Password != Settings.Operating.NT.Password) |
| | | { |
| | | throw Oops.Oh("密码错误!"); |
| | | } |
| | | var paras = new Model.MonitorTestControlParas(); |
| | | paras.ControlType = Model.MonitorTestControlParas.eControlType.Stop; |
| | | paras.Context = string.Empty; |
| | | |
| | | var runQueue = new RabbitMqExChangeHelper(); |
| | | runQueue.Push("NTTEST", paras); |
| | | return "OK"; |
| | | } |
| | | |
| | | |
| | | /* |
| | | /// <summary> |
| | | /// 测试变频 |
| | | /// </summary> |
| | | [Route("TestChange@V1.0")] |
| | | [HttpPost] |
| | | public bool TestChange(NTTestChangeInput input) |
| | | public string TestChange(NTTestChangeInput input) |
| | | { |
| | | return true; |
| | | } |
| | | var paras = new Model.MonitorTestControlParas(); |
| | | paras.ControlType = -1; |
| | | paras.Context = input.HZ.ToString(); |
| | | |
| | | var runQueue = new RabbitMqExChangeHelper(); |
| | | runQueue.Push("NTTEST", paras); |
| | | return "OK"; |
| | | } |
| | | */ |
| | | |
| | | |
| | | |