| | |
| | | } |
| | | |
| | | read(); |
| | | Thread.sleep(1000); |
| | | Thread.sleep(300); |
| | | execute(); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | |
| | | forkLiftProtocol.setIOMode((int) siemensS7Net.getByteTransform().TransInt16(result1.Content, 12)); |
| | | //故障码 |
| | | forkLiftProtocol.setErrorCode((int) siemensS7Net.getByteTransform().TransInt16(result1.Content, 14)); |
| | | //当前层 |
| | | forkLiftProtocol.setLev((int) siemensS7Net.getByteTransform().TransInt16(result1.Content, 16)); |
| | | |
| | | //************补充扩展字段************* |
| | | InnerForkLiftExtend forkLiftExtend = (InnerForkLiftExtend) forkLiftProtocol.getExtend(); |
| | |
| | | } |
| | | |
| | | @Override |
| | | public CommandResponse move(ForkLiftCommand command) { |
| | | CommandResponse response = new CommandResponse(false); |
| | | |
| | | short[] array = new short[4]; |
| | | array[0] = command.getTaskNo();//任务号 |
| | | array[1] = command.getMode();//任务模式 |
| | | array[2] = command.getPut();//放货数据 |
| | | OperateResult result = this.masterThread.write(this.slave.getId(), "write", array); |
| | | if (result.IsSuccess) { |
| | | OperateResult result2 = this.masterThread.write(this.slave.getId(), "writeConfirm", command.getConfirm()); |
| | | if (result2.IsSuccess) { |
| | | response.setResult(true); |
| | | } |
| | | } |
| | | return response; |
| | | } |
| | | |
| | | @Override |
| | | public CommandResponse reset() { |
| | | CommandResponse response = new CommandResponse(false); |
| | | OperateResult result = this.masterThread.write(this.slave.getId(), "confirm", (short) 1); |
| | |
| | | return commands; |
| | | } |
| | | |
| | | @Override |
| | | public List<ForkLiftCommand> getMoveCommand(Integer taskNo, Integer pick, Integer put) { |
| | | Integer realPick = pick % 1000; |
| | | Integer realPut = put % 1000; |
| | | |
| | | List<ForkLiftCommand> commands = new ArrayList<>(); |
| | | ForkLiftCommand command = new ForkLiftCommand(); |
| | | command.setLiftNo(slave.getId()); |
| | | command.setTaskNo(taskNo.shortValue()); |
| | | command.setMode(ForkLiftTaskModeType.MOVE.id.shortValue()); |
| | | command.setPick(realPick.shortValue()); |
| | | command.setPut(realPut.shortValue()); |
| | | command.setConfirm((short) 1); |
| | | |
| | | commands.add(command); |
| | | return commands; |
| | | } |
| | | |
| | | /** |
| | | * 扩展字段 |
| | | */ |