From fc51cbb9cd2514f7a9c2a22f41572666b5cbf1d9 Mon Sep 17 00:00:00 2001
From: chen.lin <1442464845@qq.com>
Date: 星期三, 28 一月 2026 16:14:43 +0800
Subject: [PATCH] 委外加工出库单同步+PDA出库功能

---
 src/main/webapp/views/erpMaterialwwout/materialwwout.html |  235 ++++++++++++++++++++++++++++++++++------------------------
 1 files changed, 136 insertions(+), 99 deletions(-)

diff --git a/src/main/webapp/views/erpMaterialwwout/materialwwout.html b/src/main/webapp/views/erpMaterialwwout/materialwwout.html
index 28a801b..3093a79 100644
--- a/src/main/webapp/views/erpMaterialwwout/materialwwout.html
+++ b/src/main/webapp/views/erpMaterialwwout/materialwwout.html
@@ -81,7 +81,9 @@
             <el-form-item label="">
                 <el-button type="primary" @click="dialogVisible = true">鏁版嵁鏌ヨ</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="id" @selection-change="handleSelectionChange" max-height="650">
             <el-table-column type="selection" >
@@ -498,14 +500,18 @@
                         });
                         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 fnPrintView(izPrint){
@@ -516,120 +522,153 @@
                         });
                         return ;
                     }
-
-
-
-                    print(izPrint,0)
+                    // 鎵撳嵃棰勮鐩存帴璋冪敤鎵撳嵃鎺ュ彛锛堝悗绔笉鏍¢獙鍑哄簱瀹屾垚鐘舵�侊級
+                    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)',
+                        });
+                        
+                        // 浼樺厛浣跨敤閫変腑鐨勬暟鎹垪琛ㄨ繘琛屽悓姝�
+                        $.ajax({
+                            url: "http://127.0.0.1:8133/api/materialWwOut/sync/manual",
+                            headers: {
+                                'token': localStorage.getItem('token')
+                            },
+                            data: JSON.stringify({
+                                wwRecords: JSON.stringify(selectList.value)
+                            }),
+                            contentType: 'application/json;charset=UTF-8',
+                            method: 'POST',
+                            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 print(izPrint,izRed){
                     const LODOP = getLodop()
-
                     const loading = ElementPlus.ElLoading.service({
                         lock: true,
                         text: 'Loading',
                         background: 'rgba(0, 0, 0, 0.7)',
                     })
-                    let data = JSON.parse(JSON.stringify(tableSearchParam.value))
-                    data.curr = currentPage.value
-                    data.limit = pageSize.value
-                    if (tableSearchParam.value.datetime != null) {
-                        data.datetime = null
-                        data.create_time = tableSearchParam.value.datetime[0] + " - " + tableSearchParam.value.datetime[1]
-                    }
                     $.ajax({
-                        url: "http://127.0.0.1:8133/mo/materialwwout/updateprint",
+                        url:"http://127.0.0.1:8133/mo/materialwwout/print",
                         headers: {
                             'token': localStorage.getItem('token')
                         },
-                        data: data,
+                        data: JSON.stringify({
+                            wwRecords : JSON.stringify(selectList.value),
+                            izPrint : izPrint,
+                            izRed : izRed
+                        }),
                         dataType: 'json',
                         contentType: 'application/json;charset=UTF-8',
-                        method: 'GET',
+                        method: 'POST',
                         success: function(res) {
                             loading.close()
                             if (res.code == 200) {
                                 ElementPlus.ElMessage({
-                                    message: "鎵撳嵃鐘舵�佹洿鏂版垚鍔燂紒",
+                                    message: "鑾峰彇鏁版嵁瀹屾垚,绛夊緟鍞よ捣鎵撳嵃",
                                     type: 'success'
                                 });
-
+                                page()
+                                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,"濮斿鍔犲伐鍑哄簱鍗曪紙绾㈠瓧锛�");
+                                }
+                                else{
+                                    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);
+                                LODOP.SET_PRINT_STYLEA(0,"FontSize",12);
+                                LODOP.SET_PRINT_STYLEA(0,"ItemType",1);
+                                LODOP.ADD_PRINT_TEXT(70,268,213,25,"寮�宸ユ棩鏈燂細"+dateFormat("YYYY-mm-dd", tableSearchParam.value.dateStart)+" 鍒� "+dateFormat("YYYY-mm-dd", tableSearchParam.value.dateEnd));
+                                LODOP.SET_PRINT_STYLEA(0,"FontSize",12);
+                                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);
+                                // 鏍规嵁izPrint鍙傛暟鍐冲畾鏄墦鍗拌繕鏄瑙�
+                                // izPrint=="鏄�"锛氱洿鎺ユ墦鍗帮紝寮瑰嚭鎵撳嵃瀵硅瘽妗嗭紙涓嶅脊鍑洪瑙堢獥鍙o級
+                                // izPrint=="鍚�"锛氭墦鍗伴瑙堬紝寮瑰嚭棰勮绐楀彛
+                                if(izPrint=="鏄�")
+                                {
+                                    LODOP.PRINT();
+                                }
+                                else{
+                                    // 鎵撳嵃棰勮锛屽脊鍑洪瑙堢獥鍙�
+                                    LODOP.PREVIEW();
+                                }
                             } 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'
+                            });
                         }
                     });
-
-                    var gridData = [];
-                    var listVen=[];
-                    for(var i=0; i<selectList.value.length; i++) {
-                        var curRowData = selectList.value[i]
-
-                        var izExist=false;
-                        for (var j = 0; j < listVen.length; j++) {
-                            if(curRowData.venId === listVen[j].venId)
-                            {
-                                izExist=true;
-                                break;
-                            }
-                        }
-                        if(izExist === false)
-                        {
-                            var o={};
-                            o.venId=curRowData.venId;
-                            o.venName=curRowData.venName;
-                            listVen.push(o);
-                        }
-                        gridData.push(curRowData);
-                    }
-
-
-                    LODOP.PRINT_INITA(0,0,800,1100,"濮斿鍔犲伐鍑哄簱鍗�");
-//        LODOP.SET_PRINT_PAGESIZE(1,0,0,"A5");
-//        LODOP.SET_PRINT_PAGESIZE(1,870,520,"");
-
-//        LODOP.PRINT_INITA(0,0,800,500,"濮斿鍔犲伐鍑哄簱鍗�");
-//        LODOP.SET_PRINT_PAGESIZE(1,800,500,"");
-                    LODOP.SET_PRINT_MODE("PRINT_NOCOLLATE",1);
-
-
-                    LODOP.ADD_PRINT_TEXT(28,375,331,36,"濮斿鍔犲伐鍑哄簱鍗�");
-                    LODOP.SET_PRINT_STYLEA(0,"FontSize",20);
-                    LODOP.SET_PRINT_STYLEA(0,"ItemType",1);
-                    LODOP.ADD_PRINT_TEXT(69,128,413,25,"寮�宸ユ棩鏈燂細"+dateFormat("YYYY-mm-dd", tableSearchParam.value.dateStart)+" 鍒� "+dateFormat("YYYY-mm-dd", tableSearchParam.value.dateEnd));
-                    LODOP.SET_PRINT_STYLEA(0,"FontSize",12);
-                    LODOP.SET_PRINT_STYLEA(0,"ItemType",1);
-
-
-                    LODOP.ADD_PRINT_TEXT(69,451,196,25,"鍗曟嵁鏃ユ湡锛�"+dateFormat("YYYY-mm-dd", new Date()));
-                    LODOP.SET_PRINT_STYLEA(0,"FontSize",12);
-                    LODOP.SET_PRINT_STYLEA(0,"ItemType",1);
-                    LODOP.ADD_PRINT_TEXT(69,645,176,25,"鍙戞枡浜猴細");
-                    LODOP.SET_PRINT_STYLEA(0,"FontSize",12);
-                    LODOP.SET_PRINT_STYLEA(0,"ItemType",1);
-
-                    LODOP.ADD_PRINT_TABLE(96,123,2000,960,CreateTable(gridData));
-                    LODOP.SET_PRINT_STYLEA(0,"TableHeightScope",1);
-
-                    LODOP.SET_PRINT_MODE("FULL_WIDTH_FOR_OVERFLOW",true);
-
-
-                    LODOP.PRINT_DESIGN();
-                    //        if(izPrint=="鏄�")
-                    //        {
-                    //            LODOP.PRINT();
-                    //        }
-                    //        else{
-                    //            LODOP.PREVIEW();
-                    //        }
-
                 }
 
                 function dateFormat(fmt, date) {
@@ -653,27 +692,24 @@
                 }
 
                 function  CreateTable(result) {
-//        var css =" <style> table,td,th {border: 1px solid black;border-style: solid;border-collapse: collapse;font-size: 15px;}</style><table border=1>";
-                    var css = "<style> table,td,th {table-layout: fixed;border: 1px black solid;border-collapse: collapse;font-size: 15px;}</style><table>";
+                    var css = "<style> table,td,th {table-layout: fixed;border: 1px black solid;border-collapse: collapse;font-size: 13px;}</style><table>";
                     //绗竴琛�
-                    var th = "<thead><tr style='height:30px'>" +
+                    var th = "<thead><tr style='height:20px'>" +
                         "<th  >搴忓彿</th>" +
                         "<th  >渚涘簲鍟�</th>" +
                         "<th  >鐗╂枡缂栫爜</th>" +
                         "<th  >鐗╂枡鍚嶇О</th>" +
-                        "<th  >鐗╂枡瑙勬牸</th>" +
+                        "<th >瑙勬牸</th>" +
                         "<th  >鍗曚綅</th>" +
                         "<th  >浠撳簱</th>" +
                         "<th  >搴斿彂鏁伴噺</th>" +
-                        "<th  >鏈彂鏁伴噺</th>" +
                         "<th  >瀹炲彂鏁伴噺</th>" +
                         "</tr></thead>";
 
                     var td="";
                     var row=1;
                     for (var i = 0; i <result.length; i++) {
-
-                        td = td+"<tr style='height:30px'><td style='width:30px;' align='center' >"+(row)+"</td><td style='width:170px;word-wrap:break-word;word-break:break-all;'  align='left'  >" + result[i].venName + "</td><td style='width:90px;'  align='left'  >" + result[i].invCode + "</td><td style='width:110px;word-wrap:break-word;word-break:break-all;'  align='left'  >" + result[i].invName + "</td> <td style='width:60px;'  align='left'  >" + result[i].invStd + "</td>  <td style='width:40px;'  align='left'  >" + result[i].unit + "</td><td style='width:80px;'  align='left'  >" + result[i].whName + "</td> <td style='width:60px;'  align='left'  >" + result[i].fqty + "</td> <td style='width:60px;'  align='left'  >" + result[i].wqty + "</td> <td style='width:60px;'  align='left'  ></td>  </tr>"
+                        td = td+"<tr style='height:20px'><td style='width:30px;' align='center' >"+(row)+"</td><td style='width:170px;word-wrap:break-word;word-break:break-all;'  align='left'  >" + (result[i].venName || '') + "</td><td style='width:80px;'  align='left'  >" + (result[i].invCode || '') + "</td><td style='width:250px;word-wrap:break-word;word-break:break-all;'  align='left'  >" + (result[i].invName || '') + "</td>  <td style='width:50px;'  align='left'  >" + (result[i].invStd || '') + "</td> <td style='width:35px;'  align='left'  >" + (result[i].unit || '') + "</td><td style='width:80px;'  align='left'  >" + (result[i].whName || '') + "</td><td style='width:60px;'  align='left'  >" + (result[i].fqty || 0) + "</td><td style='width:60px;'  align='left'  ></td>   </tr>"
                         row++;
                     }
 
@@ -731,6 +767,7 @@
                     fnCanelPrint,
                     fnTongBu,
                     fnCanelTongBu,
+                    manualSync,
                     handleSizeChange,
                     handleCurrentChange,
                     handleSelectionChange,

--
Gitblit v1.9.1