| | |
| | | if (data.length === 0){ |
| | | layer.msg('请添加物料'); |
| | | } else { |
| | | 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(''); |
| | | var success = true; |
| | | for (var i=0;i<matData.length;i++) { |
| | | if (matData[i].count <= 0) { |
| | | layer.msg(matData[i].matnr + '物料数量必须大于零!', {icon: 2}) |
| | | success = false; |
| | | return false; |
| | | } |
| | | }); |
| | | } |
| | | if (success) { |
| | | 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}); |
| | | matDetls.push({matnr: elem.matnr |
| | | , count: elem.count |
| | | |
| | | }); |
| | | }); |
| | | var req = JSON.stringify({ |
| | | number: data.field.orderNo |
| | | , customerTypeId: '1' |
| | | , list: matDetls |
| | | }) |
| | | $.ajax({ |
| | | url: baseUrl+"/work/order/init", |
| | | headers: {'token': localStorage.getItem('token')}, |
| | | data: JSON.stringify({ |
| | | number: data.field.orderNo, |
| | | list: matDetls |
| | | }), |
| | | data: req, |
| | | 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}); |
| | | top.layui.layer.close(top.popupRight); |
| | | } else if (res.code === 403){ |
| | | top.location.href = baseUrl+"/"; |
| | | } else { |
| | |
| | | } |
| | | } |
| | | }); |
| | | |
| | | }) |
| | | |
| | | function updateMatData(locNo, matnr, count) { |