本次提交对变量管理和数据处理进行了多项重构和优化:

1.  重构变量管理服务:
      *   统一了单个和批量变量的更新逻辑,并引入 AutoMapper 进行对象映射,提高了代码的可维护性。
      *   增加了对 IsHistoryEnabled 属性变更的跟踪,允许系统对此类变更做出响应。

  2.  改进历史记录:
      *   HistoryProcessor 现在记录变量的 DisplayValue,使得历史数据与用户界面显示的值保持一致。

  3.  修正值转换逻辑:
      *   ValueConvertProcessor 在应用转换公式后,会同时更新变量的 NumericValue 和 DisplayValue,确保了数据在处理链中的一致性。
This commit is contained in:
2025-10-02 23:14:40 +08:00
parent 745cd43513
commit f330f67767
4 changed files with 22 additions and 73 deletions

View File

@@ -41,7 +41,7 @@ public class HistoryProcessor : IVariableProcessor, IDisposable
var historyData = new VariableHistory
{
VariableId = context.Data.Id,
Value = context.Data.DataValue?.ToString() ?? string.Empty,
Value = context.Data.DisplayValue?.ToString() ?? string.Empty,
Timestamp = DateTime.Now // 记录当前时间
};