1028
This commit is contained in:
parent
e8f6e97a15
commit
88b445daf3
@ -234,6 +234,14 @@ export function getPlotState() {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 读取并记住当前项目最后一次出图结果
|
||||||
|
export function captureDrawingState(id) {
|
||||||
|
return request({
|
||||||
|
url: '/system/orderPro/drawingState/' + id,
|
||||||
|
method: 'get'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
// 金蝶生产订单(按项目 id)
|
// 金蝶生产订单(按项目 id)
|
||||||
export function getKingdeePrdMo(id) {
|
export function getKingdeePrdMo(id) {
|
||||||
return request({
|
return request({
|
||||||
|
|||||||
@ -557,20 +557,18 @@
|
|||||||
</el-button>
|
</el-button>
|
||||||
</el-upload>
|
</el-upload>
|
||||||
|
|
||||||
<!-- 出图状态展示按钮 -->
|
<!-- 出图状态:显示当前项目最后一次结果,不随其他项目出图被覆盖 -->
|
||||||
<el-button
|
<el-button
|
||||||
:type="plotStatusType"
|
:type="plotStatusType"
|
||||||
size="mini"
|
size="mini"
|
||||||
@click="fetchPlotStatus"
|
@click="fetchPlotStatus"
|
||||||
style="margin-left: 10px;"
|
style="margin-left: 10px;"
|
||||||
title="点击刷新出图状态"
|
:title="plotDetailText || '点击刷新本项目出图结果'"
|
||||||
>
|
>
|
||||||
<i class="el-icon-picture-outline" style="margin-right: 4px;"></i>
|
<i class="el-icon-picture-outline" style="margin-right: 4px;"></i>
|
||||||
出图状态:{{ plotStatusText }}
|
出图状态:{{ plotStatusText }}
|
||||||
|
<span v-if="plotStateMsg" style="margin-left: 8px;">{{ plotStateMsg }}</span>
|
||||||
<span v-if="plotProjectName" style="margin-left: 8px;">项目:{{ plotProjectName }}</span>
|
<span v-if="plotProjectName" style="margin-left: 8px;">项目:{{ plotProjectName }}</span>
|
||||||
<el-tooltip v-if="plotOutputPath || plotTargetDrawing || plotStateMsg" effect="dark" :content="plotDetailText" placement="top">
|
|
||||||
<i class="el-icon-info" style="margin-left: 6px;"></i>
|
|
||||||
</el-tooltip>
|
|
||||||
<i v-if="plotStatusLoading" class="el-icon-loading" style="margin-left: 4px;"></i>
|
<i v-if="plotStatusLoading" class="el-icon-loading" style="margin-left: 4px;"></i>
|
||||||
</el-button>
|
</el-button>
|
||||||
</div>
|
</div>
|
||||||
@ -656,8 +654,8 @@
|
|||||||
</el-button>
|
</el-button>
|
||||||
<el-button type="success" plain :loading="sendProcessRoutePlanLoading" @click="sendProcessRoutePlan"
|
<el-button type="success" plain :loading="sendProcessRoutePlanLoading" @click="sendProcessRoutePlan"
|
||||||
v-hasPermi="['system:orderPro:sendProcessRoutePlanExcel']"
|
v-hasPermi="['system:orderPro:sendProcessRoutePlanExcel']"
|
||||||
:disabled="isSkipProcessOrder"
|
:disabled="sendProcessRoutePlanLoading || isSkipProcessOrder || !!drawingNotSuccess()"
|
||||||
:title="isSkipProcessOrder ? '该项目无需做工艺,不再推送给工艺' : '发送工艺计划表(钉钉推送给工艺),括号内为已成功发送次数'">
|
:title="sendPlanButtonTitle">
|
||||||
发送计划表({{ routePlanSendCount }}次)
|
发送计划表({{ routePlanSendCount }}次)
|
||||||
</el-button>
|
</el-button>
|
||||||
<template v-if="isPlmSource(productionObj && productionObj.source)">
|
<template v-if="isPlmSource(productionObj && productionObj.source)">
|
||||||
@ -2389,6 +2387,7 @@ import {
|
|||||||
getRouteLog,
|
getRouteLog,
|
||||||
getBomUploadStatus,
|
getBomUploadStatus,
|
||||||
getPlotState,
|
getPlotState,
|
||||||
|
captureDrawingState,
|
||||||
getKingdeePrdMo,
|
getKingdeePrdMo,
|
||||||
getKingdeePurchaseOrder,
|
getKingdeePurchaseOrder,
|
||||||
importDrawingByExcel,
|
importDrawingByExcel,
|
||||||
@ -2712,7 +2711,6 @@ export default {
|
|||||||
this.getConfigIniOptions(); // 新增
|
this.getConfigIniOptions(); // 新增
|
||||||
|
|
||||||
this.$api = { addProduct, updateProduct };
|
this.$api = { addProduct, updateProduct };
|
||||||
this.fetchPlotStatus();
|
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
/** 是否做工艺=否:出图后不再把工艺表推给工艺。空值仍按需要工艺处理。 */
|
/** 是否做工艺=否:出图后不再把工艺表推给工艺。空值仍按需要工艺处理。 */
|
||||||
@ -2720,6 +2718,16 @@ export default {
|
|||||||
const v = this.productionObj && this.productionObj.needProcess;
|
const v = this.productionObj && this.productionObj.needProcess;
|
||||||
return v === 0 || v === "0";
|
return v === 0 || v === "0";
|
||||||
},
|
},
|
||||||
|
sendPlanButtonTitle() {
|
||||||
|
if (this.isSkipProcessOrder) {
|
||||||
|
return "该项目无需做工艺,不再推送给工艺";
|
||||||
|
}
|
||||||
|
const deny = this.drawingNotSuccess();
|
||||||
|
if (deny) {
|
||||||
|
return deny;
|
||||||
|
}
|
||||||
|
return "发送工艺计划表(钉钉推送给工艺),括号内为已成功发送次数";
|
||||||
|
},
|
||||||
/** 折叠区内已选筛选项数量(收起时角标) */
|
/** 折叠区内已选筛选项数量(收起时角标) */
|
||||||
advancedFilterCount() {
|
advancedFilterCount() {
|
||||||
const q = this.queryParams || {};
|
const q = this.queryParams || {};
|
||||||
@ -3057,62 +3065,126 @@ export default {
|
|||||||
this.percentage = Number(((current / total) * 100).toFixed(2));
|
this.percentage = Number(((current / total) * 100).toFixed(2));
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
// 获取出图状态
|
plotNameFromPath(path) {
|
||||||
|
const normalized = String(path || "").replace(/\\\\/g, "/");
|
||||||
|
return normalized.split("/").filter(Boolean).pop() || "";
|
||||||
|
},
|
||||||
|
plotPathMatchesCurrent(path) {
|
||||||
|
const orderNo = this.productionObj && this.productionObj.productionOrderNo;
|
||||||
|
if (!orderNo || !path) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return String(path).replace(/\\\\/g, "/").indexOf(orderNo) !== -1;
|
||||||
|
},
|
||||||
|
applyPlotStateObject(stateObj) {
|
||||||
|
if (!stateObj || stateObj.processstate === undefined || stateObj.processstate === null || stateObj.processstate === "") {
|
||||||
|
this.plotStatusText = "暂无记录";
|
||||||
|
this.plotStatusType = "info";
|
||||||
|
this.plotStateMsg = (stateObj && stateObj.msg) || "";
|
||||||
|
this.plotOutputPath = (stateObj && stateObj.outputpath) || "";
|
||||||
|
this.plotProjectName = this.plotNameFromPath(this.plotOutputPath);
|
||||||
|
this.plotTargetDrawing = "";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this.plotOutputPath = stateObj.outputpath || "";
|
||||||
|
this.plotProjectName = this.plotNameFromPath(this.plotOutputPath);
|
||||||
|
const msg = stateObj.msg || "";
|
||||||
|
this.plotStateMsg = msg;
|
||||||
|
const match = String(msg).match(/未找到装配图[::]\s*([^,,。\s"]+)/);
|
||||||
|
this.plotTargetDrawing = (match && match[1]) ? match[1] : (stateObj.sourcedrawing || "");
|
||||||
|
switch (String(stateObj.processstate)) {
|
||||||
|
case "0":
|
||||||
|
this.plotStatusText = "无任务";
|
||||||
|
this.plotStatusType = "info";
|
||||||
|
break;
|
||||||
|
case "1":
|
||||||
|
this.plotStatusText = "生成图纸中";
|
||||||
|
this.plotStatusType = "primary";
|
||||||
|
break;
|
||||||
|
case "2":
|
||||||
|
this.plotStatusText = "导出明细中";
|
||||||
|
this.plotStatusType = "primary";
|
||||||
|
break;
|
||||||
|
case "3":
|
||||||
|
this.plotStatusText = "导出PDF中";
|
||||||
|
this.plotStatusType = "primary";
|
||||||
|
break;
|
||||||
|
case "4":
|
||||||
|
this.plotStatusText = "已完成";
|
||||||
|
this.plotStatusType = "success";
|
||||||
|
break;
|
||||||
|
case "5":
|
||||||
|
this.plotStatusText = "出图失败";
|
||||||
|
this.plotStatusType = "danger";
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
this.plotStatusText = "异常";
|
||||||
|
this.plotStatusType = "warning";
|
||||||
|
}
|
||||||
|
},
|
||||||
|
applySavedPlotStatus(row) {
|
||||||
|
this.applyPlotStateObject({
|
||||||
|
processstate: row ? row.drawingState : null,
|
||||||
|
msg: (row && row.drawingStateMsg) || "",
|
||||||
|
outputpath: (row && row.drawingStatePath) || ""
|
||||||
|
});
|
||||||
|
},
|
||||||
|
rememberPlotOnProject(data) {
|
||||||
|
if (!data) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const fields = ["drawingState", "drawingStateMsg", "drawingStatePath", "drawingStateTime"];
|
||||||
|
if (this.productionObj && this.productionObj.id === data.id) {
|
||||||
|
fields.forEach((key) => this.$set(this.productionObj, key, data[key]));
|
||||||
|
}
|
||||||
|
const row = (this.orderProList || []).find((item) => item && item.id === data.id);
|
||||||
|
if (row) {
|
||||||
|
fields.forEach((key) => this.$set(row, key, data[key]));
|
||||||
|
}
|
||||||
|
this.applySavedPlotStatus(data);
|
||||||
|
},
|
||||||
|
async captureProjectPlotStatus(id) {
|
||||||
|
const projectId = id || (this.productionObj && this.productionObj.id);
|
||||||
|
if (!projectId) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
this.plotStatusLoading = true;
|
||||||
|
try {
|
||||||
|
const res = await captureDrawingState(projectId);
|
||||||
|
const data = (res && res.data) || null;
|
||||||
|
if (data) {
|
||||||
|
this.rememberPlotOnProject(data);
|
||||||
|
}
|
||||||
|
return data;
|
||||||
|
} catch (err) {
|
||||||
|
if (this.productionObj) {
|
||||||
|
this.applySavedPlotStatus(this.productionObj);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
} finally {
|
||||||
|
this.plotStatusLoading = false;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// 刷新当前项目的出图结果。出图服务若正在处理其他令号,仍显示本项目上次记录。
|
||||||
fetchPlotStatus() {
|
fetchPlotStatus() {
|
||||||
|
if (this.productionObj && this.productionObj.id) {
|
||||||
|
this.captureProjectPlotStatus(this.productionObj.id);
|
||||||
|
return;
|
||||||
|
}
|
||||||
this.plotStatusLoading = true;
|
this.plotStatusLoading = true;
|
||||||
getPlotState().then(res => {
|
getPlotState().then(res => {
|
||||||
this.plotStatusLoading = false;
|
this.plotStatusLoading = false;
|
||||||
|
|
||||||
const stateObj = this.parsePlotStateResponse(res);
|
const stateObj = this.parsePlotStateResponse(res);
|
||||||
|
|
||||||
if (stateObj && stateObj.processstate !== undefined) {
|
if (stateObj && stateObj.processstate !== undefined) {
|
||||||
this.plotOutputPath = stateObj.outputpath || "";
|
this.applyPlotStateObject(stateObj);
|
||||||
const path = String(this.plotOutputPath || "");
|
|
||||||
const normalized = path.replace(/\\\\/g, "/");
|
|
||||||
this.plotProjectName = normalized.split("/").filter(Boolean).pop() || "";
|
|
||||||
const msg = stateObj.msg || "";
|
|
||||||
this.plotStateMsg = msg || "";
|
|
||||||
const match = String(msg).match(/未找到装配图[::]\s*([^,,。\s"]+)/);
|
|
||||||
this.plotTargetDrawing = (match && match[1]) ? match[1] : (stateObj.sourcedrawing || "");
|
|
||||||
|
|
||||||
const status = stateObj.processstate;
|
|
||||||
switch (String(status)) {
|
|
||||||
case '0':
|
|
||||||
this.plotStatusText = '无任务';
|
|
||||||
this.plotStatusType = 'info';
|
|
||||||
break;
|
|
||||||
case '1':
|
|
||||||
this.plotStatusText = '生成图纸中';
|
|
||||||
this.plotStatusType = 'primary';
|
|
||||||
break;
|
|
||||||
case '2':
|
|
||||||
this.plotStatusText = '导出明细中';
|
|
||||||
this.plotStatusType = 'primary';
|
|
||||||
break;
|
|
||||||
case '3':
|
|
||||||
this.plotStatusText = '导出PDF中';
|
|
||||||
this.plotStatusType = 'primary';
|
|
||||||
break;
|
|
||||||
case '4':
|
|
||||||
this.plotStatusText = '已完成';
|
|
||||||
this.plotStatusType = 'success';
|
|
||||||
break;
|
|
||||||
case '5':
|
|
||||||
this.plotStatusText = '出图失败';
|
|
||||||
this.plotStatusType = 'danger';
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
this.plotStatusText = '异常';
|
|
||||||
this.plotStatusType = 'warning';
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
this.plotStatusText = '解析状态失败';
|
this.plotStatusText = "解析状态失败";
|
||||||
this.plotStatusType = 'warning';
|
this.plotStatusType = "warning";
|
||||||
}
|
}
|
||||||
}).catch(err => {
|
}).catch(() => {
|
||||||
this.plotStatusLoading = false;
|
this.plotStatusLoading = false;
|
||||||
this.plotStatusText = '获取失败';
|
this.plotStatusText = "获取失败";
|
||||||
this.plotStatusType = 'danger';
|
this.plotStatusType = "danger";
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
async fetchProcessLog() {
|
async fetchProcessLog() {
|
||||||
@ -3431,6 +3503,7 @@ export default {
|
|||||||
this.routePlanSendCount = Object.prototype.hasOwnProperty.call(this.routePlanSendCountMap, row.id)
|
this.routePlanSendCount = Object.prototype.hasOwnProperty.call(this.routePlanSendCountMap, row.id)
|
||||||
? this.routePlanSendCountMap[row.id]
|
? this.routePlanSendCountMap[row.id]
|
||||||
: 0;
|
: 0;
|
||||||
|
this.applySavedPlotStatus(row);
|
||||||
this.drawer = true;
|
this.drawer = true;
|
||||||
// 打开抽屉后加载表格数据
|
// 打开抽屉后加载表格数据
|
||||||
this.loadChainTableData();
|
this.loadChainTableData();
|
||||||
@ -3438,6 +3511,7 @@ export default {
|
|||||||
if (row && row.id) {
|
if (row && row.id) {
|
||||||
// 他人可能已「确认图纸已齐」,打开时拉最新状态,避免本地列表缓存导致无法下载
|
// 他人可能已「确认图纸已齐」,打开时拉最新状态,避免本地列表缓存导致无法下载
|
||||||
this.refreshProductionDrawingGate(row.id);
|
this.refreshProductionDrawingGate(row.id);
|
||||||
|
this.captureProjectPlotStatus(row.id);
|
||||||
this.fetchRoutePlanSendCount();
|
this.fetchRoutePlanSendCount();
|
||||||
this.fetchProcessLog();
|
this.fetchProcessLog();
|
||||||
}
|
}
|
||||||
@ -5112,22 +5186,25 @@ export default {
|
|||||||
|
|
||||||
this.drawLog = stateObj.msg || "";
|
this.drawLog = stateObj.msg || "";
|
||||||
const ps = this.normalizePlotProcessState(stateObj.processstate);
|
const ps = this.normalizePlotProcessState(stateObj.processstate);
|
||||||
|
if (this.plotPathMatchesCurrent(stateObj.outputpath)) {
|
||||||
|
this.applyPlotStateObject(stateObj);
|
||||||
|
}
|
||||||
|
|
||||||
if (ps === 3) {
|
if (ps === 3 && this.plotPathMatchesCurrent(stateObj.outputpath)) {
|
||||||
this.applyPlotProgressFromMsg(stateObj.msg);
|
this.applyPlotProgressFromMsg(stateObj.msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 完成 / 失败:兼容 processstate 为字符串 "4"/"5"
|
// 完成 / 失败:兼容 processstate 为字符串 "4"/"5"
|
||||||
if (ps === 4) {
|
if (ps === 4 && this.plotPathMatchesCurrent(stateObj.outputpath)) {
|
||||||
this.percentage = 100;
|
this.percentage = 100;
|
||||||
this.clearDrawProgressTimer();
|
this.clearDrawProgressTimer();
|
||||||
this.drawLoading = false;
|
this.drawLoading = false;
|
||||||
this.fetchPlotStatus();
|
this.captureProjectPlotStatus();
|
||||||
} else if (ps === 5) {
|
} else if (ps === 5 && this.plotPathMatchesCurrent(stateObj.outputpath)) {
|
||||||
this.clearDrawProgressTimer();
|
this.clearDrawProgressTimer();
|
||||||
this.drawLoading = false;
|
this.drawLoading = false;
|
||||||
this.drawLog = stateObj.msg || "出图失败";
|
this.drawLog = stateObj.msg || "出图失败";
|
||||||
this.fetchPlotStatus();
|
this.captureProjectPlotStatus();
|
||||||
}
|
}
|
||||||
} catch (pollErr) {
|
} catch (pollErr) {
|
||||||
console.error("出图进度轮询失败:", pollErr);
|
console.error("出图进度轮询失败:", pollErr);
|
||||||
@ -5137,6 +5214,7 @@ export default {
|
|||||||
this.drawLog = "出图失败:" + (e.msg || e.message || e);
|
this.drawLog = "出图失败:" + (e.msg || e.message || e);
|
||||||
this.drawLoading = false;
|
this.drawLoading = false;
|
||||||
this.clearDrawProgressTimer();
|
this.clearDrawProgressTimer();
|
||||||
|
this.captureProjectPlotStatus();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
// 加载销齿链型号表格数据
|
// 加载销齿链型号表格数据
|
||||||
@ -5547,6 +5625,26 @@ export default {
|
|||||||
this.$set(this.routePlanSendCountMap, this.productionObj.id, 0);
|
this.$set(this.routePlanSendCountMap, this.productionObj.id, 0);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
drawingNotSuccess(row) {
|
||||||
|
const item = row || this.productionObj;
|
||||||
|
if (!item) {
|
||||||
|
return "请先选择生产令号";
|
||||||
|
}
|
||||||
|
const msg = item.drawingStateMsg || "";
|
||||||
|
const failed = /失败|未找到|错误|异常/.test(msg);
|
||||||
|
const state = item.drawingState;
|
||||||
|
if (state === 4 || state === "4") {
|
||||||
|
return failed ? "项目尚未出图成功:" + msg : "";
|
||||||
|
}
|
||||||
|
if (state !== undefined && state !== null && state !== "") {
|
||||||
|
return msg ? "项目尚未出图成功:" + msg : "项目出图尚未完成,不能发送计划表或创建待办";
|
||||||
|
}
|
||||||
|
const bom = Number(item.bomStatus);
|
||||||
|
if (Number.isFinite(bom) && bom !== 0) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
return "项目尚未出图成功,不能发送计划表或创建待办";
|
||||||
|
},
|
||||||
async sendProcessRoutePlan() {
|
async sendProcessRoutePlan() {
|
||||||
if (!this.productionObj || !this.productionObj.id) {
|
if (!this.productionObj || !this.productionObj.id) {
|
||||||
this.$message.warning("请先选择生产令号");
|
this.$message.warning("请先选择生产令号");
|
||||||
@ -5556,6 +5654,14 @@ export default {
|
|||||||
this.$message.info("该项目无需做工艺,不再推送给工艺");
|
this.$message.info("该项目无需做工艺,不再推送给工艺");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
const drawingDeny = this.drawingNotSuccess();
|
||||||
|
if (drawingDeny) {
|
||||||
|
this.$message.warning(drawingDeny);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (this.sendProcessRoutePlanLoading) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
this.sendProcessRoutePlanLoading = true;
|
this.sendProcessRoutePlanLoading = true;
|
||||||
try {
|
try {
|
||||||
const res = await sendProcessRoutePlanExcel(this.productionObj.id);
|
const res = await sendProcessRoutePlanExcel(this.productionObj.id);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user