From aa910d7bb5f164b1ce4782359a8eecddca103bdc Mon Sep 17 00:00:00 2001 From: Administrator <Administrator@DESKTOP-5BIMHQ3> Date: 星期日, 04 二月 2024 09:56:27 +0800 Subject: [PATCH] 修改bug --- Pda/View/AsnSetting/productEnter1.html | 325 +++++++++++++++++++++++++++++++++-------------------- 1 files changed, 203 insertions(+), 122 deletions(-) diff --git a/Pda/View/AsnSetting/productEnter1.html b/Pda/View/AsnSetting/productEnter1.html index 137b213..caaa38d 100644 --- a/Pda/View/AsnSetting/productEnter1.html +++ b/Pda/View/AsnSetting/productEnter1.html @@ -110,8 +110,8 @@ <br /> <!-- 鏈夌爜 --> <div id="content1"> - <div id="zongDiv" class="layout-bill-info" style="height: 255px;"> - <form class="layui-form" id="form1" action=""> + <div id="zongDiv" class="layout-bill-info" style="height: 285px;"> + <form class="layui-form" action=""> <div id="" class="layui-form-item layout-dropdownlist"> <label class="layui-form-label" lang>鍏ュ簱鍗曪細</label> <div class="layui-input-block" id="selectDiv"> @@ -130,7 +130,7 @@ <img src="/assets/down_arraw.png"> </div> </div> - + <div id="" class="layui-form-item layout-input"> <label class="layui-form-label" lang>鎵樼洏鏉$爜锛�</label> <div class="layui-input-block"> @@ -159,7 +159,7 @@ class="layui-input"> </div> </div> - + <table class="layout-tbl-input" border="" cellspacing="" cellpadding=""> <tr> <td> @@ -180,7 +180,7 @@ </div> </div> </td> - + </tr> <tr> <td> @@ -202,9 +202,9 @@ </div> </td> </tr> - + </table> - + <table class="layout-tbl-submit" border="" cellspacing="" cellpadding=""> <tr> <td style="width: 23%;"></td> @@ -213,10 +213,9 @@ lay-filter="formBind">缁戝畾鍒版墭鐩�</button> </td> <td style="width: 33%;"></td> - + </tr> </table> - </form> </div> @@ -269,7 +268,7 @@ <div id="" class="layui-form-item layout-dropdownlist"> <label class="layui-form-label" lang>鍏ュ簱鍗曪細</label> <div class="layui-input-block" id="selectDiv1"> - <select id="bar1" lay-filter="getbar" lay-search> + <select id="bar1" lay-filter="getbar1" lay-search> <option value=""></option> </select> <img src="/assets/down_arraw.png"> @@ -277,7 +276,7 @@ </div> <div class="layui-form-item layout-dropdownlist" style="margin-top: 10px;"> <label class="layui-form-label">鐗╂枡-鎵规锛�</label> - <div class="layui-input-block" id="goodDiv"> + <div class="layui-input-block" id="goodDiv1"> <select id="goodSelect1" lay-filter="goodSelect1" lay-search> <option value=""></option> </select> @@ -363,10 +362,10 @@ <div class="layout-tbl-paging" id=""> <table id="tableBoxList1" class="tbl-box-list" border="" cellspacing="" cellpadding=""> <tr> - <th lang style="width: 15%;">缂栫爜</th> - <th lang style="width: 35%;">鍚嶇О</th> + <th lang style="width: 15%;">鐗╂枡缂栫爜</th> + <th lang style="width: 35%;">鐗╂枡鍚嶇О</th> <th lang style="width: 25%;">鎵规</th> - <th lang style="width: 15%;">鏁伴噺</th> + <th lang style="width: 15%;">鐗╂枡鏁伴噺</th> <th lang style="width: 10%;">鎿嶄綔</th> </tr> <tr id="boxCell" style="display: none;"> @@ -438,27 +437,30 @@ }); }); - //娓呯┖涓や釜鏍囩椤靛唴瀹� - function qingkong() - { - //鍏ュ簱鍗曟嵁 - // $('#form1').reset() - // $('#form2').reset() + //娓呮鏂囨湰妗嗕腑鏁版嵁 + // function clear() { + // if (xianshiyemian == "0") + // { + // $("#BOXCODE").val(""); + // $("#BOXCODE2").val(""); - // //琛ㄦ牸鍐呭 - // let trs = $("#tableBoxList tr") - // let len = trs.length + // $("#ImportQuantity").val(""); + // $("#Standard").val(""); + // $("#ImportFactQuantity").val(""); + // $("#BoxQty").val(""); + // } + // else if (xianshiyemian == "1") + // { + // $("#BOXCODE").val(""); + // $("#BOXCODE2").val(""); - // for (i = len - 1; i >= 2; i--) { - // trs[i].remove(); - // } - // let trs1 = $("#tableBoxList1 tr") - // let len1 = trs1.length - - // for (i = len1 - 1; i >= 2; i--) { - // trs1[i].remove(); - // } - } + // $("#ImportQuantity").val(""); + // $("#Standard").val(""); + // $("#ImportFactQuantity").val(""); + // $("#BoxQty").val(""); + // } + + // } /*鈥斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺��*/ @@ -469,15 +471,6 @@ var curPageIndex = 1; //鏄惁杩炵画缁勬墭 isContinue = "0"; - //娓呮鏂囨湰妗嗕腑鏁版嵁 - function clear() { - $("#ImportQuantity").val(""); - $("#GoodsCode").val(""); - $("#Standard").val(""); - $("#ImportFactQuantity").val(""); - $("#ImportQty").val(""); - $("#BoxQty").val(""); - } // 鎵樼洏鐮佹枃鏈敼鍙樻椂瑙﹀彂 $("#STOCKCODE").on('input', function () { @@ -490,7 +483,7 @@ } checkPalletStat() }) - // 鎵樼洏鐮佹枃鏈敼鍙樻椂瑙﹀彂 + // 鎵樼洏鐮佹枃鏈敼鍙樻椂瑙﹀彂-鏁伴噺 $("#STOCKCODE1").on('input', function () { if ($("#STOCKCODE1").val() == "" || $("#STOCKCODE1").val().length < 8) { @@ -506,22 +499,25 @@ $("#BOXCODE").keydown(function (e) { if (e.keyCode === 13) { if ($("#BOXCODE").val() == "") { - return - } - - if ($("#STOCKCODE").val() == "") { - layer.msg('璇峰厛鎵弿鎵樼洏鐮�', { + layer.msg('璇峰厛鎵弿绠辩爜', { icon: 2, time: 2000 //2绉掑叧闂紙濡傛灉涓嶉厤缃紝榛樿鏄�3绉掞級 }); - $("#BOXCODE").val(""); - $("#STOCKCODE").focus(); - return; + return } + + // if ($("#STOCKCODE").val() == "") { + // layer.msg('璇峰厛鎵弿鎵樼洏鐮�', { + // icon: 2, + // time: 2000 //2绉掑叧闂紙濡傛灉涓嶉厤缃紝榛樿鏄�3绉掞級 + // }); + // $("#BOXCODE").val(""); + // $("#STOCKCODE").focus(); + // return; + // } checkBoxInfo() } }); - /* 鍏ュ簱鍗曟嵁涓嬫媺妗� */ //鐐瑰嚮鍏ュ簱鍗曟嵁涓嬫媺妗嗕簨浠� @@ -566,7 +562,7 @@ form.render('select'); var param = { - Type: "0,1" + Type: "0,1,3" }; sendData(IP + "/PdaAsn/GetArrivalNotices", param, 'post', function (res) { if (res.code == 0) { //鎴愬姛 @@ -643,8 +639,22 @@ }, function () { }); } }) + //鐐瑰嚮鐗╂枡涓嬫媺妗嗕簨浠�-鏁伴噺 + $("#goodDiv1").click(function () { + if ($("#bar1").val() == null || $("#bar1").val() == "" || $("#bar1").val() == undefined) { + layer.msg("璇峰厛閫夋嫨鍏ュ簱鍗�", { + icon: 2, + time: 2000 //2绉掑叧闂紙濡傛灉涓嶉厤缃紝榛樿鏄�3绉掞級 + }, function () { }); + } + }) //閫変腑鍏ュ簱鍗曚簨浠� form.on('select(getbar)', function (data) { + updateGoodList() + setOrderGoods(); + }); + //閫変腑鍏ュ簱鍗曚簨浠�-鏁伴噺 + form.on('select(getbar1)', function (data) { updateGoodList() setOrderGoods(); }); @@ -662,7 +672,6 @@ form.on('submit(formBind)', function (data) { if(xianshiyemian == 0) { - console.log(isContinue); console.log($("#goodSelect").val()); if ($("#bar").val() == "") { layer.msg('璇烽�夋嫨鍏ュ簱鍗�', { @@ -693,36 +702,36 @@ return; } var param = { - AsnNo: $("#bar").val(), - PalletNo: $("#STOCKCODE").val(), - AsnDetailId: parseInt($("#goodSelect").val()), - BoxNo: $("#BOXCODE").val(), - IsContinue: isContinue, - TailBoxNo: $("#BOXCODE2").val(), - Origin:"PDA" - } - //缁勭洏 - sendData(IP + "/PdaAsn/BindPallet", param, 'post', function (res) { - if (res.code == 0) { //鎴愬姛 - layer.msg(res.msg, { - icon: 1, - time: 1000 //2绉掑叧闂紙濡傛灉涓嶉厤缃紝榛樿鏄�3绉掞級 - }, function () { - setOrderGoods(); - refreshTable(); - $("#BOXCODE").val(""); - $("#BOXCODE2").val(""); - $("#QTY").val(""); - }); - } else { //涓嶆垚鍔� - layer.msg(res.msg, { - icon: 2, - time: 2000 //2绉掑叧闂紙濡傛灉涓嶉厤缃紝榛樿鏄�3绉掞級 - }, function () { - //鍥炶皟 - }); - } - }); + AsnNo: $("#bar").val(), + PalletNo: $("#STOCKCODE").val(), + AsnDetailId: parseInt($("#goodSelect").val()), + BoxNo: $("#BOXCODE").val(), + IsContinue: isContinue, + TailBoxNo: $("#BOXCODE2").val(), + Origin:"PDA" + } + //缁勭洏 + sendData(IP + "/PdaAsn/BindPallet", param, 'post', function (res) { + if (res.code == 0) { //鎴愬姛 + layer.msg(res.msg, { + icon: 1, + time: 1000 //2绉掑叧闂紙濡傛灉涓嶉厤缃紝榛樿鏄�3绉掞級 + }, function () { + setOrderGoods(); + refreshTable(); + $("#BOXCODE").val(""); + $("#BOXCODE2").val(""); + $("#QTY").val(""); + }); + } else { //涓嶆垚鍔� + layer.msg(res.msg, { + icon: 2, + time: 2000 //2绉掑叧闂紙濡傛灉涓嶉厤缃紝榛樿鏄�3绉掞級 + }, function () { + //鍥炶皟 + }); + } + }); } else if(xianshiyemian == 1) { @@ -829,7 +838,7 @@ var asnDetails = ""; /* 缁戝畾鍏ュ簱鍗曠墿鏂欏強鎵规 */ - function updateGoodList() { + function updateGoodList(skuNo) { if (xianshiyemian == 0) { console.log("aaaa"); @@ -847,16 +856,21 @@ if (res.code == 0) { //鎴愬姛 asnDetails = res.data; for (var i = 0; i < res.data.length; i++) { - if (i == 0) { + if(skuNo!='' && skuNo==res.data[i].SkuNo){ $("#goodSelect").append('<option value =' + res.data[i].Id + ' selected>' + res.data[i] .SkuName + "-" + res.data[i].LotNo + '</option>'); - } else { - $("#goodSelect").append('<option value =' + res.data[i].Id + '>' + res.data[i] - .SkuName + "-" + res.data[i].LotNo + - '</option>'); - } - + }else{ + if (i == 0) { + $("#goodSelect").append('<option value =' + res.data[i].Id + ' selected>' + res.data[i] + .SkuName + "-" + res.data[i].LotNo + + '</option>'); + } else { + $("#goodSelect").append('<option value =' + res.data[i].Id + '>' + res.data[i] + .SkuName + "-" + res.data[i].LotNo + + '</option>'); + } + } } form.render('select'); @@ -917,7 +931,6 @@ function refreshTable() { if (xianshiyemian == 0) { - //鍏堟竻绌轰竴涓嬬瀛愬垪琛� let trs = $("#tableBoxList tr") let len = trs.length @@ -962,9 +975,9 @@ yes: function () { var param = { - Id: Id, + boxNo: res.data[i].BoxNo, }; - sendData(IP + "/PdaAsn/DelBoxInfo", param, 'post', function (res) { + sendData(IP + "/BllAsn/DelBindBoxInfo", param, 'get', function (res) { if (res.code == 0) { //鎴愬姛 layer.msg(res.msg, { icon: 1, @@ -987,18 +1000,15 @@ arrTrs[i] = tr } - //璁剧疆鍒嗛〉 - setPages(1, list.length) + } else { //涓嶆垚鍔� layer.msg("鏃犳暟鎹�", { icon: 2, time: 2000 //2绉掑叧闂紙濡傛灉涓嶉厤缃紝榛樿鏄�3绉掞級 }, function () { }); $("#boxNum").val(0) - setPages(1, 0) } }); - } else if (xianshiyemian == 1) { @@ -1017,7 +1027,7 @@ PalletNo: $.cookie('stockCode1') }; // 鏍规嵁鎵樼洏鍙疯幏鍙栫鐮佷俊鎭� - sendData(IP + "/PdaAsn/GetBoxInfos", param, 'post', function (res) { + sendData(IP + "/PdaAsn/GetPalletBindInfo", param, 'post', function (res) { if (res.code == 0) { //鎴愬姛 var list = res var arrTrs = new Array() @@ -1030,40 +1040,43 @@ tr.attr('BindNo', res.data[i].BindNo) idx++; tr.attr('index', idx) - tr.find("td[name='code']").html(res.data[i].BoxNo); + tr.find("td[name='code']").html(res.data[i].SkuNo); tr.find("td[name='name']").html(res.data[i].SkuName); tr.find("td[name='lotNo']").html(res.data[i].LotNo); tr.find("td[name='num']").html(res.data[i].Qty); tr.find("td[name='del']").click(function () { var elem = $(this).parent() - var boxno = elem.attr('boxno') + // var boxno = elem.attr('boxno') var BindNo = elem.attr('BindNo') + console.log(res) var Id = elem.attr('id') - layer.alert("纭畾瑕佷粠鎵樼洏涓婂垹闄よ繖鎵樼墿鏂欏悧锛�<br>" + boxno, { + layer.alert("纭畾瑕佷粠鎵樼洏涓婂垹闄よ繖鎵樼墿鏂欏悧锛�<br>" + res.data[0].PalletNo, { icon: 2, time: 0, //2绉掑叧闂紙濡傛灉涓嶉厤缃紝榛樿鏄�3绉掞級 btn: ['鍒犻櫎', '鍙栨秷'], yes: function () { var param = { - Id: Id, + PalletNo: res.data[0].PalletNo, }; - sendData(IP + "/PdaAsn/DelBoxInfo", param, 'post', function (res) { - if (res.code == 0) { //鎴愬姛 - layer.msg(res.msg, { - icon: 1, - time: 1000 //2绉掑叧闂紙濡傛灉涓嶉厤缃紝榛樿鏄�3绉掞級 - }); - elem.remove() - setOrderGoods(); - refreshTable(); - } else { //涓嶆垚鍔� - layer.msg(res.msg, { - icon: 2, - time: 2000 //2绉掑叧闂紙濡傛灉涓嶉厤缃紝榛樿鏄�3绉掞級 - }, function () { }); - } - }); + console.log(Id) + console.log(param) + // sendData(IP + "/PdaAsn/DelBoxInfo", param, 'post', function (res) { + // if (res.code == 0) { //鎴愬姛 + // layer.msg(res.msg, { + // icon: 1, + // time: 1000 //2绉掑叧闂紙濡傛灉涓嶉厤缃紝榛樿鏄�3绉掞級 + // }); + // elem.remove() + // setOrderGoods(); + // refreshTable(); + // } else { //涓嶆垚鍔� + // layer.msg(res.msg, { + // icon: 2, + // time: 2000 //2绉掑叧闂紙濡傛灉涓嶉厤缃紝榛樿鏄�3绉掞級 + // }, function () { }); + // } + // }); } }) }) @@ -1137,15 +1150,33 @@ var param = { "BoxNo": $("#BOXCODE").val(), } - sendData(IP + "/PdaAsn/GetBoxInfos", param, 'post', function (res) { + sendData(IP + "/PdaAsn/GetBindBoxInfos", param, 'post', function (res) { if (res.code == 0) { //鎴愬姛 - var bl = false; console.log(res.data); + var bl = false; if (res.data.length == 0) { layer.msg("鏈煡璇㈠埌姝ょ鐗╂枡淇℃伅锛岃鏍稿疄!", { icon: 2, time: 2000 //2绉掑叧闂紙濡傛灉涓嶉厤缃紝榛樿鏄�3绉掞級 }); return; + } + if(res.data[0].ASNNo!='' && res.data[0].ASNNo!=null){ + $("#bar").empty() + $("#bar").append('<option value =>' + '</option>'); + form.render('select'); + + $("#bar").append('<option value =' + res.data[0].ASNNo + ' selected>' + res.data[0].ASNNo +'</option>'); + + updateGoodList(res.data[0].SkuNo) + setOrderGoods(); + }else{ + if(asnDetails==''){ + layer.msg("璇峰厛閫夋嫨鍏ュ簱鍗曟嵁!", { + icon: 2, + time: 2000 //2绉掑叧闂紙濡傛灉涓嶉厤缃紝榛樿鏄�3绉掞級 + }); + return; + } } asnDetails.forEach(element => { console.log(element); @@ -1365,6 +1396,56 @@ } } + + function getBoxPageNum() + { + if (xianshiyemian == 0) + { + let num = $("#tableBoxList tr").length + if(num <= 2 ){ + return 0 + } + + let pageNum = Math.floor(num / 10); + if(num % 10 > 0){ + pageNum += 1; + } + + return pageNum + } + else if (xianshiyemian == 1) + { + let num = $("#tableBoxList1 tr").length + if(num <= 2 ){ + return 0 + } + + let pageNum = Math.floor(num / 10); + if(num % 10 > 0){ + pageNum += 1; + } + + return pageNum + } + + } + + function onClickPrevPage(){ + //console.log("涓婁竴椤垫寜閽鐐瑰嚮") + if(curPageIndex == 1){ + return + } + setCurPage(curPageIndex - 1) + } + + function onClickNextPage(){ + //console.log("涓嬩竴椤垫寜閽鐐瑰嚮") + let n = getBoxPageNum() + if(curPageIndex == n){ + return + } + setCurPage(curPageIndex + 1) + } /*鈥斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺��*/ -- Gitblit v1.8.0