From 958883d6f4dac68fcbbccadb4e7f87e963eee0e8 Mon Sep 17 00:00:00 2001
From: zwl <1051256694@qq.com>
Date: 星期三, 09 七月 2025 12:32:40 +0800
Subject: [PATCH] 新增盘点提取库存后可以删除明细

---
 zy-asrs-wms/src/main/webapp/static/js/order/order.js |  207 ++++++++++++++++++++++++++++++++++++++++++++-------
 1 files changed, 176 insertions(+), 31 deletions(-)

diff --git a/zy-asrs-wms/src/main/webapp/static/js/order/order.js b/zy-asrs-wms/src/main/webapp/static/js/order/order.js
index 65e68c7..cb22c64 100644
--- a/zy-asrs-wms/src/main/webapp/static/js/order/order.js
+++ b/zy-asrs-wms/src/main/webapp/static/js/order/order.js
@@ -12,26 +12,26 @@
     var layDate = layui.laydate;
     var laytpl = layui.laytpl;
 
-    // // 娓叉煋鎼滅储妯℃澘
-    // $.ajax({
-    //     url: baseUrl+"/docType/page/auth",
-    //     headers: {'token': localStorage.getItem('token')},
-    //     data: {
-    //         limit: 9999
-    //     },
-    //     method: 'POST',
-    //     success: function (res) {
-    //         if (res.code === 200){
-    //             let template = Handlebars.compile($('#docTypeTpl').html());
-    //             $('#docType-query').html(template(res.data));
-    //             layui.form.render('select');
-    //         } else if (res.code === 403){
-    //             top.location.href = baseUrl+"/";
-    //         } else {
-    //             layer.msg(res.msg, {icon: 2})
-    //         }
-    //     }
-    // })
+    // 娓叉煋鎼滅储妯℃澘
+    $.ajax({
+        url: baseUrl+"/docType/page/auth",
+        headers: {'token': localStorage.getItem('token')},
+        data: {
+            limit: 9999
+        },
+        method: 'POST',
+        success: function (res) {
+            if (res.code === 200){
+                let template = Handlebars.compile($('#docTypeTpl').html());
+                $('#docType-query').html(template(res.data));
+                layui.form.render('select');
+            } else if (res.code === 403){
+                top.location.href = baseUrl+"/";
+            } else {
+                layer.msg(res.msg, {icon: 2})
+            }
+        }
+    })
 
     let docName = getQueryVariable('docName')
     let where = {};
@@ -49,13 +49,15 @@
         where: where,
         limit: 16,
         limits: [16, 30, 50, 100, 200, 500],
+        toolbar: '#toolbar',
         cols: [[
+            {type: 'checkbox', width: 70},
             {type: 'numbers'},
-            {field: 'orderNo', title: '鍗曟嵁缂栧彿', templet: '#orderNoTpl'},
-            {field: 'docType$', align: 'center', title: '绫诲瀷',  minWidth: 160, width: 160},
+            {field: 'orderNo', title: '鍗曟嵁缂栧彿', templet: '#orderNoTpl',sort:true},
+            {field: 'docType$', align: 'center', title: '绫诲瀷',  minWidth: 160, width: 160,sort:true},
             {align: 'center', title: '鏄庣粏', toolbar: '#tbLook', minWidth: 160, width: 160},
             {field: 'createTime$', title: '鍒涘缓鏃堕棿', minWidth: 200, width: 200},
-            {field: 'settle$', align: 'center', title: '鐘舵��', templet: '#settleTpl',  minWidth: 160, width: 160},
+            {field: 'settle$', align: 'center', title: '鐘舵��', templet: '#settleTpl',  minWidth: 160, width: 160,sort:true},
             {field: 'memo', align: 'center',title: '澶囨敞', hide: true},
             {align: 'center', title: '鎿嶄綔', toolbar: '#operate', width: 280}
         ]],
@@ -92,6 +94,113 @@
     $("#orderAddBtn").click(function () {
         showEditModel();
     });
+    // Excel瀵煎嚭
+    // 鐩戝惉澶村伐鍏锋爮浜嬩欢
+    table.on('toolbar(order)', function (obj) {
+        var data = table.checkStatus(obj.config.id).data;
+        switch (obj.event) {
+            case 'exportData':
+                layer.confirm('纭畾瀵煎嚭Excel鍚�', {shadeClose: true}, function(){
+                    var titles=[];
+                    var fields=[];
+
+                    titles.push("璁㈠崟缂栧彿");
+                    titles.push("鍝佸彿");
+                    titles.push("鍝佸悕");
+                    titles.push("璁㈠崟鏁伴噺");
+                    titles.push("瀹屾垚鏁伴噺");
+                    titles.push("浣滀笟涓暟閲�");
+                    titles.push("鍒涘缓鏃堕棿");
+
+                    fields.push("orderNo");
+                    fields.push("matnr");
+                    fields.push("maktx");
+                    fields.push("anfme");
+                    fields.push("qty");
+                    fields.push("workQty");
+                    fields.push("createTime$");
+
+
+                    var orderNos = [];
+                    data.forEach(function(elem) {
+                        console.log("elem="+elem.settle);
+                        if(elem.payType >0) {
+                            co = 1;
+                        }
+                        orderNos.push(elem.orderNo);
+                    });
+                    var param = {
+                        'orderNo': orderNos,
+                        'fields' : fields
+                    };
+                    $.ajax({
+                        url: baseUrl+"/order/export/auth",
+                        headers: {'token': localStorage.getItem('token')},
+                        data: JSON.stringify(param),
+                        dataType:'json',
+                        contentType:'application/json;charset=UTF-8',
+                        method: 'POST',
+                        success: function (res) {
+                            layer.closeAll();
+                            if (res.code === 200) {
+                                table.exportFile(titles,res.data,'xls');
+                            } else if (res.code === 403) {
+                                top.location.href = baseUrl+"/";
+                            } else {
+                                layer.msg(res.msg)
+                            }
+                        }
+                    });
+                });
+                break;
+        }
+    });
+    $("#orderExcel").click(function () {
+        var checkStatus = table.checkStatus(obj.config.id);
+        var data = checkStatus.data;
+        layer.confirm('纭畾瀵煎嚭Excel鍚�', {shadeClose: true}, function(){
+            if (data.length === 0){
+                layer.msg('璇烽�夋嫨鏁版嵁');
+            } else {
+                var titles=[];
+                var fields=[];
+                data.config.cols[0].map(function (col) {
+                    if (col.type === 'normal' && col.hide === false && col.toolbar == null) {
+                        titles.push(col.title);
+                        fields.push(col.field);
+                    }
+                });
+                var exportData = {};
+                $.each($('#search-box [name]').serializeArray(), function() {
+                    exportData[this.name] = this.value;
+                });
+                var param = {
+                    'wrkMast': exportData,
+                    'fields': fields
+                };
+                $.ajax({
+                    url: baseUrl+"/order/export/auth",
+                    headers: {'token': localStorage.getItem('token')},
+                    data: JSON.stringify(param),
+                    dataType:'json',
+                    contentType:'application/json;charset=UTF-8',
+                    method: 'POST',
+                    success: function (res) {
+                        layer.closeAll();
+                        if (res.code === 200) {
+                            table.exportFile(titles,res.data,'xls');
+                        } else if (res.code === 403) {
+                            top.location.href = baseUrl+"/";
+                        } else {
+                            layer.msg(res.msg)
+                        }
+                    }
+                });
+            }
+
+        });
+
+    });
 
     // 宸ュ叿鏉$偣鍑讳簨浠�
     table.on('tool(order)', function (obj) {
@@ -104,6 +213,8 @@
             showWrkTrace(data.id);
         } else if (layEvent === 'del') {
             doDel(data.id);
+        } else if (layEvent === 'dy') {
+            doDy(data.id);
         } else if (layEvent === 'complete') {
             doModify(data.id, 4);
         } else if (layEvent === 'cancel') {
@@ -159,12 +270,12 @@
                         cellMinWidth: 100,
                         cols: [[
                             {type: 'numbers'},
-                            {field: 'matnr', title: '鍟嗗搧缂栫爜', width: 160},
+                            {field: 'matnr', title: '鍝佸彿', width: 160},
                             {field: 'maktx', title: '鍟嗗搧鍚嶇О', width: 160},
                             {field: 'batch', title: '搴忓垪鐮�'},
                             {field: 'anfme', title: '鏁伴噺'},
-                            {field: 'qty', title: '浣滀笟鏁伴噺', style: 'font-weight: bold'},
-                            // {field: 'unit', title: '鍗曚綅'},
+                            {field: 'workQty', title: '浣滀笟鏁伴噺', style: 'font-weight: bold'},
+                            {field: 'qty', title: '瀹屾垚鏁伴噺'},
                             // {
                             //     field: 'createTime$', title: '鍒涘缓鏃堕棿', sort: true, templet: function (d) {
                             //         return util.toDateString(d.createTime);
@@ -172,7 +283,7 @@
                             // },
                             // {field: 'inQty', title: '宸插叆搴撻噺'},
                             // {field: 'color', title: '棰滆壊'},
-                            {field: 'origin', title: '浠撳簱鍙�'}
+                            {field: 'threeCode', title: '浠撳簱鍙�'}
                         ]],
                         request: {
                             pageName: 'curr',
@@ -311,8 +422,8 @@
                     cellMinWidth: 100,
                     cols: [[
                         {type: 'numbers', title: '#'},
-                        {field: 'matnr', title: '鍟嗗搧缂栫爜', width: 160},
-                        {field: 'maktx', title: '鍟嗗搧鍚嶇О', width: 200},
+                        {field: 'matnr', title: '鍝佸彿', width: 160},
+                        {field: 'maktx', title: '鍚嶇О', width: 200},
                         {field: 'batch', title: '搴忓垪鐮�', edit: true},
                         {field: 'specs', title: '瑙勬牸'},
                         {field: 'anfme', title: '鏁伴噺(淇敼)', style: 'color: blue;font-weight: bold', edit: true, minWidth: 110, width: 110},
@@ -503,6 +614,40 @@
         });
     }
 
+    // 鎵撳嵃
+    function doDy(orderId) {
+        layer.confirm('纭畾瑕佹墦鍗板悧锛�', {
+            shade: .1,
+            skin: 'layui-layer-admin'
+        }, function (i) {
+            layer.close(i);
+            layer.load(2);
+            $.ajax({
+                url: baseUrl+"/order/dy",
+                headers: {'token': localStorage.getItem('token')},
+                data: {
+                    orderId: orderId
+                },
+                method: 'POST',
+                success: function (res) {
+                    layer.closeAll('loading');
+                    if (res.code === 200){
+                        if (insTbCount === 0) {
+                            insTb.reload({page: {curr: 1}});
+                        } else {
+                            $(".layui-laypage-btn")[0].click();
+                        }
+                        layer.msg(res.msg, {icon: 1});
+                    } else if (res.code === 403){
+                        top.location.href = baseUrl+"/";
+                    }else {
+                        layer.msg(res.msg, {icon: 2});
+                    }
+                }
+            })
+        });
+    }
+
 
     // 淇敼璁㈠崟鐘舵��
     function doModify(orderId, settle) {
@@ -565,7 +710,7 @@
                                 var traceCharts = echarts.init(document.getElementById('wrkTraceCharts'));
                                 var traceOptions = {
                                     title: {
-                                        text: '浣滀笟/鎬婚噺', x: 'center', y: '38%',
+                                        text: '鎬婚噺/浣滀笟/瀹屾垚', x: 'center', y: '38%',
                                         textStyle: {fontSize: 18, color: '#262626', fontWeight: 'normal'},
                                         subtextStyle: {fontSize: 36, color: '#10B4E8'},
                                         itemGap: 20
@@ -578,7 +723,7 @@
                                 // 璧嬪��
                                 traceCharts.setOption({
                                     title: {
-                                        subtext: res.data.wrkQty+"/"+res.data.totalQty
+                                        subtext: res.data.totalQty+"/"+res.data.wrkQty+"/"+res.data.endQty
                                     },
                                     series: [
                                         {

--
Gitblit v1.9.1