gaoluyang
2026-08-03 75242bbba28ae8902ddf86d33febb497d79e5fc3
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
import { requestClient } from '#/api/request';
 
export namespace MesProAiApi {
  // ========== 物料预测 ==========
  export interface MaterialRiskItem {
    itemCode: string;
    itemName: string;
    requiredQuantity: number;
    availableQuantity: number;
    shortageQuantity: number;
    riskLevel: string;
    suggestion: string;
  }
 
  export interface PredictMaterialRespVO {
    riskLevel: number;
    reasoning: string;
    riskItems: MaterialRiskItem[];
  }
 
  // ========== 时长预测 ==========
  export interface ProcessTimeBreakdown {
    processName: string;
    sort: number;
    standardPrepareTime: number;
    standardWaitTime: number;
    standardProductionTime: number;
    predictedProductionTime: number;
  }
 
  export interface PredictDurationRespVO {
    predictedTotalHours: number;
    standardTotalHours: number;
    reasoning: string;
    keyPoints: string[];
    processBreakdown: ProcessTimeBreakdown[];
  }
 
  // ========== 风险预测 ==========
  export interface RiskItem {
    category: string;
    description: string;
    severity: string;
    suggestion: string;
  }
 
  export interface PredictRiskRespVO {
    overallRiskLevel: number;
    reasoning: string;
    keyPoints: string[];
    risks: RiskItem[];
  }
 
  // ========== 交付预测 ==========
  export interface PredictDeliveryRespVO {
    onTime: boolean;
    confidence: number;
    reasoning: string;
    delayFactors: string[];
    progressPercent: number;
    remainingDays: number;
  }
}
 
const BASE = '/mes/pro/ai';
 
/** AI 物料短缺预测 */
export function predictMaterial(workOrderId: number) {
  return requestClient.post<MesProAiApi.PredictMaterialRespVO>(
    `${BASE}/predict-material`,
    { workOrderId },
  );
}
 
/** AI 生产时长预测 */
export function predictDuration(workOrderId: number) {
  return requestClient.post<MesProAiApi.PredictDurationRespVO>(
    `${BASE}/predict-duration`,
    { workOrderId },
  );
}
 
/** AI 生产风险预测 */
export function predictRisk(workOrderId: number) {
  return requestClient.post<MesProAiApi.PredictRiskRespVO>(
    `${BASE}/predict-risk`,
    { workOrderId },
  );
}
 
/** AI 按时交付预测 */
export function predictDelivery(workOrderId: number) {
  return requestClient.post<MesProAiApi.PredictDeliveryRespVO>(
    `${BASE}/predict-delivery`,
    { workOrderId },
  );
}