|  |  |  | 
|---|
|  |  |  | return false; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //自动、就绪、空闲 | 
|---|
|  |  |  | if (!(liftProtocol.getModel() | 
|---|
|  |  |  | && liftProtocol.getReady() | 
|---|
|  |  |  | && !liftProtocol.getRun()) | 
|---|
|  |  |  | ) { | 
|---|
|  |  |  | //判断提升机是否自动 | 
|---|
|  |  |  | if (!liftThread.isIdle()) { | 
|---|
|  |  |  | return false; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | ArrayList<LiftCommand> list = new ArrayList<>(); | 
|---|
|  |  |  | LiftAssignCommand assignCommand = new LiftAssignCommand(); | 
|---|
|  |  |  | assignCommand.setLiftNo(liftProtocol.getLiftNo()); | 
|---|
|  |  |  | assignCommand.setTaskNo(motion.getWrkNo()); | 
|---|
|  |  |  | assignCommand.setTaskNo(motion.getTaskNo()); | 
|---|
|  |  |  | assignCommand.setCommands(list); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | LiftCommand command = new LiftCommand(); | 
|---|
|  |  |  | 
|---|
|  |  |  | case LIFT_MOVE: | 
|---|
|  |  |  | // 如果已经在目标层,那边层过滤 | 
|---|
|  |  |  | if (liftProtocol.getLev().equals(Integer.valueOf(motion.getTarget()))) { | 
|---|
|  |  |  | liftProtocol.setTaskNo(motion.getWrkNo()); | 
|---|
|  |  |  | liftProtocol.setTaskNo(motion.getTaskNo()); | 
|---|
|  |  |  | break; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | command = liftThread.getEmptyMoveCommand(motion.getWrkNo(), Integer.parseInt(motion.getTarget())); | 
|---|
|  |  |  | command = liftThread.getEmptyMoveCommand(motion.getTaskNo(), Integer.parseInt(motion.getTarget())); | 
|---|
|  |  |  | list.add(command); | 
|---|
|  |  |  | return liftAction.assignWork(liftThread.getDevice(), assignCommand); | 
|---|
|  |  |  | case LIFT_WITH_GOODS: | 
|---|
|  |  |  | 
|---|
|  |  |  | return false; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | command = liftThread.getMoveWithShuttleCommand(motion.getWrkNo(), Integer.parseInt(motion.getOrigin()), Integer.parseInt(motion.getTarget())); | 
|---|
|  |  |  | command = liftThread.getMoveWithShuttleCommand(motion.getTaskNo(), Integer.parseInt(motion.getOrigin()), Integer.parseInt(motion.getTarget())); | 
|---|
|  |  |  | list.add(command); | 
|---|
|  |  |  | return liftAction.assignWork(liftThread.getDevice(), assignCommand); | 
|---|
|  |  |  | case LIFT_WITH_GOODS_AND_SHUTTLE: | 
|---|
|  |  |  | 
|---|
|  |  |  | return false; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if (liftProtocol.getRun() || liftProtocol.getTaskNo() != motion.getWrkNo().shortValue()) { | 
|---|
|  |  |  | if (liftProtocol.getRun() || liftProtocol.getTaskNo() != motion.getTaskNo().shortValue()) { | 
|---|
|  |  |  | return false; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | switch (Objects.requireNonNull(MotionCtgType.get(motion.getMotionCtgEl()))){ | 
|---|
|  |  |  | case LIFT_MOVE: | 
|---|
|  |  |  | // 判断提升机是否自动、空闲、准备就绪、链条没有转动、没有未就绪报错 | 
|---|
|  |  |  | if (!liftProtocol.getModel() | 
|---|
|  |  |  | || liftProtocol.getRun() | 
|---|
|  |  |  | || !liftProtocol.getReady() | 
|---|
|  |  |  | ) { | 
|---|
|  |  |  | // 判断提升机是否空闲 | 
|---|
|  |  |  | if (!liftThread.isIdle()) { | 
|---|
|  |  |  | return false; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | break; | 
|---|
|  |  |  | case LIFT_WITH_GOODS: | 
|---|
|  |  |  | // 判断提升机是否自动、空闲、准备就绪、链条没有转动、没有未就绪报错 | 
|---|
|  |  |  | if (!liftProtocol.getModel() | 
|---|
|  |  |  | || liftProtocol.getRun() | 
|---|
|  |  |  | || !liftProtocol.getReady() | 
|---|
|  |  |  | ) { | 
|---|
|  |  |  | // 判断提升机是否空闲 | 
|---|
|  |  |  | if (!liftThread.isIdle()) { | 
|---|
|  |  |  | return false; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | break; | 
|---|
|  |  |  | case LIFT_WITH_SHUTTLE: | 
|---|
|  |  |  | // 判断提升机是否自动、空闲、准备就绪、链条没有转动、没有未就绪报错 | 
|---|
|  |  |  | if (!liftProtocol.getModel() | 
|---|
|  |  |  | || liftProtocol.getRun() | 
|---|
|  |  |  | || !liftProtocol.getReady() | 
|---|
|  |  |  | ) { | 
|---|
|  |  |  | // 判断提升机是否空闲 | 
|---|
|  |  |  | if (!liftThread.isIdle()) { | 
|---|
|  |  |  | return false; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | break; | 
|---|
|  |  |  | case LIFT_WITH_GOODS_AND_SHUTTLE: | 
|---|
|  |  |  | // 判断提升机是否自动、空闲、准备就绪、链条没有转动、没有未就绪报错 | 
|---|
|  |  |  | if (!liftProtocol.getModel() | 
|---|
|  |  |  | || liftProtocol.getRun() | 
|---|
|  |  |  | || !liftProtocol.getReady() | 
|---|
|  |  |  | ) { | 
|---|
|  |  |  | // 判断提升机是否空闲 | 
|---|
|  |  |  | if (!liftThread.isIdle()) { | 
|---|
|  |  |  | return false; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|