|
|
|
|
|
$(() => {
|
|
|
|
|
|
moduleTitle()
|
|
|
|
|
|
safe('#safe')
|
|
|
|
|
|
importData('#importData')
|
|
|
|
|
|
// 公共请求地址
|
|
|
|
|
|
let url = '/broad/mtk'
|
|
|
|
|
|
|
|
|
|
|
|
// 轮询间隔时间
|
|
|
|
|
|
const INTERVAL = 30000
|
|
|
|
|
|
|
|
|
|
|
|
//每日人力出勤轮询
|
|
|
|
|
|
autoUpdate(url + "/team6s ", INTERVAL, 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
|
|
|
|
|
|
})
|
|
|
|
|
|
singleVerticalBarChartTwo({
|
|
|
|
|
|
xName: data.map(val => val.teamName),
|
|
|
|
|
|
yData: data.map(val => val.teamNumber),
|
|
|
|
|
|
yImg: data.map(val => val.path),
|
|
|
|
|
|
}, document.getElementById("manpowerAttendance"))
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
// 三日订单执行情况
|
|
|
|
|
|
autoUpdate(url + "/selectOrderInfoBy3d", INTERVAL, data => {
|
|
|
|
|
|
// console.log(data)
|
|
|
|
|
|
horizontalRoundedBarChartWithBackgroundTwo({
|
|
|
|
|
|
yNameOne: data.map(val => val.name),
|
|
|
|
|
|
yData: data.map(val => val.rate),
|
|
|
|
|
|
status:data.map(val => val.qty),
|
|
|
|
|
|
xDataName: "达成率",
|
|
|
|
|
|
}, document.getElementById("IQC"))
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
autoUpdate(url + "/mtk_selectOrderInfoBy3dTatle", INTERVAL, data => {
|
|
|
|
|
|
total(data.find(val => val.name === '入库订单统计').qty, '#total')
|
|
|
|
|
|
Tips(data.find(val => val.name === '订单数量').qty, data.find(val => val.name === '完成数量').qty, data.find(val => val.name === '清单率').qty, '#Tips')
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 当日订单入库统计
|
|
|
|
|
|
autoUpdate(url + "/selectInstoreNumByday", INTERVAL, data => {
|
|
|
|
|
|
singleVerticalBarChart({
|
|
|
|
|
|
xName: data.map(val => val.name),
|
|
|
|
|
|
yData: data.map(val => val.qty),
|
|
|
|
|
|
}, document.getElementById("productionEfficiency"), -20)
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 当日订单入库统计
|
|
|
|
|
|
autoUpdate("/broad/beforeLibrary/selectQualityInfo", INTERVAL, data => {
|
|
|
|
|
|
pieChart(data.map(val => {
|
|
|
|
|
|
return {
|
|
|
|
|
|
name: val.type,
|
|
|
|
|
|
value: val.qty
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}), document.getElementById("equipmentPower"));
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
autoUpdate(url + "/selectInstoreNumByday", INTERVAL, data => {
|
|
|
|
|
|
multipleVerticalBarChartTwo({
|
|
|
|
|
|
xName: ['1月', '2月', '3月', '4月', '5月', '6月', '7月'],
|
|
|
|
|
|
yDataOne: [22, 52, 55, 12, 35, 44, 66],
|
|
|
|
|
|
yDataOneName: '项目1',
|
|
|
|
|
|
yDataTwo: [32, 42, 50, 22, 30, 40, 52],
|
|
|
|
|
|
yDataTwoName: "项目2",
|
|
|
|
|
|
}, document.getElementById("topLeft"), -20)
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
const today = () => {
|
|
|
|
|
|
const currentYear = new Date().getFullYear().toString();
|
|
|
|
|
|
const hasTimestamp = new Date() - new Date(currentYear);
|
|
|
|
|
|
const hasDays = Math.ceil(hasTimestamp / 86400000);
|
|
|
|
|
|
return hasDays
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const curWeek = () => {
|
|
|
|
|
|
let today = new Date();
|
|
|
|
|
|
let firstDayOfYear = new Date(today.getFullYear(), 0, 1);
|
|
|
|
|
|
let dayOfWeek = firstDayOfYear.getDay();
|
|
|
|
|
|
let spendDay = 1;
|
|
|
|
|
|
if (dayOfWeek != 0) {
|
|
|
|
|
|
spendDay = 7 - dayOfWeek + 1;
|
|
|
|
|
|
}
|
|
|
|
|
|
firstDayOfYear = new Date(today.getFullYear(), 0, spendDay);
|
|
|
|
|
|
let d = Math.ceil((today.valueOf() - firstDayOfYear.valueOf()) / 86400000);
|
|
|
|
|
|
return Math.ceil((d / 7) + 1);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const moduleTitle = () => {
|
|
|
|
|
|
const html = `
|
|
|
|
|
|
<span style="position: absolute;top: 0.9%;left: 50%;color: #fff;font-size: 1.3vw;transform: translateX(-50%);letter-spacing: 0.3vw">订单可视化及安全生产平台</span>
|
|
|
|
|
|
<span style="position: absolute;top: 10%;left: 5.5%;color: #CFD2D0;font-size: 1.0vw">第${curWeek()}周 班组6S排行榜 </span>
|
|
|
|
|
|
<span style="position: absolute;top: 10%;left: 32%;color: #CFD2D0;font-size: 1.0vw">三日订单执行情况</span>
|
|
|
|
|
|
<span style="position: absolute;top: 10%;left: 73.5%;color: #CFD2D0;font-size: 1.0vw">当日订单入库统计</span>
|
|
|
|
|
|
<span style="position: absolute;top: 54.5%;left: 5.5%;color: #CFD2D0;font-size: 1.0vw">安全生产</span>
|
|
|
|
|
|
<span style="position: absolute;top: 54.5%;left: 32%;color: #CFD2D0;font-size: 1.0vw">质量分析(TOP3)</span>
|
|
|
|
|
|
<span style="position: absolute;top: 54.5%;left: 73.6%;color: #CFD2D0;font-size: 1.0vw">重点工序质量监控</span>
|
|
|
|
|
|
`
|
|
|
|
|
|
$('body').append(html)
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const safe = (el) => {
|
|
|
|
|
|
const html = `
|
|
|
|
|
|
<span style="position: absolute;top: 66%;left: 84%;white-space:nowrap;color: #CBE6F7;font-size: 1.3vw;font-weight:600;transform: translateX(-50%);letter-spacing: 0.3vw">${new Date().getFullYear().toString()}年连续安全生产天数</span>
|
|
|
|
|
|
<span style="position: absolute;top: 74%;left: 84%;color: #08F580;font-size: 2.5vw;transform: translateX(-50%);letter-spacing: 0.3vw">${today()}<span style="font-size: 0.5vw">天</span> </span>
|
|
|
|
|
|
<span style="position: absolute;top: 89%;left: 84%;color: #CBE6F7;font-size: 1vw;transform: translateX(-50%);letter-spacing: 0.3vw">智能冷柜互联工厂</span>
|
|
|
|
|
|
`
|
|
|
|
|
|
$(el).html(html)
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const Tips = (val1 = 0, val2 = 0, val3 = 0, el) => {
|
|
|
|
|
|
const html = `
|
|
|
|
|
|
<span style="position: absolute;top: 10%;left: 44%;color: #fff;font-size: 1vw;">订单数量:${val1} 完成数量:${val2} 清单率:${val3}%</span>
|
|
|
|
|
|
`
|
|
|
|
|
|
$(el).html(html)
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const total = (val1 = 0, el) => {
|
|
|
|
|
|
const html = `
|
|
|
|
|
|
<span style="position: absolute;top: 10%;left: 85.7%;color: #fff;font-size: 1vw;">合计:${val1}</span>
|
|
|
|
|
|
`
|
|
|
|
|
|
$(el).html(html)
|
|
|
|
|
|
}
|
|
|
|
|
|
const importData = (el) => {
|
|
|
|
|
|
const html = `
|
|
|
|
|
|
<span style="position: absolute;top: 54.3%;left: 85.7%;color: #fff;font-size: 1vw;">一次合格率</span>
|
|
|
|
|
|
`
|
|
|
|
|
|
$(el).html(html)
|
|
|
|
|
|
}
|