|
|
@@ -1,17 +1,25 @@
|
|
|
// ORDER-FLOW-S8-INTEGRATED-DOMAIN-RESET-1 t3g:正式 API DTO → 旧 SalesOrderExecution 字段映射。
|
|
|
// t3h:补 lifecycle mapper + OrderFlowCode 大写到 OrderNodeKey 小写的协议翻译表。
|
|
|
-// Chain 页面暂不切换;总览页展开后五阶段对照表通过 loadDetailFromDomain 注入 lifecycle。
|
|
|
+// t3i:补 substep / unit mapper + chain detail(含 subSteps)lifecycle 映射 + aggregate → 旧 baseline snapshot 映射。
|
|
|
import { EXECUTION_OBSERVED_AT } from '/@/views/aidop/s8/monitoring/data/order-execution/customers';
|
|
|
import type {
|
|
|
OrderNodeKey,
|
|
|
SalesOrderExecution,
|
|
|
StageSnapshot,
|
|
|
+ SubStepDetail,
|
|
|
} from '/@/views/aidop/s8/monitoring/data/order-execution/types';
|
|
|
import type {
|
|
|
+ OrderFlowAggregate,
|
|
|
OrderFlowOrderDetail,
|
|
|
OrderFlowOrderListItem,
|
|
|
OrderFlowStage,
|
|
|
+ OrderFlowSubstep,
|
|
|
+ OrderFlowSubstepUnit,
|
|
|
} from '/@/views/aidop/s8/api/s8OrderFlowDomainApi';
|
|
|
+import type {
|
|
|
+ S8OrderFlowAggregateSnapshotDto,
|
|
|
+ S8OrderFlowStageSnapshotItem,
|
|
|
+} from '/@/views/aidop/s8/api/s8OrderFlowApi';
|
|
|
|
|
|
// 'YYYY-MM-DD HH:mm' → 'MM-DD HH:mm';'YYYY-MM-DD' → 'MM-DD'。与旧 store.mapStage 同义,复制以避免跨文件依赖。
|
|
|
function toMonthDayTime(s: string | null | undefined): string {
|
|
|
@@ -76,6 +84,76 @@ export function mapDomainOrderDetailLifecycle(detail: OrderFlowOrderDetail): Sta
|
|
|
return detail.lifecycle.map(mapDomainStage);
|
|
|
}
|
|
|
|
|
|
+// t3i:单 unit (责任单元) → 旧 SubStepDetail 叶子。breakdown 不再嵌套。
|
|
|
+export function mapDomainSubstepUnit(unit: OrderFlowSubstepUnit): SubStepDetail {
|
|
|
+ return {
|
|
|
+ name: unit.unitName,
|
|
|
+ piHours: unit.piHours,
|
|
|
+ actualHours: unit.actualHours,
|
|
|
+ status: asStageStatus(unit.status),
|
|
|
+ };
|
|
|
+}
|
|
|
+
|
|
|
+// t3i:单 substep → 旧 SubStepDetail。units 非空时映射为 breakdown 数组。
|
|
|
+export function mapDomainSubstep(substep: OrderFlowSubstep): SubStepDetail {
|
|
|
+ const breakdown = Array.isArray(substep.units) && substep.units.length > 0
|
|
|
+ ? substep.units.map(mapDomainSubstepUnit)
|
|
|
+ : undefined;
|
|
|
+ return {
|
|
|
+ name: substep.substepName,
|
|
|
+ piHours: substep.piHours,
|
|
|
+ actualHours: substep.actualHours,
|
|
|
+ status: asStageStatus(substep.status),
|
|
|
+ ...(breakdown ? { breakdown } : {}),
|
|
|
+ };
|
|
|
+}
|
|
|
+
|
|
|
+// t3i:chain / detail lifecycle 注入 subSteps(仅含 substeps 的阶段填,其余沿用 mapDomainStage 默认)。
|
|
|
+export function mapDomainOrderDetailLifecycleWithSubsteps(
|
|
|
+ detail: OrderFlowOrderDetail,
|
|
|
+): StageSnapshot[] {
|
|
|
+ if (!detail || !Array.isArray(detail.lifecycle)) return [];
|
|
|
+ return detail.lifecycle.map((stage) => {
|
|
|
+ const base = mapDomainStage(stage);
|
|
|
+ if (Array.isArray(stage.substeps) && stage.substeps.length > 0) {
|
|
|
+ return { ...base, subSteps: stage.substeps.map(mapDomainSubstep) };
|
|
|
+ }
|
|
|
+ return base;
|
|
|
+ });
|
|
|
+}
|
|
|
+
|
|
|
+// t3i:正式 aggregate → 旧 S8OrderFlowAggregateSnapshotDto shape,让 ChainBaselineMatrix 无需修改。
|
|
|
+// ownerDept 后端未返,用 '--' 兜底,不引入硬编码部门名;snapshotCode/Label 沿用 baseline 语义。
|
|
|
+export function mapDomainAggregateToLegacyBaseline(
|
|
|
+ agg: OrderFlowAggregate,
|
|
|
+): S8OrderFlowAggregateSnapshotDto {
|
|
|
+ const stageSnapshots: S8OrderFlowStageSnapshotItem[] = Array.isArray(agg?.stageAggregates)
|
|
|
+ ? agg.stageAggregates.map((s) => ({
|
|
|
+ stageKey: mapOrderFlowCodeToNodeKey(s.orderFlowCode),
|
|
|
+ stageName: s.orderFlowName,
|
|
|
+ ownerDept: '--',
|
|
|
+ kpiAvgDays: s.kpiAvgDays,
|
|
|
+ actualAvgDays: s.actualAvgDays,
|
|
|
+ onTimeRate: s.onTimeRate,
|
|
|
+ green: s.green,
|
|
|
+ yellow: s.yellow,
|
|
|
+ red: s.red,
|
|
|
+ pending: s.pending,
|
|
|
+ }))
|
|
|
+ : [];
|
|
|
+ return {
|
|
|
+ snapshotCode: 'BASELINE_PPT',
|
|
|
+ snapshotLabel: '基线聚合',
|
|
|
+ totalOrders: agg?.totalOrders ?? 0,
|
|
|
+ totalCustomers: agg?.totalCustomers ?? 0,
|
|
|
+ avgResponseMinutes: agg?.avgResponseMinutes ?? 0,
|
|
|
+ avgProcessingMinutes: agg?.avgProcessingMinutes ?? 0,
|
|
|
+ avgLossMinutes: agg?.avgLossMinutes ?? 0,
|
|
|
+ stageSnapshots,
|
|
|
+ remark: null,
|
|
|
+ };
|
|
|
+}
|
|
|
+
|
|
|
export function mapDomainOrderListItem(dto: OrderFlowOrderListItem): SalesOrderExecution {
|
|
|
const currentKey = mapOrderFlowCodeToNodeKey(dto.currentOrderFlowCode);
|
|
|
return {
|