Junjie
2023-08-01 77bef18c6d0970c72df159f380fd06d176a8df43
小车进提升机检测方案
3个文件已修改
68 ■■■■■ 已修改文件
src/main/java/com/zy/common/utils/NavigatePositionConvert.java 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/core/model/protocol/NyShuttleProtocol.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/core/thread/NyShuttleThread.java 56 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/common/utils/NavigatePositionConvert.java
@@ -33,8 +33,14 @@
        return node;
    }
    //牛眼坐标转WCS库位号
    //WCS坐标转WCS库位号
    public static String xyzToLocNo(int x, int y, int z) {
        String locNo = Utils.getLocNo(x, y, z);
        return locNo;
    }
    //牛眼坐标转WCS库位号
    public static String nyXyzToLocNo(int x, int y, int z) {
        int[] ints = NyXyzToWCSXyz(x, y, z);
        String locNo = Utils.getLocNo(ints[0],ints[1],ints[2]);
        return locNo;
src/main/java/com/zy/core/model/protocol/NyShuttleProtocol.java
@@ -375,7 +375,7 @@
        if (this.getPoint() == null) {
            return "";
        }
        return NavigatePositionConvert.xyzToLocNo(this.getPoint().getX(), this.getPoint().getY(), this.getPoint().getZ());
        return NavigatePositionConvert.nyXyzToLocNo(this.getPoint().getX(), this.getPoint().getY(), this.getPoint().getZ());
    }
    public String getCoord$() {
@@ -386,7 +386,7 @@
    }
    public void setPoint(NyShuttlePointClass point) {
        String locNo = NavigatePositionConvert.xyzToLocNo(point.getX(), point.getY(), point.getZ());
        String locNo = NavigatePositionConvert.nyXyzToLocNo(point.getX(), point.getY(), point.getZ());
        this.point = point;
        this.currentLocNo = locNo;
    }
src/main/java/com/zy/core/thread/NyShuttleThread.java
@@ -5,6 +5,7 @@
import com.core.common.DateUtils;
import com.core.common.SpringUtils;
import com.zy.asrs.entity.*;
import com.zy.asrs.mapper.WrkMastMapper;
import com.zy.asrs.service.*;
import com.zy.asrs.utils.Utils;
@@ -410,20 +411,6 @@
        }else {
            //已执行完成
//            if (redisCommand.getLiftSecurityMk()) {
//                //曾锁定过提升机,需要进行解锁
//                if (liftProtocol != null) {
//                    liftProtocol.setSecurityMk(false);
//                }
//            }
//            String locNo = shuttleProtocol.getLocNo() == null ? shuttleProtocol.getSourceLocNo() : shuttleProtocol.getLocNo();
//            if (locNo != null) {
//                //解除锁定的库位路径
//                NavigateMapData navigateMapData = new NavigateMapData(Utils.getLev(locNo));
//                navigateMapData.writeNavigateNodeToRedisMap(redisCommand.getAssignCommand().getNodes(), false);
//            }
            //删除redis
            redisUtil.del("shuttle_wrk_no_" + redisCommand.getWrkNo());
@@ -451,8 +438,33 @@
            return false;
        }
        ShuttleRedisCommand redisCommand = JSON.parseObject(o.toString(), ShuttleRedisCommand.class);
        //当前步序
        int commandStep = redisCommand.getCommandStep();
        //检测是否存在提升机口的指令
        List<NyShuttleHttpCommand> commands = redisCommand.getAssignCommand().getCommands();
        if (commands.isEmpty()) {
            return false;
        }
        NyShuttleHttpCommand command = commands.get(commandStep);//当前命令
        if (!command.getMsgType().equals("intoLift")) {
            return true;//不是入提升机命令,直接放行
        }
        //获取起点(输送站点)
        NyShuttleProtocol.NyShuttlePointClass start = JSON.parseObject(command.getRequest().getBody().get("start").toString(), NyShuttleProtocol.NyShuttlePointClass.class);
        //将牛眼坐标转换成WCS库位号
        String startLocNo = NavigatePositionConvert.nyXyzToLocNo(start.getX(), start.getY(), start.getZ());
        BasDevpService basDevpService = SpringUtils.getBean(BasDevpService.class);
        BasDevp basDevp = basDevpService.queryByLocNo(startLocNo);
        if (basDevp == null) {
            return false;//查不到站点,禁止下发
        }
        //拿到提升机线程
        LiftThread liftThread = (LiftThread) SlaveConnection.get(SlaveType.Lift, 1);
        LiftThread liftThread = (LiftThread) SlaveConnection.get(SlaveType.Lift, basDevp.getLiftNo());
        if (liftThread == null) {
            return false;
        }
@@ -460,21 +472,13 @@
        if (liftProtocol == null) {
            return false;
        }
        ShuttleRedisCommand redisCommand = JSON.parseObject(o.toString(), ShuttleRedisCommand.class);
        //当前步序
        int commandStep = redisCommand.getCommandStep();
        //检测是否存在提升机口的指令
        List<NyShuttleHttpCommand> commands = redisCommand.getAssignCommand().getCommands();
        if (commands.size() == 0) {
        if (!liftProtocol.isIdle()) {
            return false;
        }
        if (!commands.get(commandStep).getMsgType().equals("move")) {
            return true;//不是行走命令,直接放行
        if (liftProtocol.getLev().intValue() == Utils.getLev(shuttleProtocol.getCurrentLocNo())) {
            return true;//提升机达到小车楼层,放行
        }
        return false;//默认不放行
    }