From 355ef6b8d7fc003af88d62bfd87b1061151a012a Mon Sep 17 00:00:00 2001 From: CZ Date: Thu, 27 Jun 2024 10:28:03 +0800 Subject: [PATCH] =?UTF-8?q?=E7=8E=B0=E5=9C=BA=E4=BF=AE=E6=AD=A3=EF=BC=9A?= =?UTF-8?q?=E9=98=B2=E6=AD=A2=E9=87=8D=E5=A4=8D=E5=8F=91=E5=90=AF=E5=8A=A8?= =?UTF-8?q?=E5=85=85=E7=94=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Service/Charger/MyTask/AutoChargeTask.cs | 37 +++++++++++++----------- 1 file changed, 20 insertions(+), 17 deletions(-) diff --git a/Service/Charger/MyTask/AutoChargeTask.cs b/Service/Charger/MyTask/AutoChargeTask.cs index c4b8f2c..488b17c 100644 --- a/Service/Charger/MyTask/AutoChargeTask.cs +++ b/Service/Charger/MyTask/AutoChargeTask.cs @@ -182,18 +182,22 @@ public class AutoChargeTask : ITask { float? chargePower = EquipInfoRepository.QueryPowerByCode(binInfo.ChargerNo); float? power = chargePower == null ? StaticStationInfo.ChargePower : chargePower; - Result? result = ClientMgr.GetBySn(binInfo.ChargerNo) - ?.StartCharge(chargeSoc, (float)power); - if (result is { IsSuccess: true }) + if (binInfo.ChargeStatus != 1) { - Log.Info($"auto start charge {binInfo.ChargerNo}"); - number++; - } - - if (count == number) - { - Log.Info($"auto start charge count {count}"); - break; + //没有充电时候在充电 + Result? result = ClientMgr.GetBySn(binInfo.ChargerNo) + ?.StartCharge(chargeSoc, (float)power); + if (result is { IsSuccess: true }) + { + Log.Info($"auto start charge {binInfo.ChargerNo}"); + number++; + } + + if (count == number) + { + Log.Info($"auto start charge count {count}"); + break; + } } } } @@ -202,12 +206,11 @@ public class AutoChargeTask : ITask foreach (var VARIABLE in chargingList) { - if (StaticStationInfo.ChargeSoc != 100) - if (VARIABLE.Soc >= (StaticStationInfo.ChargeSoc + 1)) - { - Log.Info($"auto stop charge {VARIABLE.No} soc>=chaegeSoc+1 soc:{VARIABLE.Soc}"); - ClientMgr.GetBySn(VARIABLE.No)?.SendRemoteStopCharging(); - } + if (VARIABLE.Soc >= (StaticStationInfo.ChargeSoc + 1)) + { + Log.Info($"auto stop charge {VARIABLE.No} soc>=chaegeSoc+1 soc:{VARIABLE.Soc}"); + ClientMgr.GetBySn(VARIABLE.No)?.SendRemoteStopCharging(); + } } #endregion