| | |
| | | return getLocNoEmpty(whsType, staDescId, sourceStaNo, matnr, batch, grade, 0, locTypeDto, 0); |
| | | } |
| | | |
| | | // @Transactional |
| | | // public StartupDto getLocNoEmptyNew(Integer whsType, Integer staDescId, Integer sourceStaNo,LocTypeDto locTypeDto,String barcode) { |
| | | // whsType = Utils.GetWhsType(sourceStaNo); |
| | | // return getLocNoEmptyNew(whsType, staDescId, sourceStaNo,locTypeDto,barcode,0,0); |
| | | // } |
| | | |
| | | @Transactional |
| | | public StartupDto getLocNoEmpty(Integer whsType, Integer staDescId, Integer sourceStaNo, String matnr, String batch, String grade, Integer moveCrnNo, LocTypeDto locTypeDto, int times) { |
| | | if (Cools.isEmpty(matnr)) { //物料号 |
| | |
| | | startupDto.setLocNo(locNo); |
| | | return startupDto; |
| | | } |
| | | |
| | | // @Transactional |
| | | // public StartupDto getLocNoEmptyNew(Integer whsType, Integer staDescId, Integer sourceStaNo,LocTypeDto locTypeDto,String barcode,int times, Integer moveCrnNo) { |
| | | // // 初始化参数 |
| | | // int crnNo = 0; //堆垛机号 |
| | | // int nearRow = 0; //最浅库位排 |
| | | // int curRow = 0; //最深库位排 |
| | | // int rowCount = 0; //轮询轮次 |
| | | // LocMast locMast = null; // 目标库位 |
| | | // |
| | | // StartupDto startupDto = new StartupDto(); |
| | | // RowLastno rowLastno = rowLastnoService.selectById(whsType); |
| | | // int sRow = rowLastno.getsRow(); |
| | | // int eRow = rowLastno.geteRow(); |
| | | // int crnNumber = rowLastno.getCrnQty(); |
| | | // |
| | | // if (Cools.isEmpty(rowLastno)) { |
| | | // throw new CoolException("数据异常,请联系管理员"); |
| | | // } |
| | | // // ===============>>>> 开始执行 |
| | | // curRow = rowLastno.getCurrentRow(); |
| | | // |
| | | // if (!Cools.isEmpty(moveCrnNo) && moveCrnNo != 0) { |
| | | // crnNumber = moveCrnNo; |
| | | // if (times == 0) { |
| | | // curRow = moveCrnNo * 4 - 1; |
| | | // } else { |
| | | // curRow = moveCrnNo * 4 - 2; |
| | | // } |
| | | // } |
| | | // |
| | | // //此程序用于优化堆垛机异常时的运行时间 |
| | | // for (int i = times; i < crnNumber; i++) { |
| | | // int[] locNecessaryParameters = Utils.LocNecessaryParameters(whsType, curRow, crnNumber); |
| | | // curRow = locNecessaryParameters[1]; |
| | | // crnNo = locNecessaryParameters[2]; |
| | | // if (basCrnpService.checkSiteError(crnNo, true)) { |
| | | // rowCount = locNecessaryParameters[0]; |
| | | // nearRow = locNecessaryParameters[3]; |
| | | // break; |
| | | // } else { |
| | | // times++; |
| | | // } |
| | | // } |
| | | // if (nearRow == 0) { |
| | | // throw new CoolException("无可用堆垛机"); |
| | | // } |
| | | // |
| | | // Wrapper<StaDesc> wrapper = null; |
| | | // StaDesc staDesc = null; |
| | | // BasDevp staNo = null; |
| | | // |
| | | // if (Utils.BooleanWhsTypeSta(whsType, staDescId)) { |
| | | // // 获取目标站 |
| | | // wrapper = new EntityWrapper<StaDesc>() |
| | | // .eq("type_no", staDescId) |
| | | // .eq("stn_no", sourceStaNo) |
| | | // .eq("crn_no", crnNo); |
| | | // staDesc = staDescService.selectOne(wrapper); |
| | | // if (Cools.isEmpty(staDesc)) { |
| | | // log.error("type_no={},stn_no={},crn_no={}", staDescId, sourceStaNo, crnNo); |
| | | // crnNo = 0; |
| | | // } |
| | | // staNo = basDevpService.selectById(staDesc.getCrnStn()); |
| | | // if (!staNo.getAutoing().equals("Y")) { |
| | | // crnNo = 0; |
| | | // } |
| | | // startupDto.setStaNo(staNo.getDevNo()); |
| | | // } |
| | | // |
| | | // // 更新库位排号 |
| | | // if (Utils.BooleanWhsTypeSta(whsType, staDescId)) { |
| | | // rowLastno.setCurrentRow(curRow); |
| | | // rowLastnoService.updateById(rowLastno); |
| | | // } |
| | | // |
| | | // // 1.按规则查找库位 |
| | | // if (Cools.isEmpty(locMast) && crnNo != 0) { |
| | | // List<LocMast> locMasts = new ArrayList<>(); |
| | | // if (barcode.startsWith("6")){ |
| | | // locMasts = locMastService.selectList(new EntityWrapper<LocMast>() |
| | | // .eq("loc_sts","O") |
| | | // .in("row1",2,3) |
| | | // .in("lev1",1,2,3,4,5,6,7) |
| | | // .orderBy("row1",true) |
| | | // .orderBy("lev1",true) |
| | | // ); |
| | | // }else if (barcode.startsWith("7")){ |
| | | // locMasts = locMastService.selectList(new EntityWrapper<LocMast>() |
| | | // .eq("loc_sts","O") |
| | | // .in("row1",2,3) |
| | | // .in("lev1",8,9,10,11,12) |
| | | // .orderBy("row1",true) |
| | | // .orderBy("lev1",true) |
| | | // ); |
| | | // }else if (barcode.startsWith("8")){ |
| | | // locMasts = locMastService.selectList(new EntityWrapper<LocMast>() |
| | | // .eq("loc_sts","O") |
| | | // .eq("lev1",13) |
| | | // .in("row1",2,3) |
| | | // .orderBy("row1",true) |
| | | // .orderBy("lev1",true) |
| | | // ); |
| | | // } |
| | | // |
| | | // if (locMasts.size() <= 7){ |
| | | // throw new CoolException("无空库位可用"); |
| | | // } |
| | | // |
| | | // locMasts.sort(new Comparator<LocMast>() { |
| | | // @Override |
| | | // public int compare(LocMast o1, LocMast o2) { |
| | | // int b1 = o1.getBay1(); |
| | | // int b2 = o2.getBay1(); |
| | | // if (o1.getBay1() >= 15) { |
| | | // b1 = Math.abs(15 - o1.getBay1()); |
| | | // } |
| | | // if (o2.getBay1() >= 15) { |
| | | // b2 = Math.abs(15 - o2.getBay1()); |
| | | // } |
| | | // return b2 - b1; |
| | | // } |
| | | // }); |
| | | // |
| | | // for (LocMast locMast1 : locMasts) { |
| | | // if (Utils.isDeepLoc(slaveProperties,locMast1.getLocNo())){ |
| | | // continue; |
| | | // } |
| | | // String deepLoc = Utils.getDeepLoc(slaveProperties, locMast1.getLocNo()); |
| | | // LocMast locMast2 = locMastService.selectOne(new EntityWrapper<LocMast>().eq("loc_no", deepLoc)); |
| | | // if (Cools.isEmpty(locMast2)){ |
| | | // continue; |
| | | // } |
| | | // if (locMast2.getLocSts().equals("P")||locMast2.getLocSts().equals("Q")||locMast2.getLocSts().equals("R")||locMast2.getLocSts().equals("S")){ |
| | | // continue; |
| | | // } |
| | | // if (!Cools.isEmpty(locMast2)&&locMast2.getLocSts().equals("O")){ |
| | | // locMast = locMast2; |
| | | // break; |
| | | // } |
| | | // if (!Cools.isEmpty(locMast2)&&(locMast2.getLocSts().equals("F")||locMast2.getLocSts().equals("D"))){ |
| | | // locMast = locMast1; |
| | | // break; |
| | | // } |
| | | // } |
| | | // } |
| | | // |
| | | // if (!Cools.isEmpty(locMast) && !basCrnpService.checkSiteError(crnNo, true)) { |
| | | // locMast = null; |
| | | // } |
| | | // |
| | | // // 递归查询 |
| | | // if (Cools.isEmpty(locMast) || !locMast.getLocSts().equals("O")) { |
| | | // // 当前巷道无空库位时,递归调整至下一巷道,检索全部巷道无果后,跳出递归 |
| | | // if (times < rowCount) { |
| | | // times = times + 1; |
| | | // return getLocNoEmptyNew(1, staDescId, sourceStaNo,locTypeDto,barcode); |
| | | // } |
| | | // log.error("系统没有空库位!!! 尺寸规格: {}, 轮询次数:{}", JSON.toJSONString(locTypeDto), times); |
| | | // throw new CoolException("没有空库位"); |
| | | // } |
| | | // String locNo = locMast.getLocNo(); |
| | | // |
| | | // // 生成工作号 |
| | | // int workNo = getWorkNo(0); |
| | | // // 返回dto |
| | | // startupDto.setWorkNo(workNo); |
| | | // startupDto.setCrnNo(crnNo); |
| | | // startupDto.setSourceStaNo(sourceStaNo); |
| | | // startupDto.setLocNo(locNo); |
| | | // return startupDto; |
| | | // |
| | | // } |
| | | } |