From 918cf69e763d30a1315fa1c83a964dae4dd88f12 Mon Sep 17 00:00:00 2001
From: luxiaotao1123 <xltys1995>
Date: 星期六, 03 四月 2021 15:11:08 +0800
Subject: [PATCH] #

---
 src/main/webapp/views/pda/stockCheck.html |  189 ++++++++++++++++++++++++++--------------------
 1 files changed, 106 insertions(+), 83 deletions(-)

diff --git a/src/main/webapp/views/pda/stockCheck.html b/src/main/webapp/views/pda/stockCheck.html
index efda29a..8107089 100644
--- a/src/main/webapp/views/pda/stockCheck.html
+++ b/src/main/webapp/views/pda/stockCheck.html
@@ -59,6 +59,9 @@
         <label class="layui-form-label">璐т綅</label>
         <input class="layui-input" id="locNo" onkeyup="find(this)" placeholder="鎵爜 / 杈撳叆" autocomplete="off" style="width: 75%; height: 40px; margin-right: 0;">
     </div>
+    <div style="margin: 5px 5px">
+        <button id="replenish-btn" type="button" class="layui-btn layui-btn-normal" onclick="replenish()"><i class="layui-icon">+</i>琛ュ厖</button>
+    </div>
 </header>
 
 <!-- 涓讳綋 -->
@@ -69,7 +72,7 @@
 <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="comb-btn" class="layui-btn layui-btn-normal " onclick="check()" style="margin-left: 20px">纭</button>
         <span id="tips"></span>
     </div>
 </footer>
@@ -78,11 +81,11 @@
 <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%">
+        <input id="matnr" type="text" disabled="disabled" style="width: 70%">
     </div>
     <div class="form-item">
         <span>鍚嶇О</span>
-        <input id="matName" type="text" disabled="disabled" style="width: 70%">
+        <input id="maktx" type="text" disabled="disabled" style="width: 70%">
     </div>
     <div class="form-item" style="margin-top: 5px">
         <span style="vertical-align: middle">鏁伴噺</span>
@@ -95,9 +98,9 @@
 </div>
 </body>
 <script>
-    window.onload = function(){document.getElementById("code").focus();}
+    window.onload = function(){document.getElementById("locNo").focus();}
     var tableIns;
-    var countLayer;
+    var anfmeLayer;
     layui.use(['table','laydate', 'form'], function() {
         var table = layui.table;
         var $ = layui.jquery;
@@ -110,9 +113,9 @@
             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: '鐗╂枡鍚嶇О'}
+                {fixed: 'left', align: 'center', field: 'count', title: '鏁伴噺', event: 'modify', style:'font-weight: bold;', width:50},
+                {field: 'matnr', align: 'center', title: '鍟嗗搧缂栧彿', event: 'modify'},
+                {field: 'maktx', align: 'center', title: '鍟嗗搧鍚嶇О', event: 'modify'}
             ]],
             done: function (res, curr, count) {
             }
@@ -123,7 +126,7 @@
             var data = obj.data;
             switch (obj.event) {
                 case 'modify':
-                    countLayer = layer.open({
+                    anfmeLayer = layer.open({
                         type: 1,
                         offset: '20px',
                         title: '淇敼鏁伴噺',
@@ -131,10 +134,9 @@
                         area: ['80%', '200px'],
                         content: $("#modify"),
                         success: function (layero, index) {
-                            $('#matNo').val(data.matNo);
-                            $('#matName').val(data.matName);
+                            $('#matnr').val(data.matnr);
+                            $('#maktx').val(data.maktx);
                             $('#count').val(data.count);
-                            maxCount = data.count;
                         }
                     });
                     break;
@@ -143,26 +145,6 @@
 
     });
 
-    // 娣诲姞琛ㄦ牸鏁版嵁
-    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();
-    }
-
-
     /**
      * 鏍规嵁閫氱煡鍗曞彿鏌ヨ鐗╂枡璇︽儏
      */
@@ -170,18 +152,18 @@
         if (isEmpty(el.value)) {
             return;
         }
-        var billNo = el.value.split(",")[0].split("=")[1];
         $.ajax({
-            url: baseUrl + "/mobile/bill/query/auth",
+            url: baseUrl + "/locDetl/queryDetl/auth",
             headers: {'token': localStorage.getItem('token')},
             data: {
-                billNo: billNo
+                uuid: el.value
             },
-            method: 'POST',
+            method: 'GET',
             success: function (res) {
                 if (res.code === 200) {
                     if (res.data != null) {
-                        addTableData(res.data);
+                        locDetlData = [];
+                        initTableData(res.data);
                     }
                 } else if (res.code === 403) {
                     top.location.href = baseUrl + "/pda";
@@ -192,14 +174,43 @@
         })
     }
 
-    /*************************************  鏁伴噺  ****************************************/
-    var countDom = $('#count');
-    var minCount = 1;
-    var maxCount = 1;
-    function add() {
-        if (countDom.val() >= maxCount) {
+    // 娣诲姞琛ㄦ牸鏁版嵁
+    var locDetlData = [];
+    function initTableData(data) {
+        for (var i=0;i<data.length;i++) {
+            var toPush = true;
+            for (var j=0;j<locDetlData.length;j++){
+                if (data[i].matnr === locDetlData[j].matnr) {
+                    toPush  = false;
+                }
+            }
+            if (toPush) {
+                locDetlData.push(data[i]);
+            }
+        }
+        tableIns.reload({data: locDetlData});
+    }
+    function addTableData(data) {
+        if (isEmpty(data.matnr)){
+            tips("鎻愬彇澶辫触", true);
             return;
         }
+        var toPush = true;
+        for (var j=0;j<locDetlData.length;j++){
+            if (data.matnr === locDetlData[j].matnr) {
+                toPush  = false;
+            }
+        }
+        if (toPush) {
+            locDetlData.push(data);
+        }
+        tableIns.reload({data: locDetlData});
+    }
+
+    /*************************************  鏁伴噺  ****************************************/
+    var countDom = $('#count');
+    var minCount = 0;
+    function add() {
         countDom.val(Number(countDom.val()) + 1);
     }
     function reduce() {
@@ -211,38 +222,54 @@
 
     // 淇敼鏁伴噺
     function confirm(){
-        var matNo = $('#matNo').val();
+        var matnr = $('#matnr').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);
+        for (var j=0;j<locDetlData.length;j++){
+            if (matnr === locDetlData[j].matnr) {
+                if (count < minCount) {
+                    tips("鏁伴噺蹇呴』澶т簬0", true);
                     return;
                 }
-                matData[j].count = Number(count);
+                locDetlData[j].count = Number(count);
             }
         }
-        tableIns.reload({data: matData});
-        layer.close(countLayer);
+        tableIns.reload({data: locDetlData});
+        layer.close(anfmeLayer);
         tips("淇敼鎴愬姛");
     }
 
     // 绉婚櫎鐗╂枡
     function remove() {
-        var matNo = $('#matNo').val();
-        for (var j=0;j<matData.length;j++){
-            if (matNo === matData[j].matNo) {
-                matData.splice(j, 1);
+        var matnr = $('#matnr').val();
+        for (var j=0;j<locDetlData.length;j++){
+            if (matnr === locDetlData[j].matnr) {
+                locDetlData.splice(j, 1);
             }
         }
-        tableIns.reload({data: matData});
-        layer.close(countLayer);
+        tableIns.reload({data: locDetlData});
+        layer.close(anfmeLayer);
         tips("绉婚櫎鎴愬姛");
     }
 
 
 
-
+    /*************************************  琛ュ厖  ****************************************/
+    var matCodeLayerIdx;
+    function replenish() {
+        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();
+            }
+        });
+    }
 
 
 
@@ -260,36 +287,32 @@
 
     // 閲嶇疆
     function reset() {
-        $('#code').val("");
-        $('#billNo').val("");
-        matData = [];
-        tableIns.reload({data: matData});
+        $('#locNo').val("");
+        locDetlData = [];
+        tableIns.reload({data: locDetlData});
     }
 
-    // 缁勬墭
-    function comb() {
-        var barcode = $('#code').val();
-        if (isEmpty(barcode)) {
-            tips("鎵樼洏鏉$爜涓虹┖", true);
-            // document.getElementById("code").focus();
+    // 纭
+    function check() {
+        var locNo = $('#locNo').val();
+        if (isEmpty(locNo)) {
+            tips("璐т綅涓嶈兘涓虹┖", true);
             return;
         }
-        if (barcode.length !== 7) {
-            tips("鏉$爜蹇呴』涓�7浣�", true);
-            return;
+        if (locDetlData.length > 0) {
+            for (var i = 0; i<locDetlData.length; i++) {
+                if (locDetlData[i].count === null || locDetlData[i].count === 0) {
+                    tips(locDetlData[i].matnr + "鍟嗗搧鏁伴噺閿欒", true);
+                    return;
+                }
+            }
         }
-        if (matData.length === 0) {
-            tips("璇锋彁鍙栫墿鏂�", true);
-            return;
-        }
-        var billNo = $('#billNo').val();
         $.ajax({
-            url: baseUrl+"/mobile/comb/auth",
+            url: baseUrl+"/work/stock/check",
             headers: {'token': localStorage.getItem('token')},
             data: JSON.stringify({
-                barcode: barcode,
-                combMats: matData,
-                billNo: billNo
+                locNo: locNo,
+                dtos: locDetlData
             }),
             contentType:'application/json;charset=UTF-8',
             method: 'POST',
@@ -297,7 +320,7 @@
             success: function (res) {
                 if (res.code === 200) {
                     reset();
-                    tips("缁勬墭鎴愬姛")
+                    tips("鐩樼偣鎴愬姛")
                 } else if (res.code === 403) {
                     top.location.href = baseUrl + "/pda";
                 } else {
@@ -324,8 +347,8 @@
             $("#comb-btn").focus();
             comb();
         } else if (key === 113) {
-            $("#code").val("");
-            $("#code").focus();
+            $("#locNo").val("");
+            $("#locNo").focus();
         }
     }
 </script>

--
Gitblit v1.9.1