From 5463ba0273559a724e181acd4ac54c1eee01aad1 Mon Sep 17 00:00:00 2001 From: luxiaotao1123 <t1341870251@163.com> Date: 星期三, 24 二月 2021 14:25:35 +0800 Subject: [PATCH] # --- src/main/java/zy/cloud/wms/manager/controller/MatController.java | 6 src/main/webapp/views/pda/combPro.html | 341 +++++++++ src/main/webapp/views/pda/index.html | 94 ++ src/main/webapp/views/pda/stockIn.html | 325 +++++++++ src/main/webapp/views/pda/stockInPro.html | 235 ++++++ src/main/java/zy/cloud/wms/common/web/RouterController.java | 7 src/main/webapp/static/css/pda.css | 97 ++ src/main/webapp/views/pda/stockOut.html | 288 ++++++++ src/main/webapp/views/pda/comb.html | 185 +++++ src/main/webapp/views/pda/login.html | 151 ++++ src/main/webapp/views/pda/locDetlIframe.html | 136 +++ src/main/webapp/views/pda/matQuery.html | 185 +++++ 12 files changed, 2,047 insertions(+), 3 deletions(-) diff --git a/src/main/java/zy/cloud/wms/common/web/RouterController.java b/src/main/java/zy/cloud/wms/common/web/RouterController.java index b345e87..cee3dda 100644 --- a/src/main/java/zy/cloud/wms/common/web/RouterController.java +++ b/src/main/java/zy/cloud/wms/common/web/RouterController.java @@ -33,13 +33,14 @@ } } - @RequestMapping("/visit") - public void visit(HttpServletResponse response) { + @RequestMapping("/pda") + public void pda(HttpServletResponse response) { try{ - response.sendRedirect(contextPath+"/views/visit/index.html"); + response.sendRedirect(contextPath+"/views/pda/login.html"); } catch (Exception ex){ ex.printStackTrace(); } } + } diff --git a/src/main/java/zy/cloud/wms/manager/controller/MatController.java b/src/main/java/zy/cloud/wms/manager/controller/MatController.java index 5c6f7d8..f0827b3 100644 --- a/src/main/java/zy/cloud/wms/manager/controller/MatController.java +++ b/src/main/java/zy/cloud/wms/manager/controller/MatController.java @@ -33,6 +33,12 @@ return R.ok(matService.selectById(String.valueOf(id))); } + @RequestMapping(value = "/matCode/auth") + @ManagerAuth + public R find(@RequestParam("matnr") String matnr) { + return R.ok(matService.selectOne(new EntityWrapper<Mat>().eq("matnr", matnr))); + } + @RequestMapping(value = "/mat/list/auth") @ManagerAuth public R list(@RequestParam(defaultValue = "1")Integer curr, diff --git a/src/main/webapp/static/css/pda.css b/src/main/webapp/static/css/pda.css new file mode 100644 index 0000000..1a49cbf --- /dev/null +++ b/src/main/webapp/static/css/pda.css @@ -0,0 +1,97 @@ +* { + font-family: microsoft yahei,serif; + margin: 0; + padding: 0; + box-sizing: border-box; + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + font-size: 16px; +} +html { + height: 100%; + background-color: #f1f1f1; + padding: 5px; +} +body { + height: 100%; + background-color: #fff; + border-radius: 5px; + box-shadow: 0 0 3px rgba(0,0,0,.3); + padding: 5px; + position: relative; +} + +/* 澶撮儴 */ +header { + padding: 5px 0; +} +.layui-form-label { + width: initial; + padding: 6px 10px; + line-height: 30px; +} +#code { + width: 70%; + height: 40px; +} +header button { + height: 20px; + width: 70px; +} +#mat-btn:focus { +} + +/* layer */ +.layui-layer-title { + font-size: 11px; + height: 20px; + line-height: 20px; +} + +/* 涓讳綋 */ +main { + height: 235px; + overflow: auto; +} +.layui-table, .layui-table-view { + margin: 0; +} +.layui-table-view .layui-table td, .layui-table-view .layui-table th { + padding: 0; +} +.layui-table-cell { + height: 32px; + line-height: 32px; + padding: 0; +} +.layui-table-grid-down { + display: none; +} +.layui-table-body .layui-none { + /*height: 144px;*/ +} +/* 灏鹃儴 */ +footer { + margin-top: 20px; + width: 100%; +} +.layui-btn-container .layui-btn { + margin-left: 10px; + margin-bottom: 2px; +} +#tips { + display: inline-block; + width: 90px; + color: #666; + margin-left: 5px; + margin-bottom: 5px; + vertical-align: middle; + overflow:hidden; + white-space:nowrap; + text-overflow:ellipsis; + font-size: 12px; +} + +.layui-btn-primary:hover { + border-color: #C9C9C9 +} \ No newline at end of file diff --git a/src/main/webapp/views/pda/comb.html b/src/main/webapp/views/pda/comb.html new file mode 100644 index 0000000..f83699a --- /dev/null +++ b/src/main/webapp/views/pda/comb.html @@ -0,0 +1,185 @@ +<!DOCTYPE html> +<html lang="en"> +<head> + <meta charset="UTF-8"> + <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no"/> + <title>缁勬墭</title> + <link rel="stylesheet" href="../../static/layui/css/layui.css" media="all"> + <link rel="stylesheet" href="../../static/css/pda.css" media="all"> + <script type="text/javascript" src="../../static/js/jquery/jquery-3.3.1.min.js"></script> + <script type="text/javascript" src="../../static/layui/layui.js" charset="utf-8"></script> + <script type="text/javascript" src="../../static/js/common.js" charset="utf-8"></script> + <script type="text/javascript" src="../../static/js/cool.js" charset="utf-8"></script> + <script type="text/javascript" src="../../static/js/handlebars/handlebars-v4.5.3.js"></script> + <style> + + </style> +</head> +<body> +<!-- 澶撮儴 --> +<header> + <div class="layui-input-inline"> + <label class="layui-form-label">鎵樼洏鐮�</label> + <input class="layui-input" type="text" id="code" onkeyup="findCode(this)" oninput="if(value.length>8)value=value.slice(0,8)" placeholder="鎵爜 / 杈撳叆" autocomplete="off"> + </div> + <div style="margin: 5px 5px"> + <button id="mat-btn" type="button" class="layui-btn layui-btn-normal" onclick="getMat()"><i class="layui-icon">+</i>鎻愬彇</button> + </div> +</header> + +<!-- 涓讳綋 --> +<main> + <table class="layui-table" id="chooseData" lay-filter="chooseData"></table> +</main> +<!-- 灏鹃儴 --> +<footer> + <div class="layui-btn-container"> + <button type="button" id="reset-btn" class="layui-btn layui-btn-primary" onclick="reset()">閲嶇疆</button> + <button type="button" id="comb-btn" class="layui-btn layui-btn-normal " onclick="comb()" style="margin-left: 20px">缁勬墭</button> + <span id="tips"></span> + </div> +</footer> +</body> +<script> + var tableIns; + layui.use(['table','laydate', 'form'], function() { + var table = layui.table; + var $ = layui.jquery; + var layer = layui.layer; + var form = layui.form; + + tableIns = table.render({ + elem: '#chooseData', + data: [], + limit: 500, + cellMinWidth: 50, + cols: [[ + {fixed: 'left', align: 'center', field: 'count', title: '鏁伴噺', style:'color: blue', width:50}, + {field: 'matNo', align: 'center', title: '鐗╂枡缂栫爜'}, + {field: 'matName', align: 'center', title: '鐗╂枡鍚嶇О'} + ]], + done: function (res, curr, count) { + } + }); + + }); + + window.onload = function(){document.getElementById("code").focus();} + + function findCode(el) { + if (el.value.length === 7) { + $('#mat-btn').focus(); + getMat(); + } + } + + var matCodeLayerIdx; + function getMat() { + matCodeLayerIdx = layer.open({ + type: 2, + title: '鎻愬彇鐗╂枡', + shade: [0.3,'#000'], + area: ['90%', '80%'], + content: 'matQuery.html', + success: function(layero, index){ + $('.layui-layer-title').css('font-size', '16px'); + }, + end: function () { + $('#mat-btn').focus(); + } + }); + } + + // 娣诲姞琛ㄦ牸鏁版嵁 + var matData = []; + function addTableData(data) { + if (isEmpty(data.matName)){ + tips("鎻愬彇澶辫触", true); + return; + } + let toPush = true; + for (var j=0;j<matData.length;j++){ + if (data.matNo === matData[j].matNo) { + matData[j].count = Number(matData[j].count) + Number(data.count); + toPush = false; + } + } + if (toPush) { + matData.push(data); + } + tips("鎻愬彇鎴愬姛"); + tableIns.reload({data: matData}); + } + + // 閲嶇疆 + function reset() { + $('#code').val(""); + matData = []; + tableIns.reload({data: matData}); + } + + // 缁勬墭 + function comb() { + let barcode = $('#code').val(); + if (isEmpty(barcode)) { + tips("鎵樼洏鏉$爜涓虹┖", true); + // document.getElementById("code").focus(); + return; + } + if (barcode.length !== 7) { + tips("鏉$爜蹇呴』涓�7浣�", true); + return; + } + if (matData.length === 0) { + tips("璇锋彁鍙栫墿鏂�", true); + return; + } + $.ajax({ + url: baseUrl+"/mobile/comb/auth", + headers: {'token': localStorage.getItem('token')}, + data: JSON.stringify({ + barcode: barcode, + combMats: matData + }), + contentType:'application/json;charset=UTF-8', + method: 'POST', + async: false, + success: function (res) { + if (res.code === 200) { + reset(); + tips("缁勬墭鎴愬姛") + } else if (res.code === 403) { + top.location.href = baseUrl + "/pda"; + } else { + tips(res.msg, true) + } + } + }) + } + + /** + * 鎻愮ず淇℃伅 + * @param msg 鎻愮ず鍐呭 + * @param warn true锛氱孩鑹插瓧浣� + */ + function tips(msg, warn) { + // var tips = $('#tips'); + // tips.html(msg); + // tips.css("color", warn?"red":'#666'); + layer.msg(msg, {icon: warn?2:1}) + } + + document.onkeyup = function (e) { + if (window.event)//濡傛灉window.event瀵硅薄瀛樺湪锛屽氨浠ユ浜嬩欢瀵硅薄涓哄噯 + e = window.event; + var key = e.charCode || e.keyCode; + if (key === 115) { + $("#comb-btn").focus(); + comb(); + } else if (key === 113) { + $("#code").val(""); + $("#code").focus(); + } + } +</script> +</html> \ No newline at end of file diff --git a/src/main/webapp/views/pda/combPro.html b/src/main/webapp/views/pda/combPro.html new file mode 100644 index 0000000..5a47eb1 --- /dev/null +++ b/src/main/webapp/views/pda/combPro.html @@ -0,0 +1,341 @@ +<!DOCTYPE html> +<html lang="en"> +<head> + <meta charset="UTF-8"> + <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no"/> + <title>缁勬墭</title> + <link rel="stylesheet" href="../../static/layui/css/layui.css" media="all"> + <link rel="stylesheet" href="../../static/css/pda.css" media="all"> + <script type="text/javascript" src="../../static/js/jquery/jquery-3.3.1.min.js"></script> + <script type="text/javascript" src="../../static/layui/layui.js" charset="utf-8"></script> + <script type="text/javascript" src="../../static/js/common.js" charset="utf-8"></script> + <script type="text/javascript" src="../../static/js/cool.js" charset="utf-8"></script> + <script type="text/javascript" src="../../static/js/handlebars/handlebars-v4.5.3.js"></script> + <style> + .number-tool { + margin-left: 10px; + padding: 1px 0 1px 5px; + display: inline-block; + width: 120px; + } + .number-tool:after { + clear: both; + content: ""; + display: table; + } + .number-tool button { + background-color: #fff; + margin-top: 3px; + font-size: 16px; + height: 25px; + float: left; + width: 25px; + border: 1px solid #777777; + } + .number-tool input { + text-align: center; + height: 30px; + float: left; + margin: 0 5px; + width: 50px; + padding: 0; + } + #confirm { + margin: 10px 10px; + padding: 5px 20px; + font-weight: 600; + } + #remove { + margin: 10px 10px; + padding: 5px 20px; + color: darkred; + } + </style> +</head> +<body> +<!-- 澶撮儴 --> +<header> + <div class="layui-input-inline"> + <label class="layui-form-label">鏉$爜</label> + <input class="layui-input" type="number" id="code" onkeyup="findCode(this)" oninput="if(value.length>8)value=value.slice(0,8)" placeholder="鎵爜 / 杈撳叆" autocomplete="off"> + </div> + <div class="layui-input-inline" style="margin-top: 5px"> + <label class="layui-form-label">鍗曞彿</label> + <input class="layui-input" id="billNo" onkeyup="find(this)" placeholder="鎵爜 / 杈撳叆" autocomplete="off" style="width: 75%; height: 40px; margin-right: 0;"> + </div> +</header> + +<!-- 涓讳綋 --> +<main> + <table class="layui-table" id="chooseData" lay-filter="chooseData"></table> +</main> +<!-- 灏鹃儴 --> +<footer> + <div class="layui-btn-container"> + <button type="button" id="reset-btn" class="layui-btn layui-btn-primary" onclick="reset()">閲嶇疆</button> + <button type="button" id="comb-btn" class="layui-btn layui-btn-normal " onclick="comb()" style="margin-left: 20px">缁勬墭</button> + <span id="tips"></span> + </div> +</footer> + +<!-- 淇敼鏁伴噺寮圭獥 --> +<div id="modify" style="display: none; text-align: center;padding-top: 10px"> + <div class="form-item"> + <span>鐗╂枡</span> + <input id="matNo" type="text" disabled="disabled" style="width: 70%"> + </div> + <div class="form-item"> + <span>鍚嶇О</span> + <input id="matName" type="text" disabled="disabled" style="width: 70%"> + </div> + <div class="form-item" style="margin-top: 5px"> + <span style="vertical-align: middle">鏁伴噺</span> + <div class="number-tool" style="vertical-align: middle"> + <button onclick="reduce()">-</button><input id="count" type="number"><button onclick="add()">+</button> + </div> + </div> + <button id="remove" onclick="remove()">绉婚櫎</button> + <button id="confirm" onclick="confirm()">淇濆瓨</button> +</div> +</body> +<script> + window.onload = function(){document.getElementById("code").focus();} + var tableIns; + var countLayer; + layui.use(['table','laydate', 'form'], function() { + var table = layui.table; + var $ = layui.jquery; + var layer = layui.layer; + var form = layui.form; + + tableIns = table.render({ + elem: '#chooseData', + data: [], + limit: 500, + cellMinWidth: 50, + cols: [[ + {fixed: 'left', align: 'center', field: 'count', title: '鏁伴噺', event: 'modify', style:'cursor: pointer;color: blue', width:50}, + {field: 'matNo', align: 'center', title: '鐗╂枡缂栫爜'}, + {field: 'matName', align: 'center', title: '鐗╂枡鍚嶇О'} + ]], + done: function (res, curr, count) { + } + }); + + // 鐩戝惉琛屽伐鍏蜂簨浠� + table.on('tool(chooseData)', function(obj) { + var data = obj.data; + switch (obj.event) { + case 'modify': + countLayer = layer.open({ + type: 1, + offset: '20px', + title: '淇敼鏁伴噺', + shadeClose: true, + area: ['80%', '200px'], + content: $("#modify"), + success: function (layero, index) { + $('#matNo').val(data.matNo); + $('#matName').val(data.matName); + $('#count').val(data.count); + maxCount = data.count; + } + }); + break; + } + }); + + }); + + function findCode(el) { + if (el.value.length === 7) { + $('#billNo').focus(); + } + } + + // 娣诲姞琛ㄦ牸鏁版嵁 + var matData = []; + function addTableData(data) { + for (var i=0;i<data.length;i++) { + var toPush = true; + for (var j=0;j<matData.length;j++){ + if (data[i].matNo === matData[j].matNo) { + matData[j].count = Number(matData[j].count) + Number(data[i].count); + toPush = false; + } + } + if (toPush) { + matData.push(data[i]); + } + } + tableIns.reload({data: matData}); + $("#comb-btn").focus(); + } + + + /** + * 鏍规嵁閫氱煡鍗曞彿鏌ヨ鐗╂枡璇︽儏 + */ + function find(el){ + if (isEmpty(el.value)) { + return; + } + $.ajax({ + url: baseUrl + "/mobile/bill/query/auth", + headers: {'token': localStorage.getItem('token')}, + data: { + billNo: el.value + }, + method: 'POST', + success: function (res) { + if (res.code === 200) { + if (res.data != null) { + addTableData(res.data); + } + } else if (res.code === 403) { + top.location.href = baseUrl + "/pda"; + } else { + tips(res.msg, true) + } + } + }) + } + + /************************************* 鏁伴噺 ****************************************/ + var countDom = $('#count'); + var minCount = 1; + var maxCount = 1; + function add() { + if (countDom.val() >= maxCount) { + return; + } + countDom.val(Number(countDom.val()) + 1); + } + function reduce() { + if (countDom.val() <= minCount) { + return; + } + countDom.val(countDom.val() - 1); + } + + // 淇敼鏁伴噺 + function confirm(){ + var matNo = $('#matNo').val(); + var count = $('#count').val(); + for (var j=0;j<matData.length;j++){ + if (matNo === matData[j].matNo) { + if (count > maxCount || count < minCount) { + tips("鏁伴噺涓嶈兘瓒呰繃鑼冨洿", true); + return; + } + matData[j].count = Number(count); + } + } + tableIns.reload({data: matData}); + layer.close(countLayer); + tips("淇敼鎴愬姛"); + } + + // 绉婚櫎鐗╂枡 + function remove() { + var matNo = $('#matNo').val(); + for (var j=0;j<matData.length;j++){ + if (matNo === matData[j].matNo) { + matData.splice(j, 1); + } + } + tableIns.reload({data: matData}); + layer.close(countLayer); + tips("绉婚櫎鎴愬姛"); + } + + + + + + + + + + + + + + + + + + + + // 閲嶇疆 + function reset() { + $('#code').val(""); + $('#billNo').val(""); + matData = []; + tableIns.reload({data: matData}); + } + + // 缁勬墭 + function comb() { + var barcode = $('#code').val(); + if (isEmpty(barcode)) { + tips("鎵樼洏鏉$爜涓虹┖", true); + // document.getElementById("code").focus(); + return; + } + if (barcode.length !== 7) { + tips("鏉$爜蹇呴』涓�7浣�", true); + return; + } + if (matData.length === 0) { + tips("璇锋彁鍙栫墿鏂�", true); + return; + } + var billNo = $('#billNo').val(); + $.ajax({ + url: baseUrl+"/mobile/comb/auth", + headers: {'token': localStorage.getItem('token')}, + data: JSON.stringify({ + barcode: barcode, + combMats: matData, + billNo: billNo + }), + contentType:'application/json;charset=UTF-8', + method: 'POST', + async: false, + success: function (res) { + if (res.code === 200) { + reset(); + tips("缁勬墭鎴愬姛") + } else if (res.code === 403) { + top.location.href = baseUrl + "/pda"; + } else { + tips(res.msg, true) + } + } + }) + } + + /** + * 鎻愮ず淇℃伅 + * @param msg 鎻愮ず鍐呭 + * @param warn true锛氱孩鑹插瓧浣� + */ + function tips(msg, warn) { + layer.msg(msg, {icon: warn?2:1}) + } + + document.onkeyup = function (e) { + if (window.event)//濡傛灉window.event瀵硅薄瀛樺湪锛屽氨浠ユ浜嬩欢瀵硅薄涓哄噯 + e = window.event; + var key = e.charCode || e.keyCode; + if (key === 115) { + $("#comb-btn").focus(); + comb(); + } else if (key === 113) { + $("#code").val(""); + $("#code").focus(); + } + } +</script> +</html> \ No newline at end of file diff --git a/src/main/webapp/views/pda/index.html b/src/main/webapp/views/pda/index.html new file mode 100644 index 0000000..f015b95 --- /dev/null +++ b/src/main/webapp/views/pda/index.html @@ -0,0 +1,94 @@ +<!DOCTYPE html> +<html lang="en"> +<head> + <meta charset="UTF-8"> + <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no"/> + <title>PDA棣栭〉</title> + <script type="text/javascript" src="../../static/js/jquery/jquery-3.3.1.min.js"></script> + <style> + * { + margin: 0; + padding: 0; + box-sizing: border-box; + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + } + html { + height: 100%; + /*line-height: 1.5;*/ + } + body { + height: 100%; + /*overflow: hidden;*/ + } + + /* 瀵艰埅 */ + .nav { + background-color: #fff; /*todo*/ + color: #000; + list-style-type: none; + position: fixed; + width: 100%; + overflow: hidden; + box-shadow: 0 1px 2px 0 rgba(0,0,0,.1) + } + .nav li { + float: left; + border-right: 1px solid #f1f1f1; /*todo*/ + } + .nav li a { + font-size: 20px; + letter-spacing: 1px; + display: block; + text-decoration: none; + padding: 3px 10px; + text-align: center; + /*transform:scale(1.5);*/ + /*-webkit-transform:scale(1.5);*/ + /*-moz-transform:scale(1.5);*/ + } + .nav li a:hover { + color: #000; + } + .nav-unselect { + color: #666; + } + .nav-select { + background-color: #f1f1f1; /*todo*/ + color: #000; + } + + /* 涓讳綋 */ + #content { + padding-top: 32px; + width: 100%; + height: 100%; + } + iframe { + border-width: 0; + } + </style> +</head> +<body> + +<!-- 瀵艰埅鏍� --> +<ul class="nav"> + <li><a id="comb" onclick="nav(this.id)" class="nav-select" href="#">缁勬墭</a></li> + <li><a id="combPro" onclick="nav(this.id)" class="nav-unselect" href="#">鍏宠仈缁勬墭</a></li> + <li><a id="stockIn" onclick="nav(this.id)" class="nav-unselect" href="#">鍏ュ簱</a></li> + <li><a id="stockOut" onclick="nav(this.id)" class="nav-unselect" href="#">鍑哄簱</a></li> +</ul> + +<!-- 涓讳綋鍐呭 --> +<iframe id="content" src="comb.html"></iframe> + +</body> +<script> + // 瀵艰埅鏍� + function nav(id) { + $('.nav-select').attr("class", "nav-unselect"); + $('#'+id).attr("class", "nav-select"); + $('#content').attr("src", id+".html"); + } +</script> +</html> \ No newline at end of file diff --git a/src/main/webapp/views/pda/locDetlIframe.html b/src/main/webapp/views/pda/locDetlIframe.html new file mode 100644 index 0000000..7d0cbaf --- /dev/null +++ b/src/main/webapp/views/pda/locDetlIframe.html @@ -0,0 +1,136 @@ +<!DOCTYPE html> +<html lang="en"> +<head> + <meta charset="UTF-8"> + <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no"/> + <title>搴撳瓨鏄庣粏璇︽儏</title> + <link rel="stylesheet" href="../../static/layui/css/layui.css" media="all"> + <script type="text/javascript" src="../../static/js/jquery/jquery-3.3.1.min.js"></script> + <script type="text/javascript" src="../../static/layui/layui.js" charset="utf-8"></script> + <script type="text/javascript" src="../../static/js/common.js" charset="utf-8"></script> + <script type="text/javascript" src="../../static/js/cool.js" charset="utf-8"></script> + <script type="text/javascript" src="../../static/js/handlebars/handlebars-v4.5.3.js"></script> + <style> + .form-box { + padding: 15px 5px 5px 5px; + font-size: 16px; + text-align: center; + } + + .form-item { + margin-bottom: 10px; + } + + .form-box span { + display: inline-block; + text-align: right; + width: 70px; + } + .form-box input { + width: 120px; + margin-left: 10px; + padding-left: 5px; + height: 30px; + border: 1px solid #777777; + overflow:hidden; + white-space:nowrap; + text-overflow:ellipsis; + } + + .number-tool { + margin-left: 10px; + padding: 1px 0 1px 5px; + display: inline-block; + width: 120px; + } + .number-tool:after { + clear: both; + content: ""; + display: table; + } + .number-tool button { + background-color: #fff; + margin-top: 3px; + font-size: 16px; + height: 25px; + float: left; + width: 25px; + border: 1px solid #777777; + } + .number-tool input { + text-align: center; + height: 30px; + float: left; + margin: 0 5px; + width: 40px; + padding: 0; + } + + .form-button { + margin: 5px 10px 0 10px; + padding: 5px 15px; + } + </style> +</head> +<body> +<div class="form-box"> + <div class="form-item"> + <span>搴撲綅鍙�</span> + <input id="locNo" type="text" disabled="disabled"> + </div> + <div class="form-item"> + <span>鐗╂枡缂栫爜</span> + <input id="matnr" type="text" disabled="disabled"> + </div> + <div class="form-item"> + <span>鐗╂枡鍚嶇О</span> + <input id="maktx" type="text" disabled="disabled"> + </div> + <div class="form-item"> + <span style="vertical-align: middle">鏁伴噺</span> + <div class="number-tool" style="vertical-align: middle"> + <button onclick="reduce()">-</button> + <input id="count" type="number"> +<!-- <button onclick="add()">+</button>--> + </div> + </div> + <button class="form-button" id="save" onclick="save()">淇濆瓨</button> + <button class="form-button" id="remove" onclick="remove()">绉婚櫎</button> +</div> +</body> +<script> + var countDom = $('#count'); + + function save() { + console.log(countDom.val()) + if (countDom.val() < 1) { + return; + } + parent.updateTableData({ + locNo: $('#locNo').val(), + matnr: $('#matnr').val(), + maktx: $('#maktx').val(), + count: countDom.val() + }) + parent.layer.closeAll(); + } + + function remove() { + parent.removeTableData({ + locNo: $('#locNo').val(), + matnr: $('#matnr').val(), + }) + parent.layer.closeAll(); + } + + function add() { + countDom.val(Number(countDom.val()) + 1); + } + function reduce() { + if (countDom.val() <= 1) { + return; + } + countDom.val(countDom.val() - 1); + } +</script> +</html> \ No newline at end of file diff --git a/src/main/webapp/views/pda/login.html b/src/main/webapp/views/pda/login.html new file mode 100644 index 0000000..6736ed8 --- /dev/null +++ b/src/main/webapp/views/pda/login.html @@ -0,0 +1,151 @@ +<!DOCTYPE html> +<html lang="en"> +<head> + <meta charset="UTF-8"> + <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no"/> + <title>绯荤粺鐧诲綍</title> + <link rel="stylesheet" href="../../static/layui/css/layui.css" media="all"> + <script type="text/javascript" src="../../static/layui/layui.js"></script> + <script type="text/javascript" src="../../static/js/common.js"></script> + <style> + html{ + height: 100%; + overflow: hidden; + } + body.login-bg { + color: #777; + height: 100%; + background-image: linear-gradient(to right, #ff9569 0%, #e92758 100%); + /*background-image: linear-gradient(-90deg, #29bdd9 0%, #276ace 100%);*/ + /*background: -webkit-linear-gradient(red, blue); !* Safari 5.1 - 6.0 *!;*/ + /*background-image: url("../static/image/login_bg.jpg");*/ + /*background-repeat: no-repeat;*/ + /*background-size: cover;*/ + /*background-position: top center;*/ + } + + #login-wrapper { + box-sizing:border-box; + background: #fff; + height: 100%; + padding: 100px 60px; + text-align: center; + overflow: hidden; + } + #login-wrapper h1 { + font-weight: bolder; + margin-bottom: 20px; + letter-spacing: 5px; + /*transform:scale(3);*/ + /*-webkit-transform:scale(3);*/ + /*-moz-transform:scale(3);*/ + } + .layui-form-item { + margin-bottom: 15px; + position: relative; + } + .layui-form-item .layui-input { + height: 40px; + padding-left: 20px; + font-size: 16px; + border: 1px solid #767676; + color: inherit; + border-radius: 3px; + transition: 0.3s; + } + .layui-input:hover, .layui-textarea:hover { + border-color: #0767aa !important; + border-width: 1.5px; + } + .login-submit { + margin-top: 20px; + } + #login-button { + background-color: #0767aa; + width: 50%; + font-size: 14px; + font-weight: bolder; + border-radius: 5px; + height: 40px; + } + </style> +</head> +<body class="login-bg"> + +<div id="login-wrapper"> + <header> + <h1>绯荤粺鐧诲綍</h1> + </header> + <div class="layui-form layadmin-user-login-body"> + <div class="layui-form-item"> + <input id="mobile" class="layui-input" type="text" name="mobile" lay-verify="mobile" placeholder="璐﹀彿" autocomplete="off"> + </div> + <div class="layui-form-item"> + <input id="password" class="layui-input" type="password" name="password" lay-verify="password" placeholder="瀵嗙爜" autocomplete="off"> + </div> +<!-- <div class="layui-form-item" style="text-align: right;padding-left: 3px;">--> +<!-- <input id="rememberPwd" style="vertical-align: middle" type="checkbox" lay-skin='primary' lay-filter="remPwd" title="璁颁綇瀵嗙爜" checked="checked">--> +<!-- </div>--> + </div> + <div class="layui-form-item login-submit"> + <button id="login-button" class="layui-btn layui-btn-fluid layui-btn-normal" lay-submit="" lay-filter="login">鐧� 褰�</button> + </div> +</div> + +</body> +<script type="text/javascript" src="../../static/js/jquery/jquery-3.3.1.min.js"></script> +<script type="text/javascript" src="../../static/js/tools/md5.js"></script> +<script type="text/javascript"> + + layui.use(['form','layer'],function () { + var form = layui.form, + layer = layui.layer, + $ = layui.jquery; + + form.on('submit(login)', function (data) { + var mobile = $("#mobile").val(); + if (mobile === "") { + layer.msg("璇疯緭鍏ヨ处鍙�", {icon: 2}) + $("#mobile").focus(); + return; + } + var password = $("#password").val(); + if (password === "") { + layer.msg("璇疯緭鍏ュ瘑鐮�", {icon: 2}) + $("#password").focus(); + return; + } + + var user = { + username: mobile, + password: hex_md5(password) + }; + $.ajax({ + url: baseUrl+"/login.action", + data: user, + method: 'POST', + success: function (res) { + if (res.code === 200){ + layer.msg("鐧诲綍鎴愬姛", {icon: 1}) + localStorage.setItem("token", res.data.token); + localStorage.setItem("username", res.data.username); + window.location.href = "index.html"; + } else { + layer.msg(res.msg, {icon: 2}) + } + } + }); + return false; + }); + + $('body').keydown(function () { + if (event.keyCode === 13) { + $("#login-button").click(); + } else if (event.keyCode === 115) { + $("#login-button").click(); + } + }); + + }); +</script> +</html> \ No newline at end of file diff --git a/src/main/webapp/views/pda/matQuery.html b/src/main/webapp/views/pda/matQuery.html new file mode 100644 index 0000000..0fc7734 --- /dev/null +++ b/src/main/webapp/views/pda/matQuery.html @@ -0,0 +1,185 @@ +<!DOCTYPE html> +<html lang="en"> +<head> + <meta charset="UTF-8"> + <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no"/> + <title>鐗╂枡鎻愬彇</title> + <link rel="stylesheet" href="../../static/layui/css/layui.css" media="all"> + <script type="text/javascript" src="../../static/js/jquery/jquery-3.3.1.min.js"></script> + <script type="text/javascript" src="../../static/layui/layui.js" charset="utf-8"></script> + <script type="text/javascript" src="../../static/js/common.js" charset="utf-8"></script> + <script type="text/javascript" src="../../static/js/cool.js" charset="utf-8"></script> + <script type="text/javascript" src="../../static/js/handlebars/handlebars-v4.5.3.js"></script> + <style> + .form-box { + padding: 15px 5px 5px 5px; + font-size: 16px; + text-align: center; + } + + .form-item { + margin-bottom: 10px; + } + + .form-box span { + font-size: 16px; + display: inline-block; + text-align: right; + width: 70px; + } + .form-box input { + width: 120px; + margin-left: 10px; + padding-left: 5px; + height: 30px; + border: 1px solid #777777; + overflow:hidden; + white-space:nowrap; + text-overflow:ellipsis; + } + #confirm { + margin-top: 10px; + padding: 5px 20px; + } + + .number-tool { + margin-left: 10px; + padding: 1px 0 1px 5px; + display: inline-block; + width: 120px; + } + .number-tool:after { + clear: both; + content: ""; + display: table; + } + .number-tool button { + background-color: #fff; + margin-top: 3px; + font-size: 16px; + height: 25px; + float: left; + width: 25px; + border: 1px solid #777777; + } + .number-tool input { + text-align: center; + height: 30px; + float: left; + margin: 0 5px; + width: 40px; + padding: 0; + } + </style> +</head> +<body> + +<div class="form-box"> + <div class="form-item"> + <span>鐗╂枡缂栫爜</span> + <input id="matNo" type="text" placeholder="鎵爜 / 杈撳叆" onkeyup="find(this)" autocomplete="off"> + </div> + <div class="form-item"> + <span>鐗╂枡鍚嶇О</span> + <input id="matName" type="text" disabled="disabled"> + </div> + <div class="form-item"> + <span>鐗╂枡瑙勬牸</span> + <input id="str2" type="text" disabled="disabled"> + </div> + <div class="form-item"> + <span>鍗曚綅</span> + <input id="str1" type="text" disabled="disabled"> + </div> + <div class="form-item"> + <span style="vertical-align: middle">鏁伴噺</span> + <div class="number-tool" style="vertical-align: middle"> + <button onclick="reduce()">-</button><input id="count" type="number"><button onclick="add()">+</button> + </div> + </div> + <button id="confirm" onclick="confirm()">鎻愬彇</button> +</div> + +</body> +<script> + var countDom = $('#count'); + var initMatCount = 1; + var pageCurr; + + /** + * 鏍规嵁鐗╂枡缂栫爜鏌ヨ鐗╂枡璇︽儏 + */ + function find(el){ + if (isEmpty(el.value)) { + return; + } + $.ajax({ + url: baseUrl + "/matCode/auth", + headers: {'token': localStorage.getItem('token')}, + data: { + matnr: el.value + }, + method: 'POST', + success: function (res) { + if (res.code === 200) { + if (res.data != null) { + $('#matName').val(res.data.matName); + $('#str1').val(res.data.str1); + $('#str2').val(res.data.str2); + countDom.val(initMatCount); + $('#count').focus().select(); + } + } else if (res.code === 403) { + top.location.href = baseUrl + "/pda"; + } else { + alert(res.msg) + } + } + }) + } + + /** + * 鎻愬彇 + */ + function confirm(){ + var data = { + matNo: $('#matNo').val(), + matName: $('#matName').val(), + count: countDom.val() + }; + parent.addTableData(data); + parent.layer.close(parent.matCodeLayerIdx); + } + + window.onload = function(){document.getElementById("matNo").focus();} + $(document).on('click','#confirm', function () { + }) + + // $('body').keydown(function () { + // if (event.keyCode === 13) { + // $("#confirm").click(); + // } + // }); + + function add() { + countDom.val(Number(countDom.val()) + 1); + } + function reduce() { + if (countDom.val() <= initMatCount) { + return; + } + countDom.val(countDom.val() - 1); + } + + + document.onkeyup = function (e) { + if (window.event)//濡傛灉window.event瀵硅薄瀛樺湪锛屽氨浠ユ浜嬩欢瀵硅薄涓哄噯 + e = window.event; + var key = e.charCode || e.keyCode; + if (key === 115) { + confirm(); + } + } + +</script> +</html> \ No newline at end of file diff --git a/src/main/webapp/views/pda/stockIn.html b/src/main/webapp/views/pda/stockIn.html new file mode 100644 index 0000000..07c06b4 --- /dev/null +++ b/src/main/webapp/views/pda/stockIn.html @@ -0,0 +1,325 @@ +<!DOCTYPE html> +<html lang="en"> +<head> + <meta charset="UTF-8"> + <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no"/> + <title>鍏ュ簱</title> + <link rel="stylesheet" href="../../static/layui/css/layui.css" media="all"> + <link rel="stylesheet" href="../../static/css/pda.css" media="all"> + <script type="text/javascript" src="../../static/js/jquery/jquery-3.3.1.min.js"></script> + <script type="text/javascript" src="../../static/layui/layui.js" charset="utf-8"></script> + <script type="text/javascript" src="../../static/js/common.js" charset="utf-8"></script> + <script type="text/javascript" src="../../static/js/cool.js" charset="utf-8"></script> + <script type="text/javascript" src="../../static/js/handlebars/handlebars-v4.5.3.js"></script> + <style> + .site-list { + padding: 2px 0; + height: 22px; + margin-bottom: 5px; + } + .site-list label { + padding-right: 15px; + } + .site-list label span { + vertical-align: middle; + font-size: 13px; + } + + .cool-checkbox:checked { + background:#1673ff + } + .cool-checkbox { + width:15px; + height:15px; + background-color:#ffffff; + border:solid 1px #dddddd; + -webkit-border-radius:50%; + border-radius:50%; + font-size:15px; + margin:0 5px 0 0; + padding:0; + position:relative; + display:inline-block; + vertical-align:middle; + cursor:default; + -webkit-appearance:none; + -webkit-user-select:none; + user-select:none; + -webkit-transition:background-color ease 0.1s; + transition:background-color ease 0.1s; + } + .cool-checkbox:checked::after { + content:''; + top:3px; + left:3px; + position:absolute; + background:transparent; + border:#fff solid 2px; + border-top:none; + border-right:none; + height:3px; + width:6px; + -moz-transform:rotate(-45deg); + -ms-transform:rotate(-45deg); + -webkit-transform:rotate(-45deg); + transform:rotate(-45deg); + } + + </style> +</head> +<body> +<!-- 澶撮儴 --> +<header> + <div class="layui-input-inline"> + <label class="layui-form-label">鏉$爜</label> + <input class="layui-input" type="number" id="code" onkeyup="findCode(this)" oninput="if(value.length>8)value=value.slice(0,8)" placeholder="鎵爜 / 杈撳叆" autocomplete="off"> + </div> + <div style="margin: 5px 5px" class="layui-form"> + <button id="mat-btn" type="button" class="layui-btn layui-btn-normal" onclick="getMat()"><i class="layui-icon">+</i>鎻愬彇</button> + <!-- 鍏ュ簱鍙� --> + <div class="layui-inline" style="width: 120px; margin-left: 15px"> + <select id="putSiteSelect"> + <option value="">鍏ュ簱鍙�</option> + </select> + </div> + + </div> +</header> + +<!-- 涓讳綋 --> +<main> + <table class="layui-table" id="chooseData" lay-filter="chooseData"></table> +</main> +<!-- 灏鹃儴 --> +<footer> + <div class="layui-btn-container"> + <button type="button" class="layui-btn layui-btn-primary" onclick="reset()">閲嶇疆</button> + <button id="empty-pakin" type="button" class="layui-btn layui-btn-normal" onclick="emptyPakIn()" style="margin-left: 15px">绌烘澘鍏ュ簱</button> + <button id="pakin" type="button" class="layui-btn layui-btn-normal" onclick="pakIn()" style="margin-left: 15px">鍏ュ簱</button> + </div> +</footer> +</body> +<script> + var tableIns; + window.onload = function(){ + document.getElementById("code").focus(); + getInBound(); + } + + + layui.use(['table','laydate', 'form'], function() { + var table = layui.table; + var $ = layui.jquery; + var layer = layui.layer; + var form = layui.form; + + tableIns = table.render({ + elem: '#chooseData', + data: [], + limit: 500, + cellMinWidth: 50, + cols: [[ + {fixed: 'left', align: 'center', field: 'count', title: '鏁伴噺', style:'color: blue', width:50}, + {field: 'matNo', align: 'center', title: '鐗╂枡缂栫爜'}, + {field: 'matName', align: 'center', title: '鐗╂枡鍚嶇О'} + ]], + done: function (res, curr, count) { + + } + }); + + }); + + function findCode(el) { + if (el.value.length === 7) { + $('#mat-btn').focus(); + getMat(); + } + } + + // 鑾峰彇鍏ュ簱鍙� + function getInBound(){ + $.ajax({ + url: baseUrl+"/available/put/site", + headers: {'token': localStorage.getItem('token')}, + method: 'POST', + async: false, + success: function (res) { + if (res.code === 200){ + var tpl = $("#putSiteSelectTemplate").html(); + var template = Handlebars.compile(tpl); + var html = template(res); + $('#putSiteSelect').append(html); + layui.form.render('select'); + } else if (res.code === 403){ + top.location.href = baseUrl+"/pda"; + }else { + tips("鑾峰彇鍏ュ簱鍙eけ璐�", true) + } + } + }) + } + + // 鎻愬彇鐗╂枡 + var matCodeLayerIdx; + function getMat() { + matCodeLayerIdx = layer.open({ + type: 2, + title: '鐗╂枡', + shade: [0.3,'#000'], + area: ['90%', '80%'], + content: 'matQuery.html', + success: function(layero, index){ + $('.layui-layer-title').css('font-size', '16px'); + }, + end: function () { + $('#mat-btn').focus(); + } + }); + } + + // 娣诲姞琛ㄦ牸鏁版嵁 + var matData = []; + function addTableData(data) { + if (isEmpty(data.matName)){ + tips("鎻愬彇澶辫触", true); + return; + } + let toPush = true; + for (var j=0;j<matData.length;j++){ + if (data.matNo === matData[j].matNo) { + matData[j].count = Number(matData[j].count) + Number(data.count); + toPush = false; + } + } + if (toPush) { + matData.push(data); + } + tips("鎻愬彇鎴愬姛"); + tableIns.reload({data: matData}); + } + + // 閲嶇疆 + function reset() { + $('#code').val(""); + matData = []; + tableIns.reload({data: matData}); + $('#putSiteSelect').val(""); + layui.form.render('select'); + // tips(""); + } + + // 鍏ュ簱 + function pakIn() { + var barcode = $('#code').val(); + if (isEmpty(barcode)) { + tips("鎵樼洏鏉$爜涓虹┖", true); + return; + } + if (barcode.length !== 7) { + tips("鏉$爜蹇呴』涓�7浣�", true); + return; + } + if (matData.length === 0) { + tips("璇锋彁鍙栫墿鏂�", true); + return; + } + // var site = $('input:radio[name="site"]:checked').next("span").html(); + var site = $('#putSiteSelect').val(); + if (null === site || undefined === site || site === "") { + tips("璇烽�夋嫨鍏ュ簱鍙�", true); + return; + } + $.ajax({ + url: baseUrl+"/full/store/put/start", + headers: {'token': localStorage.getItem('token')}, + data: JSON.stringify({ + barcode: barcode, + devpNo: site, + list: matData + }), + contentType:'application/json;charset=UTF-8', + method: 'POST', + async: false, + success: function (res) { + if (res.code === 200) { + reset(); + tips("鍏ュ簱鍚姩鎴愬姛") + } else if (res.code === 403) { + top.location.href = baseUrl + "/pda"; + } else { + tips(res.msg, true) + } + } + }) + } + + // 绌烘澘鍏ュ簱 + function emptyPakIn() { + var barcode = $('#code').val(); + if (isEmpty(barcode)) { + tips("鎵樼洏鏉$爜涓虹┖", true); + return; + } + if (barcode.length !== 7) { + tips("鏉$爜蹇呴』涓�7浣�", true); + return; + } + var site = $('#putSiteSelect').val(); + if (null === site || undefined === site || site === "") { + tips("璇烽�夋嫨鍏ュ簱鍙�", true); + return; + } + $.ajax({ + url: baseUrl+"/empty/plate/in/start", + headers: {'token': localStorage.getItem('token')}, + data: { + barcode: barcode, + sourceStaNo: site + }, + method: 'POST', + async: false, + success: function (res) { + if (res.code === 200) { + reset(); + tips("绌烘澘鍏ュ簱鍚姩鎴愬姛") + } else if (res.code === 403) { + top.location.href = baseUrl + "/pda"; + } else { + tips(res.msg, true) + } + } + }) + } + + /** + * 鎻愮ず淇℃伅 + * @param msg 鎻愮ず鍐呭 + * @param warn true锛氱孩鑹插瓧浣� + */ + function tips(msg, warn) { + // let tips = $('#tips'); + // tips.html(msg); + // tips.css("color", warn?"red":'#666'); + layer.msg(msg, {icon: warn?2:1}) + } + + document.onkeyup = function (e) { + if (window.event)//濡傛灉window.event瀵硅薄瀛樺湪锛屽氨浠ユ浜嬩欢瀵硅薄涓哄噯 + e = window.event; + var key = e.charCode || e.keyCode; + if (key === 115) { + $("#pakin").focus(); + pakIn(); + } else if (key === 113) { + $("#code").val(""); + $("#code").focus(); + } + } +</script> +<script type="text/template" id="putSiteSelectTemplate"> + {{#each data}} + <option value="{{this}}">{{this}}</option> + {{/each}} +</script> +</html> \ No newline at end of file diff --git a/src/main/webapp/views/pda/stockInPro.html b/src/main/webapp/views/pda/stockInPro.html new file mode 100644 index 0000000..34d839c --- /dev/null +++ b/src/main/webapp/views/pda/stockInPro.html @@ -0,0 +1,235 @@ +<!DOCTYPE html> +<html lang="en"> +<head> + <meta charset="UTF-8"> + <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no"/> + <title>鍏ュ簱</title> + <link rel="stylesheet" href="../../static/layui/css/layui.css" media="all"> + <link rel="stylesheet" href="../../static/css/pda.css" media="all"> + <script type="text/javascript" src="../../static/js/jquery/jquery-3.3.1.min.js"></script> + <script type="text/javascript" src="../../static/layui/layui.js" charset="utf-8"></script> + <script type="text/javascript" src="../../static/js/common.js" charset="utf-8"></script> + <script type="text/javascript" src="../../static/js/cool.js" charset="utf-8"></script> + <script type="text/javascript" src="../../static/js/handlebars/handlebars-v4.5.3.js"></script> + <style> + .site-list { + padding: 2px 0; + height: 22px; + margin-bottom: 5px; + } + .site-list label { + padding-right: 15px; + } + .site-list label span { + vertical-align: middle; + font-size: 13px; + } + + .cool-checkbox:checked { + background:#1673ff + } + .cool-checkbox { + width:15px; + height:15px; + background-color:#ffffff; + border:solid 1px #dddddd; + -webkit-border-radius:50%; + border-radius:50%; + font-size:15px; + margin:0 5px 0 0; + padding:0; + position:relative; + display:inline-block; + vertical-align:middle; + cursor:default; + -webkit-appearance:none; + -webkit-user-select:none; + user-select:none; + -webkit-transition:background-color ease 0.1s; + transition:background-color ease 0.1s; + } + .cool-checkbox:checked::after { + content:''; + top:3px; + left:3px; + position:absolute; + background:transparent; + border:#fff solid 2px; + border-top:none; + border-right:none; + height:3px; + width:6px; + -moz-transform:rotate(-45deg); + -ms-transform:rotate(-45deg); + -webkit-transform:rotate(-45deg); + transform:rotate(-45deg); + } + + </style> +</head> +<body> +<!-- 澶撮儴 --> +<header> + <div class="layui-input-inline"> + <label class="layui-form-label">鏉$爜</label> + <input class="layui-input" type="number" id="code" onkeyup="findCode(this)" oninput="if(value.length>8)value=value.slice(0,8)" placeholder="鎵爜 / 杈撳叆" autocomplete="off"> + </div> + <div class="layui-input-inline" style="margin-top: 20px"> + <label class="layui-form-label">鎴愬搧</label> + <input class="layui-input" type="number" id="matCode" placeholder="鎵爜 / 杈撳叆" autocomplete="off" style="width: 75%; height: 40px; margin-right: 0;"> + </div> + <div style="margin-top: 20px" class="layui-form"> + <label class="layui-form-label">鍏ュ簱鍙�</label> + <!-- 鍏ュ簱鍙� --> + <div class="layui-inline" style="width: 120px; margin-left: 15px"> + <select id="putSiteSelect"> + <option value="">鍏ュ簱鍙�</option> + </select> + </div> + </div> + +</header> + +<!-- 涓讳綋 --> +<!--<main>--> +<!-- <table class="layui-table" id="chooseData" lay-filter="chooseData"></table>--> +<!--</main>--> +<!-- 灏鹃儴 --> +<footer style="margin-top: 30px"> + <div class="layui-btn-container"> + <button type="button" class="layui-btn layui-btn-primary" onclick="reset()">閲嶇疆</button> + <button id="pakin" type="button" class="layui-btn layui-btn-normal" onclick="pakIn()" style="margin-left: 15px">鍏ュ簱</button> + </div> +</footer> +</body> +<script> + window.onload = function(){ + document.getElementById("code").focus(); + getInBound(); + } + + + layui.use(['table','laydate', 'form'], function() { + var table = layui.table; + var $ = layui.jquery; + var layer = layui.layer; + var form = layui.form; + + + }); + + function findCode(el) { + if (el.value.length === 7) { + $('#matCode').focus(); + } + } + + // 鑾峰彇鍏ュ簱鍙� + function getInBound(){ + $.ajax({ + url: baseUrl+"/available/put/site", + headers: {'token': localStorage.getItem('token')}, + method: 'POST', + async: false, + success: function (res) { + if (res.code === 200){ + var tpl = $("#putSiteSelectTemplate").html(); + var template = Handlebars.compile(tpl); + var html = template(res); + $('#putSiteSelect').append(html); + layui.form.render('select'); + } else if (res.code === 403){ + top.location.href = baseUrl+"/pda"; + }else { + tips("鑾峰彇鍏ュ簱鍙eけ璐�", true) + } + } + }) + } + + // 閲嶇疆 + function reset() { + $('#code').val(""); + $('#matCode').val(""); + $('#putSiteSelect').val(""); + layui.form.render('select'); + // tips(""); + } + + // 鍏ュ簱 + function pakIn() { + var barcode = $('#code').val(); + var matCode = $('#matCode').val(); + if (isEmpty(barcode)) { + tips("鎵樼洏鏉$爜涓虹┖", true); + return; + } + if (barcode.length !== 7) { + tips("鏉$爜蹇呴』涓�7浣�", true); + return; + } + if (isEmpty(matCode)) { + tips("鎴愬搧鐮佷负绌�", true); + return; + } + // var site = $('input:radio[name="site"]:checked').next("span").html(); + var site = $('#putSiteSelect').val(); + if (null === site || undefined === site || site === "") { + tips("璇烽�夋嫨鍏ュ簱鍙�", true); + return; + } + $.ajax({ + url: baseUrl+"/full/store/put/start", + headers: {'token': localStorage.getItem('token')}, + data: JSON.stringify({ + barcode: barcode, + devpNo: site, + productCode: matCode + }), + contentType:'application/json;charset=UTF-8', + method: 'POST', + async: false, + success: function (res) { + if (res.code === 200) { + reset(); + tips("鍏ュ簱鍚姩鎴愬姛") + } else if (res.code === 403) { + top.location.href = baseUrl + "/pda"; + } else { + tips(res.msg, true) + } + } + }) + } + + /** + * 鎻愮ず淇℃伅 + * @param msg 鎻愮ず鍐呭 + * @param warn true锛氱孩鑹插瓧浣� + */ + function tips(msg, warn) { + // let tips = $('#tips'); + // tips.html(msg); + // tips.css("color", warn?"red":'#666'); + layer.msg(msg, {icon: warn?2:1}) + } + + document.onkeyup = function (e) { + if (window.event)//濡傛灉window.event瀵硅薄瀛樺湪锛屽氨浠ユ浜嬩欢瀵硅薄涓哄噯 + e = window.event; + var key = e.charCode || e.keyCode; + if (key === 115) { + $("#pakin").focus(); + pakIn(); + } else if (key === 113) { + $("#code").val(""); + $("#code").focus(); + } + } +</script> +<script type="text/template" id="putSiteSelectTemplate"> + {{#each data}} + <option value="{{this}}">{{this}}</option> + {{/each}} +</script> +</html> \ No newline at end of file diff --git a/src/main/webapp/views/pda/stockOut.html b/src/main/webapp/views/pda/stockOut.html new file mode 100644 index 0000000..2e59ec2 --- /dev/null +++ b/src/main/webapp/views/pda/stockOut.html @@ -0,0 +1,288 @@ +<!DOCTYPE html> +<html lang="en"> +<head> + <meta charset="UTF-8"> + <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no"/> + <title>鍑哄簱</title> + <link rel="stylesheet" href="../../static/layui/css/layui.css" media="all"> + <link rel="stylesheet" href="../../static/css/pda.css" media="all"> + <script type="text/javascript" src="../../static/js/jquery/jquery-3.3.1.min.js"></script> + <script type="text/javascript" src="../../static/layui/layui.js" charset="utf-8"></script> + <script type="text/javascript" src="../../static/js/common.js" charset="utf-8"></script> + <script type="text/javascript" src="../../static/js/cool.js" charset="utf-8"></script> + <script type="text/javascript" src="../../static/js/handlebars/handlebars-v4.5.3.js"></script> + <style> + .layui-input-block { + margin-left: 60px; + } + main { + height: 200px; + } + </style> +</head> +<body> +<!-- 澶撮儴 --> +<header class="layui-form"> + <div class="layui-input-inline"> + <label class="layui-form-label">搴撲綅</label> + <div class="layui-input-block"> + <input class="layui-input" type="number" id="locNo" onkeyup="findByLocNo(this)" autocomplete="off"> + </div> + + </div> + <div class="layui-input-inline"> + <label class="layui-form-label">鐗╂枡</label> + <div class="layui-input-block"> + <input class="layui-input" type="text" id="matNo" onkeyup="findByMatNo(this)" autocomplete="off"> + </div> + </div> + <div class="layui-input-inline"> + <label class="layui-form-label">鍑哄簱鍙�</label> + <div class="layui-input-inline" style="margin-left: 5px;width: 120px"> + <select id="staNoSelect"> + <option value="">璇烽�夋嫨</option> + </select> + </div> + </div> +</header> +<!-- 涓讳綋 --> +<main> + <table class="layui-table" id="dataByLoc" lay-filter="dataByLoc"></table> +</main> +<!-- 灏鹃儴 --> +<footer> + <div class="layui-btn-container"> + <button id="reset" type="button" class="layui-btn layui-btn-primary" onclick="reset()">閲嶇疆</button> + <button id="pakOut" type="button" class="layui-btn layui-btn-normal" onclick="pakOut()" style="margin-left: 20px">鍑哄簱</button> + <span id="tips"></span> + </div> +</footer> +</body> +<script> + + window.onload = function(){ + document.getElementById("locNo").focus(); + getOutBound(); + } + + /** + * 鏍规嵁搴撲綅鍙锋煡鎵惧簱瀛樻槑缁� + */ + function findByLocNo(el){ + if (isEmpty(el.value)) { + return; + } + $("#matNo").val(""); + find(el.value, null); + } + + /** + * 鏍规嵁鐗╂枡鍙锋煡鎵惧簱瀛樻槑缁� + */ + function findByMatNo(el){ + if (isEmpty(el.value)) { + return; + } + $("#locNo").val(""); + find(null, el.value); + } + function find(locNo, matNo) { + $.ajax({ + url: baseUrl + "/mobile/locDetl", + headers: {'token': localStorage.getItem('token')}, + data: { + locNo: locNo, + matNo: matNo + }, + method: 'POST', + success: function (res) { + if (res.code === 200) { + if (res.data != null) { + locDetlData = res.data; + tableIns.reload({data: locDetlData}); + } + $('#pakOut').focus(); + } else if (res.code === 403) { + top.location.href = baseUrl + "/pda"; + } else { + locDetlData = []; + tableIns.reload({data: locDetlData}); + } + } + }) + } + + // 琛ㄦ牸 + var locDetlData = []; + var tableIns; + layui.use(['table','laydate', 'form'], function() { + var table = layui.table; + var $ = layui.jquery; + var layer = layui.layer; + var form = layui.form; + + tableIns = table.render({ + id: 'tableIdx', + elem: '#dataByLoc', + data: [], + limit: 500, + cellMinWidth: 50, + cols: [[ + {type: 'checkbox', fixed: 'left', width:30}, + {field: 'count', align: 'center', title: '鏁伴噺', event: 'detail', style:'color: blue', width:50}, + {field: 'matnr', align: 'center', title: '缂栫爜', event: 'detail'}, + {field: 'maktx', align: 'center', title: '鍚嶇О', event: 'detail'}, + {field: 'locNo', align: 'center', title: '搴撲綅', event: 'detail'} + ]], + done: function (res, curr, count) { + } + }); + + // 鐩戝惉琛屽伐鍏蜂簨浠� + table.on('tool(dataByLoc)', function(obj) { + var data = obj.data; + switch (obj.event) { + // 璇︽儏 + case 'detail': + layer.open({ + type: 2, + title: '搴撳瓨鏄庣粏', + shade: [0.3,'#000'], + area: ['90%', '70%'], + content: 'locDetlIframe.html', + success: function(layero, index){ + // 璁剧疆寮圭獥鏍峰紡 + $('.layui-layer-title').css('font-size', '16px'); + // 娉ㄥ叆鍊� + let el = layer.getChildFrame('.form-box', index); + for (var val in data) { + var find = el.find(":input[id='" + val + "']"); + find.val(data[val]); + } + }, + end: function () { + $('#pakOut').focus(); + } + }); + break; + } + }) + }); + + // 鑾峰彇鍑哄簱鍙� + function getOutBound(){ + $.ajax({ + url: baseUrl+"/available/take/site", + headers: {'token': localStorage.getItem('token')}, + method: 'POST', + async: false, + success: function (res) { + if (res.code === 200){ + var tpl = $("#takeSiteSelectTemplate").html(); + var template = Handlebars.compile(tpl); + var html = template(res); + $('#staNoSelect').append(html); + layui.form.render('select'); + } else if (res.code === 403){ + top.location.href = baseUrl+"/pda"; + }else { + tips("鑾峰彇鍑哄簱鍙eけ璐�", true) + } + } + }) + } + + // 鍑哄簱 + function pakOut() { + var tableData = layui.table.checkStatus('tableIdx').data; + if (tableData.length === 0) { + tips("璇烽�夋嫨鐗╂枡", true); + return; + } + var site = $('#staNoSelect').val(); + if (null === site || undefined === site || site === "") { + tips("璇烽�夋嫨鍑哄簱鍙�", true); + return; + } + $.ajax({ + url: baseUrl+"/plate/out/start", + headers: {'token': localStorage.getItem('token')}, + data: JSON.stringify({ + outSite: site, + locDetls: tableData + }), + contentType:'application/json;charset=UTF-8', + method: 'POST', + async: false, + success: function (res) { + if (res.code === 200) { + reset(); + tips("鍚姩鍑哄簱鎴愬姛") + } else if (res.code === 403) { + top.location.href = baseUrl + "/pda"; + } else { + tips(res.msg, true) + } + } + }) + } + + // 淇敼琛ㄦ牸鏁版嵁 + function updateTableData(data) { + for (var i=0;i<locDetlData.length;i++) { + if (data.matnr === locDetlData[i].matnr && data.locNo === locDetlData[i].locNo) { + locDetlData[i].count = data.count; + break + } + } + tableIns.reload({data: locDetlData}); + } + + // 鍒犻櫎琛ㄦ牸琛� + function removeTableData(data) { + for (var i = locDetlData.length - 1; i >= 0; i--) { + if (locDetlData[i].locNo === data.locNo && locDetlData[i].matnr === data.matnr) { + locDetlData.splice(i, 1); + } + } + tableIns.reload({data: locDetlData}); + } + + // 閲嶇疆 + function reset() { + $("#matNo").val(""); + $("#locNo").val(""); + locDetlData = []; + tableIns.reload({data: locDetlData}); + $('#staNoSelect').val(""); + layui.form.render('select'); + } + + /** + * 鎻愮ず淇℃伅 + * @param msg 鎻愮ず鍐呭 + * @param warn true锛氱孩鑹瞯ar瀛椾綋 + */ + function tips(msg, warn) { + layer.msg(msg, {icon: warn?2:1}) + } + + document.onkeyup = function (e) { + if (window.event)//濡傛灉window.event瀵硅薄瀛樺湪锛屽氨浠ユ浜嬩欢瀵硅薄涓哄噯 + e = window.event; + var key = e.charCode || e.keyCode; + if (key === 115) { + $("#pakOut").focus(); + pakOut(); + } else if (key === 113) { + $("#locNo").val(""); + $("#locNo").focus(); + } + } +</script> +<script type="text/template" id="takeSiteSelectTemplate"> + {{#each data}} + <option value="{{siteId}}">{{desc}}</option> + {{/each}} +</script> +</html> \ No newline at end of file -- Gitblit v1.9.1