diff --git a/Entity/Dto/Resp/HumitureResp.cs b/Entity/Dto/Resp/HumitureResp.cs new file mode 100644 index 0000000..172675a --- /dev/null +++ b/Entity/Dto/Resp/HumitureResp.cs @@ -0,0 +1,77 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Entity.Dto.Resp +{ + public class HumitureResp + { + + /// + /// 湿度 + /// + public short Humidness { get; set; } + /// + /// 温度 + /// + public short Temperature { get; set; } + /// + /// 设备型号 + /// + public short EquipmentType { get; set; } + /// + /// 版本号(低 8 位) + /// + public short VersionNumber { get; set; } + /// + /// 设备 ID 高 16 位 + /// + public short DeviceIdHigh { get; set; } + /// + /// 设备 ID 低 16 位 + /// + public short DeviceIdLower { get; set; } + /// + /// 温度上限报警值 + /// + public short UpperTemperatureAlarm { get; set; } + /// + /// 温度上限报警使能 + /// + public short UpperTemperatureAlarmEnabled { get; set; } + /// + /// 温度下限报警值 + /// + public short LowerTemperatureAlarm { get; set; } + /// + /// 温度下限报警使能 + /// + public short LowerTemperatureAlarmEnabled { get; set; } + /// + /// 湿度上限报警值 + /// + public short HumidityUpperAlarm { get; set; } + /// + /// 湿度上限报警使能 + /// + public short HumidityUpperAlarmEnabled { get; set; } + /// + /// 湿度下限报警值 + /// + public short HumidityLowerLimitAlarm { get; set; } + /// + /// 湿度下限报警使能 + /// + public short HumidityLowerLimitAlarmEnabled { get; set; } + /// + /// 温度校正值更新 + /// + public short TemperatureUpdated { get; set; } + /// + /// 湿度校正值更新 + /// + public short HumidityValueUpdated { get; set; } + } +} diff --git a/Entity/Entity.csproj b/Entity/Entity.csproj index f1a99d1..e7442a3 100644 --- a/Entity/Entity.csproj +++ b/Entity/Entity.csproj @@ -15,7 +15,7 @@ - + diff --git a/WebStarter/Controllers/HumitureController.cs b/WebStarter/Controllers/HumitureController.cs new file mode 100644 index 0000000..70594a6 --- /dev/null +++ b/WebStarter/Controllers/HumitureController.cs @@ -0,0 +1,65 @@ + +using Entity.Dto.Resp; +using HybirdFrameworkDriver.Session; +using log4net; +using Microsoft.AspNetCore.Mvc; +using Newtonsoft.Json; +using Service.Api.Resp; +using Service.Car.Msg.Car.Req; +using Service.Car.Msg.Host.Req; +using Service.Car.Server; +using Service.Humiture; +using Service.Humiture.Client; +using Service.TBox.Service; +using WebStarter.Dto.Req; + +namespace WebStarter.Controllers; + +/// +/// 温湿度 +/// +[ApiController] +[Route("[controller]")] +public class HumitureController : ControllerBase +{ + private static readonly ILog Log = LogManager.GetLogger(typeof(HumitureController)); + + + + /// + /// 获取温湿度 + /// + /// + [HttpGet("GetHumiture")] + public HumitureResp GetHumiture() + { + HumitureResp humitureResp = new HumitureResp(); + if (HumiturePlcMgr.HumitureMsg!=null) + { + humitureResp = new HumitureResp() + { + Humidness = HumiturePlcMgr.HumitureMsg.Humidness.Value, + Temperature = HumiturePlcMgr.HumitureMsg.Temperature.Value, + EquipmentType = HumiturePlcMgr.HumitureMsg.EquipmentType.Value, + VersionNumber = HumiturePlcMgr.HumitureMsg.VersionNumber.Value, + DeviceIdHigh = HumiturePlcMgr.HumitureMsg.DeviceIdHigh.Value, + DeviceIdLower = HumiturePlcMgr.HumitureMsg.DeviceIdLower.Value, + UpperTemperatureAlarm = HumiturePlcMgr.HumitureMsg.UpperTemperatureAlarm.Value, + UpperTemperatureAlarmEnabled = HumiturePlcMgr.HumitureMsg.UpperTemperatureAlarmEnabled.Value, + LowerTemperatureAlarm = HumiturePlcMgr.HumitureMsg.LowerTemperatureAlarm.Value, + LowerTemperatureAlarmEnabled = HumiturePlcMgr.HumitureMsg.LowerTemperatureAlarmEnabled.Value, + HumidityUpperAlarm = HumiturePlcMgr.HumitureMsg.HumidityUpperAlarm.Value, + HumidityUpperAlarmEnabled = HumiturePlcMgr.HumitureMsg.HumidityUpperAlarmEnabled.Value, + HumidityLowerLimitAlarm = HumiturePlcMgr.HumitureMsg.HumidityLowerLimitAlarm.Value, + HumidityLowerLimitAlarmEnabled = HumiturePlcMgr.HumitureMsg.HumidityLowerLimitAlarmEnabled.Value, + TemperatureUpdated = HumiturePlcMgr.HumitureMsg.TemperatureUpdated.Value, + HumidityValueUpdated = HumiturePlcMgr.HumitureMsg.HumidityValueUpdated.Value, + + }; + } + + return humitureResp; + } + + +} \ No newline at end of file diff --git a/WebStarter/appsettings.dev.json b/WebStarter/appsettings.dev.json index e7c8040..7d90f6c 100644 --- a/WebStarter/appsettings.dev.json +++ b/WebStarter/appsettings.dev.json @@ -2,7 +2,7 @@ "ConnectionStrings": { "ConfigId": "master", "DbType": "MySql", - "SqlConnection": "server=192.168.2.2;Port=3306;Database=huanneng_dev;Uid=root;Pwd=Rszn123;Charset=utf8;" + "SqlConnection": "server=180.76.133.253;Port=3306;Database=huanneng_dev;Uid=root;Pwd=Rszn123;Charset=utf8;" }, "Update": { "AutoUpdate": "false",