<!DOCTYPE html>
|
<html lang="en">
|
<head>
|
<meta charset="UTF-8">
|
<title>提升机监控管理</title>
|
<link rel="stylesheet" type="text/css" href="../static/css/normalize.css">
|
<link rel="stylesheet" type="text/css" href="../static/css/common.css">
|
<link rel="stylesheet" type="text/css" href="../static/layui/css/layui.css">
|
<link rel="stylesheet" href="../static/css/lift.css">
|
<script type="text/javascript" src="../static/js/jquery/jquery-3.3.1.min.js"></script>
|
<script type="text/javascript" src="../static/js/layer/layer.js"></script>
|
<script type="text/javascript" src="../static/layui/layui.js"></script>
|
<script type="text/javascript" src="../static/js/common.js"></script>
|
</head>
|
<body>
|
<div style="padding: 10px;height: 100%;float: left;width: 6%">
|
<div class="button-window"></div>
|
</div>
|
<div style="height: 100%;padding-left: 6%">
|
<div style="padding: 10px;height: 100%">
|
<!-- 日志监控板 -->
|
<div class="log-board">
|
<div class="command-log" id="commandLogId" style="width: 10%;">
|
</div>
|
<div class="lift-state" style="width: 90%;">
|
<table id="lift-state-table">
|
<thead>
|
<tr>
|
<th>提升机</th>
|
<th>工作号</th>
|
<th>任务状态</th>
|
<th>提升机锁定</th>
|
<th>位置到达反馈</th>
|
<th>准备就绪</th>
|
<th>运行中</th>
|
<th>联机/单机</th>
|
<th>平台位置偏差报警</th>
|
<th>平台扭矩偏差报警</th>
|
<th>平台四向车检测</th>
|
<th>未就绪状态</th>
|
<th>伺服1错误</th>
|
<th>伺服2错误</th>
|
<th>伺服3错误</th>
|
<th>伺服4错误</th>
|
<th>提升机实际速度反馈</th>
|
</tr>
|
</thead>
|
<tbody>
|
</tbody>
|
</table>
|
</div>
|
</div>
|
<!-- 提升机状态 -->
|
<div class="lift-msg">
|
<table id="lift-msg-table">
|
<thead>
|
<tr>
|
<th>提升机</th>
|
<th>工作号</th>
|
<th>输送线前端光电有货</th>
|
<th>输送线正转反馈</th>
|
<th>输送线反转反馈</th>
|
<th>输送线电机过载</th>
|
<th>输送线末端光电有货</th>
|
<th>进输送线卡托盘报警</th>
|
<th>出输送线卡托盘报警</th>
|
<th>作业标记</th>
|
</tr>
|
</thead>
|
<tbody>
|
</tbody>
|
</table>
|
</div>
|
<!-- 手动操作 -->
|
<div class="lift-operation">
|
<!-- 遮罩层 -->
|
<div class="lift-operation-shade">
|
<span class="lift-operation-shade-span">
|
WCS 系统运行中,请停止后操作
|
</span>
|
</div>
|
<!-- 设备任务选择 -->
|
<div class="task-select">
|
<!-- 选择 -->
|
<div id="lift-select" class="operator-item">
|
<span class="select-title">提升机号</span>
|
<div class="select-container" id="liftRadioBoxId">
|
<!-- <label><input type="radio" name="liftSelect" value="1" checked> 1号提升机</label>-->
|
</div>
|
</div>
|
</div>
|
|
<!-- 设备任务操作 -->
|
<div class="task-operator">
|
<fieldset>
|
<legend>手动操作</legend>
|
<div class="button-group">
|
<button class="item" onclick="liftOperator(1)">上升一层</button>
|
<button class="item" onclick="liftOperator(2)">下降一层</button>
|
<button class="item" onclick="liftOperator(3)">有货正转</button>
|
<button class="item" onclick="liftOperator(4)">有货反转</button>
|
<button class="item" onclick="liftOperator(5)">复位</button>
|
</div>
|
</fieldset>
|
</div>
|
|
</div>
|
<!-- 提升机日志输出 -->
|
<div class="lift-output-board">
|
<textarea id="lift-output"></textarea>
|
</div>
|
</div>
|
</div>
|
</body>
|
</html>
|
<script>
|
// 空白行数
|
var liftStateTableBlankRows = 0;
|
var liftMsgTableBlankRows = 0;
|
// 实际行数
|
var liftStateTableFullRows = 0;
|
var liftMsgTableFullRows = 0;
|
// 初始化
|
var liftOutputDom = document.getElementById("lift-output");
|
$(document).ready(function() {
|
initliftStateTable();
|
getliftStateInfo();
|
initliftMsgTable();
|
getliftMsgInfo();
|
operatorBlockShow();
|
setliftRadio();
|
});
|
|
setInterval(function () {
|
getliftStateInfo()
|
getliftMsgInfo();
|
},1000)
|
setInterval(function () {
|
getliftOutput();
|
operatorBlockShow();
|
},500);
|
|
// 判断手动操作模块是否可用
|
function operatorBlockShow() {
|
if (parent.systemRunning) {
|
$('.lift-operation').css("opacity", "0.5");
|
$('.lift-operation-shade').show();
|
$('.lift-operation-shade-span').show();
|
} else {
|
$('.lift-operation').css("opacity", "1");
|
$('.lift-operation-shade').hide();
|
$('.lift-operation-shade-span').hide();
|
}
|
}
|
|
var layerIdx;
|
$(document).on('click ','.pos-btn', function () {
|
let liftNo = Number($(this).parent().attr("data-liftNo"));
|
layerIdx = layer.open({
|
type: 1,
|
title: false,
|
shadeClose: true,
|
offset: [$(this).offset().top + 30 + 'px', $(this).offset().left + 'px'],
|
anim: 5,
|
shade: [0],
|
area: ['310px', '370px'],
|
closeBtn: 0,
|
content: $("#lift-detl"),
|
success: function(layero, index){
|
http.get(baseUrl+ "/lift/detl/"+liftNo, null, function (res) {
|
$('#liftNo').val(liftNo);
|
$('#workNo').val(res.data.workNo);
|
$('#row').val(res.data.row);
|
$('#bay').val(res.data.bay);
|
$('#lev').val(res.data.lev);
|
$('#crnNo').val(res.data.crnNo);
|
$('#pakMk').val(res.data.pakMk);
|
})
|
},
|
end: function () {
|
$('#liftNo').val("");
|
$('#workNo').val("");
|
$('#row').val("");
|
$('#bay').val("");
|
$('#lev').val("");
|
$('#crnNo').val("");
|
$('#pakMk').val("");
|
}
|
})
|
})
|
|
var layerIdx0;
|
$(document).on('click ','.mode-btn', function () {
|
let liftNo = Number($(this).parent().attr("data-liftNo"));
|
layerIdx0 = layer.open({
|
type: 1,
|
title: false,
|
shadeClose: true,
|
offset: [$(this).offset().top + 30 + 'px', $(this).offset().left + 'px'],
|
anim: 5,
|
shade: [0],
|
area: ['70%', '85%'],
|
closeBtn: 0,
|
content: $("#lift-detl2"),
|
success: function(layero, index){
|
console.log(liftNo)
|
http.get(baseUrl+ "/lift/sensor/detl/"+liftNo, null, function (res) {
|
$('#liftNo1').val(res.data.liftNo);
|
getColor(res.data.pakInTask,'#pakInTask');
|
getColor(res.data.pakOutTask,'#pakOutTask');
|
getColor(res.data.pakMoveTask,'#pakMoveTask');
|
getColor(res.data.goHpTask,'#goHpTask');
|
getColor(res.data.goOHpTask,'#goOHpTask');
|
getColor(res.data.goHpAvoid,'#goHpAvoid');
|
getColor(res.data.goOHpAvoid,'#goOHpAvoid');
|
getColor(res.data.pakInEmpty,'#pakInEmpty');
|
getColor(res.data.pakInFinish,'#pakInFinish');
|
getColor(res.data.pakOutEmpty,'#pakOutEmpty');
|
getColor(res.data.pakOutFinish,'#pakOutFinish');
|
getColor(res.data.goHpAvoidFinish,'#goHpAvoidFinish');
|
getColor(res.data.goOHpAvoidFinish,'#goOHpAvoidFinish');
|
getColor(res.data.goHpAvoidErr,'#goHpAvoidErr');
|
getColor(res.data.goOHpAvoidErr,'#goOHpAvoidErr');
|
})
|
},
|
end: function () {
|
$('#liftNo').val("");
|
}
|
})
|
})
|
|
function getColor(res,e){
|
$(e).val(res?"✔":"—");
|
if (res){
|
$(e).attr("style", "color: #FD482C;");
|
}else {
|
$(e).attr("style", "color: #00FF00;");
|
}
|
}
|
|
$(document).on('click ','#save', function () {
|
http.post(baseUrl+ "/lift/detl/update", {
|
liftNo: $('#liftNo').val(),
|
workNo: $('#workNo').val(),
|
row: $('#row').val(),
|
bay: $('#bay').val(),
|
lev: $('#lev').val(),
|
crnNo: $('#crnNo').val(),
|
pakMk: $('#pakMk').val(),
|
}, function (res) {
|
layer.msg("修改成功", {icon: 1,});
|
layer.close(layerIdx);
|
})
|
})
|
|
$(document).on('click ','#cancel', function () {
|
layer.close(layerIdx);
|
})
|
|
function setliftRadio() {
|
$.ajax({
|
url: baseUrl+ "/lift/table/lift/state",
|
headers: {'token': localStorage.getItem('token')},
|
method: 'POST',
|
success: function (res) {
|
if (res.code === 200){
|
let table = res.data;
|
for (let i=1;i<=table.length;i++){
|
//渲染提升机选项html
|
let liftRadioBox = '<label><input type="radio" name="liftSelect" ';
|
if (i === 1) {
|
liftRadioBox += 'checked '
|
}
|
liftRadioBox += 'value="' + table[i - 1].liftNo + '"> ' + table[i - 1].liftNo + '号提升机</label>'
|
$("#liftRadioBoxId").append(liftRadioBox)
|
|
|
//渲染提升机数据维护和设备信息html
|
let liftCommandLogBox = '<div class="lift-command-item" data-liftNo="' + table[i - 1].liftNo + '">\n' +
|
'<label>' + table[i - 1].liftNo + '#</label>\n' +
|
'</div>'
|
$("#commandLogId").append(liftCommandLogBox);
|
}
|
} else if (res.code === 403){
|
window.location.href = baseUrl+"/login";
|
} else {
|
console.log(res.msg);
|
}
|
}
|
});
|
}
|
|
// 提升机信息表获取 ---- 表一
|
function getliftStateInfo() {
|
let tableEl = $('#lift-state-table');
|
$.ajax({
|
url: baseUrl+ "/lift/table/lift/state",
|
headers: {'token': localStorage.getItem('token')},
|
method: 'POST',
|
success: function (res) {
|
if (res.code === 200){
|
let table = res.data;
|
if (table.length > liftStateTableBlankRows && table.length !== liftStateTableFullRows) {
|
initliftStateTable(table.length-liftStateTableBlankRows);
|
liftStateTableFullRows = table.length;
|
}
|
for (let i=1;i<=table.length;i++){
|
// $("#mode-"+table[i-1].liftNo).html(table[i-1].statusVal===0?'联机':'脱机');
|
let tr = tableEl.find("tr").eq(i);
|
setVal(tr.children("td").eq(0), table[i-1].liftNo);
|
setVal(tr.children("td").eq(1), table[i-1].taskNo);
|
setVal(tr.children("td").eq(2), table[i-1].protocolStatus$);
|
setVal(tr.children("td").eq(3), table[i-1].liftLock$);
|
setVal(tr.children("td").eq(4), table[i-1].positionArrivalFeedback);
|
setVal(tr.children("td").eq(5), table[i-1].ready$);
|
setVal(tr.children("td").eq(6), table[i-1].running$);
|
setVal(tr.children("td").eq(7), table[i-1].mode$);
|
setVal(tr.children("td").eq(8), table[i-1].platPositionDeviationAlarm$);
|
setVal(tr.children("td").eq(9), table[i-1].platTorqueDeviationAlarm$);
|
setVal(tr.children("td").eq(10), table[i-1].platShuttleCheck$);
|
setVal(tr.children("td").eq(11), table[i-1].notReady$);
|
setVal(tr.children("td").eq(12), table[i-1].servoError1);
|
setVal(tr.children("td").eq(13), table[i-1].servoError2);
|
setVal(tr.children("td").eq(14), table[i-1].servoError3);
|
setVal(tr.children("td").eq(14), table[i-1].servoError4);
|
setVal(tr.children("td").eq(14), table[i-1].liftActualSpeed);
|
}
|
} else if (res.code === 403){
|
window.location.href = baseUrl+"/login";
|
} else {
|
console.log(res.msg);
|
}
|
}
|
});
|
}
|
|
// 提升机数据表获取 ---- 表二
|
function getliftMsgInfo() {
|
let tableEl = $('#lift-msg-table');
|
$.ajax({
|
url: baseUrl+ "/lift/table/lift/msg",
|
headers: {'token': localStorage.getItem('token')},
|
method: 'POST',
|
success: function (res) {
|
if (res.code === 200){
|
var table = res.data;
|
if (table.length > liftMsgTableBlankRows && table.length !== liftMsgTableFullRows) {
|
initliftMsgTable(table.length-liftMsgTableBlankRows);
|
liftMsgTableFullRows = table.length;
|
}
|
for (var i=1;i<=table.length;i++){
|
var tr = tableEl.find("tr").eq(i);
|
setVal(tr.children("td").eq(0), table[i-1].liftNo);
|
setVal(tr.children("td").eq(1), table[i-1].workNo);
|
setVal(tr.children("td").eq(2), table[i-1].lineFrontHasStock$);
|
setVal(tr.children("td").eq(3), table[i-1].forwardRotationFeedback$);
|
setVal(tr.children("td").eq(4), table[i-1].reverseFeedback$);
|
setVal(tr.children("td").eq(5), table[i-1].motorOverload$);
|
setVal(tr.children("td").eq(6), table[i-1].lineEndHasStock$);
|
setVal(tr.children("td").eq(7), table[i-1].inConveyLineCardTrayAlarm$);
|
setVal(tr.children("td").eq(8), table[i-1].outConveyLineCardTrayAlarm$);
|
setVal(tr.children("td").eq(9), table[i-1].pakMk);
|
}
|
} else if (res.code === 403){
|
window.location.href = baseUrl+"/login";
|
} else {
|
console.log(res.msg);
|
}
|
}
|
});
|
}
|
|
// 提升机日志输出 -----------------------------------------------------------------------
|
function getliftOutput() {
|
$.ajax({
|
url: baseUrl + "/lift/output/lift",
|
headers: {'token': localStorage.getItem('token')},
|
method: 'POST',
|
success: function (res) {
|
if (res.code === 200) {
|
liftOutput(res.data);
|
} else if (res.code === 403) {
|
window.location.href = baseUrl + "/login";
|
} else {
|
console.log(res.msg);
|
}
|
}
|
})
|
}
|
|
// 任务指令下发
|
function liftOperator(liftTaskMode) {
|
http.post(baseUrl+"/lift/operator/lift", {
|
liftNo: $('input[name="liftSelect"]:checked').val(),
|
liftTaskMode: liftTaskMode,
|
}, function (res) {
|
layer.msg(res.msg, {icon: 1});
|
});
|
}
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
// 提升机信息表获取 ----- 表一
|
function initliftStateTable(row) {
|
let line;
|
if (row === undefined){
|
let one = $('#lift-state-table thead').height();
|
let total = $('.lift-state').height();
|
let count = total / one;
|
count = parseInt(count) - 1;
|
liftStateTableBlankRows = count;
|
line = count;
|
} else {
|
line = row;
|
}
|
let html = "";
|
for (let i = 0; i < line; i ++){
|
html += " <tr>\n" +
|
" <td></td>\n" +
|
" <td></td>\n" +
|
" <td></td>\n" +
|
" <td></td>\n" +
|
" <td></td>\n" +
|
" <td></td>\n" +
|
" <td></td>\n" +
|
" <td></td>\n" +
|
" <td></td>\n" +
|
" <td></td>\n" +
|
" <td></td>\n" +
|
" <td></td>\n" +
|
" <td></td>\n" +
|
" <td></td>\n" +
|
" <td></td>\n" +
|
" <td></td>\n" +
|
" <td></td>\n" +
|
" </tr>\n";
|
}
|
$('#lift-state-table tbody').after(html);
|
}
|
|
// 提升机数据表获取 ----- 表二
|
function initliftMsgTable(row) {
|
let line;
|
if (row === undefined){
|
let one = $('#lift-msg-table thead').height();
|
let total = $('.lift-msg').height();
|
let count = total / one;
|
count = parseInt(count) - 1;
|
liftMsgTableBlankRows = count;
|
line = count;
|
} else {
|
line = row;
|
}
|
let html = "";
|
for (let i = 0; i < line; i ++){
|
html += " <tr>\n" +
|
" <td></td>\n" +
|
" <td></td>\n" +
|
" <td></td>\n" +
|
" <td></td>\n" +
|
" <td></td>\n" +
|
" <td></td>\n" +
|
" <td></td>\n" +
|
" <td></td>\n" +
|
" <td></td>\n" +
|
" <td></td>\n" +
|
" <td></td>\n" +
|
" <td></td>\n" +
|
" <td></td>\n" +
|
" <td></td>\n" +
|
" <td></td>\n" +
|
" </tr>\n";
|
}
|
$('#lift-msg-table tbody').after(html);
|
}
|
|
// 日志输出框
|
function liftOutput(content){
|
liftOutputDom.value += content;
|
liftOutputDom.scrollTop = liftOutputDom.scrollHeight;
|
}
|
|
</script>
|