From 662022ecce6a5c68100d47614732bc752b9fb403 Mon Sep 17 00:00:00 2001 From: CZ Date: Fri, 21 Jun 2024 10:51:51 +0800 Subject: [PATCH] =?UTF-8?q?=E7=8E=B0=E5=9C=BA=EF=BC=8C=E8=87=AA=E5=8A=A8?= =?UTF-8?q?=E5=85=85=E7=94=B5=E7=AD=96=E7=95=A5=E6=9B=B4=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Service/Charger/MyTask/AutoChargeTask.cs | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) 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) {