| | |
| | | elem: '#chooseData', |
| | | headers: {token: localStorage.getItem('token')}, |
| | | data: [], |
| | | limit: 100, |
| | | even: true, |
| | | toolbar: '#toolbar', |
| | | cellMinWidth: 50, |
| | |
| | | table.on('toolbar(chooseData)', function (obj) { |
| | | var data = matData; |
| | | switch (obj.event) { |
| | | case 'outbound': |
| | | case 'createDoc': |
| | | if (data.length === 0){ |
| | | layer.msg('请先添加物料'); |
| | | layer.msg('请添加物料'); |
| | | } else { |
| | | var locDetls = []; |
| | | data.forEach(function(elem) { |
| | | locDetls.push({nodeId: elem.nodeId, matnr: elem.matnr, count: elem.count}); |
| | | }); |
| | | $.ajax({ |
| | | url: baseUrl+"/work/pakout/init", |
| | | headers: {'token': localStorage.getItem('token')}, |
| | | data: JSON.stringify(locDetls), |
| | | contentType:'application/json;charset=UTF-8', |
| | | method: 'POST', |
| | | success: function (res) { |
| | | if (res.code === 200){ |
| | | matData = []; |
| | | tableIns.reload({data: matData,done:function (res) { |
| | | limit(); |
| | | }}); |
| | | layer.msg(res.msg, {icon: 1}); |
| | | } else if (res.code === 403){ |
| | | top.location.href = baseUrl+"/"; |
| | | } else { |
| | | layer.msg(res.msg) |
| | | } |
| | | layer.open({ |
| | | type: 1, |
| | | title: '定义销售单编号', |
| | | offset: '100px', |
| | | area: ['360px'], |
| | | shade: 0.1, |
| | | content: $('#getOrderNo'), |
| | | success: function(layero, index){ |
| | | layer.iframeAuto(index) |
| | | }, |
| | | cancel: function () { |
| | | $('#orderNo').val(''); |
| | | } |
| | | }); |
| | | } |
| | |
| | | break; |
| | | } |
| | | }); |
| | | |
| | | // 开始生成拣货单 |
| | | form.on('submit(confirm)', function (data) { |
| | | var matDetls = []; |
| | | matData.forEach(function(elem) { |
| | | matDetls.push({matnr: elem.matnr, count: elem.count}); |
| | | }); |
| | | $.ajax({ |
| | | url: baseUrl+"/work/order/init", |
| | | headers: {'token': localStorage.getItem('token')}, |
| | | data: JSON.stringify({ |
| | | number: data.field.orderNo, |
| | | list: matDetls |
| | | }), |
| | | contentType:'application/json;charset=UTF-8', |
| | | method: 'POST', |
| | | success: function (res) { |
| | | if (res.code === 200){ |
| | | top.layui.layer.close(top.popupRight); |
| | | layer.msg(res.msg, {icon: 1}); |
| | | } else if (res.code === 403){ |
| | | top.location.href = baseUrl+"/"; |
| | | } else { |
| | | layer.msg(res.msg, {icon: 2}) |
| | | } |
| | | } |
| | | }); |
| | | |
| | | }) |
| | | |
| | | function updateMatData(locNo, matnr, count) { |
| | | if (isNaN(count)) { |
| | |
| | | matData.push.apply(matData, data); |
| | | tableIns.reload({data: matData}); |
| | | layer.close(matDetlLayerIdx); |
| | | } |
| | | |
| | | function initOrderNo() { |
| | | $.ajax({ |
| | | url: baseUrl+"/work/orderNo/init", |
| | | headers: {'token': localStorage.getItem('token')}, |
| | | async: false, |
| | | method: 'GET', |
| | | success: function (res) { |
| | | if (res.code === 200){ |
| | | $('#orderNo').val(res.data) |
| | | } else if (res.code === 403){ |
| | | top.location.href = baseUrl+"/"; |
| | | } else { |
| | | layer.msg(res.msg, {icon: 2}) |
| | | } |
| | | } |
| | | }); |
| | | } |