| | |
| | | /** |
| | | * 拣料、并板、盘点再入库【第2阶段】 |
| | | */ |
| | | @Transactional |
| | | public synchronized void stnToCrnStnPick1(){ |
| | | for (DevpSlave devp : slaveProperties.getDevp()) { |
| | | // 遍历拣料入库口 |
| | |
| | | } |
| | | |
| | | String sourceLocNo = wrkMast.getSourceLocNo().trim(); |
| | | |
| | | // 更新工作档数据状态 |
| | | wrkMast.setIoType(wrkMast.getIoType() - 50); // 入出库类型: 103->53,104->54,107->57 |
| | | wrkMast.setWrkSts(2L); // 工作状态: 2.设备上走 |
| | |
| | | if (wrkMastMapper.setSteEmpty(wrkMast.getWrkNo()) == 0) { |
| | | throw new CoolException(wrkMast.getWrkNo() + "更新工作档数据状态失败"); |
| | | } |
| | | |
| | | LocMast locMast = null; |
| | | // 修改源库位状态 O.空库位 |
| | | // locMast = locMastService.selectById(sourceLocNo); |
| | | // locMast.setLocSts("O"); |
| | | // locMast.setModiTime(new Date()); |
| | | // if (!locMastService.updateById(locMast)) { |
| | | // throw new CoolException(wrkMast.getWrkNo() + "修改源库位状态 O.空库位"); |
| | | // } |
| | | // 修改目标库位状态 Q.拣料/盘点/并板再入库 |
| | | locMast = locMastService.selectById(wrkMast.getLocNo()); |
| | | locMast.setLocSts("Q"); |
| | |
| | | if (!locMastService.updateById(locMast)) { |
| | | throw new CoolException(wrkMast.getWrkNo() + "修改目标库位状态 Q.拣料/盘点/并板再入库"); |
| | | } |
| | | // 库存明细转移 |
| | | // if (!locDetlService.updateLocNo(wrkMast.getLocNo(), sourceLocNo)) { |
| | | // throw new CoolException(wrkMast.getWrkNo() + "任务库存明细转移失败!!!"); |
| | | // } |
| | | // 源库位库存明细转移到目标库位 |
| | | if (!locDetlService.updateLocNo(wrkMast.getLocNo(), sourceLocNo)) { |
| | | throw new CoolException(wrkMast.getLocNo() + "任务库存明细转移失败!!!"); |
| | | } |
| | | |
| | | // 修改源库位状态 O.空库位 |
| | | LocMast sourceLocMast = locMastService.selectById(sourceLocNo); |
| | | if (sourceLocMast.getLocSts().equals("P")) { |
| | | sourceLocMast.setLocSts("O"); |
| | | sourceLocMast.setModiTime(new Date()); |
| | | if (!locMastService.updateById(sourceLocMast)) { |
| | | throw new CoolException(wrkMast.getWrkNo() + "修改源库位状态 O.空库位"); |
| | | } |
| | | locDetlService.delete(new EntityWrapper<LocDetl>().eq("loc_no", sourceLocNo)); |
| | | } |
| | | |
| | | // 条码设备处理 |
| | | barcodeThread.setBarcode(""); |
| | |
| | | public synchronized void pickWrkCompleteStaNo() { |
| | | List<WrkMast> wrkMasts = wrkMastMapper.selectPick17(null, null); |
| | | for (WrkMast wrkMast : wrkMasts) { |
| | | // 修改源库位状态 O.空库位 |
| | | LocMast locMast = locMastService.selectById(wrkMast.getSourceLocNo()); |
| | | if (locMast.getLocSts().equals("P")) { |
| | | locMast.setLocSts("O"); |
| | | locMast.setModiTime(new Date()); |
| | | if (!locMastService.updateById(locMast)) { |
| | | throw new CoolException(wrkMast.getWrkNo() + "修改源库位状态 O.空库位"); |
| | | } |
| | | locDetlService.delete(new EntityWrapper<LocDetl>().eq("loc_no", wrkMast.getSourceLocNo())); |
| | | } |
| | | // // 修改源库位状态 O.空库位 |
| | | // LocMast locMast = locMastService.selectById(wrkMast.getSourceLocNo()); |
| | | // if (locMast.getLocSts().equals("P")) { |
| | | // locMast.setLocSts("O"); |
| | | // locMast.setModiTime(new Date()); |
| | | // if (!locMastService.updateById(locMast)) { |
| | | // throw new CoolException(wrkMast.getWrkNo() + "修改源库位状态 O.空库位"); |
| | | // } |
| | | // locDetlService.delete(new EntityWrapper<LocDetl>().eq("loc_no", wrkMast.getSourceLocNo())); |
| | | // } |
| | | // 修改工作档 |
| | | wrkMast.setIoPri(13D); |
| | | wrkMast.setModiTime(new Date()); |
| | |
| | | } |
| | | // 没有小车 |
| | | } else { |
| | | if (wrkMast.getWrkSts() == 2L && wrkMast.getSteNo() == null) { |
| | | if (wrkMast.getWrkSts() == 2L && (wrkMast.getSteNo() == null || wrkMast.getSteNo() == 0)) { |
| | | // 寻找当前堆垛机对应的小车 |
| | | SteThread steThread = queryIdleCar(wrkMast); |
| | | if (steThread != null) { |
| | |
| | | WrkMast one = wrkMastMapper.selectLocMoveData(slave.getId()); |
| | | if(!Cools.isEmpty(one)){ |
| | | //存在移库任务,且在移出中,且移库源库位与待出库库位不在同一库位组,时跳出,确保移库/出库全套任务完成后,再执行下一笔 |
| | | if(one.getWrkSts() > 10 && (Utils.getGroupRow(wrkMast.getSourceLocNo()) != Utils.getGroupRow(one.getSourceLocNo()) |
| | | if(wrkMast.getWrkNo() == 11 && one.getWrkSts() > 10 && (Utils.getGroupRow(wrkMast.getSourceLocNo()) != Utils.getGroupRow(one.getSourceLocNo()) |
| | | || Utils.getBay(wrkMast.getSourceLocNo()) != Utils.getBay(one.getSourceLocNo()) |
| | | || Utils.getLev(wrkMast.getSourceLocNo()) != Utils.getLev(one.getSourceLocNo()))){ |
| | | continue; |
| | | } |
| | | //存在移库任务,且在移回中,且移库目标库位与待出库库位不在同一库位组,时跳出,确保移库/出库全套任务完成后,再执行下一笔 |
| | | if(one.getWrkSts() < 11 && (Utils.getGroupRow(wrkMast.getSourceLocNo()) != Utils.getGroupRow(one.getLocNo()) |
| | | if(wrkMast.getWrkNo() == 11 && one.getWrkSts() < 11 && (Utils.getGroupRow(wrkMast.getSourceLocNo()) != Utils.getGroupRow(one.getLocNo()) |
| | | || Utils.getBay(wrkMast.getSourceLocNo()) != Utils.getBay(one.getLocNo()) |
| | | || Utils.getLev(wrkMast.getSourceLocNo()) != Utils.getLev(one.getLocNo()))){ |
| | | continue; |
| | |
| | | boolean flag = false; |
| | | if(!locMastService.isOutMost(wrkMast.getSourceLocNo())){ |
| | | WrkMast wrkMastMove = wrkMastMapper.selectLocMoveWorking(slave.getId()); |
| | | if(wrkMastMove != null){ |
| | | if(wrkMastMove != null && wrkMast.getWrkNo() == 11){ |
| | | continue; |
| | | } |
| | | |
| | |
| | | } |
| | | } |
| | | LocMast sourceLoc = locMastService.selectById(wrkMast.getSourceLocNo()); |
| | | if(sourceLoc.getLocSts().equals("F")){ |
| | | if(sourceLoc.getLocSts().equals("F") || sourceLoc.getLocSts().equals("D")){ |
| | | sourceLoc.setLocSts("R"); // R.出库预约 |
| | | sourceLoc.setModiTime(new Date()); |
| | | if (!locMastService.updateById(sourceLoc)) { |
| | |
| | | SteThread steThread = (SteThread) SlaveConnection.get(SlaveType.Ste, steNo); |
| | | SteProtocol steProtocol = steThread.getSteProtocol(); |
| | | if (steProtocol == null) { return; } |
| | | if (steProtocol.isIdle()) { |
| | | if (steProtocol.isIdle() && steProtocol.getLoad() == 0) { |
| | | // 堆垛机空闲 |
| | | if (crnProtocol.getStatusType().equals(CrnStatusType.IDLE) || crnProtocol.getTaskNo() == 0) { |
| | | LocMast locMast; |
| | |
| | | SteProtocol steProtocol = steThread.getSteProtocol(); |
| | | if (steProtocol == null) { return; } |
| | | // 穿梭车空闲 |
| | | if (steProtocol.isIdle()) { |
| | | if (steProtocol.isIdle() && steProtocol.getLoad() == 0) { |
| | | // 堆垛机空闲 |
| | | if (crnProtocol.getStatusType().equals(CrnStatusType.IDLE) || crnProtocol.getTaskNo() == 0) { |
| | | |
| | |
| | | log.error("库位移转 ===>> 转移库存明细数据失败;[源库位={}],[目标库位={}]", wrkMast.getSourceLocNo(), wrkMast.getLocNo()); |
| | | continue; |
| | | } |
| | | } else { |
| | | locSts = "D"; |
| | | } |
| | | if(Cools.isEmpty(locSts)){ |
| | | log.error("库位移转 ===>> 库存状态为空;[源库位={}],[目标库位={}]", wrkMast.getSourceLocNo(), wrkMast.getLocNo()); |