You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

223 lines
7.4 KiB

<#import "../master.ftl" as master>
<@master.layout>
<div class="page-header">
<h3>倒卷</h3>
</div>
<div class="row" id="app">
<div class="col-md-4">
<p><input id="fSerialNo" name="rollNo" type="text" class="form-control" placeholder="First SN" /></p>
<p><input id="eSerialNo" name="serialNo" type="text" class="form-control" placeholder="Last SN" /></p>
<p><td>Current rewind:</td></p>
<table id="tblInfo" class="table">
</table>
<p><td>The order has created roll:</td></p>
<table id="tbInfo" class="table">
</table>
</div>
<div class="col-md-1" id="actions" style="">
<#-- <p><button id="btnConfirm" onclick="rewind()" class="btn btn-default">倒卷</button></p>-->
<p><button id="btnConfirm" onclick="combineRolls()" class="btn btn-default">Create roll</button></p>
</div>
<!-- 卷分切-->
<div id="dlgSlittingRolls" class="easyui-dialog" style="width:500px;display: none;"
closed="true" data-options="modal:true" >
<table id="dgSlittingRolls" class="easyui-datagrid" style="width:100%;height:300px;display: none;"
data-options="pagination: false, showFooter: true, singleSelect:true, fitColumns:true , method:'get', pageSize:20">
<thead>
<tr>
<th data-options="field:'slittingNo',width:60">Slitting Roll No</th>
<th data-options="field:'col',width:20">No. of Cross</th>
</tr>
</thead>
</table>
</div>
</div>
<style>
table.roll-op-serials {
border: 1px solid gray;
}
table.roll-op-serials td{
border: 1px dotted gray;
padding: 3px;
text-align: center;
text-align: center;
font-family: Arial,monospace;
font-size: 11px;
background-color: aliceblue;
}
table.roll-op-serials td .serial-no{
font-size: 11px;
}
</style>
<script src="/laydate/laydate.js"></script>
<script type="text/javascript" src="/js/layer/layer.js"></script>
<script>
$(function () {
$.ajax({
url: "/rewind/getRewindLogForTypeOne",
type:"POST",
data:{
},// 你的formid
dataType:"JSON",
success: function (data) {
if(data.code=="200"){
var $tblInfo = $("#tblInfo");
for (let i = 0; i <data.obj.length ; i++) {
$tblInfo.append("<tr><td>"+data.obj[i].slittingNo+" "+data.obj[i].scanSerialNo+"</td></tr>");
}
}else{
layer.msg(data.msg);
}
$("#fSerialNo").focus();
}
})
refreshTbInfo();
$("#fSerialNo").focus();
})
function rewind(){
let fSerialNo=$("#fSerialNo").val();
let eSerialNo=$("#eSerialNo").val();
if("" == fSerialNo||null==fSerialNo){
layer.msg("Please scan one of the top 10 serial number!");
return false;
}
if("" == eSerialNo||null==eSerialNo){
layer.msg("Please scan one of the last 10 serial number!");
return false;
}
$.ajax({
url: "/rewind/scanSlittingNoForRewindOneToCombine",
type:"POST",
data:{
"fSerialNo": fSerialNo,
"eSerialNo": eSerialNo,
},// 你的formid
dataType:"JSON",
success: function (data) {
$("#fSerialNo").val("")
$("#eSerialNo").val("")
if(data.code=="200"){
var $tblInfo = $("#tblInfo");
$tblInfo.append("<tr><td>"+data.obj+" "+fSerialNo+"</td></tr>");
layer.msg("Saved!");
$("#fSerialNo").focus();
}else{
$.messager.alert("Error", data.msg, "error");
}
$("#fSerialNo").focus();
}
})
}
//测试用
function rewindTest() {
$("#ifmforprint").attr('src', "/print/combineSlittingNo/1940937-99L01/");
}
function combineRolls() {
var tableData = [];
$('#tblInfo tbody tr').each(function(row, tr){
tableData[row] = {
"slittingNo": $(tr).find('td:eq(0)').text(),
// 根据表格实际列数添加其他属性
}
});
if(tableData.length==0){
layer.msg("No data, please rewind first");
return false;
}
$.messager.confirm("Confirm","Confirm complete below rewind?", function(cr){
if (cr){
$.ajax({
url: "/rewind/combineRolls",
type: "POST",
data: {},
dataType: "JSON",
success: function (data) {
if (data.success) {
$("#tblInfo").empty();
$("#ifmforprint").attr('src', "/print/combineSlittingNo/"+data.obj+"/");
refreshTbInfo();
layer.msg("Sucessful!new roll no is:"+data.obj);
} else {
layer.msg(data.msg);
}
}
})
}
});
}
$("#fSerialNo").on("keydown", function(event){
if(event.keyCode==13) {
$.ajax({
url: "/rewind/checkFSerialNo",
type:"POST",
data:{
"fSerialNo": $("#fSerialNo").val(),
},// 你的formid
dataType:"JSON",
success: function (data) {
if(data.code=="200"){
$("#eSerialNo").focus();
}else{
$("#fSerialNo").val("")
$.messager.alert("Error", data.msg, "error");
}
}
})
}
});
$("#eSerialNo").on("keydown", function(event){
if(event.keyCode==13) {
rewind();
}
});
function refreshTbInfo() {
$.ajax({
url: "/rewind/refreshTbInfo",
type: "POST",
data: {},
dataType: "JSON",
success: function (data) {
if (data.success) {
$("#tbInfo").empty();
for (let i = 0; i < data.obj.length; i++) {
// $("#tbInfo").append("<tr><td><a target='forprint' href='/print/combineSlittingNo/"+data.obj[i].slittingNo+"/'>"+data.obj[i].slittingNo+"</a></td> <td><button onclick=\"viewOldRolls(\""+data.obj[i].slittingNo+"\")\" class=\"easyui-linkbutton\">查看原卷</button></td></tr>");
$("#tbInfo").append("<tr><td><a target='forprint' href='/print/combineSlittingNo/"+data.obj[i].slittingNo+"/'>"+data.obj[i].slittingNo+"</a></td> <td><a href='javascript:viewOldRolls(\""+data.obj[i].slittingNo+"\")'>查看原卷</a></td></tr>");
}
} else {
layer.msg(data.msg);
}
}
})
}
function viewOldRolls(slittingNo) {
$('#dlgSlittingRolls').dialog('open').dialog('center').dialog('setTitle',"Old roll");
$("#dgSlittingRolls").datagrid({url: "/rewind/oldRolls/"+slittingNo});
}
</script>
</@master.layout>