跳到主要内容

ReadModified

如果服务端允许 HistoryUpdate (修改历史), 数据可能被改过. ReadModified 拉到所有版本及修改记录, 用于审计 / 法规合规.

前置 / 配套

签名

public IReadOnlyList<ModifiedDataValue> History.ReadModified(
string nodeId,
DateTime startTime,
DateTime endTime,
uint maxValues = 0);

ModifiedDataValue 字段

字段说明
Value / Status / SourceTimestamp / ServerTimestampDataValue
ModificationTypeInsert / Replace / Update / Delete
ModificationTime修改发生的时间
UserName执行修改的用户

用法

var modified = ua.History.ReadModified("ns=2;s=Temperature",
startTime: yesterday, endTime: today);

foreach (var m in modified)
{
Console.WriteLine($"{m.SourceTimestamp:O}: {m.Value} ({m.Status})");
Console.WriteLine($" Modified by {m.UserName} @ {m.ModificationTime} ({m.ModificationType})");
}

何时用

  • 法规合规: GMP / FDA 21 CFR Part 11 等要求"数据可追溯"
  • 审计日志: 谁动了关键参数
  • 数据修复回滚: 知道改之前的值是什么

服务端要求

  • 必须实现 HistoryUpdate
  • 必须保留修改历史 (而不是直接覆盖)
  • 用户身份必须正确传递 (Username / Certificate Token)

下一步