S8MonitoringCategory.cs 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. namespace Admin.NET.Plugin.AiDOP.Infrastructure.S8;
  2. /// <summary>
  3. /// S8 监控大屏 5 张类别卡稳定 Key 与中文 Label 的双向映射。
  4. /// Key 写入 ado_s8_exception_type.monitoring_category_key;Label 用于 byCategory.category 输出,
  5. /// 与前端 CATEGORY_DEFS_FALLBACK / OVERVIEW_CATEGORY_KEY_BY_CELL_CODE 字面 100% 对齐。
  6. /// </summary>
  7. public static class S8MonitoringCategory
  8. {
  9. public const string OrderReview = "ORDER_REVIEW";
  10. public const string ProductDesign = "PRODUCT_DESIGN";
  11. public const string MaterialPurchase = "MATERIAL_PURCHASE";
  12. public const string BodyProduction = "BODY_PRODUCTION";
  13. public const string FinalAssemblyDelivery = "FINAL_ASSEMBLY_DELIVERY";
  14. public const string OrderReviewLabel = "订单评审";
  15. public const string ProductDesignLabel = "产品设计";
  16. public const string MaterialPurchaseLabel = "材料采购";
  17. public const string BodyProductionLabel = "本体生产";
  18. public const string FinalAssemblyDeliveryLabel = "总装发货";
  19. public static string? Normalize(string? key)
  20. {
  21. var normalized = key?.Trim().ToUpperInvariant();
  22. return IsValid(normalized) ? normalized : null;
  23. }
  24. public static bool IsValid(string? key) => key is
  25. OrderReview or
  26. ProductDesign or
  27. MaterialPurchase or
  28. BodyProduction or
  29. FinalAssemblyDelivery;
  30. public static string? KeyToLabel(string? key) => Normalize(key) switch
  31. {
  32. OrderReview => OrderReviewLabel,
  33. ProductDesign => ProductDesignLabel,
  34. MaterialPurchase => MaterialPurchaseLabel,
  35. BodyProduction => BodyProductionLabel,
  36. FinalAssemblyDelivery => FinalAssemblyDeliveryLabel,
  37. _ => null,
  38. };
  39. }