| | |
| | | var insTbCount = 0; |
| | | var admin; |
| | | var insTb |
| | | var printMatCodeNos = []; |
| | | layui.config({ |
| | | base: baseUrl + "/static/layui/lay/modules/" |
| | |
| | | var form = layui.form; |
| | | var table = layui.table; |
| | | var util = layui.util; |
| | | var admin = layui.admin; |
| | | admin = layui.admin; |
| | | var xmSelect = layui.xmSelect; |
| | | var layDate = layui.laydate; |
| | | |
| | |
| | | showEditModel(); |
| | | }); |
| | | |
| | | // 导入销售单 |
| | | $("#importOrder").click(function () { |
| | | $("#importExcel").trigger("click"); |
| | | }); |
| | | |
| | | // 工具条点击事件 |
| | | table.on('tool(order)', function (obj) { |
| | | var data = obj.data; |
| | |
| | | {field: 'maktx', title: '商品名称', width: 160}, |
| | | {field: 'batch', title: '批号'}, |
| | | {field: 'anfme', title: '数量'}, |
| | | // {field: 'workQty', title: '作业数量'}, |
| | | {field: 'supp', title: '立库库存', templet: function (item){ |
| | | if(item.supp >= item.anfme) return `<span style="color: #00FF00">${item.supp}</span>`; |
| | | else return `<span style="color: red">${item.supp}</span>`; |
| | | }}, |
| | | {field: 'suppCode', title: '平库库存' , templet: function (item){ |
| | | if(item.suppCode >= item.anfme) return `<span style="color: #00FF00">${item.suppCode}</span>`; |
| | | else return `<span style="color: red">${item.suppCode}</span>`; |
| | | }}, |
| | | {field: 'workQty', title: '作业数量'}, |
| | | {field: 'qty', title: '完成数量', style: 'font-weight: bold'}, |
| | | // {field: 'unit', title: '单位'}, |
| | | // { |
| | |
| | | var className = templateDom.attr("class"); |
| | | if (className === 'template-barcode') { |
| | | res.data[i]["barcodeUrl"]=baseUrl+"/mac/code/auth?type=1¶m="+res.data[i].orderNo+ |
| | | ";"+res.data[i].matnr+";"+res.data[i].batch; |
| | | ";"+res.data[i].matnr+";"+res.data[i].batch+";"+res.data[i].anfme; |
| | | } else { |
| | | res.data[i]["barcodeUrl"]=baseUrl+"/mac/code/auth?type=2¶m="+res.data[i].orderNo+ |
| | | ";"+res.data[i].matnr+";"+res.data[i].batch; |
| | | ";"+res.data[i].matnr+";"+res.data[i].batch+";"+res.data[i].anfme; |
| | | } |
| | | } |
| | | var tpl = templateDom.html(); |
| | |
| | | }) |
| | | } |
| | | }); |
| | | function upload(obj){ |
| | | if(!obj.files) { |
| | | return; |
| | | } |
| | | var file = obj.files[0]; |
| | | admin.confirm('确认导入 [' + file.name +'] 文件吗?', function (index) { |
| | | layer.load(1, {shade: [0.1,'#fff']}); |
| | | var url = baseUrl + "/order/excel/import/auth"; |
| | | var form = new FormData(); |
| | | form.append("file", file); |
| | | let xhr = new XMLHttpRequest(); |
| | | xhr.open("post", url, true); |
| | | xhr.setRequestHeader('token', localStorage.getItem('token')); |
| | | xhr.onload = uploadComplete; |
| | | xhr.onerror = uploadFailed; |
| | | xhr.onloadend = function () { |
| | | layer.closeAll('loading'); |
| | | }; |
| | | // xhr.upload.onprogress = progressFunction; |
| | | xhr.upload.onloadstart = function(){ |
| | | ot = new Date().getTime(); |
| | | oloaded = 0; |
| | | }; |
| | | xhr.send(form); |
| | | }, function(index){ |
| | | }); |
| | | } |
| | | function uploadComplete(evt) { |
| | | let res = JSON.parse(evt.target.responseText); |
| | | if(res.code === 200) { |
| | | layer.msg(res.msg, {icon: 1}); |
| | | insTb.reload({page: {curr: 1}}); |
| | | } else { |
| | | alert(res.msg); |
| | | // layer.msg(res.msg, {icon: 2}); |
| | | } |
| | | } |
| | | function uploadFailed(evt) { |
| | | let res = JSON.parse(evt.target.responseText); |
| | | alert(res.msg); |
| | | // layer.msg(res.msg, {icon: 2}); |
| | | } |