自动化立体仓库 - WCS系统
Junjie
2023-12-28 cc42d79563a119ffb37302092c445e73ab76e274
src/main/java/com/zy/core/thread/NyShuttleThread.java
@@ -241,7 +241,23 @@
                    OutputQueue.SHUTTLE.offer(MessageFormat.format("【{0}】[id:{1}] <<<<< 实时数据更新成功",DateUtils.convert(new Date()), slave.getId()));
//                    log.info(MessageFormat.format("【{0}】[id:{1}] <<<<< 实时数据更新成功",DateUtils.convert(new Date()), slave.getId()));
                }
                log.warn(JSON.toJSONString(shuttleProtocol));
//                log.warn(JSON.toJSONString(shuttleProtocol));//输出小车状态
                if (System.currentTimeMillis() - shuttleProtocol.getDeviceDataLog() > 1000 * 5) {
                    //采集时间超过5s,保存一次数据记录
                    //保存数据记录
                    DeviceDataLogService deviceDataLogService = SpringUtils.getBean(DeviceDataLogService.class);
                    DeviceDataLog deviceDataLog = new DeviceDataLog();
                    deviceDataLog.setOriginData(JSON.toJSONString(jsonObject));
                    deviceDataLog.setWcsData(JSON.toJSONString(shuttleProtocol));
                    deviceDataLog.setType("shuttle");
                    deviceDataLog.setDeviceNo(shuttleProtocol.getShuttleNo().intValue());
                    deviceDataLog.setCreateTime(new Date());
                    deviceDataLogService.insert(deviceDataLog);
                    //更新采集时间
                    shuttleProtocol.setDeviceDataLog(System.currentTimeMillis());
                }
            }
        } catch (Exception e) {
            e.printStackTrace();
@@ -342,6 +358,9 @@
        if (result == null) {
            return false;//请求失败
        }
        shuttleProtocol.setSendTime(System.currentTimeMillis());//指令下发时间
        return true;
    }
@@ -405,7 +424,7 @@
                    //上一条指令的目标位置和当前小车位置相同,则认定上一条任务完成
                    lastCommand.setComplete(true);
                    //解锁锁定路径,上一条路径
                    List<NavigateNode> nodes = lastCommand.getNodes();
                    List<NavigateNode> nodes = JSON.parseArray(JSON.toJSONString(lastCommand.getNodes()), NavigateNode.class);//进行深度copy
//                    //解锁当前路径
//                    if (command != null && command.getNodes() != null) {
//                        nodes.addAll(command.getNodes());
@@ -416,7 +435,7 @@
                        if (!(targetNode.getX() == node.getX() && targetNode.getY() == node.getY())) {
                            nodes.remove(nodes.size() - 1);//剔除尾节点
                        }
                        boolean result = navigateMapUtils.writeNavigateNodeToRedisMap(Utils.getLev(shuttleProtocol.getCurrentLocNo()), nodes, false);//解锁路径
                        boolean result = navigateMapUtils.writeNavigateNodeToRedisMap(Utils.getLev(shuttleProtocol.getCurrentLocNo()), shuttleProtocol.getShuttleNo().intValue(), nodes, false);//解锁路径
                        if (!result) {
                            return false;//解锁失败
                        }