From 4e32eae9008b56a346f52710d86241890a0ae1a7 Mon Sep 17 00:00:00 2001
From: zhou zhou <3272660260@qq.com>
Date: 星期四, 27 十一月 2025 19:59:00 +0800
Subject: [PATCH] #库存调整

---
 src/main/webapp/static/js/checkOrder/checkOrder.js |   66 ++++++++++++++++++++++++++++++--
 1 files changed, 61 insertions(+), 5 deletions(-)

diff --git a/src/main/webapp/static/js/checkOrder/checkOrder.js b/src/main/webapp/static/js/checkOrder/checkOrder.js
index 0f19c71..24cd161 100644
--- a/src/main/webapp/static/js/checkOrder/checkOrder.js
+++ b/src/main/webapp/static/js/checkOrder/checkOrder.js
@@ -96,6 +96,8 @@
             showEditModel(data);
         }else if (layEvent === 'createTask') {
             pakoutPreview(data.id);
+        }else if (layEvent === 'export') {
+            export1(data.id);
         }else if (layEvent === 'del') {
             doDel(data.id);
         } else if (layEvent === 'complete') {
@@ -330,10 +332,17 @@
                         var isDuplicate = false;
                         for (var j = 0; j < xxDataList.length; j++) {
                             if (xxDataList[j].locNo === data[i].locNo && xxDataList[j].matnr === data[i].matnr && xxDataList[j].batch === data[i].batch) {
-                                isDuplicate = true;
-                                duplicateCount++;
-                                break;
+                                if (xxDataList[j].diffQty !== 0){
+                                    isDuplicate = true;
+                                    duplicateCount++;
+                                    break;
+                                }
+
                             }
+                        }
+                        if (data[j].diffQty !== 0){
+                            isDuplicate = true;
+                            duplicateCount++;
                         }
                         // 濡傛灉涓嶉噸澶嶏紝鍒欐坊鍔犲埌鍒楄〃
                         if (!isDuplicate) {
@@ -344,7 +353,7 @@
                     insTbSSXM.reload({data: xxDataList, page: {curr: 1}});
                     // 鎻愮ず娣诲姞缁撴灉
                     if (duplicateCount > 0) {
-                        layer.msg('鎴愬姛娣诲姞 ' + addedCount + ' 鏉℃暟鎹紝' + duplicateCount + ' 鏉¢噸澶嶆暟鎹凡蹇界暐', {icon: 1});
+                        layer.msg('鎴愬姛娣诲姞 ' + addedCount + ' 鏉℃暟鎹紝' + duplicateCount + ' 鏉℃暟鎹凡蹇界暐', {icon: 1});
                     } else if (addedCount > 0) {
                         layer.msg('鎴愬姛娣诲姞 ' + addedCount + ' 鏉℃暟鎹�', {icon: 1});
                     }
@@ -601,6 +610,54 @@
         })
     }
 
+    function export1(id) {
+        notice.msg('姝e湪瀵煎嚭鏂囦欢......', {icon: 4});
+        $.ajax({
+            url: baseUrl + "/checkOrder/export/auth",
+            headers: {'token': localStorage.getItem('token')},
+            data: {
+                orderId: id
+            },
+            method: 'POST',
+            xhrFields: {
+                responseType: 'blob'
+            },
+            success: function (data, status, xhr) {
+                notice.destroy();
+                // 浠庡搷搴斿ご鑾峰彇鏂囦欢鍚�
+                var disposition = xhr.getResponseHeader('Content-Disposition');
+                var filename = '鐩樼偣宸紓鍗�.xlsx';
+                if (disposition && disposition.indexOf('filename') !== -1) {
+                    var filenameRegex = /filename[^;=\n]*=((['"]).*?\2|[^;\n]*)/;
+                    var matches = filenameRegex.exec(disposition);
+                    if (matches != null && matches[1]) {
+                        filename = decodeURIComponent(matches[1].replace(/['"]/g, ''));
+                    }
+                }
+                
+                // 鍒涘缓涓嬭浇閾炬帴
+                var blob = new Blob([data], {type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'});
+                var link = document.createElement('a');
+                link.href = window.URL.createObjectURL(blob);
+                link.download = filename;
+                document.body.appendChild(link);
+                link.click();
+                document.body.removeChild(link);
+                window.URL.revokeObjectURL(link.href);
+                
+                layer.msg('瀵煎嚭鎴愬姛', {icon: 1});
+            },
+            error: function (xhr, status, error) {
+                notice.destroy();
+                if (xhr.status === 403) {
+                    top.location.href = baseUrl + "/";
+                } else {
+                    layer.msg('瀵煎嚭澶辫触锛�' + error, {icon: 2});
+                }
+            }
+        });
+    }
+
     function pakout(tableCache, layerIndex) {
         // let loadIndex = layer.load(2);
         notice.msg('姝e湪鐢熸垚鐩樼偣鍑哄簱浠诲姟......', {icon: 4});
@@ -616,7 +673,6 @@
                     layer.close(layerIndex);
                     layer.msg(res.msg, {icon: 1});
                     insTb.reload({where: null});
-                    insTb2.reload({where: null, page: {curr: 1}});
                 } else if (res.code === 403) {
                     top.location.href = baseUrl + "/";
                 } else {

--
Gitblit v1.9.1