From 2592b069829d66b582bef88d8b0831dc227551ad Mon Sep 17 00:00:00 2001 From: Yangwl <1726150332@qq.com> Date: Tue, 1 Jul 2025 16:13:37 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BA=A7=E7=BA=BF=E7=9C=8B=E6=9D=BF=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=E5=A2=9E=E5=8A=A0=E7=94=9F=E4=BA=A7=E7=9A=84=E4=BA=A7?= =?UTF-8?q?=E7=BA=BF=E7=AD=9B=E9=80=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Yangwl <1726150332@qq.com> --- src/views/kanban/Packagingline/index2.vue | 38 +++++++++++++++++++---- 1 file changed, 32 insertions(+), 6 deletions(-) diff --git a/src/views/kanban/Packagingline/index2.vue b/src/views/kanban/Packagingline/index2.vue index 0e00b90..d09c13a 100644 --- a/src/views/kanban/Packagingline/index2.vue +++ b/src/views/kanban/Packagingline/index2.vue @@ -110,7 +110,7 @@ 产品名称 批次号 计划数量 - 完成数量 + 报工数量 @@ -519,6 +519,7 @@ export default { getDictData({ factoryCode: "ds_" + _this.selectxt, equipmentTypeCode: "equ_type_bzx", + isqua: "1" }).then((response) => { if (response) { this.dictDatatype = response; @@ -571,6 +572,7 @@ export default { factoryCode: "ds_" + _this.selectxt, workorderCodeSap: item, }).then((response) => { + console.log(response); if (response) { _this.workOrder = response.data.workOrder; _this.taskNum = response.data.taskNum; @@ -607,13 +609,37 @@ export default { workorderCode: _this.workOrder.workorderCode }).then((response) => { if (response) { - let strQty = response.data.qty_total.toString(); + // let strQty = response.data.qty_total.toString(); + // if (strQty.length < 6) { + // strQty = String( + // strQty + // ).padStart(6, "0"); + // } + // this.actProduction = strQty.split(""); + // // 计算总产量 + // const totalProduction = _this.orderdetail.reduce((sum, item) => { + // return sum + (item.quantityProduced || 0); + // }, Number(this.actProduction.join(""))); + // console.log('总产量:', totalProduction); + // 获取基础产量并格式化为6位字符串 + const baseQty = Number(response.data.qty_build); + let strQty = baseQty.toString(); if (strQty.length < 6) { - strQty = String( - strQty - ).padStart(6, "0"); + strQty = strQty.padStart(6, "0"); } - this.actProduction = strQty.split(""); + + // 计算orderdetail中的总产量 + const detailTotal = _this.orderdetail.reduce((sum, item) => { + return sum + (item.quantityProduced || 0); + }, 0); + + // 计算总和并保持6位格式 + const total = baseQty + detailTotal; + const totalStr = total.toString().padStart(6, "0"); + + // 赋值给actProduction + this.actProduction = totalStr.split(""); + console.log('总产量:', total); } }) },