Junjie
5 小时以前 41aeff86351d1dd94fe2408175f96475f227c1b9
#执行优化
1个文件已删除
5个文件已修改
373 ■■■■ 已修改文件
src/main/java/com/zy/common/utils/NavigateUtils.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/core/plugin/FakeProcess.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/core/utils/StationOperateProcessUtils.java 31 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/core/utils/station/StationRegularDispatchProcessor.java 85 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/test/java/com/zy/asrs/task/WrkAnalysisStationArrivalScannerTest.java 248 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/test/java/com/zy/core/utils/StationOperateProcessUtilsReroutePipelineTest.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/common/utils/NavigateUtils.java
@@ -724,7 +724,7 @@
                                                                   StationPathResolvedPolicy resolvedPolicy) {
        BasStation startStation = basStationService.getById(startStationId);
        if (startStation == null) {
            throw new CoolException("未找到该 起点 对应的站点数据");
            throw new CoolException("未找到该 " + startStationId + "起点 对应的站点数据");
        }
        NavigateSolution navigateSolution = new NavigateSolution();
@@ -732,7 +732,7 @@
        NavigateNode startNode = navigateSolution.findStationNavigateNode(stationMap, startStationId);
        NavigateNode endNode = navigateSolution.findStationNavigateNode(stationMap, endStationId);
        if (startNode == null || endNode == null) {
            throw new CoolException("未找到该 起点 或 终点 对应的节点");
            throw new CoolException("未找到该 " + startStationId + "起点 或 " + endStationId + "终点 对应的节点");
        }
        DirectStationPathContext context = new DirectStationPathContext();
src/main/java/com/zy/core/plugin/FakeProcess.java
@@ -111,6 +111,10 @@
        stationOperateProcessUtils.submitInboundStationArrivalTasks(MAIN_DISPATCH_INTERVAL_MS);
        // 输送线执行堆垛机出库后的站台流转
        stationOperateProcessUtils.submitCrnStationOutTasks(MainProcessLane.FAKE_STATION_OUT, MAIN_DISPATCH_INTERVAL_MS);
        // 检测出库任务是否已经到达目标站台
        stationOperateProcessUtils.submitStationOutExecuteFinishTasks(MAIN_DISPATCH_INTERVAL_MS);
        // 检测站台运行完成后的任务转完成
        stationOperateProcessUtils.submitCheckTaskToCompleteTasks(MAIN_DISPATCH_INTERVAL_MS);
        // 检测并处理出库排序
        stationOperateProcessUtils.submitCheckStationOutOrderTasks(MainProcessLane.FAKE_STATION_OUT_ORDER, MAIN_DISPATCH_INTERVAL_MS);
        // 监控输送线绕圈站点
src/main/java/com/zy/core/utils/StationOperateProcessUtils.java
@@ -77,14 +77,9 @@
        stationOutboundDispatchProcessor.dualCrnStationOutExecute();
    }
    //检测输送站点出库任务执行完成
    public synchronized void stationOutExecuteFinish() {
        stationRegularDispatchProcessor.stationOutExecuteFinish();
    }
    // 检测单个出库任务是否到达目标站台
    public void stationOutExecuteFinish(WrkMast wrkMast) {
        stationRegularDispatchProcessor.stationOutExecuteFinish(wrkMast);
    public void stationOutExecuteFinish(StationObjModel stationObjModel) {
        stationRegularDispatchProcessor.stationOutExecuteFinish(stationObjModel);
    }
    // 检测单个入库任务是否到达目标站台
@@ -248,17 +243,17 @@
    }
    public void submitStationOutExecuteFinishTasks(MainProcessLane lane, long minIntervalMs) {
        List<WrkMast> wrkMasts = wrkMastService.list(new QueryWrapper<WrkMast>()
                .eq("wrk_sts", WrkStsType.STATION_RUN.sts)
                .isNotNull("sta_no"));
        for (WrkMast wrkMast : wrkMasts) {
            mainProcessTaskSubmitter.submitKeyedSerialTask(
                    lane,
                    wrkMast.getStaNo(),
                    "stationOutExecuteFinish",
                    minIntervalMs,
                    () -> stationOutExecuteFinish(wrkMast)
            );
        List<BasDevp> basDevps = basDevpService.list(new QueryWrapper<>());
        for (BasDevp basDevp : basDevps) {
            for (StationObjModel stationObjModel : basDevp.getOutStationList$()) {
                mainProcessTaskSubmitter.submitKeyedSerialTask(
                        lane,
                        stationObjModel.getStationId(),
                        "stationOutExecuteFinish",
                        minIntervalMs,
                        () -> stationOutExecuteFinish(stationObjModel)
                );
            }
        }
    }
src/main/java/com/zy/core/utils/station/StationRegularDispatchProcessor.java
@@ -77,52 +77,46 @@
        }
    }
    public void stationOutExecuteFinish() {
    public void stationOutExecuteFinish(StationObjModel stationObjModel) {
        try {
            List<WrkMast> wrkMasts = wrkMastService.list(new QueryWrapper<WrkMast>().eq("wrk_sts", WrkStsType.STATION_RUN.sts));
            for (WrkMast wrkMast : wrkMasts) {
                stationOutExecuteFinish(wrkMast);
            if (stationObjModel == null) {
                return;
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
    public void stationOutExecuteFinish(WrkMast wrkMast) {
        try {
            StationThread stationThread = (StationThread) SlaveConnection.get(SlaveType.Devp, stationObjModel.getDeviceNo());
            if (stationThread == null) {
                return;
            }
            Map<Integer, StationProtocol> statusMap = stationThread.getStatusMap();
            StationProtocol stationProtocol = statusMap == null ? null : statusMap.get(stationObjModel.getStationId());
            if (stationProtocol == null) {
                return;
            }
            if (stationProtocol.getTaskNo() <= 0) {
                return;
            }
            WrkMast wrkMast = wrkMastService.selectByWorkNo(stationProtocol.getTaskNo());
            if (wrkMast == null) {
                return;
            }
            Integer wrkNo = wrkMast.getWrkNo();
            Integer targetStaNo = wrkMast.getStaNo();
            if (wrkNo == null || targetStaNo == null) {
            if (!wrkMast.getWrkSts().equals(WrkStsType.STATION_RUN.sts)) {
                return;
            }
            Integer wrkNo = wrkMast.getWrkNo();
            boolean complete = false;
            Integer targetDeviceNo = null;
            StationThread stationThread = null;
            BasStation basStation = basStationService.getOne(new QueryWrapper<BasStation>().eq("station_id", targetStaNo));
            if (basStation != null) {
                targetDeviceNo = basStation.getDeviceNo();
                stationThread = (StationThread) SlaveConnection.get(SlaveType.Devp, basStation.getDeviceNo());
                if (stationThread != null) {
                    Map<Integer, StationProtocol> statusMap = stationThread.getStatusMap();
                    StationProtocol stationProtocol = statusMap == null ? null : statusMap.get(basStation.getStationId());
                    boolean arrived = stationProtocol != null && wrkNo.equals(stationProtocol.getTaskNo());
                    if (arrived || stationThread.hasRecentArrival(basStation.getStationId(), wrkNo)) {
                        complete = true;
                        if (!arrived) {
                            News.info("输送站点出库到达判定使用最近到站补偿,工作号={},目标站={}", wrkNo, targetStaNo);
                        }
                    }
                }
            if (stationMoveCoordinator != null) {
                stationMoveCoordinator.finishSession(wrkMast.getWrkNo());
            }
            if (complete) {
                attemptClearTaskPath(stationThread, wrkNo);
                completeStationRunTask(wrkMast, targetDeviceNo);
            }
            Date now = new Date();
            wrkMast.setWrkSts(WrkStsType.STATION_RUN_COMPLETE.sts);
            wrkMast.setIoTime(now);
            wrkMast.setModiTime(now);
            wrkMastService.updateById(wrkMast);
            wrkAnalysisService.markOutboundStationComplete(wrkMast, now);
            notifyUtils.notify(String.valueOf(SlaveType.Devp), stationObjModel.getDeviceNo(), String.valueOf(wrkMast.getWrkNo()), wrkMast.getWmsWrkNo(), NotifyMsgType.STATION_OUT_TASK_RUN_COMPLETE, null);
            redisUtil.set(RedisKeyType.STATION_OUT_EXECUTE_COMPLETE_LIMIT.key + wrkMast.getWrkNo(), "lock", 60);
            attemptClearTaskPath(stationThread, wrkNo);
        } catch (Exception e) {
            e.printStackTrace();
        }
@@ -193,25 +187,6 @@
        } catch (Exception e) {
            News.error("输送站点任务运行完成后清理残留路径异常,工作号={}", taskNo, e);
        }
    }
    private void completeStationRunTask(WrkMast wrkMast, Integer deviceNo) {
        if (wrkMast == null || wrkMast.getWrkNo() == null) {
            return;
        }
        if (stationMoveCoordinator != null) {
            stationMoveCoordinator.finishSession(wrkMast.getWrkNo());
        }
        Date now = new Date();
        wrkMast.setWrkSts(WrkStsType.STATION_RUN_COMPLETE.sts);
        wrkMast.setIoTime(now);
        wrkMast.setModiTime(now);
        wrkMastService.updateById(wrkMast);
        wrkAnalysisService.markOutboundStationComplete(wrkMast, now);
        if (deviceNo != null) {
            notifyUtils.notify(String.valueOf(SlaveType.Devp), deviceNo, String.valueOf(wrkMast.getWrkNo()), wrkMast.getWmsWrkNo(), NotifyMsgType.STATION_OUT_TASK_RUN_COMPLETE, null);
        }
        redisUtil.set(RedisKeyType.STATION_OUT_EXECUTE_COMPLETE_LIMIT.key + wrkMast.getWrkNo(), "lock", 60);
    }
    private boolean offerDevpCommandWithDedup(Integer deviceNo, StationCommand command, String scene) {
src/test/java/com/zy/asrs/task/WrkAnalysisStationArrivalScannerTest.java
File was deleted
src/test/java/com/zy/core/utils/StationOperateProcessUtilsReroutePipelineTest.java
@@ -891,7 +891,6 @@
        SlaveConnection.put(SlaveType.Devp, 1, stationThread);
        try {
            utils.stationOutExecuteFinish();
            verify(stationThread, times(1)).clearPath(10335);
            verify(coordinator, times(1)).finishSession(10335);