From d17c089f1d7ff3be848b05161917346e7f664a1d Mon Sep 17 00:00:00 2001
From: mrzhssss <pro6@qq.com>
Date: 星期二, 26 四月 2022 15:17:53 +0800
Subject: [PATCH] #

---
 src/main/webapp/static/js/pickout/pickout.js |  334 ++++++++++++++++++++++++++++++++++++++-----------------
 1 files changed, 231 insertions(+), 103 deletions(-)

diff --git a/src/main/webapp/static/js/pickout/pickout.js b/src/main/webapp/static/js/pickout/pickout.js
index 7e54ae0..aca4626 100644
--- a/src/main/webapp/static/js/pickout/pickout.js
+++ b/src/main/webapp/static/js/pickout/pickout.js
@@ -1,4 +1,5 @@
 var pageCurr;
+var currPick;
 layui.config({
     base: baseUrl + "/static/layui/lay/modules/"
 }).use(['table','laydate', 'form', 'admin'], function(){
@@ -34,12 +35,13 @@
         defaultToolbar: [],
         cols:[[
             // {type: 'checkbox'}
-            {field: 'wrkNo', align: 'center',title: '浠诲姟鍙�'}
+            {field: 'wrkNo', align: 'center',title: '浠诲姟鍙�',width: 180}
             ,{field: 'id', align: 'center',title: '鍞竴ID',hide: true}
             ,{field: 'hostId', align: 'center',title: '鍟嗘埛ID', hide: true}
             ,{field: 'userId', align: 'center',title: '鐢ㄦ埛ID', hide: true}
 
             ,{field: 'wrkSts$', align: 'center',title: '宸ヤ綔鐘舵��' ,templet: '#wrkStsTpl' , width: 100}
+            ,{field: 'printTimes', align: 'center', title: '鎵撳嵃娆℃暟',width: 90}
             ,{field: 'zpallet', align: 'center',title: '鏉″舰鐮�' , hide:true}
             ,{field: 'createTime$', align: 'center',title: '', hide:true}
             ,{field: 'createBy', align: 'center',title: '', hide:true}
@@ -47,7 +49,7 @@
             ,{field: 'updateBy', align: 'center',title: '', hide:true}
             ,{field: 'memo', align: 'center',title: '', hide:true}
 
-            ,{fixed: 'right', title:'鎿嶄綔', align: 'center', toolbar: '#operate', width:180}
+            ,{fixed: 'right', title:'鎿嶄綔', align: 'center', toolbar: '#operate'}
         ]],
         done: function (res,curr,count){
             $('#dictTable+.layui-table-view .layui-table-body tbody>tr:first').trigger('click');
@@ -56,20 +58,35 @@
     // 鐩戝惉琛屽伐鍏蜂簨浠�
     table.on('tool(leftTable)', function(obj){
         var data = obj.data;
+
+
+
         switch (obj.event) {
-            case 'complete':
-                complete(data);
+            case 'printOrder':
+                printPick(data);
                 break;
             case "del":
                 var ids = [data.id];
                 del(ids);
                 break;
+            case "complete":
+                donePickOut(data);
+                break;
         }
+    });
+    /* 鐩戝惉琛屽崟鍑讳簨浠� */
+    var selObj;
+    table.on('row(leftTable)', function (obj) {
+        currPick = obj.data.id;
+        selObj = obj;
+        obj.tr.addClass('layui-table-click').siblings().removeClass('layui-table-click');
+        tableIns.reload({where: {head_id: obj.data.id}, page: {curr: 1}});
+
     });
 
     /* 鍒犻櫎 */
     function del(ids) {
-        layer.confirm('纭畾瑕佸垹闄ら�変腑鏁版嵁鍚楋紵', {
+        layer.confirm('纭畾瑕佹挙閿�閫変腑鏁版嵁鍚楋紵', {
             skin: 'layui-layer-admin',
             shade: .1
         }, function (i) {
@@ -82,25 +99,112 @@
                 method: 'POST',
                 success: function (res) {
                     layer.close(loadIndex);
+
                     if (res.code === 200){
+
                         layer.msg(res.msg, {icon: 1});
-                        tableReload();
+
                     } else if (res.code === 403){
                         top.location.href = baseUrl+"/";
                     } else {
                         layer.msg(res.msg, {icon: 2});
                     }
+                    leftTB.reload({where: null,page: {curr: 1}});
+                    tableIns.reload({where: null,page: {curr: 1}});
                 }
             })
         });
     }
+    form.on('submit(leftResearch)', function (data) {
+
+        leftTB.reload({where: {wrk_no: data.field.docName}});
+        return false;
+    });
+    // 閲嶇疆
+    form.on('submit(leftReset)', function (data) {
+
+        leftTB.reload({where: null,page: {curr: 1}});
+        $("#docName").val("");
+        tableReload(false);
+    });
+
+    function donePickOut(data) {
+        $.ajax({
+            url:baseUrl + "/pickout/done/auth",
+            headers : {'token' : localStorage.getItem('token')},
+            data: JSON.stringify(data),
+            contentType:'application/json;charset=UTF-8',
+            method: 'POST',
+            success: function (res) {
+
+                leftTB.reload();
+            }
+        })
+    }
+
+    function printPick(data){
+        $.ajax({
+            url:baseUrl + "/work/pick/out/print",
+            headers : {'token' : localStorage.getItem('token')},
+            data: JSON.stringify(data),
+            contentType:'application/json;charset=UTF-8',
+            method: 'POST',
+            success: function (res) {
+                    if (res.code === 200){
+                        console.log(res);
+                        res.data["barcodeUrl"]=baseUrl+"/order/code/auth?type=1&param="+res.data.pickout.wrkNo;
+                        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+"/pickout/print/auth",
+                                        headers: {'token': localStorage.getItem('token')},
+                                        data: JSON.stringify(res.data.pickout),
+                                        contentType:'application/json;charset=UTF-8',
+                                        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})
+                                            }
+                                            leftTB.reload();
+                                        }
+                                    })
+                                });
+                            })
+                        });
+                        box.hide();
+                    }
+                    else if (res.code === 403){
+                        top.location.href = baseUrl+"/";
+                    }else {
+                        layer.msg(res.msg, {icon: 2})
+                    }
+
+            }
+
+        })
+    }
+
+
 
     /****************************************** 鍙宠竟琛� *************************************************/
     // 鏁版嵁娓叉煋
     tableIns = table.render({
         elem: '#pickout',
         headers: {token: localStorage.getItem('token')},
-        url: baseUrl+'/pickout/list/auth',
+        url: baseUrl+'/pickoutDetl/list/auth',
         page: true,
         limit: 16,
         limits: [16, 30, 50, 100, 200, 500],
@@ -108,20 +212,34 @@
         cellMinWidth: 50,
         cols: [[
             // {type: 'checkbox'}
-            {field: 'wrkNo', align: 'center',title: '浠诲姟鍙�'}
-            ,{field: 'id', align: 'center',title: '鍞竴ID'}
-            ,{field: 'hostId', align: 'center',title: '鍟嗘埛ID'}
-            ,{field: 'userId', align: 'center',title: '鐢ㄦ埛ID'}
+            {field: 'id', align: 'center',title: '鍞竴ID', hide:true}
+            ,{field: 'headId', align: 'center',title: '琛ㄥごID', hide:true}
+            ,{field: 'nodeId', align: 'center',title: '搴撲綅ID', hide:true}
+            ,{field: 'nodeName', align: 'center',title: '搴撲綅鍚嶇О'}
+            ,{field: 'anfme', align: 'center',title: '鏁伴噺'}
+            ,{field: 'matnr', align: 'center',title: '鍟嗗搧缂栫爜'}
+            ,{field: 'maktx', align: 'center',title: '鍟嗗搧鍚嶇О'}
+            ,{field: 'name', align: 'center',title: '鍚嶇О', hide:true}
+            ,{field: 'specs', align: 'center',title: '瑙勬牸', hide:true}
+            ,{field: 'model', align: 'center',title: '鍨嬪彿', hide:true}
+            ,{field: 'batch', align: 'center',title: '鎵瑰彿', hide:true}
+            ,{field: 'unit', align: 'center',title: '鍗曚綅', hide:true}
+            ,{field: 'barcode', align: 'center',title: '鎵樼洏鐮�', hide:true}
+            ,{field: 'docType', align: 'center',title: '鍗曟嵁绫诲瀷', hide:true}
+            ,{field: 'docId', align: 'center',title: '鍗曟嵁缂栧彿', hide:true}
+            ,{field: 'price', align: 'center',title: '浠锋牸', hide:true}
+            ,{field: 'weight', align: 'center',title: '閲嶉噺', hide:true}
+            ,{field: 'status', align: 'center',title: '鐘舵��' , hide:true}
+            ,{field: 'pickStaff$', align: 'center',title: '鎷h揣鍛業D'}
+            ,{field: 'pickStart$', align: 'center',title: '鎷h揣寮�濮嬫椂闂�'}
+            ,{field: 'pickEnd$', align: 'center',title: '鎷h揣缁撴潫鏃堕棿'}
+            ,{field: 'createTime$', align: 'center',title: '鍒涘缓鏃堕棿', hide:true}
+            ,{field: 'createBy', align: 'center',title: '鍒涘缓浜哄憳ID', hide:true}
+            ,{field: 'updateTime$', align: 'center',title: '淇敼鏃堕棿', hide:true}
+            ,{field: 'updateBy$', align: 'center',title: '淇敼浜哄憳ID', hide:true}
+            ,{field: 'memo', align: 'center',title: '澶囨敞', hide:true}
 
-            ,{field: 'wrkSts$', align: 'center',title: '宸ヤ綔鐘舵��' ,templet: '#wrkStsTpl' , width: 100}
-            ,{field: 'zpallet', align: 'center',title: '鏉″舰鐮�' , hide:true}
-            ,{field: 'createTime$', align: 'center',title: '', hide:true}
-            ,{field: 'createBy', align: 'center',title: '', hide:true}
-            ,{field: 'updateTime$', align: 'center',title: '', hide:true}
-            ,{field: 'updateBy', align: 'center',title: '', hide:true}
-            ,{field: 'memo', align: 'center',title: '', hide:true}
-
-            ,{fixed: 'right', title:'鎿嶄綔', align: 'center', toolbar: '#operate', width:180}
+            ,{fixed: 'right', title:'鎿嶄綔', align: 'center', toolbar: '#operate', width:150, hide:true}
         ]],
         request: {
             pageName: 'curr',
@@ -146,98 +264,107 @@
             limit();
         }
     });
-
-    // 鐩戝惉鎺掑簭浜嬩欢
-    table.on('sort(pickout)', function (obj) {
-        var searchData = {};
-        $.each($('#search-box [name]').serializeArray(), function() {
-            searchData[this.name] = this.value;
-        });
-        searchData['orderByField'] = obj.field;
-        searchData['orderByType'] = obj.type;
+    // /* 琛ㄦ牸2鎼滅储 */
+    // form.on('submit(rightSearch)', function (data) {
+    //
+    //     tableIns.reload({where: data.field , page: {curr: 1}});
+    //     return false;
+    // });
+    // // 鐩戝惉鎺掑簭浜嬩欢
+    // table.on('sort(pickout)', function (obj) {
+    //     var searchData = {};
+    //     $.each($('#search-box [name]').serializeArray(), function() {
+    //         searchData[this.name] = this.value;
+    //     });
+    //     searchData['orderByField'] = obj.field;
+    //     searchData['orderByType'] = obj.type;
+    //     tableIns.reload({
+    //         where: searchData,
+    //         page: {curr: 1}
+    //     });
+    // });
+    //
+    // // 鐩戝惉澶村伐鍏锋爮浜嬩欢
+    // table.on('toolbar(pickout)', function (obj) {
+    //     var checkStatus = table.checkStatus(obj.config.id).data;
+    //     switch(obj.event) {
+    //         case 'addData':
+    //             showEditModel();
+    //             break;
+    //         case 'deleteData':
+    //            if (checkStatus.length === 0) {
+    //                layer.msg('璇烽�夋嫨瑕佸垹闄ょ殑鏁版嵁', {icon: 2});
+    //                return;
+    //            }
+    //            var ids = checkStatus.map(function (d) {
+    //                return d.id;
+    //            });
+    //            del(ids);
+    //            break;
+    //         case 'exportData':
+    //             layer.confirm('纭畾瀵煎嚭Excel鍚�', {shadeClose: true}, function(){
+    //                 var titles=[];
+    //                 var fields=[];
+    //                 obj.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 = {
+    //                     'pickout': exportData,
+    //                     'fields': fields
+    //                 };
+    //                 $.ajax({
+    //                     url: baseUrl+"/pickout/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, {icon: 2})
+    //                         }
+    //                     }
+    //                 });
+    //             });
+    //             break;
+    //     }
+    // });
+    // /* 琛ㄦ牸鎼滅储 */
+    // form.on('submit(leftResearch)', function (data) {
+    //     insTb.reload({where: {doc_name: data.field.docName,doc_class:2}});
+    //     return false;
+    // });
+    //
+    //
+    // 鎼滅储
+    form.on('submit(rightSearch)', function (data) {
+        data.field.head_id = currPick;
         tableIns.reload({
-            where: searchData,
+            where: data.field,
             page: {curr: 1}
         });
     });
 
-    // 鐩戝惉澶村伐鍏锋爮浜嬩欢
-    table.on('toolbar(pickout)', function (obj) {
-        var checkStatus = table.checkStatus(obj.config.id).data;
-        switch(obj.event) {
-            case 'addData':
-                showEditModel();
-                break;
-            case 'deleteData':
-               if (checkStatus.length === 0) {
-                   layer.msg('璇烽�夋嫨瑕佸垹闄ょ殑鏁版嵁', {icon: 2});
-                   return;
-               }
-               var ids = checkStatus.map(function (d) {
-                   return d.id;
-               });
-               del(ids);
-               break;
-            case 'exportData':
-                layer.confirm('纭畾瀵煎嚭Excel鍚�', {shadeClose: true}, function(){
-                    var titles=[];
-                    var fields=[];
-                    obj.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 = {
-                        'pickout': exportData,
-                        'fields': fields
-                    };
-                    $.ajax({
-                        url: baseUrl+"/pickout/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, {icon: 2})
-                            }
-                        }
-                    });
-                });
-                break;
-        }
-    });
-    /* 琛ㄦ牸鎼滅储 */
-    form.on('submit(leftResearch)', function (data) {
-        insTb.reload({where: {doc_name: data.field.docName,doc_class:2}});
-        return false;
-    });
-
-
-    // 鎼滅储
-    form.on('submit(search)', function (data) {
-        pageCurr = 1;
-        tableReload(false);
-    });
-
     // 閲嶇疆
     form.on('submit(reset)', function (data) {
-        pageCurr = 1;
-        clearFormVal($('#search-box'));
+
+        tableIns.reload({where: null,page: {curr: 1}});
+        $("#matnr").val("");
         tableReload(false);
     });
-
+    //
     // 鏃堕棿閫夋嫨鍣�
     function layDateRender() {
             layDate.render({
@@ -264,6 +391,7 @@
     $.each($('#search-box [name]').serializeArray(), function() {
         searchData[this.name] = this.value;
     });
+
     tableIns.reload({
         where: searchData,
         page: {curr: pageCurr}

--
Gitblit v1.9.1