From 2634f62bb6f818717c4dabc80e5b511f95f3cafa Mon Sep 17 00:00:00 2001 From: lxw Date: Sat, 28 Sep 2024 17:00:17 +0800 Subject: [PATCH] =?UTF-8?q?=E8=87=AA=E5=8A=A8=E5=85=85=E7=94=B5=E7=AD=96?= =?UTF-8?q?=E7=95=A5=E6=B7=BB=E5=8A=A0=E5=8C=BA=E9=97=B4=E7=94=B5=E6=B1=A0?= =?UTF-8?q?=20=E4=B8=BB=E5=8A=A8=E5=81=9C=E6=AD=A2=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Service/Charger/MyTask/AutoChargeTask.cs | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) 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 &&