From 4ad1f324ab1fd2b51504afc00b43b4ee40f029c2 Mon Sep 17 00:00:00 2001
From: lsh <lsh@163.com>
Date: 星期四, 20 二月 2025 09:40:03 +0800
Subject: [PATCH] #

---
 src/main/webapp/static/js/pakStore/locCheckOut.js |   84 +++++++++++++++++++++++++++++++++--------
 1 files changed, 67 insertions(+), 17 deletions(-)

diff --git a/src/main/webapp/static/js/pakStore/locCheckOut.js b/src/main/webapp/static/js/pakStore/locCheckOut.js
index aeef93f..f8fb271 100644
--- a/src/main/webapp/static/js/pakStore/locCheckOut.js
+++ b/src/main/webapp/static/js/pakStore/locCheckOut.js
@@ -1,5 +1,7 @@
 var locDetlLayerIdx;
 var tableIns;
+var locDetlData = [];
+var admin;
 function getCol() {
     var cols = [
         {field: 'locNo', align: 'center',title: '搴撲綅鍙�', merge: true, style: 'font-weight: bold'}
@@ -16,7 +18,7 @@
     var layer = layui.layer;
     var layDate = layui.laydate;
     var form = layui.form;
-    var admin = layui.admin;
+    admin = layui.admin;
     var tableMerge = layui.tableMerge;
 
     tableIns = table.render({
@@ -36,25 +38,19 @@
 
     // 鐩戝惉澶村伐鍏锋爮浜嬩欢
     table.on('toolbar(chooseData)', function (obj) {
-        var data = locDetlData;
         switch (obj.event) {
             case 'outbound':
-                if (data.length === 0){
-                    layer.msg('璇峰厛娣诲姞搴撲綅鐗╂枡');
+                if (locDetlData.length === 0){
+                    layer.msg('璇峰厛娣诲姞鐩樼偣搴撳瓨', {icon: 2});
                 } else {
                     var staNo = $("#staNoSelect").val();
                     if (staNo === "" || staNo === null){
-                        layer.msg("璇烽�夋嫨鍑哄簱鍙�");
+                        layer.msg("璇烽�夋嫨鐩樼偣绔�", {icon: 2});
                         return;
                     }
-                    var locDetls = [];
-                    data.forEach(function(elem) {
-                        // locDetls.push({locNo: elem.locNo, matnr: elem.matnr, count: elem.count}); // todo
-                        locDetls.push({locNo: elem.locNo, matnr: elem.matnr});
-                    });
                     let param = {
                         outSite: staNo,
-                        locDetls: locDetls
+                        locDetls: locDetlData
                     }
                     $.ajax({
                         url: baseUrl+"/locCheck/out/start",
@@ -65,12 +61,12 @@
                         success: function (res) {
                             if (res.code === 200){
                                 locDetlData = [];
-                                tableIns.reload({data: locDetlData,done:function (res) {limit();getOutBound();}});
-                                layer.msg(res.msg);
+                                tableIns.reload({data: locDetlData});
+                                layer.msg(res.msg, {icon: 1});
                             } else if (res.code === 403){
                                 top.location.href = baseUrl+"/";
                             } else {
-                                layer.msg(res.msg)
+                                layer.msg(res.msg, {icon: 2})
                             }
                         }
                     });
@@ -122,10 +118,10 @@
 
 // 娣诲姞琛ㄦ牸鏁版嵁
 function addTableData(data) {
-    for (var i=0;i<data.length;i++){
+    for (let i=0;i<data.length;i++){
         let pass = false;
-        for (var j=0;j<locDetlData.length;j++){
-            if (data[i].matnr === locDetlData[j].matnr && data[i].locNo$ === locDetlData[j].locNo$) {
+        for (let j=0;j<locDetlData.length;j++){
+            if (data[i].matnr === locDetlData[j].matnr && data[i].batch === locDetlData[j].batch && data[i].locNo$ === locDetlData[j].locNo$) {
                 pass = true;
                 break;
             }
@@ -141,3 +137,57 @@
     tableIns.reload({data: locDetlData});
     layer.close(locDetlLayerIdx);
 }
+
+// excel瀵煎叆妯℃澘涓嬭浇
+function excelMouldDownload(){
+    layer.load(1, {shade: [0.1,'#fff']});
+    location.href = baseUrl + "/out/loc/box/excel/import/mould1";
+    layer.closeAll('loading');
+}
+
+// excel瀵煎叆
+function importExcel() {
+    $("#importExcel").trigger("click");
+}
+function upload(obj){
+    if(!obj.files) {
+        return;
+    }
+    var file = obj.files[0];
+    admin.confirm('纭鍚屾 [' + file.name +'] 鏂囦欢鍚楋紵', function (index) {
+        layer.load(1, {shade: [0.1,'#fff']});
+        var url = baseUrl + "/out/loc/box/excel/import/auth1";
+        var form = new FormData();
+        form.append("file", file);
+        xhr = new XMLHttpRequest();
+        xhr.open("post", url, true); //post鏂瑰紡锛寀rl涓烘湇鍔″櫒璇锋眰鍦板潃锛宼rue 璇ュ弬鏁拌瀹氳姹傛槸鍚﹀紓姝ュ鐞嗐��
+        xhr.setRequestHeader('token', localStorage.getItem('token'));
+        xhr.onload = uploadComplete; //璇锋眰瀹屾垚
+        xhr.onerror =  uploadFailed; //璇锋眰澶辫触
+        xhr.onloadend = function () { // // 涓婁紶瀹屾垚閲嶇疆鏂囦欢娴�
+            layer.closeAll('loading');
+            $("#importExcel").val("");
+        };
+        // xhr.upload.onprogress = progressFunction;//銆愪笂浼犺繘搴﹁皟鐢ㄦ柟娉曞疄鐜般��
+        xhr.upload.onloadstart = function(){//涓婁紶寮�濮嬫墽琛屾柟娉�
+            ot = new Date().getTime();   //璁剧疆涓婁紶寮�濮嬫椂闂�
+            oloaded = 0;//璁剧疆涓婁紶寮�濮嬫椂锛屼互涓婁紶鐨勬枃浠跺ぇ灏忎负0
+        };
+        xhr.send(form);
+    }, function(index){
+        $("#importExcel").val("");
+    });
+}
+function uploadComplete(evt) {
+    var res = JSON.parse(evt.target.responseText);
+    if(res.code === 200) {
+        layer.msg(res.msg, {icon: 1});
+        loadTree("");
+    } else {
+        layer.msg(res.msg, {icon: 2});
+    }
+}
+function uploadFailed(evt) {
+    var res = JSON.parse(evt.target.responseText);
+    layer.msg(res.msg, {icon: 2});
+}

--
Gitblit v1.9.1