现场,自动充电策略更改

zw
CZ 5 months ago
parent 79cfc5909f
commit 662022ecce

@ -31,7 +31,7 @@ public class AutoChargeTask : ITask
public int Interval() public int Interval()
{ {
return 1000 * 30; return 1000 * 10;
} }
public void Handle() public void Handle()
@ -100,13 +100,24 @@ public class AutoChargeTask : ITask
List<BatteryOpModelDetail> batteryOpModelDetails = List<BatteryOpModelDetail> batteryOpModelDetails =
batteryOpModelDetailRepository.QueryListByClause(d => d.ModelId == oid); batteryOpModelDetailRepository.QueryListByClause(d => d.ModelId == oid);
List<BatteryOpModelDetail> opModelDetails = batteryOpModelDetails.Where(t =>
List<BatteryOpModelDetail> opModelDetails = new List<BatteryOpModelDetail>();
/*List<BatteryOpModelDetail> opModelDetails = batteryOpModelDetails.Where(t =>
{ {
List<int> start = t.StartTime.Split(":").Select(int.Parse).ToList(); List<int> start = t.StartTime.Split(":").Select(int.Parse).ToList();
List<int> end = t.EndTime.Split(":").Select(int.Parse).ToList(); List<int> end = t.EndTime.Split(":").Select(int.Parse).ToList();
return now.Hour >= start[0] && now.Hour < end[0] && now.Minute >= start[1] && now.Minute < end[1] && return now.Hour >= start[0] && now.Hour < end[0] && now.Minute >= start[1] && now.Minute < end[1] &&
now.Second >= start[2] && now.Second < end[2]; now.Second >= start[2] && now.Second < end[2];
}).ToList(); }).ToList();*/
foreach (var VARIABLE in batteryOpModelDetails)
{
if (DateTime.Now >= DateTime.Parse(VARIABLE.StartTime) &&
DateTime.Now <= DateTime.Parse(VARIABLE.EndTime))
{
opModelDetails.Add(VARIABLE);
}
}
if (opModelDetails.Count == 0) if (opModelDetails.Count == 0)
{ {

Loading…
Cancel
Save