功率赋值

master
tq 6 months ago
parent aadf4317dc
commit a7c8b103a6

@ -0,0 +1,167 @@
namespace Entity.Dto.Resp;
public partial class BinInfoResp
{
public BinInfoResp()
{
}
/// <summary>
/// Desc:id
/// Default:
/// Nullable:False
/// </summary>
public int Id { get; set; }
/// <summary>
/// Desc:仓位编号
/// Default:
/// Nullable:True
/// </summary>
public string No { get; set; }
/// <summary>
/// Desc:仓位编码
/// Default:
/// Nullable:True
/// </summary>
public string Code { get; set; }
/// <summary>
/// Desc:仓位名称
/// Default:
/// Nullable:True
/// </summary>
public string Name { get; set; }
/// <summary>
/// Desc:电池编号
/// Default:
/// Nullable:True
/// </summary>
public string BatteryNo { get; set; }
/// <summary>
/// Desc:充电机编号
/// Default:
/// Nullable:True
/// </summary>
public string ChargerNo { get; set; }
/// <summary>
/// Desc:充电枪编号
/// Default:
/// Nullable:True
/// </summary>
public string ChargerGunNo { get; set; }
/// <summary>
/// Desc:水冷编号
/// Default:
/// Nullable:True
/// </summary>
public string WaterCoolNo { get; set; }
/// <summary>
/// Desc:是否有电插头;0-无电插头1-有电插头
/// Default:
/// Nullable:True
/// </summary>
public int? ElecPluginFlag { get; set; }
/// <summary>
/// Desc:电插头状态;0-未知1-已经连接2-未连接
/// Default:
/// Nullable:True
/// </summary>
public string ElecPluginStatus { get; set; }
/// <summary>
/// Desc:是否有水插头;0-无水插头1-有水插头
/// Default:
/// Nullable:False
/// </summary>
public string WaterPluginFlag { get; set; }
/// <summary>
/// Desc:预约锁定;0-未锁定1-锁定
/// Default:
/// Nullable:True
/// </summary>
public string AmtLock { get; set; }
/// <summary>
/// Desc:soc
/// Default:
/// Nullable:True
/// </summary>
public decimal? Soc { get; set; }
/// <summary>
/// Desc:soe
/// Default:
/// Nullable:True
/// </summary>
public decimal? Soe { get; set; }
/// <summary>
/// Desc:soh
/// Default:
/// Nullable:True
/// </summary>
public decimal? Soh { get; set; }
/// <summary>
/// Desc:电池入仓顺序
/// Default:
/// Nullable:True
/// </summary>
public int? BatteryEnterSeq { get; set; }
/// <summary>
/// Desc:充电状态;0-未知1-正在充电2-无电池3-禁用4-充电停止
/// Default:0
/// Nullable:True
/// </summary>
public int? ChargeStatus { get; set; }
/// <summary>
/// Desc:仓位状态;0-禁用1-启用
/// Default:1
/// Nullable:True
/// </summary>
public int? Status { get; set; }
/// <summary>
/// Desc:创建人
/// Default:
/// Nullable:True
/// </summary>
public string CreatedBy { get; set; }
/// <summary>
/// Desc:创建时间
/// Default:CURRENT_TIMESTAMP
/// Nullable:True
/// </summary>
public DateTime? CreatedTime { get; set; }
/// <summary>
/// Desc:更新人
/// Default:
/// Nullable:True
/// </summary>
public string UpdatedBy { get; set; }
/// <summary>
/// Desc:更新时间
/// Default:CURRENT_TIMESTAMP
/// Nullable:True
/// </summary>
public DateTime? UpdatedTime { get; set; }
/// <summary>
/// 功率
/// </summary>
public float power { get; set; }
}

@ -1,4 +1,6 @@
using Entity.DbModel.Station;
using AutoMapper;
using Entity.DbModel.Station;
using Entity.Dto.Resp;
using HybirdFrameworkCore.Entity;
using Microsoft.AspNetCore.Mvc;
using Repository.Station;
@ -32,9 +34,25 @@ public class ChargeController : ControllerBase
/// <returns>仓位信息列表</returns>
[HttpGet]
[Route("/api/ChrgMonitor/GetChargMonitorChargBinData")]
public Result<List<BinInfo>> GetChargMonitorChargBinData()
public Result<List<BinInfoResp>> GetChargMonitorChargBinData()
{
return Result<List<BinInfo>>.Success(_binInfoRepository.Query());
List<BinInfo> binInfos = _binInfoRepository.Query();
var configuration = new MapperConfiguration(cfg => cfg.CreateMap<BinInfo, BinInfoResp>());
var mapper = configuration.CreateMapper();
// 转换为 BinInfoResp 列表
List<BinInfoResp> binInfoList = mapper.Map<List<BinInfoResp>>(binInfos);
// 功率赋值
foreach (var binInfoResp in binInfoList)
{
ChargerClient? chargerClient = ClientMgr.GetBySn(binInfoResp.Code);
if (chargerClient != null)
{
binInfoResp.power = chargerClient.RealTimeChargePower;
}
}
return Result<List<BinInfoResp>>.Success(binInfoList);
}
/// <summary>

Loading…
Cancel
Save