| | |
| | | try { |
| | | deviceLogCollectTime = Utils.getDeviceLogCollectTime(); |
| | | readStatus(); |
| | | Thread.sleep(100); |
| | | Thread.sleep(50); |
| | | } catch (Exception e) { |
| | | log.error("DualCrnThread Fail", e); |
| | | } |
| | |
| | | map.put("commands", commandList); |
| | | map.put("idx", 1); |
| | | redisUtil.set(RedisKeyType.DUAL_CRN_COMMAND_.key + command.getTaskNo(), JSON.toJSONString(map, SerializerFeature.DisableCircularReferenceDetect), 60 * 60 * 24); |
| | | redisUtil.set(RedisKeyType.DUAL_CRN_COMMAND_STATION_TASK_NO.key + crnProtocol.getCrnNo() + "_" + command.getStation(), command.getTaskNo(), 60 * 60 * 24); |
| | | sendCommand(command); |
| | | } else if (step == 3) { |
| | | sendCommand((DualCrnCommand) task.getData()); |
| | |
| | | } |
| | | } |
| | | |
| | | if(crnProtocol.getTaskNo() > 0 && crnProtocol.getStatus() == DualCrnStatusType.IDLE.id) { |
| | | Integer taskNo = crnProtocol.getTaskNo(); |
| | | if(crnProtocol.getTaskNo() == 0 && crnProtocol.getStatus().equals(DualCrnStatusType.FETCH_COMPLETE.id)) { |
| | | Integer taskNo = null; |
| | | Object stationObj = redisUtil.get(RedisKeyType.DUAL_CRN_COMMAND_STATION_TASK_NO.key + crnProtocol.getCrnNo() + "_" + 1); |
| | | if(stationObj != null) { |
| | | taskNo = Integer.parseInt(String.valueOf(stationObj)); |
| | | } |
| | | |
| | | if (taskNo == null) { |
| | | News.error("双工位堆垛机,工位1空闲等待下发命令,但未找到工作号。堆垛机号={}", crnProtocol.getCrnNo()); |
| | | continue; |
| | | } |
| | | |
| | | Object commandObj = redisUtil.get(RedisKeyType.DUAL_CRN_COMMAND_.key + taskNo); |
| | | if (commandObj == null) { |
| | | News.error("双工位堆垛机,工位1空闲等待下发命令,但未找到命令。堆垛机号={},工作号={}", crnProtocol.getCrnNo(), taskNo); |
| | |
| | | redisUtil.set(RedisKeyType.DUAL_CRN_COMMAND_.key + taskNo, commandMap.toJSONString(), 60 * 60 * 24); |
| | | } |
| | | |
| | | if(crnProtocol.getTaskNoTwo() > 0 && crnProtocol.getStatusTwo() == DualCrnStatusType.IDLE.id) { |
| | | Integer taskNo = crnProtocol.getTaskNoTwo(); |
| | | if(crnProtocol.getTaskNoTwo() == 0 && crnProtocol.getStatusTwo().equals(DualCrnStatusType.FETCH_COMPLETE.id)) { |
| | | Integer taskNo = null; |
| | | Object stationObj = redisUtil.get(RedisKeyType.DUAL_CRN_COMMAND_STATION_TASK_NO.key + crnProtocol.getCrnNo() + "_" + 2); |
| | | if(stationObj != null) { |
| | | taskNo = Integer.parseInt(String.valueOf(stationObj)); |
| | | } |
| | | |
| | | if (taskNo == null) { |
| | | News.error("双工位堆垛机,工位1空闲等待下发命令,但未找到工作号。堆垛机号={}", crnProtocol.getCrnNo()); |
| | | continue; |
| | | } |
| | | |
| | | Object commandObj = redisUtil.get(RedisKeyType.DUAL_CRN_COMMAND_.key + taskNo); |
| | | if (commandObj == null) { |
| | | News.error("双工位堆垛机,工位2空闲等待下发命令,但未找到命令。堆垛机号={},工作号={}", crnProtocol.getCrnNo(), taskNo); |
| | |
| | | crnProtocol.setLiftPosTwo(0); |
| | | |
| | | crnProtocol.setAlarm(0); |
| | | crnProtocol.setXSpeed(0); |
| | | crnProtocol.setYSpeed(0); |
| | | crnProtocol.setZSpeed(0); |
| | | crnProtocol.setXDistance(0); |
| | | crnProtocol.setYDistance(0); |
| | | crnProtocol.setXDuration(0); |
| | | crnProtocol.setYDuration(0); |
| | | crnProtocol.setXSpeed(0D); |
| | | crnProtocol.setYSpeed(0D); |
| | | crnProtocol.setZSpeed(0D); |
| | | crnProtocol.setXDistance(0D); |
| | | crnProtocol.setYDistance(0D); |
| | | crnProtocol.setXDuration(0D); |
| | | crnProtocol.setYDuration(0D); |
| | | |
| | | BasDualCrnpService basDualCrnpService = null; |
| | | try { |
| | |
| | | crnCommand.setCrnNo(crnNo); // 堆垛机编号 |
| | | crnCommand.setTaskNo(taskNo); // 工作号 |
| | | crnCommand.setTaskMode(DualCrnTaskModeType.PICK.id); // 任务模式: 取货 |
| | | crnCommand.setSourcePosX(Utils.getRow(targetLocNo)); // 目标库位排 |
| | | crnCommand.setSourcePosY(Utils.getBay(targetLocNo)); // 目标库位列 |
| | | crnCommand.setSourcePosZ(Utils.getLev(targetLocNo)); // 目标库位层 |
| | | crnCommand.setDestinationPosX(Utils.getRow(targetLocNo)); // 目标库位排 |
| | | crnCommand.setDestinationPosY(Utils.getBay(targetLocNo)); // 目标库位列 |
| | | crnCommand.setDestinationPosZ(Utils.getLev(targetLocNo)); // 目标库位层 |
| | |
| | | crnCommand.setCrnNo(crnNo); // 堆垛机编号 |
| | | crnCommand.setTaskNo(taskNo); // 工作号 |
| | | crnCommand.setTaskMode(DualCrnTaskModeType.PUT.id); // 任务模式: 放货 |
| | | crnCommand.setSourcePosX(Utils.getRow(targetLocNo)); // 目标库位排 |
| | | crnCommand.setSourcePosY(Utils.getBay(targetLocNo)); // 目标库位列 |
| | | crnCommand.setSourcePosZ(Utils.getLev(targetLocNo)); // 目标库位层 |
| | | crnCommand.setDestinationPosX(Utils.getRow(targetLocNo)); // 目标库位排 |
| | | crnCommand.setDestinationPosY(Utils.getBay(targetLocNo)); // 目标库位列 |
| | | crnCommand.setDestinationPosZ(Utils.getLev(targetLocNo)); // 目标库位层 |
| | |
| | | crnCommand.setCrnNo(crnNo); // 堆垛机编号 |
| | | crnCommand.setTaskNo(taskNo); // 工作号 |
| | | crnCommand.setTaskMode(DualCrnTaskModeType.MOVE.id); // 任务模式: 堆垛机移动 |
| | | crnCommand.setSourcePosX(Utils.getRow(targetLocNo)); // 目标库位排 |
| | | crnCommand.setSourcePosY(Utils.getBay(targetLocNo)); // 目标库位列 |
| | | crnCommand.setSourcePosZ(Utils.getLev(targetLocNo)); // 目标库位层 |
| | | crnCommand.setDestinationPosX(Utils.getRow(targetLocNo)); // 目标库位排 |
| | | crnCommand.setDestinationPosY(Utils.getBay(targetLocNo)); // 目标库位列 |
| | | crnCommand.setDestinationPosZ(Utils.getLev(targetLocNo)); // 目标库位层 |