| | |
| | | import com.core.exception.CoolException; |
| | | import com.zy.asrs.entity.*; |
| | | import com.zy.asrs.service.*; |
| | | import com.zy.asrs.utils.LocUtils; |
| | | import com.zy.system.entity.Config; |
| | | import com.zy.system.service.ConfigService; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | /** |
| | |
| | | private AgvLocMastService agvLocMastService; |
| | | @Autowired |
| | | private MatService matService; |
| | | @Autowired |
| | | private LocRuleService locRuleService; |
| | | @Autowired |
| | | AgvBasDevpService agvBasDevpService; |
| | | |
| | | @Autowired |
| | | private ConfigService configService; |
| | | |
| | | @Autowired |
| | | private LocUtils locUtils; |
| | | |
| | | public int getWorkNo(Integer wrkMk) { |
| | | AgvWrkLastno wrkLastno = agvWrkLastnoService.selectById(wrkMk); |
| | |
| | | int sNo = wrkLastno.getSNo(); |
| | | int eNo = wrkLastno.getENo(); |
| | | |
| | | workNo = workNo>=eNo ? sNo : workNo+1; |
| | | workNo = workNo >= eNo ? sNo : workNo + 1; |
| | | |
| | | while (true) { |
| | | AgvWrkMast wrkMast = agvWrkMastService.selectById(workNo); |
| | | if (null != wrkMast) { |
| | | workNo = workNo>=eNo ? sNo : workNo+1; |
| | | workNo = workNo >= eNo ? sNo : workNo + 1; |
| | | } else { |
| | | break; |
| | | } |
| | | } |
| | | if (workNo > 0){ |
| | | if (workNo > 0) { |
| | | wrkLastno.setWrkNo(workNo); |
| | | agvWrkLastnoService.updateById(wrkLastno); |
| | | } |
| | | if (workNo == 0) { |
| | | throw new CoolException("生成工作号失败,请联系管理员"); |
| | | } else { |
| | | if (agvWrkMastService.selectById(workNo)!=null) { |
| | | if (agvWrkMastService.selectById(workNo) != null) { |
| | | throw new CoolException("生成工作号" + workNo + "在工作档中已存在"); |
| | | } |
| | | } |
| | |
| | | |
| | | /** |
| | | * 检索库位号 |
| | | * |
| | | * @return locNo 检索到的库位号 |
| | | */ |
| | | public AgvLocMast getLocNo(List<AgvWaitPakin> agvWaitPakinList, int floor) { |
| | | public AgvLocMast getLocNo(int type, int floor, boolean isEmpty, boolean isCurrLev) { |
| | | // 目标库位 |
| | | AgvLocMast locMast = null; |
| | | // if(Cools.isEmpty(agvWaitPakinList)){ |
| | | // return getLocNoRule(type); // 1. 随机库位 |
| | | // } |
| | | |
| | | //库位规则 |
| | | if(!Cools.isEmpty(agvWaitPakinList)){ |
| | | locMast = getLocByLocRule(agvWaitPakinList.get(0),floor); |
| | | if(!Cools.isEmpty(locMast)){ |
| | | return locMast; |
| | | } |
| | | } |
| | | |
| | | // 靠近摆放规则 --- 相同订单号, 同天同规格物料 |
| | | locMast = getLocByProximityRule(); |
| | | if (locMast != null) { |
| | | //找到库位,返回dto |
| | | //return getLocNoStep6(staDescId, sourceStaNo, locMast);//返回dto |
| | | } |
| | | |
| | | //根据物料频率搜索库位,频率高则搜索离缓存货架最近库位,频率低则搜索最远库位 |
| | | Mat mat = matService.selectByMatnr(agvWaitPakinList.get(0).getMatnr()); |
| | | if(true){ |
| | | |
| | | }else { |
| | | |
| | | } |
| | | |
| | | // |
| | | // // 靠近摆放规则 --- 空托 |
| | | // locMast = getLocNoStep4(staDescId, locTypeDto); |
| | | // if (locMast != null) { |
| | | // //找到库位,返回dto |
| | | // return getLocNoStep6(staDescId, sourceStaNo, locMast);//返回dto |
| | | // //库位规则 |
| | | // locMast = getLocByLocRule(agvWaitPakinList.get(0),floor); // 2. 按库位规则搜索 |
| | | // if(!Cools.isEmpty(locMast)){ |
| | | // return locMast; |
| | | // } |
| | | // |
| | | // // 如果没有相近物料,则按规则轮询货架 |
| | | // 开始查找库位 ==============================>> |
| | | locMast = getLocNoRule(floor); |
| | | if (locMast != null) { |
| | | return locMast; |
| | | // |
| | | // //库位编码规则 |
| | | // locMast = getLocByLocCodeRule(agvWaitPakinList.get(0),floor); |
| | | // if(!Cools.isEmpty(locMast)){ |
| | | // return locMast; |
| | | // } |
| | | // |
| | | // // 靠近摆放规则 --- 相同订单号, 同天同规格物料 |
| | | // locMast = getLocByProximityRule(); |
| | | // if (locMast != null) { |
| | | // //找到库位,返回dto |
| | | // //return getLocNoStep6(staDescId, sourceStaNo, locMast);//返回dto |
| | | // } |
| | | // |
| | | // //根据物料频率搜索库位,频率高则搜索离缓存货架最近库位,频率低则搜索最远库位 |
| | | // Mat mat = matService.selectByMatnr(agvWaitPakinList.get(0).getMatnr()); |
| | | // if(Cools.isEmpty(mat.getBeBatch())){ |
| | | // mat.setBeBatch(0); |
| | | // } |
| | | // locMast = getLocByFre(mat.getBeBatch(), floor); |
| | | // if (locMast != null) { |
| | | // return locMast; |
| | | // } |
| | | |
| | | |
| | | try { |
| | | // 开始查找库位 ==============================>> |
| | | // 箱壳入库 |
| | | // if (type == 3 && factory != null) { |
| | | // //优先入库吸塑1楼,在2楼 |
| | | // locMast = locUtils.getLocNoRuleByFactory(type, isEmpty, factory); |
| | | // } else if (type == 6) { |
| | | // //半成品箱壳入库,入到吸塑2楼的370个库位里 |
| | | // locMast = locUtils.getLocNoRuleByFloor(type, floor, isEmpty, 2); |
| | | // } else { |
| | | // //不动这个逻辑 |
| | | if (type == 6) { |
| | | locMast = locUtils.getLocNoRuleByFloor(type, floor); |
| | | } else { |
| | | locMast = getLocNoRule(type, floor, isEmpty, isCurrLev); |
| | | } |
| | | // } |
| | | if (locMast != null) { |
| | | return locMast; |
| | | } |
| | | } catch (Exception e) { |
| | | throw new CoolException(floor + "楼;该楼层没有空库位===>" + e.getMessage()); |
| | | } |
| | | |
| | | //找不到库位,抛出异常 |
| | | throw new CoolException("该楼层没有空库位"); |
| | | throw new CoolException(floor + "楼;该楼层没有空库位"); |
| | | } |
| | | |
| | | /** |
| | | * 库位规则查找,会预留20个库位 |
| | | */ |
| | | public synchronized AgvLocMast getLocByLocRule20(int type, int floor, String factory, boolean flag) { |
| | | |
| | | try { |
| | | EntityWrapper<AgvLocMast> wrapper = new EntityWrapper<>(); |
| | | wrapper.eq("loc_sts", "O").eq("loc_type1", type); |
| | | List<AgvLocMast> agvLocMasts = new ArrayList<>(); |
| | | //不是空板优先找2层 |
| | | if (Cools.isEmpty(factory)) { |
| | | wrapper.eq("floor", floor).orderBy("lev1", true); |
| | | } else { |
| | | //B是二厂,G是三厂 |
| | | if (factory.equals("B")) { |
| | | wrapper.eq("floor", floor).orderBy("lev1", false).orderBy("row1", flag); |
| | | |
| | | } else { |
| | | wrapper.eq("floor", floor).orderBy("lev1", true); |
| | | |
| | | } |
| | | } |
| | | int num = 20; |
| | | Config config = configService.selectOne(new EntityWrapper<Config>().eq("code", "LOC_3_NUM")); |
| | | if (config != null && !Cools.isEmpty(config.getValue())) { |
| | | num = Integer.parseInt(config.getValue()); |
| | | } |
| | | agvLocMasts = agvLocMastService.selectList(wrapper); |
| | | int er = 0; |
| | | for (AgvLocMast agvLocMast : agvLocMasts) { |
| | | if (agvLocMast.getLev1() == 2) { |
| | | er++; |
| | | } |
| | | } |
| | | for (AgvLocMast agvLocMast : agvLocMasts) { |
| | | AgvLocMast agvLocMast1 = agvLocMastService.selectOne(new EntityWrapper<AgvLocMast>().eq("loc_no", agvLocMast.getLocNo())); |
| | | if (agvLocMast1.getLocSts().equals("O")) { |
| | | if (agvLocMast1.getLev1() == 2) { |
| | | if (er > num) { |
| | | return agvLocMast1; |
| | | } |
| | | } else { |
| | | return agvLocMast1; |
| | | } |
| | | |
| | | } |
| | | } |
| | | throw new CoolException("搜索库位时,未找到可入库库位。"); |
| | | } catch (Exception e) { |
| | | throw new CoolException("搜索库位时,未找到可入库库位。"); |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | | /** |
| | | * 库位规则查找 |
| | | */ |
| | | public synchronized AgvLocMast getLocByLocRule(int type, int floor, String factory, boolean flag) { |
| | | |
| | | try { |
| | | EntityWrapper<AgvLocMast> wrapper = new EntityWrapper<>(); |
| | | wrapper.eq("loc_sts", "O").eq("loc_type1", type); |
| | | List<AgvLocMast> agvLocMasts = new ArrayList<>(); |
| | | //不是空板优先找2层 |
| | | if (Cools.isEmpty(factory)) { |
| | | wrapper.eq("floor", floor).orderBy("lev1", true); |
| | | } else { |
| | | //B是二厂,G是三厂 |
| | | switch (factory) { |
| | | case "B": |
| | | wrapper.eq("floor", floor).orderBy("lev1", false).orderBy("row1", flag); |
| | | break; |
| | | case "G": |
| | | wrapper.eq("floor", floor).orderBy("lev1", true); |
| | | break; |
| | | default: |
| | | wrapper.eq("floor", floor).orderBy("lev1", true); |
| | | break; |
| | | } |
| | | } |
| | | |
| | | agvLocMasts = agvLocMastService.selectList(wrapper); |
| | | for (AgvLocMast agvLocMast : agvLocMasts) { |
| | | AgvLocMast agvLocMast1 = agvLocMastService.selectOne(new EntityWrapper<AgvLocMast>().eq("loc_no", agvLocMast.getLocNo())); |
| | | if (agvLocMast1.getLocSts().equals("O")) { |
| | | return agvLocMast1; |
| | | } |
| | | } |
| | | throw new CoolException("搜索库位时,未找到可入库库位。"); |
| | | } catch (Exception e) { |
| | | throw new CoolException("搜索库位时,未找到可入库库位。"); |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | | /** |
| | | * 库位规则查找 |
| | | */ |
| | | public AgvLocMast getLocByLocRule(int type, int floor, int lev1) { |
| | | |
| | | try { |
| | | EntityWrapper<AgvLocMast> wrapper = new EntityWrapper<>(); |
| | | wrapper.eq("loc_sts", "O").eq("loc_type1", type); |
| | | wrapper.eq("floor", floor).eq("lev1", lev1).orderBy("bay1", false); |
| | | List<AgvLocMast> agvLocMasts = agvLocMastService.selectList(wrapper); |
| | | for (AgvLocMast agvLocMast : agvLocMasts) { |
| | | AgvLocMast agvLocMast1 = agvLocMastService.selectOne(new EntityWrapper<AgvLocMast>().eq("loc_no", agvLocMast.getLocNo())); |
| | | if (agvLocMast1.getLocSts().equals("O")) { |
| | | return agvLocMast1; |
| | | } |
| | | } |
| | | throw new CoolException("搜索库位时,未找到可入库库位。"); |
| | | } catch (Exception e) { |
| | | throw new CoolException("搜索库位时,未找到可入库库位。"); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 库位规则查找 |
| | | */ |
| | | public AgvLocMast getLocByLocRule2(int type, int floor, int lev1) { |
| | | |
| | | try { |
| | | EntityWrapper<AgvLocMast> wrapper = new EntityWrapper<>(); |
| | | wrapper.eq("loc_sts", "O").eq("loc_type1", type); |
| | | wrapper.eq("floor", floor).eq("lev1", lev1); |
| | | List<AgvLocMast> agvLocMasts = agvLocMastService.selectList(wrapper); |
| | | if (lev1 == 2) { |
| | | int num = 20; |
| | | Config config = configService.selectOne(new EntityWrapper<Config>().eq("code", "LOC_3_NUM")); |
| | | if (config != null && !Cools.isEmpty(config.getValue())) { |
| | | num = Integer.parseInt(config.getValue()); |
| | | } |
| | | int er = agvLocMasts.size(); |
| | | if (er < num) { |
| | | throw new CoolException("搜索库位时,未找到可入库库位。20"); |
| | | } |
| | | } |
| | | for (AgvLocMast agvLocMast : agvLocMasts) { |
| | | AgvLocMast agvLocMast1 = agvLocMastService.selectOne(new EntityWrapper<AgvLocMast>().eq("loc_no", agvLocMast.getLocNo())); |
| | | if (agvLocMast1.getLocSts().equals("O")) { |
| | | return agvLocMast1; |
| | | } |
| | | } |
| | | throw new CoolException("搜索库位时,未找到可入库库位。"); |
| | | } catch (Exception e) { |
| | | throw new CoolException("搜索库位时,未找到可入库库位。"); |
| | | } |
| | | } |
| | | |
| | | /* |
| | | 库位规则查找 |
| | | */ |
| | | public AgvLocMast getLocByFloorAndLev1(int type, int floor, int lev1) { |
| | | |
| | | try { |
| | | EntityWrapper<AgvLocMast> wrapper = new EntityWrapper<>(); |
| | | wrapper.eq("loc_sts", "O").eq("loc_type1", type); |
| | | wrapper.eq("floor", floor).eq("lev1", lev1); |
| | | |
| | | List<AgvLocMast> agvLocMasts = agvLocMastService.selectList(wrapper); |
| | | for (AgvLocMast agvLocMast : agvLocMasts) { |
| | | AgvLocMast agvLocMast1 = agvLocMastService.selectOne(new EntityWrapper<AgvLocMast>().eq("loc_no", agvLocMast.getLocNo())); |
| | | if (agvLocMast1.getLocSts().equals("O")) { |
| | | return agvLocMast1; |
| | | } |
| | | } |
| | | return null; |
| | | } catch (Exception e) { |
| | | throw new CoolException("搜索库位时,未找到可入库库位。"); |
| | | } |
| | | } |
| | | |
| | | /* |
| | | 库位规则查找 |
| | | */ |
| | | public AgvLocMast getLocByFloor(int type, int floor) { |
| | | try { |
| | | EntityWrapper<AgvLocMast> wrapper = new EntityWrapper<>(); |
| | | wrapper.eq("loc_sts", "O").eq("loc_type1", type); |
| | | wrapper.eq("floor", floor).orderBy("lev1", false); |
| | | |
| | | List<AgvLocMast> agvLocMasts = agvLocMastService.selectList(wrapper); |
| | | for (AgvLocMast agvLocMast : agvLocMasts) { |
| | | AgvLocMast agvLocMast1 = agvLocMastService.selectOne(new EntityWrapper<AgvLocMast>().eq("loc_no", agvLocMast.getLocNo())); |
| | | if (agvLocMast1.getLocSts().equals("O")) { |
| | | return agvLocMast1; |
| | | } |
| | | } |
| | | return null; |
| | | } catch (Exception e) { |
| | | return null; |
| | | } |
| | | } |
| | | |
| | | /* |
| | | 库位规则查找 |
| | | */ |
| | | private AgvLocMast getLocByLocRule(AgvWaitPakin agvWaitPakin, int floor) { |
| | | List<AgvLocRule> agvLocRules = null; |
| | | agvLocRules = agvLocRuleService.selectList(new EntityWrapper<AgvLocRule>() |
| | | .eq("matnr", agvWaitPakin.getMatnr()) |
| | | .eq("batch", agvWaitPakin.getModel()) |
| | | .eq("floor", floor)); |
| | | if(Cools.isEmpty(agvLocRules)){ |
| | | agvLocRules = agvLocRuleService.selectList(new EntityWrapper<AgvLocRule>() |
| | | .eq("matnr", agvWaitPakin.getMatnr()) |
| | | .eq("floor", floor)); |
| | | } |
| | | if(Cools.isEmpty(agvLocRules)){ |
| | | private AgvLocMast getLocByLocCodeRule(AgvWaitPakin agvWaitPakin, int floor) { |
| | | /*if(Cools.isEmpty(agvWaitPakin.getBrand())){ |
| | | return null; |
| | | } |
| | | |
| | | for (AgvLocRule agvLocRule : agvLocRules) { |
| | | //库区 |
| | | String other = "agv-" + floor; |
| | | List<LocRule> locRules = locRuleService.findCode(agvWaitPakin.getMatnr(), other); |
| | | if(Cools.isEmpty(locRules)){ |
| | | return null; |
| | | } |
| | | |
| | | for (LocRule agvLocRule : locRules) { |
| | | EntityWrapper<AgvLocMast> wrapper = new EntityWrapper<>(); |
| | | wrapper.between("row1",agvLocRule.getRowBeg(),agvLocRule.getRowEnd()) |
| | | .between("bay1",agvLocRule.getBayBeg(),agvLocRule.getBayEnd()) |
| | |
| | | if(!Cools.isEmpty(agvLocMast)){ |
| | | return agvLocMast; |
| | | } |
| | | } |
| | | }*/ |
| | | |
| | | return null; |
| | | } |
| | |
| | | /* |
| | | 靠近摆放规则 |
| | | */ |
| | | private AgvLocMast getLocByProximityRule(){ |
| | | private AgvLocMast getLocByProximityRule() { |
| | | //to do |
| | | return null; |
| | | } |
| | |
| | | /* |
| | | 根据物料频率查找 |
| | | */ |
| | | private AgvLocMast getLocByFre(int fre, int floor){ |
| | | if(floor == 1){ |
| | | if(fre == 1){ |
| | | private AgvLocMast getLocByFre(int fre, int floor) { |
| | | if (floor == 1) { |
| | | if (fre == 1) { |
| | | return agvLocMastService.selectOne(new EntityWrapper<AgvLocMast>() |
| | | .eq("floor",floor) |
| | | .eq("loc_sts","O") |
| | | .orderBy("bay1",false)); |
| | | }else{ |
| | | .eq("floor", floor) |
| | | .eq("loc_sts", "O") |
| | | .orderBy("bay1", false)); |
| | | } else { |
| | | return agvLocMastService.selectOne(new EntityWrapper<AgvLocMast>() |
| | | .eq("floor",floor) |
| | | .eq("loc_sts","O") |
| | | .eq("floor", floor) |
| | | .eq("loc_sts", "O") |
| | | .orderBy("bay1")); |
| | | } |
| | | } |
| | | if(floor == 3){ |
| | | if(fre == 1){ |
| | | if (floor == 3) { |
| | | if (fre == 1) { |
| | | return agvLocMastService.selectOne(new EntityWrapper<AgvLocMast>() |
| | | .eq("floor",floor) |
| | | .eq("loc_sts","O") |
| | | .orderBy("row1",false)); |
| | | }else{ |
| | | .eq("floor", floor) |
| | | .eq("loc_sts", "O") |
| | | .orderBy("row1", false)); |
| | | } else { |
| | | return agvLocMastService.selectOne(new EntityWrapper<AgvLocMast>() |
| | | .eq("floor",floor) |
| | | .eq("loc_sts","O") |
| | | .eq("floor", floor) |
| | | .eq("loc_sts", "O") |
| | | .orderBy("row1")); |
| | | } |
| | | } |
| | |
| | | throw new CoolException("搜索库位时,楼层出错。"); |
| | | } |
| | | |
| | | //随机取一个货位 |
| | | private AgvLocMast getLocNoRule(int floor){ |
| | | return agvLocMastService.selectOne(new EntityWrapper<AgvLocMast>() |
| | | .eq("floor",floor) |
| | | .eq("loc_sts","O") |
| | | .eq(false,"loc_type2",1)); |
| | | public AgvLocMast getLocNoOnXiSuer(int type, int floor) { |
| | | EntityWrapper<AgvLocMast> wrapper = new EntityWrapper<>(); |
| | | wrapper.eq("loc_sts", "O").eq("loc_type1", type); |
| | | wrapper.eq("floor", floor).orderBy("lev1", false); |
| | | List<AgvLocMast> agvLocMasts = agvLocMastService.selectList(wrapper); |
| | | if (Cools.isEmpty(agvLocMasts)) { |
| | | return null; |
| | | } else { |
| | | for (AgvLocMast agvLocMast : agvLocMasts) { |
| | | AgvLocMast agvLocMast1 = agvLocMastService.selectOne(new EntityWrapper<AgvLocMast>().eq("loc_no", agvLocMast.getLocNo())); |
| | | if (agvLocMast1.getLocSts().equals("O")) { |
| | | return agvLocMast1; |
| | | } |
| | | } |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | public AgvLocMast getLocNoOnXiSuer20(int type, int floor) { |
| | | EntityWrapper<AgvLocMast> wrapper = new EntityWrapper<>(); |
| | | wrapper.eq("loc_sts", "O").eq("loc_type1", type); |
| | | wrapper.eq("floor", floor).eq("lev1", 2); |
| | | List<AgvLocMast> agvLocMasts = agvLocMastService.selectList(wrapper); |
| | | if (Cools.isEmpty(agvLocMasts)) { |
| | | return null; |
| | | } else { |
| | | int num = 15; |
| | | Config config = configService.selectOne(new EntityWrapper<Config>().eq("code", "LOC_6_NUM")); |
| | | if (config != null && !Cools.isEmpty(config.getValue())) { |
| | | num = Integer.parseInt(config.getValue()); |
| | | } |
| | | if (agvLocMasts.size() > num) { |
| | | for (AgvLocMast agvLocMast : agvLocMasts) { |
| | | AgvLocMast agvLocMast1 = agvLocMastService.selectOne(new EntityWrapper<AgvLocMast>().eq("loc_no", agvLocMast.getLocNo())); |
| | | if (agvLocMast1.getLocSts().equals("O")) { |
| | | return agvLocMast1; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | |
| | | //随机取一个货位 |
| | | private AgvLocMast getLocNoRule(int type, int floor, boolean isEmpty, boolean isCurrLev) { |
| | | Boolean orderBy = false; |
| | | int levCount = 0; |
| | | int times = 1; |
| | | if (floor == 1 || floor >= 4) { |
| | | if (floor >= 4) { |
| | | floor = 1; |
| | | } |
| | | orderBy = true; |
| | | levCount = 2; |
| | | } else { |
| | | orderBy = false; |
| | | levCount = 1; |
| | | } |
| | | try { |
| | | EntityWrapper<AgvLocMast> wrapper = new EntityWrapper<>(); |
| | | wrapper.eq("loc_sts", "O").eq("loc_type1", type); |
| | | List<AgvLocMast> agvLocMasts = new ArrayList<>(); |
| | | //不是空板优先找2层 |
| | | if (isEmpty) { |
| | | wrapper.eq("floor", floor).eq("lev1", 1); |
| | | } else { |
| | | if (isCurrLev) { |
| | | wrapper.eq("floor", floor).eq("lev1", 1); |
| | | } else { |
| | | wrapper.eq("floor", floor).orderBy("lev1", !orderBy); |
| | | } |
| | | } |
| | | |
| | | |
| | | //当目标库位是1楼 |
| | | if (floor == 1) { |
| | | wrapper.orderBy("loc_no", false); |
| | | } |
| | | agvLocMasts = agvLocMastService.selectList(wrapper); |
| | | //是否当前层 |
| | | if (Cools.isEmpty(agvLocMasts) && !isCurrLev) { |
| | | if (times < levCount) { |
| | | times++; |
| | | return getLocNoRule(type, floor, isEmpty, isCurrLev); |
| | | } |
| | | } |
| | | for (AgvLocMast agvLocMast : agvLocMasts) { |
| | | AgvLocMast agvLocMast1 = agvLocMastService.selectOne(new EntityWrapper<AgvLocMast>().eq("loc_no", agvLocMast.getLocNo())); |
| | | if (agvLocMast1.getLocSts().equals("O")) { |
| | | return agvLocMast1; |
| | | } |
| | | } |
| | | throw new CoolException("搜索库位时,未找到可入库库位。"); |
| | | } catch (Exception e) { |
| | | throw new CoolException("搜索库位时,未找到可入库库位。"); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 检索库位号 |
| | | * |
| | | * @return locNo 检索到的库位号 |
| | | */ |
| | | public AgvBasDevp getDevpNo(int type, int floor) { |
| | | // 目标库位 |
| | | AgvBasDevp basDevp = null; |
| | | |
| | | // 开始查找库位 ==============================>> |
| | | basDevp = getDevpNoRule(type, floor); |
| | | if (basDevp != null) { |
| | | return basDevp; |
| | | } |
| | | |
| | | //找不到库位,抛出异常 |
| | | throw new CoolException("楼层号:" + floor + ";该楼层没有空接驳位"); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 检索库位号 |
| | | * |
| | | * @return locNo 检索自动接驳位 |
| | | */ |
| | | public AgvBasDevp getDevpNo(int type, int floor, String auto) { |
| | | // 目标库位 |
| | | AgvBasDevp basDevp = null; |
| | | |
| | | // 开始查找库位 ==============================>> |
| | | basDevp = getDevpNoAuto(type, floor, auto); |
| | | if (basDevp != null) { |
| | | return basDevp; |
| | | } |
| | | |
| | | //找不到库位,抛出异常 |
| | | throw new CoolException("楼层号:" + floor + ";该楼层没有空接驳位"); |
| | | } |
| | | |
| | | /** |
| | | * 检索库位号 |
| | | * |
| | | * @return locNo 检索可入接驳位 |
| | | */ |
| | | public AgvBasDevp getDevpNo(int type, int floor, String auto, String inEable) { |
| | | // 目标库位 |
| | | AgvBasDevp basDevp = null; |
| | | |
| | | // 开始查找库位 ==============================>> |
| | | basDevp = getDevpNoInEable(type, floor, inEable); |
| | | if (basDevp != null) { |
| | | return basDevp; |
| | | } |
| | | |
| | | //找不到库位,抛出异常 |
| | | return basDevp; |
| | | } |
| | | |
| | | //随机取一个货位 |
| | | private AgvBasDevp getDevpNoRule(int type, int floor) { |
| | | return agvBasDevpService.selectOne(new EntityWrapper<AgvBasDevp>() |
| | | .eq("loc_sts", "O") |
| | | .eq("floor", floor) |
| | | .eq("loc_type1", type) |
| | | .like("dev_no", "DB")); |
| | | } |
| | | |
| | | //随机取一个货位 |
| | | private AgvBasDevp getDevpNoAuto(int type, int floor, String auto) { |
| | | return agvBasDevpService.selectOne(new EntityWrapper<AgvBasDevp>() |
| | | .eq("loc_sts", "O") |
| | | .eq("floor", floor) |
| | | .eq("loc_type1", type) |
| | | .eq("autoing", auto) |
| | | .like("dev_no", "DB")); |
| | | } |
| | | |
| | | //随机取一个货位 |
| | | private AgvBasDevp getDevpNoInEable(int type, int floor, String inEable) { |
| | | return agvBasDevpService.selectOne(new EntityWrapper<AgvBasDevp>() |
| | | .eq("loc_sts", "O") |
| | | .eq("floor", floor) |
| | | .eq("loc_type1", type) |
| | | .eq("in_enable", inEable) |
| | | .like("dev_no", "DB")); |
| | | } |
| | | |
| | | } |