48 lines
1.4 KiB
C#
48 lines
1.4 KiB
C#
using Quartz;
|
|
using System;
|
|
using System.Threading.Tasks;
|
|
using ToolLibrary.LogHelper;
|
|
using Yunda.ISAS.DataMonitoringServer.DataAnalysis.DataCollection;
|
|
using Yunda.ISAS.DataMonitoringServer.DataAnalysis.Model;
|
|
|
|
namespace Yunda.ISAS.DataMonitoringServer.TimeWorkers
|
|
{
|
|
/// <summary>
|
|
/// 巡检灯光控制
|
|
/// </summary>
|
|
[DisallowConcurrentExecution]
|
|
public class LightingControlTimeJob : IJob
|
|
{
|
|
public async Task Execute(IJobExecutionContext context)
|
|
{
|
|
try
|
|
{
|
|
var telecomands = TimeWorkService._webApiRequest
|
|
.GetLightingControlTelecommand(TimeWorkService._configurationHepler.SubstationId);
|
|
if (telecomands == null)
|
|
{
|
|
return;
|
|
}
|
|
foreach (var telecomand in telecomands)
|
|
{
|
|
var telecom = new TelecommandModel();
|
|
ToolLibrary.MapValue.Map(telecomand, telecom);
|
|
telecom.Value = telecomand.Value;
|
|
TimeWorkService._teleCommandDataSendTask.TelecommandTActionBlock.Post(new TelcommandDataModel()
|
|
{
|
|
Telecommand = telecom
|
|
});
|
|
}
|
|
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
|
|
Log4Helper.Error(this.GetType(), "定时布防撤防数据更新发生错误", ex);
|
|
|
|
}
|
|
|
|
}
|
|
}
|
|
}
|