From e3ef3289ab63c62dfa4f04e08addcdf8fca7dcba Mon Sep 17 00:00:00 2001 From: bklLiudl <673013083@qq.com> Date: 星期日, 18 二月 2024 16:17:38 +0800 Subject: [PATCH] 平库入库,地码文本框增加回车验证功能 --- Pda/View/AsnSetting/pingKuEnter.html | 1163 ++++++++++++++++++++++++++++++--------------------------- 1 files changed, 604 insertions(+), 559 deletions(-) diff --git a/Pda/View/AsnSetting/pingKuEnter.html b/Pda/View/AsnSetting/pingKuEnter.html index 03eaa90..9f3ec0a 100644 --- a/Pda/View/AsnSetting/pingKuEnter.html +++ b/Pda/View/AsnSetting/pingKuEnter.html @@ -1,589 +1,634 @@ <!DOCTYPE html> <html> - <head> - <meta name="viewport" content="user-scalable=0,width=device-width,initial-scale=1.0" /> - <meta charset="UTF-8" /> - <!-- <meta name="viewport" content="width=device-width, initial-scale=0.665, minimum-scale=0.5, maximum-scale=1, user-scalable=no" /> --> - <!-- <meta name="viewport" content="width=device-width, initial-scale=0.665" /> --> - <meta http-equiv="X-UA-Compatible" content="ie=edge" /> - <title>Boxline PDA</title> - <link rel="stylesheet" href="/layui/css/layui.css" /> - <link rel="stylesheet" href="/css/style.css" /> - <script src="/js/adaptive.js"></script> - <link rel="stylesheet" href="/css/my.css" /> - <style type="text/css"> - .layout-bill-info { - height: auto; - /* background-color: #009E94; */ - } - .btn-ok-blue { - border: none; - color: #FFFFFF; - background-color: #0a93e3; - width: 48%; - height: 36px; - border-radius: 5px; - } - .btn-ok-red { - border: none; - color: #FFFFFF; - background-color: #9f1707; - width: 48%; - height: 36px; - border-radius: 5px; - } - .btn-ok-blue:active { - opacity: 0.8; - } - .btn-ok-red:active { - opacity: 0.8; - } - .foot-container { - text-align: center; - /* background-color: #007DDB; */ - } - </style> - <link rel="stylesheet" href="/css/adapter.css" /> - </head> - <body> - <div id="" class="main-content"> - <div id="" class="layout-title"> - <table border="" cellspacing="" cellpadding=""> - <tr> - <td class="img-back"><a href="../index.html"><img src="/assets/back.jpg" ></a></td> - <td class="title-text" lang>骞冲簱鍏ュ簱</td> - <td class="title-menu-icon"><img id="menuImg" src="/assets/menu.jpg" ></td> - </tr> - </table> +<head> + <meta name="viewport" content="user-scalable=0,width=device-width,initial-scale=1.0" /> + <meta charset="UTF-8" /> + <!-- <meta name="viewport" content="width=device-width, initial-scale=0.665, minimum-scale=0.5, maximum-scale=1, user-scalable=no" /> --> + <!-- <meta name="viewport" content="width=device-width, initial-scale=0.665" /> --> + <meta http-equiv="X-UA-Compatible" content="ie=edge" /> + <title>Boxline PDA</title> + + <link rel="stylesheet" href="/layui/css/layui.css" /> + <link rel="stylesheet" href="/css/style.css" /> + <script src="/js/adaptive.js"></script> + <link rel="stylesheet" href="/css/my.css" /> + <style type="text/css"> + .layout-bill-info { + height: auto; + /* background-color: #009E94; */ + } + + .btn-ok-blue { + border: none; + color: #FFFFFF; + background-color: #0a93e3; + width: 48%; + height: 36px; + border-radius: 5px; + } + + .btn-ok-red { + border: none; + color: #FFFFFF; + background-color: #9f1707; + width: 48%; + height: 36px; + border-radius: 5px; + } + + .btn-ok-blue:active { + opacity: 0.8; + } + + .btn-ok-red:active { + opacity: 0.8; + } + + .foot-container { + text-align: center; + /* background-color: #007DDB; */ + } + </style> + <link rel="stylesheet" href="/css/adapter.css" /> +</head> + +<body> + <div id="" class="main-content"> + <div id="" class="layout-title"> + <table border="" cellspacing="" cellpadding=""> + <tr> + <td class="img-back"><a href="../index.html"><img src="/assets/back.jpg"></a></td> + <td class="title-text" lang>骞冲簱鍏ュ簱</td> + <td class="title-menu-icon"><img id="menuImg" src="/assets/menu.jpg"></td> + </tr> + </table> + </div> + <div id="" class="layout-sub-content"> + <div id="menuList" class="menu"> + <ul class="" style="text-align: center;"> + <li><a href="../index.html" lang>涓婚〉</a></li> + <!-- <li><a href="productEnterConfirm.html">鍏ュ簱淇℃伅纭</a></li> --> + <li><a href="../login.html" lang>閲嶆柊鐧诲綍</a></li> + </ul> </div> - <div id="" class="layout-sub-content" > - <div id="menuList" class="menu"> - <ul class="" style="text-align: center;"> - <li><a href="../index.html" lang>涓婚〉</a></li> - <!-- <li><a href="productEnterConfirm.html">鍏ュ簱淇℃伅纭</a></li> --> - <li><a href="../login.html" lang>閲嶆柊鐧诲綍</a></li> - </ul> - </div> - - <div id="" class="layout-bill-info"> - <form class="layui-form" action="" style="height: auto;"> - <div id="" class="layui-form-item layout-dropdownlist" > - <label class="layui-form-label" lang>鍏ュ簱鍗曪細</label> - <div class="layui-input-block" id="selectDiv"> - <select id="bar" lay-filter="getbar" lay-search> - <option value=""></option> - </select> - <img src="/assets/down_arraw.png" > - </div> + + <div id="" class="layout-bill-info"> + <form class="layui-form" action="" style="height: auto;"> + <div id="" class="layui-form-item layout-dropdownlist"> + <label class="layui-form-label" lang>鍏ュ簱鍗曪細</label> + <div class="layui-input-block" id="selectDiv"> + <select id="bar" lay-filter="getbar" lay-search> + <option value=""></option> + </select> + <img src="/assets/down_arraw.png"> </div> - <div id="" class="layui-form-item layout-input"> - <label class="layui-form-label" lang>鎵樼洏鏉$爜锛�</label> - <div class="layui-input-block"> - <input id="PalletNo" type="text" lay-verify="stock" lang langholder placeholder="璇锋壂鎻忔墭鐩樻潯鐮�" - autocomplete="off" class="layui-input"> - </div> - </div> - <div id="" class="layui-form-item layout-input"> - <label class="layui-form-label" lang>鍦扮爜锛�</label> - <div class="layui-input-block"> - <input id="LocatNo" type="text" lay-verify="stock" lang langholder placeholder="璇锋壂鎻忓湴鐮�" - autocomplete="off" class="layui-input"> - </div> - </div> - </form> - <div id="" style="text-align: center;"> - <button class="btn-ok-blue" type="button" lay-submit lay-filter="formBind">纭鍏ュ簱</button> </div> + <div id="" class="layui-form-item layout-input"> + <label class="layui-form-label" lang>鎵樼洏鏉$爜锛�</label> + <div class="layui-input-block"> + <input id="PalletNo" type="text" lay-verify="stock" lang langholder placeholder="璇锋壂鎻忔墭鐩樻潯鐮�" + autocomplete="off" class="layui-input"> + </div> + </div> + <div id="" class="layui-form-item layout-input"> + <label class="layui-form-label" lang>鍦扮爜锛�</label> + <div class="layui-input-block"> + <input id="LocatNo" type="text" lay-verify="stock" lang langholder placeholder="璇锋壂鎻忓湴鐮�" + autocomplete="off" class="layui-input"> + </div> + </div> + </form> + <div id="" style="text-align: center;"> + <button class="btn-ok-blue" type="button" lay-submit lay-filter="formBind">纭鍏ュ簱</button> </div> - - <div id="" class="cut-line" > - <img src="/assets/fengexian.png" > - </div> - - <div class="layout-tbl-paging" id="" > - <div id="" class="tbl-title"> - <table class="layout-tbl-input" border="0" cellspacing="" cellpadding="" > - <tr> - <td> - <!-- <div class="layout-boxinfo"> + </div> + + <div id="" class="cut-line"> + <img src="/assets/fengexian.png"> + </div> + + <div class="layout-tbl-paging" id=""> + <div id="" class="tbl-title"> + <table class="layout-tbl-input" border="0" cellspacing="" cellpadding=""> + <tr> + <td> + <!-- <div class="layout-boxinfo"> <label class="layui-form-label" lang style="width: 35%;">鎵樼洏鍙凤細</label> <div class="layui-input-block" style="width: 70%;"> <input id="PalletNo" type="text" disabled lay-verify="required" placeholder="" autocomplete="off" class="layui-input" style="margin-left: -35px;"> </div> </div> --> - </td> - <td> - <div class="layout-boxinfo"> - <label class="layui-form-label" style="color: #FF0000" lang>绠卞瓙鏁伴噺锛�</label> - <div class="layui-input-block"> - <input id="boxNum" type="text" disabled lay-verify="required" placeholder="" - autocomplete="off" class="layui-input"> - </div> + </td> + <td> + <div class="layout-boxinfo"> + <label class="layui-form-label" style="color: #FF0000" lang>绠卞瓙鏁伴噺锛�</label> + <div class="layui-input-block"> + <input id="boxNum" type="text" disabled lay-verify="required" placeholder="" + autocomplete="off" class="layui-input"> </div> - </td> - </tr> - </table> - </div> - <table id="tableBoxList" class="tbl-box-list" border="" cellspacing="" cellpadding=""> - <tr><th lang>绠辩爜</th><th lang>鍚嶇О</th><th lang>鏁伴噺</th></tr> - <tr id="boxCell" style="display: none"> - <td id="BoxNo" name="BoxNo">AG000001</td> - <td id="SkuName" name="SkuName">鐤嫍鍚嶇О鍚嶇О鍚嶇О</td> - <td id="Qty" name="Qty">30</td> - <!-- <td name="del"> + </div> + </td> + </tr> + </table> + </div> + <table id="tableBoxList" class="tbl-box-list" border="" cellspacing="" cellpadding=""> + <tr> + <th lang>绠辩爜</th> + <th lang>鍚嶇О</th> + <th lang>鏁伴噺</th> + </tr> + <tr id="boxCell" style="display: none"> + <td id="BoxNo" name="BoxNo">AG000001</td> + <td id="SkuName" name="SkuName">鐤嫍鍚嶇О鍚嶇О鍚嶇О</td> + <td id="Qty" name="Qty">30</td> + <!-- <td name="del"> <div id="" class="tbl-btn-del" lang> 鍒犻櫎 </div> </td> --> - </tr> - </table> - - <!-- 鍒嗛〉 --> - <table id="tableBoxPages" class="tbl-box-pages" border="" cellspacing="" cellpadding=""> - <tr > - <td class="page-prev" lang>涓婁竴椤�</td> - <td class="page-num page-num-select">1</td> - <td class="page-num">2</td> - <td class="page-num">3</td> - <td class="page-num">4</td> - <td class="page-num">5</td> - <td class="page-next" lang>涓嬩竴椤�</td> - </tr> - </table> - </div> - </div> + </tr> + </table> + + <!-- 鍒嗛〉 --> + <table id="tableBoxPages" class="tbl-box-pages" border="" cellspacing="" cellpadding=""> + <tr> + <td class="page-prev" lang>涓婁竴椤�</td> + <td class="page-num page-num-select">1</td> + <td class="page-num">2</td> + <td class="page-num">3</td> + <td class="page-num">4</td> + <td class="page-num">5</td> + <td class="page-next" lang>涓嬩竴椤�</td> + </tr> + </table> + </div> </div> - <script src="/js/jquery-3.5.1.min.js"></script> - <script src="/layui/layui.js"></script> - <script src="/js/public.js"></script> - <script src="/js/language.js"></script> - <script src="/js/jquery.cookie.js"></script> - <script> - layui.use(['form', 'jquery'], function() { - var form = layui.form - - initLanguage() - setLanguage() - - //褰撳墠鍒嗛〉 - var curPageIndex = 1 - var billList = null - var IsHuiKu=0 //鏄惁鍥炲簱锛�0:鍚� 1:鏄� + </div> + <script src="/js/jquery-3.5.1.min.js"></script> + <script src="/layui/layui.js"></script> + <script src="/js/public.js"></script> + <script src="/js/language.js"></script> + <script src="/js/jquery.cookie.js"></script> + <script> + layui.use(['form', 'jquery'], function () { + var form = layui.form - //鑾峰彇鍏ュ簱鍗� - function getBar(selectedvalue) { - if (selectedvalue) { - let item = getCurBillInfo(selectedvalue) - let str = item.ImportWarehouseId + "; " + item.WarehouseName + "; " - if(item.LanewayCode == ""){ - str += "" - }else{ - str += item.LanewayCode - str += ";" - } - if(item.LanewayName == null || $.isPlainObject(item.LanewayName)){ - str += "" - }else{ - str += item.LanewayName - } - $('#whName').val(str) + initLanguage() + setLanguage() + + //褰撳墠鍒嗛〉 + var curPageIndex = 1 + var billList = null + var IsHuiKu = 0 //鏄惁鍥炲簱锛�0:鍚� 1:鏄� + // + //鑾峰彇鍏ュ簱鍗� + function getBar(selectedvalue) { + if (selectedvalue) { + let item = getCurBillInfo(selectedvalue) + let str = item.ImportWarehouseId + "; " + item.WarehouseName + "; " + if (item.LanewayCode == "") { + str += "" } else { - $('#whName').val('') + str += item.LanewayCode + str += ";" } + if (item.LanewayName == null || $.isPlainObject(item.LanewayName)) { + str += "" + } else { + str += item.LanewayName + } + $('#whName').val(str) + } else { + $('#whName').val('') } - - //鑾峰彇褰撳墠鎵�閫夊叆搴撳崟鐨勪俊鎭� - function getCurBillInfo(billcode){ - for(var i in billList){ - if(billList[i].ImportBillCode == billcode){ - return billList[i] - } - } - - return null - } + } - $("#selectDiv").click(function(){ - var input = $('select[id="bar"]').next().find('.layui-select-title input') - var val = input.val() - //鍏堟洿鏂颁竴涓嬪叆搴撳崟 - updateBillList(function(data){ - $('select[id="bar"]').next().addClass('layui-form-selected') - - $('select[id="bar"]').next().find('.layui-select-title input').val(val) - }) - }) - - //鏇存柊鍏ュ簱鍗� - function updateBillList(callback){ - var input = $('select[id="bar"]').next().find('.layui-select-title input') - var val = input.val() - $("#bar").empty() - $("#bar").append('<option value =>' + '</option>'); - form.render('select'); - - var param = { - Type: '0,1,2,3', - }; - sendData(IP + "/PdaAsn/GetArrivalNotices", param, 'post', function(res) { - if (res.code == 0) { //鎴愬姛 - billList = deepCopy(res.data) - console.log(billList) - for (var i = 0; i < billList.length; i++) { - $("#bar").append('<option value =' + billList[i].ASNNo + '>' + billList[i] - .ASNNo + - '</option>'); - } - form.render('select'); - - if(!val){ - $('#bar').siblings("div.layui-form-select").find('dl').find('.layui-select-tips').addClass('layui-this') - }else{ - var sel = 'dd[lay-value=' + val + ']'; - $('#bar').siblings("div.layui-form-select").find('dl').find(sel).addClass('layui-this') - } - - callback(billList) - } else { //涓嶆垚鍔� - // billList = null - // layer.msg(res.msg, { - // icon: 2, - // time: 2000 //2绉掑叧闂紙濡傛灉涓嶉厤缃紝榛樿鏄�3绉掞級 - // }, function() {}); - } - }); - } - //褰撴墭鐩樻潯鐮佽緭鍏ユ澶卞幓鐒︾偣鏃�,妫�鏌ヤ竴涓嬫墭鐩樼姸鎬� - $("#PalletNo").blur(function(){ - checkPalletStat() - }) - $("#PalletNo").keydown(function(e) { - if (e.keyCode === 13) { - //妫�鏌ユ墭鐩樼姸鎬� - checkPalletStat(); - } - }); - //妫�鏌ユ墭鐩樼姸鎬� - function checkPalletStat(){ - if($("#PalletNo").val() == ""){ - return - } - IsHuiKu=0 - var param1 = { - "PalletNo": $("#PalletNo").val() - } - //鑾峰彇鎵樼洏绠$悊鐨勫叆搴撳崟 - sendData(IP + "/PdaAsn/GetASNNoByPalletNo", param1, 'post', function(res) { - if (res.code == 0) { //鎴愬姛 - $("#bar").append('<option value =' + res.data + '>' + res.data +'</option>'); - $("#bar").find("option[value='"+res.data+"']").prop("selected",true); - form.render(); - if(res.data==''){ - IsHuiKu=1 - } - var param = { - "PalletNo": $("#PalletNo").val() - } - //妫�鏌ユ墭鐩樼姸鎬� - sendData(IP + "/PdaAsn/IsEnablePalletNo", param, 'post', function(res) { - if (res.code == 0) { //鎴愬姛 - $.cookie('PalletNo', $("#PalletNo").val()); - refreshTable() - } else { //涓嶆垚鍔� - layer.msg(res.msg, { - icon: 2, - time: 2000 //2绉掑叧闂紙濡傛灉涓嶉厤缃紝榛樿鏄�3绉掞級 - }, function() {}); - } - }); - } else { //涓嶆垚鍔� - layer.msg(res.msg, { - icon: 2, - time: 2000 //2绉掑叧闂紙濡傛灉涓嶉厤缃紝榛樿鏄�3绉掞級 - }, function() { - //鍏堟竻绌轰竴涓嬬瀛愬垪琛� - let trs = $("#tableBoxList tr") - let len = trs.length - for(i=len - 1; i >=2; i--){ - trs[i].remove(); - } - }); - return - } - }); - } - //娓叉煋鍒楄〃 - function refreshTable() { - //鍏堟竻绌轰竴涓嬬瀛愬垪琛� - let trs = $("#tableBoxList tr") - let len = trs.length - for(i=len - 1; i >=2; i--){ - trs[i].remove(); - } - //璁剧疆鎵樼洏鍙� - $("#PalletNo").val($.cookie('PalletNo')) - - var param = { - // PalletNo: $.cookie('PalletNo') - PalletNo: $.cookie('PalletNo'), - IsHuiKu : IsHuiKu - }; - sendData(IP + "/PdaAsn/GetBoxInfos", param, 'post', function(res) { - console.log(res) - if (res.code == 0) { //鎴愬姛 - console.log(res) - $("#boxNum").val(res.data.length) - var list = res.data - var arrTrs = new Array() - let idx = 0 - for(var i in list) { - // list[i].BoxNo - var tr = $("#boxCell").eq(0).clone(); - tr.appendTo("#tableBoxList"); - tr.attr('id', list[i].BoxNo) - idx++; - tr.attr('index', idx) - tr.find("td[name='BoxNo']").html(list[i].BoxNo); - tr.find("td[name='SkuName']").html(list[i].SkuName); - tr.find("td[name='Qty']").html(list[i].Qty); - var code = list[i].BoxNo - //console.log("code is "+code) - - // //console.log("BoxNo is "+tr.find("td[name='BoxNo']").html()) - tr.show(); - arrTrs[i] = tr - } - - //璁剧疆鍒嗛〉 - setPages(1, list.length) - } else { //涓嶆垚鍔� - layer.msg("鏃犳暟鎹�", { - icon: 2, - time: 2000 //2绉掑叧闂紙濡傛灉涓嶉厤缃紝榛樿鏄�3绉掞級 - }, function() {}); - $("#boxNum").val(0) - setPages(1, 0) - } - }); - } - //纭鍏ュ簱 - form.on('submit(formBind)', function(data) { - // if (!$.cookie('userId')) { - // layer.msg('鐧婚檰澶辨晥锛岃閲嶆柊鐧婚檰', { - // icon: 2, - // time: 2000 //2绉掑叧闂紙濡傛灉涓嶉厤缃紝榛樿鏄�3绉掞級 - // }, function() { - // location.href = "login.html"; - // //鍥炶皟 - // }); - // } - let bval = $('select[id="bar"]').next().find('.layui-select-title input').val() - if (!bval && IsHuiKu==0) { - layer.msg('璇烽�夋嫨鍏ュ簱鍗�', { - icon: 2, - time: 2000 //2绉掑叧闂紙濡傛灉涓嶉厤缃紝榛樿鏄�3绉掞級 - }); - return; - } - if (!$("#PalletNo").val()) { - layer.msg('璇锋壂鎻忔墭鐩樻潯鐮�', { - icon: 2, - time: 2000 //2绉掑叧闂紙濡傛灉涓嶉厤缃紝榛樿鏄�3绉掞級 - }); - return; - } - if (!$("#LocatNo").val()) { - layer.msg('璇锋壂鎻忓湴鐮�', { - icon: 2, - time: 2000 //2绉掑叧闂紙濡傛灉涓嶉厤缃紝榛樿鏄�3绉掞級 - }); - return; - } - - let item = getCurBillInfo(bval) - var param = { - PalletNo:$("#PalletNo").val(), - LocatNo:$("#LocatNo").val(), - ASNNo:$("#bar").val() - } - param.Qty=Number(param.Qty) - sendData(IP + "/PdaAsn/ConfirmInStock", param, 'post', function(res) { - if (res.code == 0) { //鎴愬姛 - layer.msg(res.msg, { - icon: 1, - time: 2500 //2绉掑叧闂紙濡傛灉涓嶉厤缃紝榛樿鏄�3绉掞級 - }, function() { - clearTable() - $("#PalletNo").val('') - }); - } else { //涓嶆垚鍔� - layer.msg(res.msg, { - icon: 2, - time: 2000 //2绉掑叧闂紙濡傛灉涓嶉厤缃紝榛樿鏄�3绉掞級 - }, function() { - //鍥炶皟 - }); - } - }); - return false; //闃绘琛ㄥ崟璺宠浆銆傚鏋滈渶瑕佽〃鍗曡烦杞紝鍘绘帀杩欐鍗冲彲銆� - }); - function clearTable(){ - $("#PalletNo").val('') - $("#boxNum").val('') - let trs = $("#tableBoxList tr") - let len = trs.length - for(i=len - 1; i >=2; i--){ - trs[i].remove(); + //鑾峰彇褰撳墠鎵�閫夊叆搴撳崟鐨勪俊鎭� + function getCurBillInfo(billcode) { + for (var i in billList) { + if (billList[i].ImportBillCode == billcode) { + return billList[i] } } - form.verify({ - stock: [/^[\S]{8}$/, '鎵樼洏鏉$爜蹇呴』涓哄叚浣嶅瓧绗�'] - }); + return null + } - 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) - } - - function getBoxPageNum() - { - let num = $("#tableBoxList tr").length - if(num <= 2 ){ - return 0 - } - - let pageNum = Math.floor(num / 10); - if(num % 10 > 0){ - pageNum += 1; - } - - return pageNum - } - - //璁剧疆鍒嗛〉 - function setPages(pageIndex, boxNum){ - if(boxNum <= 0){ - //鍒楄〃涓虹┖锛岄殣钘忓垎椤甸〉鐮� - $("#tableBoxPages").hide() - return - } - - let pageNum = Math.floor(boxNum / 10); - if(boxNum % 10 > 0){ - pageNum += 1; - } - //console.log("pageNum is " + pageNum) - - $("#tableBoxPages").find("tr").remove() - let table = $("#tableBoxPages") - $("<tr></tr>").appendTo("#tableBoxPages") - - // let newTr = table.append("<tr></tr>") - // newTr.append("<td class='page-prev'>涓婁竴椤�</td>") - $("<td id='prevPage' class='page-prev'>涓婁竴椤�</td>").appendTo("#tableBoxPages tr") - $("#tableBoxPages tr").eq(0).find("td[id^='prevPage']").click(function(){ - onClickPrevPage() - }) - for(i=1; i < pageNum + 1; i++){ - // newTr.append("<td class='page-num'>"+ i +"</td>") - $("<td class='page-num'>"+ i +"</td>").appendTo("#tableBoxPages tr") - } - // newTr.append("<td class='page-next'>涓嬩竴椤�</td>") - $("<td id='nextPage' class='page-next'>涓嬩竴椤�</td>").appendTo("#tableBoxPages tr") - $("#tableBoxPages tr").eq(0).find("td[id^='nextPage']").click(function(){ - onClickNextPage() - }) - // pages.show() - $("#tableBoxPages").show() - - setCurPage(1) - } - - //璁剧疆褰撳墠鍒嗛〉 - function setCurPage(pageIndex){ - let totalTrNum = $("#tableBoxList tr").length - if(totalTrNum <= 2 ){ - //console.log("tableBoxList 涓虹┖ totalTrNum: " + totalTrNum) - //curPageIndex = 1 - return - } - - let pageNum = getBoxPageNum() - if(pageIndex > pageNum){ - //console.log("璁剧疆鐨勯〉鐮佽秴鍑洪〉鏁�, pageIndex : " + pageIndex) - //curPageIndex = 1 - return - } - - let startIndex = (pageIndex - 1) * 10 + 1 - let n = totalTrNum - startIndex - let endIndex = 0 - if(n > 9){ - endIndex = startIndex + 9 - }else{ - endIndex = startIndex + n - } - //console.log("startIndex is "+startIndex) - //console.log("endIndex is "+endIndex) - //startIndex =2 - //endIndex = 2 - let trs = $("#tableBoxList tr") - //console.log("琛屾暟 "+trs.length) - let d = 0 - for(let i = 2; i < trs.length; i++){ - //console.log("琛岀储寮� " + trs.eq(i).attr('index')) - let t = trs.eq(i) - d = t.attr('index') - if(d >= startIndex && d <= endIndex){ - //console.log("闇�瑕佹樉绀�") - //鏄剧ず琛� - t.show() - }else{ - //闅愯棌琛� - t.hide() - } - } - - curPageIndex = pageIndex - - let ptr = $("#tableBoxPages tr") - for(let i = 1; i < pageNum+1; i++){ - ptr.eq(0).find("td").eq(i).removeClass("page-num-select") - if(i == curPageIndex){ - ptr.eq(0).find("td").eq(i).addClass("page-num-select") - } - } - //console.log("totalTrNum is " + totalTrNum) - } - $("#menuImg").click(function(e){ - e.stopPropagation() - - if($("#menuList").is(":hidden")){ - $("#menuList").show() - }else{ - $("#menuList").hide() - } - }) - $('body').click(function(){ - // //console.log("body") - $("#menuList").hide() + $("#selectDiv").click(function () { + var input = $('select[id="bar"]').next().find('.layui-select-title input') + var val = input.val() + //鍏堟洿鏂颁竴涓嬪叆搴撳崟 + updateBillList(function (data) { + $('select[id="bar"]').next().addClass('layui-form-selected') + + $('select[id="bar"]').next().find('.layui-select-title input').val(val) }) }) - </script> - </body> -</html> + + //鏇存柊鍏ュ簱鍗� + function updateBillList(callback) { + var input = $('select[id="bar"]').next().find('.layui-select-title input') + var val = input.val() + $("#bar").empty() + $("#bar").append('<option value =>' + '</option>'); + form.render('select'); + + var param = { + Type: '0,1,2,3', + }; + sendData(IP + "/PdaAsn/GetArrivalNotices", param, 'post', function (res) { + if (res.code == 0) { //鎴愬姛 + billList = deepCopy(res.data) + console.log(billList) + for (var i = 0; i < billList.length; i++) { + $("#bar").append('<option value =' + billList[i].ASNNo + '>' + billList[i] + .ASNNo + + '</option>'); + } + form.render('select'); + + if (!val) { + $('#bar').siblings("div.layui-form-select").find('dl').find('.layui-select-tips').addClass('layui-this') + } else { + var sel = 'dd[lay-value=' + val + ']'; + $('#bar').siblings("div.layui-form-select").find('dl').find(sel).addClass('layui-this') + } + + callback(billList) + } else { //涓嶆垚鍔� + // billList = null + // layer.msg(res.msg, { + // icon: 2, + // time: 2000 //2绉掑叧闂紙濡傛灉涓嶉厤缃紝榛樿鏄�3绉掞級 + // }, function() {}); + } + }); + } + //褰撴墭鐩樻潯鐮佽緭鍏ユ澶卞幓鐒︾偣鏃�,妫�鏌ヤ竴涓嬫墭鐩樼姸鎬� + $("#PalletNo").blur(function () { + checkPalletStat() + }) + $("#PalletNo").keydown(function (e) { + if (e.keyCode === 13) { + //妫�鏌ユ墭鐩樼姸鎬� + checkPalletStat(); + } + }); + //妫�鏌ユ墭鐩樼姸鎬� + function checkPalletStat() { + if ($("#PalletNo").val() == "") { + return + } + IsHuiKu = 0 + var param1 = { + "PalletNo": $("#PalletNo").val() + } + //鑾峰彇鎵樼洏绠$悊鐨勫叆搴撳崟 + sendData(IP + "/PdaAsn/GetASNNoByPalletNo", param1, 'post', function (res) { + if (res.code == 0) { //鎴愬姛 + $("#bar").append('<option value =' + res.data + '>' + res.data + '</option>'); + $("#bar").find("option[value='" + res.data + "']").prop("selected", true); + form.render(); + if (res.data == '') { + IsHuiKu = 1 + } + var param = { + "PalletNo": $("#PalletNo").val() + } + //妫�鏌ユ墭鐩樼姸鎬� + sendData(IP + "/PdaAsn/IsEnablePalletNo", param, 'post', function (res) { + if (res.code == 0) { //鎴愬姛 + $.cookie('PalletNo', $("#PalletNo").val()); + refreshTable() + } else { //涓嶆垚鍔� + layer.msg(res.msg, { + icon: 2, + time: 2000 //2绉掑叧闂紙濡傛灉涓嶉厤缃紝榛樿鏄�3绉掞級 + }, function () { }); + } + }); + } else { //涓嶆垚鍔� + layer.msg(res.msg, { + icon: 2, + time: 2000 //2绉掑叧闂紙濡傛灉涓嶉厤缃紝榛樿鏄�3绉掞級 + }, function () { + //鍏堟竻绌轰竴涓嬬瀛愬垪琛� + let trs = $("#tableBoxList tr") + let len = trs.length + for (i = len - 1; i >= 2; i--) { + trs[i].remove(); + } + }); + return + } + }); + } + + // 鍌ㄤ綅淇℃伅(鍦扮爜)澶卞幓鐒︾偣鍚庤Е鍙戦獙璇� + $("#LocatNo").blur(function () { + CheckLocatNo() + }) + // 鍌ㄤ綅淇℃伅(鍦扮爜)鐐瑰嚮鍥炶溅鍚庤Е鍙戦獙璇� + $("#LocatNo").keydown(function (e) { + if (e.keyCode === 13) { + CheckLocatNo(); + } + }); + // 楠岃瘉鍌ㄤ綅淇℃伅(鍦扮爜)鏄惁鍙敤 + function CheckLocatNo() { + if ($("#LocatNo").val() == "") { + return + } + var param1 = { + "LocatNo": $("#LocatNo").val() + } + //鑾峰彇鎵樼洏绠$悊鐨勫叆搴撳崟 + sendData(IP + "/PdaAsn/CheckLocatNo", param1, 'post', function (res) { + if (res.code != 0) { //鎴愬姛 + layer.msg(res.msg, { + icon: 0, + time: 2000 //2绉掑叧闂紙濡傛灉涓嶉厤缃紝榛樿鏄�3绉掞級 + }); + + // 娓呯┖鍦扮爜淇℃伅銆傛殏瀹氭竻绌鸿緭鍏ユ淇℃伅 + $("#LocatNo").val(''); + return + } + }); + } + + //娓叉煋鍒楄〃 + function refreshTable() { + //鍏堟竻绌轰竴涓嬬瀛愬垪琛� + let trs = $("#tableBoxList tr") + let len = trs.length + for (i = len - 1; i >= 2; i--) { + trs[i].remove(); + } + //璁剧疆鎵樼洏鍙� + $("#PalletNo").val($.cookie('PalletNo')) + + var param = { + // PalletNo: $.cookie('PalletNo') + PalletNo: $.cookie('PalletNo'), + IsHuiKu: IsHuiKu + }; + sendData(IP + "/PdaAsn/GetBoxInfos", param, 'post', function (res) { + console.log(res) + if (res.code == 0) { //鎴愬姛 + console.log(res) + $("#boxNum").val(res.data.length) + var list = res.data + var arrTrs = new Array() + let idx = 0 + for (var i in list) { + // list[i].BoxNo + var tr = $("#boxCell").eq(0).clone(); + tr.appendTo("#tableBoxList"); + tr.attr('id', list[i].BoxNo) + idx++; + tr.attr('index', idx) + tr.find("td[name='BoxNo']").html(list[i].BoxNo); + tr.find("td[name='SkuName']").html(list[i].SkuName); + tr.find("td[name='Qty']").html(list[i].Qty); + var code = list[i].BoxNo + //console.log("code is "+code) + + // //console.log("BoxNo is "+tr.find("td[name='BoxNo']").html()) + tr.show(); + arrTrs[i] = tr + } + + //璁剧疆鍒嗛〉 + setPages(1, list.length) + } else { //涓嶆垚鍔� + layer.msg("鏃犳暟鎹�", { + icon: 2, + time: 2000 //2绉掑叧闂紙濡傛灉涓嶉厤缃紝榛樿鏄�3绉掞級 + }, function () { }); + $("#boxNum").val(0) + setPages(1, 0) + } + }); + } + //纭鍏ュ簱 + form.on('submit(formBind)', function (data) { + // if (!$.cookie('userId')) { + // layer.msg('鐧婚檰澶辨晥锛岃閲嶆柊鐧婚檰', { + // icon: 2, + // time: 2000 //2绉掑叧闂紙濡傛灉涓嶉厤缃紝榛樿鏄�3绉掞級 + // }, function() { + // location.href = "login.html"; + // //鍥炶皟 + // }); + // } + let bval = $('select[id="bar"]').next().find('.layui-select-title input').val() + if (!bval && IsHuiKu == 0) { + layer.msg('璇烽�夋嫨鍏ュ簱鍗�', { + icon: 2, + time: 2000 //2绉掑叧闂紙濡傛灉涓嶉厤缃紝榛樿鏄�3绉掞級 + }); + return; + } + if (!$("#PalletNo").val()) { + layer.msg('璇锋壂鎻忔墭鐩樻潯鐮�', { + icon: 2, + time: 2000 //2绉掑叧闂紙濡傛灉涓嶉厤缃紝榛樿鏄�3绉掞級 + }); + return; + } + if (!$("#LocatNo").val()) { + layer.msg('璇锋壂鎻忓湴鐮�', { + icon: 2, + time: 2000 //2绉掑叧闂紙濡傛灉涓嶉厤缃紝榛樿鏄�3绉掞級 + }); + return; + } + + let item = getCurBillInfo(bval) + var param = { + PalletNo: $("#PalletNo").val(), + LocatNo: $("#LocatNo").val(), + ASNNo: $("#bar").val() + } + param.Qty = Number(param.Qty) + sendData(IP + "/PdaAsn/ConfirmInStock", param, 'post', function (res) { + if (res.code == 0) { //鎴愬姛 + layer.msg(res.msg, { + icon: 1, + time: 2500 //2绉掑叧闂紙濡傛灉涓嶉厤缃紝榛樿鏄�3绉掞級 + }, function () { + clearTable() + $("#PalletNo").val('') + }); + } else { //涓嶆垚鍔� + layer.msg(res.msg, { + icon: 2, + time: 2000 //2绉掑叧闂紙濡傛灉涓嶉厤缃紝榛樿鏄�3绉掞級 + }, function () { + //鍥炶皟 + }); + } + }); + return false; //闃绘琛ㄥ崟璺宠浆銆傚鏋滈渶瑕佽〃鍗曡烦杞紝鍘绘帀杩欐鍗冲彲銆� + }); + function clearTable() { + $("#PalletNo").val('') + $("#boxNum").val('') + let trs = $("#tableBoxList tr") + let len = trs.length + for (i = len - 1; i >= 2; i--) { + trs[i].remove(); + } + } + + form.verify({ + stock: [/^[\S]{8}$/, '鎵樼洏鏉$爜蹇呴』涓哄叚浣嶅瓧绗�'] + }); + + 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) + } + + function getBoxPageNum() { + let num = $("#tableBoxList tr").length + if (num <= 2) { + return 0 + } + + let pageNum = Math.floor(num / 10); + if (num % 10 > 0) { + pageNum += 1; + } + + return pageNum + } + + //璁剧疆鍒嗛〉 + function setPages(pageIndex, boxNum) { + if (boxNum <= 0) { + //鍒楄〃涓虹┖锛岄殣钘忓垎椤甸〉鐮� + $("#tableBoxPages").hide() + return + } + + let pageNum = Math.floor(boxNum / 10); + if (boxNum % 10 > 0) { + pageNum += 1; + } + //console.log("pageNum is " + pageNum) + + $("#tableBoxPages").find("tr").remove() + let table = $("#tableBoxPages") + $("<tr></tr>").appendTo("#tableBoxPages") + + // let newTr = table.append("<tr></tr>") + // newTr.append("<td class='page-prev'>涓婁竴椤�</td>") + $("<td id='prevPage' class='page-prev'>涓婁竴椤�</td>").appendTo("#tableBoxPages tr") + $("#tableBoxPages tr").eq(0).find("td[id^='prevPage']").click(function () { + onClickPrevPage() + }) + for (i = 1; i < pageNum + 1; i++) { + // newTr.append("<td class='page-num'>"+ i +"</td>") + $("<td class='page-num'>" + i + "</td>").appendTo("#tableBoxPages tr") + } + // newTr.append("<td class='page-next'>涓嬩竴椤�</td>") + $("<td id='nextPage' class='page-next'>涓嬩竴椤�</td>").appendTo("#tableBoxPages tr") + $("#tableBoxPages tr").eq(0).find("td[id^='nextPage']").click(function () { + onClickNextPage() + }) + // pages.show() + $("#tableBoxPages").show() + + setCurPage(1) + } + + //璁剧疆褰撳墠鍒嗛〉 + function setCurPage(pageIndex) { + let totalTrNum = $("#tableBoxList tr").length + if (totalTrNum <= 2) { + //console.log("tableBoxList 涓虹┖ totalTrNum: " + totalTrNum) + //curPageIndex = 1 + return + } + + let pageNum = getBoxPageNum() + if (pageIndex > pageNum) { + //console.log("璁剧疆鐨勯〉鐮佽秴鍑洪〉鏁�, pageIndex : " + pageIndex) + //curPageIndex = 1 + return + } + + let startIndex = (pageIndex - 1) * 10 + 1 + let n = totalTrNum - startIndex + let endIndex = 0 + if (n > 9) { + endIndex = startIndex + 9 + } else { + endIndex = startIndex + n + } + //console.log("startIndex is "+startIndex) + //console.log("endIndex is "+endIndex) + //startIndex =2 + //endIndex = 2 + let trs = $("#tableBoxList tr") + //console.log("琛屾暟 "+trs.length) + let d = 0 + for (let i = 2; i < trs.length; i++) { + //console.log("琛岀储寮� " + trs.eq(i).attr('index')) + let t = trs.eq(i) + d = t.attr('index') + if (d >= startIndex && d <= endIndex) { + //console.log("闇�瑕佹樉绀�") + //鏄剧ず琛� + t.show() + } else { + //闅愯棌琛� + t.hide() + } + } + + curPageIndex = pageIndex + + let ptr = $("#tableBoxPages tr") + for (let i = 1; i < pageNum + 1; i++) { + ptr.eq(0).find("td").eq(i).removeClass("page-num-select") + if (i == curPageIndex) { + ptr.eq(0).find("td").eq(i).addClass("page-num-select") + } + } + //console.log("totalTrNum is " + totalTrNum) + } + $("#menuImg").click(function (e) { + e.stopPropagation() + + if ($("#menuList").is(":hidden")) { + $("#menuList").show() + } else { + $("#menuList").hide() + } + }) + $('body').click(function () { + // //console.log("body") + $("#menuList").hide() + }) + }) + </script> +</body> + +</html> \ No newline at end of file -- Gitblit v1.8.0