Prechádzať zdrojové kódy

feat: add PENDING_VERIFICATION status to S8 state machine

YY968XX 3 mesiacov pred
rodič
commit
987b0cd9ea

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

@@ -5,6 +5,7 @@ namespace Admin.NET.Plugin.AiDOP.Entity.S8;
 /// </summary>
 [SugarTable("ado_s8_exception", "S8 异常主表")]
 [SugarIndex("uk_ado_s8_exception_tenant_factory_code", nameof(TenantId), OrderByType.Asc, nameof(FactoryId), OrderByType.Asc, nameof(ExceptionCode), OrderByType.Asc, IsUnique = true)]
+[SugarIndex("idx_ado_s8_exception_type_time", nameof(TenantId), OrderByType.Asc, nameof(FactoryId), OrderByType.Asc, nameof(ExceptionTypeCode), OrderByType.Asc, nameof(CreatedAt), OrderByType.Desc)]
 public class AdoS8Exception
 {
     [SugarColumn(ColumnName = "id", IsPrimaryKey = true, IsIdentity = true, ColumnDataType = "bigint")]
@@ -102,4 +103,40 @@ public class AdoS8Exception
 
     [SugarColumn(ColumnName = "updated_by", Length = 64, IsNullable = true)]
     public string? UpdatedBy { get; set; }
+
+    /// <summary>异常类型编码(关联 ado_s8_exception_type.type_code)。配置化改造后新增。</summary>
+    [SugarColumn(ColumnName = "exception_type_code", Length = 64, IsNullable = true)]
+    public string? ExceptionTypeCode { get; set; }
+
+    /// <summary>来源数据源 ID(自动建单时填充;人工提报为空)。关联 ado_s8_data_source.id</summary>
+    [SugarColumn(ColumnName = "source_data_source_id", ColumnDataType = "bigint", IsNullable = true)]
+    public long? SourceDataSourceId { get; set; }
+
+    /// <summary>来源监视规则 ID(自动建单时填充)。关联 ado_s8_watch_rule.id</summary>
+    [SugarColumn(ColumnName = "source_rule_id", ColumnDataType = "bigint", IsNullable = true)]
+    public long? SourceRuleId { get; set; }
+
+    /// <summary>命中规则时的原始数据快照(JSON 文本,便于追溯)</summary>
+    [SugarColumn(ColumnName = "source_payload", Length = 4000, IsNullable = true)]
+    public string? SourcePayload { get; set; }
+
+    /// <summary>检验人ID(提交复检时手选)</summary>
+    [SugarColumn(ColumnName = "verifier_id", ColumnDataType = "bigint", IsNullable = true)]
+    public long? VerifierId { get; set; }
+
+    /// <summary>提交复检时间</summary>
+    [SugarColumn(ColumnName = "verification_assigned_at", IsNullable = true)]
+    public DateTime? VerificationAssignedAt { get; set; }
+
+    /// <summary>检验完成时间</summary>
+    [SugarColumn(ColumnName = "verified_at", IsNullable = true)]
+    public DateTime? VerifiedAt { get; set; }
+
+    /// <summary>检验结果(APPROVED / REJECTED)</summary>
+    [SugarColumn(ColumnName = "verification_result", Length = 32, IsNullable = true)]
+    public string? VerificationResult { get; set; }
+
+    /// <summary>检验意见</summary>
+    [SugarColumn(ColumnName = "verification_remark", Length = 2000, IsNullable = true)]
+    public string? VerificationRemark { get; set; }
 }

+ 2 - 1
server/Plugins/Admin.NET.Plugin.AiDOP/Infrastructure/S8/S8Labels.cs

@@ -11,6 +11,7 @@ public static class S8Labels
         "CLOSED" => "已关闭",
         "REJECTED" => "已驳回",
         "ESCALATED" => "已升级",
+        "PENDING_VERIFICATION" => "待检验",
         _ => code
     };
 
@@ -24,7 +25,7 @@ public static class S8Labels
     };
 
     public static object[] StatusOptions() =>
-        new[] { "NEW", "ASSIGNED", "IN_PROGRESS", "RESOLVED", "CLOSED", "REJECTED", "ESCALATED" }
+        new[] { "NEW", "ASSIGNED", "IN_PROGRESS", "PENDING_VERIFICATION", "RESOLVED", "CLOSED", "REJECTED", "ESCALATED" }
             .Select(v => new { value = v, label = StatusLabel(v) }).ToArray<object>();
 
     public static object[] SeverityOptions() =>

+ 3 - 0
server/Plugins/Admin.NET.Plugin.AiDOP/Infrastructure/S8/S8StatusRules.cs

@@ -13,6 +13,9 @@ public static class S8StatusRules
         ("ASSIGNED", "ESCALATED"),
         ("ASSIGNED", "REJECTED"),
         ("IN_PROGRESS", "RESOLVED"),
+        ("IN_PROGRESS", "PENDING_VERIFICATION"),
+        ("PENDING_VERIFICATION", "RESOLVED"),
+        ("PENDING_VERIFICATION", "IN_PROGRESS"),
         ("IN_PROGRESS", "ESCALATED"),
         ("IN_PROGRESS", "REJECTED"),
         ("RESOLVED", "CLOSED"),

+ 1 - 0
server/Plugins/Admin.NET.Plugin.AiDOP/Service/S8/S8DictionaryService.cs

@@ -11,6 +11,7 @@ public class S8DictionaryService : ITransient
                 new { value = "ASSIGNED", label = "已指派" },
                 new { value = "IN_PROGRESS", label = "处理中" },
                 new { value = "RESOLVED", label = "已处理" },
+                new { value = "PENDING_VERIFICATION", label = "待检验" },
                 new { value = "CLOSED", label = "已关闭" },
                 new { value = "REJECTED", label = "已驳回" },
                 new { value = "ESCALATED", label = "已升级" },

+ 1 - 1
server/Plugins/Admin.NET.Plugin.AiDOP/Service/S8/S8ExceptionService.cs

@@ -26,7 +26,7 @@ public class S8ExceptionService : ITransient
     public async Task<(int total, List<AdoS8ExceptionListItemDto> list)> GetPagedAsync(AdoS8ExceptionQueryDto q)
     {
         (q.Page, q.PageSize) = PagingGuard.Normalize(q.Page, q.PageSize);
-        var pendingStatuses = new[] { "NEW", "ASSIGNED", "IN_PROGRESS" };
+        var pendingStatuses = new[] { "NEW", "ASSIGNED", "IN_PROGRESS", "PENDING_VERIFICATION" };
 
         var query = _rep.Context.Queryable<AdoS8Exception>()
             .LeftJoin<AdoS8SceneConfig>((e, sc) =>