From 52c94f01b291968f331fc0d2def2f7dd885609cb Mon Sep 17 00:00:00 2001
From: zjj <3272660260@qq.com>
Date: 星期三, 03 四月 2024 09:01:20 +0800
Subject: [PATCH] #平转立

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

diff --git a/src/main/webapp/views/pda/locNormalIn.html b/src/main/webapp/views/pda/locNormalIn.html
index 73ad16d..d7b1f90 100644
--- a/src/main/webapp/views/pda/locNormalIn.html
+++ b/src/main/webapp/views/pda/locNormalIn.html
@@ -96,17 +96,24 @@
         </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>
+    <!--<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>
+    <div class="layui-btn-group demoTable">
+        <div class="layui-inline">
+            <input class="layui-input" name="id" id="demoReload" autocomplete="off" placeholder="鐢熶骇鍗曞彿">
+        </div>
+        <button class="layui-btn" data-type="reload">鎼滅储</button>
+        <button class="layui-btn" data-type="getCheckData">鎻愬彇</button>
+    </div>
     <table class="layui-table" id="chooseData" lay-filter="chooseData"></table>
 </main>
+
 <!-- 灏鹃儴 -->
 <footer>
     <div class="layui-btn-container">
@@ -170,6 +177,7 @@
             <button onclick="add()">+</button>
         </div>
     </div>
+    <button id="remove" onclick="remove()">绉婚櫎</button>
     <button id="confirm" onclick="confirm()">淇濆瓨</button>
 </div>
 
@@ -182,6 +190,21 @@
         var layer = layui.layer;
         var form = layui.form;
 
+        var $$ = layui.$, active = {
+            getCheckData: function(){ //鑾峰彇閫変腑鏁版嵁
+                var checkStatus = table.checkStatus('chooseData')
+                    ,data = checkStatus.data;
+                matData = data
+                tableIns.reload({data: matData});
+            },
+            reload: function () {
+                findMata();
+            }
+        };
+        $$('.demoTable .layui-btn').on('click', function(){
+            var type = $(this).data('type');
+            active[type] ? active[type].call(this) : '';
+        });
         document.getElementById("billNo").focus();
 
         tableIns = table.render({
@@ -191,6 +214,7 @@
             limit: 500,
             cellMinWidth: 50,
             cols: [[
+                {type: 'checkbox'},
                 {field: 'matNo', align: 'center', title: '鐗╂枡缂栫爜', event: 'modify'},
                 {field: 'mnemonic', align: 'center', title: '鐢熶骇鍗曞彿', event: 'modify'},
                 {field: 'count', align: 'center', title: '鏁伴噺', style: 'color: blue', width: 50, event: 'modify'},
@@ -224,6 +248,7 @@
             }
         });
 
+
         var areaType = getQueryVariable('areaType');
         // 鑾峰彇浠撳簱涓嬫媺
         $.ajax({
@@ -249,6 +274,7 @@
         });
     });
 
+
     /*************************************  鏁伴噺  ****************************************/
     var countDom = $('#count');
     var minCount = 1;
@@ -271,19 +297,49 @@
     function confirm() {
         var matNo = $('#matNo').val();
         var count = $('#count').val();
+        if (count > maxCount) {
+            alert("鏁伴噺涓嶈兘瓒呰繃" + maxCount);
+            return;
+        }
+        if (count < minCount) {
+            alert("鏁伴噺涓嶈兘浣庝簬" + minCount);
+            return;
+        }
         var mnemonic = $("#mnemonic").val() === '' ? null : $("#mnemonic").val();
         for (var j = 0; j < matData.length; j++) {
-            if (matNo === matData[j].matNo && mnemonic === matData[j].mnemonic) {
-                if (count > maxCount || count < minCount) {
-                    tips("鏁伴噺涓嶈兘瓒呰繃鑼冨洿", true);
-                    return;
+            if (mnemonic) {
+                if (matNo === matData[j].matNo && mnemonic === matData[j].mnemonic) {
+                    matData[j].count = Number(count);
                 }
-                matData[j].count = Number(count);
+            } else {
+                if (matNo === matData[j].matNo) {
+                    matData[j].count = Number(count);
+                }
             }
         }
         tableIns.reload({data: matData});
         layer.close(countLayer);
         tips("淇敼鎴愬姛");
+    }
+
+    function remove() {
+        var matnr = $('#matNo').val();
+        var index = $('#index').val();
+        var mnemonic = $("#mnemonic").val() === '' ? null : $("#mnemonic").val();
+        for (var j = 0; j < matData.length; j++) {
+            if (mnemonic) {
+                if (matnr === matData[j].matNo && mnemonic === matData[j].mnemonic) {
+                    matData.splice(j, 1);
+                }
+            } else {
+                if (matnr === matData[j].matNo) {
+                    matData.splice(j, 1);
+                }
+            }
+        }
+        tableIns.reload({data: matData});
+        layer.close(countLayer);
+        tips("绉婚櫎鎴愬姛");
     }
 
     window.onload = function () {
@@ -361,26 +417,50 @@
         });
 
         // 璇锋眰淇濆瓨鎺ュ彛
-        $.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)
-                }
-            },
-        });
+        var areaType = getQueryVariable('areaType');
+        if (areaType == 1) {
+            $.ajax({
+                url: baseUrl + "/locNormal/in/source",
+                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)
+                    }
+                },
+            });
+        } else {
+            $.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)
+                    }
+                },
+            });
+        }
     }
 
     /**
@@ -402,7 +482,49 @@
             url: baseUrl + "/mobile/bill/query/auth",
             headers: {'token': localStorage.getItem('token')},
             data: {
-                billNo: billNo
+                billNo: billNo,
+                mnemonic: '',
+            },
+            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)
+                }
+            }
+        });
+    }
+    function findMata() {
+        var billNo = $('#billNo').val()
+        if (isEmpty(billNo)) {
+            return;
+        }
+        if (billNo.indexOf('=') > -1) {
+            billNo = billNo.split(",")[0].split("=")[1];
+        }
+        var mnemonic = $('#demoReload').val();
+        // 璧嬪�煎墠娓呯┖琛ㄦ牸
+        matData = [];
+        tableIns.reload({data: matData});
+        console.log(billNo)
+        console.log(mnemonic)
+        $.ajax({
+            url: baseUrl + "/mobile/bill/query/auth",
+            headers: {'token': localStorage.getItem('token')},
+            data: {
+                billNo: billNo,
+                mnemonic: mnemonic,
             },
             method: 'POST',
             success: function (res) {
@@ -458,6 +580,7 @@
         layer.closeAll();
         $("#billNo").val("");
         $("#uuid").val("");
+        $("#demoReload").val("");
         layui.form.render('select');
     }
 </script>

--
Gitblit v1.9.1