|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | private void readStatus() { | 
|---|
|  |  |  | try { | 
|---|
|  |  |  | if (null == shuttleProtocol) { | 
|---|
|  |  |  | shuttleProtocol = new NyShuttleProtocol(); | 
|---|
|  |  |  | shuttleProtocol.setShuttleNo(slave.getId().shortValue()); | 
|---|
|  |  |  | shuttleProtocol.setProtocolStatus(ShuttleProtocolStatusType.IDLE); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //----------读取四向穿梭车状态----------- | 
|---|
|  |  |  | NyShuttleHttpCommand readStatusCommand = NyHttpUtils.getReadStatusCommand(slave.getId()); | 
|---|
|  |  |  | JSONObject jsonObject = NyHttpUtils.requestCommand(socket, readStatusCommand); | 
|---|
|  |  |  | 
|---|
|  |  |  | 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));//输出小车状态 | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } catch (Exception e) { | 
|---|
|  |  |  | e.printStackTrace(); | 
|---|
|  |  |  | 
|---|
|  |  |  | socket.setSoTimeout(60000); | 
|---|
|  |  |  | socket.setKeepAlive(true); | 
|---|
|  |  |  | this.socket = socket; | 
|---|
|  |  |  | if (null == shuttleProtocol) { | 
|---|
|  |  |  | shuttleProtocol = new NyShuttleProtocol(); | 
|---|
|  |  |  | shuttleProtocol.setShuttleNo(slave.getId().shortValue()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | shuttleProtocol.setProtocolStatus(ShuttleProtocolStatusType.IDLE); | 
|---|
|  |  |  | log.info(MessageFormat.format("【{0}】四向穿梭车Socket链接成功 ===>> [id:{1}] [ip:{2}] [port:{3}]", DateUtils.convert(new Date()), slave.getId(), slave.getIp(), slave.getPort())); | 
|---|
|  |  |  | } catch (IOException e) { | 
|---|
|  |  |  | OutputQueue.SHUTTLE.offer(MessageFormat.format("【{0}】四向穿梭车Socket链接失败 ===>> [id:{1}] [ip:{2}] [port:{3}]", DateUtils.convert(new Date()), slave.getId(), slave.getIp(), slave.getPort())); | 
|---|
|  |  |  | 
|---|
|  |  |  | if (result == null) { | 
|---|
|  |  |  | return false;//请求失败 | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | shuttleProtocol.setSendTime(System.currentTimeMillis());//指令下发时间 | 
|---|
|  |  |  |  | 
|---|
|  |  |  | return true; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | //上一条指令的目标位置和当前小车位置相同,则认定上一条任务完成 | 
|---|
|  |  |  | 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()); | 
|---|