소스 검색

feat(s8): t1b add order flow detail entities

YY968XX 1 개월 전
부모
커밋
956867e0f4

+ 70 - 0
server/Plugins/Admin.NET.Plugin.AiDOP/Entity/S8/OrderFlow/AdoS8OrderFlowProcurementPivot.cs

@@ -0,0 +1,70 @@
+namespace Admin.NET.Plugin.AiDOP.Entity.S8.OrderFlow;
+
+/// <summary>
+/// ORDER-FLOW-S8-INTEGRATED-DOMAIN-RESET-1 t1b:S8 订单执行链路材料采购透视表。
+/// 承载供应商 × 线材规格的周期透视数据;order_id / order_code 允许为空:
+///   - NULL → baseline / PPT / DEMO 级别基线行
+///   - 非 NULL → 订单级透视行(后续扩展)
+/// cycle_days 使用 decimal(6,3) 以承载 YY 真值的 3 位小数精度。
+/// material_code / supplier_code / spec_code 的 TOTAL 值表示合计行 / 合计列。
+/// </summary>
+[SugarTable("ado_s8_order_flow_procurement_pivot", "S8 订单执行链路采购透视表")]
+[SugarIndex("idx_order_flow_proc_pivot_baseline", nameof(TenantId), OrderByType.Asc, nameof(FactoryId), OrderByType.Asc, nameof(MaterialCode), OrderByType.Asc, nameof(SupplierCode), OrderByType.Asc, nameof(SpecCode), OrderByType.Asc)]
+[SugarIndex("idx_order_flow_proc_pivot_order", nameof(TenantId), OrderByType.Asc, nameof(FactoryId), OrderByType.Asc, nameof(OrderCode), OrderByType.Asc)]
+[SugarIndex("idx_order_flow_proc_pivot_scenario", nameof(TenantId), OrderByType.Asc, nameof(FactoryId), OrderByType.Asc, nameof(ScenarioCode), OrderByType.Asc, nameof(IsDeleted), OrderByType.Asc)]
+public class AdoS8OrderFlowProcurementPivot
+{
+    [SugarColumn(ColumnName = "id", IsPrimaryKey = true, IsIdentity = true, ColumnDataType = "bigint")]
+    public long Id { get; set; }
+
+    /// <summary>NULL = baseline 行;非 NULL = 订单级行。</summary>
+    [SugarColumn(ColumnName = "order_id", ColumnDataType = "bigint", IsNullable = true)]
+    public long? OrderId { get; set; }
+
+    /// <summary>NULL = baseline 行;非 NULL = 订单业务键。</summary>
+    [SugarColumn(ColumnName = "order_code", Length = 64, IsNullable = true)]
+    public string? OrderCode { get; set; }
+
+    /// <summary>材料编码:XX / YY / ZZ / TOTAL。TOTAL 表示合计行。</summary>
+    [SugarColumn(ColumnName = "material_code", Length = 16)]
+    public string MaterialCode { get; set; } = string.Empty;
+
+    /// <summary>供应商编码:A / B / C / TOTAL。</summary>
+    [SugarColumn(ColumnName = "supplier_code", Length = 16)]
+    public string SupplierCode { get; set; } = string.Empty;
+
+    /// <summary>线材规格:L4.5*11.2 / MT2*6.3 / MT1*5.4 / TOTAL。</summary>
+    [SugarColumn(ColumnName = "spec_code", Length = 32)]
+    public string SpecCode { get; set; } = string.Empty;
+
+    /// <summary>周期天数。精度 decimal(6,3) 以承载 YY 真值最高位的 3 位小数。</summary>
+    [SugarColumn(ColumnName = "cycle_days", DecimalDigits = 3, Length = 6)]
+    public decimal CycleDays { get; set; }
+
+    /// <summary>green / yellow / red。</summary>
+    [SugarColumn(ColumnName = "status", Length = 16)]
+    public string Status { get; set; } = "green";
+
+    /// <summary>PPT(YY 真值)/ DEMO(XX, ZZ 演示 fixture)。</summary>
+    [SugarColumn(ColumnName = "scenario_code", Length = 16)]
+    public string ScenarioCode { get; set; } = "DEMO";
+
+    /// <summary>SEED / IMPORT / AGG。</summary>
+    [SugarColumn(ColumnName = "data_source", Length = 16)]
+    public string DataSource { get; set; } = "SEED";
+
+    [SugarColumn(ColumnName = "tenant_id", ColumnDataType = "bigint")]
+    public long TenantId { get; set; }
+
+    [SugarColumn(ColumnName = "factory_id", ColumnDataType = "bigint")]
+    public long FactoryId { get; set; }
+
+    [SugarColumn(ColumnName = "created_at")]
+    public DateTime CreatedAt { get; set; } = DateTime.Now;
+
+    [SugarColumn(ColumnName = "updated_at", IsNullable = true)]
+    public DateTime? UpdatedAt { get; set; }
+
+    [SugarColumn(ColumnName = "is_deleted", ColumnDataType = "boolean")]
+    public bool IsDeleted { get; set; }
+}

+ 74 - 0
server/Plugins/Admin.NET.Plugin.AiDOP/Entity/S8/OrderFlow/AdoS8OrderFlowSubstep.cs

@@ -0,0 +1,74 @@
+namespace Admin.NET.Plugin.AiDOP.Entity.S8.OrderFlow;
+
+/// <summary>
+/// ORDER-FLOW-S8-INTEGRATED-DOMAIN-RESET-1 t1b:S8 订单执行链路 L2 子节点。
+/// 首版用于 ORDER_REVIEW_PLAN_CALC 阶段的 5 个评审子节点(意见评审 / 意见反馈 /
+/// 二次评审 / 领导意见 / 合同盖章)。substep_code 白名单由 service / seed 约束,
+/// 不在 DB CHECK 中固化,便于后续扩展其它阶段的子节点。
+/// </summary>
+[SugarTable("ado_s8_order_flow_substep", "S8 订单执行链路 L2 子节点")]
+[SugarIndex("uk_order_flow_substep", nameof(OrderId), OrderByType.Asc, nameof(SubstepCode), OrderByType.Asc, IsUnique = true)]
+[SugarIndex("idx_order_flow_substep_order_code", nameof(TenantId), OrderByType.Asc, nameof(FactoryId), OrderByType.Asc, nameof(OrderCode), OrderByType.Asc)]
+[SugarIndex("idx_order_flow_substep_flow", nameof(TenantId), OrderByType.Asc, nameof(FactoryId), OrderByType.Asc, nameof(OrderFlowCode), OrderByType.Asc)]
+public class AdoS8OrderFlowSubstep
+{
+    [SugarColumn(ColumnName = "id", IsPrimaryKey = true, IsIdentity = true, ColumnDataType = "bigint")]
+    public long Id { get; set; }
+
+    /// <summary>外键 → ado_s8_order_flow_order.id。</summary>
+    [SugarColumn(ColumnName = "order_id", ColumnDataType = "bigint")]
+    public long OrderId { get; set; }
+
+    /// <summary>冗余订单业务键,便于按 order_code 聚合。</summary>
+    [SugarColumn(ColumnName = "order_code", Length = 64)]
+    public string OrderCode { get; set; } = string.Empty;
+
+    /// <summary>UPPER ORDER_FLOW node_code,首版主要承载 ORDER_REVIEW_PLAN_CALC。白名单由 service / seed 约束。</summary>
+    [SugarColumn(ColumnName = "order_flow_code", Length = 64)]
+    public string OrderFlowCode { get; set; } = string.Empty;
+
+    /// <summary>L2 子节点编码:OPINION_REVIEW / OPINION_FEEDBACK / SECOND_REVIEW / LEADER_REVIEW / CONTRACT_SEAL。</summary>
+    [SugarColumn(ColumnName = "substep_code", Length = 32)]
+    public string SubstepCode { get; set; } = string.Empty;
+
+    [SugarColumn(ColumnName = "substep_name", Length = 32)]
+    public string SubstepName { get; set; } = string.Empty;
+
+    /// <summary>PI 基线工时(小时)。t2b seed 按 PPT 第 2 页基线写入。</summary>
+    [SugarColumn(ColumnName = "pi_hours", DecimalDigits = 1, Length = 6)]
+    public decimal PiHours { get; set; }
+
+    /// <summary>实际工时(小时)。nullable,未完成时为空。</summary>
+    [SugarColumn(ColumnName = "actual_hours", DecimalDigits = 1, Length = 6, IsNullable = true)]
+    public decimal? ActualHours { get; set; }
+
+    /// <summary>green / yellow / red / pending。</summary>
+    [SugarColumn(ColumnName = "status", Length = 16)]
+    public string Status { get; set; } = "pending";
+
+    [SugarColumn(ColumnName = "sort_no")]
+    public int SortNo { get; set; }
+
+    /// <summary>PPT / DEMO / PROD。</summary>
+    [SugarColumn(ColumnName = "scenario_code", Length = 16)]
+    public string ScenarioCode { get; set; } = "DEMO";
+
+    /// <summary>SEED / IMPORT / AGG。</summary>
+    [SugarColumn(ColumnName = "data_source", Length = 16)]
+    public string DataSource { get; set; } = "SEED";
+
+    [SugarColumn(ColumnName = "tenant_id", ColumnDataType = "bigint")]
+    public long TenantId { get; set; }
+
+    [SugarColumn(ColumnName = "factory_id", ColumnDataType = "bigint")]
+    public long FactoryId { get; set; }
+
+    [SugarColumn(ColumnName = "created_at")]
+    public DateTime CreatedAt { get; set; } = DateTime.Now;
+
+    [SugarColumn(ColumnName = "updated_at", IsNullable = true)]
+    public DateTime? UpdatedAt { get; set; }
+
+    [SugarColumn(ColumnName = "is_deleted", ColumnDataType = "boolean")]
+    public bool IsDeleted { get; set; }
+}

+ 77 - 0
server/Plugins/Admin.NET.Plugin.AiDOP/Entity/S8/OrderFlow/AdoS8OrderFlowSubstepUnit.cs

@@ -0,0 +1,77 @@
+namespace Admin.NET.Plugin.AiDOP.Entity.S8.OrderFlow;
+
+/// <summary>
+/// ORDER-FLOW-S8-INTEGRATED-DOMAIN-RESET-1 t1b:S8 订单执行链路 L3 责任单元。
+/// 首版用于 OPINION_REVIEW 子节点下的四方责任单元(法律事务部 / 技术售前组 /
+/// 综合主计划 / 试验站)。order_id / order_code / order_flow_code / substep_code
+/// 全部冗余保留,便于跨层聚合而免去多次 join。
+/// </summary>
+[SugarTable("ado_s8_order_flow_substep_unit", "S8 订单执行链路 L3 责任单元")]
+[SugarIndex("uk_order_flow_substep_unit", nameof(SubstepId), OrderByType.Asc, nameof(UnitCode), OrderByType.Asc, IsUnique = true)]
+[SugarIndex("idx_order_flow_substep_unit_order_code", nameof(TenantId), OrderByType.Asc, nameof(FactoryId), OrderByType.Asc, nameof(OrderCode), OrderByType.Asc)]
+[SugarIndex("idx_order_flow_substep_unit_substep", nameof(TenantId), OrderByType.Asc, nameof(FactoryId), OrderByType.Asc, nameof(SubstepCode), OrderByType.Asc)]
+public class AdoS8OrderFlowSubstepUnit
+{
+    [SugarColumn(ColumnName = "id", IsPrimaryKey = true, IsIdentity = true, ColumnDataType = "bigint")]
+    public long Id { get; set; }
+
+    /// <summary>外键 → ado_s8_order_flow_substep.id。</summary>
+    [SugarColumn(ColumnName = "substep_id", ColumnDataType = "bigint")]
+    public long SubstepId { get; set; }
+
+    /// <summary>冗余 order_id,便于按订单维度聚合。</summary>
+    [SugarColumn(ColumnName = "order_id", ColumnDataType = "bigint")]
+    public long OrderId { get; set; }
+
+    [SugarColumn(ColumnName = "order_code", Length = 64)]
+    public string OrderCode { get; set; } = string.Empty;
+
+    /// <summary>冗余 UPPER ORDER_FLOW node_code,首版主要为 ORDER_REVIEW_PLAN_CALC。</summary>
+    [SugarColumn(ColumnName = "order_flow_code", Length = 64)]
+    public string OrderFlowCode { get; set; } = string.Empty;
+
+    /// <summary>冗余 L2 子节点编码,首版主要为 OPINION_REVIEW。</summary>
+    [SugarColumn(ColumnName = "substep_code", Length = 32)]
+    public string SubstepCode { get; set; } = string.Empty;
+
+    /// <summary>L3 责任单元编码:LEGAL / TECH_PRESALE / GENERAL_PLAN / LAB。</summary>
+    [SugarColumn(ColumnName = "unit_code", Length = 32)]
+    public string UnitCode { get; set; } = string.Empty;
+
+    [SugarColumn(ColumnName = "unit_name", Length = 32)]
+    public string UnitName { get; set; } = string.Empty;
+
+    [SugarColumn(ColumnName = "pi_hours", DecimalDigits = 1, Length = 6)]
+    public decimal PiHours { get; set; }
+
+    [SugarColumn(ColumnName = "actual_hours", DecimalDigits = 1, Length = 6, IsNullable = true)]
+    public decimal? ActualHours { get; set; }
+
+    /// <summary>green / yellow / red / pending。</summary>
+    [SugarColumn(ColumnName = "status", Length = 16)]
+    public string Status { get; set; } = "pending";
+
+    [SugarColumn(ColumnName = "sort_no")]
+    public int SortNo { get; set; }
+
+    [SugarColumn(ColumnName = "scenario_code", Length = 16)]
+    public string ScenarioCode { get; set; } = "DEMO";
+
+    [SugarColumn(ColumnName = "data_source", Length = 16)]
+    public string DataSource { get; set; } = "SEED";
+
+    [SugarColumn(ColumnName = "tenant_id", ColumnDataType = "bigint")]
+    public long TenantId { get; set; }
+
+    [SugarColumn(ColumnName = "factory_id", ColumnDataType = "bigint")]
+    public long FactoryId { get; set; }
+
+    [SugarColumn(ColumnName = "created_at")]
+    public DateTime CreatedAt { get; set; } = DateTime.Now;
+
+    [SugarColumn(ColumnName = "updated_at", IsNullable = true)]
+    public DateTime? UpdatedAt { get; set; }
+
+    [SugarColumn(ColumnName = "is_deleted", ColumnDataType = "boolean")]
+    public bool IsDeleted { get; set; }
+}

+ 3 - 0
server/Plugins/Admin.NET.Plugin.AiDOP/Startup.cs

@@ -146,6 +146,9 @@ public class Startup : AppStartup
                 typeof(AdoS8OrderFlowOrder),
                 typeof(AdoS8OrderFlowStage),
                 typeof(AdoS8OrderFlowSnapshot),
+                typeof(AdoS8OrderFlowSubstep),
+                typeof(AdoS8OrderFlowSubstepUnit),
+                typeof(AdoS8OrderFlowProcurementPivot),
                 typeof(ContractReview),
                 typeof(ContractReviewFlow),
                 typeof(ProductDesign),