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.

80 lines
2.3 KiB

3 days ago
  1. <#import "../master.ftl" as master>
  2. <@master.layout>
  3. <div class="page-header">
  4. <h3>Receive by Normal Box</h3>
  5. </div>
  6. <div class="row" id="app">
  7. <div class="col-md-4">
  8. <p><input id="locationNo" name="locationNo" type="text" class="form-control" style="text-transform:uppercase;" placeholder="Please scan location no" /></p>
  9. <p><input id="boxNo" name="boxNo" type="text" class="form-control" style="text-transform:uppercase;" placeholder="Scaning Box No" /></p>
  10. <table id="tblInfo" class="table">
  11. </table>
  12. </div>
  13. <div class="col-md-1">
  14. <p><button class="btn btn-default" id="btnFinishBox" onclick="">Receive</button></p>
  15. </div>
  16. <div class="col-md-2" style="margin-top:10px">
  17. <p style="font-size:14px">Receive Qty this Time<span id = "boxQty" style="color:#00f"></span></p>
  18. </div>
  19. </div>
  20. <script>
  21. var boxQty=0
  22. $(function(){
  23. $("#locationNo").focus()
  24. boxQty=0
  25. $("#boxQty").html(" : "+boxQty)
  26. });
  27. $("#locationNo").on("keydown", function(){
  28. if (event.keyCode === 13) {
  29. $(this).val($(this).val().trim().toUpperCase());
  30. if ($(this).val() == '') {
  31. alert("The scanned location is wrong !");
  32. return false
  33. }
  34. $("#boxNo").focus()
  35. }
  36. })
  37. $("#boxNo").on("keydown", function(){
  38. if (event.keyCode === 13) {
  39. let boxNo=$("#boxNo").val().toUpperCase()
  40. let locationNo=$("#locationNo").val().toUpperCase()
  41. if (boxNo == '') {
  42. alert("The scanned Box No is wrong !");
  43. return false
  44. }
  45. if ($("#locationNo").val() == '') {
  46. alert("The scanned location is wrong !");
  47. return false
  48. }
  49. $.post("/receive/stockBox", {boxNo:boxNo , locationNo:locationNo } , function(data){
  50. if (data.success){
  51. $("#tblInfo").append("<p>" + boxNo + "</a> => Received</p>");
  52. boxQty=Number(boxQty)+1
  53. $("#boxQty").html(" : "+boxQty)
  54. $("#boxNo").val("").focus();
  55. }else{
  56. $("#tblInfo").append("<p>"+ boxNo + "&nbsp;<span style='color:red'>" + data.errorMsg+"</span></p>");
  57. $("#boxNo").val("").focus();
  58. }
  59. });
  60. }
  61. })
  62. </script>
  63. </@master.layout>