From eeaf4c48daad39b5c922395ca9df00dad4b7ddc5 Mon Sep 17 00:00:00 2001 From: rszn <645583145@qq.com> Date: Tue, 4 Jun 2024 20:18:46 +0800 Subject: [PATCH] =?UTF-8?q?=E8=87=AA=E5=8A=A8=E5=85=85=E7=94=B5=E5=BC=80?= =?UTF-8?q?=E5=85=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Service/Charger/MyTask/AutoChargeTask.cs | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/Service/Charger/MyTask/AutoChargeTask.cs b/Service/Charger/MyTask/AutoChargeTask.cs index 176eaf8..77dd525 100644 --- a/Service/Charger/MyTask/AutoChargeTask.cs +++ b/Service/Charger/MyTask/AutoChargeTask.cs @@ -1,7 +1,9 @@ -using Entity.DbModel.Station; +using Common.Const; +using Entity.DbModel.Station; using HybirdFrameworkCore.Autofac.Attribute; -using HybirdFrameworkCore.Entity; using HybirdFrameworkCore.AutoTask; +using HybirdFrameworkCore.Entity; +using HybirdFrameworkCore.Utils; using log4net; using Repository.Station; using Service.Charger.Client; @@ -20,6 +22,7 @@ public class AutoChargeTask : ITask public BatteryOpModelRepository batteryOpModelRepository { get; set; } public BatteryOpModelDetailRepository batteryOpModelDetailRepository { get; set; } public BinInfoRepository binInfoRepository { get; set; } + public EquipInfoRepository EquipInfoRepository { get; set; } public string Name() { @@ -37,11 +40,6 @@ public class AutoChargeTask : ITask { DateTime now = DateTime.Now; - if (StaticStationInfo.AutoChargeEnabled != 1) - { - Log.Info("AutoChargeEnabled = 0 continue"); - return; - } List binInfos = binInfoRepository.Query(); if (binInfos.Count < 0) @@ -50,6 +48,17 @@ public class AutoChargeTask : ITask return; } + List chargerList = EquipInfoRepository.QueryListByClause(it => it.TypeCode == (int)EquipmentType.Charger); + HashSet autoChargeSet = chargerList.Where(it => it.AutoCharge == 1).Select(it => it.Code).ToHashSet(); + + + binInfos = binInfos.Where(it => autoChargeSet.Contains(it.ChargerNo)).ToList(); + + if (ObjUtils.IsEmpty(binInfos)) + { + Log.Info("there is no auto charger"); + return; + } #region 电价模型