123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322 |
- //波次单号回车
- $('#waveNo').keyup(function(event) {
- if(event.keyCode != "13") {
- return false;
- }
- $("#waveNo").val(trimStr($("#waveNo").val()));
-
- //播放扫描声音
- playSound('../raw/scan.wav');
- submitWaveNo()
- });
- $("#waveNo").blur(function() {
- var waveNo = trimStr($("#waveNo").val());
- if(waveNo == '') {
- $('#waveNo').focus();
- }
- });
- setTimeout(function() {
- $('#waveNo').focus();
- }, 1000);
- // 库位号回车
- // $('#locationCode').keyup(function(event) {
- // if(event.keyCode != "13") {
- // return false;
- // }
- // $("#locationCode").val(trimStr($("#locationCode").val()));
- // //播放扫描声音
- // playSound('../raw/scan.wav');
- // $('#barcode').focus();
- // });
- // 条码回车
- $('#barcode').keyup(function(event) {
- if(event.keyCode != "13") {
- return false;
- }
- $("#barcode").val(trimStr($("#barcode").val()));
- //播放扫描声音
- playSound('../raw/scan.wav');
- $("#productQty").focus();
- });
- // 提交
- $('#productQty').keyup(function(event) {
- if(event.keyCode != "13") {
- return false;
- }
- $("#productQty").val(trimStr($("#productQty").val()));
- //播放扫描声音
- playSound('../raw/scan.wav');
- submitOutShelf();
- });
- function submitWaveNo() {
- if($("#waveNo").val() == '') {
- mui.alert('波次号或运单号不能为空!', '注意');
- return;
- }
- var appRequest = $appRequest; //复制请求封装对象
- appRequest.opType = OP_TYPE_MENU.BATCH_OUT_SHELF_1;
- appRequest.msg = $("#waveNo").val(); //msg是消息内容主体
-
- // 提交
- $.ajax({
- type: 'POST',
- url: $appRequestUrl,
- data: JSON.stringify(appRequest),
- contentType: "application/json",
- success: function(result) {
- if(!result.success) {
- playSound('../raw/error.wav');
- $("#waveNo").val("");
- mui.alert(result.msg, '警告', function() { setFocus('waveNo'); });
- return;
- }
- var wave = result.extend;
-
- //刷新待下架列表
- showUnOutShelfDetails();
-
- $("#warehouseCode").val(wave.warehouseCode);
- $("#customerCode").val(wave.customerCode);
- $("#statusName").val(wave.statusName);
-
- $('#barcode').focus();
- },
- error: function() {
- mui.alert('网络断开或服务器发生异常', '注意');
- }
- });
- }
- //提交下架
- var isSubmintIng = false; // 是否正在提交
- function submitOutShelf() {
- if(isSubmintIng) {
- return;
- }
- if($("#waveNo").val() == '') {
- mui.alert('波次号不能为空!', '注意');
- return;
- }
- // if($("#locationCode").val() == '') {
- // mui.alert('货位号不能为空!', '注意');
- // return;
- // }
- if($("#barcode").val() == '') {
- mui.alert('商品条码不能为空!', '注意');
- return;
- }
- if($("#productQty").val() == '') {
- mui.alert('商品数量不能为空!', '注意');
- return;
- }
- isSubmintIng = true;
- var waveNo = $("#waveNo").val();
- // var locationCode = $('#locationCode').val();
- var barcode = $('#barcode').val();
- var quantity = $("#productQty").val();
- var jsonData = {};
- jsonData.waveNo = waveNo;
- jsonData.quantity = quantity;
- // jsonData.locationCode = locationCode;
- jsonData.barcode = barcode;
- var appRequest = $appRequest; //复制请求封装对象
- appRequest.opType = OP_TYPE_MENU.BATCH_OUT_SHELF_2;
- appRequest.msg = JSON.stringify(jsonData); //msg是消息内容主体
- mui(document.getElementById("subButton")).button('loading'); //切换为loading状态
- // 提交
- $.ajax({
- type: 'POST',
- url: $appRequestUrl,
- data: JSON.stringify(appRequest),
- contentType: "application/json",
- success: function(result) {
- console.log(JSON.stringify(result))
- isSubmintIng = false;
- mui(document.getElementById("subButton")).button('reset'); //重置button
- if(!result.success) {
- playSound('../raw/error.wav');
- mui.alert(result.msg, '警告', function() { setFocus('barcode'); });
- return;
- }
- mui.toast(result.msg);
- //播放成功声音
- playSound('../raw/ok.wav');
-
- //刷新下架列表
- refreshUnOutShelfItems();
- refreshAlreadyOutShelfItems();
-
- nextBarcode(); // 下一个库位
-
- if(result.extend.flag == '3') { // 波次完成下架
- cleanAll();
- }
- },
- error: function() {
- isSubmintIng = false;
- mui(document.getElementById("subButton")).button('reset'); //重置button
- mui.alert('网络断开或服务器发生异常', '注意');
- }
- });
- }
- function nextBarcode() {
- // 下架完之后清空
- $(".allowClear").each(function() {
- $(this).val("")
- })
- $('#barcode').focus();
- }
- function cleanAll() {
- $("input").each(function() {
- $(this).val("")
- })
- $('#waveNo').focus();
- }
- //下架列表
- var isShowUnOutShelfDetails = false;
- function showUnOutShelfDetails(){
- if(!isShowUnOutShelfDetails){
- $("#showUnOutShelfDetails").show();
- isShowUnOutShelfDetails = true;
- $("#showUnOutShelfIco").attr("class", "fa fa-angle-double-up");
-
- //刷新明细
- refreshUnOutShelfItems();
- }else{
- $("#showUnOutShelfDetails").hide();
- isShowUnOutShelfDetails = false;
- $("#showUnOutShelfIco").attr("class", "fa fa-angle-double-down");
- }
- //回到上次焦点地方
- // if(focusId!=null && focusId != ''){
- // $("#"+focusId).focus();
- // }
- }
- //显示待下架明细
- function refreshUnOutShelfItems(){
- var waveNo = $('#waveNo').val();
-
- var appRequest = $appRequest;//复制请求封装对象
- appRequest.opType = OP_TYPE_MENU.BATCH_OUT_SHELF_3;
- appRequest.msg = waveNo;//msg是消息内容主体
-
- $("#unOutShelfItemList").empty();
- $.ajax({
- type: 'POST',
- url: $appRequestUrl,
- contentType: "application/json; charset=utf-8",
- data: JSON.stringify(appRequest),
- success: function (appResponse) {
- if(!appResponse.success){
- return;
- }
-
- var waitQtyTotal = 0;
- var itemList = appResponse.extend;
- // console.log(JSON.stringify(itemList));
-
- var unOutShelfList = itemList.unOutShelfList;
- for(var index = 0; index < unOutShelfList.length; index ++){
- var unOutShelf = unOutShelfList[index];
- var tr = "<tr id='item_"+unOutShelf.id+"'>";
- tr += "<th><div style='width:100%;overflow: hidden;font-size: 9pt;text-align: left;'>"+unOutShelf.barcode+"</div></th>";
- tr += "<th><div style='width:100%;overflow: hidden;font-size: 9pt;text-align: left;'>"+unOutShelf.productName+"</div></th>";
- tr += "<th><div style='width:100%;overflow: hidden;font-size: 9pt;text-align: left;'>"+unOutShelf.locationCode+"</div></th>";
- tr += "<th><div style='width:100%;overflow: hidden;font-size: 9pt;text-align: left;'>"+unOutShelf.quantity+"</div></th>";
- tr += "<th><div style='width:100%;overflow: hidden;font-size: 9pt;text-align: left;'>"+unOutShelf.extend4+"</div></th>";
- tr += "</tr>";
-
- $("#unOutShelfItemList").append(tr);
- }
- },
- error: function () {
- playSound('../raw/error.wav');
- mui.toast('网络断开或服务器发生异常');
- }
- });
- }
- //已下架列表
- var isAlreadyOutShelfDetails = false;
- function alreadyOutShelfDetails(){
- if(!isAlreadyOutShelfDetails){
- $("#alreadyOutShelfDetails").show();
- isAlreadyOutShelfDetails = true;
- $("#showAlreadyOutShelfIco").attr("class", "fa fa-angle-double-up");
-
- //刷新明细
- refreshAlreadyOutShelfItems();
- }else{
- $("#alreadyOutShelfDetails").hide();
- isAlreadyOutShelfDetails = false;
- $("#showAlreadyOutShelfIco").attr("class", "fa fa-angle-double-down");
- }
- //回到上次焦点地方
- /* if(focusId!=null && focusId != ''){
- $("#"+focusId).focus();
- } */
- }
- //显示已下架明细
- function refreshAlreadyOutShelfItems(){
- var waveNo = $('#waveNo').val();
-
- var appRequest = $appRequest;//复制请求封装对象
- appRequest.opType = OP_TYPE_MENU.BATCH_OUT_SHELF_3;
- appRequest.msg = waveNo;//msg是消息内容主体
-
- $("#alreadyOutShelfItemList").empty();
- $.ajax({
- type: 'POST',
- url: $appRequestUrl,
- contentType: "application/json; charset=utf-8",
- data: JSON.stringify(appRequest),
- success: function (appResponse) {
- if(!appResponse.success){
- return;
- }
-
- var waitQtyTotal = 0;
- var itemList = appResponse.extend;
- // console.log(JSON.stringify(itemList));
-
- var alreadyOutShelfList = itemList.alreadyOutShelfList;
- for(var index = 0; index < alreadyOutShelfList.length; index ++){
- var alreadyOutShelf = alreadyOutShelfList[index];
- var tr = "<tr id='item_"+alreadyOutShelf.id+"'>";
- tr += "<th><div style='width:100%;overflow: hidden;font-size: 9pt;text-align: left;'>"+alreadyOutShelf.barcode+"</div></th>";
- tr += "<th><div style='width:100%;overflow: hidden;font-size: 9pt;text-align: left;'>"+alreadyOutShelf.productName+"</div></th>";
- tr += "<th><div style='width:100%;overflow: hidden;font-size: 9pt;text-align: left;'>"+alreadyOutShelf.locationCode+"</div></th>";
- tr += "<th><div style='width:100%;overflow: hidden;font-size: 9pt;text-align: left;'>"+alreadyOutShelf.quantity+"</div></th>";
- tr += "<th><div style='width:100%;overflow: hidden;font-size: 9pt;text-align: left;'>"+alreadyOutShelf.extend4+"</div></th>";
- tr += "</tr>";
-
- $("#alreadyOutShelfItemList").append(tr);
- }
- },
- error: function () {
- playSound('../raw/error.wav');
- mui.toast('网络断开或服务器发生异常');
- }
- });
- }
|