namespace Admin.NET.Plugin.AiDOP.Entity.S8.OrderFlow;
///
/// ORDER-FLOW-S8-INTEGRATED-DOMAIN-RESET-1 t1b:S8 订单执行链路 L3 责任单元。
/// 首版用于 OPINION_REVIEW 子节点下的四方责任单元(法律事务部 / 技术售前组 /
/// 综合主计划 / 试验站)。order_id / order_code / order_flow_code / substep_code
/// 全部冗余保留,便于跨层聚合而免去多次 join。
///
[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, ColumnDataType = "bigint")]
public long Id { get; set; }
/// 外键 → ado_s8_order_flow_substep.id。
[SugarColumn(ColumnName = "substep_id", ColumnDataType = "bigint")]
public long SubstepId { get; set; }
/// 冗余 order_id,便于按订单维度聚合。
[SugarColumn(ColumnName = "order_id", ColumnDataType = "bigint")]
public long OrderId { get; set; }
[SugarColumn(ColumnName = "order_code", Length = 64)]
public string OrderCode { get; set; } = string.Empty;
/// 冗余 UPPER ORDER_FLOW node_code,首版主要为 ORDER_REVIEW_PLAN_CALC。
[SugarColumn(ColumnName = "order_flow_code", Length = 64)]
public string OrderFlowCode { get; set; } = string.Empty;
/// 冗余 L2 子节点编码,首版主要为 OPINION_REVIEW。
[SugarColumn(ColumnName = "substep_code", Length = 32)]
public string SubstepCode { get; set; } = string.Empty;
/// L3 责任单元编码:LEGAL / TECH_PRESALE / GENERAL_PLAN / LAB。
[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; }
/// green / yellow / red / pending。
[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; }
}