diff --git a/Entity/Api/Resp/TemperatureHumidityResp.cs b/Entity/Api/Resp/TemperatureHumidityResp.cs
new file mode 100644
index 0000000..58fd477
--- /dev/null
+++ b/Entity/Api/Resp/TemperatureHumidityResp.cs
@@ -0,0 +1,14 @@
+namespace Entity.Api.Resp;
+
+public class TemperatureHumidityResp
+{
+ ///
+ /// 温度
+ ///
+ public float Temperature { get; set; }
+
+ ///
+ /// 湿度
+ ///
+ public float Humidity { get; set; }
+}
\ No newline at end of file
diff --git a/Service/FireControl/Client/FireControlClient.cs b/Service/FireControl/Client/FireControlClient.cs
index 1abdb51..cdd676a 100644
--- a/Service/FireControl/Client/FireControlClient.cs
+++ b/Service/FireControl/Client/FireControlClient.cs
@@ -36,10 +36,12 @@ public class FireControlClient: ModbusTcpMaster
#region 电表
- var readPowerValue = master.Read("x=3;39424", 4).Content;
+ var readPowerValue = master.Read("x=3;39424", 2).Content;
if (readPowerValue != null)
{
- ModbusDecoder.Decode(readPowerValue, FireControlMgr.PowerValue, EndingConst.ByteSeq.AB, EndingConst.WordSeq.DC);
+ Array.Reverse(readPowerValue);
+ //ModbusDecoder.Decode(readPowerValue, FireControlMgr.PowerValue, EndingConst.ByteSeq.BA, EndingConst.WordSeq.DC);
+ FireControlMgr.PowerValue.FPowerValue.Value=BitConverter.ToSingle(readPowerValue, 0);
}
#endregion
diff --git a/WebStarter/Controllers/Ammeter/AmmeterController.cs b/WebStarter/Controllers/Ammeter/AmmeterController.cs
index 9c72066..169be78 100644
--- a/WebStarter/Controllers/Ammeter/AmmeterController.cs
+++ b/WebStarter/Controllers/Ammeter/AmmeterController.cs
@@ -4,7 +4,9 @@ using Entity.Ammeter;
using Entity.Api.Resp;
using HybirdFrameworkCore.Entity;
using Microsoft.AspNetCore.Mvc;
+using OfficeOpenXml.FormulaParsing.Excel.Functions.Text;
using Service.Ammeter;
+using Service.FireControl.Client;
using Service.Station;
namespace WebStarter.Controllers.Ammeter
@@ -274,6 +276,17 @@ namespace WebStarter.Controllers.Ammeter
await QueryParameterTime(resp, endTime);
}
+ if (resp != null)//添加主控柜电表
+ {
+ EmeterResp EmeterResp = new EmeterResp();
+ EmeterResp.Code = "主控柜";
+ EmeterResp.Value = FireControlMgr.Power;
+ EmeterResp.Type = 1;
+ EmeterResp.UploadTime=DateTime.Now;
+
+ resp.emeterEnergyChange.Add(EmeterResp);
+ }
+
return Result.Success(resp, "成功");
}
diff --git a/WebStarter/Controllers/FireControlController.cs b/WebStarter/Controllers/FireControlController.cs
index 4634dfc..65b5d3b 100644
--- a/WebStarter/Controllers/FireControlController.cs
+++ b/WebStarter/Controllers/FireControlController.cs
@@ -273,4 +273,13 @@ public class FireControlController
return Result.Success(FireResp);
}
+
+ [HttpGet("TemperatureHumidityResp")]
+ public Result TemperatureHumidityResp()
+ {
+ TemperatureHumidityResp TemperatureHumidity = new TemperatureHumidityResp();
+ TemperatureHumidity.Temperature = FireControlMgr.Temperature;
+ TemperatureHumidity.Humidity = FireControlMgr.Humidity;
+ return Result.Success(TemperatureHumidity);
+ }
}
\ No newline at end of file