namespace Admin.NET.Plugin.AiDOP.Entity.S8.OrderFlow;
///
/// ORDER-FLOW-S8-INTEGRATED-DOMAIN-RESET-1 t1a:S8 订单链路正式主表。
/// order_code 为业务键;不保留异常数预存字段,
/// 异常数由 ado_s8_exception 实时聚合,order 表只持有 response/processing/loss KPI。
///
[SugarTable("ado_s8_order_flow_order", "S8 订单执行链路主档")]
[SugarIndex("uk_order_flow_order_code", nameof(TenantId), OrderByType.Asc, nameof(FactoryId), OrderByType.Asc, nameof(OrderCode), OrderByType.Asc, IsUnique = true)]
[SugarIndex("idx_order_flow_order_current_flow", nameof(TenantId), OrderByType.Asc, nameof(FactoryId), OrderByType.Asc, nameof(CurrentOrderFlowCode), OrderByType.Asc)]
[SugarIndex("idx_order_flow_order_customer", nameof(TenantId), OrderByType.Asc, nameof(FactoryId), OrderByType.Asc, nameof(CustomerCode), OrderByType.Asc)]
public class AdoS8OrderFlowOrder
{
[SugarColumn(ColumnName = "id", IsPrimaryKey = true, ColumnDataType = "bigint")]
public long Id { get; set; }
[SugarColumn(ColumnName = "tenant_id", ColumnDataType = "bigint")]
public long TenantId { get; set; }
[SugarColumn(ColumnName = "factory_id", ColumnDataType = "bigint")]
public long FactoryId { get; set; }
/// 订单业务键,全局唯一(tenant/factory 维度)。
[SugarColumn(ColumnName = "order_code", Length = 64)]
public string OrderCode { get; set; } = string.Empty;
[SugarColumn(ColumnName = "product_name", Length = 128)]
public string ProductName { get; set; } = string.Empty;
[SugarColumn(ColumnName = "product_line", Length = 32)]
public string ProductLine { get; set; } = string.Empty;
[SugarColumn(ColumnName = "customer_code", Length = 64)]
public string CustomerCode { get; set; } = string.Empty;
[SugarColumn(ColumnName = "customer_name", Length = 128)]
public string CustomerName { get; set; } = string.Empty;
/// KA / SMB / MICRO。
[SugarColumn(ColumnName = "customer_type", Length = 16)]
public string CustomerType { get; set; } = "KA";
[SugarColumn(ColumnName = "region", Length = 32)]
public string Region { get; set; } = string.Empty;
/// P1 / P2 / P3。
[SugarColumn(ColumnName = "priority", Length = 16)]
public string Priority { get; set; } = "P2";
/// completed / in_progress。
[SugarColumn(ColumnName = "workflow_status", Length = 32)]
public string WorkflowStatus { get; set; } = "in_progress";
/// UPPER ORDER_FLOW node_code(5 选 1):ORDER_REVIEW_PLAN_CALC / PRODUCT_DESIGN / MATERIAL_PURCHASE / BODY_PRODUCTION / FINAL_ASSEMBLY_DELIVERY。白名单由 service 层校验。
[SugarColumn(ColumnName = "current_order_flow_code", Length = 64)]
public string CurrentOrderFlowCode { get; set; } = string.Empty;
[SugarColumn(ColumnName = "release_at")]
public DateTime ReleaseAt { get; set; }
[SugarColumn(ColumnName = "target_cycle_days", DecimalDigits = 1, Length = 6)]
public decimal TargetCycleDays { get; set; }
[SugarColumn(ColumnName = "actual_cycle_days", DecimalDigits = 1, Length = 6, IsNullable = true)]
public decimal? ActualCycleDays { get; set; }
/// KPI:响应时长(分钟)。来源 = 主档业务字段,不从 ado_s8_exception 派生。
[SugarColumn(ColumnName = "response_minutes", IsNullable = true)]
public int? ResponseMinutes { get; set; }
/// KPI:处理时长(分钟)。来源 = 主档业务字段。
[SugarColumn(ColumnName = "processing_minutes", IsNullable = true)]
public int? ProcessingMinutes { get; set; }
/// KPI:总损失时长(分钟)。来源 = 主档业务字段。
[SugarColumn(ColumnName = "total_loss_minutes", IsNullable = true)]
public int? TotalLossMinutes { get; set; }
/// PPT / DEMO / PROD。SO-2026-001 = PPT;其余 19 单 = DEMO。
[SugarColumn(ColumnName = "scenario_code", Length = 16)]
public string ScenarioCode { get; set; } = "DEMO";
/// SEED / IMPORT / AGG。t2a seed 全部为 SEED。
[SugarColumn(ColumnName = "data_source", Length = 16)]
public string DataSource { get; set; } = "SEED";
[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; }
}