| | |
| | | List<SendDualCrnCommandParam> commandList = (List<SendDualCrnCommandParam>) task.getData(); |
| | | for (SendDualCrnCommandParam sendDualCrnCommandParam : commandList) { |
| | | DualCrnCommand dualCrnCommand = sendDualCrnCommandParam.getCommands().get(0); |
| | | redisUtil.set(RedisKeyType.DUAL_CRN_COMMAND_IDX.key + dualCrnCommand.getTaskNo(), sendDualCrnCommandParam.getCommandIdx(), 60 * 60 * 24); |
| | | redisUtil.set(RedisKeyType.DUAL_CRN_COMMAND_IDX.key + dualCrnCommand.getTaskNo(), 0, 60 * 60 * 24); |
| | | redisUtil.set(RedisKeyType.DUAL_CRN_COMMAND_.key + dualCrnCommand.getTaskNo(), JSON.toJSONString(sendDualCrnCommandParam, SerializerFeature.DisableCircularReferenceDetect), 60 * 60 * 24); |
| | | if (sendDualCrnCommandParam.getStation() == 1) { |
| | | redisUtil.set(RedisKeyType.DUAL_CRN_STATION1_FLAG.key + crnProtocol.getCrnNo(), dualCrnCommand.getTaskNo(), 60 * 60 * 24); |
| | | }else { |
| | | redisUtil.set(RedisKeyType.DUAL_CRN_STATION2_FLAG.key + crnProtocol.getCrnNo(), dualCrnCommand.getTaskNo(), 60 * 60 * 24); |
| | | } |
| | | } |
| | | |
| | | redisUtil.set(RedisKeyType.DUAL_CRN_COMMAND_.key + crnProtocol.getCrnNo(), JSON.toJSONString(commandList, SerializerFeature.DisableCircularReferenceDetect), 60 * 60 * 24); |
| | | } else if (step == 3) { |
| | | sendCommand((DualCrnCommand) task.getData()); |
| | | } |
| | |
| | | continue; |
| | | } |
| | | |
| | | Object commandListObj = redisUtil.get(RedisKeyType.DUAL_CRN_COMMAND_.key + crnProtocol.getCrnNo()); |
| | | if (commandListObj == null) { |
| | | continue; |
| | | } |
| | | List<SendDualCrnCommandParam> commandList = JSON.parseArray(commandListObj.toString(), SendDualCrnCommandParam.class); |
| | | List<SendDualCrnCommandParam> commandList = getDualCrnCommandList(); |
| | | for (SendDualCrnCommandParam commandParam : commandList) { |
| | | processStation(commandParam); |
| | | } |
| | |
| | | |
| | | boolean send = false; |
| | | if (station == 1) { |
| | | if (dualCommand.getTaskMode().intValue() == DualCrnTaskModeType.PICK.id) { |
| | | if (crnProtocol.getStatus().equals(DualCrnStatusType.IDLE.id)) { |
| | | send = true; |
| | | } |
| | | } else if (dualCommand.getTaskMode().intValue() == DualCrnTaskModeType.PUT.id) { |
| | | if (crnProtocol.getStatus().equals(DualCrnStatusType.FETCH_COMPLETE.id)) { |
| | | send = true; |
| | | if (crnProtocol.getTaskSend() == 0) { |
| | | if (dualCommand.getTaskMode().intValue() == DualCrnTaskModeType.PICK.id) { |
| | | if (crnProtocol.getStatus().equals(DualCrnStatusType.IDLE.id)) { |
| | | send = true; |
| | | } |
| | | } else if (dualCommand.getTaskMode().intValue() == DualCrnTaskModeType.PUT.id) { |
| | | if (crnProtocol.getStatus().equals(DualCrnStatusType.FETCH_COMPLETE.id)) { |
| | | send = true; |
| | | } |
| | | } |
| | | } |
| | | }else { |
| | | if (dualCommand.getTaskMode().intValue() == DualCrnTaskModeType.PICK.id) { |
| | | if (crnProtocol.getStatusTwo().equals(DualCrnStatusType.IDLE.id)) { |
| | | send = true; |
| | | } |
| | | } else if (dualCommand.getTaskMode().intValue() == DualCrnTaskModeType.PUT.id) { |
| | | if (crnProtocol.getStatusTwo().equals(DualCrnStatusType.FETCH_COMPLETE.id)) { |
| | | send = true; |
| | | if (crnProtocol.getTaskSendTwo() == 0) { |
| | | if (dualCommand.getTaskMode().intValue() == DualCrnTaskModeType.PICK.id) { |
| | | if (crnProtocol.getStatusTwo().equals(DualCrnStatusType.IDLE.id)) { |
| | | send = true; |
| | | } |
| | | } else if (dualCommand.getTaskMode().intValue() == DualCrnTaskModeType.PUT.id) { |
| | | if (crnProtocol.getStatusTwo().equals(DualCrnStatusType.FETCH_COMPLETE.id)) { |
| | | send = true; |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | |
| | | //工位1 |
| | | crnProtocol.setTaskNo(0); |
| | | crnProtocol.setDeviceTaskNo(0); |
| | | crnProtocol.setStatus(-1); |
| | | crnProtocol.setBay(0); |
| | | crnProtocol.setLevel(0); |
| | |
| | | |
| | | //工位2 |
| | | crnProtocol.setTaskNoTwo(0); |
| | | crnProtocol.setDeviceTaskNoTwo(0); |
| | | crnProtocol.setStatusTwo(-1); |
| | | crnProtocol.setBayTwo(0); |
| | | crnProtocol.setLevelTwo(0); |
| | |
| | | crnProtocol.setMode(crnStatus.getMode()); |
| | | |
| | | //工位1 |
| | | crnProtocol.setTaskNo(crnStatus.getTaskNo()); |
| | | crnProtocol.setDeviceTaskNo(crnStatus.getTaskNo()); |
| | | crnProtocol.setStatus(crnStatus.getStatus()); |
| | | crnProtocol.setForkPos(crnStatus.getForkPos()); |
| | | crnProtocol.setLoaded(crnStatus.getLoaded()); |
| | | crnProtocol.setTaskReceive(crnStatus.getTaskReceive()); |
| | | crnProtocol.setTaskSend(crnStatus.getTaskSend()); |
| | | |
| | | //工位2 |
| | | crnProtocol.setTaskNoTwo(crnStatus.getTaskNoTwo()); |
| | | crnProtocol.setDeviceTaskNoTwo(crnStatus.getTaskNoTwo()); |
| | | crnProtocol.setStatusTwo(crnStatus.getStatusTwo()); |
| | | crnProtocol.setForkPosTwo(crnStatus.getForkPosTwo()); |
| | | crnProtocol.setLoadedTwo(crnStatus.getLoadedTwo()); |
| | | crnProtocol.setTaskReceiveTwo(crnStatus.getTaskReceiveTwo()); |
| | | crnProtocol.setTaskSendTwo(crnStatus.getTaskSendTwo()); |
| | | |
| | | crnProtocol.setBay(crnStatus.getBay()); |
| | | crnProtocol.setLevel(crnStatus.getLevel()); |
| | |
| | | } |
| | | |
| | | @Override |
| | | public DualCrnCommand getResetCommand(Integer crnNo, Integer station) { |
| | | public DualCrnCommand getResetCommand(Integer taskNo, Integer crnNo, Integer station) { |
| | | DualCrnCommand crnCommand = new DualCrnCommand(); |
| | | crnCommand.setCrnNo(crnNo); // 堆垛机编号 |
| | | crnCommand.setTaskNo(0); // 工作号 |
| | | crnCommand.setTaskNo(taskNo); // 工作号 |
| | | crnCommand.setTaskMode(DualCrnTaskModeType.CONFIRM.id); // 任务模式: 确认 |
| | | crnCommand.setSourcePosX(0); // 源库位排 |
| | | crnCommand.setSourcePosY(0); // 源库位列 |
| | |
| | | } |
| | | } |
| | | } |
| | | |
| | | public List<SendDualCrnCommandParam> getDualCrnCommandList() { |
| | | List<SendDualCrnCommandParam> commandList = new ArrayList<>(); |
| | | SendDualCrnCommandParam command1 = getDualCrnCommandList(1); |
| | | SendDualCrnCommandParam command2 = getDualCrnCommandList(2); |
| | | if (command1 != null) { |
| | | commandList.add(command1); |
| | | } |
| | | |
| | | if (command2 != null) { |
| | | commandList.add(command2); |
| | | } |
| | | |
| | | return commandList; |
| | | } |
| | | |
| | | public SendDualCrnCommandParam getDualCrnCommandList(int station) { |
| | | SendDualCrnCommandParam sendDualCrnCommandParam = null; |
| | | String key = null; |
| | | if (station == 1 && crnProtocol.getTaskNo() > 0) { |
| | | key = RedisKeyType.DUAL_CRN_COMMAND_.key + crnProtocol.getTaskNo(); |
| | | } else if (station == 2 && crnProtocol.getTaskNoTwo() > 0) { |
| | | key = RedisKeyType.DUAL_CRN_COMMAND_.key + crnProtocol.getTaskNoTwo(); |
| | | } |
| | | |
| | | if (key == null) { |
| | | return null; |
| | | } |
| | | |
| | | Object commandObj = redisUtil.get(key); |
| | | if (commandObj == null) { |
| | | return null; |
| | | } |
| | | |
| | | sendDualCrnCommandParam = JSON.parseObject(commandObj.toString(), SendDualCrnCommandParam.class); |
| | | if (sendDualCrnCommandParam == null) { |
| | | return null; |
| | | } |
| | | |
| | | return sendDualCrnCommandParam; |
| | | } |
| | | } |