From 88643027715a77275ff74e8e8cd2ca2dac9e5192 Mon Sep 17 00:00:00 2001 From: dk1st Date: Thu, 30 Oct 2025 12:40:42 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BA=8B=E4=BB=B6=E5=B7=A1=E6=A3=80=E7=B1=BB?= =?UTF-8?q?=E5=9E=8B=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../SecondaryCircuitInspectionPlanService.cs | 53 +++++-------------- 1 file changed, 13 insertions(+), 40 deletions(-) diff --git a/src/YunDa.Server/YunDa.Server.ISMSTcp/Services/SecondaryCircuitInspectionPlanService.cs b/src/YunDa.Server/YunDa.Server.ISMSTcp/Services/SecondaryCircuitInspectionPlanService.cs index a260228..a39ba3c 100644 --- a/src/YunDa.Server/YunDa.Server.ISMSTcp/Services/SecondaryCircuitInspectionPlanService.cs +++ b/src/YunDa.Server/YunDa.Server.ISMSTcp/Services/SecondaryCircuitInspectionPlanService.cs @@ -6,6 +6,7 @@ using Newtonsoft.Json.Linq; using System; using System.Collections.Concurrent; using System.Collections.Generic; +using System.ComponentModel; using System.Diagnostics; using System.Linq; using System.Net.Http; @@ -504,7 +505,17 @@ namespace YunDa.Server.ISMSTcp.Services { await Task.Delay(item.MandatoryWaitSeconds * 1000); - CheckPlanFormIds(item.SecondaryCircuitInspectionEventItems); + //CheckPlanFormIds(item.SecondaryCircuitInspectionEventItems); + + //执行巡检 + foreach(var planItem in item.SecondaryCircuitInspectionEventItems) + { + if (!string.IsNullOrWhiteSpace(planItem.CalculationExpression) && !string.IsNullOrWhiteSpace(planItem.Id.ToString())) + { + //写到队列里,由队列控制执行频率 + await _singlePlanChannel.Writer.WriteAsync(planItem); + } + } } } } @@ -519,45 +530,7 @@ namespace YunDa.Server.ISMSTcp.Services } - //检测巡检计划中的计划 - private async Task CheckPlanFormIds(List planIds) - { - if (_planList == null) - return; - - try - { - SecondaryCircuitInspectionPlanStateModel[] planList; - lock (_planLock) - { - planList = _planList.ToArray(); - } - - foreach (var plan in planList) - { - if(plan.Plan.IsActive) - { - foreach (var item in plan.Plan.InspectionItems) - { - if (planIds.IndexOf(item.Id) > -1 && item.IsActive) - { - if (!string.IsNullOrWhiteSpace(item.CalculationExpression) && !string.IsNullOrWhiteSpace(item.Id.ToString())) - { - //写到队列里,由队列控制执行频率 - await _singlePlanChannel.Writer.WriteAsync(item); - } - } - } - } - } - } - catch (Exception ex) - { - _logger.LogError(ex, "SecondaryCircuitInspectionPlanService - CheckPlanFormIds :发生错误"); - } - - return; - } + ////获取遥测数据 //public async Task> CallYCByDataIdAsync(CallYCByDataIdRequest request, CancellationToken cancellationToken = default)