OrderFlowConstants.cs 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. namespace Admin.NET.Plugin.AiDOP.Service.S8.OrderFlow;
  2. /// <summary>
  3. /// ORDER-FLOW-S8-INTEGRATED-DOMAIN-RESET-1 t3b:ORDER_FLOW 5 项常量 + 派生映射。
  4. /// 5 阶段顺序由 SortNo 隐含(同 ORDER_FLOW_ALL 数组顺序);S_STAGE 与 OrderFlowName 字典为只读引用。
  5. /// 不在此文件硬编码任何业务真值(KPI 天数 / 行数 / 真值矩阵)。
  6. /// </summary>
  7. public static class OrderFlowConstants
  8. {
  9. public const string ORDER_REVIEW_PLAN_CALC = "ORDER_REVIEW_PLAN_CALC";
  10. public const string PRODUCT_DESIGN = "PRODUCT_DESIGN";
  11. public const string MATERIAL_PURCHASE = "MATERIAL_PURCHASE";
  12. public const string BODY_PRODUCTION = "BODY_PRODUCTION";
  13. public const string FINAL_ASSEMBLY_DELIVERY = "FINAL_ASSEMBLY_DELIVERY";
  14. /// <summary>5 阶段固定顺序(与 ado_s8_order_flow_stage.sort_no 1~5 对齐)。</summary>
  15. public static readonly IReadOnlyList<string> All = new[]
  16. {
  17. ORDER_REVIEW_PLAN_CALC,
  18. PRODUCT_DESIGN,
  19. MATERIAL_PURCHASE,
  20. BODY_PRODUCTION,
  21. FINAL_ASSEMBLY_DELIVERY,
  22. };
  23. /// <summary>ORDER_FLOW → S 阶段编码(演示协议固定)。</summary>
  24. public static readonly IReadOnlyDictionary<string, string> SStageMap = new Dictionary<string, string>
  25. {
  26. [ORDER_REVIEW_PLAN_CALC] = "S1",
  27. [PRODUCT_DESIGN] = "S2",
  28. [MATERIAL_PURCHASE] = "S3",
  29. [BODY_PRODUCTION] = "S6",
  30. [FINAL_ASSEMBLY_DELIVERY] = "S7",
  31. };
  32. /// <summary>ORDER_FLOW → 展示中文名(与 t2a stage seed FlowDef 一致)。</summary>
  33. public static readonly IReadOnlyDictionary<string, string> OrderFlowName = new Dictionary<string, string>
  34. {
  35. [ORDER_REVIEW_PLAN_CALC] = "评审/排产/测算",
  36. [PRODUCT_DESIGN] = "产品设计",
  37. [MATERIAL_PURCHASE] = "材料采购",
  38. [BODY_PRODUCTION] = "本体生产",
  39. [FINAL_ASSEMBLY_DELIVERY] = "总装发货",
  40. };
  41. /// <summary>未识别 code 时的 fallback 名称(直接回显 code)。</summary>
  42. public static string ResolveName(string? orderFlowCode)
  43. => !string.IsNullOrEmpty(orderFlowCode) && OrderFlowName.TryGetValue(orderFlowCode, out var n)
  44. ? n
  45. : (orderFlowCode ?? string.Empty);
  46. /// <summary>未识别 code 时回退为空字符串(service 调用方决定是否升级为异常)。</summary>
  47. public static string ResolveSStage(string? orderFlowCode)
  48. => !string.IsNullOrEmpty(orderFlowCode) && SStageMap.TryGetValue(orderFlowCode, out var s)
  49. ? s
  50. : string.Empty;
  51. }