| | |
| | | } |
| | | } |
| | | |
| | | // 命令下发区 -------------------------------------------------------------------------- |
| | | // 入库命令下发区 -------------------------------------------------------------------------- |
| | | CrnCommand crnCommand = new CrnCommand(); |
| | | crnCommand.setCrnNo(slave.getId()); // 堆垛机编号 |
| | | crnCommand.setTaskNo(wrkMast.getWrkNo().shortValue()); // 工作号 |
| | | crnCommand.setAckFinish((short) 0); // 任务完成确认位 |
| | | crnCommand.setTaskMode(CrnTaskModeType.LOC_MOVE); // 任务模式: 库位移转 |
| | | crnCommand.setSourcePosX(crnStn.getRow().shortValue()); // 源库位排 |
| | | crnCommand.setSourcePosY(crnStn.getBay().shortValue()); // 源库位列 |
| | | crnCommand.setSourcePosZ(crnStn.getLev().shortValue()); // 源库位层 |
| | | //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()); // 目标库位层 |
| | | crnCommand.setSourceStaNo(crnStn.getPlatNo().shortValue()); // 源库位排 |
| | | if (!MessageQueue.offer(SlaveType.Crn, wrkMast.getCrnNo(), new Task(2, crnCommand))) { |
| | | log.error("堆垛机命令下发失败,堆垛机号={},任务数据={}", wrkMast.getCrnNo(), JSON.toJSON(crnCommand)); |
| | | } else { |
| | |
| | | log.error("查询工作档数据不符合条件--入出类型/站点, 工作号={},源库位={},入出类型={}", wrkMast.getWrkNo(), wrkMast.getSourceLocNo(), wrkMast.getIoType()); |
| | | continue; |
| | | } |
| | | //退库模式跳过118、119出库任务 |
| | | if (wrkMast.getStaNo()==118 || wrkMast.getStaNo()==119){ |
| | | RgvOneSign rgvOneSign = rgvOneSignMapper.selectOneSign(); |
| | | if (Cools.isEmpty(rgvOneSign) || rgvOneSign.getRgvOneSign()==1){ |
| | | continue; |
| | | } |
| | | } |
| | | // 获取源库位信息 |
| | | LocMast sourceSta = locMastService.selectById(wrkMast.getSourceLocNo()); |
| | | if (!sourceSta.getLocSts().equals("R") && !sourceSta.getLocSts().equals("P")) { |
| | |
| | | continue; |
| | | } |
| | | // 获取堆垛机出库站信息 |
| | | SiemensDevpThread devpThread = (SiemensDevpThread) SlaveConnection.get(SlaveType.Devp, crnStn.getDevpPlcId()); |
| | | StaProtocol staProtocol = devpThread.getStation().get(crnStn.getStaNo()); |
| | | if (staProtocol == null) { |
| | | break; |
| | | // continue; |
| | | } else { |
| | | staProtocol = staProtocol.clone(); |
| | | } |
| | | //SiemensDevpThread devpThread = (SiemensDevpThread) SlaveConnection.get(SlaveType.Devp, crnStn.getDevpPlcId()); |
| | | //StaProtocol staProtocol = devpThread.getStation().get(crnStn.getStaNo()); |
| | | // if (staProtocol == null) { |
| | | // break; |
| | | //// continue; |
| | | // } else { |
| | | // staProtocol = staProtocol.clone(); |
| | | // } |
| | | |
| | | // // 入出库模式判断 |
| | | // if (devpThread.ioMode != IoModeType.PAKOUT_MODE) { continue; } |
| | | if (wrkMast.getStaNo() == 204 && devpThread.ioModeOf2F != IoModeType.PAKOUT_MODE) { |
| | | continue; |
| | | } |
| | | // if (wrkMast.getStaNo() == 204 && devpThread.ioModeOf2F != IoModeType.PAKOUT_MODE) { |
| | | // continue; |
| | | // } |
| | | |
| | | // 查询站点详细信息 |
| | | BasDevp staDetl = basDevpService.selectById(crnStn.getStaNo()); |
| | |
| | | // continue; |
| | | } |
| | | // 判断堆垛机出库站状态 |
| | | if (staProtocol.isAutoing() && !staProtocol.isLoading() && staDetl.getCanouting() != null && staDetl.getCanouting().equals("Y") |
| | | && staProtocol.getWorkNo() == 0 && staProtocol.isOutEnable()) { |
| | | //if (staProtocol.isAutoing() && !staProtocol.isLoading() && staDetl.getCanouting() != null && staDetl.getCanouting().equals("Y") |
| | | // && staProtocol.getWorkNo() == 0 && staProtocol.isOutEnable()) { |
| | | if (staDetl.getCanouting() != null && staDetl.getCanouting().equals("Y")) { |
| | | // 命令下发区 -------------------------------------------------------------------------- |
| | | |
| | | // 堆垛机控制过滤 |
| | |
| | | // return; |
| | | } |
| | | |
| | | // 1.堆垛机开始移动 |
| | | // 1.堆垛机开始移动 出库命令 |
| | | CrnCommand crnCommand = new CrnCommand(); |
| | | crnCommand.setCrnNo(slave.getId()); // 堆垛机编号 |
| | | crnCommand.setTaskNo(wrkMast.getWrkNo().shortValue()); // 工作号 |
| | |
| | | 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()); // 目标库位层 |
| | | // crnCommand.setDestinationPosX(crnStn.getRow().shortValue()); // 目标库位排 |
| | | // crnCommand.setDestinationPosY(crnStn.getBay().shortValue()); // 目标库位列 |
| | | // crnCommand.setDestinationPosZ(crnStn.getLev().shortValue()); // 目标库位层 |
| | | crnCommand.setDestinationStaNo(crnStn.getPlatNo().shortValue()); |
| | | if (!MessageQueue.offer(SlaveType.Crn, wrkMast.getCrnNo(), new Task(2, crnCommand))) { |
| | | log.error("堆垛机命令下发失败,堆垛机号={},任务数据={}", wrkMast.getCrnNo(), JSON.toJSON(crnCommand)); |
| | | } else { |
| | |
| | | */ |
| | | private boolean crnEnabled(WrkMast wrkMast) { |
| | | |
| | | String url = "127.0.0.1"; |
| | | String path = "/ghwcs/ca"; |
| | | String url = "http://192.168.14.249:8008"; |
| | | String path = "/api/Task/DockStatus"; |
| | | |
| | | // 获取请求头 |
| | | Map<String,Object> headers = new HashMap<>(); |
| | |
| | | // 入库 + 库位转移 ==> 4.入库完成 |
| | | if (wrkMast.getWrkSts() == 3 || (wrkMast.getWrkSts() == 12 && wrkMast.getIoType() == 11)) { |
| | | wrkMast.setWrkSts(4L); |
| | | if (wrkMast.getIoType() == 3) { |
| | | wrkMast.setWrkSts(13L); |
| | | } |
| | | } else { |
| | | continue; |
| | | } |
| | |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 二楼空托回流到一楼,3.站到站任务 |
| | | */ |
| | | public synchronized void emptyTrayReflux() { |
| | | for (CrnSlave crn : slaveProperties.getCrn()) { |
| | | List<WrkMast> wrkMastList = wrkMastMapper.selectList(new EntityWrapper<WrkMast>().eq("wrk_sts", 2) |
| | | .eq("crn_no",crn.getId()).eq("io_type", 3)); |
| | | for (WrkMast wrkMast : wrkMastList) { |
| | | CrnThread crnThread = (CrnThread) SlaveConnection.get(SlaveType.Crn, crn.getId()); |
| | | CrnProtocol crnProtocol = crnThread.getCrnProtocol(); |
| | | if (crnProtocol == null) { |
| | | continue; |
| | | } |
| | | if (crnProtocol.getStatusType() == CrnStatusType.IDLE |
| | | && crnProtocol.getTaskNo() == 0 |
| | | && crnProtocol.getModeType() == CrnModeType.AUTO |
| | | && crnProtocol.getLoaded() == 0 |
| | | && crnProtocol.getForkPos() == 0) { |
| | | |
| | | CrnSlave.CrnStn crnStn = null; |
| | | for (CrnSlave.CrnStn crnStn1 : crn.getCrnInStn()){ |
| | | if(crnStn1.getStaNo().equals(wrkMast.getStaNo())){ |
| | | crnStn = crnStn1; |
| | | break; |
| | | } |
| | | } |
| | | if(Cools.isEmpty(crnStn)){ |
| | | continue; |
| | | } |
| | | |
| | | // 入库命令下发区 -------------------------------------------------------------------------- |
| | | CrnCommand crnCommand = new CrnCommand(); |
| | | crnCommand.setCrnNo(crnProtocol.getCrnNo()); // 堆垛机编号 |
| | | crnCommand.setTaskNo(wrkMast.getWrkNo().shortValue()); // 工作号 |
| | | crnCommand.setAckFinish((short) 0); // 任务完成确认位 |
| | | crnCommand.setTaskMode(CrnTaskModeType.LOC_MOVE); // 任务模式: 库位移转 |
| | | //crnCommand.setSourcePosX(crnStn.getRow().shortValue()); // 源库位排 |
| | | //crnCommand.setSourcePosY(crnStn.getBay().shortValue()); // 源库位列 |
| | | //crnCommand.setSourcePosZ(crnStn.getLev().shortValue()); // 源库位层 |
| | | crnCommand.setDestinationPosX(crnStn.getRow().shortValue()); // 目标库位排 |
| | | crnCommand.setDestinationPosY(crnStn.getBay().shortValue()); // 目标库位列 |
| | | crnCommand.setDestinationPosZ(crnStn.getLev().shortValue()); // 目标库位层 |
| | | crnCommand.setSourceStaNo(crnStn.getPlatNo().shortValue()); // 源库位排 |
| | | if (!MessageQueue.offer(SlaveType.Crn, wrkMast.getCrnNo(), new Task(2, crnCommand))) { |
| | | log.error("堆垛机命令下发失败,堆垛机号={},任务数据={}", wrkMast.getCrnNo(), JSON.toJSON(crnCommand)); |
| | | } else { |
| | | // 修改工作档状态 2.设备上走 => 3.吊车入库中 |
| | | Date now = new Date(); |
| | | wrkMast.setWrkSts(3L); |
| | | wrkMast.setCrnStrTime(now); |
| | | wrkMast.setModiTime(now); |
| | | if (wrkMastMapper.updateById(wrkMast) == 0) { |
| | | log.error("修改工作档状态 2.设备上走 => 3.吊车入库中 失败!!,工作号={}", wrkMast.getWrkNo()); |
| | | } |
| | | } |
| | | break; |
| | | } |
| | | |
| | | } |
| | | } |
| | | } |
| | | } |