自动化立体仓库 - WCS系统
#
Junjie
2023-10-14 ae0d613e60b2308d23b2760d514d0ff3356bfa48
src/main/java/com/zy/core/thread/NyShuttleThread.java
@@ -336,6 +336,7 @@
            );
            opt.setSend(1);//已下发
            opt.setResponse(JSON.toJSONString(result));//请求响应
            opt.setDeviceWrk(command.getWrkNo().toString());//设备工作号
            shuttleOptService.insert(opt);
        }
@@ -369,6 +370,7 @@
        }
        WrkMastMapper wrkMastMapper = SpringUtils.getBean(WrkMastMapper.class);
        WrkMast wrkMast = wrkMastMapper.selectByWorkNo(wrkNo.intValue());
        Object o = redisUtil.get("shuttle_wrk_no_" + wrkNo);
        if (o == null) {
@@ -446,8 +448,9 @@
        }
        if (shuttleProtocol.getFree() == ShuttleStatusType.BUSY.id) {
            //停止充电
            if(!(command.getRequest().getBody().get("requestType").equals("stopCharge") && shuttleProtocol.getChargState() == 1)){
            String requestType = command.getRequest().getBody().get("requestType").toString();
            //停止充电 管制命令
            if(!(requestType.equals("stopCharge") && shuttleProtocol.getChargState() == 1) && !requestType.equals("resume")){
                return false;//小车状态忙,禁止执行命令
            }
        }
@@ -463,8 +466,15 @@
        }
        if (command.getRequest().getBody().get("requestType").equals("move")) {
            ArrayList<int[]> whiteList = new ArrayList<>();//设置节点的白名单
            if (wrkMast != null && ((wrkMast.getIoType() > 100 && wrkMast.getIoType() < 200) || wrkMast.getIoType() == 11)) {
                //出库任务,不检测首节点
                int[] startArr = NavigatePositionConvert.positionToXY(wrkMast.getSourceLocNo());//开始节点
                whiteList.add(startArr);
            }
            //检测路径是否可行走
            if (!checkPath(command.getNodes(), nextNodes, redisCommand)) {
            if (!checkPath(command.getNodes(), nextNodes, whiteList)) {
                return false;
            }
@@ -634,17 +644,17 @@
     * 检测路径是否可行走
     * 如果路径为目标库位,但不可行走,系统将尝试重新计算路径
     */
    private boolean checkPath(List<NavigateNode> currentNodes, List<NavigateNode> nextNodes, ShuttleRedisCommand redisCommand) {
    private boolean checkPath(List<NavigateNode> currentNodes, List<NavigateNode> nextNodes, List<int[]> whitePoints) {
        //检测路径是否可行走(检查路径锁定状态,检测路径是否有其他小车)
        //检测当前行走路径,和下一步路径
        boolean checkPathIsAvailable = NavigateUtils.checkPathIsAvailable(currentNodes, shuttleProtocol.getShuttleNo().intValue(), Utils.getLev(shuttleProtocol.getCurrentLocNo()));
        boolean checkPathIsAvailable = NavigateUtils.checkPathIsAvailable(currentNodes, shuttleProtocol.getShuttleNo().intValue(), Utils.getLev(shuttleProtocol.getCurrentLocNo()), whitePoints);
        if (nextNodes == null) {
            if (checkPathIsAvailable) {
                return true;//可行走
            }
            return false;
        }else {
            boolean checkPathIsAvailable2 = NavigateUtils.checkPathIsAvailable(nextNodes, shuttleProtocol.getShuttleNo().intValue(), Utils.getLev(shuttleProtocol.getCurrentLocNo()));
            boolean checkPathIsAvailable2 = NavigateUtils.checkPathIsAvailable(nextNodes, shuttleProtocol.getShuttleNo().intValue(), Utils.getLev(shuttleProtocol.getCurrentLocNo()), whitePoints);
            if (checkPathIsAvailable && checkPathIsAvailable2) {
                return true;//可行走
            }