|
|
@@ -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;
|