<%@ page contentType="text/html;charset=UTF-8"%>
|
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
|
<c:set var="ctx" value="${pageContext.request.contextPath}" />
|
<html>
|
<head>
|
|
<title></title>
|
<style type="text/css">
|
* {
|
padding: 0px;
|
margin: 0px;
|
font-family: "microsoft yahei", "Helvetica Neue", Helvetica, Arial,
|
sans-serif;
|
}
|
#Top {
|
display: block;
|
margin-bottom: 10px;
|
padding: 5px;
|
padding-left: 6px;
|
padding-right: 15px;
|
line-height: 22px;
|
border-radius: 0 2px 2px 0;
|
background-color: #f2f2f2;
|
}
|
|
.btn {
|
height: 35px;
|
line-height: 35px;
|
background-color: #0dc316;
|
padding: 0 15px;
|
color: #fff;
|
border: none;
|
border-radius: 2px;
|
}
|
|
table thead tr {
|
background-color: #f2f2f2;
|
}
|
|
table {
|
width: 100%;
|
border-collapse: collapse;
|
text-align:center;
|
}
|
|
table th {
|
border: 1px solid #f2f2f2;
|
height: 20px;
|
line-height: 20px;
|
padding: 9px 15px 9px 15px;
|
text-align:center;
|
}
|
|
.One td {
|
border: 1px solid #f2f2f2;
|
height: 20px;
|
line-height: 20px;
|
padding: 9px 15px 9px 15px;
|
}
|
|
.two td {
|
border: 1px solid #f2f2f2;
|
height: 20px;
|
line-height: 20px;
|
padding: 9px 15px 9px 15px;
|
}
|
</style>
|
<script type="text/javascript" src="${ctx}/static/jquery/jquery-3.1.0.min.js"></script>
|
<script>
|
|
/*弹窗-手动添加*/
|
function modifyraw(){
|
$("#add-fix-info").modal('show');
|
initializeData();
|
}
|
/*初始化加载表格*/
|
initialize();
|
function initialize(){
|
initializeTable();
|
}
|
function initializeData(){
|
$('#station').empty();
|
var row="<tr><td>1</td>";
|
var stationOption="";
|
for(var i = 1; i < 10; i++){
|
stationOption+="<option value='"+i+"'>"+i+" 号库位</option>";
|
}
|
for(var i=1101;i<=1114;i++){
|
stationOption+="<option value='"+i+"'>"+i+" 号上片位</option>";
|
}
|
for(var i=990;i<=993;i++){
|
stationOption+="<option value='"+i+"'>"+i+" 号吊装位</option>";
|
}
|
|
row+="<td><select name='start'>"+stationOption+"</select></td>"+
|
"<td><select name='end'>"+stationOption+"</select></td></tr>";
|
$('#station').append(row);
|
}
|
var Tb={
|
id:"tb1",
|
style:"margin-top: 20px;",
|
className:null,
|
positionId:"contents",
|
columns:[
|
{
|
text:"任务顺序",
|
calssName:"id",
|
index:0
|
},
|
{
|
text:"ID",
|
calssName:"id",
|
index:1
|
},
|
{
|
text:"起始地址",
|
calssName:"stockName",
|
index:2
|
},
|
{
|
text:"目的地址",
|
calssName:"destination",
|
index:3
|
},
|
{
|
text:"料架号",
|
calssName:"stockName",
|
index:4
|
},
|
{
|
text:"任务类型",
|
calssName:"taskType",
|
index:5
|
},
|
{
|
text:"操作",
|
calssName:"",
|
index:6
|
}
|
]
|
}
|
function createTable(model,data){
|
var columns=model.columns;
|
var positionid=model.positionId;
|
var position=document.getElementById(positionid);
|
var tablehtml=document.createElement("table");
|
console.log(data[0]);
|
console.log(data[0][columns[0].calssName]);
|
tablehtml.style=model.style;
|
//头部
|
var theadhtml=document.createElement("thead");
|
var thRowhtml=document.createElement("tr");
|
for(var thj = 0; thj < columns.length; thj++){
|
var thColhtml=document.createElement("th");
|
var thtext=document.createTextNode(columns[thj].text);
|
thColhtml.appendChild(thtext);
|
thRowhtml.appendChild(thColhtml);
|
}
|
theadhtml.appendChild(thRowhtml);
|
//内容
|
var tbodyhtml=document.createElement("tbody");
|
for(var i = 0; i < data.length; i++){
|
var row=data[i];
|
var rowhtml=document.createElement("tr");
|
for(var j = 0; j < columns.length; j++){
|
var colhtml=document.createElement("td");
|
var text=document.createTextNode("");
|
if(!(columns[j].calssName==null||columns[j].calssName=="")){
|
text=document.createTextNode(row[columns[j].calssName]);
|
}
|
colhtml.appendChild(text);
|
rowhtml.appendChild(colhtml);
|
}
|
tbodyhtml.appendChild(rowhtml);
|
}
|
console.log(tablehtml);
|
tablehtml.appendChild(theadhtml);
|
tablehtml.appendChild(tbodyhtml);
|
position.appendChild(tablehtml);
|
}
|
function initializeTable(){
|
$.ajax({
|
cache:false,
|
type:"POST",
|
dataType : "json",
|
url:"${ctx}/Config/selectOutTasks",
|
success:function(data){
|
console.log(data);
|
console.log(data[0][0]);
|
/* for(var i = 0; i < data.length; i++){
|
data[i][0]
|
}
|
createTable(Tb,data); */
|
|
}
|
});
|
}
|
function initializeTable2(){
|
//$('#OneContent').empty();
|
/* var tablehteml="<table class='One'><thead><tr><th>任务顺序</th><th>ID</th><th>起始地址</th><th>目的地址</th><th>料架号</th><th>任务类型</th><th>操作</th></tr></thead>";
|
tablehteml+="<tbody id='station'></tbody>";
|
$('#Content').append(tablehteml); */
|
$.ajax({
|
cache:false,
|
type:"POST",
|
dataType : "json",
|
url:"${ctx}/Config/selectOutTasks",
|
success:function(data){
|
console.log(data);
|
var html="";
|
for(var i = 0; i < data.length; i++){
|
var row=data[i];
|
html+="<tr>";
|
html+="<td>"+(i+1)+"</td>";
|
html+="<td class='taskid'>"+row.id+"</td>";
|
html+="<td>"+row.stockName+"</td>";
|
html+="<td>"+row.destination+row.rackNumber+"</td>";
|
html+="<td>"+row.stockName+"</td>";
|
html+="<td>"+row.taskType+"</td>";
|
html+="<td>";
|
html+="<button class='btn btn-default btn-lg' style='margin-right:10px;' onclick='taskCancel(this)'>失败</button>";
|
html+="<button class='btn btn-default btn-lg' style='margin-right:10px;' onclick='taskCancel(this)'>完成</button>";
|
html+="<button class='btn btn-default btn-lg' style='margin-right:10px;' onclick='taskCancel(this)'>取消</button>";
|
html+="</td>";
|
html+="</tr>";
|
}
|
$('#OneContent').append(html);
|
}
|
});
|
}
|
/*操作【取消/重新发送/完成】*/
|
function taskCancel(oneself){
|
var Controls=oneself.innerHTML;
|
var row=oneself.parentNode.parentNode;
|
var taskid=row.getElementsByClassName("taskid")[0].innerHTML;
|
console.log(Controls);
|
$.ajax({
|
cache:false,
|
type:"POST",
|
dataType : "json",
|
url:"${ctx}/Config/updateTask",
|
data:{
|
"taskid":taskid,
|
"Controls":Controls
|
},success:function(data){
|
// 刷新当前页面
|
|
//window.location.href="${ctx }/Config/updateTask;";
|
}
|
});
|
location.reload();
|
}
|
</script>
|
</head>
|
<body>
|
<div class="content-wrapper" style="background-color: white;">
|
<section class="content-header">
|
<div id="Top">
|
<!-- <button class="btn" style="background-color: #fd5f56;" onclick="delAll()">批量删除</button> -->
|
<button class="btn" onclick="modifyraw()">添加手动任务</button>
|
<span style="float: right; line-height: 40px"></span>
|
</div>
|
<div class="modal fade" id="add-fix-info" tabindex="-1" role="dialog"
|
aria-labelledby="myModalLabel" aria-hidden="true">
|
<div class="modal-dialog" style="width: 100%; height: 100%;">
|
<div class="modal-content"
|
style="width: 1000px; margin: auto;">
|
<div class="modal-header">
|
<button type="button" class="close" data-dismiss="modal"
|
aria-hidden="true" data-backdrop="static">×</button>
|
<h3 class="modal-title" id="myModalLabel" style="font-weight: bolder;">添加手动任务</h3>
|
</div>
|
<!--提交-->
|
<form class="form-horizontal" role="form" id="category_add" action="${ctx}/Config/addTask" method="post">
|
<div style="margin-top: 20px;">
|
<!-- 机器逻辑配置添加 -->
|
<table class="two" id="addManualOperation">
|
<thead>
|
<tr>
|
<th>序号</th>
|
<th>起始地址</th>
|
<th>目标地址</th>
|
<!-- <th>操作</th> -->
|
</tr>
|
</thead>
|
<tbody id="station">
|
|
</tbody>
|
|
</table>
|
</div>
|
<div class="modal-footer">
|
<button type="button" class="btn btn-default btn-lg" data-dismiss="modal">关闭</button>
|
<button type="submit" class="btn btn-primary btn-lg" id="addbtnsubmit">提交</button>
|
</div>
|
</form>
|
</div>
|
</div>
|
</div>
|
</section>
|
|
<section class="content container-fluid">
|
<div id="contents">
|
<!-- <table class="One">
|
<thead>
|
<tr>
|
<th>任务顺序</th>
|
<th>ID</th>
|
<th>起始地址</th>
|
<th>目的地址</th>
|
<th>料架号</th>
|
<th>任务类型</th>
|
<th>操作</th>
|
</tr>
|
</thead>
|
<tbody id='OneContent'>
|
|
</tbody> -->
|
|
</table>
|
</div>
|
</section>
|
</div>
|
</body>
|
</html>
|