From 396c55df2e6117e66b95605dd628a1db27ad5341 Mon Sep 17 00:00:00 2001
From: chen.lin <1442464845@qq.com>
Date: 星期二, 27 一月 2026 18:58:29 +0800
Subject: [PATCH] 手动同步

---
 src/main/webapp/views/erpMaterialuse/materialuse.html |  148 +++++++++++++++++++++++++++++++++++++++----------
 1 files changed, 117 insertions(+), 31 deletions(-)

diff --git a/src/main/webapp/views/erpMaterialuse/materialuse.html b/src/main/webapp/views/erpMaterialuse/materialuse.html
index 6dca10f..1b51f67 100644
--- a/src/main/webapp/views/erpMaterialuse/materialuse.html
+++ b/src/main/webapp/views/erpMaterialuse/materialuse.html
@@ -69,7 +69,10 @@
                 <el-button type="primary" @click="fnPrintRed('鏄�')">鎵撳嵃(绾㈠瓧)</el-button>
             </el-form-item>
             <el-form-item label="">
-                <el-button type="primary" @click="fnCanelPrintRed()">鎾ら攢鐢熸垚(绾㈠瓧)</el-button>
+               <el-button type="primary" @click="fnCanelPrintRed()">鎾ら攢鐢熸垚(绾㈠瓧)</el-button>
+            </el-form-item>
+            <el-form-item label="">
+               <el-button type="success" @click="manualSync()">鎵嬪姩鍚屾</el-button>
             </el-form-item>
         </el-form>
         <el-table :data="tableData" border style="width: 100%" row-key="finterid" @selection-change="handleSelectionChange" max-height="650">
@@ -321,14 +324,89 @@
                         });
                         return ;
                     }
-                    ElementPlus.ElMessageBox.confirm('纭畾鎵撳嵃鍚�?')
-                        .then(() => {
-                            print(izPrint,0)
-                        })
-                        .catch(() => {
-                            // catch error
-                        })
-
+                    // 鎵撳嵃鍓嶇‘璁�
+                    if (izPrint === '鏄�') {
+                        ElementPlus.ElMessageBox.confirm('纭畾鎵撳嵃鍚�?')
+                            .then(() => {
+                                print(izPrint, 0);
+                            })
+                            .catch(() => {
+                                // 鍙栨秷
+                            });
+                    } else {
+                        print(izPrint, 0);
+                    }
+                }
+                
+                // 鎵嬪姩鍚屾
+                function manualSync() {
+                    if (selectList.value.length === 0){
+                        ElementPlus.ElMessage({
+                            message: "璇峰厛閫夋嫨瑕佸悓姝ョ殑鏁版嵁",
+                            type: 'error'
+                        });
+                        return ;
+                    }
+                    
+                    ElementPlus.ElMessageBox.confirm('纭畾瑕佸悓姝ラ�変腑鐨勬暟鎹埌WMS鍚�?', '鎻愮ず', {
+                        confirmButtonText: '纭畾',
+                        cancelButtonText: '鍙栨秷',
+                        type: 'warning'
+                    }).then(() => {
+                        const loading = ElementPlus.ElLoading.service({
+                            lock: true,
+                            text: '鍚屾涓�...',
+                            background: 'rgba(0, 0, 0, 0.7)',
+                        });
+                        
+                        // 鏋勫缓鍚屾鍙傛暟锛堜娇鐢ㄥ綋鍓嶆煡璇㈡潯浠讹級
+                        const syncParams = {
+                            startDate: null,
+                            endDate: null
+                        };
+                        
+                        if (tableSearchParam.value.fplancommitdate) {
+                            const date = new Date(tableSearchParam.value.fplancommitdate);
+                            syncParams.startDate = date.toISOString().split('T')[0];
+                            syncParams.endDate = date.toISOString().split('T')[0];
+                        }
+                        
+                        $.ajax({
+                            url: "http://127.0.0.1:8133/api/materialReceive/sync/manual",
+                            headers: {
+                                'token': localStorage.getItem('token')
+                            },
+                            data: syncParams,
+                            method: 'GET',
+                            success: function(res) {
+                                loading.close();
+                                if (res.code == 200) {
+                                    ElementPlus.ElMessage({
+                                        message: res.data.message || "鍚屾浠诲姟宸叉彁浜�",
+                                        type: 'success'
+                                    });
+                                    // 鍒锋柊鍒楄〃
+                                    setTimeout(() => {
+                                        page();
+                                    }, 2000);
+                                } else {
+                                    ElementPlus.ElMessage({
+                                        message: res.msg || "鍚屾澶辫触",
+                                        type: 'error'
+                                    });
+                                }
+                            },
+                            error: function() {
+                                loading.close();
+                                ElementPlus.ElMessage({
+                                    message: "鍚屾璇锋眰澶辫触",
+                                    type: 'error'
+                                });
+                            }
+                        });
+                    }).catch(() => {
+                        // 鍙栨秷
+                    });
                 }
 
                 function fnPrintView(izPrint){
@@ -339,7 +417,8 @@
                         });
                         return ;
                     }
-                    print(izPrint,0)
+                    // 鎵撳嵃棰勮鐩存帴璋冪敤鎵撳嵃鎺ュ彛锛堝悗绔笉鏍¢獙鍑哄簱瀹屾垚鐘舵�侊級
+                    print(izPrint, 0);
                 }
 
                 function fnPrintRedView(izPrint) {
@@ -350,7 +429,8 @@
                         });
                         return ;
                     }
-                    print(izPrint,1);
+                    // 鎵撳嵃棰勮鐩存帴璋冪敤鎵撳嵃鎺ュ彛锛堝悗绔笉鏍¢獙鍑哄簱瀹屾垚鐘舵�侊級
+                    print(izPrint, 1);
                 }
 
                 function fnPrintRed(izPrint) {
@@ -361,14 +441,18 @@
                         });
                         return ;
                     }
-                    ElementPlus.ElMessageBox.confirm('纭畾绾㈠瓧鎵撳嵃鍚�?')
-                        .then(() => {
-                            print(izPrint,1);
-                        })
-                        .catch(() => {
-                            // catch error
-                        })
-
+                    // 鎵撳嵃鍓嶇‘璁�
+                    if (izPrint === '鏄�') {
+                        ElementPlus.ElMessageBox.confirm('纭畾鎵撳嵃鍚�?')
+                            .then(() => {
+                                print(izPrint, 1);
+                            })
+                            .catch(() => {
+                                // 鍙栨秷
+                            });
+                    } else {
+                        print(izPrint, 1);
+                    }
                 }
 
                 function print(izPrint,izRed){
@@ -399,18 +483,16 @@
                                     type: 'success'
                                 });
                                 page()
-                                LODOP.PRINT_INITA(0,0,800,1100,"鐢熶骇棰嗘枡鍗�");
+                                LODOP.PRINT_INITA(0,0,800,1100,"鐢熸垚棰嗘枡鍗�");
                                 LODOP.SET_PRINT_PAGESIZE(1,0,0,"A4");
                                 LODOP.SET_PRINT_MODE("PRINT_NOCOLLATE",1);
                                 if(izRed==1)
                                 {
-                                    LODOP.ADD_PRINT_TEXT(28,268,331,36,"鐢熶骇棰嗘枡鍗曪紙绾㈠瓧锛�");
+                                    LODOP.ADD_PRINT_TEXT(28,268,331,36,"鐢熸垚棰嗘枡鍗曪紙绾㈠瓧锛�");
                                 }
                                 else{
-                                    LODOP.ADD_PRINT_TEXT(28,268,331,36,"鐢熶骇棰嗘枡鍗�");
+                                    LODOP.ADD_PRINT_TEXT(28,268,331,36,"鐢熸垚棰嗘枡鍗�");
                                 }
-
-
                                 LODOP.SET_PRINT_STYLEA(0,"FontSize",20);
                                 LODOP.SET_PRINT_STYLEA(0,"ItemType",1);
                                 LODOP.ADD_PRINT_TEXT(69,21,213,25,"鐢熶骇绾匡細"+depName.value);
@@ -430,9 +512,7 @@
                                 LODOP.SET_PRINT_STYLEA(0,"ItemType",1);
                                 LODOP.ADD_PRINT_TABLE(96,16,2000,960,CreateTable(res.data));
                                 LODOP.SET_PRINT_STYLEA(0,"TableHeightScope",1);
-
                                 LODOP.SET_PRINT_MODE("FULL_WIDTH_FOR_OVERFLOW",true);
-
                                 if(izPrint=="鏄�")
                                 {
                                     LODOP.PRINT();
@@ -440,17 +520,22 @@
                                 else{
                                     LODOP.PREVIEW();
                                 }
-
-
-//                    LODOP.PRINT_DESIGN();
                             } else if (res.code === 403) {
                                 top.location.href = baseUrl + "/";
                             } else {
-                                ElementPlus.ElMessage({
-                                    message: res.msg,
+                                // 鍚庣杩斿洖閿欒淇℃伅锛堟牎楠屽け璐ワ級
+                                ElementPlus.ElMessageBox.alert(res.msg || "鎵撳嵃澶辫触", '閿欒', {
+                                    confirmButtonText: '纭畾',
                                     type: 'error'
                                 });
                             }
+                        },
+                        error: function(xhr, status, error) {
+                            loading.close()
+                            ElementPlus.ElMessage({
+                                message: "鎵撳嵃璇锋眰澶辫触锛岃绋嶅悗閲嶈瘯",
+                                type: 'error'
+                            });
                         }
                     });
                 }
@@ -526,6 +611,7 @@
                     fnCanelPrintRed,
                     fnPrintRed,
                     fnPrintRedView,
+                    manualSync,
                     handleSizeChange,
                     handleCurrentChange,
                     handleSelectionChange

--
Gitblit v1.9.1