自动充电开关

master
rszn 6 months ago
parent d5d847064a
commit eeaf4c48da

@ -1,7 +1,9 @@
using Entity.DbModel.Station; using Common.Const;
using Entity.DbModel.Station;
using HybirdFrameworkCore.Autofac.Attribute; using HybirdFrameworkCore.Autofac.Attribute;
using HybirdFrameworkCore.Entity;
using HybirdFrameworkCore.AutoTask; using HybirdFrameworkCore.AutoTask;
using HybirdFrameworkCore.Entity;
using HybirdFrameworkCore.Utils;
using log4net; using log4net;
using Repository.Station; using Repository.Station;
using Service.Charger.Client; using Service.Charger.Client;
@ -20,6 +22,7 @@ public class AutoChargeTask : ITask
public BatteryOpModelRepository batteryOpModelRepository { get; set; } public BatteryOpModelRepository batteryOpModelRepository { get; set; }
public BatteryOpModelDetailRepository batteryOpModelDetailRepository { get; set; } public BatteryOpModelDetailRepository batteryOpModelDetailRepository { get; set; }
public BinInfoRepository binInfoRepository { get; set; } public BinInfoRepository binInfoRepository { get; set; }
public EquipInfoRepository EquipInfoRepository { get; set; }
public string Name() public string Name()
{ {
@ -37,11 +40,6 @@ public class AutoChargeTask : ITask
{ {
DateTime now = DateTime.Now; DateTime now = DateTime.Now;
if (StaticStationInfo.AutoChargeEnabled != 1)
{
Log.Info("AutoChargeEnabled = 0 continue");
return;
}
List<BinInfo> binInfos = binInfoRepository.Query(); List<BinInfo> binInfos = binInfoRepository.Query();
if (binInfos.Count < 0) if (binInfos.Count < 0)
@ -50,6 +48,17 @@ public class AutoChargeTask : ITask
return; return;
} }
List<EquipInfo> chargerList = EquipInfoRepository.QueryListByClause(it => it.TypeCode == (int)EquipmentType.Charger);
HashSet<string> 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 电价模型 #region 电价模型

Loading…
Cancel
Save