| | |
| | | if (task != null) { |
| | | step = task.getStep(); |
| | | } |
| | | switch (step) { |
| | | // 读数据 |
| | | case 1: |
| | | readStatus(); |
| | | break; |
| | | // 写入数据 |
| | | case 2: |
| | | write5((CrnCommand) task.getData()); |
| | | break; |
| | | // 复位 |
| | | case 3: |
| | | CrnCommand command = (CrnCommand) task.getData(); |
| | | if (null == command) { |
| | | command = new CrnCommand(); |
| | | } |
| | | command.setCrnNo(slave.getId()); // 堆垛机编号 |
| | | command.setTaskNo((short) 0); // 工作号 |
| | | command.setAckFinish((short) 1); // 任务完成确认位 |
| | | command.setTaskMode(CrnTaskModeType.NONE); // 任务模式 |
| | | command.setSourcePosX((short)0); // 源库位排 |
| | | command.setSourcePosY((short)0); // 源库位列 |
| | | command.setSourcePosZ((short)0); // 源库位层 |
| | | command.setDestinationPosX((short)0); // 目标库位排 |
| | | command.setDestinationPosY((short)0); // 目标库位列 |
| | | command.setDestinationPosZ((short)0); // 目标库位层 |
| | | write(command); |
| | | break; |
| | | case 4: |
| | | writeAuto((CrnCommand) task.getData()); |
| | | break; |
| | | case 5: |
| | | write((CrnCommand) task.getData()); |
| | | break; |
| | | default: |
| | | break; |
| | | } |
| | | // switch (step) { |
| | | // // 读数据 |
| | | // case 1: |
| | | // readStatus(); |
| | | // break; |
| | | // // 写入数据 |
| | | // case 2: |
| | | // write5((CrnCommand) task.getData()); |
| | | // break; |
| | | // // 复位 |
| | | // case 3: |
| | | // CrnCommand command = (CrnCommand) task.getData(); |
| | | // if (null == command) { |
| | | // command = new CrnCommand(); |
| | | // } |
| | | // command.setCrnNo(slave.getId()); // 堆垛机编号 |
| | | // command.setTaskNo((short) 0); // 工作号 |
| | | // command.setAckFinish((short) 1); // 任务完成确认位 |
| | | // command.setTaskMode(CrnTaskModeType.NONE); // 任务模式 |
| | | // command.setSourcePosX((short)0); // 源库位排 |
| | | // command.setSourcePosY((short)0); // 源库位列 |
| | | // command.setSourcePosZ((short)0); // 源库位层 |
| | | // command.setDestinationPosX((short)0); // 目标库位排 |
| | | // command.setDestinationPosY((short)0); // 目标库位列 |
| | | // command.setDestinationPosZ((short)0); // 目标库位层 |
| | | // write(command); |
| | | // break; |
| | | // case 4: |
| | | // writeAuto((CrnCommand) task.getData()); |
| | | // break; |
| | | // case 5: |
| | | // write((CrnCommand) task.getData()); |
| | | // break; |
| | | // default: |
| | | // break; |
| | | // } |
| | | Thread.sleep(500); |
| | | } catch (Exception e) { |
| | | // e.printStackTrace(); |