Merge remote-tracking branch 'gitee/master'

master
wangh 3 years ago
commit a42d56b6e7

@ -8,16 +8,16 @@ $(() => {
const INTERVAL = 30000
const request = () => {
const request = async () => {
// 目标
$.post(url + "/selectProductInTarget", {}, data => {
await $.post(url + "/selectProductInTarget", {}, data => {
data = JSON.parse(data)
target.topTips = data.find(val => val.name == "进度目标").qty
Tips('#Tips')
if (isFirst){
isFirst = false
request()
}
targetTop.tips = data.find(val => val.name == "目标").qty
})
// 终检一次不合格率目标
await $.post(url + "/selectOneBadRateMb", {}, data => {
data = JSON.parse(data)
targetBottom.tips = data.rate
})
// LOSS(分类)
$.post(url + "/selectLossInfo", {}, data => {
@ -33,61 +33,52 @@ $(() => {
data = JSON.parse(data)
jp(data.qty)
})
// 终检一次不合格率目标
$.post(url + "/selectOneBadRateMb", {}, data => {
data = JSON.parse(data)
target.bottomTips = data.rate
for (let i = 0; i < 12; i++) {
target.bottom.push(data.rate)
}
})
// 产量
$.post(url + `/selectProductInByTeam/${yieldType}`, {}, data => {
data = JSON.parse(data)
console.log(data)
target.topReality = data.map(val => val.qty).reduce((val1, val2) => val1 + val2, 0)
target.topGap = target.topProgress - target.topReality
if (target.topProgress != 0){
target.topRate = ((target.topReality / target.topProgress).toFixed(4) * 100 + '').substring(0, 5)
}else{
target.topRate = 0
}
Tips('#Tips')
// 实际
targetTop.reality = data.map(val => val.qty).reduce((val1, val2) => val1 + val2, 0)
// 起始时间
let oneTime = parseFloat(data[0].name.split(':')[0])
// 横坐标
let xName = []
if (yieldType == 0) {
let arr = []
for (let i = 0; i < 12; i++) {
arr.push(Math.ceil(target.topTips / 11))
arr.push(Math.ceil(targetTop.tips / 11))
}
arr[3] = Math.ceil(target.topTips / 22)
arr[8] = Math.ceil(target.topTips / 22)
arr[0] = arr[0] - (arr.reduce((val1, val2) => val1 + val2, 0) - target.topTips)
target.top = arr
target.topProgress = arr.slice(0,data.length).reduce((val1, val2) => val1 + val2, 0)
target.topProgress = 399
arr[3] = Math.ceil(targetTop.tips / 22)
arr[8] = Math.ceil(targetTop.tips / 22)
arr[0] = arr[0] - (arr.reduce((val1, val2) => val1 + val2, 0) - targetTop.tips)
targetTop.targetArr = arr
targetTop.progress = arr.slice(0, data.length).reduce((val1, val2) => val1 + val2, 0)
for (let i = 0; i < 12; i++) {
xName.push(`${(oneTime + i) % 24}:30`)
}
} else {
let arr = []
for (let i = 0; i < 24; i++) {
arr.push(Math.ceil(target.topTips / 23))
arr.push(Math.ceil(targetTop.tips / 23))
}
arr[8] = Math.ceil(target.topTips / 46)
arr[13] = Math.ceil(target.topTips / 46)
arr[0] = arr[0] - (arr.reduce((val1, val2) => val1 + val2, 0) - target.topTips)
target.top = arr
target.topProgress = arr.slice(0,data.length).reduce((val1, val2) => val1 + val2, 0)
// target.topProgress = 399
xName = ['0:00','1:00','2:00','3:00','4:00','5:00','6:00','7:00','8:00','9:00','10:00','11:00','12:00','13:00','14:00','15:00','16:00','17:00','18:00','19:00','20:00','21:00','22:00','23:00']
arr[8] = Math.ceil(targetTop.tips / 46)
arr[13] = Math.ceil(targetTop.tips / 46)
arr[0] = arr[0] - (arr.reduce((val1, val2) => val1 + val2, 0) - targetTop.tips)
targetTop.targetArr = arr
targetTop.progress = arr.slice(0, data.length).reduce((val1, val2) => val1 + val2, 0)
xName = ['0:00', '1:00', '2:00', '3:00', '4:00', '5:00', '6:00', '7:00', '8:00', '9:00', '10:00', '11:00', '12:00', '13:00', '14:00', '15:00', '16:00', '17:00', '18:00', '19:00', '20:00', '21:00', '22:00', '23:00']
}
// 达成率
if (targetTop.progress != 0) {
targetTop.rate = ((targetTop.reality / targetTop.progress)).toFixed(4) * 100
} else {
targetTop.rate = 0
}
targetTop.gap = targetTop.progress - targetTop.reality
barChartAndLineChartThree({
xName: xName,
yDataOne: data.map(val => val.qty),
yDataOneName: "实际产量",
yDataTwo: target.top,
yDataTwo: targetTop.targetArr,
yDataTwoName: "目标产量",
}, document.getElementById("yield"));
})
@ -98,30 +89,37 @@ $(() => {
let oneTime = parseFloat(data[0].name.split(':')[0])
let xName = []
if (yieldType == 0) {
let arr = []
for (let i = 0; i < 12; i++) {
arr.push(targetBottom.tips)
xName.push(`${(oneTime + i) % 24}:30`)
}
targetBottom.targetArr = arr
} else {
xName = ['0:00','1:00','2:00','3:00','4:00','5:00','6:00','7:00','8:00','9:00','10:00','11:00','12:00','13:00','14:00','15:00','16:00','17:00','18:00','19:00','20:00','21:00','22:00','23:00']
let arr = []
for (let i = 0; i < 24; i++) {
arr.push(targetBottom.tips)
}
targetBottom.targetArr = arr
xName = ['0:00', '1:00', '2:00', '3:00', '4:00', '5:00', '6:00', '7:00', '8:00', '9:00', '10:00', '11:00', '12:00', '13:00', '14:00', '15:00', '16:00', '17:00', '18:00', '19:00', '20:00', '21:00', '22:00', '23:00']
}
target.bottomReality = (data.map(val => val.rate).reduce((val1, val2) => val1 + val2, 0) / data.map(val => val.rate).length).toFixed(2)
target.bottomTotal = data.map(val => val.qty).reduce((val1, val2) => val1 + val2, 0)
Tips('#Tips')
targetBottom.reality = ((data.map(val => val.rate).reduce((val1, val2) => val1 + val2, 0) / data.map(val => val.rate).length)).toFixed(4)
targetBottom.total = data.map(val => val.qty).reduce((val1, val2) => val1 + val2, 0)
barChartAndLineChartFour({
xName: xName,
yDataOne: data.map(val => val.qty),
yDataOneName: "不良数",
yDataTwo: data.map(val => val.rate),
yDataTwoName: "一次不合格率",
yDataThree: target.bottom,
yDataThree: targetBottom.targetArr,
yDataThreeName: "目标",
}, document.getElementById("fractionDefective"));
})
//追踪事件轮询
//当班入库执行订单
$.post(url + "/selectInStoreOrderInfo", {}, data => {
data = JSON.parse(data)
total('#total',data.map(val => val.actual_number).reduce((val1,val2) => val1 + val2 ,0))
total('#total', data.map(val => val.actual_number).reduce((val1, val2) => val1 + val2, 0))
$('#trackEvents').remove()
$('.trackEventsScrollTable').html('<div class="trackEvents" id="trackEvents"></div>')
dynamicTable({
@ -129,7 +127,7 @@ $(() => {
rowNum: 5,
timeout: 0,
header: ["订单编号", '产品型号', "计划数量", "完成数量", "执行进度", "时间"],
data: data.map(value => [value.plan_code.slice(4, value.plan_code.length), value.name.split('-')[1], value.plan_number, value.actual_number, ((value.actual_number /value.plan_number).toFixed(4) * 100 + '').slice(0,5) + '%', value.day]),
data: data.map(value => [value.plan_code.slice(4, value.plan_code.length), value.name.split('-')[1], value.plan_number, value.actual_number, value.plan_number === 0? 0 :((value.actual_number / value.plan_number)* 100 + '').slice(0, 5) + '%', value.day]),
index: false,
fontColor: '#B4B7BF ',
indexBGC: '#86F3FF',
@ -156,19 +154,40 @@ $(() => {
})
let yieldType = '0'
let isFirst = true
let target = {
top: [],
bottom: [3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3],
topTips: 0,
bottomTips: 3.05,
topProgress: 0,
topReality: 0,
topGap: 0,
topRate: 0,
bottomReality:0,
bottomTotal:0,
let targetTopRaw = {
targetArr: [],
tips: 0,
progress: 0,
reality: 0,
gap: 0,
rate: 0,
}
let targetBottomRaw = {
targetArr: [],
tips: 0,
reality: 0,
total: 0,
}
const targetTopProxy = {
get: function (target, key) {
return target[key];
},
set: function (target, key, value) {
target[key] = value;
TipsTop('#TipsTop')
}
}
const targetBottomProxy = {
get: function (target, key) {
return target[key];
},
set: function (target, key, value) {
target[key] = value;
TipsBottom('#TipsBottom')
}
}
const targetTop = new Proxy(targetTopRaw, targetTopProxy)
const targetBottom = new Proxy(targetBottomRaw, targetBottomProxy)
const LOSS = (val = 0) => {
const html = `
<span style="position: absolute;top: 15.7%;left: 61.8%;color: #CFD2D0;font-size: 2vw;transform: translateX(-50%)">${val}</span>
@ -195,21 +214,20 @@ const moduleTitle = () => {
$('body').append(html)
}
// 目标
const Tips = (el, top = {
target: target.topTips,
progress: target.topProgress,
reality: target.topReality,
gap: target.topGap,
rate: target.topRate,
}, bottom = {target: target.bottomTips, reality: target.bottomReality, total: target.bottomTotal}) => {
const TipsTop = (el) => {
const html = `
<span style="position: absolute;top: 10%;left: 19%;color: #fff;font-size: 1vw;">目标${top.target}&nbsp;&nbsp;进度目标${top.progress}&nbsp;&nbsp;实际${top.reality}&nbsp;&nbsp;差异${top.gap}&nbsp;&nbsp;达成率${top.rate}% </span>
<span style="position: absolute;top: 54.3%;left: 19%;color: #fff;font-size: 1vw">目标${bottom.target}% &nbsp;&nbsp;&nbsp;实际${bottom.reality}% &nbsp;&nbsp;&nbsp;累计不良数${bottom.total}</span>
<span style="position: absolute;top: 10%;left: 19%;color: #fff;font-size: 1vw;">目标${targetTop.tips}&nbsp;&nbsp;进度目标${targetTop.progress}&nbsp;&nbsp;实际${targetTop.reality}&nbsp;&nbsp;差异${targetTop.gap}&nbsp;&nbsp;达成率${targetTop.rate}% </span>
`
$(el).html(html)
}
const TipsBottom = (el) => {
const html = `
<span style="position: absolute;top: 54.3%;left: 19%;color: #fff;font-size: 1vw">目标${targetBottom.tips}% &nbsp;&nbsp;&nbsp;实际${targetBottom.reality}% &nbsp;&nbsp;&nbsp;累计不良数${targetBottom.total}</span>
`
$(el).html(html)
}
// 入库执行订单合计
const total = (el,val=0) => {
const total = (el, val = 0) => {
const html = `
<span style="position: absolute;top: 54.3%;left: 66.7%;color: #CFD2D0;font-size: 1.0vw">合计${val}</span>
`

@ -1,103 +1,188 @@
$(() => {
moduleTitle()
safe('#safe')
Tips(0,0,0,'#Tips')
total( 0,'#total')
card({top: 60, left: 30.5,title:'内胆检漏',name1:'问题1',value1:'值1',name2:'问题2',value2:'值2',name3:'问题3',value3:'值3'},'#cardOne')
card({top: 60, left: 38.5,title:'安全检测',name1:'问题1',value1:'值1',name2:'问题2',value2:'值2',name3:'问题3',value3:'值3'},'#cardTwo')
card({top: 60, left: 46.5,title:'成品检漏',name1:'问题1',value1:'值1',name2:'问题2',value2:'值2',name3:'问题3',value3:'值3'},'#cardThree')
card({top: 60, left: 54.5,title:'测温性能',name1:'问题1',value1:'值1',name2:'问题2',value2:'值2',name3:'问题3',value3:'值3'},'#cardFour')
card({top: 60, left: 62.5,title:'成品外观',name1:'问题1',value1:'值1',name2:'问题2',value2:'值2',name3:'问题3',value3:'值3'},'#cardFive')
Tips(0, 0, 0, '#Tips')
total(0, '#total')
card({
top: 60,
left: 30.5,
title: '内胆检漏',
name1: '问题1',
value1: '值1',
name2: '问题2',
value2: '值2',
name3: '问题3',
value3: '值3'
}, '#cardOne')
card({
top: 60,
left: 38.5,
title: '安全检测',
name1: '问题1',
value1: '值1',
name2: '问题2',
value2: '值2',
name3: '问题3',
value3: '值3'
}, '#cardTwo')
card({
top: 60,
left: 46.5,
title: '成品检漏',
name1: '问题1',
value1: '值1',
name2: '问题2',
value2: '值2',
name3: '问题3',
value3: '值3'
}, '#cardThree')
card({
top: 60,
left: 54.5,
title: '测温性能',
name1: '问题1',
value1: '值1',
name2: '问题2',
value2: '值2',
name3: '问题3',
value3: '值3'
}, '#cardFour')
card({
top: 60,
left: 62.5,
title: '成品外观',
name1: '问题1',
value1: '值1',
name2: '问题2',
value2: '值2',
name3: '问题3',
value3: '值3'
}, '#cardFive')
// 公共请求地址
let url = 'mtk'
// let url = ''
let url = '/broad/mtk'
// 轮询间隔时间
const INTERVAL = 30000
//每日人力出勤轮询
autoUpdate(url + "/team6s ", INTERVAL, data => {
console.log(data)
data ??= [
{
teamName: '班组1',
teamNumber: 72,
path:''
},
{
teamName: '班组2',
teamNumber: 52,
path:''
},
{
teamName: '班组3',
teamNumber: 72,
path:''
},
{
teamName: '班组4',
teamNumber: 29,
path:''
},
{
teamName: '班组5',
teamNumber: 82,
path:''
},
{
teamName: '班组6',
teamNumber: 82,
path:''
},
{
teamName: '班组7',
teamNumber: 28,
path:''
},
{
teamName: '班组8',
teamNumber: 62,
path:''
},
{
teamName: '班组9',
teamNumber: 82,
path:''
},
{
teamName: '班组10',
teamNumber: 38,
path:''
},
{
teamName: '班组11',
teamNumber: 93,
path:''
},
]
data.sort((a,b)=>{
return b.teamNumber - a.teamNumber
})
console.log(data)
singleVerticalBarChartTwo({
xName: data.map(val => val.teamName),
yData: data.map(val => val.teamNumber),
yImg: data.map(val => val.path),
}, document.getElementById("manpowerAttendance"))
data ??= [
{
teamName: '班组1',
teamNumber: 72,
path: ''
},
{
teamName: '班组2',
teamNumber: 52,
path: ''
},
{
teamName: '班组3',
teamNumber: 72,
path: ''
},
{
teamName: '班组4',
teamNumber: 29,
path: ''
},
{
teamName: '班组5',
teamNumber: 82,
path: ''
},
{
teamName: '班组6',
teamNumber: 82,
path: ''
},
{
teamName: '班组7',
teamNumber: 28,
path: ''
},
{
teamName: '班组8',
teamNumber: 62,
path: ''
},
{
teamName: '班组9',
teamNumber: 82,
path: ''
},
{
teamName: '班组10',
teamNumber: 38,
path: ''
},
{
teamName: '班组11',
teamNumber: 93,
path: ''
},
]
data.sort((a, b) => {
return b.teamNumber - a.teamNumber
})
singleVerticalBarChartTwo({
xName: data.map(val => val.teamName),
yData: data.map(val => val.teamNumber),
yImg: data.map(val => val.path),
}, document.getElementById("manpowerAttendance"))
})
// IQC
horizontalRoundedBarChartWithBackgroundTwo(null, document.getElementById("IQC"))
// 三日订单执行情况
autoUpdate(url + "/inStore3d", INTERVAL, data => {
console.log(data)
horizontalRoundedBarChartWithBackgroundTwo({
yNameOne: data.map(val => val.name),
yData: data.map(val => val.rate),
xDataName: "达成率",
}, document.getElementById("IQC"))
})
// 设备功率
singleVerticalBarChart(null, document.getElementById("equipmentPower"))
// autoUpdate(url + "/inStore3d", INTERVAL, data => {
singleVerticalBarChart({
xName: ["1月", "2月", "3月", "4月", "5月", "6月", "7月"],
yData: [12, 20, 11, 30, 14, 80, 50],
}, document.getElementById("equipmentPower"))
// })
// 生产效率
// autoUpdate(url + "/ ", INTERVAL, data => {
singleVerticalBarChart(null, document.getElementById("productionEfficiency"))
singleVerticalBarChart({
xName: ["1月", "2月", "3月", "4月", "5月", "6月", "7月"],
yData: [12, 20, 11, 30, 14, 80, 50],
}, document.getElementById("productionEfficiency"))
// })
// 成品入库统计
percentageRingDiagram(null, document.getElementById("mainData"))
// autoUpdate(url + "/inStore3d", INTERVAL, data => {
percentageRingDiagram([
{
name: "内胆检漏",
value: 54,
},
{
name: "安全检测",
value: 44,
},
{
name: "成品检漏",
value: 35,
},
{
name: "测温性能",
value: 30,
},
{
name: "成品外观",
value: 44,
},
], document.getElementById("mainData"))
// })
})
const today = () => {
@ -141,7 +226,17 @@ const safe = (el) => {
$(el).html(html)
}
const card = (val = {top: 1, left: 1,title:'',name1:'',value1:'',name2:'',value2:'',name3:'',value3:''},el) => {
const card = (val = {
top: 1,
left: 1,
title: '',
name1: '',
value1: '',
name2: '',
value2: '',
name3: '',
value3: ''
}, el) => {
const html = `
<div style="position: absolute;top: ${val.top}%;left: ${val.left}%;width:7%;height:15%;border: 1px solid #0E72F1;">
<div style="position: absolute;top: 0%;left: 0%;width:100%;height:15%;background-color: #0C71F3;text-align: center;font-size: 0.75vw;line-height: 1.2vw">

@ -913,6 +913,9 @@ const barChartAndLineChartFour = function (data, id) {
}
]
};
if (Math.max(...data.yDataOne) <=5){
option.yAxis[0].max = 5
}
charts.setOption(option);
$(window).resize(charts.resize);
@ -1584,12 +1587,11 @@ const singleVerticalBarChart = function (data, id) {
}
const singleVerticalBarChartTwo = function (data, id) {
let charts = echarts.init(id);
let walk =
'path://M29.902,23.275c1.86,0,3.368-1.506,3.368-3.365c0-1.859-1.508-3.365-3.368-3.365 c-1.857,0-3.365,1.506-3.365,3.365C26.537,21.769,28.045,23.275,29.902,23.275z M36.867,30.74c-1.666-0.467-3.799-1.6-4.732-4.199 c-0.932-2.6-3.131-2.998-4.797-2.998s-7.098,3.894-7.098,3.894c-1.133,1.001-2.1,6.502-0.967,6.769 c1.133,0.269,1.266-1.533,1.934-3.599c0.666-2.065,3.797-3.466,3.797-3.466s0.201,2.467-0.398,3.866 c-0.599,1.399-1.133,2.866-1.467,6.198s-1.6,3.665-3.799,6.266c-2.199,2.598-0.6,3.797,0.398,3.664 c1.002-0.133,5.865-5.598,6.398-6.998c0.533-1.397,0.668-3.732,0.668-3.732s0,0,2.199,1.867c2.199,1.865,2.332,4.6,2.998,7.73 s2.332,0.934,2.332-0.467c0-1.401,0.269-5.465-1-7.064c-1.265-1.6-3.73-3.465-3.73-5.265s1.199-3.732,1.199-3.732 c0.332,1.667,3.335,3.065,5.599,3.399C38.668,33.206,38.533,31.207,36.867,30.74z';
if (!data) {
data = {
xName: ['0时', '2时', '4时', '6时', '8时', '10时', '12时', '14时'],
yData: [38, 60, 40, 55, 42, 39, 45, 40],
yImg: ['','','','','','','',''],
}
}
let option = {
@ -1674,23 +1676,6 @@ const singleVerticalBarChartTwo = function (data, id) {
type: 'bar',
barMaxWidth: 'auto',
barWidth: 1.5 * vw,
// label: {
// show: true,
// position: 'top',
// // distance: 10,
// color: '#fff',
// formatter: '{a|}',
// rich: {
// a: {
// width: 3 * vw,
// height: 3 * vw,
// backgroundColor: {
// image: 'http://10.100.70.5:9090/profile/upload/2022/07/22/%E9%99%88%E5%A6%82%E5%8D%8E_20220722161444A002.jpeg'
// },
// },
// }
// },
},
{
data: data.yData,
@ -1718,19 +1703,17 @@ const singleVerticalBarChartTwo = function (data, id) {
type: 'pictorialBar',
name: 'pictorial element',
symbol: function(val,index){
console.log(val)
console.log(index)
// return walk
return 'image://' + 'http://10.100.70.5:9090/' + data.yImg[index.dataIndex]
},
symbolSize: [20, 20],
symbolSize: [40, 40],
z: 10,
data: [
{
value: data.yData[0],
data: data.yData.map(val => {
return {
value: val,
symbolPosition: 'end',
symbolOffset: [0, '-120%']
}
]
})
},
],
};

@ -46,14 +46,15 @@
<!--一次装配不合格率-->
<div class="fractionDefective" id="fractionDefective"></div>
<!--追踪事件-->
<!--当班入库执行订单-->
<div class="trackEventsScrollTable" id="trackEventsScrollTable">
<div class="trackEvents" id="trackEvents">
</div>
</div>
<div id="Tips"></div>
<div id="TipsTop"></div>
<div id="TipsBottom"></div>
<div class="total" id="total"></div>
</body>

@ -505,10 +505,10 @@
times++
}
getTable(classes,dataOne)
total(((data.filter(val => val.status === '生产中').length / 28).toFixed(4) * 100 + '').substring(0, 5) + '%',
total(((data.filter(val => val.status === '生产中').length / 28)).toFixed(4) * 100 + '%',
eval(data.map(val => val.plan_number).join('+')),
eval(data.map(val => val.qty).join('+')),
((eval(data.map(val => val.qty).join('+')) / eval(data.map(val => val.plan_number).join('+'))).toFixed(4) * 100 + '').substring(0, 5) + '%',
((eval(data.map(val => val.qty).join('+')) / eval(data.map(val => val.plan_number).join('+')))).toFixed(4) * 100+ '%',
eval(data.map(val => val.h1).join('+')),
eval(data.map(val => val.h2).join('+')),
eval(data.map(val => val.h3).join('+')),

Loading…
Cancel
Save