diff --git a/Service/Charger/MyTask/AutoChargeTask.cs b/Service/Charger/MyTask/AutoChargeTask.cs index 7f2fc5d..9bf4e17 100644 --- a/Service/Charger/MyTask/AutoChargeTask.cs +++ b/Service/Charger/MyTask/AutoChargeTask.cs @@ -31,7 +31,7 @@ public class AutoChargeTask : ITask public int Interval() { - return 1000 * 30; + return 1000 * 10; } public void Handle() @@ -100,13 +100,24 @@ public class AutoChargeTask : ITask List batteryOpModelDetails = batteryOpModelDetailRepository.QueryListByClause(d => d.ModelId == oid); - List opModelDetails = batteryOpModelDetails.Where(t => + + List opModelDetails = new List(); + /*List opModelDetails = batteryOpModelDetails.Where(t => { List start = t.StartTime.Split(":").Select(int.Parse).ToList(); List 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] && 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) {