@@ -420,8 +420,7 @@ export default {
total: 0,
statusFilters: [
{ text: '未开工', value: '未开工' },
- { text: '进行中', value: '进行中' },
- { text: '已延期', value: '已延期' },
+ { text: '生产中', value: '生产中' },
{ text: '已完工', value: '已完工' }
],
// 工序计划主表格数据
@@ -718,10 +717,6 @@ export default {
const overallOkQty = row.overallOkQty != null && row.overallOkQty !== ''
? this.normalizeNumber(row.overallOkQty)
: this.normalizeNumber((finalProcess && finalProcess.okQty) ?? 0);
- const backendOverallProgress = this.normalizePercent(row.overallProgress);
- const overallProgress = backendOverallProgress != null
- ? Math.round(backendOverallProgress)
- : (overallPlanQty > 0 ? Math.min(100, Math.round((overallOkQty / overallPlanQty) * 100)) : 0);
const processSteps = processList.map(p => {
const planQty = this.normalizeNumber(p.__effectivePlanQty != null ? p.__effectivePlanQty : (p.planQty || overallPlanQty));
@@ -729,13 +724,13 @@ export default {
const inQty = this.normalizeNumber(p.__effectiveInQty != null ? p.__effectiveInQty : p.inQty);
const ngQty = this.normalizeNumber(p.ngQty);
const transOutQty = this.normalizeNumber(p.transOutQty);
- const backendProgress = this.normalizePercent(p.progress);
- const baseQty = p.inQty != null ? inQty : okQty;
- const fallbackProgress = planQty > 0 ? (baseQty / planQty) * 100 : 0;
- const percent = backendProgress != null ? backendProgress : this.normalizePercent(fallbackProgress) || 0;
+ // 进度 = 合格数量 / 工序数量 * 100
+ const percent = planQty > 0
+ ? Math.min(100, Math.max(0, Math.round((okQty / planQty) * 100)))
+ : 0;
const phase = this.calcProcessStepPhase(p, planQty, okQty, inQty, ngQty, transOutQty);
- const displayPercent = this.calcStepDisplayPercent(phase, planQty, okQty, inQty, ngQty, percent);
- const activeLabel = this.calcStepActiveLabel(planQty, okQty, inQty, ngQty, displayPercent);
+ const displayPercent = phase === 'done' ? 100 : percent;
+ const activeLabel = percent > 0 ? `${percent}%` : '入';
return {
operNo: p.operNo,
@@ -750,6 +745,8 @@ export default {
});
const lineText = this.buildLineText(processList);
+ const processProgress = this.resolveRowProcessProgress(processList, processSteps);
+ const processStatus = this.resolveStatusByProgress(processProgress);
return {
...row,
@@ -757,18 +754,64 @@ export default {
processSteps,
overallPlanQty,
overallOkQty,
- overallProgress,
+ processStatus,
+ processProgress,
lineText
};
},
+ /** 当前工序:优先取未完工的第一道,否则取最后一道 */
+ resolveCurrentProcess(processList) {
+ if (!processList || !processList.length) return null;
+ for (let i = 0; i < processList.length; i++) {
+ const p = processList[i];
+ const planQty = this.normalizeNumber(p.__effectivePlanQty != null ? p.__effectivePlanQty : p.planQty);
+ const okQty = this.normalizeNumber(p.okQty);
+ const inQty = this.normalizeNumber(p.__effectiveInQty != null ? p.__effectiveInQty : p.inQty);
+ const transOutQty = this.normalizeNumber(p.transOutQty);
+ const phase = this.calcProcessStepPhase(p, planQty, okQty, inQty, this.normalizeNumber(p.ngQty), transOutQty);
+ if (phase !== 'done') return p;
+ }
+ return processList[processList.length - 1];
+ },
+ /**
+ * 工序状态按进度:0 未开工;>0 生产中;100 已完工
+ */
+ resolveStatusByProgress(progress) {
+ const p = this.normalizeNumber(progress);
+ if (p <= 0) return '未开工';
+ if (p >= 100) return '已完工';
+ return '生产中';
+ },
+ /** 工序进度:合格数量 / 工序数量 * 100(取当前工序) */
+ resolveRowProcessProgress(processList, processSteps) {
+ const current = this.resolveCurrentProcess(processList);
+ if (!current) return 0;
+ const planQty = this.normalizeNumber(
+ current.__effectivePlanQty != null ? current.__effectivePlanQty : current.planQty
+ );
+ const okQty = this.normalizeNumber(current.okQty);
+ if (planQty <= 0) return 0;
+ if (processSteps && processSteps.length && processSteps.every(s => s.phase === 'done')) {
+ return 100;
+ }
+ return Math.min(100, Math.max(0, Math.round((okQty / planQty) * 100)));
+ },
calcProcessStepPhase(process, planQty, okQty, inQty, ngQty, transOutQty) {
const status = this.calcProcessStatus(process);
- if (status === '已转出' || status === '工序完成' || status === '已关闭') return 'done';
- if (transOutQty > 0) return 'done';
- if (planQty > 0 && okQty >= planQty) return 'done';
+ if (status === '已关闭') return 'done';
+ // 工序数=转入=合格=转出 才算完工
+ if (planQty > 0
+ && this.qtyEquals(planQty, inQty)
+ && this.qtyEquals(planQty, okQty)
+ && this.qtyEquals(planQty, transOutQty)) {
+ return 'done';
+ }
if (inQty === 0) return 'idle';
return 'active';
},
+ qtyEquals(a, b) {
+ return Math.abs(this.normalizeNumber(a) - this.normalizeNumber(b)) <= 0.0001;
+ },
calcStepDisplayPercent(phase, planQty, okQty, inQty, ngQty, percent) {
if (phase === 'done') return 100;
if (phase === 'idle') return 0;
@@ -833,7 +876,7 @@ export default {
},
overallStatusText(row) {
if (!row) return '-';
- return row.overallStatus || '-';
+ return row.processStatus || '-';
},
filterOrderStatus(value, row) {
return this.overallStatusText(row) === value;
@@ -841,8 +884,7 @@ export default {
overallStatusTagClass(row) {
const text = this.overallStatusText(row);
if (text === '未开工') return 'tag-gray';
- if (text === '进行中') return 'tag-green';
- if (text === '已延期') return 'tag-red';
+ if (text === '生产中') return 'tag-green';
if (text === '已完工') return 'tag-blue';
return 'tag-gray';
},
@@ -1051,16 +1093,26 @@ export default {
if (!process) return '';
const rawK3 = process.k3Status ?? process.operStatus ?? process.k3OperStatus;
- const k3 = rawK3 == null || rawK3 === '' ? 0 : Number(rawK3);
- if (k3 === 5 || k3 === 6) return '已关闭';
+ const k3Code = rawK3 == null || rawK3 === '' ? '' : String(rawK3).trim();
+ const k3Num = Number(k3Code);
+ if (k3Num === 5 || k3Num === 6 || k3Code === '完工' || k3Code === '关闭' || k3Code === '已关闭') {
+ return '已关闭';
+ }
+ const planQty = this.normalizeNumber(process.planQty);
const inQty = this.normalizeNumber(process.__effectiveInQty != null ? process.__effectiveInQty : process.inQty);
const okQty = this.normalizeNumber(process.okQty);
const ngQty = this.normalizeNumber(process.ngQty);
const transOutQty = this.normalizeNumber(process.transOutQty);
if (inQty === 0) return '未开工';
- if (transOutQty > 0) return '已转出';
+ // 工序数=转入=合格=转出 才算已转出完工
+ if (planQty > 0
+ && this.qtyEquals(planQty, inQty)
+ && this.qtyEquals(planQty, okQty)
+ && this.qtyEquals(planQty, transOutQty)) {
+ return '已转出';
+ }
if (okQty + ngQty >= inQty) return '工序完成';
if (okQty + ngQty > 0) return '质检中';
return '生产中';
diff --git a/src/views/system/orderPro/index.vue b/src/views/system/orderPro/index.vue
index b98d374..cfb27e7 100644
--- a/src/views/system/orderPro/index.vue
+++ b/src/views/system/orderPro/index.vue
@@ -8,6 +8,13 @@
项目总数
+
+
+
+ {{ overviewStats.inProgress }}
+ 进行中
+
+
@@ -26,7 +33,7 @@
{{ overviewStats.inProduction }}
- 生产中数量
+ 生产中
@@ -61,6 +68,17 @@
+
+ 设计人
+
+
+
+
搜索
重置
@@ -114,7 +132,7 @@
项目状态
设置状态
+ 出图导入模板
+
+
+ 导入出图时间
+
+
@@ -229,17 +262,23 @@