From 2346edcd4cafe5753c8b794218a982bc035ae1ba Mon Sep 17 00:00:00 2001 From: smartwyy <645583145@qq.com> Date: Tue, 28 May 2024 20:47:24 +0800 Subject: [PATCH] =?UTF-8?q?=E5=85=85=E7=94=B5=E6=97=A5=E5=BF=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Service/Charger/Client/ChargerClient.cs | 5 +++++ Service/Charger/Common/ChargerUtils.cs | 4 ++-- WebStarter/Controllers/ChargeController.cs | 3 +-- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/Service/Charger/Client/ChargerClient.cs b/Service/Charger/Client/ChargerClient.cs index 2df4680..0e5a4e7 100644 --- a/Service/Charger/Client/ChargerClient.cs +++ b/Service/Charger/Client/ChargerClient.cs @@ -7,6 +7,7 @@ using HybirdFrameworkCore.Redis; using HybirdFrameworkCore.Utils; using HybirdFrameworkDriver.Session; using HybirdFrameworkDriver.TcpClient; +using log4net; using Newtonsoft.Json; using Repository.Station; using Service.Charger.Codec; @@ -27,6 +28,8 @@ namespace Service.Charger.Client; [Scope("InstancePerDependency")] public class ChargerClient : TcpClient { + + private static readonly ILog Log = LogManager.GetLogger(typeof(ChargerClient)); #region 属性 public ushort AuthTimes { get; set; } = 0; @@ -239,6 +242,8 @@ public class ChargerClient : TcpClient chargeOrderNo = ChargerUtils.GenChargeOrderSn(); } + + Log.Info($"SendRemoteStartCharging soc={socLimit}, changePower={changePower}, changePowerCmdType={changePowerCmdType}, chargeOrderNo={chargeOrderNo}"); var remoteStartCharging = new RemoteStartCharging(socLimit, changePowerCmdType, changePower, chargeOrderNo); CurrentCmd = JsonConvert.SerializeObject(remoteStartCharging, Formatting.Indented) + "\r\n" + BitUtls.BytesToHexStr(remoteStartCharging.ToBytes()); diff --git a/Service/Charger/Common/ChargerUtils.cs b/Service/Charger/Common/ChargerUtils.cs index d18e2e3..cecea4e 100644 --- a/Service/Charger/Common/ChargerUtils.cs +++ b/Service/Charger/Common/ChargerUtils.cs @@ -1,5 +1,5 @@ using System.Text; -using Service.Station; +using Service.Init; namespace Service.Charger.Common; @@ -55,7 +55,7 @@ public static class ChargerUtils public static string GenChargeOrderSn() { - return StationParamConst.StationNo + DateTime.Now.ToString(ChargerConst.DateFormat) + + return StaticStationInfo.StationNo + DateTime.Now.ToString(ChargerConst.DateFormat) + GetRandomNumLimit99(); } diff --git a/WebStarter/Controllers/ChargeController.cs b/WebStarter/Controllers/ChargeController.cs index 6092a49..fb4a701 100644 --- a/WebStarter/Controllers/ChargeController.cs +++ b/WebStarter/Controllers/ChargeController.cs @@ -6,7 +6,6 @@ using Microsoft.AspNetCore.Mvc; using Repository.Station; using Service.Charger; using Service.Charger.Client; -using Service.Charger.Msg.Charger.Req; namespace WebStarter.Controllers; @@ -102,6 +101,6 @@ public class ChargeController : ControllerBase [Route("StopChargeByBinNo/{binNo}")] public Result StopChargeByBinNo(string binNo) { - return _chargerService.StartChargeByBinNo(binNo); + return _chargerService.StopChargeByBinNo(binNo); } } \ No newline at end of file