| | |
| | | Integer code = jsonObject.getInteger("code"); |
| | | if (code.equals(200)) { |
| | | StartupDto dto = jsonObject.getObject("data", StartupDto.class); |
| | | // // plc 处理 |
| | | // barcodeThread.setBarcode(""); |
| | | // plc 处理 |
| | | barcodeThread.setBarcode(""); |
| | | // staProtocol.setWorkNo(dto.getWorkNo().shortValue()); |
| | | // staProtocol.setStaNo(dto.getStaNo().shortValue()); |
| | | // devpThread.setPakMk(staProtocol.getSiteId(), false); |
| | |
| | | return false;//小车已被独占,禁止再派发任务 |
| | | } |
| | | |
| | | //判断小车是否存在移动任务 |
| | | WrkMast hasMoveWorking = wrkMastMapper.selectShuttleHasMoveWorking(wrkMast.getShuttleNo()); |
| | | if (hasMoveWorking != null) { |
| | | return false;//存在移动任务,禁止执行入库任务 |
| | | } |
| | | |
| | | //判断小车是否到达输送站点库位 |
| | | if (!shuttleProtocol.getCurrentLocNo().equals(liftStaProtocol.getLocNo())) { |
| | | //小车不在输送站点位置 |
| | |
| | | |
| | | //23.小车搬运完成 ==> 24.提升机搬运中 |
| | | if (wrkMast.getWrkSts() == 23) { |
| | | NyShuttleThread shuttleThread = (NyShuttleThread) SlaveConnection.get(SlaveType.Shuttle, wrkMast.getShuttleNo()); |
| | | if (shuttleThread == null) { |
| | | return false; |
| | | } |
| | | |
| | | //调度小车避让 |
| | | boolean result = Utils.searchEmptyGroupToMoveShuttle(Utils.getLev(wrkMast.getSourceLocNo()), wrkMast.getShuttleNo(), shuttleThread); |
| | | if (!result) { |
| | | return false; |
| | | } |
| | | |
| | | //获取出库站点(目标站) |
| | | BasDevp basDevp = basDevpService.selectById(wrkMast.getStaNo()); |
| | | if (basDevp == null) { |
| | |
| | | case 3://3.提升机搬运中 ==> 4.提升机搬运完成 |
| | | wrkMast.setWrkSts(4L); |
| | | wrkMast.setLiftNo(null);//释放提升机 |
| | | if (liftProtocol.getToken() == wrkMast.getWrkNo()) { |
| | | if (liftProtocol.getToken().equals(wrkMast.getWrkNo())) { |
| | | //释放提升机令牌 |
| | | liftProtocol.setToken(0); |
| | | } |
| | |
| | | //释放提升机令牌 |
| | | liftProtocol.setToken(0); |
| | | } |
| | | |
| | | if (wrkMast.getMk() == null || !wrkMast.getMk().equals("Y")) { |
| | | //不需要用到机械臂,直接转29.出库完成 |
| | | wrkMast.setWrkSts(29L); |
| | | } |
| | | |
| | | break; |
| | | case 106://106.提升机搬运中 ==> 107.提升机搬运完成 |
| | | wrkMast.setWrkSts(107L); |
| | |
| | | Integer code = jsonObject.getInteger("code"); |
| | | if (code.equals(200)) { |
| | | StartupDto dto = jsonObject.getObject("data", StartupDto.class); |
| | | |
| | | barcodeThread.setBarcode(""); |
| | | // // 更新站点信息 且 下发plc命令 |
| | | // staProtocol.setWorkNo(dto.getWorkNo().shortValue()); |
| | | // staProtocol.setStaNo(dto.getStaNo().shortValue()); |
| | |
| | | continue; |
| | | } |
| | | |
| | | if (wrkMast.getMk().equals("Y")) {//标记为Y表示需要用到机械臂拣料 |
| | | if (wrkMast.getMk() != null && wrkMast.getMk().equals("Y")) {//标记为Y表示需要用到机械臂拣料 |
| | | Short targetSta = null;//目标站 |
| | | //判断机械臂拣料站是否空闲 |
| | | StaProtocol staProtocol303 = devpThread.getStation().get(303); |
| | |
| | | |
| | | targetSta = (short) 317; |
| | | |
| | | //覆盖工作档目标站 |
| | | wrkMast.setStaNo(targetSta.intValue()); |
| | | if (wrkMastMapper.updateById(wrkMast) > 0) { |
| | | //向300站写入目标站 |
| | | staProtocol = staProtocol.clone(); |
| | | staProtocol.setStaNo(targetSta);//移动到目标站 |
| | | boolean result = MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol)); |
| | | try { |
| | | Thread.sleep(500); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | if (wrkMast.getStaNo() != 303 && wrkMast.getStaNo() != 317) { |
| | | //覆盖工作档目标站 |
| | | wrkMast.setStaNo(targetSta.intValue()); |
| | | if (wrkMastMapper.updateById(wrkMast) > 0) { |
| | | //向300站写入目标站 |
| | | staProtocol = staProtocol.clone(); |
| | | staProtocol.setStaNo(targetSta);//移动到目标站 |
| | | boolean result = MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol)); |
| | | try { |
| | | Thread.sleep(500); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | continue; |
| | | } |
| | | continue; |
| | | } |
| | | } |
| | | } |
| | |
| | | StaProtocol staProtocol317 = devpThread.getStation().get(317); |
| | | if (staProtocol303.isAutoing() && staProtocol303.isLoading() && staProtocol303.getWorkNo() != 0) { |
| | | //调度机械臂 |
| | | //查询是否有工作档 |
| | | WrkMast wrkMast = wrkMastMapper.selectByWorkNo(staProtocol303.getWorkNo().intValue()); |
| | | if (wrkMast == null) { |
| | | continue; |
| | | } |
| | | WrkDetl wrkDetl = wrkDetlService.selectById(wrkMast.getWrkNo()); |
| | | if (wrkDetl == null) { |
| | | continue; |
| | | } |
| | | RobotUtils.sendTask(staProtocol303.getWorkNo().toString(), wrkDetl.getAnfme().intValue(), "303"); |
| | | // //查询是否有工作档 |
| | | // WrkMast wrkMast = wrkMastMapper.selectByWorkNo(staProtocol303.getWorkNo().intValue()); |
| | | // if (wrkMast == null) { |
| | | // continue; |
| | | // } |
| | | // WrkDetl wrkDetl = wrkDetlService.selectById(wrkMast.getWrkNo()); |
| | | // if (wrkDetl == null) { |
| | | // continue; |
| | | // } |
| | | // RobotUtils.sendTask(staProtocol303.getWorkNo().toString(), wrkDetl.getAnfme().intValue(), "303"); |
| | | RobotUtils.sendTask(staProtocol303.getWorkNo().toString(), -1, "303"); |
| | | }else if (staProtocol317.isAutoing() && staProtocol317.isLoading() && staProtocol317.getWorkNo() != 0) { |
| | | //调度机械臂 |
| | | //查询是否有工作档 |
| | | WrkMast wrkMast = wrkMastMapper.selectByWorkNo(staProtocol317.getWorkNo().intValue()); |
| | | if (wrkMast == null) { |
| | | continue; |
| | | } |
| | | WrkDetl wrkDetl = wrkDetlService.selectById(wrkMast.getWrkNo()); |
| | | if (wrkDetl == null) { |
| | | continue; |
| | | } |
| | | RobotUtils.sendTask(staProtocol303.getWorkNo().toString(), wrkDetl.getAnfme().intValue(), "317"); |
| | | // //查询是否有工作档 |
| | | // WrkMast wrkMast = wrkMastMapper.selectByWorkNo(staProtocol317.getWorkNo().intValue()); |
| | | // if (wrkMast == null) { |
| | | // continue; |
| | | // } |
| | | // WrkDetl wrkDetl = wrkDetlService.selectById(wrkMast.getWrkNo()); |
| | | // if (wrkDetl == null) { |
| | | // continue; |
| | | // } |
| | | // RobotUtils.sendTask(staProtocol303.getWorkNo().toString(), wrkDetl.getAnfme().intValue(), "317"); |
| | | RobotUtils.sendTask(staProtocol303.getWorkNo().toString(), -1, "317"); |
| | | } |
| | | } |
| | | } |
| | |
| | | } |
| | | |
| | | //获取小车到输送站点行走命令 |
| | | NyShuttleOperaResult result = NyShuttleOperaUtils.getStartToTargetCommands(shuttleThread.getSlave().getId(), wrkMast.getWrkNo(), shuttleProtocol.getCurrentLocNo(), liftSta.getLocNo()); |
| | | NyShuttleOperaResult result = NyShuttleOperaUtils.getStartToTargetCommands(shuttleThread.getSlave().getId(), wrkMast.getWrkNo(), shuttleProtocol.getCurrentLocNo(), liftSta.getLocNo(), NavigationMapType.NORMAL.id); |
| | | List<NyShuttleHttpCommand> commands = result.getCommands(); |
| | | |
| | | ShuttleAssignCommand assignCommand = new ShuttleAssignCommand(); |
| | |
| | | // liftNode.setZ(basLift.getPoint$().getZ()); |
| | | |
| | | //获取小车到目标库位命令 |
| | | NyShuttleOperaResult result = NyShuttleOperaUtils.getStartToTargetCommands(shuttleThread.getSlave().getId(), wrkMast.getWrkNo(), shuttleProtocol.getCurrentLocNo(), wrkMast.getLocNo()); |
| | | NyShuttleOperaResult result = NyShuttleOperaUtils.getStartToTargetCommands(shuttleThread.getSlave().getId(), wrkMast.getWrkNo(), shuttleProtocol.getCurrentLocNo(), wrkMast.getLocNo(), NavigationMapType.NORMAL.id); |
| | | if (result == null) { |
| | | return false;//路径计算失败 |
| | | } |