| | |
| | | } |
| | | |
| | | LiftDispatcher liftDispatcher = SpringUtils.getBean(LiftDispatcher.class); |
| | | Integer lev = liftDispatcher.getLiftLevOffset(this.device.getId().intValue(), liftProtocol.getLev()); |
| | | if (null == lev){ |
| | | News.error("提升机获取当前层为空"); |
| | | response.setMessage("提升机获取当前层为空"); |
| | | return response; |
| | | |
| | | Integer origin = command.getOriginLev(); |
| | | Integer target = command.getTargetLev(); |
| | | if (command.getMode() == 2) { |
| | | origin = liftDispatcher.getLiftLevOffset(this.device.getId().intValue(), liftProtocol.getLev()); |
| | | target = liftDispatcher.getLiftLevOffset(this.device.getId().intValue(), command.getTargetLev()); |
| | | } |
| | | array[1] = lev.shortValue(); |
| | | Integer targetLev = liftDispatcher.getLiftLevOffset(this.device.getId().intValue(), command.getTargetLev()); |
| | | if (null == targetLev){ |
| | | News.error("提升机获取目标层为空"); |
| | | response.setMessage("提升机获取目标层为空"); |
| | | return response; |
| | | } |
| | | array[2] = targetLev.shortValue(); |
| | | |
| | | array[1] = origin.shortValue(); |
| | | array[2] = target.shortValue(); |
| | | |
| | | OperateResult result = siemensS7Net.Write("DB83.0", array); |
| | | if (result != null && result.IsSuccess) { |
| | |
| | | public List<LiftCommand> getMoveCommand(Integer taskNo, Integer sourceLev, Integer targetLev, LiftCommandModeType mode) { |
| | | /** |
| | | * 任务类型 |
| | | * 1=移托盘;升降机将源站台托盘移到目标站台 |
| | | * 2=移小车,升降机移到目标层,等待 |
| | | 1=移托盘;升降机将源站台托盘移到目标站台 |
| | | 2=换层,升降机移到目标层,等待 |
| | | 3=入库托盘,升降机将源站台托盘移到目标层数; |
| | | 4=出库托盘,升降机将源站台托盘移到目标站台 |
| | | */ |
| | | short taskMode = 2; |
| | | if (mode.equals(LiftCommandModeType.PALLET_INOUT)) { |
| | | taskMode = 1; |
| | | if (mode.equals(LiftCommandModeType.PALLET_IN)) { |
| | | taskMode = 3; |
| | | } else if (mode.equals(LiftCommandModeType.PALLET_OUT)) { |
| | | taskMode = 4; |
| | | } |
| | | |
| | | // 开始任务 |
| | |
| | | LiftCommand command = new LiftCommand(); |
| | | command.setLiftNo(Integer.valueOf(this.device.getDeviceNo())); |
| | | command.setBody(JSON.toJSONString(array)); |
| | | command.setMode(LiftCommandModeType.MOVE.id); |
| | | command.setMode(mode.id); |
| | | command.setOriginLev(sourceLev); |
| | | command.setTargetLev(targetLev); |
| | | |