namespace Admin.NET.Plugin.AiDOP.Infrastructure.S8; /// /// S8 异常场景码常量。 /// scene_code 格式:S{模块组}_场景域,方便前端按监控页分类。 /// public static class S8SceneCode { /// 交付异常(S1 订单评审变更 + S7 成品出库交期) public const string S1S7Delivery = "S1S7_DELIVERY"; /// 生产异常(S2 工单开工 + S6 完工/质量) public const string S2S6Production = "S2S6_PRODUCTION"; /// 供应异常(S3 MRP套料 + S5 IQC/库存) public const string S3S5Supply = "S3S5_SUPPLY"; /// 采购执行异常(S4 PO跟单/收货/退货) public const string S4Purchase = "S4_PURCHASE"; /// scene_code → 中文名称 public static string Label(string sceneCode) => sceneCode switch { S1S7Delivery => "交付异常", S2S6Production => "生产异常", S3S5Supply => "供应异常", S4Purchase => "采购执行异常", _ => sceneCode }; /// scene_code → 所属模块列表(用于页面展示列头) public static string[] Modules(string sceneCode) => sceneCode switch { S1S7Delivery => new[] { "S1", "S7" }, S2S6Production => new[] { "S2", "S6" }, S3S5Supply => new[] { "S3", "S5" }, S4Purchase => new[] { "S4" }, _ => Array.Empty() }; /// 所有 scene_code 有序列表(综合全景页列顺序) public static readonly string[] All = { S1S7Delivery, S2S6Production, S3S5Supply, S4Purchase }; } /// /// S8 模块码常量(对应 S1-S7 业务模块)。 /// public static class S8ModuleCode { public const string S1 = "S1"; public const string S2 = "S2"; public const string S3 = "S3"; public const string S4 = "S4"; public const string S5 = "S5"; public const string S6 = "S6"; public const string S7 = "S7"; /// module_code → 业务名称(与侧栏菜单 S{N} 看板标题对齐,统一字面) public static string Label(string moduleCode) => moduleCode switch { S1 => "S1 产销协同", S2 => "S2 制造协同", S3 => "S3 供应协同", S4 => "S4 采购执行", S5 => "S5 物料仓储", S6 => "S6 生产执行", S7 => "S7 成品仓储", _ => moduleCode }; /// module_code → 所属 scene_code public static string SceneOf(string moduleCode) => moduleCode switch { S1 or S7 => S8SceneCode.S1S7Delivery, S2 or S6 => S8SceneCode.S2S6Production, S3 or S5 => S8SceneCode.S3S5Supply, S4 => S8SceneCode.S4Purchase, _ => string.Empty }; /// 所有模块码有序列表 public static readonly string[] All = { S1, S2, S3, S4, S5, S6, S7 }; /// /// 场景码 → 代表模块码(取场景内 S8SceneCode.Modules 的首项)。 /// 用于建单时回填 module_code:scene 内含多个 module 时,取代表项作为聚合归属, /// 不替代显式 module_code(caller 可在拿到此值前覆盖)。 /// 未识别 scene 返回 null(caller 自决:留空或兜底)。 /// public static string? FromScene(string? sceneCode) { if (string.IsNullOrWhiteSpace(sceneCode)) return null; var modules = S8SceneCode.Modules(sceneCode); return modules.Length == 0 ? null : modules[0]; } }