|  |  |  | 
|---|
|  |  |  | var pageCurr; | 
|---|
|  |  |  | var printMatCodeNos = []; | 
|---|
|  |  |  | layui.config({ | 
|---|
|  |  |  | base: baseUrl + "/static/layui/lay/modules/" | 
|---|
|  |  |  | }).use(['table','laydate', 'form', 'admin'], function(){ | 
|---|
|  |  |  | }).use(['table','laydate', 'form', 'admin' , 'layer'], function(){ | 
|---|
|  |  |  | var table = layui.table; | 
|---|
|  |  |  | var $ = layui.jquery; | 
|---|
|  |  |  | var layer = layui.layer; | 
|---|
|  |  |  | var layDate = layui.laydate; | 
|---|
|  |  |  | var form = layui.form; | 
|---|
|  |  |  | var admin = layui.admin; | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | // 数据渲染 | 
|---|
|  |  |  | tableIns = table.render({ | 
|---|
|  |  |  | 
|---|
|  |  |  | cellMinWidth: 50, | 
|---|
|  |  |  | height: 'full-120', | 
|---|
|  |  |  | cols: [[ | 
|---|
|  |  |  | {type: 'checkbox'} | 
|---|
|  |  |  | ,{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: '关联货位'} | 
|---|
|  |  |  | ,{field: 'locNo', align: 'center',title: '货位'} | 
|---|
|  |  |  | ,{field: 'matnr', align: 'center',title: '商品编码'} | 
|---|
|  |  |  | ,{field: 'maktx', align: 'center',title: '商品名称'} | 
|---|
|  |  |  | ,{field: 'name', align: 'center',title: '名称'} | 
|---|
|  |  |  | ,{field: 'specs', align: 'center',title: '规格'} | 
|---|
|  |  |  | ,{field: 'model', align: 'center',title: '型号'} | 
|---|
|  |  |  | ,{field: 'batch', align: 'center',title: '批号'} | 
|---|
|  |  |  | ,{field: 'unit', align: 'center',title: '单位'} | 
|---|
|  |  |  | ,{field: 'barcode', align: 'center',title: '货物条码'} | 
|---|
|  |  |  | ,{field: 'docId', align: 'center',title: '单据类型'} | 
|---|
|  |  |  | ,{field: 'docNum', align: 'center',title: '单据编号'} | 
|---|
|  |  |  | ,{field: 'custName', align: 'center',title: '客户名称'} | 
|---|
|  |  |  | ,{field: 'itemNum', align: 'center',title: '品项数'} | 
|---|
|  |  |  | ,{field: 'count', align: 'center',title: '数量'} | 
|---|
|  |  |  | ,{field: 'weight', align: 'center',title: '重量'} | 
|---|
|  |  |  | // {type: 'checkbox'} | 
|---|
|  |  |  | ,{field: 'wrkNo', align: 'center',title: 'id', hide:true} | 
|---|
|  |  |  | ,{field: 'docNum',title: '拣货单号' , templet: '#orderNoTpl'} | 
|---|
|  |  |  | ,{align: 'center', title: '明细', toolbar: '#tbLook', minWidth: 160, width: 160} | 
|---|
|  |  |  | ,{field: 'status$', align: 'center',title: '状态'} | 
|---|
|  |  |  | ,{field: 'createBy$', align: 'center',title: '添加人员'} | 
|---|
|  |  |  | ,{field: 'createTime$', align: 'center',title: '添加时间'} | 
|---|
|  |  |  | ,{field: 'updateBy$', align: 'center',title: '修改人员'} | 
|---|
|  |  |  | ,{field: 'updateTime$', align: 'center',title: '修改时间'} | 
|---|
|  |  |  | ,{field: 'memo', align: 'center',title: '备注'} | 
|---|
|  |  |  |  | 
|---|
|  |  |  | ,{fixed: 'right', title:'操作', align: 'center', toolbar: '#operate', width:120} | 
|---|
|  |  |  | // ,{field: 'custName', align: 'center',title: '客户名称', width: 160} | 
|---|
|  |  |  | ,{field: 'createTime$', align: 'center',title: '操作时间'} | 
|---|
|  |  |  | ]], | 
|---|
|  |  |  | request: { | 
|---|
|  |  |  | pageName: 'curr', | 
|---|
|  |  |  | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | }); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | function btnPrint(orderId, orderNo, settle) { | 
|---|
|  |  |  | printMatCodeNos.push(orderNo) | 
|---|
|  |  |  | var templateNo = 3; | 
|---|
|  |  |  | $.ajax({ | 
|---|
|  |  |  | // url: baseUrl+"/pakOut/print/auth", | 
|---|
|  |  |  | url: baseUrl+"/pakOut/show", | 
|---|
|  |  |  | headers: {'token': localStorage.getItem('token')}, | 
|---|
|  |  |  | // data: {param: printMatCodeNos}, | 
|---|
|  |  |  | method: 'POST', | 
|---|
|  |  |  | async: false, | 
|---|
|  |  |  | success: function (res) { | 
|---|
|  |  |  | if (res.code === 200){ | 
|---|
|  |  |  | layer.closeAll(); | 
|---|
|  |  |  | for (let i=0;i<res.data.length;i++){ | 
|---|
|  |  |  | var templateDom = $("#templatePreview"+templateNo); | 
|---|
|  |  |  | var className = templateDom.attr("class"); | 
|---|
|  |  |  | if (className === 'template-barcode') { | 
|---|
|  |  |  | res.data[i]["barcodeUrl"]=baseUrl+"/mac/code/auth?type=1¶m="+res.data[i].docNum; | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | res.data[i]["barcodeUrl"]=baseUrl+"/mac/code/auth?type=2¶m="+res.data[i].docNum; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | // var tpl = templateDom.html(); | 
|---|
|  |  |  | // var template = Handlebars.compile(tpl); | 
|---|
|  |  |  | // var html = template(res); | 
|---|
|  |  |  | // var box = $("#box"); | 
|---|
|  |  |  | // box.html(html); | 
|---|
|  |  |  | // box.show(); | 
|---|
|  |  |  | var imgUrl; | 
|---|
|  |  |  | // console.log(res.data[0]); | 
|---|
|  |  |  | for (let i=0;i<res.data.length;i++){ | 
|---|
|  |  |  | if (res.data[i].docNum === orderNo){ | 
|---|
|  |  |  | imgUrl = res.data[i]["barcodeUrl"]; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | var img = '<img className="template-code template-qrcode" src='+imgUrl+' height="80%">' | 
|---|
|  |  |  | layer.open({ | 
|---|
|  |  |  | type: 1, | 
|---|
|  |  |  | title: "拣货单", | 
|---|
|  |  |  | area: '150px', | 
|---|
|  |  |  | content: img | 
|---|
|  |  |  | }) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | // box.print({mediaPrint:true}); | 
|---|
|  |  |  | // box.hide(); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } else if (res.code === 403){ | 
|---|
|  |  |  | top.location.href = baseUrl+"/"; | 
|---|
|  |  |  | }else { | 
|---|
|  |  |  | layer.msg(res.msg) | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | // 监听头工具栏事件 | 
|---|
|  |  |  | table.on('toolbar(pakout)', function (obj) { | 
|---|
|  |  |  | var checkStatus = table.checkStatus(obj.config.id).data; | 
|---|
|  |  |  | 
|---|
|  |  |  | return d.matnr; | 
|---|
|  |  |  | })); | 
|---|
|  |  |  | break; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | case 'exportData': | 
|---|
|  |  |  | admin.confirm('确定导出Excel吗', {shadeClose: true}, function(){ | 
|---|
|  |  |  | var titles=[]; | 
|---|
|  |  |  | 
|---|
|  |  |  | case "del": | 
|---|
|  |  |  | del([data.matnr]); | 
|---|
|  |  |  | break; | 
|---|
|  |  |  | case "wrkTrace": | 
|---|
|  |  |  | btnPrint(data.wrkNo, data.docNum, 4); | 
|---|
|  |  |  | break | 
|---|
|  |  |  | case "look": | 
|---|
|  |  |  | var $a = $(obj.tr).find('a[lay-event="look"]'); | 
|---|
|  |  |  | var offset = $a.offset(); | 
|---|
|  |  |  | var top = offset.top; | 
|---|
|  |  |  | var left = offset.left; | 
|---|
|  |  |  | layer.open({ | 
|---|
|  |  |  | type: 1, | 
|---|
|  |  |  | title: false, | 
|---|
|  |  |  | area: '1200px', | 
|---|
|  |  |  | offset: [top + 'px', (left - 530 + $a.outerWidth()) + 'px'], | 
|---|
|  |  |  | shade: .01, | 
|---|
|  |  |  | shadeClose: true, | 
|---|
|  |  |  | fixed: false, | 
|---|
|  |  |  | content: '<table id="lookSSXMTable" lay-filter="lookSSXMTable"></table>', | 
|---|
|  |  |  | success: function (layero) { | 
|---|
|  |  |  | table.render({ | 
|---|
|  |  |  | elem: '#lookSSXMTable', | 
|---|
|  |  |  | headers: {token: localStorage.getItem('token')}, | 
|---|
|  |  |  | url: baseUrl+'/pakout/list/auth', | 
|---|
|  |  |  | where: { | 
|---|
|  |  |  | doc_num: data.docNum | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | page: true, | 
|---|
|  |  |  | cellMinWidth: 100, | 
|---|
|  |  |  | cols: [[ | 
|---|
|  |  |  | {type: 'numbers'}, | 
|---|
|  |  |  | ,{field: 'id', align: 'center',title: 'id', hide:true} | 
|---|
|  |  |  | ,{field: 'docNum', align: 'center',title: '拣货单号'} | 
|---|
|  |  |  | ,{field: 'locNo', align: 'center',title: '库位'} | 
|---|
|  |  |  | ,{field: 'matnr', align: 'center',title: '物料号'} | 
|---|
|  |  |  | ,{field: 'maktx', align: 'center',title: '商品名称'} | 
|---|
|  |  |  | ,{field: 'anfme', align: 'center',title: '数量'} | 
|---|
|  |  |  | ,{field: 'createTime$', align: 'center',title: '操作时间'} | 
|---|
|  |  |  | ,{field: 'status$', align: 'center',title: '状态'} | 
|---|
|  |  |  | ,{field: 'memo', align: 'center',title: '备注'} | 
|---|
|  |  |  | ,{field: 'createBy', align: 'center',title: '', hide:true} | 
|---|
|  |  |  | ]], | 
|---|
|  |  |  | request: { | 
|---|
|  |  |  | pageName: 'curr', | 
|---|
|  |  |  | pageSize: 'limit' | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | parseData: function (res) { | 
|---|
|  |  |  | return { | 
|---|
|  |  |  | 'code': res.code, | 
|---|
|  |  |  | 'msg': res.msg, | 
|---|
|  |  |  | 'count': res.data.total, | 
|---|
|  |  |  | 'data': res.data.records | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | response: { | 
|---|
|  |  |  | statusCode: 200 | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | done: function () { | 
|---|
|  |  |  | $(layero).find('.layui-table-view').css('margin', '0'); | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | size: '' | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | }); | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | // 关闭动作 | 
|---|
|  |  |  | $(document).on('click','#data-detail-close', function () { | 
|---|
|  |  |  | parent.layer.closeAll(); | 
|---|