站外优化

master
tq 5 months ago
parent 135e46016e
commit ac9e1caaeb

@ -0,0 +1,38 @@
namespace Entity.Dto.Resp;
/// <summary>
/// 充电桩信息
/// </summary>
public class ChargerPileResp
{
public ChargerPileResp()
{
}
public string Sn { get; set; }
/// <summary>
/// 站外1枪是否充电
/// </summary>
public bool GunChargedOne { get; set; }
/// <summary>
/// 站外2枪是否充电
/// </summary>
public bool GunChargedTwo { get; set; }
/// <summary>
/// 站外1枪是否连接
/// </summary>
public bool ChargedPileOne { get; set; }
/// <summary>
/// 站外2枪是否连接
/// </summary>
public bool ChargedPileTwo { get; set; }
/// <summary>
/// 站外1枪充电功率
/// </summary>
public float? ChargePilePowerOne { get; set; }
/// <summary>
/// 站外2枪充电功率
/// </summary>
public float? ChargePilePowerTwo { get; set; }
}

@ -171,6 +171,11 @@ public class ChargerClient : TcpClient<IBaseHandler, Decoder, Encoder>
/// </summary>
public ConcurrentDictionary<byte, ChargerPile> ChargerPile = new();
/// <summary>
/// 充电桩功率
/// </summary>
public ConcurrentDictionary<byte, float> ChargePilePower = new();
/// <summary>
///充电机实时充电功率
/// </summary>

@ -23,7 +23,7 @@ public class PileUploadTelemetryHandler : SimpleChannelInboundHandler<PileUpload
client.PileUploadTelemetry[msg.Pn] = msg;
client.RealTimeChargePower = msg.HighVoltageAcquisitionCurrent * msg.HighVoltageAcquisitionVoltage;
client.ChargePilePower[msg.Pn] = msg.HighVoltageAcquisitionCurrent * msg.HighVoltageAcquisitionVoltage;
}
}

@ -1,4 +1,5 @@
using HybirdFrameworkCore.Entity;
using Entity.Dto.Resp;
using HybirdFrameworkCore.Entity;
using Microsoft.AspNetCore.Mvc;
using Repository.Station;
using Service.Charger.Client;
@ -125,4 +126,32 @@ public class OutChargerController
return Result<bool>.Fail("充电机未连接");
}
/// <summary>
/// 获取充电桩信息
/// </summary>
/// <returns></returns>
[HttpGet]
[Route("GetChargerPile")]
public Result<List<ChargerPileResp>> GetChargerPile()
{
var chargerClients = ClientMgr.Dictionary;
if (chargerClients.IsEmpty)
{
return Result<List<ChargerPileResp>>.Fail("没有充电机连接");
}
var list = chargerClients.Values.Select(client => new ChargerPileResp
{
Sn = client.Sn,
GunChargedOne = client.GunCharged[1],
GunChargedTwo = client.GunCharged[2],
ChargedPileOne = client.ChargedPile[1],
ChargedPileTwo = client.ChargedPile[2],
ChargePilePowerOne = client.ChargePilePower[1],
ChargePilePowerTwo = client.ChargePilePower[2]
}).ToList();
return Result<List<ChargerPileResp>>.Success(list);
}
}
Loading…
Cancel
Save