Browse Source

拿掉註解 排程

Jessica Tseng 1 year ago
parent
commit
7995ef753f
2 changed files with 17 additions and 24 deletions
  1. 11 18
      EVCB_OCPP.TaskScheduler/Jobs/ResetChargerJob.cs
  2. 6 6
      EVCB_OCPP.TaskScheduler/Program.cs

+ 11 - 18
EVCB_OCPP.TaskScheduler/Jobs/ResetChargerJob.cs

@@ -31,26 +31,19 @@ namespace EVCB_OCPP.TaskScheduler.Jobs
                 using (var dbConn = new SqlConnection(mainDBConnectString))
                 {
                     dbConn.Open();
-                    try
-                    {
-                        var parameters = new DynamicParameters();
-                        parameters.Add("@SerialNo", Guid.NewGuid().ToString(), System.Data.DbType.String);
-                        parameters.Add("@OutAction", "Reset", System.Data.DbType.String);
-                        parameters.Add("@OutRequest", @"{""type"":""Hard""}", System.Data.DbType.String);
-                        parameters.Add("@InMessage", string.Empty, System.Data.DbType.String);
-                        parameters.Add("@CreatedOn", DateTime.UtcNow, System.Data.DbType.DateTime);
-                        parameters.Add("@ReceivedOn", DefaultSetting.DefaultNullTime, System.Data.DbType.DateTime);
-                        parameters.Add("@CreatedBy", "Task", System.Data.DbType.String);
-                        parameters.Add("@ChargeBoxId", charger, System.Data.DbType.String);
-                        parameters.Add("@UpdatedOn", DefaultSetting.DefaultNullTime, System.Data.DbType.DateTime);
+                    var parameters = new DynamicParameters();
+                    parameters.Add("@SerialNo", Guid.NewGuid().ToString(), System.Data.DbType.String);
+                    parameters.Add("@OutAction", "Reset", System.Data.DbType.String);
+                    parameters.Add("@OutRequest", @"{""type"":""Hard""}", System.Data.DbType.String);
+                    parameters.Add("@InMessage", string.Empty, System.Data.DbType.String);
+                    parameters.Add("@CreatedOn", DateTime.UtcNow, System.Data.DbType.DateTime);
+                    parameters.Add("@ReceivedOn", DefaultSetting.DefaultNullTime, System.Data.DbType.DateTime);
+                    parameters.Add("@CreatedBy", "Task", System.Data.DbType.String);
+                    parameters.Add("@ChargeBoxId", charger, System.Data.DbType.String);
+                    parameters.Add("@UpdatedOn", DefaultSetting.DefaultNullTime, System.Data.DbType.DateTime);
 
-                        await dbConn.ExecuteAsync(sqlString, parameters);
-                    }
-                    catch(Exception ex)
-                    {
+                    await dbConn.ExecuteAsync(sqlString, parameters);
 
-                    }
-                   
                 }
             }
 

+ 6 - 6
EVCB_OCPP.TaskScheduler/Program.cs

@@ -117,15 +117,15 @@ namespace EVCB_OCPP.TaskScheduler
                 ITrigger _ResetChargerTrigger = TriggerBuilder.Create()
              .WithIdentity("trigger6", "group1")
              .StartNow()
-             .WithCronSchedule("0 51 18 ? * THU")
+             .WithCronSchedule("0 30 18 ? * THU")
              .Build();
 
                 // Tell quartz to schedule the job using our trigger
-                //await scheduler.ScheduleJob(_CheckEVSEOnlineJob, _CheckEVSEOnlineTrigger);
-                //await scheduler.ScheduleJob(_StartTransacionReportJob, _StartTransacionReportTrigger);
-                //await scheduler.ScheduleJob(_StopTransacionReportJob, _StopTransacionReportTrigger);
-                //await scheduler.ScheduleJob(_CheckExecutionCmdJob, _CheckExecutionCmdTrigger);
-                //await scheduler.ScheduleJob(_ExecutionCmdReportJob, _ExecutionCmdReportTrigger);
+                await scheduler.ScheduleJob(_CheckEVSEOnlineJob, _CheckEVSEOnlineTrigger);
+                await scheduler.ScheduleJob(_StartTransacionReportJob, _StartTransacionReportTrigger);
+                await scheduler.ScheduleJob(_StopTransacionReportJob, _StopTransacionReportTrigger);
+                await scheduler.ScheduleJob(_CheckExecutionCmdJob, _CheckExecutionCmdTrigger);
+                await scheduler.ScheduleJob(_ExecutionCmdReportJob, _ExecutionCmdReportTrigger);
 
                 await scheduler.ScheduleJob(_ResetChargerJob, _ResetChargerTrigger);