修改发泡线生产统计数据表格

master
夜笙歌 2 years ago
parent 3d2fa66271
commit a5b82e2fd0

@ -2,17 +2,17 @@
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset="UTF-8">
<meta name="viewport"
content="width=device-width,initial-scale=1.0">
<meta content="width=device-width,initial-scale=1.0"
name="viewport">
<title>发泡SCADA数据平台</title>
<meta name="description" content="U壳钣金SCADA数据平台">
<link href="../../static/css/main-style.css" th:href="@{/css/main-style.css}" rel="stylesheet"/>
<meta content="U壳钣金SCADA数据平台" name="description">
<link href="../../static/css/main-style.css" rel="stylesheet" th:href="@{/css/main-style.css}"/>
<!-- <link href="../../static/css/materialdesignicons.min.css" th:href="@{/css/materialdesignicons.min.css}" rel="stylesheet"/>-->
<!-- 360浏览器急速模式 -->
<meta name="renderer" content="webkit">
<meta content="webkit" name="renderer">
<!-- 避免IE使用兼容模式 -->
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<link rel="stylesheet" href="../../static/css/autoscroll-table.css" th:href="@{/css/autoscroll-table.css}">
<meta content="IE=edge" http-equiv="X-UA-Compatible">
<link href="../../static/css/autoscroll-table.css" rel="stylesheet" th:href="@{/css/autoscroll-table.css}">
</head>
<style>
@ -22,6 +22,7 @@
width: 0;
height: 0;
}
#top-left {
border: 0px solid red;
position: absolute;
@ -101,7 +102,6 @@
}
#bottom-mid {
position: absolute;
width: 43.3%;
@ -111,7 +111,6 @@
}
#oee {
position: absolute;
top: 14%;
@ -315,27 +314,27 @@
<!--运行状态-->
<div class="top-mid-Text-status" style="transform: translate(-50%,-50%);left: 33%;">
<img alt="运行状态" id="status-a" src="../../static/img/runImg.png" th:src="@{/img/runImg.png}" style="width:2vw"/>
<img alt="运行状态" id="status-a" src="../../static/img/runImg.png" style="width:2vw" th:src="@{/img/runImg.png}"/>
</div>
<div class="top-mid-Text-status" style="transform: translate(-50%,-50%);left:39%">
<img alt="运行状态" id="status-b" src="../../static/img/runImg.png" th:src="@{/img/runImg.png}" style="width:2vw"/>
<img alt="运行状态" id="status-b" src="../../static/img/runImg.png" style="width:2vw" th:src="@{/img/runImg.png}"/>
</div>
<div class="top-mid-Text-status" style="transform: translate(-50%,-50%);left:44.5%">
<img alt="运行状态" id="status-c" src="../../static/img/runImg.png" th:src="@{/img/runImg.png}" style="width:2vw"/>
<img alt="运行状态" id="status-c" src="../../static/img/runImg.png" style="width:2vw" th:src="@{/img/runImg.png}"/>
</div>
<div class="top-mid-Text-status" style="transform: translate(-50%,-50%);left:50.5%">
<img alt="运行状态" id="status-d" src="../../static/img/runImg.png" th:src="@{/img/runImg.png}" style="width:2vw"/>
<img alt="运行状态" id="status-d" src="../../static/img/runImg.png" style="width:2vw" th:src="@{/img/runImg.png}"/>
</div>
<!--运行状态-->
<div class="top-mid-Text-status" style="transform: translate(-50%,-50%);left:59.5%">
<img alt="运行状态" id="status-sys1" src="../../static/img/runImg.png" th:src="@{/img/runImg.png}" style="width:2vw"/>
<img alt="运行状态" id="status-sys1" src="../../static/img/runImg.png" style="width:2vw" th:src="@{/img/runImg.png}"/>
<!--<img alt="运行状态" src="../../static/img/stopImg.png" th:src="@{/img/stopImg.png}"/>-->
</div>
<div class="top-mid-Text-status" style="transform: translate(-50%,-50%);left:67%">
<img alt="运行状态" id="status-sys2" src="../../static/img/runImg.png" th:src="@{/img/runImg.png}" style="width:2vw"/>
<img alt="运行状态" id="status-sys2" src="../../static/img/runImg.png" style="width:2vw" th:src="@{/img/runImg.png}"/>
<!--<img alt="运行状态" src="../../static/img/stopImg.png" th:src="@{/img/stopImg.png}"/>-->
</div>
@ -369,8 +368,8 @@
showalert();
window.setInterval(showalert, 1000 * 30);
function showalert()
{
function showalert() {
var myTransition = $('.my-transition');
var myTransition2 = $('.my-transition2');
if (myTransition.hasClass('my-click-transiton')) {
@ -383,7 +382,6 @@
}
const orderInfColumns = [
"型号",
"计划数",
@ -408,11 +406,11 @@
}
const planInfo = new AutoScrollTable(document.getElementById("bottom-left"), [], {
width: ["5%", null, "7%", "5%", "5%", "5%", "8%", "4.2%", "4.2%", "4.2%", "4.2%", "4.2%", "4.2%", "4.2%", "4.2%", "4.2%", "4.2%", "4.2%", "4.2%"],
width: [null, "7%", "5%", "5%", "8%", "5%", "4.2%", "4.2%", "4.2%", "4.2%", "4.2%", "4.2%", "4.2%", "4.2%", "4.2%", "4.2%", "4.2%", "4.2%"],
})
const planInfo2 = new AutoScrollTable(document.getElementById("bottom-left-2"), [], {
width: ["5%", null, "7%", "5%", "5%", "5%", "8%", "4.2%", "4.2%", "4.2%", "4.2%", "4.2%", "4.2%", "4.2%", "4.2%", "4.2%", "4.2%", "4.2%", "4.2%"],
width: [null, "7%", "5%", "5%", "8%", "5%", "4.2%", "4.2%", "4.2%", "4.2%", "4.2%", "4.2%", "4.2%", "4.2%", "4.2%", "4.2%", "4.2%", "4.2%"],
})
function updateStatus(id, status) {
@ -453,71 +451,50 @@
}
})
autoUpdate('/system/FoamerMes/getPlanHourInfo', INTERVAL, data => {
// orderInf.loadData(data, Object.keys(orderInfColumns))
let consolidatedRow = ["", "合计", ""]
for (let i = 3; i < 19; i++) {
if (i === 6) {
consolidatedRow.push(`${(consolidatedRow[5] / consolidatedRow[4] * 100).toFixed(1)}%`)
continue
let filter = (arr, key, value, key2) => {
return arr.filter(e => e[key] === value)?.[0]?.[key2]
}
let sum = 0
for (let j = 1; j < data.length; j++) {
let d = data[j][i]
if (!d || d === '') {
continue
let totle = (arr, i) => {
return arr.map((e, index) => {
if (index !== 0) {
return e[i]
} else {
return 0
}
if (typeof d === 'string') {
d = parseInt(d)
}).reduce((a, b) => a + b)
}
sum += d
autoUpdate('/system/FoamerMes/getPlanHourInfo', INTERVAL, data => {
let name = []
let dataA = []
let dataB = []
dataA.push(['型号', '状态', '目标', '计划', '累计', '达成率', '8:00', '9:00', '10:00', '11:00', '12:00', '13:00', '14:00', '15:00', '16:00', '17:00', '18:00', '19:00'])
dataB.push(['型号', '状态', '目标', '计划', '累计', '达成率', '8:00', '9:00', '10:00', '11:00', '12:00', '13:00', '14:00', '15:00', '16:00', '17:00', '18:00', '19:00'])
data.forEach(e => {
if (!name.includes(e.orderType)) {
name.push(e.orderType)
}
consolidatedRow.push(sum.toString())
})
name.forEach((val, index) => {
if (index < 6) {
let arr = data.filter(e => e.orderType === val)
let plannedProduction = arr.map(e => e.plannedProduction).reduce((a, b) => a + b) || 0
let actualProduction = arr.map(e => e.actualProduction).reduce((a, b) => a + b) || 0
dataA.push([val.split(',')[0], '正常', arr[0].target, plannedProduction, actualProduction, plannedProduction === 0 ? '0%' : ((actualProduction / plannedProduction) * 100).toString().substr(0, 5) + '%', filter(arr, 'recordTime', 8, 'actualProduction') || 0, filter(arr, 'recordTime', 9, 'actualProduction') || 0, filter(arr, 'recordTime', 10, 'actualProduction') || 0, filter(arr, 'recordTime', 11, 'actualProduction') || 0, filter(arr, 'recordTime', 12, 'actualProduction') || 0, filter(arr, 'recordTime', 13, 'actualProduction') || 0, filter(arr, 'recordTime', 14, 'actualProduction') || 0, filter(arr, 'recordTime', 15, 'actualProduction') || 0, filter(arr, 'recordTime', 16, 'actualProduction') || 0, filter(arr, 'recordTime', 17, 'actualProduction') || 0, filter(arr, 'recordTime', 18, 'actualProduction') || 0, filter(arr, 'recordTime', 19, 'actualProduction') || 0])
}else{
let arr = data.filter(e => e.orderType === val)
let plannedProduction = arr.map(e => e.plannedProduction).reduce((a, b) => a + b) || 0
let actualProduction = arr.map(e => e.actualProduction).reduce((a, b) => a + b) || 0
dataB.push([val.split(',')[0], '正常', arr[0].target, plannedProduction, actualProduction, plannedProduction === 0 ? '0%' : ((actualProduction / plannedProduction) * 100).toString().substr(0, 5) + '%', filter(arr, 'recordTime', 8, 'actualProduction') || 0, filter(arr, 'recordTime', 9, 'actualProduction') || 0, filter(arr, 'recordTime', 10, 'actualProduction') || 0, filter(arr, 'recordTime', 11, 'actualProduction') || 0, filter(arr, 'recordTime', 12, 'actualProduction') || 0, filter(arr, 'recordTime', 13, 'actualProduction') || 0, filter(arr, 'recordTime', 14, 'actualProduction') || 0, filter(arr, 'recordTime', 15, 'actualProduction') || 0, filter(arr, 'recordTime', 16, 'actualProduction') || 0, filter(arr, 'recordTime', 17, 'actualProduction') || 0, filter(arr, 'recordTime', 18, 'actualProduction') || 0, filter(arr, 'recordTime', 19, 'actualProduction') || 0])
}
})
dataA.push(['合计', '', totle(dataA, 2), totle(dataA, 3), totle(dataA, 4), totle(dataB, 3) === 0 ? '0%' : ((totle(dataA, 4) / totle(dataA, 3)) * 100).toString().substr(0, 5) + '%', totle(dataA, 6), totle(dataA, 7), totle(dataA, 8), totle(dataA, 9), totle(dataA, 10), totle(dataA, 11), totle(dataA, 12), totle(dataA, 13), totle(dataA, 14), totle(dataA, 15), totle(dataA, 16), totle(dataA, 17)])
dataB.push(['合计', '', totle(dataB, 2), totle(dataB, 3), totle(dataB, 4), totle(dataB, 3) === 0 ? '0%' : ((totle(dataB, 4) / totle(dataB, 3)) * 100).toString().substr(0, 5) + '%', totle(dataB, 6), totle(dataB, 7), totle(dataB, 8), totle(dataB, 9), totle(dataB, 10), totle(dataB, 11), totle(dataB, 12), totle(dataB, 13), totle(dataB, 14), totle(dataB, 15), totle(dataB, 16), totle(dataB, 17)])
data.push(consolidatedRow)
planInfo.loadData(data, 19, {
planInfo.loadData(dataA, 18, {
includeHead: true,
})
//data.map(value => [value.orderType, value.plannedProduction, value.actualProduction, value.plannedProduction - value.actualProduction, `${(value.actualProduction / value.plannedProduction * 100).toFixed(2)}%`]
})
autoUpdate('/system/FoamerMes/getPlanHourInfo2', INTERVAL, data => {
// orderInf.loadData(data, Object.keys(orderInfColumns))
let consolidatedRow = ["", "合计", ""]
for (let i = 3; i < 19; i++) {
if (i === 6) {
consolidatedRow.push(`${(consolidatedRow[5] / consolidatedRow[4] * 100).toFixed(1)}%`)
continue
}
let sum = 0
for (let j = 1; j < data.length; j++) {
let d = data[j][i]
if (!d || d === '') {
continue
}
if (typeof d === 'string') {
d = parseInt(d)
}
sum += d
}
consolidatedRow.push(sum.toString())
}
data.push(consolidatedRow)
planInfo2.loadData(data, 19, {
planInfo2.loadData(dataB, 18, {
includeHead: true,
})
})

Loading…
Cancel
Save