From 91f2cd5b0f832091f654cce926585d2f05cad114 Mon Sep 17 00:00:00 2001
From: luxiaotao1123 <xltys1995>
Date: 星期四, 08 四月 2021 23:22:32 +0800
Subject: [PATCH] Merge branches 'dev' and 'master' of https://gitee.com/luxiaotao1123/xtywms into master

---
 src/main/webapp/views/pda/locNormalIn.html |  296 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 296 insertions(+), 0 deletions(-)

diff --git a/src/main/webapp/views/pda/locNormalIn.html b/src/main/webapp/views/pda/locNormalIn.html
new file mode 100644
index 0000000..4b50791
--- /dev/null
+++ b/src/main/webapp/views/pda/locNormalIn.html
@@ -0,0 +1,296 @@
+<!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 class="layui-form">
+    <div>
+        <div class="layui-input-inline">
+            <label class="layui-form-label">鍗曞彿</label>
+            <div class="layui-input-inline" style="width: 175px">
+                <input id="billNo" class="layui-input" autocomplete="off" oninput="find(this)">
+            </div>
+        </div>
+    </div>
+    <div>
+        <div class="layui-input-inline">
+            <label class="layui-form-label">搴撳尯</label>
+            <div class="layui-input-inline" style="width: 175px">
+                <select id="uuid">
+                    <option value="">璇烽�夋嫨</option>
+                </select>
+            </div>
+        </div>
+    </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>
+        <button type="button" id="retrun-btn" class="layui-btn layui-btn-primary " onclick="back()"
+                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;
+
+        document.getElementById("billNo").focus();
+
+        tableIns = table.render({
+            elem: '#chooseData',
+            data: [],
+            width: 320,
+            limit: 500,
+            cellMinWidth: 50,
+            cols: [[
+                {field: 'matNo', align: 'center', title: '鐗╂枡缂栫爜'},
+                {field: 'mnemonic', align: 'center', title: '鐢熶骇鍗曞彿'},
+                { field: 'count', align: 'center', title: '鏁伴噺', style: 'color: blue', width: 50},
+                {field: 'matName', align: 'center', title: '鐗╂枡鍚嶇О'},
+
+            ]],
+            done: function (res, curr, count) {
+            }
+        });
+
+        var areaType = getQueryVariable('areaType');
+        // 鑾峰彇浠撳簱涓嬫媺
+        $.ajax({
+            url: baseUrl + "/locArea/queryAll/auth?areaType=" + (areaType ? areaType : ""),
+            headers: {'token': localStorage.getItem('token')},
+            method: 'POST',
+            success: function (res) {
+                if (res.code === 200) {
+                    var html = "";
+                    if (res.data && res.data.length > 0) {
+                        html += res.data.map(function (item) {
+                            return "<Option value=" + item.uuid + ">" + item.name + "</Option>";
+                        });
+                    }
+                    $('#uuid').append(html);
+                    layui.form.render('select');
+                } else if (res.code === 403) {
+                    top.location.href = baseUrl + "/";
+                } else {
+                    layer.msg(res.msg)
+                }
+            }
+        });
+    });
+
+    window.onload = function () {
+        document.getElementById("uuid").focus();
+    }
+
+    var matCodeLayerIdx;
+
+    function getMat() {
+        matCodeLayerIdx = layer.open({
+            type: 2,
+            title: '鎻愬彇鐗╂枡',
+            shade: [0.3, '#000'],
+            area: ['90%', '90%'],
+            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 comb() {
+        let barcode = $('#uuid').val();
+        console.log('barcode', barcode);
+        if (isEmpty(barcode)) {
+            tips("璇烽�夋嫨搴撳尯", true);
+            document.getElementById("uuid").focus();
+            return;
+        }
+        if (matData.length === 0) {
+            tips("璇锋彁鍙栫墿鏂�", true);
+            return;
+        }
+
+        // 鏋勯�犲钩浠撳叆搴撴暟鎹�
+        var data = []
+        matData.map(function (item) {
+            data.push({
+                matnr: item.matNo,
+                maktx: item.matName,
+                anfme: item.count,
+                warehouse: barcode,
+                mnemonic: item.mnemonic,
+                supplier: item.supplier,
+                lgnum: item.lgnum,
+                type: item.type,
+                altme: item.altme,
+            });
+        });
+
+        // 璇锋眰淇濆瓨鎺ュ彛
+        $.ajax({
+            url: baseUrl + "/locNormal/pda/in",
+            headers: {'token': localStorage.getItem('token')},
+            data: JSON.stringify({
+                normalList: data,
+            }),
+            contentType: 'application/json;charset=UTF-8',
+            method: 'POST',
+            async: false,
+            success: function (res) {
+                if (res.code === 200) {
+                    reset(true);
+                    tips("缁勬墭鎴愬姛")
+                } else if (res.code === 403) {
+                    top.location.href = baseUrl + "/pda";
+                } else {
+                    tips(res.msg, true)
+                }
+            },
+        });
+    }
+
+    /**
+     * 鏍规嵁閫氱煡鍗曞彿鏌ヨ鐗╂枡璇︽儏
+     */
+    function find(el) {
+        var billNo = el.value;
+        if (isEmpty(billNo)) {
+            return;
+        }
+        if (billNo.indexOf('=') > -1) {
+            billNo = billNo.split(",")[0].split("=")[1];
+        }
+        // 璧嬪�煎墠娓呯┖琛ㄦ牸
+        matData = [];
+        tableIns.reload({data: matData});
+
+        $.ajax({
+            url: baseUrl + "/mobile/bill/query/auth",
+            headers: {'token': localStorage.getItem('token')},
+            data: {
+                billNo: billNo
+            },
+            method: 'POST',
+            success: function (res) {
+                if (res.code === 200) {
+                    if (res.data != null) {
+                        console.log('鍗曞彿鏁版嵁', res.data);
+                        var data = res.data;
+                        if (data.length > 0) {
+                            for (var i = 0; i < data.length; i++) {
+                                addTableData(data[i]);
+                            }
+                        }
+                    }
+                } 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) {
+            $("#uuid").val("");
+            $("#uuid").focus();
+        }
+    }
+
+    function back() {
+        parent.backIndex();
+    }
+
+    // 閲嶇疆
+    function reset() {
+        matData = [];
+        tableIns.reload({data: matData});
+        layer.closeAll();
+        $("#billNo").val("");
+        $("#uuid").val("");
+        layui.form.render('select');
+    }
+</script>
+</html>
\ No newline at end of file

--
Gitblit v1.9.1