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.
 
 
 
 
 

102 lines
3.5 KiB

<#import "../master.ftl" as master>
<@master.layout>
<div class="page-header">
<h3>出库扫描 - ${box.shipNo} / ${box.boxNo}</h3>
</div>
<div class="row" id="app">
<div class="col-md-4">
<#if box.status?? && box.status == "Packed">
<h3>Packed</h3>
<#else>
<p><input id="finalRollNo" name="finalRollNo" type="text" class="form-control" placeholder="FG roll no" /></p>
</#if>
<div id="tblInfo" >
</div>
</div>
<div class="col-md-1">
<#if box.status?? && box.status == "Packed">
<p><button class="btn btn-default" id="btnAddBox" onclick="doAddBox('${box.shipNo}')">New Box</button></p>
<#else>
<p><button class="btn btn-default" id="btnFinishBox" onclick="doFinishBox()">End packing</button></p>
</#if>
</div>
<div class="col-md-2" style="margin-top:10px">
<p style="font-size:14px">Rolls in box<span id = "shipNo" style="color:#00f"></span></p>
</div>
</div>
<script>
var boxId = '${box.id}';
boxId = boxId.replace(',','');
$("#finalRollNo").on("keydown", function(){
var finalRollNo = $(this).val();
if(event.keyCode == 13){
$.post("/shipment/boxes/scan/add", {boxNo: "${box.boxNo}", finalRollNo: finalRollNo} , function(data){
console.log(data);
if (data.success){
getRollNO();
$("#tblInfo").append("<p>" + finalRollNo + " => Shipped</p>");
$("#finalRollNo").val("");
}else{
if("扫描的小卷卷号的数量 < 500!"==data.errorMsg){
//$("#tblInfo").append("<p>" + finalRollNo + data.errorMsg + "</p>");
$("#tblInfo").append("<p><span style='color:#ff0000;font-weight:bold;'>" + finalRollNo + data.errorMsg + "</span></p>");
$("#finalRollNo").val("");
}else{
$("#tblInfo").append("<p><span style='color:#ff0000;font-weight:bold;'>" + finalRollNo + data.errorMsg + "</p>");
$("#finalRollNo").val("");
}
playmp3();
}
});
}
});
function doAddBox(shipNo){
$.post("/shipment/boxes/add", {shipNo: shipNo} , function(data){
if (data.success){
window.location.href="/shipment/boxes/scan/" + data.box.id;
}else{
alert("Fail to add: " + data.errorMsg);
}
});
}
function doFinishBox(){
console.log(boxId);
$.messager.confirm("Confirm","Submit", function(cr){
if (cr){
$.post("/shipment/boxes/finish", {boxId: boxId}, function(ret){
if (ret.success){
$("#ifmforprint").attr('src', "/print/box/" + ret.box.boxNo + "/");
setTimeout(function(){window.location.reload();},2000);
}else{
$.messager.alert("Error", ret.errorMsg, "error");
}
})
}
})
}
$(function () {
$("#finalRollNo").focus();
getRollNO();
})
//获取该箱子得卷数量
function getRollNO(){
$.post("/shipment/getRollNO", {boxNo: "${box.boxNo}"} , function(data){
if (data.success){
$('#shipNo').html(" : "+data.rollNo);
}else{
alert("Fail to add: " + data.errorMsg);
}
});
}
</script>
</@master.layout>