AdoS8OrderFlowDtos.cs 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584
  1. namespace Admin.NET.Plugin.AiDOP.Dto.S8.OrderFlow;
  2. /// <summary>
  3. /// ORDER-FLOW-S8-INTEGRATED-DOMAIN-RESET-1 t3a:S8 订单执行链路 DTO 契约。
  4. /// 仅定义类型,不携带业务常量 / 不引用 Entity / 不接 service 逻辑。
  5. /// 后续 t3b/t3c 切片负责 service + controller 把 DTO 接到 ado_s8_order_flow_* 与 ado_s8_exception 实时聚合。
  6. /// </summary>
  7. #region 订单档案
  8. public class AdoS8OrderFlowOrderQueryDto
  9. {
  10. public string? Keyword { get; set; }
  11. public string? CurrentFlowCode { get; set; }
  12. public string? CustomerCode { get; set; }
  13. public string? ProductLine { get; set; }
  14. public string? Region { get; set; }
  15. public string? WorkflowStatus { get; set; }
  16. public string? ScenarioCode { get; set; }
  17. }
  18. public class AdoS8OrderFlowOrderListItemDto
  19. {
  20. // ── REAL runtime(mdp_std_so)新增字段 ─────────────────────────────────────────────
  21. // SEED 路径(ado_s8_order_flow_*)不填这些,保持 null;REAL 路径不填 SEED 的周期/偏差字段。
  22. // 两条路径互不混用:靠 DataSource 区分(SEED / MDP_STD_SO)。
  23. /// <summary>
  24. /// 真实销售订单头 Id = <c>mdp_std_so.order_id</c> = <c>crm_seorder.Id</c>。
  25. /// <b>REAL runtime 的唯一订单身份</b>;SEED 路径为 null。
  26. /// 前端必须用它定位订单,禁止再用订单号文本或字符串拼接构造 id。
  27. /// </summary>
  28. public long? SalesOrderId { get; set; }
  29. /// <summary>真实销售订单号 = <c>mdp_std_so.order_no</c>。**仅展示 / 搜索**,不作主键。</summary>
  30. public string? OrderNo { get; set; }
  31. /// <summary>客户 Id(Header Authority)。</summary>
  32. public long? CustomerId { get; set; }
  33. /// <summary>下单日期(Header Authority)。</summary>
  34. public DateTime? OrderDate { get; set; }
  35. /// <summary>订单类型(Header Authority,源端为 int 域)。</summary>
  36. public int? OrderType { get; set; }
  37. /// <summary>订单状态 OPEN/CLOSED(Header Authority)。</summary>
  38. public string? OrderStatus { get; set; }
  39. /// <summary>流程状态(Header Authority)。</summary>
  40. public string? FlowState { get; set; }
  41. // ── 既有字段 ─────────────────────────────────────────────────────────────────────
  42. public string OrderCode { get; set; } = string.Empty;
  43. public string ProductName { get; set; } = string.Empty;
  44. public string ProductLine { get; set; } = string.Empty;
  45. public string CustomerCode { get; set; } = string.Empty;
  46. public string CustomerName { get; set; } = string.Empty;
  47. public string CustomerType { get; set; } = string.Empty;
  48. public string Region { get; set; } = string.Empty;
  49. public string Priority { get; set; } = string.Empty;
  50. public string WorkflowStatus { get; set; } = string.Empty;
  51. public string CurrentOrderFlowCode { get; set; } = string.Empty;
  52. public string CurrentOrderFlowName { get; set; } = string.Empty;
  53. public string CurrentStatus { get; set; } = string.Empty;
  54. /// <summary>SEED 的下达时间。REAL runtime 无对应 Authority → null(改用 <see cref="OrderDate"/>)。</summary>
  55. public DateTime? ReleaseAt { get; set; }
  56. /// <summary>SEED 的目标周期。**REAL runtime 必须为 null** —— 真实订单没有目标周期 Authority,不得回落 SEED。</summary>
  57. public decimal? TargetCycleDays { get; set; }
  58. public decimal? ActualCycleDays { get; set; }
  59. public decimal? CurrentCycleDays { get; set; }
  60. public decimal? NodeVarianceDays { get; set; }
  61. public decimal? CumulativeVarianceDays { get; set; }
  62. /// <summary>来自 ado_s8_exception 实时聚合(order 主档表无 exception_count 列)。</summary>
  63. public int ExceptionCount { get; set; }
  64. public string ExceptionStatus { get; set; } = string.Empty;
  65. public int? ResponseMinutes { get; set; }
  66. public int? ProcessingMinutes { get; set; }
  67. public int? TotalLossMinutes { get; set; }
  68. public string ScenarioCode { get; set; } = string.Empty;
  69. public string DataSource { get; set; } = string.Empty;
  70. }
  71. public class AdoS8OrderFlowOrderDetailDto : AdoS8OrderFlowOrderListItemDto
  72. {
  73. public List<AdoS8OrderFlowStageDto> Lifecycle { get; set; } = new();
  74. }
  75. #endregion
  76. #region 阶段 / L2 / L3
  77. public class AdoS8OrderFlowStageDto
  78. {
  79. public string OrderFlowCode { get; set; } = string.Empty;
  80. public string OrderFlowName { get; set; } = string.Empty;
  81. public string? OwnerDept { get; set; }
  82. public int SortNo { get; set; }
  83. /// <summary>SEED 的计划天数。REAL runtime 无 Authority → null。</summary>
  84. public decimal? PlannedDays { get; set; }
  85. /// <summary>SEED 的实际天数。REAL runtime 无 Authority → null。**不得把小时塞进这里**(它已被 KPI 反推逻辑占用)。</summary>
  86. public decimal? ActualDays { get; set; }
  87. /// <summary>SEED 的目标时间。REAL runtime 无 Authority → null。</summary>
  88. public DateTime? TargetAt { get; set; }
  89. public DateTime? ActualStartAt { get; set; }
  90. public DateTime? ActualEndAt { get; set; }
  91. /// <summary>
  92. /// 阶段实际耗时(小时)。REAL runtime 下 ORDER_REVIEW 取
  93. /// <c>dwd_order_review_kpi.actual_hours</c>;其余阶段与 SEED 路径为 null。
  94. /// <b>独立字段,绝不复用 <see cref="ActualDays"/></b>(单位与语义都不同)。
  95. /// </summary>
  96. public decimal? ActualHours { get; set; }
  97. /// <summary>
  98. /// Stage-1 KPI 计算状态:OK / NO_START / IN_PROGRESS / INVALID / INVALID_TIME_SEQUENCE。
  99. /// 仅 REAL runtime 的 ORDER_REVIEW 有值。
  100. /// </summary>
  101. public string? CalculationStatus { get; set; }
  102. public string Status { get; set; } = string.Empty;
  103. public decimal? NodeVarianceDays { get; set; }
  104. public decimal? CumulativeVarianceDays { get; set; }
  105. public List<AdoS8OrderFlowSubstepDto> Substeps { get; set; } = new();
  106. // ── 阶段数据态(通用,不是某个阶段专属)─────────────────────────────────────
  107. //
  108. // 起因:REAL runtime 下 Status 恒为 "pending",前端只能按「有没有时间」细分标签。
  109. // 对没有时间 Authority 的阶段(如材料采购),这会把「已经有真实在办数据」
  110. // 说成「未到达」—— 与同页详情直接矛盾。下面四个字段让阶段能在不伪造时间的前提下
  111. // 如实表达自己有多少可信数据。仅有 REAL Authority 的阶段填,其余保持 null。
  112. /// <summary>
  113. /// 阶段数据态:<c>NO_DATA</c>(无可归属对象)/ <c>IN_PROGRESS</c>(有可归属对象)/
  114. /// <c>UNKNOWN</c>(取数失败,技术故障不得当业务结论)。
  115. /// <para><b>刻意没有 COMPLETED</b>:现有 Authority 只覆盖「能可靠归属到该订单的对象」,
  116. /// 不是该阶段的完整需求集合,据此宣称阶段完成会是错的。</para>
  117. /// </summary>
  118. public string? DataState { get; set; }
  119. /// <summary>数据范围,如 <c>ATTRIBUTED_ONLY</c>。消费方据此避免把子集当全集。</summary>
  120. public string? DataScope { get; set; }
  121. /// <summary>该阶段已可靠归属到本订单的对象数(材料采购 = 已归属采购行数)。</summary>
  122. public int? KnownItemCount { get; set; }
  123. /// <summary>上述对象中已完成的数量(材料采购 = 采购已完成行数)。</summary>
  124. public int? CompletedItemCount { get; set; }
  125. }
  126. /// <summary>
  127. /// 阶段数据态取值。
  128. ///
  129. /// <para><b>这里没有、也不会有 <c>COMPLETED</c>。</b>现有 Authority 只覆盖「能可靠归属到该订单的
  130. /// 对象」(<see cref="AdoS8OrderFlowStageDto.DataScope"/> = <c>ATTRIBUTED_ONLY</c>),
  131. /// 不是该阶段的完整需求集合。即便已归属对象全部完成,也推不出「该阶段已完成」——
  132. /// 那要等完整需求集合的 Authority 建立之后才谈得上。谁想加 COMPLETED,先拿出那个 Authority。</para>
  133. /// </summary>
  134. public static class AdoS8StageDataState
  135. {
  136. /// <summary>有可归属对象(在办)。</summary>
  137. public const string InProgress = "IN_PROGRESS";
  138. /// <summary>无可归属对象。注意是「没查到」,不是「不需要」。</summary>
  139. public const string NoData = "NO_DATA";
  140. /// <summary>取数失败。技术故障,不得渲染成任何业务结论。</summary>
  141. public const string Unknown = "UNKNOWN";
  142. }
  143. public class AdoS8OrderFlowSubstepDto
  144. {
  145. public string SubstepCode { get; set; } = string.Empty;
  146. public string SubstepName { get; set; } = string.Empty;
  147. public decimal PiHours { get; set; }
  148. public decimal? ActualHours { get; set; }
  149. public string Status { get; set; } = string.Empty;
  150. public int SortNo { get; set; }
  151. public List<AdoS8OrderFlowSubstepUnitDto> Units { get; set; } = new();
  152. }
  153. public class AdoS8OrderFlowSubstepUnitDto
  154. {
  155. public string UnitCode { get; set; } = string.Empty;
  156. public string UnitName { get; set; } = string.Empty;
  157. public decimal PiHours { get; set; }
  158. public decimal? ActualHours { get; set; }
  159. public string Status { get; set; } = string.Empty;
  160. public int SortNo { get; set; }
  161. }
  162. #endregion
  163. #region 订单 + 采购透视组合
  164. public class AdoS8OrderFlowChainDto
  165. {
  166. public AdoS8OrderFlowOrderDetailDto Order { get; set; } = new();
  167. public AdoS8OrderFlowProcurementPivotDto? ProcurementPivot { get; set; }
  168. }
  169. #endregion
  170. #region 聚合 / Baseline
  171. public class AdoS8OrderFlowAggregateQueryDto
  172. {
  173. public string Scope { get; set; } = string.Empty;
  174. /// <summary>
  175. /// S8-STEP5B-P2-FILTER-SUBSET-CERT-1:订单编码 CSV,与 procurement / manufacturing /
  176. /// final-assembly / drawings 四个 pivot DTO 的 OrderCodes 口径统一(服务侧走 ParseOrderCodesCsv)。
  177. /// 原类型是 <c>List&lt;string&gt;?</c>——aggregate 是唯一没跟上该约定的端点。实测:
  178. /// <c>orderCodes=SO-001,SO-002</c> 被默认集合绑定器绑成 **单元素** <c>["SO-001,SO-002"]</c>,
  179. /// 与任何 order_code 都不相等 → totalOrders=0(静默返回空聚合,而非报错);
  180. /// <c>orderCodes[]=X</c> 则整体绑不上 → 静默退回全量。两种失败都不会暴露为 4xx/5xx。
  181. /// </summary>
  182. public string? OrderCodes { get; set; }
  183. }
  184. public class AdoS8OrderFlowAggregateDto
  185. {
  186. public string Scope { get; set; } = string.Empty;
  187. public int TotalOrders { get; set; }
  188. public int TotalCustomers { get; set; }
  189. public decimal AvgResponseMinutes { get; set; }
  190. public decimal AvgProcessingMinutes { get; set; }
  191. public decimal AvgLossMinutes { get; set; }
  192. public List<AdoS8OrderFlowStageAggregateDto> StageAggregates { get; set; } = new();
  193. /// <summary>
  194. /// FINAL_ASSEMBLY_DELIVERY 末端协同聚合摘要(基线 / 当前两条路径均填充)。
  195. /// 派生自 ado_s8_exception 现有异常类型,不新增业务表 / 不新增异常类型 / 不读 S0|S4 业务表。
  196. /// 字段全 nullable,老调用方无感知。
  197. /// </summary>
  198. public AdoS8FinalAssemblyCollabSummaryDto? FinalAssemblyCollabSummary { get; set; }
  199. }
  200. public class AdoS8FinalAssemblyCollabSummaryDto
  201. {
  202. /// <summary>主门禁(GATE)—— key 为前端固定 object_code(如 GOODS_HANDOVER / SHIPMENT_CONFIRMATION)。无映射的门禁不出现在字典中。</summary>
  203. public Dictionary<string, AdoS8FinalAssemblyObjectStatDto> Gates { get; set; } = new();
  204. /// <summary>并行准备(PARALLEL)—— key 为前端固定 object_code(如 SHIPPING_PLAN)。无映射的准备项不出现在字典中。</summary>
  205. public Dictionary<string, AdoS8FinalAssemblyObjectStatDto> Parallels { get; set; } = new();
  206. }
  207. public class AdoS8FinalAssemblyObjectStatDto
  208. {
  209. /// <summary>主门禁口径下的"影响订单"数 = 命中候选异常类型的去重 RelatedObjectCode 数;并行准备口径下保持 null。</summary>
  210. public int? ImpactedOrderCount { get; set; }
  211. /// <summary>并行准备口径下的"风险订单"数 = 命中候选异常类型的去重 RelatedObjectCode 数;主门禁口径下保持 null。</summary>
  212. public int? RiskOrderCount { get; set; }
  213. /// <summary>主要风险标题:候选异常中按 Severity(SERIOUS 优先) → CreatedAt(降序) 取首条 Title。无命中保持 null。</summary>
  214. public string? TopRiskTitle { get; set; }
  215. /// <summary>主要风险严重度:与 TopRiskTitle 来自同一条异常。无命中保持 null。</summary>
  216. public string? TopRiskSeverity { get; set; }
  217. }
  218. public class AdoS8OrderFlowStageAggregateDto
  219. {
  220. public string OrderFlowCode { get; set; } = string.Empty;
  221. public string OrderFlowName { get; set; } = string.Empty;
  222. public decimal KpiAvgDays { get; set; }
  223. public decimal ActualAvgDays { get; set; }
  224. /// <summary>整数百分比(例如 59 / 96 / 85 / 89 / 96),不是 0.59 小数。</summary>
  225. public int OnTimeRate { get; set; }
  226. public int Green { get; set; }
  227. public int Yellow { get; set; }
  228. public int Red { get; set; }
  229. public int Pending { get; set; }
  230. }
  231. #endregion
  232. #region 采购透视
  233. public class AdoS8OrderFlowProcurementPivotQueryDto
  234. {
  235. public string Scope { get; set; } = string.Empty;
  236. /// <summary>
  237. /// 订单编码 CSV(与产品设计 drawings API 对齐)。
  238. /// 例如:单订单 "SO-2026-001";多订单 "SO-2026-001,SO-2026-002,SO-2026-006"。
  239. /// 与 axios 默认 brackets 序列化不兼容,统一用 CSV 字符串避免 ASP.NET Core List 绑定二义性。
  240. /// </summary>
  241. public string? OrderCodes { get; set; }
  242. }
  243. public class AdoS8OrderFlowProcurementPivotDto
  244. {
  245. public string Scope { get; set; } = string.Empty;
  246. public List<AdoS8OrderFlowKeyMaterialDto> KeyMaterials { get; set; } = new();
  247. public List<AdoS8OrderFlowSupplierBreakdownDto> SupplierBreakdown { get; set; } = new();
  248. public List<AdoS8OrderFlowSpecBreakdownDto> SpecBreakdown { get; set; } = new();
  249. public Dictionary<string, List<AdoS8OrderFlowProcurementMatrixRowDto>> MatrixByMaterial { get; set; } = new();
  250. }
  251. public class AdoS8OrderFlowKeyMaterialDto
  252. {
  253. public string MaterialCode { get; set; } = string.Empty;
  254. public decimal AvgCycleDays { get; set; }
  255. public string CycleStatus { get; set; } = string.Empty;
  256. public int? ImpactCount { get; set; }
  257. public decimal? KitRate { get; set; }
  258. public string ResultStatus { get; set; } = string.Empty;
  259. }
  260. public class AdoS8OrderFlowSupplierBreakdownDto
  261. {
  262. public string MaterialCode { get; set; } = string.Empty;
  263. public string SupplierCode { get; set; } = string.Empty;
  264. public decimal AvgCycleDays { get; set; }
  265. public string Status { get; set; } = string.Empty;
  266. }
  267. public class AdoS8OrderFlowSpecBreakdownDto
  268. {
  269. public string MaterialCode { get; set; } = string.Empty;
  270. public string SpecCode { get; set; } = string.Empty;
  271. public decimal AvgCycleDays { get; set; }
  272. public string Status { get; set; } = string.Empty;
  273. }
  274. public class AdoS8OrderFlowProcurementMatrixRowDto
  275. {
  276. public string SupplierCode { get; set; } = string.Empty;
  277. public Dictionary<string, AdoS8OrderFlowProcurementMatrixCellDto> Cells { get; set; } = new();
  278. }
  279. public class AdoS8OrderFlowProcurementMatrixCellDto
  280. {
  281. public decimal CycleDays { get; set; }
  282. public string Status { get; set; } = string.Empty;
  283. }
  284. #endregion
  285. #region 关联异常
  286. public class AdoS8OrderFlowRelatedExceptionQueryDto
  287. {
  288. public string OrderCode { get; set; } = string.Empty;
  289. public string? OrderFlowCode { get; set; }
  290. }
  291. #endregion
  292. #region 产品设计图号
  293. /// <summary>
  294. /// S8-ORDER-CHAIN-PRODUCT-DESIGN-DRAWING-PERSIST-1:产品设计图号查询入参。
  295. /// orderCodes 为空 → 默认聚合全 20 单(scope=BASELINE_PPT);
  296. /// orderCodes 非空 → 仅命中订单范围聚合(scope=CURRENT_FILTERED)。
  297. /// productType 仅过滤 drawings 列表,不改变 summary.categories 的"常规/非标/合计"三档结构。
  298. /// </summary>
  299. public class AdoS8OrderFlowProductDesignDrawingsQueryDto
  300. {
  301. /// <summary>逗号分隔订单号;为空时默认全 20 单。</summary>
  302. public string? OrderCodes { get; set; }
  303. /// <summary>STANDARD / NON_STANDARD;为空时返回全量并保留三档汇总。</summary>
  304. public string? ProductType { get; set; }
  305. }
  306. /// <summary>查询条件回显,便于前端固定下钻状态。</summary>
  307. public class AdoS8OrderFlowProductDesignFilterDto
  308. {
  309. public List<string> OrderCodes { get; set; } = new();
  310. public string? ProductType { get; set; }
  311. }
  312. public class AdoS8OrderFlowProductDesignDrawingItemDto
  313. {
  314. public string OrderCode { get; set; } = string.Empty;
  315. public string DrawingNo { get; set; } = string.Empty;
  316. /// <summary>STANDARD / NON_STANDARD。</summary>
  317. public string ProductType { get; set; } = string.Empty;
  318. /// <summary>责任单位/岗位(研发中心 / 结构设计组 / 电气设计组 / 工艺设计组 / 设计审核组)。</summary>
  319. public string ResponsiblePerson { get; set; } = string.Empty;
  320. public DateTime PlannedStartDate { get; set; }
  321. public DateTime PlannedEndDate { get; set; }
  322. public DateTime? ActualStartDate { get; set; }
  323. public DateTime? ActualEndDate { get; set; }
  324. public decimal KpiDays { get; set; }
  325. public decimal? ActualDays { get; set; }
  326. public bool IsAchieved { get; set; }
  327. /// <summary>green / yellow / red / pending。</summary>
  328. public string Status { get; set; } = string.Empty;
  329. /// <summary>该图号对应台数;台数/占比/加权达成率三种口径的唯一来源。</summary>
  330. public int ProductQuantity { get; set; }
  331. }
  332. public class AdoS8OrderFlowProductDesignOverallSummaryDto
  333. {
  334. public int DrawingCount { get; set; }
  335. public int TotalQuantity { get; set; }
  336. public decimal KpiDays { get; set; }
  337. /// <summary>图号 actual_days 算术平均(非加权),保留小数原值,由前端格式化为 2 位。</summary>
  338. public decimal AvgActualDays { get; set; }
  339. /// <summary>按 product_quantity 加权达标率,小数 0~1,由前端格式化为整数百分比。</summary>
  340. public decimal AchievementRate { get; set; }
  341. }
  342. public class AdoS8OrderFlowProductDesignCategorySummaryDto
  343. {
  344. /// <summary>STANDARD / NON_STANDARD / TOTAL。</summary>
  345. public string ProductType { get; set; } = string.Empty;
  346. public string Name { get; set; } = string.Empty;
  347. public int DrawingCount { get; set; }
  348. public int TotalQuantity { get; set; }
  349. /// <summary>product_quantity 占合计比例,小数 0~1,由前端格式化为 1 位百分比。</summary>
  350. public decimal Ratio { get; set; }
  351. /// <summary>S8-ORDER-CHAIN-PRODUCT-DESIGN-PPT-STATIC-AND-SINGLE-ORDER-ALIGN-1:常规/合计返回 null,前端展示 --;非标返回真实平均设计周期。</summary>
  352. public decimal? AvgActualDays { get; set; }
  353. /// <summary>常规/合计返回 null,前端展示 --;非标返回 3 天 PRODUCT_DESIGN 阶段 KPI。</summary>
  354. public decimal? KpiDays { get; set; }
  355. /// <summary>常规/合计返回 null,前端展示 --;非标返回加权达成率。</summary>
  356. public decimal? AchievementRate { get; set; }
  357. /// <summary>green / yellow / red / ''(空 = 无数据,前端展示 --)。由 achievement_rate 分档得出,不再二次判定。</summary>
  358. public string Status { get; set; } = string.Empty;
  359. }
  360. public class AdoS8OrderFlowProductDesignSummaryDto
  361. {
  362. public AdoS8OrderFlowProductDesignOverallSummaryDto Overall { get; set; } = new();
  363. public List<AdoS8OrderFlowProductDesignCategorySummaryDto> Categories { get; set; } = new();
  364. }
  365. public class AdoS8OrderFlowProductDesignDrawingsDto
  366. {
  367. /// <summary>BASELINE_PPT(默认全 20 单)/ CURRENT_FILTERED(命中订单子集)。</summary>
  368. public string Scope { get; set; } = string.Empty;
  369. public AdoS8OrderFlowProductDesignFilterDto Filter { get; set; } = new();
  370. public AdoS8OrderFlowProductDesignSummaryDto Summary { get; set; } = new();
  371. public List<AdoS8OrderFlowProductDesignDrawingItemDto> Drawings { get; set; } = new();
  372. }
  373. #endregion
  374. #region 本体生产(设备制造) — S8-ORDER-CHAIN-BODY-PRODUCTION-ORDER-LEVEL-SEED-FIX-1
  375. /// <summary>
  376. /// 本体生产「工序明细 / 损失因素 / 操作员表现」三表透视查询入参。
  377. /// orderCodes CSV:与产品设计 drawings API、采购透视 API 对齐,避免 axios brackets 与 ASP.NET Core List 绑定二义性。
  378. /// scope=BASELINE_PPT 时 orderCodes 忽略;scope=CURRENT_FILTERED 时 orderCodes 为空返回空骨架(不静默 fallback baseline)。
  379. /// </summary>
  380. public class AdoS8OrderFlowManufacturingPivotQueryDto
  381. {
  382. /// <summary>BASELINE_PPT | CURRENT_FILTERED</summary>
  383. public string Scope { get; set; } = string.Empty;
  384. /// <summary>逗号分隔订单号;scope=CURRENT_FILTERED 时使用。</summary>
  385. public string? OrderCodes { get; set; }
  386. }
  387. /// <summary>
  388. /// 工序明细行:P10 / P20 / P30 / P40 / TOTAL。
  389. /// pi_days / actual_days 保留 decimal(6,3) 精度;plan_qty 在 TOTAL 行为 null。
  390. /// achievement_rate 在 TOTAL 行 baseline 来自 fixture(0.9000)、订单级按 plan_qty 加权平均;其它行 baseline 复用。
  391. /// </summary>
  392. public class AdoS8OrderFlowManufacturingProcessDto
  393. {
  394. public string ProcessCode { get; set; } = string.Empty;
  395. public string ProcessName { get; set; } = string.Empty;
  396. public decimal PiDays { get; set; }
  397. public decimal ActualDays { get; set; }
  398. public string CycleStatus { get; set; } = string.Empty;
  399. public int? PlanQty { get; set; }
  400. public decimal? AchievementRate { get; set; }
  401. public string AchievementStatus { get; set; } = string.Empty;
  402. public int SortNo { get; set; }
  403. }
  404. /// <summary>损失因素行:MATERIAL / EQUIPMENT / QUALITY / EFFICIENCY / SUBTOTAL。</summary>
  405. public class AdoS8OrderFlowManufacturingLossFactorDto
  406. {
  407. public string FactorCode { get; set; } = string.Empty;
  408. public string FactorName { get; set; } = string.Empty;
  409. public int? CountValue { get; set; }
  410. public decimal? RatioPct { get; set; }
  411. public decimal? LossHours { get; set; }
  412. public int SortNo { get; set; }
  413. }
  414. /// <summary>操作员表现行:OP_ZHANG / OP_LI / OP_WANG。</summary>
  415. public class AdoS8OrderFlowManufacturingOperatorDto
  416. {
  417. public string OperatorCode { get; set; } = string.Empty;
  418. public string OperatorName { get; set; } = string.Empty;
  419. public decimal AvgHours { get; set; }
  420. public string Status { get; set; } = string.Empty;
  421. public int SortNo { get; set; }
  422. }
  423. /// <summary>本体生产透视聚合结果:scope + 工序 / 损失 / 操作员 三组。</summary>
  424. public class AdoS8OrderFlowManufacturingPivotDto
  425. {
  426. /// <summary>BASELINE_PPT | CURRENT_FILTERED</summary>
  427. public string Scope { get; set; } = string.Empty;
  428. public List<AdoS8OrderFlowManufacturingProcessDto> Processes { get; set; } = new();
  429. public List<AdoS8OrderFlowManufacturingLossFactorDto> LossFactors { get; set; } = new();
  430. public List<AdoS8OrderFlowManufacturingOperatorDto> Operators { get; set; } = new();
  431. }
  432. #endregion
  433. #region 总装发货 — S8-ORDER-CHAIN-ASSEMBLY-DELIVERY-DATA-LINEAGE-AUDIT-1
  434. /// <summary>
  435. /// 总装发货「主门禁里程碑 / 并行准备」透视查询入参。
  436. /// orderCodes CSV:与本体生产 / 产品设计 / 采购透视 API 对齐,规避 axios brackets 与 ASP.NET Core List 绑定二义性。
  437. /// scope=BASELINE_PPT 时 orderCodes 忽略;scope=CURRENT_FILTERED 时 orderCodes 为空返回空骨架(不静默 fallback baseline)。
  438. /// 与既有 aggregate.finalAssemblyCollabSummary 通道独立:本 API 提供门禁 KPI / 实际 / 偏差 / 齐套率,
  439. /// aggregate 仍保留异常派生通道作为补充。
  440. /// </summary>
  441. public class AdoS8FinalAssemblyPivotQueryDto
  442. {
  443. /// <summary>BASELINE_PPT | CURRENT_FILTERED</summary>
  444. public string Scope { get; set; } = string.Empty;
  445. /// <summary>逗号分隔订单号;scope=CURRENT_FILTERED 时使用。</summary>
  446. public string? OrderCodes { get; set; }
  447. }
  448. /// <summary>
  449. /// 主门禁里程碑行:ASSEMBLY_COMPLETION / QUALITY_RELEASE / PACKAGING_COMPLETION / GOODS_HANDOVER / SHIPMENT_CONFIRMATION。
  450. /// planned_offset_days 为累计里程碑(0.6/1.2/1.8/2.4/3.0);末位 SHIPMENT_CONFIRMATION.actual_offset_days 守恒为 stage.actual_days。
  451. /// pending 单不进入聚合结果。
  452. /// </summary>
  453. public class AdoS8FinalAssemblyGateDto
  454. {
  455. public string GateCode { get; set; } = string.Empty;
  456. public string GateName { get; set; } = string.Empty;
  457. public decimal PlannedOffsetDays { get; set; }
  458. public decimal? ActualOffsetDays { get; set; }
  459. public decimal? VarianceDays { get; set; }
  460. public string Status { get; set; } = string.Empty;
  461. public int? ImpactedOrderCount { get; set; }
  462. public int? RiskOrderCount { get; set; }
  463. public string? TopRiskType { get; set; }
  464. public string? TopRiskLabel { get; set; }
  465. public string? OwnerSideText { get; set; }
  466. public int SortNo { get; set; }
  467. }
  468. /// <summary>
  469. /// 并行准备行:PACKAGING_MATERIAL_PREP / LABEL_DOC_PREP / SHIPPING_PLAN / SHIPPING_DOC_PREP。
  470. /// kitting_rate 取值 0.0000~1.0000;status 按 ≥0.95 green / ≥0.85 yellow / 否则 red 派生(seed 时固化,运行期不重判)。
  471. /// </summary>
  472. public class AdoS8FinalAssemblyParallelDto
  473. {
  474. public string PrepCode { get; set; } = string.Empty;
  475. public string PrepName { get; set; } = string.Empty;
  476. public decimal? KittingRate { get; set; }
  477. public string Status { get; set; } = string.Empty;
  478. public int? ImpactedOrderCount { get; set; }
  479. public int? RiskOrderCount { get; set; }
  480. public string? TopRiskType { get; set; }
  481. public string? TopRiskLabel { get; set; }
  482. public string? OwnerSideText { get; set; }
  483. public int SortNo { get; set; }
  484. }
  485. /// <summary>总装发货透视聚合结果:scope + 5 门禁 + 4 并行准备。</summary>
  486. public class AdoS8FinalAssemblyPivotDto
  487. {
  488. /// <summary>BASELINE_PPT | CURRENT_FILTERED</summary>
  489. public string Scope { get; set; } = string.Empty;
  490. public List<AdoS8FinalAssemblyGateDto> Gates { get; set; } = new();
  491. public List<AdoS8FinalAssemblyParallelDto> ParallelPreps { get; set; } = new();
  492. }
  493. #endregion