You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

87 lines
4.2 KiB

using Entity.Dto.Resp;
4 months ago
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;
/// <summary>
/// 温湿度
/// </summary>
[ApiController]
[Route("api/[controller]")]
4 months ago
public class HumitureController : ControllerBase
{
private static readonly ILog Log = LogManager.GetLogger(typeof(HumitureController));
/// <summary>
/// 获取温湿度
/// </summary>
/// <returns></returns>
[HttpGet("LstGetHumiture")]
public List<HumitureResp> LstGetHumiture()
4 months ago
{
List<HumitureResp> lstLstGetHumiture = new();
if (HumiturePlcMgr.HumitureMsg1 != null)
4 months ago
{
HumitureResp humitureResp = new HumitureResp()
4 months ago
{
Humidness = HumiturePlcMgr.HumitureMsg1.Humidness.Value,
Temperature = HumiturePlcMgr.HumitureMsg1.Temperature.Value,
EquipmentType = HumiturePlcMgr.HumitureMsg1.EquipmentType.Value,
VersionNumber = HumiturePlcMgr.HumitureMsg1.VersionNumber.Value,
DeviceIdHigh = HumiturePlcMgr.HumitureMsg1.DeviceIdHigh.Value,
DeviceIdLower = HumiturePlcMgr.HumitureMsg1.DeviceIdLower.Value,
UpperTemperatureAlarm = HumiturePlcMgr.HumitureMsg1.UpperTemperatureAlarm.Value,
UpperTemperatureAlarmEnabled = HumiturePlcMgr.HumitureMsg1.UpperTemperatureAlarmEnabled.Value,
LowerTemperatureAlarm = HumiturePlcMgr.HumitureMsg1.LowerTemperatureAlarm.Value,
LowerTemperatureAlarmEnabled = HumiturePlcMgr.HumitureMsg1.LowerTemperatureAlarmEnabled.Value,
HumidityUpperAlarm = HumiturePlcMgr.HumitureMsg1.HumidityUpperAlarm.Value,
HumidityUpperAlarmEnabled = HumiturePlcMgr.HumitureMsg1.HumidityUpperAlarmEnabled.Value,
HumidityLowerLimitAlarm = HumiturePlcMgr.HumitureMsg1.HumidityLowerLimitAlarm.Value,
HumidityLowerLimitAlarmEnabled = HumiturePlcMgr.HumitureMsg1.HumidityLowerLimitAlarmEnabled.Value,
TemperatureUpdated = HumiturePlcMgr.HumitureMsg1.TemperatureUpdated.Value,
HumidityValueUpdated = HumiturePlcMgr.HumitureMsg1.HumidityValueUpdated.Value,
sn = "L",
};
lstLstGetHumiture.Add(humitureResp);
}
4 months ago
if (HumiturePlcMgr.HumitureMsg2 != null)
{
HumitureResp humitureResp = new HumitureResp()
{
Humidness = HumiturePlcMgr.HumitureMsg2.Humidness.Value,
Temperature = HumiturePlcMgr.HumitureMsg2.Temperature.Value,
EquipmentType = HumiturePlcMgr.HumitureMsg2.EquipmentType.Value,
VersionNumber = HumiturePlcMgr.HumitureMsg2.VersionNumber.Value,
DeviceIdHigh = HumiturePlcMgr.HumitureMsg2.DeviceIdHigh.Value,
DeviceIdLower = HumiturePlcMgr.HumitureMsg2.DeviceIdLower.Value,
UpperTemperatureAlarm = HumiturePlcMgr.HumitureMsg2.UpperTemperatureAlarm.Value,
UpperTemperatureAlarmEnabled = HumiturePlcMgr.HumitureMsg2.UpperTemperatureAlarmEnabled.Value,
LowerTemperatureAlarm = HumiturePlcMgr.HumitureMsg2.LowerTemperatureAlarm.Value,
LowerTemperatureAlarmEnabled = HumiturePlcMgr.HumitureMsg2.LowerTemperatureAlarmEnabled.Value,
HumidityUpperAlarm = HumiturePlcMgr.HumitureMsg2.HumidityUpperAlarm.Value,
HumidityUpperAlarmEnabled = HumiturePlcMgr.HumitureMsg2.HumidityUpperAlarmEnabled.Value,
HumidityLowerLimitAlarm = HumiturePlcMgr.HumitureMsg2.HumidityLowerLimitAlarm.Value,
HumidityLowerLimitAlarmEnabled = HumiturePlcMgr.HumitureMsg2.HumidityLowerLimitAlarmEnabled.Value,
TemperatureUpdated = HumiturePlcMgr.HumitureMsg2.TemperatureUpdated.Value,
HumidityValueUpdated = HumiturePlcMgr.HumitureMsg2.HumidityValueUpdated.Value,
sn = "R",
4 months ago
};
lstLstGetHumiture.Add(humitureResp);
4 months ago
}
return lstLstGetHumiture;
}
4 months ago
}