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.9 KiB

3 days ago
  1. <#import "../master.ftl" as master>
  2. <@master.layout>
  3. <div class="page-header">
  4. <h3> Combining Box - ${recv.receiveNo} <#if RequestParameters.type == "Defective"></#if></h3>
  5. <input id="boxType" type="hidden" value="RequestParameters.type"></input>
  6. </div>
  7. <div class="row" id="app">
  8. <div class="col-md-4">
  9. <#if box.status?? && box.status == "Packed">
  10. <h3>Packed</h3>
  11. <#else>
  12. <p><input id="finalRollNo" name="finalRollNo" type="text" class="form-control" style="text-transform:uppercase;" placeholder="FG roll no" /></p>
  13. </#if>
  14. <div id="tblInfo" >
  15. </div>
  16. </div>
  17. <div class="col-md-1">
  18. <#if box.status?? && box.status == "Packed">
  19. <p><button class="btn btn-default" id="btnAddBox" onclick="doAddBox('${recv.receiveNo}','${recv.id}','${box.boxType}')">New Box</button></p>
  20. <#else>
  21. <p><button class="btn btn-default" id="btnFinishBox" onclick="doFinishBox('${box.boxNo}')">End packing</button></p>
  22. </#if>
  23. <!-- <p>Rolls in box</p><input type="text" id = "rollNo" readonly="readonly" value=""> -->
  24. </div>
  25. <div class="col-md-2" style="margin-top:10px">
  26. <p style="font-size:14px">Rolls in box<span id = "rollNo" style="color:#00f"></span></p>
  27. </div>
  28. </div>
  29. <script>
  30. $(function(){
  31. getRollNO();
  32. });
  33. var recv_id = "${recv.id}";
  34. recv_id = recv_id.replace(',','');
  35. $("#finalRollNo").on("keydown", function(){
  36. var finalRollNo = $(this).val();
  37. if(event.keyCode == 13){
  38. $.post("/receive/scan/addPlus", {receiveId: recv_id, receiveNo: "${recv.receiveNo}",boxNo: "${box.boxNo}", finalRollNo: finalRollNo, type:'${box.boxType}'} , function(data){
  39. if (data.success){
  40. $("#tblInfo").append("<p><a href='/print/finalroll/"+finalRollNo+"/' target='forprint'>" + finalRollNo + "</a> => Successfully</p>");
  41. getRollNO();
  42. if ("QS" == "${RequestParameters.type}"){
  43. $("#ifmforprint").attr('src', "/print/finalroll/" + finalRollNo + "/");
  44. }
  45. $("#finalRollNo").val("").focus();
  46. }else{
  47. $("#tblInfo").append("<p>"+ finalRollNo + "&nbsp;<span style='color:red'>" + data.errorMsg+"</span></p>");
  48. $("#finalRollNo").val("").focus();
  49. }
  50. });
  51. }
  52. }).on("blur", function() {
  53. $(this).val($(this).val().trim().toUpperCase());
  54. }).focus();
  55. function doAddBox(receiveNo,id,boxType){
  56. id = id.replace(',','');
  57. $.post("/receive/boxes/add", {receiveNo: receiveNo,type: boxType} , function(data){
  58. if (data.success){
  59. window.location.href="/receive/scanPlus/" + id+"?type="+boxType+"&boxNo="+data.box.boxNo;
  60. }else{
  61. alert("Fail to add: " + data.errorMsg);
  62. }
  63. });
  64. }
  65. function doFinishBox(boxNo){
  66. console.log(boxNo);
  67. $.messager.confirm("Confirm","Submit", function(cr){
  68. console.log(cr);
  69. if (cr){
  70. $.post("/receive/boxes/finish", {boxNo: boxNo}, function(ret){
  71. console.log(ret);
  72. if (ret.success){
  73. $("#ifmforprint").attr('src', "/print/receiveBox/" + ret.box.boxNo + "/");
  74. setTimeout(function(){window.location.reload();},2000);
  75. }else{
  76. $.messager.alert("Error", ret.errorMsg, "error");
  77. }
  78. })
  79. }
  80. })
  81. }
  82. //获取该箱子得卷数量
  83. function getRollNO(){
  84. $.post("/receive/getRollNO", {boxNo: "${box.boxNo}"} , function(data){
  85. if (data.success){
  86. $("#rollNo").html(" : "+data.rollNo)
  87. }else{
  88. alert("Fail to add: " + data.errorMsg);
  89. }
  90. });
  91. }
  92. </script>
  93. </@master.layout>