From 7ee8b7dd582937fdd77f3a0bce34e0653917a318 Mon Sep 17 00:00:00 2001 From: "zangch@mesnac.com" Date: Tue, 14 Oct 2025 09:56:17 +0800 Subject: [PATCH] =?UTF-8?q?feat(mes):=E4=BC=98=E5=8C=96=E5=9C=A8=E5=88=B6?= =?UTF-8?q?=E5=93=81=E8=B7=9F=E8=B8=AA=E6=8A=A5=E8=A1=A8=E4=B8=8E=E5=B7=A5?= =?UTF-8?q?=E5=BA=8F=E7=BB=9F=E8=AE=A1=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 新增工序工单统计图表(Top10展示)- 更新表格列标题“生产订单号”为“派工单号”- 修改查询参数字段orderCode为planCode -重构工序统计逻辑,支持按工序聚合展示完成率与状态 - 增加工序展开加载子计划列表功能 - 优化进度条显示,支持超额完成状态提示 - 添加日期范围、物料编号与名称筛选条件- 实现工序统计导出功能 - 调整图表Y轴最大值逻辑,支持超额完成区域标记- 修复部分字段显示与计算逻辑问题 --- src/api/mes/prodReport/index.ts | 56 +++++ src/views/mes/wipTrackingReport/backup.vue | 94 ++++---- src/views/mes/wipTrackingReport/index.vue | 264 +++++++++++++-------- 3 files changed, 269 insertions(+), 145 deletions(-) diff --git a/src/api/mes/prodReport/index.ts b/src/api/mes/prodReport/index.ts index 950917d..c949020 100644 --- a/src/api/mes/prodReport/index.ts +++ b/src/api/mes/prodReport/index.ts @@ -157,3 +157,59 @@ export const exportHourlyOutputByHour = (query) => { responseType: 'blob' }); }; + +/** + * 工序生产统计(按工序聚合):完成数量、未完成数量与完成率 + */ +export const processWorkOrderStats = (query): AxiosPromise<[]> => { + return request({ + url: '/mes/prodReport/processWorkOrderStats', + method: 'get', + params: query + }); +}; + +/** + * 工序生产统计(分页,按工序聚合) + */ +export const processWorkOrderStatsPage = (query): AxiosPromise<[]> => { + return request({ + url: '/mes/prodReport/processWorkOrderStats/page', + method: 'get', + params: query + }); +}; + +/** + * 工序生产统计导出(按工序聚合) + */ +export const exportProcessWorkOrderStats = (query) => { + return request({ + url: '/mes/prodReport/processWorkOrderStats/export', + method: 'post', + params: query, + responseType: 'blob' + }); +}; + +/** + * 工序下的计划子节点查询:按 plan_code + process_id 过滤 + */ +export const planProcessChildren = (query): AxiosPromise<[]> => { + return request({ + url: '/mes/prodReport/planProcessChildren', + method: 'get', + params: query + }); +}; + +/** + * 按工序查询计划列表(不分页) + */ +export const processPlanList = (query): AxiosPromise<[]> => { + return request({ + url: '/mes/prodReport/processPlanList', + method: 'get', + params: query + }); +}; diff --git a/src/views/mes/wipTrackingReport/backup.vue b/src/views/mes/wipTrackingReport/backup.vue index 9bb782a..6bacd7f 100644 --- a/src/views/mes/wipTrackingReport/backup.vue +++ b/src/views/mes/wipTrackingReport/backup.vue @@ -106,6 +106,18 @@ + + + + + +
+
+
+
+ @@ -126,7 +138,7 @@ - + @@ -225,7 +237,7 @@ let processStatsChart: echarts.ECharts | null = null; // 列显隐信息 const columns = ref([ - { key: 0, label: '生产订单号', visible: true }, + { key: 0, label: '派工单号', visible: true }, { key: 1, label: '物料编号', visible: false }, { key: 2, label: '物料名称', visible: true }, { key: 3, label: '规格型号', visible: true }, @@ -247,7 +259,7 @@ const columns = ref([ const queryParams = ref({ pageNum: 1, pageSize: 10, - orderCode: '', + planCode: '', materialCode: '', materialName: '', progressStatus: '', @@ -294,7 +306,7 @@ function resetQuery() { queryParams.value = { pageNum: 1, pageSize: 10, - orderCode: '', + planCode: '', materialCode: '', materialName: '', progressStatus: '', @@ -449,49 +461,49 @@ function updateProgressChart() { function updateProcessStatsChart() { if (!processStatsChart || !reportList.value.length) return; - const processStats = { - '已完成': 0, - '进行中': 0, - '未开始': 0 - }; + const nowTs = Date.now(); + const statsMap = new Map(); reportList.value.forEach(item => { - if (item.processProgressList) { - item.processProgressList.forEach(process => { - if (process.isCompleted) { - processStats['已完成']++; - } else if (process.isInProgress) { - processStats['进行中']++; - } else { - processStats['未开始']++; - } - }); - } + (item.processProgressList || []).forEach((proc: any) => { + const name = proc.processName || '未知工序'; + const rec = statsMap.get(name) || { total: 0, notStarted: 0, incomplete: 0, delayed: 0, completed: 0 }; + + rec.total += 1; + const isCompleted = proc.isCompleted === 1 || !!proc.isCompleted; + const planStatus = proc.planStatus; + if (!isCompleted) rec.incomplete += 1; else rec.completed += 1; + if (planStatus === '0') rec.notStarted += 1; + + const planEndTime = proc.planEndTime ? new Date(proc.planEndTime).getTime() : null; + if (planEndTime && planEndTime < nowTs && !isCompleted) rec.delayed += 1; + + statsMap.set(name, rec); + }); }); + const topEntries = Array.from(statsMap.entries()).sort((a, b) => b[1].total - a[1].total).slice(0, 10); + const processNames = topEntries.map(([n]) => n); + const notStartedData = topEntries.map(([, v]) => v.notStarted); + const incompleteData = topEntries.map(([, v]) => v.incomplete); + const delayedData = topEntries.map(([, v]) => v.delayed); + const completionRateData = topEntries.map(([, v]) => (v.total > 0 ? +(v.completed * 100 / v.total).toFixed(2) : 0)); + const option = { - title: { - text: '工序完成率统计', - left: 'center', - textStyle: { fontSize: 14 } - }, - tooltip: { - trigger: 'item', - formatter: '{a}
{b}: {c} ({d}%)' - }, + title: { text: '工序工单统计(Top10)', left: 'center', textStyle: { fontSize: 14 } }, + tooltip: { trigger: 'axis' }, + legend: { data: ['未开工', '未完成', '延期', '完成率%'], bottom: 0 }, + grid: { left: '3%', right: '6%', top: 40, bottom: 60, containLabel: true }, + xAxis: { type: 'category', data: processNames }, + yAxis: [ + { type: 'value', name: '工单数' }, + { type: 'value', name: '完成率%', min: 0, max: 100, position: 'right' } + ], series: [ - { - name: '工序状态', - type: 'pie', - radius: ['40%', '70%'], - data: Object.entries(processStats).map(([name, value]) => ({ name, value })), - itemStyle: { - color: function(params: any) { - const colors = ['#722ed1', '#52c41a', '#d9d9d9']; - return colors[params.dataIndex]; - } - } - } + { name: '未开工', type: 'bar', stack: 'count', data: notStartedData }, + { name: '未完成', type: 'bar', stack: 'count', data: incompleteData }, + { name: '延期', type: 'bar', stack: 'count', data: delayedData }, + { name: '完成率%', type: 'line', yAxisIndex: 1, data: completionRateData, smooth: true } ] }; diff --git a/src/views/mes/wipTrackingReport/index.vue b/src/views/mes/wipTrackingReport/index.vue index b78cfdb..2aa25fc 100644 --- a/src/views/mes/wipTrackingReport/index.vue +++ b/src/views/mes/wipTrackingReport/index.vue @@ -4,6 +4,34 @@
+ + + + + + + + + + + + - + @@ -148,80 +176,38 @@
{{ Number(scope.row.completionRateNum || 0) }}% + 超额 +{{ Number(scope.row.completionRateNum || 0) - 100 }}%