<!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_wcs.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>PLC任务号</th>
|
<th>模式</th>
|
<th>任务状态</th>
|
<th>任务模式</th>
|
<th>取货数据</th>
|
<th>放货数据</th>
|
<th>出入库模式</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>
|
</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">
|
<div class="select-container-item">
|
<span>源站</span>
|
<label><input id="sourceStaNo" type="text" name="sourceStaNo" /></label>
|
</div>
|
<div class="select-container-item">
|
<span>目标站</span>
|
<label><input id="staNo" type="text" name="staNo" /></label>
|
</div>
|
<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(0)">复位</button>
|
</div>
|
</fieldset>
|
</div>
|
|
</div>
|
<!-- 提升机日志输出 -->
|
<div class="lift-output-board">
|
<textarea id="lift-output"></textarea>
|
</div>
|
|
<div id="lift-detl" style="display: none">
|
<div>
|
<div class="form-item">
|
<label class="form-label">站号:</label>
|
<div class="form-input">
|
<input id="liftNo" name="liftNo" class="layui-input" lay-verify="required|number" autocomplete="off" disabled="disabled">
|
</div>
|
</div>
|
<div class="form-item">
|
<label class="form-label">工作号:</label>
|
<div class="form-input">
|
<input id="workNo" name="workNo" type="number" class="layui-input" lay-verify="number" autocomplete="off">
|
</div>
|
</div>
|
<div class="form-item form-button-container">
|
<button class="form-button" id="save">保存</button>
|
<button class="form-button" id="cancel" style="background-color: #D0D0D0">取消</button>
|
</div>
|
</div>
|
</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();
|
}
|
}
|
|
$(document).on('click ','#save', function () {
|
http.post(baseUrl+ "/forkLift/detl/update", {
|
liftNo: $('#liftNo').val(),
|
workNo: $('#workNo').val(),
|
}, function (res) {
|
layer.msg("修改成功", {icon: 1,});
|
layer.close(layerDetl);
|
})
|
})
|
|
function setliftRadio() {
|
$.ajax({
|
url: baseUrl+ "/forkLift/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+ "/forkLift/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].wrkNo);
|
setVal(tr.children("td").eq(3), table[i-1].model$);
|
setVal(tr.children("td").eq(4), table[i-1].protocolStatus$);
|
setVal(tr.children("td").eq(5), table[i-1].taskMode$);
|
setVal(tr.children("td").eq(6), table[i-1].pick);
|
setVal(tr.children("td").eq(7), table[i-1].put);
|
setVal(tr.children("td").eq(8), table[i-1].iOMode$);
|
setVal(tr.children("td").eq(9), table[i-1].errorCode$);
|
}
|
} 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+ "/forkLift/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);
|
let staDiv = "";
|
table[i-1].forkLiftStaProtocols.forEach((item) => {
|
let hasTray = item.hasTray ? "Y" : "N";
|
let hasCar = item.hasCar ? "Y" : "N";
|
staDiv += "<div>" + item.lev + "层,托盘:" + hasTray + ",小车:" + hasCar + "</div>"
|
})
|
|
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), staDiv);
|
}
|
} else if (res.code === 403){
|
window.location.href = baseUrl+"/login";
|
} else {
|
console.log(res.msg);
|
}
|
}
|
});
|
}
|
|
// 提升机日志输出 -----------------------------------------------------------------------
|
function getliftOutput() {
|
$.ajax({
|
url: baseUrl + "/forkLift/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+"/forkLift/operator/lift", {
|
liftNo: $('input[name="liftSelect"]:checked').val(),
|
liftTaskMode: liftTaskMode,
|
lev: $("#liftLev").val(),
|
sourceStaNo: $("#sourceStaNo").val(),
|
staNo: $("#staNo").val()
|
}, 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;
|
}
|
|
// 详情操作 -------------------------------------------------------------------------
|
var layerDetl;
|
$(document).on('dblclick ','#lift-msg-table tr', function () {
|
var liftNo = $(this).children("td").eq(0).html();
|
if (liftNo !== null && liftNo !== "") {
|
layerDetl = layer.open({
|
type: 1,
|
title: false,
|
shadeClose: true,
|
offset: 'rt',
|
anim: 5,
|
shade: [0],
|
area: ['340px', '255px'],
|
closeBtn: 0,
|
content: $("#lift-detl"),
|
success: function(layero, index){
|
$.ajax({
|
url: baseUrl+ "/forkLift/table/lift/msg",
|
headers: {'token': localStorage.getItem('token')},
|
method: 'POST',
|
success: function (res) {
|
if (res.code === 200){
|
var table = res.data;
|
for (var i=1;i<=table.length;i++){
|
if (liftNo == table[i-1].liftNo) {
|
$('#liftNo').val(liftNo);
|
$('#workNo').val(table[i-1].workNo);
|
$('#pakMk').val(table[i-1].pakMk);
|
$('#token').val(table[i-1].token);
|
}
|
}
|
} else if (res.code === 403){
|
window.location.href = baseUrl+"/login";
|
} else {
|
console.log(res.msg);
|
}
|
}
|
});
|
},
|
end: function () {
|
$('#liftNo').val("");
|
$('#workNo').val("");
|
$('#pakMk').val("");
|
$('#token').val("");
|
}
|
})
|
}
|
});
|
|
$(document).on('click ','#cancel', function () {
|
$('#liftNo').val("");
|
$('#workNo').val("");
|
$('#pakMk').val("");
|
$('#token').val("");
|
layer.close(layerDetl);
|
})
|
|
</script>
|