| | |
| | | } |
| | | }); |
| | | |
| | | // 获取工作区 |
| | | function getDevp(){ |
| | | $.ajax({ |
| | | url: baseUrl+"/available/put/site", |
| | | headers: {'token': localStorage.getItem('token')}, |
| | | method: 'POST', |
| | | async: false, |
| | | success: function (res) { |
| | | if (res.code === 200){ |
| | | var tpl = $("#devpSelectTemplate").html(); |
| | | var template = Handlebars.compile(tpl); |
| | | var html = template(res); |
| | | $('#devpSelect').append(html); |
| | | layui.form.render('select'); |
| | | } else if (res.code === 403){ |
| | | top.location.href = baseUrl+"/pda"; |
| | | }else { |
| | | tips("获取工作区失败", true) |
| | | } |
| | | } |
| | | }) |
| | | } |
| | | getDevp(); |
| | | }); |
| | | |
| | | // 获取工作区 |
| | | function getDevp(){ |
| | | $.ajax({ |
| | | url: baseUrl+"/available/put/site", |
| | | headers: {'token': localStorage.getItem('token')}, |
| | | method: 'POST', |
| | | async: false, |
| | | success: function (res) { |
| | | if (res.code === 200){ |
| | | var tpl = $("#devpSelectTemplate").html(); |
| | | var template = Handlebars.compile(tpl); |
| | | var html = template(res); |
| | | $('#devpSelect').append(html); |
| | | layui.form.render('select'); |
| | | } else if (res.code === 403){ |
| | | top.location.href = baseUrl+"/pda"; |
| | | }else { |
| | | tips("获取工作区失败", true) |
| | | } |
| | | var matCodeLayerIdx; |
| | | function getMat() { |
| | | matCodeLayerIdx = layer.open({ |
| | | type: 2, |
| | | title: '提取物料', |
| | | shade: [0.3,'#000'], |
| | | area: ['90%', '90%'], |
| | | content: 'matQuery.html', |
| | | success: function(layero, index){ |
| | | $('.layui-layer-title').css('font-size', '16px'); |
| | | }, |
| | | end: function () { |
| | | $('#mat-btn').focus(); |
| | | } |
| | | }) |
| | | }); |
| | | } |
| | | getDevp(); |
| | | |
| | | |
| | | |
| | | // 添加表格数据 |
| | | // var matData = []; |
| | | |
| | | function addTableData(data) { |
| | | for (var i = 0; i < data.length; i++) { |
| | | var toPush = true; |
| | | for (var j = 0; j < matData.length; j++) { |
| | | if (data[i].matNo === matData[j].matNo && data[i].mnemonic === matData[j].mnemonic) { |
| | | matData[j].count = Number(matData[j].count) + Number(data[i].count); |
| | | toPush = false; |
| | | } |
| | | } |
| | | if (toPush) { |
| | | matData.push(data[i]); |
| | | sourceData.push({ |
| | | matNo: data[i].matNo, |
| | | count: data[i].count, |
| | | supplier: data[i].supplier, |
| | | mnemonic: data[i].mnemonic, |
| | | }); |
| | | if (isEmpty(data.matName)){ |
| | | tips("提取失败", true); |
| | | return; |
| | | } |
| | | let toPush = true; |
| | | for (var j=0;j<matData.length;j++){ |
| | | if (data.matNo === matData[j].matNo) { |
| | | matData[j].count = Number(matData[j].count) + Number(data.count); |
| | | toPush = false; |
| | | } |
| | | } |
| | | if (toPush) { |
| | | matData.push(data); |
| | | } |
| | | tips("提取成功"); |
| | | tableIns.reload({data: matData}); |
| | | // $("#comb-btn").focus(); |
| | | } |
| | | |
| | | |