自动化立体仓库 - WMS系统
src/main/java/com/zy/asrs/controller/OpenController.java
@@ -439,8 +439,7 @@
    }
    /**
     * 组托信息下发
     * return
     * 7.3 组托信息下发
     */
    @PostMapping("/comb/auth")
    public synchronized R comb(@RequestBody ArrayList<MesToCombParam> param, HttpServletRequest request) {
@@ -487,9 +486,8 @@
    }
    /**
     * 出库通知单
     * 7.11 出库通知单(传递有序无序规则)
     */
    @PostMapping("/outOrder")
    public synchronized R outOrder(@RequestBody ArrayList<OutTaskParam> params, HttpServletRequest request) {
        if (Cools.isEmpty(params)) {
@@ -497,32 +495,51 @@
        }
        log.info("[outOrder] cache: {}", JSON.toJSONString(params));
        request.setAttribute("cache", params);
        Set<String> orderIds = new LinkedHashSet<>();
        Map<String, List<OutTaskParam>> linesByBatch = new LinkedHashMap<>();
        for (OutTaskParam outTaskParam : params) {
            if (Cools.isEmpty(outTaskParam) || Cools.isEmpty(outTaskParam.getOrderId())) {
                return R.error("出库单号不能为空");
            }
            orderIds.add(outTaskParam.getOrderId());
            if (Cools.isEmpty(outTaskParam.getBatchSeq())) {
                outTaskParam.setBatchSeq(outTaskParam.getOrderId());
            }
            if (Cools.isEmpty(outTaskParam.getStationId())) {
                return R.error("托盘「" + outTaskParam.getPalletId() + "」出库口编码不能为空");
            }
            linesByBatch.computeIfAbsent(outTaskParam.getBatchSeq(), k -> new ArrayList<>()).add(outTaskParam);
        }
        Map<String, List<OutTaskParam>> linesByOrder = new LinkedHashMap<>();
        for (OutTaskParam outTaskParam : params) {
            linesByOrder.computeIfAbsent(outTaskParam.getOrderId(), k -> new ArrayList<>()).add(outTaskParam);
        }
        for (Map.Entry<String, List<OutTaskParam>> entry : linesByOrder.entrySet()) {
            String oid = entry.getKey();
        for (Map.Entry<String, List<OutTaskParam>> entry : linesByBatch.entrySet()) {
            List<OutTaskParam> lines = entry.getValue();
            List<Integer> seqs = new ArrayList<>(lines.size());
            OutTaskParam head = lines.get(0);
            String oid = head.getOrderId();
            String batchSeq = head.getBatchSeq();
            boolean hasZero = false;
            boolean hasPositive = false;
            List<Integer> orderedSeqs = new ArrayList<>(lines.size());
            for (OutTaskParam line : lines) {
                if (line.getSeq() == null) {
                    return R.error("出库单「" + oid + "」序号不能为空");
                    return R.error("出库单「" + oid + "」批次「" + batchSeq + "」序号不能为空");
                }
                seqs.add(line.getSeq());
                if (line.getSeq() < 0) {
                    return R.error("出库单「" + oid + "」批次「" + batchSeq + "」序号不能小于0");
            }
            Collections.sort(seqs);
            for (int i = 0; i < seqs.size(); i++) {
                if (!String.valueOf(seqs.get(i)).equals(String.valueOf(i + 1))) {
                    return R.error("出库单「" + oid + "」序号不连贯");
                if (line.getSeq() == 0) {
                    hasZero = true;
                } else {
                    hasPositive = true;
                    orderedSeqs.add(line.getSeq());
                }
            }
            if (hasZero && hasPositive) {
                return R.error("出库单「" + oid + "」批次「" + batchSeq + "」序号不能混用无序和有序");
            }
            if (!hasZero) {
                Collections.sort(orderedSeqs);
                for (int i = 0; i < orderedSeqs.size(); i++) {
                    if (!Objects.equals(orderedSeqs.get(i), i + 1)) {
                        return R.error("出库单「" + oid + "」批次「" + batchSeq + "」序号不连贯");
                    }
                }
            }
        }
@@ -589,6 +606,36 @@
    }
    /**
     * 7.9 出库异常变动上报
     */
    @PostMapping("/order/pakout/abnormal/report/v1")
    public synchronized R outOrderAbnormalReport(@RequestBody OutOrderAbnormalReportParam param, HttpServletRequest request) {
        if (request != null) {
            log.info("[outOrderAbnormalReport] cache: {}", param == null ? "null" : JSON.toJSONString(param));
            request.setAttribute("cache", param);
        }
        if (Cools.isEmpty(param) || Cools.isEmpty(param.getPalletId())) {
            return R.error("palletId不能为空");
        }
        return openService.outOrderAbnormalReport(param);
    }
    /**
     * 7.10 出库异常变动处理
     */
    @PostMapping("/order/pakout/abnormal/handle/v1")
    public synchronized R outOrderAbnormalHandle(@RequestBody OutOrderAbnormalHandleParam param, HttpServletRequest request) {
        if (request != null) {
            log.info("[outOrderAbnormalHandle] cache: {}", param == null ? "null" : JSON.toJSONString(param));
            request.setAttribute("cache", param);
        }
        if (Cools.isEmpty(param) || Cools.isEmpty(param.getPalletId())) {
            return R.error("palletId不能为空");
        }
        return openService.outOrderAbnormalHandle(param);
    }
    /**
     * pause out order
     */
    @PostMapping("/order/pakout/pause/default/v1")
@@ -603,6 +650,10 @@
        return openService.pakoutOrderPause(param);
    }
    private String buildOutOrderBatchKey(OutTaskParam param) {
        return param.getOrderId() + "#" + param.getBatchSeq();
    }
    /*************************************电视机程序***********************************************/