AdoS8OrderFlowDtos.cs 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347
  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 long? TenantId { get; set; }
  11. public long? FactoryId { get; set; }
  12. public string? Keyword { get; set; }
  13. public string? CurrentFlowCode { get; set; }
  14. public string? CustomerCode { get; set; }
  15. public string? ProductLine { get; set; }
  16. public string? Region { get; set; }
  17. public string? WorkflowStatus { get; set; }
  18. public string? ScenarioCode { get; set; }
  19. }
  20. public class AdoS8OrderFlowOrderListItemDto
  21. {
  22. public string OrderCode { get; set; } = string.Empty;
  23. public string ProductName { get; set; } = string.Empty;
  24. public string ProductLine { get; set; } = string.Empty;
  25. public string CustomerCode { get; set; } = string.Empty;
  26. public string CustomerName { get; set; } = string.Empty;
  27. public string CustomerType { get; set; } = string.Empty;
  28. public string Region { get; set; } = string.Empty;
  29. public string Priority { get; set; } = string.Empty;
  30. public string WorkflowStatus { get; set; } = string.Empty;
  31. public string CurrentOrderFlowCode { get; set; } = string.Empty;
  32. public string CurrentOrderFlowName { get; set; } = string.Empty;
  33. public string CurrentStatus { get; set; } = string.Empty;
  34. public DateTime ReleaseAt { get; set; }
  35. public decimal TargetCycleDays { get; set; }
  36. public decimal? ActualCycleDays { get; set; }
  37. public decimal? CurrentCycleDays { get; set; }
  38. public decimal? NodeVarianceDays { get; set; }
  39. public decimal? CumulativeVarianceDays { get; set; }
  40. /// <summary>来自 ado_s8_exception 实时聚合(order 主档表无 exception_count 列)。</summary>
  41. public int ExceptionCount { get; set; }
  42. public string ExceptionStatus { get; set; } = string.Empty;
  43. public int? ResponseMinutes { get; set; }
  44. public int? ProcessingMinutes { get; set; }
  45. public int? TotalLossMinutes { get; set; }
  46. public string ScenarioCode { get; set; } = string.Empty;
  47. public string DataSource { get; set; } = string.Empty;
  48. }
  49. public class AdoS8OrderFlowOrderDetailDto : AdoS8OrderFlowOrderListItemDto
  50. {
  51. public List<AdoS8OrderFlowStageDto> Lifecycle { get; set; } = new();
  52. }
  53. #endregion
  54. #region 阶段 / L2 / L3
  55. public class AdoS8OrderFlowStageDto
  56. {
  57. public string OrderFlowCode { get; set; } = string.Empty;
  58. public string OrderFlowName { get; set; } = string.Empty;
  59. public string? OwnerDept { get; set; }
  60. public int SortNo { get; set; }
  61. public decimal PlannedDays { get; set; }
  62. public decimal? ActualDays { get; set; }
  63. public DateTime TargetAt { get; set; }
  64. public DateTime? ActualStartAt { get; set; }
  65. public DateTime? ActualEndAt { get; set; }
  66. public string Status { get; set; } = string.Empty;
  67. public decimal? NodeVarianceDays { get; set; }
  68. public decimal? CumulativeVarianceDays { get; set; }
  69. public List<AdoS8OrderFlowSubstepDto> Substeps { get; set; } = new();
  70. }
  71. public class AdoS8OrderFlowSubstepDto
  72. {
  73. public string SubstepCode { get; set; } = string.Empty;
  74. public string SubstepName { get; set; } = string.Empty;
  75. public decimal PiHours { get; set; }
  76. public decimal? ActualHours { get; set; }
  77. public string Status { get; set; } = string.Empty;
  78. public int SortNo { get; set; }
  79. public List<AdoS8OrderFlowSubstepUnitDto> Units { get; set; } = new();
  80. }
  81. public class AdoS8OrderFlowSubstepUnitDto
  82. {
  83. public string UnitCode { get; set; } = string.Empty;
  84. public string UnitName { get; set; } = string.Empty;
  85. public decimal PiHours { get; set; }
  86. public decimal? ActualHours { get; set; }
  87. public string Status { get; set; } = string.Empty;
  88. public int SortNo { get; set; }
  89. }
  90. #endregion
  91. #region 订单 + 采购透视组合
  92. public class AdoS8OrderFlowChainDto
  93. {
  94. public AdoS8OrderFlowOrderDetailDto Order { get; set; } = new();
  95. public AdoS8OrderFlowProcurementPivotDto? ProcurementPivot { get; set; }
  96. }
  97. #endregion
  98. #region 聚合 / Baseline
  99. public class AdoS8OrderFlowAggregateQueryDto
  100. {
  101. public long? TenantId { get; set; }
  102. public long? FactoryId { get; set; }
  103. public string Scope { get; set; } = string.Empty;
  104. public List<string>? OrderCodes { get; set; }
  105. }
  106. public class AdoS8OrderFlowAggregateDto
  107. {
  108. public string Scope { get; set; } = string.Empty;
  109. public int TotalOrders { get; set; }
  110. public int TotalCustomers { get; set; }
  111. public decimal AvgResponseMinutes { get; set; }
  112. public decimal AvgProcessingMinutes { get; set; }
  113. public decimal AvgLossMinutes { get; set; }
  114. public List<AdoS8OrderFlowStageAggregateDto> StageAggregates { get; set; } = new();
  115. /// <summary>
  116. /// FINAL_ASSEMBLY_DELIVERY 末端协同聚合摘要(基线 / 当前两条路径均填充)。
  117. /// 派生自 ado_s8_exception 现有异常类型,不新增业务表 / 不新增异常类型 / 不读 S0|S4 业务表。
  118. /// 字段全 nullable,老调用方无感知。
  119. /// </summary>
  120. public AdoS8FinalAssemblyCollabSummaryDto? FinalAssemblyCollabSummary { get; set; }
  121. }
  122. public class AdoS8FinalAssemblyCollabSummaryDto
  123. {
  124. /// <summary>主门禁(GATE)—— key 为前端固定 object_code(如 GOODS_HANDOVER / SHIPMENT_CONFIRMATION)。无映射的门禁不出现在字典中。</summary>
  125. public Dictionary<string, AdoS8FinalAssemblyObjectStatDto> Gates { get; set; } = new();
  126. /// <summary>并行准备(PARALLEL)—— key 为前端固定 object_code(如 SHIPPING_PLAN)。无映射的准备项不出现在字典中。</summary>
  127. public Dictionary<string, AdoS8FinalAssemblyObjectStatDto> Parallels { get; set; } = new();
  128. }
  129. public class AdoS8FinalAssemblyObjectStatDto
  130. {
  131. /// <summary>主门禁口径下的"影响订单"数 = 命中候选异常类型的去重 RelatedObjectCode 数;并行准备口径下保持 null。</summary>
  132. public int? ImpactedOrderCount { get; set; }
  133. /// <summary>并行准备口径下的"风险订单"数 = 命中候选异常类型的去重 RelatedObjectCode 数;主门禁口径下保持 null。</summary>
  134. public int? RiskOrderCount { get; set; }
  135. /// <summary>主要风险标题:候选异常中按 Severity(SERIOUS 优先) → CreatedAt(降序) 取首条 Title。无命中保持 null。</summary>
  136. public string? TopRiskTitle { get; set; }
  137. /// <summary>主要风险严重度:与 TopRiskTitle 来自同一条异常。无命中保持 null。</summary>
  138. public string? TopRiskSeverity { get; set; }
  139. }
  140. public class AdoS8OrderFlowStageAggregateDto
  141. {
  142. public string OrderFlowCode { get; set; } = string.Empty;
  143. public string OrderFlowName { get; set; } = string.Empty;
  144. public decimal KpiAvgDays { get; set; }
  145. public decimal ActualAvgDays { get; set; }
  146. /// <summary>整数百分比(例如 59 / 96 / 85 / 89 / 96),不是 0.59 小数。</summary>
  147. public int OnTimeRate { get; set; }
  148. public int Green { get; set; }
  149. public int Yellow { get; set; }
  150. public int Red { get; set; }
  151. public int Pending { get; set; }
  152. }
  153. #endregion
  154. #region 采购透视
  155. public class AdoS8OrderFlowProcurementPivotQueryDto
  156. {
  157. public long? TenantId { get; set; }
  158. public long? FactoryId { get; set; }
  159. public string Scope { get; set; } = string.Empty;
  160. public List<string>? OrderCodes { get; set; }
  161. }
  162. public class AdoS8OrderFlowProcurementPivotDto
  163. {
  164. public string Scope { get; set; } = string.Empty;
  165. public List<AdoS8OrderFlowKeyMaterialDto> KeyMaterials { get; set; } = new();
  166. public List<AdoS8OrderFlowSupplierBreakdownDto> SupplierBreakdown { get; set; } = new();
  167. public List<AdoS8OrderFlowSpecBreakdownDto> SpecBreakdown { get; set; } = new();
  168. public Dictionary<string, List<AdoS8OrderFlowProcurementMatrixRowDto>> MatrixByMaterial { get; set; } = new();
  169. }
  170. public class AdoS8OrderFlowKeyMaterialDto
  171. {
  172. public string MaterialCode { get; set; } = string.Empty;
  173. public decimal AvgCycleDays { get; set; }
  174. public string CycleStatus { get; set; } = string.Empty;
  175. public int? ImpactCount { get; set; }
  176. public decimal? KitRate { get; set; }
  177. public string ResultStatus { get; set; } = string.Empty;
  178. }
  179. public class AdoS8OrderFlowSupplierBreakdownDto
  180. {
  181. public string MaterialCode { get; set; } = string.Empty;
  182. public string SupplierCode { get; set; } = string.Empty;
  183. public decimal AvgCycleDays { get; set; }
  184. public string Status { get; set; } = string.Empty;
  185. }
  186. public class AdoS8OrderFlowSpecBreakdownDto
  187. {
  188. public string MaterialCode { get; set; } = string.Empty;
  189. public string SpecCode { get; set; } = string.Empty;
  190. public decimal AvgCycleDays { get; set; }
  191. public string Status { get; set; } = string.Empty;
  192. }
  193. public class AdoS8OrderFlowProcurementMatrixRowDto
  194. {
  195. public string SupplierCode { get; set; } = string.Empty;
  196. public Dictionary<string, AdoS8OrderFlowProcurementMatrixCellDto> Cells { get; set; } = new();
  197. }
  198. public class AdoS8OrderFlowProcurementMatrixCellDto
  199. {
  200. public decimal CycleDays { get; set; }
  201. public string Status { get; set; } = string.Empty;
  202. }
  203. #endregion
  204. #region 关联异常
  205. public class AdoS8OrderFlowRelatedExceptionQueryDto
  206. {
  207. public long? TenantId { get; set; }
  208. public long? FactoryId { get; set; }
  209. public string OrderCode { get; set; } = string.Empty;
  210. public string? OrderFlowCode { get; set; }
  211. }
  212. #endregion
  213. #region 产品设计图号
  214. /// <summary>
  215. /// S8-ORDER-CHAIN-PRODUCT-DESIGN-DRAWING-PERSIST-1:产品设计图号查询入参。
  216. /// orderCodes 为空 → 默认聚合全 20 单(scope=BASELINE_PPT);
  217. /// orderCodes 非空 → 仅命中订单范围聚合(scope=CURRENT_FILTERED)。
  218. /// productType 仅过滤 drawings 列表,不改变 summary.categories 的"常规/非标/合计"三档结构。
  219. /// </summary>
  220. public class AdoS8OrderFlowProductDesignDrawingsQueryDto
  221. {
  222. public long? TenantId { get; set; }
  223. public long? FactoryId { get; set; }
  224. /// <summary>逗号分隔订单号;为空时默认全 20 单。</summary>
  225. public string? OrderCodes { get; set; }
  226. /// <summary>STANDARD / NON_STANDARD;为空时返回全量并保留三档汇总。</summary>
  227. public string? ProductType { get; set; }
  228. }
  229. /// <summary>查询条件回显,便于前端固定下钻状态。</summary>
  230. public class AdoS8OrderFlowProductDesignFilterDto
  231. {
  232. public List<string> OrderCodes { get; set; } = new();
  233. public string? ProductType { get; set; }
  234. }
  235. public class AdoS8OrderFlowProductDesignDrawingItemDto
  236. {
  237. public string OrderCode { get; set; } = string.Empty;
  238. public string DrawingNo { get; set; } = string.Empty;
  239. /// <summary>STANDARD / NON_STANDARD。</summary>
  240. public string ProductType { get; set; } = string.Empty;
  241. /// <summary>责任单位/岗位(研发中心 / 结构设计组 / 电气设计组 / 工艺设计组 / 设计审核组)。</summary>
  242. public string ResponsiblePerson { get; set; } = string.Empty;
  243. public DateTime PlannedStartDate { get; set; }
  244. public DateTime PlannedEndDate { get; set; }
  245. public DateTime? ActualStartDate { get; set; }
  246. public DateTime? ActualEndDate { get; set; }
  247. public decimal KpiDays { get; set; }
  248. public decimal? ActualDays { get; set; }
  249. public bool IsAchieved { get; set; }
  250. /// <summary>green / yellow / red / pending。</summary>
  251. public string Status { get; set; } = string.Empty;
  252. /// <summary>该图号对应台数;台数/占比/加权达成率三种口径的唯一来源。</summary>
  253. public int ProductQuantity { get; set; }
  254. }
  255. public class AdoS8OrderFlowProductDesignOverallSummaryDto
  256. {
  257. public int DrawingCount { get; set; }
  258. public int TotalQuantity { get; set; }
  259. public decimal KpiDays { get; set; }
  260. /// <summary>图号 actual_days 算术平均(非加权),保留小数原值,由前端格式化为 2 位。</summary>
  261. public decimal AvgActualDays { get; set; }
  262. /// <summary>按 product_quantity 加权达标率,小数 0~1,由前端格式化为整数百分比。</summary>
  263. public decimal AchievementRate { get; set; }
  264. }
  265. public class AdoS8OrderFlowProductDesignCategorySummaryDto
  266. {
  267. /// <summary>STANDARD / NON_STANDARD / TOTAL。</summary>
  268. public string ProductType { get; set; } = string.Empty;
  269. public string Name { get; set; } = string.Empty;
  270. public int DrawingCount { get; set; }
  271. public int TotalQuantity { get; set; }
  272. /// <summary>product_quantity 占合计比例,小数 0~1,由前端格式化为 1 位百分比。</summary>
  273. public decimal Ratio { get; set; }
  274. /// <summary>S8-ORDER-CHAIN-PRODUCT-DESIGN-PPT-STATIC-AND-SINGLE-ORDER-ALIGN-1:常规/合计返回 null,前端展示 --;非标返回真实平均设计周期。</summary>
  275. public decimal? AvgActualDays { get; set; }
  276. /// <summary>常规/合计返回 null,前端展示 --;非标返回 3 天 PRODUCT_DESIGN 阶段 KPI。</summary>
  277. public decimal? KpiDays { get; set; }
  278. /// <summary>常规/合计返回 null,前端展示 --;非标返回加权达成率。</summary>
  279. public decimal? AchievementRate { get; set; }
  280. /// <summary>green / yellow / red / ''(空 = 无数据,前端展示 --)。由 achievement_rate 分档得出,不再二次判定。</summary>
  281. public string Status { get; set; } = string.Empty;
  282. }
  283. public class AdoS8OrderFlowProductDesignSummaryDto
  284. {
  285. public AdoS8OrderFlowProductDesignOverallSummaryDto Overall { get; set; } = new();
  286. public List<AdoS8OrderFlowProductDesignCategorySummaryDto> Categories { get; set; } = new();
  287. }
  288. public class AdoS8OrderFlowProductDesignDrawingsDto
  289. {
  290. /// <summary>BASELINE_PPT(默认全 20 单)/ CURRENT_FILTERED(命中订单子集)。</summary>
  291. public string Scope { get; set; } = string.Empty;
  292. public AdoS8OrderFlowProductDesignFilterDto Filter { get; set; } = new();
  293. public AdoS8OrderFlowProductDesignSummaryDto Summary { get; set; } = new();
  294. public List<AdoS8OrderFlowProductDesignDrawingItemDto> Drawings { get; set; } = new();
  295. }
  296. #endregion