From c297f060529b54d570fa94b1759a53bb9d34c0a1 Mon Sep 17 00:00:00 2001 From: Yangwl <1726150332@qq.com> Date: Tue, 1 Jul 2025 18:33:54 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BA=A7=E7=BA=BF=E7=9C=8B=E6=9D=BF=E4=BC=98?= =?UTF-8?q?=E5=8C=96?= 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 | 59 +++++++++++------------ 1 file changed, 29 insertions(+), 30 deletions(-) diff --git a/src/views/kanban/Packagingline/index2.vue b/src/views/kanban/Packagingline/index2.vue index d09c13a..09d8ce9 100644 --- a/src/views/kanban/Packagingline/index2.vue +++ b/src/views/kanban/Packagingline/index2.vue @@ -461,10 +461,10 @@ export default { // this.getdatalist(this.selectxt) this.selectfactoryCodelist(); this.gettime(); + this.startRotation() this.timer = setInterval(() => { this.getProductionNumberPLC(); }, 10000); - this.startRotation() }, beforeDestroy() { clearInterval(this.rotationTimer) @@ -503,17 +503,17 @@ export default { } }); }, - getDeviceRefreshTime() { - const _this = this; - getDeviceRefreshTime().then((response) => { - if (response) { - this.RefreshTime = response.data; - this.time1 = setInterval(() => { - _this.getdatalist(_this.selectxt); - },1000 * 60 * this.RefreshTime); - } - }); - }, + // getDeviceRefreshTime() { + // const _this = this; + // getDeviceRefreshTime().then((response) => { + // if (response) { + // this.RefreshTime = response.data; + // this.time1 = setInterval(() => { + // _this.getdatalist(_this.selectxt); + // },1000 * 60 * this.RefreshTime); + // } + // }); + // }, getDictData() { const _this = this; getDictData({ @@ -525,7 +525,7 @@ export default { this.dictDatatype = response; _this.selectxtclasses = _this.dictDatatype[0].equCode; _this.getdatalist(); - _this.getDeviceRefreshTime(); + // _this.getDeviceRefreshTime(); } }); }, @@ -557,10 +557,9 @@ export default { if (_this.orderdetail.length == 0) { _this.orderdetail = this.ceshitable; } + _this.getProductionNumberPLC(); } }); - - }, @@ -596,7 +595,7 @@ export default { } else { //_this.initChart3(); } - _this.getProductionNumberPLC(); + //_this.getProductionNumberPLC(); } }); }, @@ -608,19 +607,7 @@ export default { factoryCode: "ds_" + _this.selectxt, workorderCode: _this.workOrder.workorderCode }).then((response) => { - if (response) { - // 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); + if (response.data) { // 获取基础产量并格式化为6位字符串 const baseQty = Number(response.data.qty_build); let strQty = baseQty.toString(); @@ -639,7 +626,19 @@ export default { // 赋值给actProduction this.actProduction = totalStr.split(""); - console.log('总产量:', total); + console.log('总产量1:', this.actProduction); + }else { + // 计算orderdetail中的总产量 + const detailTotal = _this.orderdetail.reduce((sum, item) => { + return sum + (item.quantityProduced || 0); + }, 0); + // 计算总和并保持6位格式 + const total = detailTotal; + const totalStr = total.toString().padStart(6, "0"); + + // 赋值给actProduction + this.actProduction = totalStr.split(""); + console.log('总产量2:', this.actProduction); } }) },