| | |
| | | |
| | | if (step == 2) { |
| | | sendCommand((CrnCommand) task.getData()); |
| | | }else if (step == 3) { |
| | | sendCommand1((CrnCommand) task.getData()); |
| | | }else if (step == 4) { |
| | | sendCommand2((CrnCommand) task.getData()); |
| | | }else if (step == 5) { |
| | | sendCommand3((CrnCommand) task.getData()); |
| | | } |
| | | |
| | | |
| | | Thread.sleep(100); |
| | | } catch (Exception e) { |
| | |
| | | } |
| | | |
| | | @Override |
| | | public CrnCommand getResetCommand(Integer crnNo) { |
| | | public CrnCommand getResetCommand(Integer taskNo, Integer crnNo) { |
| | | CrnCommand crnCommand = new CrnCommand(); |
| | | crnCommand.setCrnNo(crnNo); // 堆垛机编号 |
| | | crnCommand.setTaskNo(0); // 工作号 |
| | | crnCommand.setTaskNo(taskNo); // 工作号 |
| | | crnCommand.setAckFinish(1); // 任务完成确认位 |
| | | crnCommand.setTaskMode(CrnTaskModeType.NONE.id); // 任务模式 |
| | | crnCommand.setTaskMode(CrnTaskModeType.RESET.id); // 任务模式 |
| | | crnCommand.setSourcePosX(0); // 源库位排 |
| | | crnCommand.setSourcePosY(0); // 源库位列 |
| | | crnCommand.setSourcePosZ(0); // 源库位层 |
| | |
| | | CommandResponse response = null; |
| | | try { |
| | | response = zyCrnConnectDriver.sendCommand(command); |
| | | return response; |
| | | } finally { |
| | | String sourceLocNo = Utils.getLocNo(command.getSourcePosX(), command.getSourcePosY(), command.getSourcePosZ()); |
| | | String targetLocNo = Utils.getLocNo(command.getDestinationPosX(), command.getDestinationPosY(), command.getDestinationPosZ()); |
| | | BasCrnpOptService bean = SpringUtils.getBean(BasCrnpOptService.class); |
| | | ZyCrnStatusEntity statusEntity = zyCrnConnectDriver.getStatus(); |
| | | BasCrnpOpt basCrnpOpt = new BasCrnpOpt( |
| | | command.getTaskNo().intValue(), |
| | | command.getCrnNo(), |
| | | new Date(), |
| | | String.valueOf(command.getTaskMode()), |
| | | sourceLocNo, |
| | | targetLocNo, |
| | | null, |
| | | null, |
| | | null, |
| | | JSON.toJSONString(command), |
| | | JSON.toJSONString(statusEntity), |
| | | 1, |
| | | JSON.toJSONString(response) |
| | | ); |
| | | if (bean != null) { |
| | | bean.insert(basCrnpOpt); |
| | | } |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public synchronized CommandResponse sendCommand1(CrnCommand command) { |
| | | this.crnProtocol.setLastCommandTime(System.currentTimeMillis()); |
| | | CommandResponse response = null; |
| | | try { |
| | | response = zyCrnConnectDriver.sendCommand1(command); |
| | | return response; |
| | | } finally { |
| | | String sourceLocNo = Utils.getLocNo(command.getSourcePosX(), command.getSourcePosY(), command.getSourcePosZ()); |