修改成品包装线看板生产数量从PLC点位里面取值

Signed-off-by: Yangwl <1726150332@qq.com>
master
Yangwl 4 months ago
parent 33ca8a5049
commit f209a08ccb

@ -38,4 +38,12 @@ export function getPorOrderList(data) {
method: 'post', method: 'post',
data: data data: data
}); });
} }
export function getProductionNumberPLC(data){
return request({
url: '/mes/mesborad/getProductionNumberPLC',
method: 'post',
data: data
});
}

@ -373,12 +373,14 @@ import {
getProMonthNoOk, getProMonthNoOk,
getLineDayNoOk, getLineDayNoOk,
getMonthOfYearContrast, getMonthOfYearContrast,
} from "@/api/kanban/quality"; } from "@/api/kanban/quality";
import { import {
getDictData, getDictData,
getProduction15Days, getProduction15Days,
getProductionLineInfo, getProductionLineInfo,
getPorOrderList, getPorOrderList,
getProductionNumberPLC
} from "@/api/kanban/Packagingline"; } from "@/api/kanban/Packagingline";
import { getDeviceRefreshTime } from "@/api/kanban/equipment"; import { getDeviceRefreshTime } from "@/api/kanban/equipment";
import * as echarts from "echarts"; import * as echarts from "echarts";
@ -441,20 +443,28 @@ export default {
// //
actProduction: [], actProduction: [],
ceshitable: [{}, {}, {}, {}, {}, {}], ceshitable: [{}, {}, {}, {}, {}, {}],
pollTimer: null,
timer: null
}; };
}, },
created() {}, created() {},
destroyed() { destroyed() {
clearInterval(this.time1); clearInterval(this.time1);
this.time1 = null; this.time1 = null;
if (this.timer) clearInterval(this.timer);
}, },
mounted() { mounted() {
// this.datetime = moment().subtract(2, "day").format("yyyy-MM-DD"); // this.datetime = moment().subtract(2, "day").format("yyyy-MM-DD");
//console.log('zhuanhuahou',this.dateRangeone) //console.log('zhuanhuahou',this.dateRangeone)
// this.getdatalist(this.selectxt) // this.getdatalist(this.selectxt)
this.selectfactoryCodelist(); this.selectfactoryCodelist();
this.gettime(); this.gettime();
this.timer = setInterval(() => {
this.getProductionNumberPLC();
}, 10000);
},
beforeDestroy() {
}, },
methods: { methods: {
back() { back() {
@ -485,7 +495,7 @@ export default {
this.RefreshTime = response.data; this.RefreshTime = response.data;
this.time1 = setInterval(() => { this.time1 = setInterval(() => {
_this.getdatalist(_this.selectxt); _this.getdatalist(_this.selectxt);
},1000 * 60 * this.RefreshTime); },1000 * 5 );
} }
}); });
}, },
@ -507,57 +517,36 @@ export default {
const _this = this; const _this = this;
_this.initChart1(); _this.initChart1();
_this.piedata = []; _this.piedata = [];
// getProductionLineInfo({
// equCode: _this.selectxtclasses,
// factoryCode: "ds_" + _this.selectxt,
// }).then((response) => {
// if (response) {
// _this.workOrder = response.data.workOrder;
// _this.taskNum = response.data.taskNum;
// _this.taskSampleNum = response.data.taskSampleNum;
// if (response.data.piedata.checkList) {
// response.data.piedata.checkList.forEach((item) => {
// let a = {};
// let b = {};
// if (item.checkResult == "") {
// a.name = item.checkResult;
// a.value = item.quality;
// _this.piedata[0] = a;
// }
// if (item.checkResult == "") {
// b.name = item.checkResult;
// b.value = item.quality;
// _this.piedata[1] = b;
// }
// });
// _this.initChart2();
// } else {
// _this.initChart3();
// }
// }
// });
getPorOrderList({ getPorOrderList({
equCode: _this.selectxtclasses, equCode: _this.selectxtclasses,
factoryCode: "ds_" + _this.selectxt, factoryCode: "ds_" + _this.selectxt,
}).then((response) => { }).then((response) => {
if (response) { if (response) {
_this.orderdetail = response.data; _this.orderdetail = response.data;
// _this.gudingworkorderCodeSap = _this.orderdetail[0].workorderCodeSap;
if(_this.datetime == 0){ //
_this.gudingworkorderCodeSap = _this.orderdetail[0].workorderCodeSap; const w2Items = response.data.filter(item =>
item.status === 'w2'
);
this.actProduction = "000000"
if (w2Items.length) {
_this.gudingworkorderCodeSap = w2Items[0].workorderCodeSap;
_this.getorderdetail(_this.gudingworkorderCodeSap); _this.getorderdetail(_this.gudingworkorderCodeSap);
} }
_this.datetime+=1; // _this.getorderdetail(_this.gudingworkorderCodeSap);
if (_this.orderdetail.length == 0) { if (_this.orderdetail.length == 0) {
_this.orderdetail = this.ceshitable; _this.orderdetail = this.ceshitable;
} }
} }
}); });
}, },
// //
getorderdetail(item) { getorderdetail(item) {
const _this = this; const _this = this;
getProductionLineInfo({ getProductionLineInfo({
equCode: _this.selectxtclasses, equCode: _this.selectxtclasses,
factoryCode: "ds_" + _this.selectxt, factoryCode: "ds_" + _this.selectxt,
@ -586,9 +575,29 @@ export default {
} else { } else {
//_this.initChart3(); //_this.initChart3();
} }
_this.getProductionNumberPLC();
} }
}); });
}, },
//PLC
getProductionNumberPLC(){
const _this = this;
getProductionNumberPLC({
equCode: _this.selectxtclasses,
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("");
}
})
},
// //
selectline() { selectline() {
const _this = this; const _this = this;
@ -754,6 +763,9 @@ export default {
], ],
}; };
myChart6.setOption(option6); myChart6.setOption(option6);
getProduction15Days({ getProduction15Days({
equCode: _this.selectxtclasses, equCode: _this.selectxtclasses,
factoryCode: "ds_" + _this.selectxt, factoryCode: "ds_" + _this.selectxt,
@ -764,13 +776,9 @@ export default {
response.data.planProduction response.data.planProduction
).padStart(6, "0"); ).padStart(6, "0");
} }
if (response.data.actProduction.length < 6) {
response.data.actProduction = String(
response.data.actProduction
).padStart(6, "0");
}
this.planProduction = response.data.planProduction.split(""); this.planProduction = response.data.planProduction.split("");
this.actProduction = response.data.actProduction.split("");
let seriesdata1 = response.data.acts; let seriesdata1 = response.data.acts;
let seriesdata2 = response.data.plans; let seriesdata2 = response.data.plans;

Loading…
Cancel
Save