chen.lin
2 天以前 42b24af07f1ec2d1a375232d754128ba41d56f0a
pda匹配单号
2个文件已修改
123 ■■■■■ 已修改文件
src/main/java/com/zy/asrs/controller/MaterialReceiveController.java 65 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/webapp/views/pda/materialReceiveOut.html 58 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/controller/MaterialReceiveController.java
@@ -41,24 +41,55 @@
                  @RequestParam(required = false) String condition,
                  @RequestParam(required = false) Boolean pdaQuery,
                  @RequestParam Map<String, Object> param) {
        EntityWrapper<MaterialReceive> wrapper = new EntityWrapper<>();
        excludeTrash(param);
        // 移除pdaQuery参数,因为它不是数据库字段,只是控制参数
        param.remove("pdaQuery");
        convert(param, wrapper);
        allLike(MaterialReceive.class, param.keySet(), wrapper, condition);
        // 参考其他出库模块,PDA出库查询时过滤掉已全部出库的物料(只显示还有剩余数量的)
        // 通过 pdaQuery 参数判断是否是PDA出库查询
        if (pdaQuery != null && pdaQuery) {
            // PDA出库查询:只显示剩余数量大于0的记录
            wrapper.gt("remain_qty", 0);
        try {
            EntityWrapper<MaterialReceive> wrapper = new EntityWrapper<>();
            excludeTrash(param);
            // 移除pdaQuery参数,因为它不是数据库字段,只是控制参数
            param.remove("pdaQuery");
            // 处理生产单号/任务单号的多个值查询(用|分隔)
            if (param.containsKey("soCodeOrFbillno")) {
                String soCodeOrFbillno = String.valueOf(param.get("soCodeOrFbillno"));
                param.remove("soCodeOrFbillno");
                // 分割多个值
                String[] codeArray = soCodeOrFbillno.split("\\|");
                List<String> validCodes = new ArrayList<>();
                for (String codeStr : codeArray) {
                    String code = codeStr.trim();
                    if (code.length() > 0) {
                        validCodes.add(code);
                    }
                }
                if (!validCodes.isEmpty()) {
                    // 构建OR查询条件
                    // 格式:so_code IN (value1, value2, ...) OR fbillno IN (value1, value2, ...)
                    wrapper.andNew()
                          .in("so_code", validCodes)
                          .or()
                          .in("fbillno", validCodes);
                }
            }
            convert(param, wrapper);
            allLike(MaterialReceive.class, param.keySet(), wrapper, condition);
            // 参考其他出库模块,PDA出库查询时过滤掉已全部出库的物料(只显示还有剩余数量的)
            // 通过 pdaQuery 参数判断是否是PDA出库查询
            if (pdaQuery != null && pdaQuery) {
                // PDA出库查询:只显示剩余数量大于0的记录
                wrapper.gt("remain_qty", 0);
            }
            if (!Cools.isEmpty(orderByField)) {
                wrapper.orderBy(humpToLine(orderByField), "asc".equals(orderByType));
            }
            return R.ok(materialReceiveService.selectPage(new Page<>(curr, limit), wrapper));
        } catch (Exception e) {
            e.printStackTrace();
            return R.error("查询失败: " + e.getMessage());
        }
        if (!Cools.isEmpty(orderByField)) {
            wrapper.orderBy(humpToLine(orderByField), "asc".equals(orderByType));
        }
        return R.ok(materialReceiveService.selectPage(new Page<>(curr, limit), wrapper));
    }
    @RequestMapping(value = "/materialReceive/batchSave/auth", method = RequestMethod.POST)
src/main/webapp/views/pda/materialReceiveOut.html
@@ -61,17 +61,11 @@
<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>
@@ -156,7 +150,7 @@
    // 表格数据
    var materialReceiveList = [];
    window.onload = function () {
        document.getElementById("soCode").focus();
        document.getElementById("soCodeOrFbillno").focus();
    }
    /**
@@ -269,24 +263,19 @@
        });
    });
    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();
@@ -296,9 +285,7 @@
        }
        
        switch (type) {
            case 'soCode':
                break;
            case 'fbillno':
            case 'soCodeOrFbillno':
                break;
            case 'invCode':
                break;
@@ -308,8 +295,8 @@
                break;
        }
        // 如果生产单号和任务单号和物料编码都为空,不执行查询
        if (!soCodeBar && !fbillnoBar&&!invCodeBar) {
        // 如果生产单号/任务单号和物料编码都为空,不执行查询
        if (!soCodeOrFbillnoBar && !invCodeBar) {
            // 清空表格数据
            tableIns.reload({
                data: [],
@@ -320,12 +307,13 @@
        // 构建查询参数
        var params = {};
        if (soCodeBar) {
            params.soCode = soCodeBar;
        // 处理生产单号/任务单号(支持多个,用|分隔)
        if (soCodeOrFbillnoBar) {
            // 直接传递原始值,后端会处理多个值的OR查询
            params.soCodeOrFbillno = soCodeOrFbillnoBar;
        }
        if (fbillnoBar) {
            params.fbillno = fbillnoBar;
        }
        if (invCodeBar) {
            params.invCode = invCodeBar;
        }
@@ -507,13 +495,12 @@
            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);
@@ -524,14 +511,13 @@
    }
    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>