refactor:删除了DeviceDto,VariableDto,VariableTableDto,改为使用DMS.Core中的实体
This commit is contained in:
@@ -56,7 +56,7 @@ public class HistoryProcessor : IVariableProcessor, IDisposable
|
||||
}
|
||||
}
|
||||
|
||||
// 将 VariableDto 转换为 VariableHistory
|
||||
// 将 Variable 转换为 VariableHistory
|
||||
var historyData = new VariableHistory
|
||||
{
|
||||
VariableId = context.Data.Id,
|
||||
|
||||
@@ -17,7 +17,7 @@ public class UpdateDbVariableProcessor : IVariableProcessor, IDisposable
|
||||
private const int BATCH_SIZE = 50; // 批量更新的阈值
|
||||
private const int TIMER_INTERVAL_MS = 30 * 1000; // 30秒
|
||||
|
||||
private readonly ConcurrentQueue<VariableDto> _queue = new();
|
||||
private readonly ConcurrentQueue<Variable> _queue = new();
|
||||
private readonly Timer _timer;
|
||||
private readonly IRepositoryManager _repositoryManager;
|
||||
private readonly ILogger<UpdateDbVariableProcessor> _logger;
|
||||
@@ -52,7 +52,7 @@ public class UpdateDbVariableProcessor : IVariableProcessor, IDisposable
|
||||
// 停止定时器,防止在写入过程中再次触发
|
||||
_timer.Change(Timeout.Infinite, Timeout.Infinite);
|
||||
|
||||
var itemsToProcess = new List<VariableDto>();
|
||||
var itemsToProcess = new List<Variable>();
|
||||
while (_queue.TryDequeue(out var item))
|
||||
{
|
||||
itemsToProcess.Add(item);
|
||||
|
||||
@@ -4,6 +4,7 @@ using DMS.Application.DTOs;
|
||||
using DMS.Application.Interfaces;
|
||||
using DMS.Application.Models;
|
||||
using DMS.Core.Enums;
|
||||
using DMS.Core.Models;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
namespace DMS.Application.Services.Processors;
|
||||
@@ -58,7 +59,7 @@ public class ValueConvertProcessor : IVariableProcessor
|
||||
/// 根据转换公式计算用于UI显示的DisplayValue
|
||||
/// </summary>
|
||||
/// <param name="variable">需要处理的变量DTO</param>
|
||||
private void CalculateDisplayValue(VariableDto variable)
|
||||
private void CalculateDisplayValue(Variable variable)
|
||||
{
|
||||
// 默认情况下,显示值等于原始数据值
|
||||
variable.DisplayValue = variable.DataValue;
|
||||
@@ -106,7 +107,7 @@ public class ValueConvertProcessor : IVariableProcessor
|
||||
/// </summary>
|
||||
/// <param name="variable">关联的变量 DTO</param>
|
||||
/// <param name="value">从 S7 读取的原始对象值</param>
|
||||
private void ConvertS7ValueToStringAndNumeric(VariableDto variable, string value)
|
||||
private void ConvertS7ValueToStringAndNumeric(Variable variable, string value)
|
||||
{
|
||||
if (value == null)
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user