Просмотр исходного кода

fix(s8): add minimal rule schema fields

R1-SCHEMA-MINIMAL-1: add nullable columns to support future
TIMEOUT / SHORTAGE / OUT_OF_RANGE rule classes without changing
service semantics or evaluator dispatch.

- AdoS8WatchRule: rule_type / source_object_type / params_json
- AdoS8Exception: dedup_key / last_detected_at / recovered_at
                  source_rule_code / source_object_type / source_object_id

CodeFirst auto-ALTER applied on aidopdev; G01_TEST_WATCH backfilled
as OUT_OF_RANGE single-threshold sample. service / evaluator / DTO
unchanged; index, evaluator split, DetectionLog deferred to next steps.
YY968XX 2 недель назад
Родитель
Сommit
976232ad2d

+ 24 - 0
server/Plugins/Admin.NET.Plugin.AiDOP/Entity/S8/AdoS8Exception.cs

@@ -139,4 +139,28 @@ public class AdoS8Exception
     /// <summary>检验意见</summary>
     [SugarColumn(ColumnName = "verification_remark", Length = 2000, IsNullable = true)]
     public string? VerificationRemark { get; set; }
+
+    /// <summary>R1 持久化去重键(首版仅普通列,唯一约束在后续小步加)。</summary>
+    [SugarColumn(ColumnName = "dedup_key", Length = 128, IsNullable = true)]
+    public string? DedupKey { get; set; }
+
+    /// <summary>R1 最近一次被规则检测命中的时间(首版仅落列,service 暂不写)。</summary>
+    [SugarColumn(ColumnName = "last_detected_at", IsNullable = true)]
+    public DateTime? LastDetectedAt { get; set; }
+
+    /// <summary>R1 规则恢复时间(首版仅落列,service 暂不写)。</summary>
+    [SugarColumn(ColumnName = "recovered_at", IsNullable = true)]
+    public DateTime? RecoveredAt { get; set; }
+
+    /// <summary>R1 来源规则人读编码(与 source_rule_id 配合,首版仅落列)。</summary>
+    [SugarColumn(ColumnName = "source_rule_code", Length = 64, IsNullable = true)]
+    public string? SourceRuleCode { get; set; }
+
+    /// <summary>R1 源对象类型(DEVICE / ORDER 等,首版仅落列)。</summary>
+    [SugarColumn(ColumnName = "source_object_type", Length = 64, IsNullable = true)]
+    public string? SourceObjectType { get; set; }
+
+    /// <summary>R1 源对象主键或业务 ID(字符串以适配跨表/跨域,首版仅落列)。</summary>
+    [SugarColumn(ColumnName = "source_object_id", Length = 64, IsNullable = true)]
+    public string? SourceObjectId { get; set; }
 }

+ 12 - 0
server/Plugins/Admin.NET.Plugin.AiDOP/Entity/S8/AdoS8WatchRule.cs

@@ -41,4 +41,16 @@ public class AdoS8WatchRule
 
     [SugarColumn(ColumnName = "updated_at", IsNullable = true)]
     public DateTime? UpdatedAt { get; set; }
+
+    /// <summary>规则类型:TIMEOUT / SHORTAGE / OUT_OF_RANGE。R1 仅落列,evaluator 不分派。</summary>
+    [SugarColumn(ColumnName = "rule_type", Length = 32, IsNullable = true)]
+    public string? RuleType { get; set; }
+
+    /// <summary>源对象类型(DEVICE / ORDER / MATERIAL / QUALITY_CHECK 等)。R1 与 watch_object_type 可保持一致。</summary>
+    [SugarColumn(ColumnName = "source_object_type", Length = 64, IsNullable = true)]
+    public string? SourceObjectType { get; set; }
+
+    /// <summary>规则类型相关结构化参数 JSON。R1 仅预留,service 不解析。</summary>
+    [SugarColumn(ColumnName = "params_json", ColumnDataType = "mediumtext", IsNullable = true)]
+    public string? ParamsJson { get; set; }
 }