From 67da83c698e77ccf178669a31e4bd3a4e8fc1ca7 Mon Sep 17 00:00:00 2001
From: luxiaotao1123 <t1341870251@63.com>
Date: 星期二, 03 八月 2021 16:10:05 +0800
Subject: [PATCH] #

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

diff --git a/src/main/webapp/views/pda/locNormalIn.html b/src/main/webapp/views/pda/locNormalIn.html
index 73ad16d..f82101e 100644
--- a/src/main/webapp/views/pda/locNormalIn.html
+++ b/src/main/webapp/views/pda/locNormalIn.html
@@ -170,6 +170,7 @@
             <button onclick="add()">+</button>
         </div>
     </div>
+    <button id="remove" onclick="remove()">绉婚櫎</button>
     <button id="confirm" onclick="confirm()">淇濆瓨</button>
 </div>
 
@@ -273,17 +274,39 @@
         var count = $('#count').val();
         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 +384,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)
+                    }
+                },
+            });
+        }
     }
 
     /**

--
Gitblit v1.9.1