Преглед изворни кода

fix(s8): align process nodes with s1-s7 flow

YY968XX пре 2 недеља
родитељ
комит
bc45e611a3

+ 21 - 2
server/Plugins/Admin.NET.Plugin.AiDOP/Service/S8/S8ManualReportService.cs

@@ -17,6 +17,18 @@ public class S8ManualReportService : ITransient
         "CRITICAL", "HIGH", "MEDIUM", "LOW"
     };
 
+    // S8-PROCESS-NODE-S1S7-ALIGN-1:process_node_code 当前阶段对齐 S1-S7 订单主流程。
+    // 优先 module_code(已是 S1-S7),其次按 scene_code 反推;都无法识别则 null。
+    private static string? ResolveProcessNodeCode(string? sceneCode, string? moduleCode)
+    {
+        if (!string.IsNullOrWhiteSpace(moduleCode) && S8ModuleCode.All.Contains(moduleCode))
+            return moduleCode;
+        var fromScene = S8ModuleCode.FromScene(sceneCode);
+        if (!string.IsNullOrWhiteSpace(fromScene) && S8ModuleCode.All.Contains(fromScene))
+            return fromScene;
+        return null;
+    }
+
     private readonly SqlSugarRepository<AdoS8Exception> _rep;
     private readonly SqlSugarRepository<AdoS8ExceptionTimeline> _timelineRep;
     private readonly SqlSugarRepository<AdoS8Evidence> _evidenceRep;
@@ -171,6 +183,7 @@ public class S8ManualReportService : ITransient
             ReporterId = currentUserId,
             ExceptionTypeCode = inferredType,
             ModuleCode = S8ModuleCode.FromScene(dto.SceneCode.Trim()),
+            ProcessNodeCode = ResolveProcessNodeCode(dto.SceneCode.Trim(), S8ModuleCode.FromScene(dto.SceneCode.Trim())),
             CreatedAt = DateTime.Now,
             IsDeleted = false
         };
@@ -245,7 +258,8 @@ public class S8ManualReportService : ITransient
             ExceptionTypeCode = "EQUIP_FAULT",
             // S2 自映射 → S2。看板按 module_code 聚合,留空会导致模块卡空白。
             ModuleCode = S8ModuleCode.FromScene(S8SceneCode.S2),
-            ProcessNodeCode = null,
+            // S8-PROCESS-NODE-S1S7-ALIGN-1:process_node_code 与 module 对齐 S1-S7。
+            ProcessNodeCode = ResolveProcessNodeCode(S8SceneCode.S2, S8ModuleCode.FromScene(S8SceneCode.S2)),
             // 追溯三件套(自动建单必填口径)。
             SourceRuleId = hit.SourceRuleId,
             SourceDataSourceId = hit.DataSourceId,
@@ -314,7 +328,12 @@ public class S8ManualReportService : ITransient
             ModuleCode = !string.IsNullOrWhiteSpace(hit.ModuleCode)
                 ? hit.ModuleCode
                 : S8ModuleCode.FromScene(string.IsNullOrWhiteSpace(hit.SceneCode) ? S8SceneCode.S2 : hit.SceneCode),
-            ProcessNodeCode = null,
+            // S8-PROCESS-NODE-S1S7-ALIGN-1:process_node_code 与 module 对齐 S1-S7。
+            ProcessNodeCode = ResolveProcessNodeCode(
+                string.IsNullOrWhiteSpace(hit.SceneCode) ? S8SceneCode.S2 : hit.SceneCode,
+                !string.IsNullOrWhiteSpace(hit.ModuleCode)
+                    ? hit.ModuleCode
+                    : S8ModuleCode.FromScene(string.IsNullOrWhiteSpace(hit.SceneCode) ? S8SceneCode.S2 : hit.SceneCode)),
             SourceRuleId = hit.SourceRuleId,
             SourceDataSourceId = hit.DataSourceId == 0 ? null : hit.DataSourceId,
             SourcePayload = hit.SourcePayload,