自动化立体仓库 - WCS系统
log
Junjie
2023-06-19 d4f1965d2dd5c1add73778f42e18d6153890858c
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,10 +406,19 @@
            News.info("提升机命令下发成功,提升机号={},任务数据={}", command.getLiftNo(), JSON.toJSON(command));
            liftProtocol.setWrkTime(new Date());//更新工作时间
            try {
                Thread.sleep(1000);//命令下发完成后休眠1s
            } catch (InterruptedException e) {
                throw new RuntimeException(e);
            //保存数据到数据库做流水
            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);
            }
            //判断数据是否执行完成
@@ -416,20 +431,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());