自动化立体仓库 - WCS系统
log
Junjie
2023-06-19 a5d3d6b0df0c0de059864e18e17aa690139a14f2
log
2个文件已修改
71 ■■■■ 已修改文件
src/main/java/com/zy/core/thread/LiftThread.java 35 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/core/thread/ShuttleThread.java 36 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/core/thread/LiftThread.java
@@ -283,6 +283,12 @@
            array = tmp;
        }
        try {
            Thread.sleep(1000);//命令下发前休眠1s
        } catch (InterruptedException e) {
            throw new RuntimeException(e);
        }
        OperateResult result = modbusTcpNet.Write("41088", array);;
        if (result != null && result.IsSuccess) {
            News.info("提升机命令下发[id:{}] >>>>> {}", slave.getId(), JSON.toJSON(command));
@@ -400,6 +406,21 @@
            News.info("提升机命令下发成功,提升机号={},任务数据={}", command.getLiftNo(), JSON.toJSON(command));
            liftProtocol.setWrkTime(new Date());//更新工作时间
            //保存数据到数据库做流水
            BasLiftOptService liftOptService = SpringUtils.getBean(BasLiftOptService.class);
            if (liftOptService != null) {
                BasLiftOpt opt = new BasLiftOpt(
                        redisCommand.getWrkNo().intValue(),
                        redisCommand.getLiftNo().intValue(),
                        new Date(),
                        null,
                        null,
                        null,
                        JSON.toJSONString(command)
                );
                liftOptService.insert(opt);
            }
            try {
                Thread.sleep(1000);//命令下发完成后休眠1s
            } catch (InterruptedException e) {
@@ -416,20 +437,6 @@
                redisUtil.set("lift_wrk_no_" + redisCommand.getWrkNo(), JSON.toJSONString(redisCommand));
            }else {
                //已执行完成
                //保存数据到数据库做流水
                BasLiftOptService liftOptService = SpringUtils.getBean(BasLiftOptService.class);
                if (liftOptService != null) {
                    BasLiftOpt opt = new BasLiftOpt(
                            redisCommand.getWrkNo().intValue(),
                            redisCommand.getLiftNo().intValue(),
                            new Date(),
                            null,
                            null,
                            null,
                            JSON.toJSONString(assignCommand)
                    );
                    liftOptService.insert(opt);
                }
                //删除redis
                redisUtil.del("lift_wrk_no_" + redisCommand.getWrkNo());
src/main/java/com/zy/core/thread/ShuttleThread.java
@@ -364,6 +364,12 @@
        //指令结束位
        array[16] = command.getCommandEnd();
        try {
            Thread.sleep(1000);//命令下发前休眠1s
        } catch (InterruptedException e) {
            throw new RuntimeException(e);
        }
        OperateResult result = modbusTcpNet.Write("0", array);;
        if (result != null && result.IsSuccess) {
            News.info("四向穿梭车命令下发[id:{}] >>>>> {}", slave.getId(), JSON.toJSON(command));
@@ -781,7 +787,6 @@
            }
        }
        //下发命令
        if (!write(command)) {
            News.error("四向穿梭车命令下发失败,穿梭车号={},任务数据={}", shuttleProtocol.getShuttleNo(), JSON.toJSON(command));
@@ -789,22 +794,6 @@
        } else {
            News.info("四向穿梭车命令下发成功,穿梭车号={},任务数据={}", shuttleProtocol.getShuttleNo(), JSON.toJSON(command));
            try {
                Thread.sleep(1000);//命令下发完后休眠1s
            } catch (InterruptedException e) {
                throw new RuntimeException(e);
            }
            //判断数据是否执行完成
            if (commandStep < size - 1) {
                //更新redis数据
                //步序增加
                commandStep++;
                redisCommand.setCommandStep(commandStep);
                //任务数据保存到redis
                redisUtil.set("shuttle_wrk_no_" + redisCommand.getWrkNo(), JSON.toJSONString(redisCommand));
            }else {
                //已执行完成
                //保存数据到数据库做流水
                BasShuttleOptService shuttleOptService = SpringUtils.getBean(BasShuttleOptService.class);
                if (shuttleOptService != null) {
@@ -818,11 +807,22 @@
                            null,
                            null,
                            null,
                            JSON.toJSONString(assignCommand)
                        JSON.toJSONString(command)
                    );
                    shuttleOptService.insert(opt);
                }
            //判断数据是否执行完成
            if (commandStep < size - 1) {
                //更新redis数据
                //步序增加
                commandStep++;
                redisCommand.setCommandStep(commandStep);
                //任务数据保存到redis
                redisUtil.set("shuttle_wrk_no_" + redisCommand.getWrkNo(), JSON.toJSONString(redisCommand));
            }else {
                //已执行完成
                if (redisCommand.getLiftSecurityMk()) {
                    //曾锁定过提升机,需要进行解锁
                    if (liftProtocol != null) {