|
|
<#import "../master.ftl" as master><@master.layout>
<div class="page-header"> <h3> Combining Box - ${recv.receiveNo} <#if RequestParameters.type == "Defective"></#if></h3> <input id="boxType" type="hidden" value="RequestParameters.type"></input></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" style="text-transform:uppercase;" 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('${recv.receiveNo}','${recv.id}','${box.boxType}')">New Box</button></p> <#else> <p><button class="btn btn-default" id="btnFinishBox" onclick="doFinishBox('${box.boxNo}')">End packing</button></p> </#if> <!-- <p>Rolls in box</p><input type="text" id = "rollNo" readonly="readonly" value=""> --> </div> <div class="col-md-2" style="margin-top:10px"> <p style="font-size:14px">Rolls in box<span id = "rollNo" style="color:#00f"></span></p> </div></div>
<script> $(function(){ getRollNO();}); var recv_id = "${recv.id}"; recv_id = recv_id.replace(',',''); $("#finalRollNo").on("keydown", function(){ var finalRollNo = $(this).val(); if(event.keyCode == 13){ $.post("/receive/scan/addPlus", {receiveId: recv_id, receiveNo: "${recv.receiveNo}",boxNo: "${box.boxNo}", finalRollNo: finalRollNo, type:'${box.boxType}'} , function(data){ if (data.success){ $("#tblInfo").append("<p><a href='/print/finalroll/"+finalRollNo+"/' target='forprint'>" + finalRollNo + "</a> => Successfully</p>"); getRollNO(); if ("QS" == "${RequestParameters.type}"){ $("#ifmforprint").attr('src', "/print/finalroll/" + finalRollNo + "/"); }
$("#finalRollNo").val("").focus(); }else{ $("#tblInfo").append("<p>"+ finalRollNo + " <span style='color:red'>" + data.errorMsg+"</span></p>"); $("#finalRollNo").val("").focus(); } }); } }).on("blur", function() { $(this).val($(this).val().trim().toUpperCase()); }).focus();
function doAddBox(receiveNo,id,boxType){ id = id.replace(',',''); $.post("/receive/boxes/add", {receiveNo: receiveNo,type: boxType} , function(data){ if (data.success){ window.location.href="/receive/scanPlus/" + id+"?type="+boxType+"&boxNo="+data.box.boxNo; }else{ alert("Fail to add: " + data.errorMsg); } }); } function doFinishBox(boxNo){ console.log(boxNo); $.messager.confirm("Confirm","Submit", function(cr){ console.log(cr); if (cr){ $.post("/receive/boxes/finish", {boxNo: boxNo}, function(ret){ console.log(ret); if (ret.success){ $("#ifmforprint").attr('src', "/print/receiveBox/" + ret.box.boxNo + "/"); setTimeout(function(){window.location.reload();},2000); }else{ $.messager.alert("Error", ret.errorMsg, "error"); } }) } }) } //获取该箱子得卷数量 function getRollNO(){ $.post("/receive/getRollNO", {boxNo: "${box.boxNo}"} , function(data){ if (data.success){ $("#rollNo").html(" : "+data.rollNo) }else{ alert("Fail to add: " + data.errorMsg); } }); }</script>
</@master.layout>
|