From c923a3aca3cfb4da23eca4666ad7367b8aa3f217 Mon Sep 17 00:00:00 2001
From: luxiaotao1123 <t1341870251@163.com>
Date: 星期四, 25 三月 2021 09:22:06 +0800
Subject: [PATCH] #

---
 src/main/webapp/static/js/pakout/pakout.js |   99 +++++++++++++++++++++++++++++++++++++++++++++----
 1 files changed, 90 insertions(+), 9 deletions(-)

diff --git a/src/main/webapp/static/js/pakout/pakout.js b/src/main/webapp/static/js/pakout/pakout.js
index 3bec522..76957a9 100644
--- a/src/main/webapp/static/js/pakout/pakout.js
+++ b/src/main/webapp/static/js/pakout/pakout.js
@@ -21,13 +21,12 @@
             {type: 'checkbox'}
 //            ,{field: 'id', title: 'ID', sort: true,align: 'center', fixed: 'left', width: 80}
             ,{field: 'wrkNo', align: 'center',title: '浠诲姟鍙�'}
-            ,{field: 'wrkSts$', align: 'center',title: '宸ヤ綔鐘舵��'}
-            ,{field: 'zpallet', align: 'center',title: '鎵樼洏鍙�'}
-            ,{field: 'anfme', align: 'center',title: '鍑哄簱鏁伴噺'}
-            ,{field: 'nodeId', align: 'center',title: '鍏宠仈璐т綅', hide: true}
-            ,{field: 'locNo', align: 'center',title: '璐т綅'}
             ,{field: 'matnr', align: 'center',title: '鍟嗗搧缂栫爜'}
             ,{field: 'maktx', align: 'center',title: '鍟嗗搧鍚嶇О'}
+            ,{field: 'anfme', align: 'center',title: '鍑哄簱鏁伴噺', style: 'font-weight: bolder', width: 100}
+            ,{field: 'locNo', align: 'center',title: '璐т綅'}
+            ,{field: 'zpallet', align: 'center',title: '鎵樼洏鍙�'}
+            // ,{field: 'nodeId', align: 'center',title: '鍏宠仈璐т綅', hide: true}
             ,{field: 'name', align: 'center',title: '鍚嶇О', hide: true}
             ,{field: 'specs', align: 'center',title: '瑙勬牸', hide: true}
             ,{field: 'model', align: 'center',title: '鍨嬪彿', hide: true}
@@ -35,19 +34,20 @@
             ,{field: 'unit', align: 'center',title: '鍗曚綅', hide: true}
             ,{field: 'barcode', align: 'center',title: '璐х墿鏉$爜', hide: true}
             ,{field: 'docId', align: 'center',title: '鍗曟嵁绫诲瀷', hide: true}
-            ,{field: 'docNum', align: 'center',title: '鍗曟嵁缂栧彿', hide: true}
+            ,{field: 'docNum', align: 'center',title: '鍗曟嵁缂栧彿'}
             ,{field: 'custName', align: 'center',title: '瀹㈡埛鍚嶇О', hide: true}
             ,{field: 'itemNum', align: 'center',title: '鍝侀」鏁�', hide: true}
             ,{field: 'count', align: 'center',title: '鏁伴噺', hide: true}
             ,{field: 'weight', align: 'center',title: '閲嶉噺', hide: true}
             ,{field: 'status$', align: 'center',title: '鐘舵��', hide: true}
             // ,{field: 'createBy$', align: 'center',title: '娣诲姞浜哄憳',event: 'createBy', style: 'cursor:pointer'}
-            ,{field: 'createTime$', align: 'center',title: '鐢熸垚鏃堕棿'}
             // ,{field: 'updateBy$', align: 'center',title: '淇敼浜哄憳',event: 'updateBy', style: 'cursor:pointer'}
             // ,{field: 'updateTime$', align: 'center',title: '淇敼鏃堕棿'}
+            ,{field: 'wrkSts$', align: 'center',title: '宸ヤ綔鐘舵��', templet: '#wrkStsTpl', width: 100}
+            ,{field: 'createTime$', align: 'center',title: '鐢熸垚鏃堕棿'}
             ,{field: 'memo', align: 'center',title: '澶囨敞', hide: true}
 
-            ,{fixed: 'right', title:'鎿嶄綔', align: 'center', toolbar: '#operate', width:200}
+            ,{fixed: 'right', title:'鎿嶄綔', align: 'center', toolbar: '#operate', width:180}
         ]],
         request: {
             pageName: 'curr',
@@ -108,6 +108,25 @@
     table.on('toolbar(pakout)', function (obj) {
         var checkStatus = table.checkStatus(obj.config.id);
         switch(obj.event) {
+            // 鎵归噺鎵撳嵃
+            case 'batchPrint':
+                var data = checkStatus.data;
+                if (data.length === 0){
+                    layer.msg('璇峰嬀閫夋墦鍗拌褰�', {icon: 9});
+                } else {
+                    layer.msg('鏉冮檺涓嶈冻銆佽鑱旂郴绠$悊鍛�', {icon: 3});
+                    // console.log(data);
+                    // layer.confirm(res.msg, {
+                    //         shadeClose: true
+                    //         , btn: ['鎵撳嵃鎷h揣鍗�']
+                    //     }, function() {
+                    //         layer.closeAll();
+                    //         printPakouts(data.number);
+                    //     }
+                    // )
+                }
+                break;
+            // 瀵煎嚭
             case 'exportData':
                 layer.confirm('纭畾瀵煎嚭Excel鍚�', {shadeClose: true}, function(){
                     var titles=[];
@@ -149,6 +168,60 @@
         }
     });
 
+    // 鎵撳嵃鎷h揣鍗�
+    function printPakouts(docNumber) {
+        $.ajax({
+            url: baseUrl+"/work/stock/out/print",
+            headers: {'token': localStorage.getItem('token')},
+            data: JSON.stringify({
+                number: docNumber
+            }),
+            contentType:'application/json;charset=UTF-8',
+            method: 'POST',
+            success: function (res) {
+                if (res.code === 200){
+                    res.data["barcodeUrl"]=baseUrl+"/custOrder/code/auth?type=1&param="+res.data.docNum;
+                    var tpl = $('#pakoutPrintTpl').html();
+                    var template = Handlebars.compile(tpl);
+                    var html = template(res);
+                    var box = $("#pakoutPrintBox");
+                    box.html(html);box.show();
+                    box.print({
+                        mediaPrint:true,
+                        deferred: $.Deferred().done(function () {
+                            layer.confirm('[閲嶈] 鎵撳嵃鏄惁鎴愬姛锛�',  {btn: ['Yes', 'No']}, function(){
+                                $.ajax({
+                                    url: baseUrl+"/pakout/print/auth",
+                                    headers: {'token': localStorage.getItem('token')},
+                                    data: {
+                                        docNumber: docNumber
+                                    },
+                                    method: 'POST',
+                                    success: function (res) {
+                                        if (res.code === 200){
+                                            layer.closeAll();
+                                            $(".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})
+                                        }
+                                    }
+                                })
+                            });
+                        })
+                    });
+                    box.hide();
+                } else if (res.code === 403){
+                    top.location.href = baseUrl+"/";
+                } else {
+                    layer.msg(res.msg, {icon: 2})
+                }
+            }
+        })
+    }
+
     // 鐩戝惉琛屽伐鍏蜂簨浠�
     table.on('tool(pakout)', function(obj){
         var data = obj.data;
@@ -156,7 +229,9 @@
             // 瀹屾垚
             case 'complete':
                 layer.confirm('纭瀹屾垚璇ョ瑪鎷h揣鍗曪紵', {title: '宸ヤ綔鍙凤細'+data.wrkNo, shadeClose: true}, function(){
+                    var loadIndex = layer.load(2);
                     http.post(baseUrl+"/work/hand/control/pakout", {wrkNo: data.wrkNo, type:1}, function (res) {
+                        layer.close(loadIndex);
                         $(".layui-laypage-btn")[0].click();
                         layer.msg(data.wrkNo + res.msg);
                     })
@@ -167,7 +242,9 @@
             // 鍙栨秷
             case 'cancel':
                 layer.confirm('纭鍙栨秷璇ョ瑪鎷h揣鍗曪紵', {title: '宸ヤ綔鍙凤細'+data.wrkNo, shadeClose: true}, function(){
+                    var loadIndex = layer.load(2);
                     http.post(baseUrl+"/work/hand/control/pakout", {wrkNo: data.wrkNo, type:2}, function (res) {
+                        layer.close(loadIndex);
                         $(".layui-laypage-btn")[0].click();
                         layer.msg(data.wrkNo + res.msg);
                     })
@@ -299,7 +376,11 @@
         elem: '#updateTime\\$',
         type: 'datetime'
     });
-
+    layDate.render({
+        elem: '.layui-laydate-range'
+        ,type: 'datetime'
+        ,range: true
+    });
 
 });
 

--
Gitblit v1.9.1