| | |
| | | /** |
| | | * 拣料、并板、盘点再入库 |
| | | */ |
| | | @Transactional |
| | | public synchronized void stnToCrnStnPick(){ |
| | | for (DevpSlave devp : slaveProperties.getDevp()) { |
| | | // 遍历拣料入库口 |
| | |
| | | && staProtocol.isPakMk()){ |
| | | |
| | | // 获取条码扫描仪信息 |
| | | // BarcodeThread barcodeThread = (BarcodeThread) SlaveConnection.get(SlaveType.Barcode, pickSta.getBarcode()); |
| | | // if (barcodeThread == null) { |
| | | // continue; |
| | | // } |
| | | BarcodeThread barcodeThread = (BarcodeThread) SlaveConnection.get(SlaveType.Barcode, pickSta.getBarcode()); |
| | | if (barcodeThread == null) { |
| | | continue; |
| | | } |
| | | String barcode = barcodeThread.getBarcode(); |
| | | |
| | | WrkMast wrkMast = null; |
| | | if (staProtocol.getWorkNo() > 0 && staProtocol.getWorkNo() < 9999) { |
| | | wrkMast = wrkMastMapper.selectPickStep(staProtocol.getWorkNo()); |
| | | if (null == wrkMast) { |
| | | continue; |
| | | } |
| | | } else { |
| | | wrkMast = wrkMastMapper.selectPickStepByBarcode(barcode); |
| | | if (wrkMast == null) { |
| | | continue; |
| | | } |
| | | // if (staProtocol.getWorkNo() == 9996) { |
| | |
| | | // News.error("{}条码错误,暂无拣料任务!", barcode); |
| | | // } |
| | | // } |
| | | |
| | | if ((wrkMast.getIoType() != 103 && wrkMast.getIoType() != 104 && wrkMast.getIoType() != 107) |
| | | || Cools.isEmpty(wrkMast.getStaNo()) || Cools.isEmpty(wrkMast.getSourceStaNo()) ) { |
| | | continue; |
| | |
| | | if (code.equals(200)) { |
| | | StartupDto dto = jsonObject.getObject("data", StartupDto.class); |
| | | |
| | | // 获取目标站 |
| | | Wrapper<StaDesc> wrapper = new EntityWrapper<StaDesc>() |
| | | .eq("type_no", wrkMast.getIoType() - 50) |
| | | .eq("stn_no", pickSta.getStaNo()) // 作业站点 = 拣料出库的目标站 |
| | | .eq("crn_no", dto.getCrnNo()); // 堆垛机号 |
| | | StaDesc staDesc = staDescService.selectOne(wrapper); |
| | | if (Cools.isEmpty(staDesc)) { |
| | | News.error("入库路径不存在!type_no={},stn_no={},crn_no={}", wrkMast.getIoType(), pickSta.getStaNo(), wrkMast.getCrnNo()); |
| | | continue; |
| | | } |
| | | // 堆垛机站点(目标站) |
| | | Integer staNo = staDesc.getCrnStn(); |
| | | // // 获取目标站 |
| | | // Wrapper<StaDesc> wrapper = new EntityWrapper<StaDesc>() |
| | | // .eq("type_no", wrkMast.getIoType() - 50) |
| | | // .eq("stn_no", pickSta.getStaNo()) // 作业站点 = 拣料出库的目标站 |
| | | // .eq("crn_no", dto.getCrnNo()); // 堆垛机号 |
| | | // StaDesc staDesc = staDescService.selectOne(wrapper); |
| | | // if (Cools.isEmpty(staDesc)) { |
| | | // News.error("入库路径不存在!type_no={},stn_no={},crn_no={}", wrkMast.getIoType(), pickSta.getStaNo(), wrkMast.getCrnNo()); |
| | | // continue; |
| | | // } |
| | | // // 堆垛机站点(目标站) |
| | | // Integer staNo = staDesc.getCrnStn(); |
| | | |
| | | // 保存工作明细档历史档 |
| | | // if (wrkMastMapper.saveWrkDetlLog(wrkMast.getWrkNo()) == 0) { |
| | |
| | | wrkMast.setSourceStaNo(pickSta.getStaNo()); // 源站 |
| | | wrkMast.setStaNo(dto.getStaNo()); // 目标站 |
| | | wrkMast.setCrnNo(dto.getCrnNo()); |
| | | wrkMast.setLocNo(dto.getLocNo()); // 目标库位 = 出库时的源库位 |
| | | wrkMast.setSourceLocNo(""); // 源库位清空 |
| | | wrkMast.setLocNo(sourceLocNo); // 目标库位 = 出库时的源库位 |
| | | wrkMast.setShuttleNo(null); // 穿梭车清空 |
| | | wrkMast.setModiTime(new Date()); |
| | | if (wrkMastMapper.updateById(wrkMast) == 0) { |
| | |
| | | } |
| | | |
| | | // 修改库位状态 Q.拣料/盘点/并板再入库 |
| | | LocMast locMast = locMastService.selectById(wrkMast.getLocNo()); |
| | | LocMast locMast = locMastService.selectById(sourceLocNo); |
| | | locMast.setLocSts("Q"); |
| | | locMast.setModiTime(new Date()); |
| | | if (!locMastService.updateById(locMast)) { |
| | |
| | | * 初始化实时地图 |
| | | */ |
| | | public synchronized void initRealtimeBasMap() { |
| | | for (int i = 1; i <= 4; i++) {//总共四层楼 |
| | | for (int i = 1; i <= 10; i++) {//总共四层楼 |
| | | Object data = redisUtil.get("realtimeBasMap_" + i); |
| | | if (data == null) {//redis地图数据为空,从数据库中获取 |
| | | BasMap basMap = basMapService.selectLatestMap(i); |
| | |
| | | if (commands == null) { |
| | | continue;//找不到路径等待下一次 |
| | | } |
| | | assignCommand.setCommands(commands); |
| | | // assignCommand.setCommands(commands); |
| | | //分配目标库位 |
| | | shuttleProtocol.setLocNo(wrkMast.getLocNo()); |
| | | //目标库位 |
| | |
| | | shuttleProtocol.setLocNo(liftSiteLocNo); |
| | | //目标库位 |
| | | assignCommand.setLocNo(liftSiteLocNo); |
| | | assignCommand.setCommands(commands); |
| | | // assignCommand.setCommands(commands); |
| | | wrkMast.setWrkSts(5L);//小车迁移状态 |
| | | } |
| | | } else if (wrkMast.getWrkSts() == 8) { |
| | |
| | | ShuttleCommand moveCommand = shuttleThread.getMoveCommand(startCode, distCode, 1600, runDirection, null, null, 500); |
| | | commands.add(0, moveCommand);//将该指令添加到队头 |
| | | |
| | | assignCommand.setCommands(commands); |
| | | // assignCommand.setCommands(commands); |
| | | //分配目标库位 |
| | | shuttleProtocol.setLocNo(wrkMast.getLocNo()); |
| | | //目标库位 |
| | |
| | | //获取小车移动速度 |
| | | BasShuttle basShuttle = basShuttleService.selectById(assignCommand.getShuttleNo()); |
| | | Integer runSpeed = 1000; |
| | | if (basShuttle != null) { |
| | | Integer runSpeed1 = basShuttle.getRunSpeed(); |
| | | if (runSpeed1 != null) { |
| | | runSpeed = runSpeed1; |
| | | } |
| | | } |
| | | // if (basShuttle != null) { |
| | | // Integer runSpeed1 = basShuttle.getRunSpeed(); |
| | | // if (runSpeed1 != null) { |
| | | // runSpeed = runSpeed1; |
| | | // } |
| | | // } |
| | | |
| | | //计算小车起点到中点所需命令 |
| | | List<NavigateNode> calc = NavigateUtils.calc(startLocNo, locNo, mapType, Utils.getShuttlePoints(shuttleThread.getSlave().getId(), Utils.getLev(startLocNo))); |
| | |
| | | //获取小车移动速度 |
| | | BasShuttle basShuttle = basShuttleService.selectById(assignCommand.getShuttleNo()); |
| | | Integer runSpeed = 1000; |
| | | if (basShuttle != null) { |
| | | Integer runSpeed1 = basShuttle.getRunSpeed(); |
| | | if (runSpeed1 != null) { |
| | | runSpeed = runSpeed1; |
| | | } |
| | | } |
| | | // if (basShuttle != null) { |
| | | // Integer runSpeed1 = basShuttle.getRunSpeed(); |
| | | // if (runSpeed1 != null) { |
| | | // runSpeed = runSpeed1; |
| | | // } |
| | | // } |
| | | |
| | | List<NavigateNode> allNode = new ArrayList<>(); |
| | | |
| | |
| | | shuttleProtocol.setSourceLocNo(currentLocNo); |
| | | //目标库位 |
| | | assignCommand.setLocNo(wrkMast.getSourceLocNo()); |
| | | assignCommand.setCommands(commands); |
| | | // assignCommand.setCommands(commands); |
| | | wrkMast.setWrkSts(26L);//小车搬运中 |
| | | |
| | | if (wrkMastMapper.updateById(wrkMast) > 0) { |
| | |
| | | |
| | | //目标库位 |
| | | assignCommand.setLocNo(liftSiteLocNo); |
| | | assignCommand.setCommands(commands); |
| | | // assignCommand.setCommands(commands); |
| | | wrkMast.setWrkSts(22L);//小车迁移状态 |
| | | |
| | | if (wrkMastMapper.updateById(wrkMast) > 0) { |
| | |
| | | shuttleProtocol.setSourceLocNo(liftSiteLocNo); |
| | | //目标库位 |
| | | assignCommand.setLocNo(wrkMast.getSourceLocNo()); |
| | | assignCommand.setCommands(commands); |
| | | // assignCommand.setCommands(commands); |
| | | wrkMast.setWrkSts(26L);//小车搬运中 |
| | | |
| | | if (wrkMastMapper.updateById(wrkMast) > 0) { |
| | |
| | | |
| | | //所需命令组合完毕,更新数据库,提交到线程去工作 |
| | | LiftAssignCommand assignCommand = new LiftAssignCommand(); |
| | | assignCommand.setCommands(commands); |
| | | // assignCommand.setCommands(commands); |
| | | assignCommand.setLiftNo(liftProtocol.getLiftNo()); |
| | | assignCommand.setTaskNo(liftProtocol.getTaskNo()); |
| | | if (wrkMastMapper.updateById(wrkMast) > 0) { |
| | |
| | | shuttleProtocol.setLocNo(liftSiteLocNo); |
| | | //目标库位 |
| | | assignCommand.setLocNo(liftSiteLocNo); |
| | | assignCommand.setCommands(commands); |
| | | // assignCommand.setCommands(commands); |
| | | wrkMast.setWrkSts(5L);//小车迁移状态 |
| | | |
| | | if (wrkMastMapper.updateById(wrkMast) > 0) { |
| | |
| | | //分配源库位 |
| | | shuttleProtocol.setSourceLocNo(wrkMast.getSourceLocNo()); |
| | | |
| | | assignCommand.setCommands(commands); |
| | | // assignCommand.setCommands(commands); |
| | | //分配目标库位 |
| | | shuttleProtocol.setLocNo(wrkMast.getLocNo()); |
| | | //目标库位 |
| | |
| | | commands.add(command); |
| | | |
| | | //指令集分配 |
| | | assignCommand.setCommands(commands); |
| | | // assignCommand.setCommands(commands); |
| | | |
| | | wrkCharge.setWrkSts(56L);//充电中状态 |
| | | if (wrkChargeMapper.updateById(wrkCharge) > 0) { |
| | |
| | | assignCommand.setLocNo(chargeLocNo); |
| | | //源库位 |
| | | assignCommand.setSourceLocNo(currentLocNo); |
| | | assignCommand.setCommands(commands); |
| | | // assignCommand.setCommands(commands); |
| | | wrkCharge.setWrkSts(52L);//小车迁移状态 |
| | | if (wrkChargeMapper.updateById(wrkCharge) > 0) { |
| | | //下发任务 |
| | |
| | | wrkCharge.setWrkSts(54L);//提升机搬运中 |
| | | //所需命令组合完毕,更新数据库,提交到线程去工作 |
| | | LiftAssignCommand assignCommand = new LiftAssignCommand(); |
| | | assignCommand.setCommands(commands); |
| | | // assignCommand.setCommands(commands); |
| | | assignCommand.setLiftNo(liftProtocol.getLiftNo()); |
| | | assignCommand.setTaskNo(liftProtocol.getTaskNo()); |
| | | if (wrkChargeMapper.updateById(wrkCharge) > 0) { |
| | |
| | | commands.add(command); |
| | | |
| | | //指令集分配 |
| | | assignCommand.setCommands(commands); |
| | | // assignCommand.setCommands(commands); |
| | | |
| | | wrkCharge.setWrkSts(56L);//充电中状态 |
| | | if (wrkChargeMapper.updateById(wrkCharge) > 0) { |