diff --git a/Service/Charger/MyTask/AutoChargeTask.cs b/Service/Charger/MyTask/AutoChargeTask.cs index b1be357..4791002 100644 --- a/Service/Charger/MyTask/AutoChargeTask.cs +++ b/Service/Charger/MyTask/AutoChargeTask.cs @@ -55,7 +55,7 @@ public class AutoChargeTask : ITask chargerList.Where(it => it.AutoCharge == 1).Select(it => it.Code).ToHashSet(); - var binInfos = allBinInfos.Where(it => autoChargeSet.Contains(it.ChargerNo)).ToList(); + var binInfos = allBinInfos.Where(it => autoChargeSet.Contains(it.ChargerNo)).ToList(); if (ObjUtils.IsEmpty(binInfos)) { @@ -153,10 +153,9 @@ public class AutoChargeTask : ITask List chargingList = binInfos.Where(it => it.ChargeStatus == 1).ToList(); if (canSwapList.Count >= needBatteryCount) { - int needStopCount = chargingList.Count - (canSwapList.Count - needBatteryCount); //if (needStopCount > 0) - if(chargingList.Count>0) + if (chargingList.Count > 0) { //停电量低的 chargingList.Sort((a, b) => (a.Soc ?? 0).CompareTo(b.Soc ?? 0)); @@ -171,7 +170,7 @@ public class AutoChargeTask : ITask { List canChargeList = binInfos.Where(it => it.Soc != null && Convert.ToSingle(it.Soc) < StaticStationInfo.ChargeSoc && - it.CanChargeFlag == 1&&it.Exists==1) + it.CanChargeFlag == 1 && it.Exists == 1) .ToList(); //启动电量高的 canChargeList.Sort((a, b) => (b.Soc ?? 0).CompareTo(a.Soc ?? 0)); @@ -200,14 +199,15 @@ public class AutoChargeTask : ITask } #region 达到充电SOC自动停 - + foreach (var VARIABLE in chargingList) { - if (VARIABLE.Soc >= StaticStationInfo.ChargeSoc) - { - Log.Info($"auto stop charge {VARIABLE.No} soc>=chaegeSoc"); - ClientMgr.GetBySn(VARIABLE.No)?.SendRemoteStopCharging(); - } + if (StaticStationInfo.ChargeSoc != 100) + if (VARIABLE.Soc >= StaticStationInfo.ChargeSoc + 1) + { + Log.Info($"auto stop charge {VARIABLE.No} soc>=chaegeSoc"); + ClientMgr.GetBySn(VARIABLE.No)?.SendRemoteStopCharging(); + } } #endregion