| | |
| | | |
| | | <div id="btn-con"> |
| | | <button style="margin-right: 20px" onclick="reset()">重置</button> |
| | | <button >组托</button> |
| | | <button onclick="comb()">组托</button> |
| | | <span id="tips"></span> |
| | | </div> |
| | | |
| | |
| | | } else { |
| | | alert(res.msg); |
| | | } |
| | | }) |
| | | } |
| | | |
| | | // 组托 |
| | | function comb() { |
| | | var barcode = code.value; |
| | | if (isEmpty(barcode)) { |
| | | tips("托盘条码为空", true); |
| | | // document.getElementById("code").focus(); |
| | | return; |
| | | } |
| | | if (matData.length === 0) { |
| | | tips("请提取物料", true); |
| | | return; |
| | | } |
| | | httpRequest({ |
| | | httpUrl: baseUrl+"/mobile/comb/auth", |
| | | type: 'post', |
| | | data: JSON.stringify({ |
| | | barcode: barcode, |
| | | combMats: matData |
| | | }), |
| | | }, function (res) { |
| | | if (res.code === 200) { |
| | | if (res.data != null) { |
| | | // 样式 |
| | | matMsg.style.display = 'none'; |
| | | btnCon.style.display = 'none'; |
| | | matDetail.style.display = 'block'; |
| | | // 填充数据 |
| | | matName.value = res.data.matName; |
| | | str1.value = res.data.str1; |
| | | count.value = initMatCount; |
| | | } else { |
| | | matMsg.style.display = 'block'; |
| | | btnCon.style.display = 'block'; |
| | | matDetail.style.display = 'none'; |
| | | } |
| | | } else { |
| | | alert(res.msg); |
| | | } |
| | | }) |
| | | $.ajax({ |
| | | url: baseUrl+"/mobile/comb/auth", |
| | | 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) |
| | | } |
| | | } |
| | | }) |
| | | } |
| | | |
| | |
| | | } |
| | | if (toPush) { |
| | | matData.push(data); |
| | | } |
| | | var html = ""; |
| | | for (var i=0;i<matData.length;i++) { |
| | | html += " <div>\n" + |
| | | html += " <div class='table-data'>\n" + |
| | | " <span>" + matData[i].matnr + "</span>\n" + |
| | | " <span>" + matData[i].matName + "</span>\n" + |
| | | " <span>" + matData[i].str1 + "</span>\n" + |
| | |
| | | |
| | | ttbody.innerHTML = html; |
| | | } |
| | | } |
| | | |
| | | // 重置 |
| | | function reset() { |
| | | code.value = ""; |
| | | matnr.value = ""; |
| | | cancel(); |
| | | while(ttbody.hasChildNodes()) { |
| | | ttbody.removeChild(ttbody.firstChild); |
| | | |
| | | } |
| | | } |
| | | |
| | | /** |