完成S7变量启用和停用更新
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
using AutoMapper;
|
||||
using DMS.Application.DTOs;
|
||||
using DMS.Application.DTOs.Events;
|
||||
using DMS.Core.Models;
|
||||
using DMS.Application.Interfaces;
|
||||
using DMS.Core.Interfaces;
|
||||
@@ -11,6 +10,7 @@ using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using System;
|
||||
using System.Linq;
|
||||
using DMS.Application.Events;
|
||||
using DMS.Application.Interfaces.Management;
|
||||
using DMS.Core.Events;
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ using DMS.Application.DTOs;
|
||||
using DMS.Application.Interfaces;
|
||||
using DMS.Core.Interfaces;
|
||||
using System.Collections.Concurrent;
|
||||
using DMS.Application.DTOs.Events;
|
||||
using DMS.Application.Events;
|
||||
using DMS.Application.Interfaces.Database;
|
||||
using DMS.Core.Models;
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using System;
|
||||
using DMS.Application.DTOs.Events;
|
||||
using DMS.Application.Events;
|
||||
using DMS.Application.Interfaces;
|
||||
using DMS.Core.Events;
|
||||
@@ -77,6 +76,16 @@ public class EventService : IEventService
|
||||
OnVariableChanged?.Invoke(sender, e);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 变量启停改变事件
|
||||
/// </summary>
|
||||
public event EventHandler<VariablesActiveChangedEventArgs> OnVariableActiveChanged;
|
||||
public void RaiseVariableActiveChanged(object sender, VariablesActiveChangedEventArgs e)
|
||||
{
|
||||
OnVariableActiveChanged?.Invoke(sender, e);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 变量值改变事件
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
using DMS.Application.DTOs;
|
||||
using DMS.Application.DTOs.Events;
|
||||
using DMS.Application.Events;
|
||||
using DMS.Application.Interfaces;
|
||||
using DMS.Application.Interfaces.Database;
|
||||
using DMS.Application.Interfaces.Management;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
using DMS.Application.DTOs;
|
||||
using DMS.Application.DTOs.Events;
|
||||
using DMS.Application.Events;
|
||||
using DMS.Application.Interfaces;
|
||||
using DMS.Application.Interfaces.Database;
|
||||
using DMS.Application.Interfaces.Management;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
using DMS.Application.DTOs;
|
||||
using DMS.Application.DTOs.Events;
|
||||
using DMS.Application.Events;
|
||||
using DMS.Application.Interfaces;
|
||||
using DMS.Application.Interfaces.Management;
|
||||
using DMS.Core.Enums;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
using DMS.Application.DTOs;
|
||||
using DMS.Application.DTOs.Events;
|
||||
using DMS.Application.Events;
|
||||
using DMS.Application.Interfaces;
|
||||
using DMS.Application.Interfaces.Database;
|
||||
using DMS.Application.Interfaces.Management;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
using System.Collections.Concurrent;
|
||||
using DMS.Application.DTOs;
|
||||
using DMS.Application.DTOs.Events;
|
||||
using DMS.Application.Events;
|
||||
using DMS.Application.Interfaces;
|
||||
using DMS.Application.Interfaces.Database;
|
||||
using DMS.Application.Interfaces.Management;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
using System.Collections.Concurrent;
|
||||
using DMS.Application.DTOs;
|
||||
using DMS.Application.DTOs.Events;
|
||||
using DMS.Application.Events;
|
||||
using DMS.Application.Interfaces;
|
||||
using DMS.Application.Interfaces.Database;
|
||||
using DMS.Application.Interfaces.Management;
|
||||
|
||||
@@ -2,8 +2,8 @@ using System;
|
||||
using System.Collections.Concurrent;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using DMS.Application.Events;
|
||||
using DMS.Application.Interfaces;
|
||||
using DMS.Core.Events;
|
||||
using DMS.Core.Models;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@ public class HistoryProcessor : IVariableProcessor, IDisposable
|
||||
// 只有当数据需要保存时才记录历史
|
||||
if (!context.Data.IsHistoryEnabled) // 如果数据已经被其他处理器处理过或者不需要保存,则跳过
|
||||
{
|
||||
_logger.LogDebug("变量 {VariableName} (ID: {VariableId}) 历史记录已禁用,跳过处理", context.Data.Name, context.Data.Id);
|
||||
// _logger.LogDebug("变量 {VariableName} (ID: {VariableId}) 历史记录已禁用,跳过处理", context.Data.Name, context.Data.Id);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ public class ValueConvertProcessor : IVariableProcessor
|
||||
ConvertS7ValueToStringAndNumeric(context.Data, context.NewValue);
|
||||
context.Data.UpdatedAt = DateTime.Now;
|
||||
// 如何值没有变化则中断处理
|
||||
if (context.Data.DataValue!=oldValue)
|
||||
if (context.Data.DataValue==oldValue)
|
||||
{
|
||||
context.IsHandled = true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user