| | |
| | | |
| | | <header class="layui-form"> |
| | | <div class="layui-input-inline"> |
| | | <label class="layui-form-label" >生产单号</label> |
| | | <label class="layui-form-label">生产单号/任务单号</label> |
| | | <div class="layui-input-inline"> |
| | | <input id="soCode" class="layui-input" autocomplete="off" oninput="findCode(this, 'soCode')" |
| | | placeholder="扫码 / 输入" style="width: 175px"> |
| | | <input id="soCodeOrFbillno" class="layui-input" autocomplete="off" oninput="findCode(this, 'soCodeOrFbillno')" |
| | | placeholder="扫码/输入,多个用|分隔" style="width: 200px"> |
| | | </div> |
| | | </div> |
| | | <div class="layui-input-inline"> |
| | | <label class="layui-form-label">任务单号</label> |
| | | <input class="layui-input" id="fbillno" onkeyup="findCode(this, 'fbillno')" placeholder="扫码 / 输入" |
| | | style="width: 175px" |
| | | autocomplete="off"> |
| | | </div> |
| | | <div class="layui-input-inline"> |
| | | <label class="layui-form-label">物料编码</label> |
| | |
| | | // 表格数据 |
| | | var materialReceiveList = []; |
| | | window.onload = function () { |
| | | document.getElementById("soCode").focus(); |
| | | document.getElementById("soCodeOrFbillno").focus(); |
| | | } |
| | | |
| | | /** |
| | |
| | | }); |
| | | }); |
| | | |
| | | var soCodeBar; |
| | | var fbillnoBar; |
| | | var soCodeOrFbillnoBar; |
| | | var invCodeBar; |
| | | var fplancommitdateBar; |
| | | |
| | | /* 扫码、输入生产单号、任务单号、物料编码和开工日期 */ |
| | | /* 扫码、输入生产单号/任务单号(支持多个,用|分隔)、物料编码和开工日期 */ |
| | | function findCode(el, type) { |
| | | soCodeBar = $('#soCode').val(); |
| | | fbillnoBar = $("#fbillno").val(); |
| | | soCodeOrFbillnoBar = $('#soCodeOrFbillno').val(); |
| | | invCodeBar = $("#invCode").val(); |
| | | fplancommitdateBar = $("#fplancommitdate").val(); |
| | | |
| | | // 去除空格 |
| | | if (soCodeBar) { |
| | | soCodeBar = soCodeBar.trim(); |
| | | } |
| | | if (fbillnoBar) { |
| | | fbillnoBar = fbillnoBar.trim(); |
| | | if (soCodeOrFbillnoBar) { |
| | | soCodeOrFbillnoBar = soCodeOrFbillnoBar.trim(); |
| | | } |
| | | if (invCodeBar) { |
| | | invCodeBar = invCodeBar.trim(); |
| | |
| | | } |
| | | |
| | | switch (type) { |
| | | case 'soCode': |
| | | break; |
| | | case 'fbillno': |
| | | case 'soCodeOrFbillno': |
| | | break; |
| | | case 'invCode': |
| | | break; |
| | |
| | | break; |
| | | } |
| | | |
| | | // 如果生产单号和任务单号和物料编码都为空,不执行查询 |
| | | if (!soCodeBar && !fbillnoBar&&!invCodeBar) { |
| | | // 如果生产单号/任务单号和物料编码都为空,不执行查询 |
| | | if (!soCodeOrFbillnoBar && !invCodeBar) { |
| | | // 清空表格数据 |
| | | tableIns.reload({ |
| | | data: [], |
| | |
| | | |
| | | // 构建查询参数 |
| | | var params = {}; |
| | | if (soCodeBar) { |
| | | params.soCode = soCodeBar; |
| | | |
| | | // 处理生产单号/任务单号(支持多个,用|分隔) |
| | | if (soCodeOrFbillnoBar) { |
| | | // 直接传递原始值,后端会处理多个值的OR查询 |
| | | params.soCodeOrFbillno = soCodeOrFbillnoBar; |
| | | } |
| | | if (fbillnoBar) { |
| | | params.fbillno = fbillnoBar; |
| | | } |
| | | |
| | | if (invCodeBar) { |
| | | params.invCode = invCodeBar; |
| | | } |
| | |
| | | if (successCount > 0) { |
| | | tips("成功出库 " + successCount + " 条记录"); |
| | | // 清空输入框并刷新列表 |
| | | $("#soCode").val(""); |
| | | $("#fbillno").val(""); |
| | | $("#soCodeOrFbillno").val(""); |
| | | $("#invCode").val(""); |
| | | $("#fplancommitdate").val(""); |
| | | materialReceiveList = []; |
| | | tableIns.reload({data: materialReceiveList}); |
| | | document.getElementById("soCode").focus(); |
| | | document.getElementById("soCodeOrFbillno").focus(); |
| | | } |
| | | if (failCount > 0) { |
| | | tips("出库失败 " + failCount + " 条记录", true); |
| | |
| | | } |
| | | |
| | | function reset() { |
| | | $("#soCode").val(null); |
| | | $("#fbillno").val(null); |
| | | $("#soCodeOrFbillno").val(null); |
| | | $("#invCode").val(null); |
| | | $("#fplancommitdate").val(null); |
| | | materialReceiveList = []; |
| | | tableIns.reload({data: materialReceiveList}); |
| | | layer.closeAll(); |
| | | document.getElementById("soCode").focus(); |
| | | document.getElementById("soCodeOrFbillno").focus(); |
| | | } |
| | | </script> |
| | | </html> |