| | |
| | | shuttleProtocol.setPakMk(true); |
| | | } |
| | | |
| | | //将四向穿梭车状态保存至数据库 |
| | | BasShuttleService shuttleService = SpringUtils.getBean(BasShuttleService.class); |
| | | BasShuttle basShuttle = shuttleService.selectById(slave.getId()); |
| | | if (basShuttle == null) { |
| | | basShuttle = new BasShuttle(); |
| | | //四向穿梭车号 |
| | | basShuttle.setShuttleNo(slave.getId()); |
| | | shuttleService.insert(basShuttle); |
| | | } |
| | | //小车忙状态位 |
| | | basShuttle.setBusyStatus(shuttleProtocol.getBusyStatus().intValue()); |
| | | //当前二维码 |
| | | basShuttle.setCurrentCode(shuttleProtocol.getCurrentCode().intValue()); |
| | | //电池电量百分比 |
| | | basShuttle.setBatteryPower(shuttleProtocol.getBatteryPower().intValue()); |
| | | //电池温度 |
| | | basShuttle.setBatteryTemp(shuttleProtocol.getBatteryTemp().intValue()); |
| | | //错误编号 |
| | | basShuttle.setErrorCode(shuttleProtocol.getErrorCode().intValue()); |
| | | //Plc输出状态IO |
| | | basShuttle.setPlcOutputStatusIo(shuttleProtocol.getPlcOutputStatusIO().intValue()); |
| | | //错误信息码 |
| | | basShuttle.setStatusErrorCode(shuttleProtocol.getStatusErrorCode().intValue()); |
| | | //PLC输入状态 |
| | | basShuttle.setPlcInputStatus(shuttleProtocol.getPlcInputStatus().intValue()); |
| | | //当前或者之前读到的二维码值 |
| | | basShuttle.setCurrentOrBeforeCode(shuttleProtocol.getCurrentOrBeforeCode().intValue()); |
| | | //读到的二维码X方向偏移量 |
| | | basShuttle.setCodeOffsetX(shuttleProtocol.getCodeOffsetX().intValue()); |
| | | //读到的二维码Y方向偏移量 |
| | | basShuttle.setCodeOffsetY(shuttleProtocol.getCodeOffsetY().intValue()); |
| | | //当前的电压值 |
| | | basShuttle.setCurrentVoltage(shuttleProtocol.getCurrentVoltage().intValue()); |
| | | //当前的模拟量值 |
| | | basShuttle.setCurrentAnalogValue(shuttleProtocol.getCurrentAnalogValue().intValue()); |
| | | //当前的升降伺服速度 |
| | | basShuttle.setCurrentLiftServoSpeed(shuttleProtocol.getCurrentLiftServoSpeed().intValue()); |
| | | //当前的行走伺服速度 |
| | | basShuttle.setCurrentMoveServoSpeed(shuttleProtocol.getCurrentMoveServoSpeed().intValue()); |
| | | //当前的升降伺服负载率 |
| | | basShuttle.setCurrentLiftServoLoad(shuttleProtocol.getCurrentLiftServoLoad().intValue()); |
| | | //当前的行走伺服负载率 |
| | | basShuttle.setCurrentMoveServoLoad(shuttleProtocol.getCurrentMoveServoLoad().intValue()); |
| | | //当前小车状态(内部自我维护) |
| | | basShuttle.setShuttleStatus(shuttleProtocol.getProtocolStatus()); |
| | | //任务号 |
| | | basShuttle.setWrkNo(shuttleProtocol.getTaskNo().intValue()); |
| | | //修改时间 |
| | | basShuttle.setUpdateTime(new Date()); |
| | | //作业标记 |
| | | basShuttle.setPakMk(shuttleProtocol.getPakMk()); |
| | | if (shuttleService.updateById(basShuttle)) { |
| | | 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())); |
| | | } |
| | | // //将四向穿梭车状态保存至数据库 |
| | | // BasShuttleService shuttleService = SpringUtils.getBean(BasShuttleService.class); |
| | | // BasShuttle basShuttle = shuttleService.selectById(slave.getId()); |
| | | // if (basShuttle == null) { |
| | | // basShuttle = new BasShuttle(); |
| | | // //四向穿梭车号 |
| | | // basShuttle.setShuttleNo(slave.getId()); |
| | | // shuttleService.insert(basShuttle); |
| | | // } |
| | | // //小车忙状态位 |
| | | // basShuttle.setBusyStatus(shuttleProtocol.getBusyStatus().intValue()); |
| | | // //当前二维码 |
| | | // basShuttle.setCurrentCode(shuttleProtocol.getCurrentCode().intValue()); |
| | | // //电池电量百分比 |
| | | // basShuttle.setBatteryPower(shuttleProtocol.getBatteryPower().intValue()); |
| | | // //电池温度 |
| | | // basShuttle.setBatteryTemp(shuttleProtocol.getBatteryTemp().intValue()); |
| | | // //错误编号 |
| | | // basShuttle.setErrorCode(shuttleProtocol.getErrorCode().intValue()); |
| | | // //Plc输出状态IO |
| | | // basShuttle.setPlcOutputStatusIo(shuttleProtocol.getPlcOutputStatusIO().intValue()); |
| | | // //错误信息码 |
| | | // basShuttle.setStatusErrorCode(shuttleProtocol.getStatusErrorCode().intValue()); |
| | | // //PLC输入状态 |
| | | // basShuttle.setPlcInputStatus(shuttleProtocol.getPlcInputStatus().intValue()); |
| | | // //当前或者之前读到的二维码值 |
| | | // basShuttle.setCurrentOrBeforeCode(shuttleProtocol.getCurrentOrBeforeCode().intValue()); |
| | | // //读到的二维码X方向偏移量 |
| | | // basShuttle.setCodeOffsetX(shuttleProtocol.getCodeOffsetX().intValue()); |
| | | // //读到的二维码Y方向偏移量 |
| | | // basShuttle.setCodeOffsetY(shuttleProtocol.getCodeOffsetY().intValue()); |
| | | // //当前的电压值 |
| | | // basShuttle.setCurrentVoltage(shuttleProtocol.getCurrentVoltage().intValue()); |
| | | // //当前的模拟量值 |
| | | // basShuttle.setCurrentAnalogValue(shuttleProtocol.getCurrentAnalogValue().intValue()); |
| | | // //当前的升降伺服速度 |
| | | // basShuttle.setCurrentLiftServoSpeed(shuttleProtocol.getCurrentLiftServoSpeed().intValue()); |
| | | // //当前的行走伺服速度 |
| | | // basShuttle.setCurrentMoveServoSpeed(shuttleProtocol.getCurrentMoveServoSpeed().intValue()); |
| | | // //当前的升降伺服负载率 |
| | | // basShuttle.setCurrentLiftServoLoad(shuttleProtocol.getCurrentLiftServoLoad().intValue()); |
| | | // //当前的行走伺服负载率 |
| | | // basShuttle.setCurrentMoveServoLoad(shuttleProtocol.getCurrentMoveServoLoad().intValue()); |
| | | // //当前小车状态(内部自我维护) |
| | | // basShuttle.setShuttleStatus(shuttleProtocol.getProtocolStatus()); |
| | | // //任务号 |
| | | // basShuttle.setWrkNo(shuttleProtocol.getTaskNo().intValue()); |
| | | // //修改时间 |
| | | // basShuttle.setUpdateTime(new Date()); |
| | | // //作业标记 |
| | | // basShuttle.setPakMk(shuttleProtocol.getPakMk()); |
| | | // if (shuttleService.updateById(basShuttle)) { |
| | | // 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())); |
| | | // } |
| | | |
| | | }else { |
| | | OutputQueue.SHUTTLE.offer(MessageFormat.format("【{0}】{1}四向穿梭车plc状态信息失败", DateUtils.convert(new Date()), slave.getId())); |
| | |
| | | News.info("四向穿梭车命令下发[id:{}] >>>>> {},次数:{}", slave.getId(), JSON.toJSON(command), i); |
| | | OutputQueue.SHUTTLE.offer(MessageFormat.format("【{0}】[id:{1}] >>>>> 命令下发: {2},次数:{}", DateUtils.convert(new Date()), slave.getId(), JSON.toJSON(command), i)); |
| | | try { |
| | | Thread.sleep(3000);//命令下发后休眠 |
| | | Thread.sleep(300);//命令下发后休眠 |
| | | } catch (InterruptedException e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | |
| | | //获取小车移动速度 |
| | | BasShuttle basShuttle = shuttleService.selectById(slave.getId()); |
| | | Integer runSpeed = 1000; |
| | | if (basShuttle != null) { |
| | | Integer runSpeed1 = basShuttle.getRunSpeed(); |
| | | if (runSpeed1 != null) { |
| | | runSpeed = runSpeed1; |
| | | } |
| | | } |
| | | // if (basShuttle != null) { |
| | | // Integer runSpeed1 = basShuttle.getRunSpeed(); |
| | | // if (runSpeed1 != null) { |
| | | // runSpeed = runSpeed1; |
| | | // } |
| | | // } |
| | | |
| | | LiftThread liftThread = (LiftThread) SlaveConnection.get(SlaveType.Lift, 1); |
| | | LiftProtocol liftProtocol = liftThread.getLiftProtocol(); |
| | |
| | | //目标路径 |
| | | NavigateNode endPath = nodes.get(nodes.size() - 1); |
| | | Integer allDistance = NavigateUtils.getCurrentPathAllDistance(nodes);//计算当前路径行走总距离 |
| | | Integer middleToDistDistance = NavigateUtils.getMiddleToDistDistance(nodes);//计算中间点到目标点行走距离 |
| | | Integer middleToDistDistance = NavigateUtils.getMiddleToDistDistance(nodes, middlePath);//计算中间点到目标点行走距离 |
| | | |
| | | //正常移动命令 |
| | | Short startCode = NavigatePositionConvert.xyToPosition(startPath.getX(), startPath.getY(), startPath.getZ());//开始二维码 |
| | |
| | | //目标路径 |
| | | NavigateNode endPath = nodes.get(nodes.size() - 1); |
| | | Integer allDistance = NavigateUtils.getCurrentPathAllDistance(nodes);//计算当前路径行走总距离 |
| | | Integer middleToDistDistance = NavigateUtils.getMiddleToDistDistance(nodes);//计算中间点到目标点行走距离 |
| | | Integer middleToDistDistance = NavigateUtils.getMiddleToDistDistance(nodes, middlePath);//计算中间点到目标点行走距离 |
| | | |
| | | //正常移动命令 |
| | | Short startCode = NavigatePositionConvert.xyToPosition(startPath.getX(), startPath.getY(), startPath.getZ());//开始二维码 |
| | |
| | | //目标路径 |
| | | NavigateNode endPath = nodes.get(nodes.size() - 1); |
| | | Integer allDistance = NavigateUtils.getCurrentPathAllDistance(nodes);//计算当前路径行走总距离 |
| | | Integer middleToDistDistance = NavigateUtils.getMiddleToDistDistance(nodes);//计算中间点到目标点行走距离 |
| | | Integer middleToDistDistance = NavigateUtils.getMiddleToDistDistance(nodes, middlePath);//计算中间点到目标点行走距离 |
| | | Short startCode = NavigatePositionConvert.xyToPosition(startPath.getX(), startPath.getY(), startPath.getZ());//开始二维码 |
| | | Short middleCode = NavigatePositionConvert.xyToPosition(middlePath.getX(), middlePath.getY(), middlePath.getZ());//中间二维码 |
| | | Short distCode = NavigatePositionConvert.xyToPosition(endPath.getX(), endPath.getY(), endPath.getZ());//目标二维码 |
| | |
| | | //目标路径 |
| | | NavigateNode endPath = nodes.get(nodes.size() - 1); |
| | | Integer allDistance = NavigateUtils.getCurrentPathAllDistance(nodes);//计算当前路径行走总距离 |
| | | Integer middleToDistDistance = NavigateUtils.getMiddleToDistDistance(nodes);//计算中间点到目标点行走距离 |
| | | Integer middleToDistDistance = NavigateUtils.getMiddleToDistDistance(nodes, middlePath);//计算中间点到目标点行走距离 |
| | | Short startCode = NavigatePositionConvert.xyToPosition(startPath.getX(), startPath.getY(), startPath.getZ());//开始二维码 |
| | | Short middleCode = NavigatePositionConvert.xyToPosition(middlePath.getX(), middlePath.getY(), middlePath.getZ());//中间二维码 |
| | | Short distCode = NavigatePositionConvert.xyToPosition(endPath.getX(), endPath.getY(), endPath.getZ());//目标二维码 |
| | |
| | | } |
| | | } |
| | | |
| | | if (commands.size() == 0) { |
| | | return false; |
| | | } |
| | | |
| | | //当前等待执行的指令 |
| | | ShuttleCommand command = commands.get(commandStep); |
| | | |