| | |
| | | } |
| | | var tableIns; |
| | | var countLayer; |
| | | var matData = []; |
| | | var sourceData = []; |
| | | layui.use(['table', 'laydate', 'form'], function () { |
| | | var table = layui.table; |
| | | var $ = layui.jquery; |
| | |
| | | limit: 500, |
| | | cellMinWidth: 50, |
| | | cols: [[ |
| | | {field: 'matNo', align: 'center', title: '物料编码',event: 'modify',}, |
| | | {field: 'mnemonic', align: 'center', title: '生产单号',event: 'modify',}, |
| | | {field: 'matNo', align: 'center', title: '物料编码', event: 'modify',}, |
| | | {field: 'mnemonic', align: 'center', title: '生产单号', event: 'modify',}, |
| | | { |
| | | align: 'center', |
| | | field: 'count', |
| | |
| | | style: 'cursor: pointer;color: blue', |
| | | width: 50 |
| | | }, |
| | | {field: 'matName', align: 'center', title: '物料名称',event: 'modify',} |
| | | {field: 'matName', align: 'center', title: '物料名称', event: 'modify',} |
| | | ]], |
| | | done: function (res, curr, count) { |
| | | } |
| | |
| | | } |
| | | |
| | | // 添加表格数据 |
| | | var matData = []; |
| | | // var matData = []; |
| | | |
| | | function addTableData(data) { |
| | | for (var i = 0; i < data.length; i++) { |
| | |
| | | } |
| | | if (toPush) { |
| | | matData.push(data[i]); |
| | | sourceData.push({ |
| | | matNo: data[i].matNo, |
| | | count: data[i].count, |
| | | supplier: data[i].supplier, |
| | | mnemonic: data[i].mnemonic, |
| | | }); |
| | | } |
| | | } |
| | | tableIns.reload({data: matData}); |
| | |
| | | return; |
| | | } |
| | | // 赋值前清空表格 |
| | | matData = []; |
| | | // matData = []; |
| | | tableIns.reload({data: matData}); |
| | | |
| | | $.ajax({ |
| | |
| | | if (res.code === 200) { |
| | | if (res.data != null) { |
| | | addTableData(res.data); |
| | | // 延迟1秒后清空通知单号 |
| | | setTimeout(function () { |
| | | $('#billNo').val(""); |
| | | }, 500); |
| | | } |
| | | } else if (res.code === 403) { |
| | | top.location.href = baseUrl + "/pda"; |
| | |
| | | $('#code').val(""); |
| | | $('#billNo').val(""); |
| | | matData = []; |
| | | sourceData = []; |
| | | tableIns.reload({data: matData}); |
| | | } |
| | | |
| | |
| | | tips("请提取物料", true); |
| | | return; |
| | | } |
| | | var billNo = $('#billNo').val(); |
| | | var mnemonic = $('#mnemonic').val(); |
| | | $.ajax({ |
| | | url: baseUrl + "/mobile/comb/auth", |
| | | headers: {'token': localStorage.getItem('token')}, |
| | | data: JSON.stringify({ |
| | | barcode: barcode, |
| | | combMats: matData, |
| | | billNo: billNo, |
| | | mnemonic: mnemonic, |
| | | }), |
| | | contentType: 'application/json;charset=UTF-8', |
| | | method: 'POST', |
| | | async: false, |
| | | success: function (res) { |
| | | if (res.code === 200) { |
| | | reset(); |
| | | tips("组托成功") |
| | | } else if (res.code === 403) { |
| | | top.location.href = baseUrl + "/pda"; |
| | | } else { |
| | | tips(res.msg, true) |
| | | for (var i = 0; i < matData.length; i++) { |
| | | for (var j = 0; j < sourceData.length ; j++) { |
| | | if (matData[i].matNo == sourceData[j].matNo && matData[i].mnemonic == sourceData[j].mnemonic && matData[i].count == sourceData[j].count) { |
| | | // 数量提醒 |
| | | layer.confirm('数量和剩余数量一致,确定继续组托吗?', function(){ |
| | | $.ajax({ |
| | | url: baseUrl + "/mobile/comb/auth/batch", |
| | | headers: {'token': localStorage.getItem('token')}, |
| | | data: JSON.stringify({ |
| | | barcode: barcode, |
| | | combMats: matData, |
| | | }), |
| | | contentType: 'application/json;charset=UTF-8', |
| | | method: 'POST', |
| | | async: false, |
| | | success: function (res) { |
| | | if (res.code === 200) { |
| | | reset(); |
| | | tips("组托成功") |
| | | } else if (res.code === 403) { |
| | | top.location.href = baseUrl + "/pda"; |
| | | } else { |
| | | tips(res.msg, true) |
| | | } |
| | | } |
| | | }) |
| | | }); |
| | | } |
| | | } |
| | | }) |
| | | } |
| | | } |
| | | |
| | | /** |