From 29d65fc5654ce3501e947e07c85b8a39f66a0347 Mon Sep 17 00:00:00 2001
From: luxiaotao1123 <t1341870251@163.com>
Date: 星期四, 18 六月 2020 14:20:30 +0800
Subject: [PATCH] #

---
 src/main/webapp/static/js/pakStore/stockAdjust.js |   90 +++++++++++++++++++++++++++++++++++++++++++++
 src/main/webapp/views/pakStore/stockAdjust.html   |   12 +++++
 src/main/webapp/static/js/pakStore/pakStore.js    |    1 
 3 files changed, 101 insertions(+), 2 deletions(-)

diff --git a/src/main/webapp/static/js/pakStore/pakStore.js b/src/main/webapp/static/js/pakStore/pakStore.js
index ad04f6f..33dd887 100644
--- a/src/main/webapp/static/js/pakStore/pakStore.js
+++ b/src/main/webapp/static/js/pakStore/pakStore.js
@@ -90,7 +90,6 @@
     table.on('tool(chooseData)', function(obj){
         var data = obj.data;
         switch (obj.event) {
-            // 璇︽儏
             case 'remove':
                 for (var i = matCodeData.length - 1; i >= 0; i--) {
                     if (matCodeData[i].matNo === data.matNo) {
diff --git a/src/main/webapp/static/js/pakStore/stockAdjust.js b/src/main/webapp/static/js/pakStore/stockAdjust.js
index 47b6df3..2e4721f 100644
--- a/src/main/webapp/static/js/pakStore/stockAdjust.js
+++ b/src/main/webapp/static/js/pakStore/stockAdjust.js
@@ -31,6 +31,77 @@
         }
     });
 
+    // 椤甸潰淇敼
+    table.on('edit(chooseData)', function (obj) {
+        updateMatCodeData(obj.data.matNo, Number(obj.value));
+    });
+
+    // 鐩戝惉澶村伐鍏锋爮浜嬩欢
+    table.on('toolbar(chooseData)', function (obj) {
+        switch(obj.event) {
+            case 'adjust':
+                if (isEmpty(currLocNo)) {
+                    layer.msg("璇峰厛妫�绱㈠簱浣�")
+                    inputTip($("#searchLocNo"));
+                    return;
+                }
+                if (matCodeData.length === 0) {
+                    layer.msg("璇峰厛娣诲姞鐗╂枡");
+                    return;
+                }
+                for (var i=0;i<matCodeData.length;i++){
+                    if (isNaN(matCodeData[i].count)) {
+                        layer.msg("璇疯緭鍏ユ暟瀛�");
+                        return;
+                    }
+                    if (matCodeData[i].count < 0){
+                        layer.msg("鏁伴噺涓嶈兘灏忎簬闆�");
+                        return;
+                    }
+                }
+                layer.confirm('纭畾璋冩暣'+currLocNo+'搴撲綅鐨勬槑缁嗗悧锛�', {shadeClose: true}, function(){
+                    $.ajax({
+                        url: baseUrl+"/full/store/put/start",
+                        headers: {'token': localStorage.getItem('token')},
+                        data: JSON.stringify({
+                            devpNo: $('#putSiteSelect').val(),
+                            list: matCodeData
+                        }),
+                        contentType:'application/json;charset=UTF-8',
+                        method: 'POST',
+                        async: false,
+                        success: function (res) {
+                            if (res.code === 200){
+                                layer.msg("鍏ュ簱鍚姩鎴愬姛锛岀洰鏍囧簱浣嶏細" + res.data);
+                                matCodeData = [];
+                                tableIns.reload({data: matCodeData,done:function (res) { limit(); getInBound();}});
+                            } else if (res.code === 403){
+                                top.location.href = baseUrl+"/";
+                            }else {
+                                layer.msg(res.msg)
+                            }
+                        }
+                    })
+                });
+                break;
+        }
+    });
+
+    // 鐩戝惉琛屽伐鍏蜂簨浠�
+    table.on('tool(chooseData)', function(obj){
+        var data = obj.data;
+        switch (obj.event) {
+            case 'remove':
+                for (var i = matCodeData.length - 1; i >= 0; i--) {
+                    if (matCodeData[i].matNo === data.matNo) {
+                        matCodeData.splice(i, 1);
+                    }
+                }
+                tableIns.reload({data: matCodeData,done:function (res) {limit();}});
+                break;
+        }
+    });
+
     // 妫�绱簨浠�
     form.on('submit(search)', function (data) {
         let locNo = data.field.loc_no;
@@ -97,6 +168,25 @@
             currLocNo = null;
         }
     }
+
+    function updateMatCodeData(matNo, count) {
+        if (isNaN(count)) {
+            layer.msg("璇疯緭鍏ユ暟瀛�");
+        } else {
+            if (count > 0) {
+                for (var i=0;i<matCodeData.length;i++){
+                    if (matCodeData[i]["matNo"] === matNo){
+                        matCodeData[i]["count"] = count;
+                    }
+                }
+            } else {
+                layer.msg("鏁伴噺蹇呴』澶т簬闆�");
+            }
+        }
+        tableIns.reload({data: matCodeData,done:function (res) {
+                limit();
+            }});
+    }
 })
 
 // 鎻愬彇鐗╂枡
diff --git a/src/main/webapp/views/pakStore/stockAdjust.html b/src/main/webapp/views/pakStore/stockAdjust.html
index 04d7d76..2a50bd3 100644
--- a/src/main/webapp/views/pakStore/stockAdjust.html
+++ b/src/main/webapp/views/pakStore/stockAdjust.html
@@ -73,7 +73,7 @@
 <div id="search-box" class="layui-form layui-card-header">
     <div class="layui-inline">
         <div class="layui-input-inline">
-            <input id="searchLocNo" class="layui-input" type="text" name="loc_no" placeholder="搴撲綅鍙�" autocomplete="off"  style="height: 45px;border-color: #b8b8b8">
+            <input id="searchLocNo" value="0100202" class="layui-input" type="text" name="loc_no" placeholder="搴撲綅鍙�" autocomplete="off"  style="height: 45px;border-color: #b8b8b8">
         </div>
     </div>
     <!-- 寰呮坊鍔� -->
@@ -100,6 +100,16 @@
     <button id="mat-query" class="function-btn" onclick="getMat()">鏂板搴撳瓨</button>
 </div>
 
+<!-- 澶撮儴 -->
+<script type="text/html" id="toolbar">
+    <button class="layui-btn layui-btn-lg" id="btn-adjust" lay-event="adjust" style="">璋冩暣搴撳瓨</button>
+</script>
+
+<!-- 琛� -->
+<script type="text/html" id="operate">
+    <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="remove">绉婚櫎</a>
+</script>
+
 <!-- 琛ㄦ牸 -->
 <table class="layui-table" id="chooseData" lay-filter="chooseData"></table>
 

--
Gitblit v1.9.1