自动化立体仓库 - WCS系统
#
Junjie
2023-12-13 bd0d3a69bc5a38c11af4aa7222806bacdea97318
src/main/java/com/zy/core/thread/LiftThread.java
@@ -288,6 +288,7 @@
        OperateResult result = siemensS7Net.Write("DB83.0", array);
        if (result != null && result.IsSuccess) {
            liftProtocol.setSendTime(System.currentTimeMillis());//指令下发时间
            News.info("提升机命令下发[id:{}] >>>>> {}", slave.getId(), JSON.toJSON(command));
            OutputQueue.LIFT.offer(MessageFormat.format("【{0}】[id:{1}] >>>>> 命令下发: {2}", DateUtils.convert(new Date()), slave.getId(), JSON.toJSON(command)));
            return true;
@@ -329,7 +330,7 @@
        redisCommand.setCommandStep(0);//命令执行步序
        redisCommand.setAssignCommand(assignCommand);//命令
        //任务数据保存到redis
        redisUtil.set("lift_wrk_no_" + assignCommand.getTaskNo(), JSON.toJSONString(redisCommand));
        redisUtil.set(RedisKeyType.LIFT.key + assignCommand.getTaskNo(), JSON.toJSONString(redisCommand));
        liftProtocol.setAssignCommand(assignCommand);
        liftProtocol.setProtocolStatus(LiftProtocolStatusType.WORKING);
        //执行下发任务
@@ -344,7 +345,7 @@
        }
        WrkMastMapper wrkMastMapper = SpringUtils.getBean(WrkMastMapper.class);
        Object o = redisUtil.get("lift_wrk_no_" + wrkNo);
        Object o = redisUtil.get(RedisKeyType.LIFT.key + wrkNo);
        if (o == null) {
            return false;
        }
@@ -357,6 +358,10 @@
        //取出命令
        NyLiftCommand command = commands.get(commandStep);
        if (!redisCommand.getLiftNo().equals(liftProtocol.getLiftNo())) {
            return false;
        }
        //下发命令
        if (!write(command)) {
@@ -376,7 +381,7 @@
            short[] commandArr = getCommandArr(command);//获取命令报文
            BasLiftOpt opt = new BasLiftOpt(
                    redisCommand.getWrkNo().intValue(),
                    redisCommand.getLiftNo().intValue(),
                    liftProtocol.getLiftNo().intValue(),
                    new Date(),
                    null,
                    null,
@@ -395,11 +400,11 @@
            commandStep++;
            redisCommand.setCommandStep(commandStep);
            //任务数据保存到redis
            redisUtil.set("lift_wrk_no_" + redisCommand.getWrkNo(), JSON.toJSONString(redisCommand));
            redisUtil.set(RedisKeyType.LIFT.key + redisCommand.getWrkNo(), JSON.toJSONString(redisCommand));
        }else {
            //已执行完成
            //删除redis
            redisUtil.del("lift_wrk_no_" + redisCommand.getWrkNo());
            redisUtil.del(RedisKeyType.LIFT.key + redisCommand.getWrkNo());
            //对主线程抛出等待确认状态waiting
            liftProtocol.setProtocolStatus(LiftProtocolStatusType.WAITING);