温州现场测试,电表和温湿度接口

zw
CZ 4 months ago
parent 528d0468f1
commit ba05e02013

@ -0,0 +1,14 @@
namespace Entity.Api.Resp;
public class TemperatureHumidityResp
{
/// <summary>
/// 温度
/// </summary>
public float Temperature { get; set; }
/// <summary>
/// 湿度
/// </summary>
public float Humidity { get; set; }
}

@ -36,10 +36,12 @@ public class FireControlClient: ModbusTcpMaster
#region 电表 #region 电表
var readPowerValue = master.Read("x=3;39424", 4).Content; var readPowerValue = master.Read("x=3;39424", 2).Content;
if (readPowerValue != null) if (readPowerValue != null)
{ {
ModbusDecoder.Decode<PowerValue>(readPowerValue, FireControlMgr.PowerValue, EndingConst.ByteSeq.AB, EndingConst.WordSeq.DC); Array.Reverse(readPowerValue);
//ModbusDecoder.Decode<PowerValue>(readPowerValue, FireControlMgr.PowerValue, EndingConst.ByteSeq.BA, EndingConst.WordSeq.DC);
FireControlMgr.PowerValue.FPowerValue.Value=BitConverter.ToSingle(readPowerValue, 0);
} }
#endregion #endregion

@ -4,7 +4,9 @@ using Entity.Ammeter;
using Entity.Api.Resp; using Entity.Api.Resp;
using HybirdFrameworkCore.Entity; using HybirdFrameworkCore.Entity;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using OfficeOpenXml.FormulaParsing.Excel.Functions.Text;
using Service.Ammeter; using Service.Ammeter;
using Service.FireControl.Client;
using Service.Station; using Service.Station;
namespace WebStarter.Controllers.Ammeter namespace WebStarter.Controllers.Ammeter
@ -274,6 +276,17 @@ namespace WebStarter.Controllers.Ammeter
await QueryParameterTime(resp, endTime); 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<EmeterEnergyResp>.Success(resp, "成功"); return Result<EmeterEnergyResp>.Success(resp, "成功");
} }

@ -273,4 +273,13 @@ public class FireControlController
return Result<FireResp>.Success(FireResp); return Result<FireResp>.Success(FireResp);
} }
[HttpGet("TemperatureHumidityResp")]
public Result<TemperatureHumidityResp> TemperatureHumidityResp()
{
TemperatureHumidityResp TemperatureHumidity = new TemperatureHumidityResp();
TemperatureHumidity.Temperature = FireControlMgr.Temperature;
TemperatureHumidity.Humidity = FireControlMgr.Humidity;
return Result<TemperatureHumidityResp>.Success(TemperatureHumidity);
}
} }
Loading…
Cancel
Save