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