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

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