SafetyStateFixedTimeJob.cs 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. using Quartz;
  2. using System.Linq;
  3. using System.Threading.Tasks;
  4. using ToolLibrary.LogHelper;
  5. using Yunda.ISAS.DataMonitoringServer.WebSocket.Model;
  6. namespace Yunda.ISAS.DataMonitoringServer.TimeWorkers
  7. {
  8. /// <summary>
  9. /// 布防撤防
  10. /// </summary>
  11. [DisallowConcurrentExecution]
  12. public class SafetyStateFixedTimeJob : IJob
  13. {
  14. public async Task Execute(IJobExecutionContext context)
  15. {
  16. //#if DEBUG
  17. // return;
  18. //#endif
  19. SafetyStateUpdate();
  20. }
  21. private void SafetyStateUpdate()
  22. {
  23. try
  24. {
  25. TimeWorkService._webApiRequest.UpdateEuipmentSafetyData();
  26. DataMonitorMessageModel messageModel = new DataMonitorMessageModel
  27. {
  28. Content = TimeWorkService._runningDataCache.EquipmentDataDic.Values.ToList(),
  29. GroupType = GroupTypeEnum.All,
  30. MessageType = MessgeTypeEnum.All
  31. };
  32. TimeWorkService._webSocketServer.SendMsg(messageModel);
  33. }
  34. catch (System.Exception ex)
  35. {
  36. Log4Helper.Error(this.GetType(), "定时布防撤防数据更新发生错误", ex);
  37. }
  38. }
  39. }
  40. }