waveOutShelf.js 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184
  1. //波次单号回车
  2. $('#waveNo').keyup(function(event) {
  3. if(event.keyCode != "13") {
  4. return false;
  5. }
  6. $("#waveNo").val(trimStr($("#waveNo").val()));
  7. //播放扫描声音
  8. playSound('../raw/scan.wav');
  9. submitWaveNo()
  10. });
  11. $("#waveNo").blur(function() {
  12. var waveNo = trimStr($("#waveNo").val());
  13. if(waveNo == '') {
  14. $('#waveNo').focus();
  15. }
  16. });
  17. setTimeout(function() {
  18. $('#waveNo').focus();
  19. }, 1000);
  20. // 库位号回车
  21. // $('#locationCode').keyup(function(event) {
  22. // if(event.keyCode != "13") {
  23. // return false;
  24. // }
  25. // $("#locationCode").val(trimStr($("#locationCode").val()));
  26. // //播放扫描声音
  27. // playSound('../raw/scan.wav');
  28. // $('#barcode').focus();
  29. // });
  30. // 条码回车
  31. $('#barcode').keyup(function(event) {
  32. if(event.keyCode != "13") {
  33. return false;
  34. }
  35. $("#barcode").val(trimStr($("#barcode").val()));
  36. //播放扫描声音
  37. playSound('../raw/scan.wav');
  38. $("#productQty").focus();
  39. });
  40. // 提交
  41. $('#productQty').keyup(function(event) {
  42. if(event.keyCode != "13") {
  43. return false;
  44. }
  45. $("#productQty").val(trimStr($("#productQty").val()));
  46. //播放扫描声音
  47. playSound('../raw/scan.wav');
  48. submitOutShelf();
  49. });
  50. function submitWaveNo() {
  51. if($("#waveNo").val() == '') {
  52. mui.alert('波次号或运单号不能为空!', '注意');
  53. return;
  54. }
  55. var appRequest = $appRequest; //复制请求封装对象
  56. appRequest.opType = OP_TYPE_MENU.BATCH_OUT_SHELF_1;
  57. appRequest.msg = $("#waveNo").val(); //msg是消息内容主体
  58. // 提交
  59. $.ajax({
  60. type: 'POST',
  61. url: $appRequestUrl,
  62. data: JSON.stringify(appRequest),
  63. contentType: "application/json",
  64. success: function(result) {
  65. if(!result.success) {
  66. playSound('../raw/error.wav');
  67. $("#waveNo").val("");
  68. mui.alert(result.msg, '警告', function() { setFocus('waveNo'); });
  69. return;
  70. }
  71. var wave = result.extend;
  72. $("#warehouseCode").val(wave.warehouseCode);
  73. $("#customerCode").val(wave.customerCode);
  74. $("#statusName").val(wave.statusName);
  75. $('#barcode').focus();
  76. },
  77. error: function() {
  78. mui.alert('网络断开或服务器发生异常', '注意');
  79. }
  80. });
  81. }
  82. //提交下架
  83. var isSubmintIng = false; // 是否正在提交
  84. function submitOutShelf() {
  85. if(isSubmintIng) {
  86. return;
  87. }
  88. if($("#waveNo").val() == '') {
  89. mui.alert('波次号不能为空!', '注意');
  90. return;
  91. }
  92. // if($("#locationCode").val() == '') {
  93. // mui.alert('货位号不能为空!', '注意');
  94. // return;
  95. // }
  96. if($("#barcode").val() == '') {
  97. mui.alert('商品条码不能为空!', '注意');
  98. return;
  99. }
  100. if($("#productQty").val() == '') {
  101. mui.alert('商品数量不能为空!', '注意');
  102. return;
  103. }
  104. isSubmintIng = true;
  105. var waveNo = $("#waveNo").val();
  106. // var locationCode = $('#locationCode').val();
  107. var barcode = $('#barcode').val();
  108. var quantity = $("#productQty").val();
  109. var jsonData = {};
  110. jsonData.waveNo = waveNo;
  111. jsonData.quantity = quantity;
  112. // jsonData.locationCode = locationCode;
  113. jsonData.barcode = barcode;
  114. var appRequest = $appRequest; //复制请求封装对象
  115. appRequest.opType = OP_TYPE_MENU.BATCH_OUT_SHELF_2;
  116. appRequest.msg = JSON.stringify(jsonData); //msg是消息内容主体
  117. mui(document.getElementById("subButton")).button('loading'); //切换为loading状态
  118. // 提交
  119. $.ajax({
  120. type: 'POST',
  121. url: $appRequestUrl,
  122. data: JSON.stringify(appRequest),
  123. contentType: "application/json",
  124. success: function(result) {
  125. console.log(JSON.stringify(result))
  126. isSubmintIng = false;
  127. mui(document.getElementById("subButton")).button('reset'); //重置button
  128. if(!result.success) {
  129. playSound('../raw/error.wav');
  130. mui.alert(result.msg, '警告', function() { setFocus('barcode'); });
  131. return;
  132. }
  133. mui.toast(result.msg);
  134. //播放成功声音
  135. playSound('../raw/ok.wav');
  136. nextBarcode(); // 下一个库位
  137. if(result.extend.flag == '3') { // 波次完成下架
  138. cleanAll();
  139. }
  140. },
  141. error: function() {
  142. isSubmintIng = false;
  143. mui(document.getElementById("subButton")).button('reset'); //重置button
  144. mui.alert('网络断开或服务器发生异常', '注意');
  145. }
  146. });
  147. }
  148. function nextBarcode() {
  149. // 下架完之后清空
  150. $(".allowClear").each(function() {
  151. $(this).val("")
  152. })
  153. $('#barcode').focus();
  154. }
  155. function cleanAll() {
  156. $("input").each(function() {
  157. $(this).val("")
  158. })
  159. $('#waveNo').focus();
  160. }