diff --git a/Service/Cloud/Client/CloudClient.cs b/Service/Cloud/Client/CloudClient.cs index da49f64..2ee592b 100644 --- a/Service/Cloud/Client/CloudClient.cs +++ b/Service/Cloud/Client/CloudClient.cs @@ -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 { get; set; } = new(); public MsgPair PileChargeRealtime { get; set; } = new(); + public MsgPair 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 diff --git a/Service/Cloud/Common/CloudConst.cs b/Service/Cloud/Common/CloudConst.cs index 016a6b9..47194b8 100644 --- a/Service/Cloud/Common/CloudConst.cs +++ b/Service/Cloud/Common/CloudConst.cs @@ -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 } \ No newline at end of file diff --git a/Service/Cloud/Handler/OutCharger/PileStopChargeHandler.cs b/Service/Cloud/Handler/OutCharger/PileStopChargeHandler.cs index 5e81cc8..01cda9c 100644 --- a/Service/Cloud/Handler/OutCharger/PileStopChargeHandler.cs +++ b/Service/Cloud/Handler/OutCharger/PileStopChargeHandler.cs @@ -20,7 +20,7 @@ public class PileStopChargeHandler : IBaseHandler PileStopCharge? pileStopCharge = JsonConvert.DeserializeObject(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"); } } } \ No newline at end of file diff --git a/Service/Cloud/Msg/Host/Resp/OutCharger/PileChargeRealtimeResp.cs b/Service/Cloud/Msg/Cloud/Resp/OutCharger/PileChargeRealtimeResp.cs similarity index 89% rename from Service/Cloud/Msg/Host/Resp/OutCharger/PileChargeRealtimeResp.cs rename to Service/Cloud/Msg/Cloud/Resp/OutCharger/PileChargeRealtimeResp.cs index e34d8f4..789cbd8 100644 --- a/Service/Cloud/Msg/Host/Resp/OutCharger/PileChargeRealtimeResp.cs +++ b/Service/Cloud/Msg/Cloud/Resp/OutCharger/PileChargeRealtimeResp.cs @@ -1,6 +1,6 @@ using Service.Cloud.Common; -namespace Service.Cloud.Msg.Host.Resp.OutCharger; +namespace Service.Cloud.Msg.Cloud.Resp.OutCharger; /// /// 9.2.1.6 云端响应充电枪充电遥测数据 diff --git a/Service/Cloud/Msg/Cloud/Resp/OutCharger/PileRealtimeResp.cs b/Service/Cloud/Msg/Cloud/Resp/OutCharger/PileRealtimeResp.cs new file mode 100644 index 0000000..254c83a --- /dev/null +++ b/Service/Cloud/Msg/Cloud/Resp/OutCharger/PileRealtimeResp.cs @@ -0,0 +1,25 @@ +using Service.Cloud.Common; + +namespace Service.Cloud.Msg.Cloud.Resp.OutCharger; + +/// +/// 9.2.1.6 云端响应充电枪实时数据 +/// +public class PileRealtimeResp : ICmd +{ + /// + /// 执行结果 + /// + public string rs { get; set; } + + + /// + /// 充电枪编号 + /// + public string pn { get; set; } + + public string GetCmd() + { + return CloudConst.pileRealtimeRes; + } +} \ No newline at end of file diff --git a/Service/Cloud/Msg/Host/Req/OutCharger/PileRealtime.cs b/Service/Cloud/Msg/Host/Req/OutCharger/PileRealtime.cs new file mode 100644 index 0000000..cb4adc7 --- /dev/null +++ b/Service/Cloud/Msg/Host/Req/OutCharger/PileRealtime.cs @@ -0,0 +1,53 @@ +using Service.Cloud.Common; + +namespace Service.Cloud.Msg.Host.Req.OutCharger; + +/// +/// 9.2.1.5 站控上报充电枪实时数据上报 +/// +public class PileRealtime : ICmd +{ + /// + /// 换电站编码 + /// + public string sn { get; set; } + + + /// + /// Desc:充电枪编号 + /// Default: + /// Nullable:True + /// + public string? pn { get; set; } + + /// + /// 充电枪状态 + /// + public int ps { get; set; } + + /// + /// 插枪状态 + /// + public int con { get; set; } + + + /// + /// 单枪输出电压 + /// + public float pov { get; set; } + + /// + /// 单枪输出电流 + /// + public float poe { get; set; } + + /// + /// 单枪故障代码 + /// + public int ec { get; set; } + + public string GetCmd() + { + return CloudConst.pileRealtime; + } +} \ No newline at end of file diff --git a/Service/Execute/Api/CloudApi.cs b/Service/Execute/Api/CloudApi.cs index 6965135..045bccf 100644 --- a/Service/Execute/Api/CloudApi.cs +++ b/Service/Execute/Api/CloudApi.cs @@ -174,4 +174,14 @@ public abstract class CloudApi CloudClientMgr.CloudClient?.SendPileChargeRealtime(req, global::System.TimeSpan.FromSeconds(TimeSpan)); } + + /// + /// 9.2.1.5 站控上报充电枪实时数据上报 + /// + /// + public static void SendPileRealtime(PileRealtime req) + { + CloudClientMgr.CloudClient?.SendPileRealtime(req, + global::System.TimeSpan.FromSeconds(TimeSpan)); + } } \ No newline at end of file diff --git a/WebStarter/Controllers/OutChargerController.cs b/WebStarter/Controllers/OutChargerController.cs index 347f2d8..7593aee 100644 --- a/WebStarter/Controllers/OutChargerController.cs +++ b/WebStarter/Controllers/OutChargerController.cs @@ -68,4 +68,17 @@ public class OutChargerController return Result.Success(true); } + + /// + /// 9.2.1.5 站控上报充电枪实时数据上报 + /// + /// + /// + [HttpPost] + [Route("SendPileRealtime")] + public Result SendPileRealtime([FromBody] PileRealtime req) + { + CloudApi.SendPileRealtime(req); + return Result.Success(true); + } } \ No newline at end of file