diff --git a/Service/Charger/MyTask/AutoChargeTask.cs b/Service/Charger/MyTask/AutoChargeTask.cs index 6974152..56a7a27 100644 --- a/Service/Charger/MyTask/AutoChargeTask.cs +++ b/Service/Charger/MyTask/AutoChargeTask.cs @@ -153,7 +153,23 @@ public class AutoChargeTask : ITask List chargingList = binInfos.Where(it => it.ChargeStatus == 1).ToList(); Log.Info( $"chargingList={JsonConvert.SerializeObject(chargingList.Select(info => info.Code + "," + info.ChargerNo).ToList())}"); - if (canSwapList.Count <= needBatteryCount) + + #region 现有电池满足需求 停止正在充电的电池 + + + + + if (canSwapList.Count >= needBatteryCount) + { + Log.Info($"can swap count {canSwapList.Count} > {needBatteryCount}, all stop={JsonConvert.SerializeObject(chargingList.Select(info => info.Code + "," + info.ChargerNo).ToList())}"); + foreach (var t in chargingList) + { + Log.Info($"auto stop charge {t.No}"); + ClientMgr.GetBySn(t.ChargerNo)?.SendRemoteStopCharging(); + } + } + #endregion + if (canSwapList.Count < needBatteryCount) { List canChargeList = binInfos.Where(it => it.Soc != null && Convert.ToSingle(it.Soc) < StaticStationInfo.SwapSoc &&