From 094ba2c92c77330da08ecfc145d37257374eaa11 Mon Sep 17 00:00:00 2001
From: luxiaotao1123 <t1341870251@163.com>
Date: 星期二, 23 六月 2020 10:19:17 +0800
Subject: [PATCH] #

---
 src/main/webapp/static/js/pakStore/stockAdjust.js |  103 ++++++++++++++++++++++++++++++++++-----------------
 1 files changed, 69 insertions(+), 34 deletions(-)

diff --git a/src/main/webapp/static/js/pakStore/stockAdjust.js b/src/main/webapp/static/js/pakStore/stockAdjust.js
index 2e4721f..e4c5f33 100644
--- a/src/main/webapp/static/js/pakStore/stockAdjust.js
+++ b/src/main/webapp/static/js/pakStore/stockAdjust.js
@@ -17,14 +17,19 @@
         cellMinWidth: 50,
         toolbar: '#toolbar',
         cols: [[
-            {fixed: 'left', field: 'count', title: '瀹為檯鏁伴噺', align: 'center', edit:'text', width: 120,  style:'color: blue;font-weight: bold'},
-            {field: 'anfme', align: 'center',title: '鏁伴噺'},
-            {field: 'matNo', align: 'center', title: '鐗╂枡缂栫爜'},
-            {field: 'barcode', align: 'center', title: '鏉$爜'},
-            {field: 'matName', align: 'center', title: '鐗╂枡鍚嶇О'},
-            {field: 'str1', align: 'center', title: '鐗╂枡鍗曚綅'},
-            {field: 'str2', align: 'center', title: '鐗╂枡瑙勬牸'},
-            {fixed: 'right', title:'鎿嶄綔', align: 'center', toolbar: '#operate', width:80}
+            {fixed: 'left', field: 'count', title: '瀹為檯鏁伴噺', align: 'center', edit:'text', width: 120,  style:'color: blue;font-weight: bold'}
+            ,{field: 'anfme', align: 'center',title: '鏁伴噺'}
+            ,{field: 'matnr', align: 'center',title: '鐗╂枡'}
+            // ,{field: 'lgnum', align: 'center',title: '浠撳簱鍙�'}
+            // ,{field: 'tbnum', align: 'center',title: '杞偍璇锋眰缂栧彿'}
+            // ,{field: 'tbpos', align: 'center',title: '琛岄」鐩�'}
+            // ,{field: 'zmatid', align: 'center',title: '鐗╂枡鏍囩ID'}
+            ,{field: 'maktx', align: 'center',title: '鐗╂枡鎻忚堪'}
+            // ,{field: 'werks', align: 'center',title: '宸ュ巶'}
+            ,{field: 'altme', align: 'center',title: '鍗曚綅'}
+            ,{field: 'zpallet', align: 'center',title: '鎵樼洏鏉$爜'}
+            // ,{field: 'bname', align: 'center',title: '鐢ㄦ埛ID'}
+            ,{fixed: 'right', title:'鎿嶄綔', align: 'center', toolbar: '#operate', width:80}
         ]],
         done: function (res, curr, count) {
             limit();
@@ -33,7 +38,7 @@
 
     // 椤甸潰淇敼
     table.on('edit(chooseData)', function (obj) {
-        updateMatCodeData(obj.data.matNo, Number(obj.value));
+        updateMatCodeData(obj.data.matnr, Number(obj.value));
     });
 
     // 鐩戝惉澶村伐鍏锋爮浜嬩欢
@@ -61,10 +66,10 @@
                 }
                 layer.confirm('纭畾璋冩暣'+currLocNo+'搴撲綅鐨勬槑缁嗗悧锛�', {shadeClose: true}, function(){
                     $.ajax({
-                        url: baseUrl+"/full/store/put/start",
+                        url: baseUrl+"/locDdetl/adjust/start",
                         headers: {'token': localStorage.getItem('token')},
                         data: JSON.stringify({
-                            devpNo: $('#putSiteSelect').val(),
+                            locNo: currLocNo,
                             list: matCodeData
                         }),
                         contentType:'application/json;charset=UTF-8',
@@ -72,9 +77,8 @@
                         async: false,
                         success: function (res) {
                             if (res.code === 200){
-                                layer.msg("鍏ュ簱鍚姩鎴愬姛锛岀洰鏍囧簱浣嶏細" + res.data);
-                                matCodeData = [];
-                                tableIns.reload({data: matCodeData,done:function (res) { limit(); getInBound();}});
+                                layer.msg(currLocNo + res.msg);
+                                init(currLocNo)
                             } else if (res.code === 403){
                                 top.location.href = baseUrl+"/";
                             }else {
@@ -93,7 +97,7 @@
         switch (obj.event) {
             case 'remove':
                 for (var i = matCodeData.length - 1; i >= 0; i--) {
-                    if (matCodeData[i].matNo === data.matNo) {
+                    if (matCodeData[i].matnr === data.matnr) {
                         matCodeData.splice(i, 1);
                     }
                 }
@@ -110,30 +114,34 @@
             layer.msg("璇疯緭鍏ュ簱浣嶅彿");
             return;
         }
-        http.post(baseUrl + "/locDetl/list/auth", {locNo: locNo,limit: 1000}, function (res) {
-            matCodeData = [];
-            let data = res.data.records;
-            for (var i = 0; i<data.length; i++) {
-                matCodeData.push({
-                    count: data[i].anfme,
-                    anfme: data[i].anfme,
-                    matNo: data[i].matnr,
-                    matName: data[i].maktx,
-
-                })
-            }
-            locTips(true, locNo);
-            tableReload();
-        })
+        init(locNo);
     });
 
     // 閲嶇疆浜嬩欢
     form.on('submit(reset)', function (data) {
+        reset();
+    });
+
+    function init(locNo) {
+        http.post(baseUrl + "/locDetl/list/auth", {locNo: locNo,limit: 1000}, function (res) {
+            matCodeData = [];
+            let data = res.data.records;
+            for (var i = 0; i<data.length; i++) {
+                data[i]["count"] = data[i].anfme;
+                data[i]["removeBtn"] = false;
+                matCodeData.push(data[i]);
+            }
+            locTips(true, locNo);
+            tableReload();
+        })
+    }
+
+    function reset() {
         clearFormVal($('#search-box'));
         matCodeData = [];
         tableReload();
         locTips(false);
-    });
+    }
 
     // 閲嶈浇琛ㄦ牸
     function tableReload() {
@@ -169,13 +177,13 @@
         }
     }
 
-    function updateMatCodeData(matNo, count) {
+    function updateMatCodeData(matnr, count) {
         if (isNaN(count)) {
             layer.msg("璇疯緭鍏ユ暟瀛�");
         } else {
-            if (count > 0) {
+            if (count >= 0) {
                 for (var i=0;i<matCodeData.length;i++){
-                    if (matCodeData[i]["matNo"] === matNo){
+                    if (matCodeData[i]["matnr"] === matnr){
                         matCodeData[i]["count"] = count;
                     }
                 }
@@ -216,3 +224,30 @@
         el.css("border-color", "#b8b8b8");
     }, 1000);
 }
+
+// 娣诲姞琛ㄦ牸鏁版嵁
+function addTableData(data) {
+    let applyData = [];
+    for (var i=0;i<data.length;i++){
+        let pass = false;
+        for (var j=0;j<matCodeData.length;j++){
+            if (data[i].matNo === matCodeData[j].matnr) {
+                pass = true;
+                break;
+            }
+        }
+        if (!pass) {
+            applyData.push({
+                count: initCountVal,
+                anfme: initAnfmeVal,
+                removeBtn: true,
+                matnr: data[i].matNo,
+                maktx: data[i].matName,
+                altme: data[i].str1,
+            })
+        }
+    }
+    matCodeData.push.apply(matCodeData,applyData);
+    tableIns.reload({data: matCodeData});
+    layer.close(matCodeLayerIdx);
+}
\ No newline at end of file

--
Gitblit v1.9.1