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