namespace Admin.NET.Plugin.AiDOP.Dto.S8.OrderFlow;
///
/// ORDER-FLOW-S8-INTEGRATED-DOMAIN-RESET-1 t3a:S8 订单执行链路 DTO 契约。
/// 仅定义类型,不携带业务常量 / 不引用 Entity / 不接 service 逻辑。
/// 后续 t3b/t3c 切片负责 service + controller 把 DTO 接到 ado_s8_order_flow_* 与 ado_s8_exception 实时聚合。
///
#region 订单档案
public class AdoS8OrderFlowOrderQueryDto
{
public long? TenantId { get; set; }
public long? FactoryId { get; set; }
public string? Keyword { get; set; }
public string? CurrentFlowCode { get; set; }
public string? CustomerCode { get; set; }
public string? ProductLine { get; set; }
public string? Region { get; set; }
public string? WorkflowStatus { get; set; }
public string? ScenarioCode { get; set; }
}
public class AdoS8OrderFlowOrderListItemDto
{
public string OrderCode { get; set; } = string.Empty;
public string ProductName { get; set; } = string.Empty;
public string ProductLine { get; set; } = string.Empty;
public string CustomerCode { get; set; } = string.Empty;
public string CustomerName { get; set; } = string.Empty;
public string CustomerType { get; set; } = string.Empty;
public string Region { get; set; } = string.Empty;
public string Priority { get; set; } = string.Empty;
public string WorkflowStatus { get; set; } = string.Empty;
public string CurrentOrderFlowCode { get; set; } = string.Empty;
public string CurrentOrderFlowName { get; set; } = string.Empty;
public string CurrentStatus { get; set; } = string.Empty;
public DateTime ReleaseAt { get; set; }
public decimal TargetCycleDays { get; set; }
public decimal? ActualCycleDays { get; set; }
public decimal? CurrentCycleDays { get; set; }
public decimal? NodeVarianceDays { get; set; }
public decimal? CumulativeVarianceDays { get; set; }
/// 来自 ado_s8_exception 实时聚合(order 主档表无 exception_count 列)。
public int ExceptionCount { get; set; }
public string ExceptionStatus { get; set; } = string.Empty;
public int? ResponseMinutes { get; set; }
public int? ProcessingMinutes { get; set; }
public int? TotalLossMinutes { get; set; }
public string ScenarioCode { get; set; } = string.Empty;
public string DataSource { get; set; } = string.Empty;
}
public class AdoS8OrderFlowOrderDetailDto : AdoS8OrderFlowOrderListItemDto
{
public List Lifecycle { get; set; } = new();
}
#endregion
#region 阶段 / L2 / L3
public class AdoS8OrderFlowStageDto
{
public string OrderFlowCode { get; set; } = string.Empty;
public string OrderFlowName { get; set; } = string.Empty;
public string? OwnerDept { get; set; }
public int SortNo { get; set; }
public decimal PlannedDays { get; set; }
public decimal? ActualDays { get; set; }
public DateTime TargetAt { get; set; }
public DateTime? ActualStartAt { get; set; }
public DateTime? ActualEndAt { get; set; }
public string Status { get; set; } = string.Empty;
public decimal? NodeVarianceDays { get; set; }
public decimal? CumulativeVarianceDays { get; set; }
public List Substeps { get; set; } = new();
}
public class AdoS8OrderFlowSubstepDto
{
public string SubstepCode { get; set; } = string.Empty;
public string SubstepName { get; set; } = string.Empty;
public decimal PiHours { get; set; }
public decimal? ActualHours { get; set; }
public string Status { get; set; } = string.Empty;
public int SortNo { get; set; }
public List Units { get; set; } = new();
}
public class AdoS8OrderFlowSubstepUnitDto
{
public string UnitCode { get; set; } = string.Empty;
public string UnitName { get; set; } = string.Empty;
public decimal PiHours { get; set; }
public decimal? ActualHours { get; set; }
public string Status { get; set; } = string.Empty;
public int SortNo { get; set; }
}
#endregion
#region 订单 + 采购透视组合
public class AdoS8OrderFlowChainDto
{
public AdoS8OrderFlowOrderDetailDto Order { get; set; } = new();
public AdoS8OrderFlowProcurementPivotDto? ProcurementPivot { get; set; }
}
#endregion
#region 聚合 / Baseline
public class AdoS8OrderFlowAggregateQueryDto
{
public long? TenantId { get; set; }
public long? FactoryId { get; set; }
public string Scope { get; set; } = string.Empty;
public List? OrderCodes { get; set; }
}
public class AdoS8OrderFlowAggregateDto
{
public string Scope { get; set; } = string.Empty;
public int TotalOrders { get; set; }
public int TotalCustomers { get; set; }
public decimal AvgResponseMinutes { get; set; }
public decimal AvgProcessingMinutes { get; set; }
public decimal AvgLossMinutes { get; set; }
public List StageAggregates { get; set; } = new();
///
/// FINAL_ASSEMBLY_DELIVERY 末端协同聚合摘要(基线 / 当前两条路径均填充)。
/// 派生自 ado_s8_exception 现有异常类型,不新增业务表 / 不新增异常类型 / 不读 S0|S4 业务表。
/// 字段全 nullable,老调用方无感知。
///
public AdoS8FinalAssemblyCollabSummaryDto? FinalAssemblyCollabSummary { get; set; }
}
public class AdoS8FinalAssemblyCollabSummaryDto
{
/// 主门禁(GATE)—— key 为前端固定 object_code(如 GOODS_HANDOVER / SHIPMENT_CONFIRMATION)。无映射的门禁不出现在字典中。
public Dictionary Gates { get; set; } = new();
/// 并行准备(PARALLEL)—— key 为前端固定 object_code(如 SHIPPING_PLAN)。无映射的准备项不出现在字典中。
public Dictionary Parallels { get; set; } = new();
}
public class AdoS8FinalAssemblyObjectStatDto
{
/// 主门禁口径下的"影响订单"数 = 命中候选异常类型的去重 RelatedObjectCode 数;并行准备口径下保持 null。
public int? ImpactedOrderCount { get; set; }
/// 并行准备口径下的"风险订单"数 = 命中候选异常类型的去重 RelatedObjectCode 数;主门禁口径下保持 null。
public int? RiskOrderCount { get; set; }
/// 主要风险标题:候选异常中按 Severity(SERIOUS 优先) → CreatedAt(降序) 取首条 Title。无命中保持 null。
public string? TopRiskTitle { get; set; }
/// 主要风险严重度:与 TopRiskTitle 来自同一条异常。无命中保持 null。
public string? TopRiskSeverity { get; set; }
}
public class AdoS8OrderFlowStageAggregateDto
{
public string OrderFlowCode { get; set; } = string.Empty;
public string OrderFlowName { get; set; } = string.Empty;
public decimal KpiAvgDays { get; set; }
public decimal ActualAvgDays { get; set; }
/// 整数百分比(例如 59 / 96 / 85 / 89 / 96),不是 0.59 小数。
public int OnTimeRate { get; set; }
public int Green { get; set; }
public int Yellow { get; set; }
public int Red { get; set; }
public int Pending { get; set; }
}
#endregion
#region 采购透视
public class AdoS8OrderFlowProcurementPivotQueryDto
{
public long? TenantId { get; set; }
public long? FactoryId { get; set; }
public string Scope { get; set; } = string.Empty;
///
/// 订单编码 CSV(与产品设计 drawings API 对齐)。
/// 例如:单订单 "SO-2026-001";多订单 "SO-2026-001,SO-2026-002,SO-2026-006"。
/// 与 axios 默认 brackets 序列化不兼容,统一用 CSV 字符串避免 ASP.NET Core List 绑定二义性。
///
public string? OrderCodes { get; set; }
}
public class AdoS8OrderFlowProcurementPivotDto
{
public string Scope { get; set; } = string.Empty;
public List KeyMaterials { get; set; } = new();
public List SupplierBreakdown { get; set; } = new();
public List SpecBreakdown { get; set; } = new();
public Dictionary> MatrixByMaterial { get; set; } = new();
}
public class AdoS8OrderFlowKeyMaterialDto
{
public string MaterialCode { get; set; } = string.Empty;
public decimal AvgCycleDays { get; set; }
public string CycleStatus { get; set; } = string.Empty;
public int? ImpactCount { get; set; }
public decimal? KitRate { get; set; }
public string ResultStatus { get; set; } = string.Empty;
}
public class AdoS8OrderFlowSupplierBreakdownDto
{
public string MaterialCode { get; set; } = string.Empty;
public string SupplierCode { get; set; } = string.Empty;
public decimal AvgCycleDays { get; set; }
public string Status { get; set; } = string.Empty;
}
public class AdoS8OrderFlowSpecBreakdownDto
{
public string MaterialCode { get; set; } = string.Empty;
public string SpecCode { get; set; } = string.Empty;
public decimal AvgCycleDays { get; set; }
public string Status { get; set; } = string.Empty;
}
public class AdoS8OrderFlowProcurementMatrixRowDto
{
public string SupplierCode { get; set; } = string.Empty;
public Dictionary Cells { get; set; } = new();
}
public class AdoS8OrderFlowProcurementMatrixCellDto
{
public decimal CycleDays { get; set; }
public string Status { get; set; } = string.Empty;
}
#endregion
#region 关联异常
public class AdoS8OrderFlowRelatedExceptionQueryDto
{
public long? TenantId { get; set; }
public long? FactoryId { get; set; }
public string OrderCode { get; set; } = string.Empty;
public string? OrderFlowCode { get; set; }
}
#endregion
#region 产品设计图号
///
/// S8-ORDER-CHAIN-PRODUCT-DESIGN-DRAWING-PERSIST-1:产品设计图号查询入参。
/// orderCodes 为空 → 默认聚合全 20 单(scope=BASELINE_PPT);
/// orderCodes 非空 → 仅命中订单范围聚合(scope=CURRENT_FILTERED)。
/// productType 仅过滤 drawings 列表,不改变 summary.categories 的"常规/非标/合计"三档结构。
///
public class AdoS8OrderFlowProductDesignDrawingsQueryDto
{
public long? TenantId { get; set; }
public long? FactoryId { get; set; }
/// 逗号分隔订单号;为空时默认全 20 单。
public string? OrderCodes { get; set; }
/// STANDARD / NON_STANDARD;为空时返回全量并保留三档汇总。
public string? ProductType { get; set; }
}
/// 查询条件回显,便于前端固定下钻状态。
public class AdoS8OrderFlowProductDesignFilterDto
{
public List OrderCodes { get; set; } = new();
public string? ProductType { get; set; }
}
public class AdoS8OrderFlowProductDesignDrawingItemDto
{
public string OrderCode { get; set; } = string.Empty;
public string DrawingNo { get; set; } = string.Empty;
/// STANDARD / NON_STANDARD。
public string ProductType { get; set; } = string.Empty;
/// 责任单位/岗位(研发中心 / 结构设计组 / 电气设计组 / 工艺设计组 / 设计审核组)。
public string ResponsiblePerson { get; set; } = string.Empty;
public DateTime PlannedStartDate { get; set; }
public DateTime PlannedEndDate { get; set; }
public DateTime? ActualStartDate { get; set; }
public DateTime? ActualEndDate { get; set; }
public decimal KpiDays { get; set; }
public decimal? ActualDays { get; set; }
public bool IsAchieved { get; set; }
/// green / yellow / red / pending。
public string Status { get; set; } = string.Empty;
/// 该图号对应台数;台数/占比/加权达成率三种口径的唯一来源。
public int ProductQuantity { get; set; }
}
public class AdoS8OrderFlowProductDesignOverallSummaryDto
{
public int DrawingCount { get; set; }
public int TotalQuantity { get; set; }
public decimal KpiDays { get; set; }
/// 图号 actual_days 算术平均(非加权),保留小数原值,由前端格式化为 2 位。
public decimal AvgActualDays { get; set; }
/// 按 product_quantity 加权达标率,小数 0~1,由前端格式化为整数百分比。
public decimal AchievementRate { get; set; }
}
public class AdoS8OrderFlowProductDesignCategorySummaryDto
{
/// STANDARD / NON_STANDARD / TOTAL。
public string ProductType { get; set; } = string.Empty;
public string Name { get; set; } = string.Empty;
public int DrawingCount { get; set; }
public int TotalQuantity { get; set; }
/// product_quantity 占合计比例,小数 0~1,由前端格式化为 1 位百分比。
public decimal Ratio { get; set; }
/// S8-ORDER-CHAIN-PRODUCT-DESIGN-PPT-STATIC-AND-SINGLE-ORDER-ALIGN-1:常规/合计返回 null,前端展示 --;非标返回真实平均设计周期。
public decimal? AvgActualDays { get; set; }
/// 常规/合计返回 null,前端展示 --;非标返回 3 天 PRODUCT_DESIGN 阶段 KPI。
public decimal? KpiDays { get; set; }
/// 常规/合计返回 null,前端展示 --;非标返回加权达成率。
public decimal? AchievementRate { get; set; }
/// green / yellow / red / ''(空 = 无数据,前端展示 --)。由 achievement_rate 分档得出,不再二次判定。
public string Status { get; set; } = string.Empty;
}
public class AdoS8OrderFlowProductDesignSummaryDto
{
public AdoS8OrderFlowProductDesignOverallSummaryDto Overall { get; set; } = new();
public List Categories { get; set; } = new();
}
public class AdoS8OrderFlowProductDesignDrawingsDto
{
/// BASELINE_PPT(默认全 20 单)/ CURRENT_FILTERED(命中订单子集)。
public string Scope { get; set; } = string.Empty;
public AdoS8OrderFlowProductDesignFilterDto Filter { get; set; } = new();
public AdoS8OrderFlowProductDesignSummaryDto Summary { get; set; } = new();
public List Drawings { get; set; } = new();
}
#endregion
#region 本体生产(设备制造) — S8-ORDER-CHAIN-BODY-PRODUCTION-ORDER-LEVEL-SEED-FIX-1
///
/// 本体生产「工序明细 / 损失因素 / 操作员表现」三表透视查询入参。
/// orderCodes CSV:与产品设计 drawings API、采购透视 API 对齐,避免 axios brackets 与 ASP.NET Core List 绑定二义性。
/// scope=BASELINE_PPT 时 orderCodes 忽略;scope=CURRENT_FILTERED 时 orderCodes 为空返回空骨架(不静默 fallback baseline)。
///
public class AdoS8OrderFlowManufacturingPivotQueryDto
{
public long? TenantId { get; set; }
public long? FactoryId { get; set; }
/// BASELINE_PPT | CURRENT_FILTERED
public string Scope { get; set; } = string.Empty;
/// 逗号分隔订单号;scope=CURRENT_FILTERED 时使用。
public string? OrderCodes { get; set; }
}
///
/// 工序明细行:P10 / P20 / P30 / P40 / TOTAL。
/// pi_days / actual_days 保留 decimal(6,3) 精度;plan_qty 在 TOTAL 行为 null。
/// achievement_rate 在 TOTAL 行 baseline 来自 fixture(0.9000)、订单级按 plan_qty 加权平均;其它行 baseline 复用。
///
public class AdoS8OrderFlowManufacturingProcessDto
{
public string ProcessCode { get; set; } = string.Empty;
public string ProcessName { get; set; } = string.Empty;
public decimal PiDays { get; set; }
public decimal ActualDays { get; set; }
public string CycleStatus { get; set; } = string.Empty;
public int? PlanQty { get; set; }
public decimal? AchievementRate { get; set; }
public string AchievementStatus { get; set; } = string.Empty;
public int SortNo { get; set; }
}
/// 损失因素行:MATERIAL / EQUIPMENT / QUALITY / EFFICIENCY / SUBTOTAL。
public class AdoS8OrderFlowManufacturingLossFactorDto
{
public string FactorCode { get; set; } = string.Empty;
public string FactorName { get; set; } = string.Empty;
public int? CountValue { get; set; }
public decimal? RatioPct { get; set; }
public decimal? LossHours { get; set; }
public int SortNo { get; set; }
}
/// 操作员表现行:OP_ZHANG / OP_LI / OP_WANG。
public class AdoS8OrderFlowManufacturingOperatorDto
{
public string OperatorCode { get; set; } = string.Empty;
public string OperatorName { get; set; } = string.Empty;
public decimal AvgHours { get; set; }
public string Status { get; set; } = string.Empty;
public int SortNo { get; set; }
}
/// 本体生产透视聚合结果:scope + 工序 / 损失 / 操作员 三组。
public class AdoS8OrderFlowManufacturingPivotDto
{
/// BASELINE_PPT | CURRENT_FILTERED
public string Scope { get; set; } = string.Empty;
public List Processes { get; set; } = new();
public List LossFactors { get; set; } = new();
public List Operators { get; set; } = new();
}
#endregion
#region 总装发货 — S8-ORDER-CHAIN-ASSEMBLY-DELIVERY-DATA-LINEAGE-AUDIT-1
///
/// 总装发货「主门禁里程碑 / 并行准备」透视查询入参。
/// orderCodes CSV:与本体生产 / 产品设计 / 采购透视 API 对齐,规避 axios brackets 与 ASP.NET Core List 绑定二义性。
/// scope=BASELINE_PPT 时 orderCodes 忽略;scope=CURRENT_FILTERED 时 orderCodes 为空返回空骨架(不静默 fallback baseline)。
/// 与既有 aggregate.finalAssemblyCollabSummary 通道独立:本 API 提供门禁 KPI / 实际 / 偏差 / 齐套率,
/// aggregate 仍保留异常派生通道作为补充。
///
public class AdoS8FinalAssemblyPivotQueryDto
{
public long? TenantId { get; set; }
public long? FactoryId { get; set; }
/// BASELINE_PPT | CURRENT_FILTERED
public string Scope { get; set; } = string.Empty;
/// 逗号分隔订单号;scope=CURRENT_FILTERED 时使用。
public string? OrderCodes { get; set; }
}
///
/// 主门禁里程碑行:ASSEMBLY_COMPLETION / QUALITY_RELEASE / PACKAGING_COMPLETION / GOODS_HANDOVER / SHIPMENT_CONFIRMATION。
/// planned_offset_days 为累计里程碑(0.6/1.2/1.8/2.4/3.0);末位 SHIPMENT_CONFIRMATION.actual_offset_days 守恒为 stage.actual_days。
/// pending 单不进入聚合结果。
///
public class AdoS8FinalAssemblyGateDto
{
public string GateCode { get; set; } = string.Empty;
public string GateName { get; set; } = string.Empty;
public decimal PlannedOffsetDays { get; set; }
public decimal? ActualOffsetDays { get; set; }
public decimal? VarianceDays { get; set; }
public string Status { get; set; } = string.Empty;
public int? ImpactedOrderCount { get; set; }
public int? RiskOrderCount { get; set; }
public string? TopRiskType { get; set; }
public string? TopRiskLabel { get; set; }
public string? OwnerSideText { get; set; }
public int SortNo { get; set; }
}
///
/// 并行准备行:PACKAGING_MATERIAL_PREP / LABEL_DOC_PREP / SHIPPING_PLAN / SHIPPING_DOC_PREP。
/// kitting_rate 取值 0.0000~1.0000;status 按 ≥0.95 green / ≥0.85 yellow / 否则 red 派生(seed 时固化,运行期不重判)。
///
public class AdoS8FinalAssemblyParallelDto
{
public string PrepCode { get; set; } = string.Empty;
public string PrepName { get; set; } = string.Empty;
public decimal? KittingRate { get; set; }
public string Status { get; set; } = string.Empty;
public int? ImpactedOrderCount { get; set; }
public int? RiskOrderCount { get; set; }
public string? TopRiskType { get; set; }
public string? TopRiskLabel { get; set; }
public string? OwnerSideText { get; set; }
public int SortNo { get; set; }
}
/// 总装发货透视聚合结果:scope + 5 门禁 + 4 并行准备。
public class AdoS8FinalAssemblyPivotDto
{
/// BASELINE_PPT | CURRENT_FILTERED
public string Scope { get; set; } = string.Empty;
public List Gates { get; set; } = new();
public List ParallelPreps { get; set; } = new();
}
#endregion