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 },
|
);
|
}
|