| | |
| | | } |
| | | |
| | | // 命令下发区 -------------------------------------------------------------------------- |
| | | // CrnThread crnThread = (CrnThread) SlaveConnection.get(SlaveType.Crn, slave.getId()); |
| | | // CrnProtocol crnProtocol = crnThread.getCrnProtocol(); |
| | | CrnCommand crnCommand = new CrnCommand(); |
| | | crnCommand.setCrnNo(slave.getId()); // 堆垛机编号 |
| | | crnCommand.setTaskNo(wrkMast.getWrkNo().shortValue()); // 工作号 |
| | | crnCommand.setDestinationPosX(locMast.getRow1().shortValue()); // 排 |
| | | crnCommand.setDestinationPosY(locMast.getBay1().shortValue()); // 列 |
| | | crnCommand.setDestinationPosZ(locMast.getLev1().shortValue()); // 层 |
| | | crnCommand.setAckFinish((short) 0); // 任务完成确认位 |
| | | crnCommand.setTaskMode(CrnTaskModeType.PAKIN); // 任务模式: 库位移转 |
| | | crnCommand.setSourcePosX(crnStn.getRow().shortValue()); // 源库位排 |
| | | crnCommand.setSourcePosY(crnStn.getBay().shortValue()); // 源库位列 |
| | | crnCommand.setSourcePosZ(crnStn.getLev().shortValue()); // 源库位层 |
| | | crnCommand.setDestinationPosX(locMast.getRow1().shortValue()); // 目标库位排 |
| | | crnCommand.setDestinationPosY(locMast.getBay1().shortValue()); // 目标库位列 |
| | | crnCommand.setDestinationPosZ(locMast.getLev1().shortValue()); // 目标库位层 |
| | | if (!MessageQueue.offer(SlaveType.Crn, wrkMast.getCrnNo(), new Task(2, crnCommand))) { |
| | | log.error("堆垛机命令下发失败,堆垛机号={},任务数据={}", wrkMast.getCrnNo(), JSON.toJSON(crnCommand)); |
| | | } else { |
| | | // 修改工作档状态 2=>3 todo:luxiaotao |
| | | // Date now = new Date(); |
| | | // wrkMast.setWrkSts(3L); |
| | | // wrkMast.setCrnStrTime(now); |
| | | // wrkMast.setModiTime(now); |
| | | } |
| | | } |
| | | } |
| | |
| | | && staProtocol.getWorkNo() == 0) { |
| | | // 命令下发区 -------------------------------------------------------------------------- |
| | | CrnCommand crnCommand = new CrnCommand(); |
| | | crnCommand.setCrnNo(slave.getId()); // 堆垛机编号 |
| | | crnCommand.setTaskNo(wrkMast.getWrkNo().shortValue()); // 工作号 |
| | | crnCommand.setAckFinish((short) 1); // 任务完成确认位 |
| | | |
| | | crnCommand.setAckFinish((short) 0); // 任务完成确认位 |
| | | crnCommand.setTaskMode(CrnTaskModeType.PAKOUT); // 任务模式: 库位移转 |
| | | crnCommand.setSourcePosX(sourceSta.getRow1().shortValue()); // 源库位排 |
| | | crnCommand.setSourcePosY(sourceSta.getBay1().shortValue()); // 源库位列 |
| | | crnCommand.setSourcePosZ(sourceSta.getLev1().shortValue()); // 源库位层 |
| | | crnCommand.setDestinationPosX(crnStn.getRow().shortValue()); // 目标库位排 |
| | | crnCommand.setDestinationPosY(crnStn.getBay().shortValue()); // 目标库位列 |
| | | crnCommand.setDestinationPosZ(crnStn.getLev().shortValue()); // 目标库位层 |
| | | if (!MessageQueue.offer(SlaveType.Crn, wrkMast.getCrnNo(), new Task(2, crnCommand))) { |
| | | log.error("堆垛机命令下发失败,堆垛机号={},任务数据={}", wrkMast.getCrnNo(), JSON.toJSON(crnCommand)); |
| | | } |
| | |
| | | // 获取堆垛机信息 |
| | | CrnThread crnThread = (CrnThread) SlaveConnection.get(SlaveType.Crn, crn.getId()); |
| | | CrnProtocol crnProtocol = crnThread.getCrnProtocol(); |
| | | // 状态:等待确认 并且 任务完成位 = 1 |
| | | if (crnProtocol.statusType == CrnStatusType.WAITING && crnProtocol.taskFinish == 1 && crnProtocol.getTaskNo() != 0) { |
| | | // 获取入库待确认工作档 |
| | | WrkMast wrkMast = wrkMastMapper.selectPakInStep3(crnProtocol.getTaskNo().intValue()); |
| | | if (wrkMast == null) { |
| | | log.error("堆垛机处于等待确认且任务完成状态,但未找到工作档。堆垛机号={},工作号={}", crn.getId(), crnProtocol.getTaskNo()); |
| | | continue; |
| | | } |
| | | // 如果工作状态为3.吊车入库中,则修改为4.入库完成 |
| | | if (wrkMast.getWrkSts() == 3) { |
| | | Date now = new Date(); |
| | | wrkMast.setWrkSts(4L); |
| | | wrkMast.setCrnEndTime(now); |
| | | wrkMast.setModiTime(now); |
| | | // 修改成功后复位堆垛机 |
| | | if (wrkMastMapper.updateById(wrkMast) > 0) { |
| | | |
| | | } |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | } |
| | | } |