| | |
| | | if (!liftThread.isLock(new ExecuteSupport() { |
| | | @Override |
| | | public Boolean judgement() { |
| | | return true; |
| | | return true;//牛眼没有提升机锁,直接返回true |
| | | } |
| | | })) { |
| | | return false; |
| | |
| | | } |
| | | |
| | | //判断提升机是否被锁定 |
| | | if (liftThread.isLock(new ExecuteSupport() { |
| | | if (!liftThread.isLock(new ExecuteSupport() { |
| | | @Override |
| | | public Boolean judgement() { |
| | | return false; |
| | | } |
| | | })) { |
| | | //解锁提升机 |
| | | List<LiftCommand> lockCommand = liftThread.getLockCommand(motion.getTaskNo(), false);//获取提升机解锁命令 |
| | | |
| | | LiftAssignCommand liftAssignCommand = new LiftAssignCommand(); |
| | | liftAssignCommand.setLiftNo(liftThread.getStatus().getLiftNo()); |
| | | liftAssignCommand.setTaskNo(motion.getTaskNo()); |
| | | ArrayList<LiftCommand> list = new ArrayList<>(); |
| | | list.addAll(lockCommand); |
| | | liftAssignCommand.setCommands(list); |
| | | |
| | | liftAction.assignWork(liftThread.getDevice(), liftAssignCommand); |
| | | return false;//等待下一次轮询 |
| | | } |
| | | |
| | | //判断小车是否已到位 |
| | | if (liftProtocol.getHasCar()) { |
| | | List<LiftCommand> signalCommand = liftThread.getShuttleSignalCommand(motion.getTaskNo(), true);//获取小车已到位命令 |
| | | if(signalCommand != null) { |
| | | boolean hasKey = redisUtil.hasKey(DeviceRedisConstant.COMMAND_TMP + motion.getTaskNo()); |
| | | if (!hasKey) { |
| | | LiftAssignCommand liftAssignCommand = new LiftAssignCommand(); |
| | | liftAssignCommand.setLiftNo(liftThread.getStatus().getLiftNo()); |
| | | liftAssignCommand.setTaskNo(motion.getTaskNo()); |
| | | ArrayList<LiftCommand> list = new ArrayList<>(); |
| | | list.addAll(signalCommand); |
| | | liftAssignCommand.setCommands(list); |
| | | liftAction.assignWork(liftThread.getDevice(), liftAssignCommand); |
| | | redisUtil.set(DeviceRedisConstant.COMMAND_TMP + motion.getTaskNo(), true, 120); |
| | | return false; |
| | | } |
| | | } |
| | | } |
| | | |
| | | //判断提升机工作号是否和当前任务相同 |
| | | if (liftProtocol.getTaskNo().intValue() != motion.getTaskNo()) { |
| | | return false; |
| | | } |
| | | |
| | | if (liftProtocol.getTaskNo() != 0) { |
| | | //清空提升机号 |
| | | liftThread.setSyncTaskNo(0); |
| | | //判断小车是否已到位 |
| | | if (!liftProtocol.getHasCar()) { |
| | | return false; |
| | | } |
| | | |
| | | // //判断提升机工作号是否和当前任务相同 |
| | | // if (liftProtocol.getTaskNo().intValue() != motion.getTaskNo()) { |
| | | // return false; |
| | | // } |
| | | break; |
| | | case SHUTTLE_MOVE_FROM_LIFT: |
| | | liftThread = (LiftThread) SlaveConnection.get(SlaveType.Lift, Integer.parseInt(motion.getTemp())); |
| | |
| | | } |
| | | |
| | | //判断提升机是否被锁定 |
| | | if (liftThread.isLock(new ExecuteSupport() { |
| | | if (!liftThread.isLock(new ExecuteSupport() { |
| | | @Override |
| | | public Boolean judgement() { |
| | | return false; |
| | | } |
| | | })) { |
| | | //解锁提升机 |
| | | List<LiftCommand> lockCommand = liftThread.getLockCommand(motion.getTaskNo(), false);//获取提升机解锁命令 |
| | | |
| | | LiftAssignCommand liftAssignCommand = new LiftAssignCommand(); |
| | | liftAssignCommand.setLiftNo(liftThread.getStatus().getLiftNo()); |
| | | liftAssignCommand.setTaskNo(motion.getTaskNo()); |
| | | ArrayList<LiftCommand> list = new ArrayList<>(); |
| | | list.addAll(lockCommand); |
| | | liftAssignCommand.setCommands(list); |
| | | |
| | | liftAction.assignWork(liftThread.getDevice(), liftAssignCommand); |
| | | return false;//等待下一次轮询 |
| | | } |
| | | |
| | | //判断小车是否已离开 |
| | | if (!liftProtocol.getHasCar()) { |
| | | List<LiftCommand> signalCommand = liftThread.getShuttleSignalCommand(motion.getTaskNo(), false);//获取小车已驾离命令 |
| | | if(signalCommand != null) { |
| | | boolean hasKey = redisUtil.hasKey(DeviceRedisConstant.COMMAND_TMP + motion.getTaskNo()); |
| | | if (!hasKey) { |
| | | redisUtil.set(DeviceRedisConstant.COMMAND_TMP + motion.getTaskNo(), JSON.toJSONString(signalCommand), 120); |
| | | LiftAssignCommand liftAssignCommand = new LiftAssignCommand(); |
| | | liftAssignCommand.setLiftNo(liftThread.getStatus().getLiftNo()); |
| | | liftAssignCommand.setTaskNo(motion.getTaskNo()); |
| | | ArrayList<LiftCommand> list = new ArrayList<>(); |
| | | list.addAll(signalCommand); |
| | | liftAssignCommand.setCommands(list); |
| | | liftAction.assignWork(liftThread.getDevice(), liftAssignCommand); |
| | | return false; |
| | | } |
| | | } |
| | | } |
| | | |
| | | //判断提升机工作号是否和当前任务相同 |
| | | if (liftProtocol.getTaskNo().intValue() != motion.getTaskNo()) { |
| | | return false; |
| | | } |
| | | |
| | | if (liftProtocol.getTaskNo() != 0) { |
| | | //清空提升机号 |
| | | liftThread.setSyncTaskNo(0); |
| | | //判断小车是否已离开 |
| | | if (liftProtocol.getHasCar()) { |
| | | return false; |
| | | } |
| | | |
| | | // //判断提升机工作号是否和当前任务相同 |
| | | // if (liftProtocol.getTaskNo().intValue() != motion.getTaskNo()) { |
| | | // return false; |
| | | // } |
| | | break; |
| | | case SHUTTLE_TRANSPORT_FROM_LIFT: |
| | | case SHUTTLE_TRANSPORT_TO_LIFT: |
| | |
| | | return false; |
| | | } |
| | | })) { |
| | | //解锁提升机 |
| | | List<LiftCommand> lockCommand = liftThread.getLockCommand(motion.getTaskNo(), false);//获取提升机解锁命令 |
| | | |
| | | LiftAssignCommand liftAssignCommand = new LiftAssignCommand(); |
| | | liftAssignCommand.setLiftNo(liftThread.getStatus().getLiftNo()); |
| | | liftAssignCommand.setTaskNo(motion.getTaskNo()); |
| | | ArrayList<LiftCommand> list = new ArrayList<>(); |
| | | list.addAll(lockCommand); |
| | | liftAssignCommand.setCommands(list); |
| | | |
| | | liftAction.assignWork(liftThread.getDevice(), liftAssignCommand); |
| | | return false;//等待下一次轮询 |
| | | return false; |
| | | } |
| | | |
| | | //判断提升机工作号是否和当前任务相同 |
| | | if (liftProtocol.getTaskNo().intValue() != motion.getTaskNo()) { |
| | | return false; |
| | | } |
| | | |
| | | if (liftProtocol.getTaskNo() != 0) { |
| | | //清空提升机号 |
| | | liftThread.setSyncTaskNo(0); |
| | | } |
| | | break; |
| | | case SHUTTLE_UPDATE_LOCATION://小车坐标更新 |