| | |
| | | @Transactional |
| | | public StartupDto getLocNo(Integer whsType, Integer staDescId, Integer sourceStaNo, String matnr, String batch, String grade, LocTypeDto locTypeDto) { |
| | | whsType = Utils.GetWhsType(sourceStaNo); |
| | | return getLocNo(whsType, staDescId, sourceStaNo, matnr, batch, grade, 0, locTypeDto, 0); |
| | | return getLocNoToOne(whsType, staDescId, sourceStaNo, matnr, batch, grade, 0, locTypeDto, 0); |
| | | } |
| | | |
| | | /** |
| | |
| | | |
| | | StartupDto startupDto = new StartupDto(); |
| | | RowLastno rowLastno = rowLastnoService.selectById(whsType); |
| | | int sRow = rowLastno.getsRow(); |
| | | int eRow = rowLastno.geteRow(); |
| | | int crnNumber = rowLastno.getCrnQty(); |
| | | int sRow = rowLastno.getsRow(); //起始排号 |
| | | int eRow = rowLastno.geteRow(); //终止排号 |
| | | int crnNumber = rowLastno.getCrnQty(); //堆垛机数量 |
| | | |
| | | if (Cools.isEmpty(rowLastno)) { |
| | | throw new CoolException("数据异常,请联系管理员"); |
| | | } |
| | | // ===============>>>> 开始执行 |
| | | curRow = rowLastno.getCurrentRow(); |
| | | curRow = rowLastno.getCurrentRow(); //当前排号 |
| | | |
| | | if (!Cools.isEmpty(moveCrnNo) && moveCrnNo != 0) { |
| | | crnNumber = moveCrnNo; |
| | |
| | | } |
| | | |
| | | if (signRule1) { |
| | | List<LocMast> locMasts = locMastService.selectList(new EntityWrapper<LocMast>().eq("row1", nearRow).eq("loc_sts", "O")); |
| | | List<LocMast> locMasts = locMastService.selectList(new EntityWrapper<LocMast>().eq("row1", nearRow).eq("loc_sts", "O").eq("loc_type2",locTypeDto.getLocType2())); |
| | | for (LocMast locMast1 : locMasts) { |
| | | if (VersionUtils.locMoveCheckLocTypeComplete(locMast1, locTypeDto)) { |
| | | continue; |
| | |
| | | |
| | | // 靠近摆放规则 --- 空托 //互通版 |
| | | if (staDescId == 10) { |
| | | List<LocMast> locMasts = locMastService.selectList(new EntityWrapper<LocMast>().eq("loc_sts", "D").ge("row1", sRow).le("row1", eRow)); |
| | | List<LocMast> locMasts = locMastService.selectList(new EntityWrapper<LocMast>().eq("loc_sts", "D").ge("row1", sRow).le("row1", eRow).eq("loc_type2",locTypeDto.getLocType2())); |
| | | if (locMasts.size() > 0) { |
| | | for (LocMast loc : locMasts) { |
| | | if (Utils.isShallowLoc(slaveProperties, loc.getLocNo())) { |
| | |
| | | if (Cools.isEmpty(locMast) && crnNo != 0) { |
| | | List<LocMast> locMasts = locMastService.selectList(new EntityWrapper<LocMast>().eq("row1", nearRow).eq("loc_sts", "O").eq("loc_type2",locTypeDto.getLocType2())); |
| | | List<LocMast> locMastList = new ArrayList<>(); |
| | | 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; |
| | | } |
| | | }); |
| | | // 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 (!VersionUtils.locMoveCheckLocTypeComplete(locMast1, locTypeDto)) { |
| | | continue; |
| | | } |
| | | String shallowLoc = Utils.getDeepLoc(slaveProperties, locMast1.getLocNo()); |
| | | LocMast locMast2 = locMastService.selectOne(new EntityWrapper<LocMast>().eq("loc_no", shallowLoc).eq("loc_sts", "O")); |
| | | if (!Cools.isEmpty(locMast2)) { |
| | | locMast = locMast2; |
| | | LocMast locMast2 = locMastService.selectOne(new EntityWrapper<LocMast>().eq("loc_no", shallowLoc).eq("loc_sts", "O").eq("loc_type2",locTypeDto.getLocType2())); |
| | | if (Cools.isEmpty(locMast2)) { |
| | | locMast = locMast1; |
| | | break; |
| | | } |
| | | } |
| | |
| | | startupDto.setLocNo(locNo); |
| | | return startupDto; |
| | | } |
| | | |
| | | /*镇江恒立单伸立库逻辑*/ |
| | | @Transactional |
| | | public StartupDto getLocNoToOne(Integer whsType, Integer staDescId, Integer sourceStaNo, String matnr, String batch, String grade, Integer moveCrnNo, LocTypeDto locTypeDto, int times) { |
| | | //目标库位 |
| | | LocMast locMast = null; |
| | | //1号巷道 3种托盘类型 |
| | | if (locTypeDto.getLocType2()==4||locTypeDto.getLocType2()==5||locTypeDto.getLocType2()==6){ |
| | | locMast=locMastService.queryLocToOne(locTypeDto.getLocType2()); |
| | | }else if (locTypeDto.getLocType2()==7||locTypeDto.getLocType2()==8){ |
| | | //2号巷道 2种类型托盘 |
| | | locMast=locMastService.queryLocToTwo(locTypeDto.getLocType2()); |
| | | }else { |
| | | throw new CoolException("不存在该库位类型:"+locTypeDto.getLocType2()); |
| | | } |
| | | if (locMast == null){ |
| | | throw new CoolException("入库没有空库位"); |
| | | } |
| | | |
| | | //堆垛机号 |
| | | Integer crnNo = locMast.getCrnNo(); |
| | | |
| | | //获取目标站 |
| | | Wrapper<StaDesc> wrapper = new EntityWrapper<StaDesc>() |
| | | .eq("type_no", staDescId) |
| | | .eq("stn_no", sourceStaNo) |
| | | .eq("crn_no", crnNo); |
| | | StaDesc staDesc = staDescService.selectOne(wrapper); |
| | | if (Cools.isEmpty(staDesc)){ |
| | | log.error("入库路径不存在,staDesc={},sourceStaNo={},crnNo={}",1,staDescId,crnNo); |
| | | throw new CoolException("入库路径不存在"); |
| | | } |
| | | |
| | | //检测目标站 |
| | | BasDevp staNo = basDevpService.selectById(staDesc.getCrnStn()); |
| | | if (!staNo.getAutoing().equals("Y")){ |
| | | throw new CoolException("目标站"+staDesc.getCrnStn()+"不可用"); |
| | | } |
| | | |
| | | //生成工作号 |
| | | int workNo = getWorkNo(0); |
| | | |
| | | //返回dto |
| | | StartupDto startupDto =new StartupDto(); |
| | | startupDto.setWorkNo(workNo); |
| | | startupDto.setLocNo(locMast.getLocNo()); |
| | | startupDto.setStaNo(staNo.getDevNo()); |
| | | startupDto.setCrnNo(crnNo); |
| | | startupDto.setSourceStaNo(sourceStaNo); |
| | | return startupDto; |
| | | } |
| | | |
| | | } |