| | |
| | | import com.zy.asrs.wcs.core.model.command.*; |
| | | import com.zy.asrs.wcs.core.model.enums.LiftCommandModeType; |
| | | import com.zy.asrs.wcs.core.service.TaskService; |
| | | import com.zy.asrs.wcs.core.utils.LiftDispatcher; |
| | | import com.zy.asrs.wcs.core.utils.RedisUtil; |
| | | import com.zy.asrs.wcs.rcs.News; |
| | | import com.zy.asrs.wcs.rcs.cache.SlaveConnection; |
| | |
| | | private TaskService taskService; |
| | | @Autowired |
| | | private BasLiftOptService basLiftOptService; |
| | | @Autowired |
| | | private LiftDispatcher liftDispatcher; |
| | | |
| | | public synchronized boolean assignWork(Device device, LiftAssignCommand assignCommand) { |
| | | LiftThread liftThread = (LiftThread) SlaveConnection.get(SlaveType.Lift, device.getId().intValue()); |
| | |
| | | LiftCommand command = commands.get(commandStep - 1); |
| | | if (command.getMode() == LiftCommandModeType.MOVE.id) { |
| | | //提升机升降 |
| | | if (liftProtocol.getLev() == command.getTargetLev()) { |
| | | Integer target = liftDispatcher.getLiftLevLogic(liftThread.getDevice().getId().intValue(), command.getTargetLev()); |
| | | if (liftProtocol.getLev() == target) { |
| | | command.setComplete(true); |
| | | } |
| | | } else if (command.getMode() == LiftCommandModeType.MOVE_CAR.id) { |
| | |
| | | if (liftProtocol.getLev() == command.getTargetLev()) { |
| | | command.setComplete(true); |
| | | } |
| | | } else if (command.getMode() == LiftCommandModeType.PALLET_INOUT.id) { |
| | | //托盘出入 |
| | | if (liftProtocol.getLev() == command.getTargetLev()) { |
| | | } else if (command.getMode() == LiftCommandModeType.PALLET_IN.id) { |
| | | //托盘入 |
| | | Integer target = liftDispatcher.getLiftLevLogic(liftThread.getDevice().getId().intValue(), command.getTargetLev()); |
| | | if (liftProtocol.getLev() == target) { |
| | | command.setComplete(true); |
| | | } |
| | | |
| | | //判断提升机托盘是否存在 |
| | | if (!liftProtocol.getHasTray()) { |
| | | return false; |
| | | } |
| | | |
| | | } else if (command.getMode() == LiftCommandModeType.PALLET_OUT.id) { |
| | | //托盘出 |
| | | Integer target = liftDispatcher.getLiftLevLogic(liftThread.getDevice().getId().intValue(), command.getTargetLev()); |
| | | if (liftProtocol.getLev() == target) { |
| | | command.setComplete(true); |
| | | } |
| | | |
| | |
| | | if (liftProtocol.getHasTray()) { |
| | | return false; |
| | | } |
| | | |
| | | } else if (command.getMode() == LiftCommandModeType.RESET.id) { |
| | | //复位 |
| | | command.setComplete(true); |
| | |
| | | |
| | | if (command.getMode() == LiftCommandModeType.MOVE.id) { |
| | | response = liftThread.move(command); |
| | | } else if (command.getMode() == LiftCommandModeType.PALLET_INOUT.id) { |
| | | } else if (command.getMode() == LiftCommandModeType.PALLET_IN.id || command.getMode() == LiftCommandModeType.PALLET_OUT.id) { |
| | | response = liftThread.palletInOut(command); |
| | | } else if (command.getMode() == LiftCommandModeType.LOCK.id) { |
| | | response = liftThread.lock(command); |