站外优化

master
tq 5 months ago
parent 8059e6ec4e
commit 473d409ec4

@ -25,7 +25,6 @@ using Service.Cloud.Msg.Cloud.Resp;
using Service.Cloud.Msg.Cloud.Resp.OutCharger;
using Service.Cloud.Msg.Host.Req;
using Service.Cloud.Msg.Host.Req.OutCharger;
using Service.Cloud.Msg.Host.Resp.OutCharger;
namespace Service.Cloud.Client;
@ -95,6 +94,7 @@ public class CloudClient : IMqttClientConnectedHandler, IMqttApplicationMessageR
public MsgPair<PileEndCharge, PileEndChargeResp> PileEndCharge { get; set; } = new();
public MsgPair<PileChargeRealtime, PileChargeRealtimeResp> PileChargeRealtime { get; set; } = new();
public MsgPair<PileRealtime, PileRealtimeResp> PileRealtime { get; set; } = new();
#endregion
@ -527,6 +527,13 @@ public class CloudClient : IMqttClientConnectedHandler, IMqttApplicationMessageR
this.Publish(req);
return PileChargeRealtime.GetResp(timeSpan);
}
public PileRealtimeResp? SendPileRealtime(PileRealtime req, TimeSpan? timeSpan = null)
{
this.PileRealtime.Req = req;
this.Publish(req);
return PileRealtime.GetResp(timeSpan);
}
#endregion
#region business func

@ -75,6 +75,8 @@ public class CloudConst
public static readonly string pileChargeRealtime = "pileChargeRealtime";
public static readonly string pileChargeRealtimeRes = "pileChargeRealtimeRes";
public static readonly string pileRealtime = "pileRealtime";
#endregion
}

@ -20,7 +20,7 @@ public class PileStopChargeHandler : IBaseHandler
PileStopCharge? pileStopCharge = JsonConvert.DeserializeObject<PileStopCharge>(t);
if (pileStopCharge != null)
{
HttpUtil.SendPostRequest(pileStopCharge, "http://127.0.0.1:5035/api/OutCharger/SendStartOutCharger");
HttpUtil.SendPostRequest(pileStopCharge, "http://127.0.0.1:5035/api/OutCharger/SendStopOutCharger");
}
}
}

@ -1,6 +1,6 @@
using Service.Cloud.Common;
namespace Service.Cloud.Msg.Host.Resp.OutCharger;
namespace Service.Cloud.Msg.Cloud.Resp.OutCharger;
/// <summary>
/// 9.2.1.6 云端响应充电枪充电遥测数据

@ -0,0 +1,25 @@
using Service.Cloud.Common;
namespace Service.Cloud.Msg.Cloud.Resp.OutCharger;
/// <summary>
/// 9.2.1.6 云端响应充电枪实时数据
/// </summary>
public class PileRealtimeResp : ICmd
{
/// <summary>
/// 执行结果
/// </summary>
public string rs { get; set; }
/// <summary>
/// 充电枪编号
/// </summary>
public string pn { get; set; }
public string GetCmd()
{
return CloudConst.pileRealtimeRes;
}
}

@ -0,0 +1,53 @@
using Service.Cloud.Common;
namespace Service.Cloud.Msg.Host.Req.OutCharger;
/// <summary>
/// 9.2.1.5 站控上报充电枪实时数据上报
/// </summary>
public class PileRealtime : ICmd
{
/// <summary>
/// 换电站编码
/// </summary>
public string sn { get; set; }
/// <summary>
/// Desc:充电枪编号
/// Default:
/// Nullable:True
/// </summary>
public string? pn { get; set; }
/// <summary>
/// 充电枪状态
/// </summary>
public int ps { get; set; }
/// <summary>
/// 插枪状态
/// </summary>
public int con { get; set; }
/// <summary>
/// 单枪输出电压
/// </summary>
public float pov { get; set; }
/// <summary>
/// 单枪输出电流
/// </summary>
public float poe { get; set; }
/// <summary>
/// 单枪故障代码
/// </summary>
public int ec { get; set; }
public string GetCmd()
{
return CloudConst.pileRealtime;
}
}

@ -174,4 +174,14 @@ public abstract class CloudApi
CloudClientMgr.CloudClient?.SendPileChargeRealtime(req,
global::System.TimeSpan.FromSeconds(TimeSpan));
}
/// <summary>
/// 9.2.1.5 站控上报充电枪实时数据上报
/// </summary>
/// <param name="req"></param>
public static void SendPileRealtime(PileRealtime req)
{
CloudClientMgr.CloudClient?.SendPileRealtime(req,
global::System.TimeSpan.FromSeconds(TimeSpan));
}
}

@ -68,4 +68,17 @@ public class OutChargerController
return Result<bool>.Success(true);
}
/// <summary>
/// 9.2.1.5 站控上报充电枪实时数据上报
/// </summary>
/// <param name="req"></param>
/// <returns></returns>
[HttpPost]
[Route("SendPileRealtime")]
public Result<bool> SendPileRealtime([FromBody] PileRealtime req)
{
CloudApi.SendPileRealtime(req);
return Result<bool>.Success(true);
}
}
Loading…
Cancel
Save