Browse Source

feat(s8): t4a remove legacy demo order flow api client

bump version Web 2.4.130
YY968XX 2 months ago
parent
commit
0db13b2c5f

+ 1 - 1
Web/package.json

@@ -1,7 +1,7 @@
 {
 	"name": "admin.net",
 	"type": "module",
-	"version": "2.4.129",
+	"version": "2.4.130",
 	"packageManager": "pnpm@10.32.1",
 	"lastBuildTime": "2026.03.15",
 	"description": "Admin.NET 站在巨人肩膀上的 .NET 通用权限开发框架",

+ 4 - 99
Web/src/stores/orderExecution.ts

@@ -1,5 +1,4 @@
-// ORDER-FLOW-BE-DEMO-DATASET-RESET-1:主数据源切换为后端 demo API。
-// 旧 fixture(customers.ts / builder.ts)保留代码作为 dev fallback 工具,本 store 不再静默回退。
+// ORDER-FLOW-S8-INTEGRATED-DOMAIN-RESET-1 t4a:旧 demo API client 已删除,store 改由 domainMapper 持有 baseline 类型。
 import { defineStore } from 'pinia';
 import { Session } from '/@/utils/storage';
 // EXECUTION_OBSERVED_AT 仍来自旧 fixture 模块,仅用作 UI 顶部"当前观测时间"展示文案;
@@ -10,23 +9,14 @@ import {
 	createDefaultFilters,
 	filterOrders,
 } from '/@/views/aidop/s8/monitoring/data/order-execution/aggregation';
-// ORDER-FLOW-CHAIN-PAGE2-ORIGINAL-LOGIC-RESTORE-1:order_review 子节点数据由前端 fixture 派生(与原项目同源),后端 DTO 不返。
-import { buildReviewSubSteps } from '/@/views/aidop/s8/monitoring/data/order-execution/builder';
 import type {
 	CustomerGroup,
 	OrderExecutionFilters,
 	OrderExecutionKpiAverages,
 	OrderNodeKey,
 	SalesOrderExecution,
-	StageSnapshot,
 } from '/@/views/aidop/s8/monitoring/data/order-execution/types';
-import {
-	s8OrderFlowApi,
-	type S8OrderFlowAggregateSnapshotDto,
-	type S8OrderFlowDto,
-	type S8OrderFlowStageDto,
-} from '/@/views/aidop/s8/api/s8OrderFlowApi';
-// ORDER-FLOW-S8-INTEGRATED-DOMAIN-RESET-1 t3g:正式 API client + mapper,loadFromDomain 旁路旧 demo 走正式端点。
+// ORDER-FLOW-S8-INTEGRATED-DOMAIN-RESET-1 t3g:正式 API client + mapper,loadFromDomain 走正式端点。
 // t3h:增订单详情按需加载,展开订单时调 getOrderFlowOrder 注入 lifecycle。
 // t3i:Chain 页 baseline + 单订单 chain(含 substeps/units)切正式 API。
 import {
@@ -40,6 +30,7 @@ import {
 	mapDomainOrderDetailLifecycle,
 	mapDomainOrderDetailLifecycleWithSubsteps,
 	mapDomainOrderListItem,
+	type S8OrderFlowAggregateSnapshotDto,
 } from '/@/views/aidop/s8/monitoring/data/order-execution/domainMapper';
 
 export interface OrderExecutionFilterOption<V = string> {
@@ -72,65 +63,6 @@ const dedupe = <T>(values: Iterable<T>): T[] => Array.from(new Set(values));
 
 const NAV_STATE_KEY = 's8_order_chain_nav_state';
 
-// 后端时间字符串:'YYYY-MM-DD HH:mm' → 前端展示 'MM-DD HH:mm';'YYYY-MM-DD' → 'MM-DD'。
-function toMonthDayTime(s: string | null | undefined): string {
-	if (!s) return '';
-	// 形如 2026-04-15 09:00 → 04-15 09:00
-	const m = s.match(/^\d{4}-(\d{2}-\d{2}( \d{2}:\d{2})?)/);
-	return m ? m[1] : s;
-}
-
-function mapStage(s: S8OrderFlowStageDto): StageSnapshot {
-	return {
-		key: s.stageKey as OrderNodeKey,
-		name: s.stageName,
-		targetDate: toMonthDayTime(s.expectedDate),
-		actualReachedAt: s.actualEndAt ? toMonthDayTime(s.actualEndAt) : null,
-		actualDays: s.actualDays,
-		nodeVarianceDays: s.nodeVarianceDays,
-		cumulativeVarianceDays: s.cumulativeVarianceDays,
-		status: s.status,
-	};
-}
-
-function mapOrder(dto: S8OrderFlowDto): SalesOrderExecution {
-	return {
-		soNo: dto.soNo,
-		orderId: dto.soNo.replace('SO', 'ORD'),
-		productName: dto.productName,
-		productLine: dto.productLine,
-		customerName: dto.customerName,
-		customerCode: dto.customerCode,
-		customerType: dto.customerType,
-		region: dto.region,
-		priority: dto.priority,
-		workflowStatus: dto.workflowStatus,
-		currentNode: dto.currentNodeLabel,
-		currentNodeKey: dto.currentNodeKey as OrderNodeKey,
-		focusNodeKey: dto.focusNodeKey as OrderNodeKey,
-		nodeStatus: dto.nodeStatus,
-		observedAt: EXECUTION_OBSERVED_AT,
-		orderStartDate: toMonthDayTime(dto.releaseAt),
-		targetCycleDays: dto.targetCycleDays,
-		actualCycleDays: dto.actualCycleDays,
-		currentCycleDays: dto.currentCycleDays,
-		nodeVarianceDays: dto.nodeVarianceDays,
-		cumulativeVarianceDays: dto.cumulativeVarianceDays,
-		exceptionCount: dto.exceptionCount,
-		responseDisplayMinutes: dto.responseMinutes,
-		responseTime: dto.responseMinutes,
-		processingTime: dto.processingMinutes,
-		currentProcessingMinutes: dto.processingMinutes,
-		totalLossTime: dto.totalLossMinutes,
-		exceptionStatus: dto.exceptionStatus,
-		lifecycle: dto.lifecycle.map(mapStage).map((stage) =>
-			stage.key === 'order_review'
-				? { ...stage, subSteps: buildReviewSubSteps(dto.soNo, stage.actualDays ?? null) }
-				: stage,
-		),
-	};
-}
-
 interface OrderExecutionState {
 	orders: SalesOrderExecution[];
 	aggregateSnapshot: S8OrderFlowAggregateSnapshotDto | null;
@@ -239,36 +171,9 @@ export const useOrderExecutionStore = defineStore('orderExecution', {
 		},
 	},
 	actions: {
-		async loadFromBackend() {
-			if (this.loading) return;
-			this.loading = true;
-			this.loadError = null;
-			try {
-				const [orders, snapshot] = await Promise.all([
-					s8OrderFlowApi.listOrders(),
-					s8OrderFlowApi.aggregateSnapshot(),
-				]);
-				this.orders = orders.map(mapOrder);
-				this.aggregateSnapshot = snapshot;
-				this.initialized = true;
-			} catch (err: unknown) {
-				// fail-closed:清空数据,不静默回退到旧 fixture
-				this.orders = [];
-				this.aggregateSnapshot = null;
-				this.initialized = true;
-				this.loadError = err instanceof Error ? err.message : String(err);
-			} finally {
-				this.loading = false;
-			}
-		},
-		// 兼容现有 3 个页面 onMounted 调用名;行为已改为后端取数。
-		loadFixture() {
-			if (this.initialized) return;
-			void this.loadFromBackend();
-		},
 		// ORDER-FLOW-S8-INTEGRATED-DOMAIN-RESET-1 t3g:调用正式 /api/aidop/s8/order-flow/orders。
-		// 旧 loadFromBackend / loadFixture 保留作 fallback;本切片只让总览主页改走 loadFromDomain。
 		// aggregate 端点本切片不接入;snapshot 置空(baseline 矩阵在 chain 页消费,总览页不渲染)。
+		// t4a:旧 loadFromBackend / loadFixture 已删除,旧 demo API 不再被任何路径触发。
 		async loadFromDomain() {
 			if (this.loading) return;
 			this.loading = true;

+ 0 - 83
Web/src/views/aidop/s8/api/s8OrderFlowApi.ts

@@ -1,83 +0,0 @@
-// ORDER-FLOW-BE-DEMO-DATASET-RESET-1:S8 demo 订单执行档案 API client。
-import service from '/@/utils/request';
-
-function unwrap<T>(res: { data: T }): T {
-	return res.data;
-}
-
-export interface S8OrderFlowStageDto {
-	stageKey: string;
-	stageName: string;
-	sortNo: number;
-	plannedDays: number;
-	actualDays: number | null;
-	expectedDate: string; // YYYY-MM-DD
-	actualStartAt: string | null; // YYYY-MM-DD HH:mm
-	actualEndAt: string | null; // YYYY-MM-DD HH:mm
-	status: 'green' | 'yellow' | 'red' | 'pending';
-	nodeVarianceDays: number | null;
-	cumulativeVarianceDays: number | null;
-}
-
-export interface S8OrderFlowDto {
-	soNo: string;
-	productName: string;
-	productLine: string;
-	customerName: string;
-	customerCode: string;
-	customerType: 'KA' | 'SMB' | 'MICRO';
-	region: string;
-	priority: 'P1' | 'P2' | 'P3';
-	materialCode: 'XX' | 'YY' | 'ZZ';
-	supplierGroup: 'A' | 'B' | 'C';
-	workflowStatus: 'completed' | 'in_progress';
-	currentNodeKey: string;
-	focusNodeKey: string;
-	currentNodeLabel: string;
-	nodeStatus: 'green' | 'yellow' | 'red';
-	releaseAt: string; // YYYY-MM-DD HH:mm
-	targetCycleDays: number;
-	currentCycleDays: number | null;
-	actualCycleDays: number | null;
-	nodeVarianceDays: number | null;
-	cumulativeVarianceDays: number | null;
-	exceptionCount: number;
-	responseMinutes: number | null;
-	processingMinutes: number | null;
-	totalLossMinutes: number | null;
-	exceptionStatus: '待响应' | '处理中' | '已闭环';
-	lifecycle: S8OrderFlowStageDto[];
-}
-
-export interface S8OrderFlowStageSnapshotItem {
-	stageKey: string;
-	stageName: string;
-	ownerDept: string;
-	kpiAvgDays: number;
-	actualAvgDays: number;
-	onTimeRate: number;
-	green: number;
-	yellow: number;
-	red: number;
-	pending: number;
-}
-
-export interface S8OrderFlowAggregateSnapshotDto {
-	snapshotCode: string;
-	snapshotLabel: string;
-	totalOrders: number;
-	totalCustomers: number;
-	avgResponseMinutes: number;
-	avgProcessingMinutes: number;
-	avgLossMinutes: number;
-	stageSnapshots: S8OrderFlowStageSnapshotItem[];
-	remark: string | null;
-}
-
-const BASE = '/api/aidop/s8/demo/order-flow';
-
-export const s8OrderFlowApi = {
-	listOrders: () => service.get<S8OrderFlowDto[]>(`${BASE}/orders`).then(unwrap),
-	getOrder: (soNo: string) => service.get<S8OrderFlowDto>(`${BASE}/orders/${encodeURIComponent(soNo)}`).then(unwrap),
-	aggregateSnapshot: () => service.get<S8OrderFlowAggregateSnapshotDto>(`${BASE}/aggregate-snapshot`).then(unwrap),
-};

+ 1 - 1
Web/src/views/aidop/s8/monitoring/components/order-execution/ChainBaselineMatrix.vue

@@ -3,7 +3,7 @@
 // 渲染独立 105 单聚合快照(与 20 条明细不同源)。仅在用户未做任何筛选时出现。
 import { computed } from 'vue';
 import type { OrderNodeKey } from '/@/views/aidop/s8/monitoring/data/order-execution/types';
-import type { S8OrderFlowAggregateSnapshotDto } from '/@/views/aidop/s8/api/s8OrderFlowApi';
+import type { S8OrderFlowAggregateSnapshotDto } from '/@/views/aidop/s8/monitoring/data/order-execution/domainMapper';
 
 interface Props {
 	snapshot: S8OrderFlowAggregateSnapshotDto;

+ 27 - 4
Web/src/views/aidop/s8/monitoring/data/order-execution/domainMapper.ts

@@ -16,10 +16,33 @@ import type {
 	OrderFlowSubstep,
 	OrderFlowSubstepUnit,
 } from '/@/views/aidop/s8/api/s8OrderFlowDomainApi';
-import type {
-	S8OrderFlowAggregateSnapshotDto,
-	S8OrderFlowStageSnapshotItem,
-} from '/@/views/aidop/s8/api/s8OrderFlowApi';
+
+// t4a:legacy ChainBaselineMatrix 消费的 baseline snapshot shape;原 owner 是旧 demo client,
+// 旧 client 删除后由 mapper 自持,保留字段语义与 ChainBaselineMatrix 当前依赖一致。
+export interface S8OrderFlowStageSnapshotItem {
+	stageKey: string;
+	stageName: string;
+	ownerDept: string;
+	kpiAvgDays: number;
+	actualAvgDays: number;
+	onTimeRate: number;
+	green: number;
+	yellow: number;
+	red: number;
+	pending: number;
+}
+
+export interface S8OrderFlowAggregateSnapshotDto {
+	snapshotCode: string;
+	snapshotLabel: string;
+	totalOrders: number;
+	totalCustomers: number;
+	avgResponseMinutes: number;
+	avgProcessingMinutes: number;
+	avgLossMinutes: number;
+	stageSnapshots: S8OrderFlowStageSnapshotItem[];
+	remark: string | null;
+}
 
 // 'YYYY-MM-DD HH:mm' → 'MM-DD HH:mm';'YYYY-MM-DD' → 'MM-DD'。与旧 store.mapStage 同义,复制以避免跨文件依赖。
 function toMonthDayTime(s: string | null | undefined): string {