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.

103 lines
3.9 KiB

3 days ago
  1. <#import "../master.ftl" as master>
  2. <@master.layout>
  3. <div class="page-header">
  4. <h3>Packing&Receive - ${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. var receivedType = "${recv.receivedType}";
  35. recv_id = recv_id.replace(',','');
  36. $("#finalRollNo").on("keydown", function(){
  37. var finalRollNo = $(this).val();
  38. if(event.keyCode == 13){
  39. $.post("/receive/scan/add", {receiveId: recv_id, receiveNo: "${recv.receiveNo}",boxNo: "${box.boxNo}", finalRollNo: finalRollNo, type:'${box.boxType}'} , function(data){
  40. if (data.success){
  41. $("#tblInfo").append("<p><a href='/print/finalroll/"+finalRollNo+"/' target='forprint'>" + finalRollNo + "</a> => Successfully</p>");
  42. getRollNO();
  43. if ("QS" == "${RequestParameters.type}"){
  44. $("#ifmforprint").attr('src', "/print/finalroll/" + finalRollNo + "/");
  45. }
  46. $("#finalRollNo").val("").focus();
  47. }else{
  48. $("#tblInfo").append("<p>"+ finalRollNo + "&nbsp;<span style='color:red'>" + data.errorMsg+"</span></p>");
  49. $("#finalRollNo").val("").focus();
  50. }
  51. });
  52. }
  53. }).on("blur", function() {
  54. $(this).val($(this).val().trim().toUpperCase());
  55. }).focus();
  56. function doAddBox(receiveNo,id,boxType){
  57. id = id.replace(',','');
  58. $.post("/receive/boxes/add", {receiveNo: receiveNo,type: boxType} , function(data){
  59. if (data.success){
  60. window.location.href="/receive/scan/" + id+"?type="+boxType+"&boxNo="+data.box.boxNo;
  61. }else{
  62. alert("Fail to add: " + data.errorMsg);
  63. }
  64. });
  65. }
  66. function doFinishBox(boxNo){
  67. console.log(boxNo);
  68. $.messager.confirm("Confirm","Submit", function(cr){
  69. console.log(cr);
  70. if (cr){
  71. $.post("/receive/boxes/finish", {boxNo: boxNo}, function(ret){
  72. console.log(ret);
  73. if (ret.success){
  74. $("#ifmforprint").attr('src', "/print/receiveBox/" + ret.box.boxNo + "/");
  75. setTimeout(function(){window.location.reload();},2000);
  76. }else{
  77. $.messager.alert("Error", ret.errorMsg, "error");
  78. }
  79. })
  80. }
  81. })
  82. }
  83. //获取该箱子得卷数量
  84. function getRollNO(){
  85. $.post("/receive/getRollNO", {boxNo: "${box.boxNo}"} , function(data){
  86. if (data.success){
  87. $("#rollNo").html(" : "+data.rollNo)
  88. }else{
  89. alert("Fail to add: " + data.errorMsg);
  90. }
  91. });
  92. }
  93. </script>
  94. </@master.layout>