From 6ce49b375bba4e1bbbe75c4dd891dc95cd9ff28f Mon Sep 17 00:00:00 2001 From: whycq <10027870+whycq@user.noreply.gitee.com> Date: 星期五, 31 五月 2024 15:44:09 +0800 Subject: [PATCH] # --- src/main/java/com/zy/common/service/AgvCommonService.java | 189 ++++++++++++++++++++++++++++++++++++----------- 1 files changed, 144 insertions(+), 45 deletions(-) diff --git a/src/main/java/com/zy/common/service/AgvCommonService.java b/src/main/java/com/zy/common/service/AgvCommonService.java index 8684a32..f756a9a 100644 --- a/src/main/java/com/zy/common/service/AgvCommonService.java +++ b/src/main/java/com/zy/common/service/AgvCommonService.java @@ -31,6 +31,8 @@ private MatService matService; @Autowired private LocRuleService locRuleService; + @Autowired + AgvBasDevpService agvBasDevpService; public int getWorkNo(Integer wrkMk) { AgvWrkLastno wrkLastno = agvWrkLastnoService.selectById(wrkMk); @@ -71,52 +73,56 @@ * 妫�绱㈠簱浣嶅彿 * @return locNo 妫�绱㈠埌鐨勫簱浣嶅彿 */ - public AgvLocMast getLocNo(List<AgvWaitPakin> agvWaitPakinList, int floor) { + public AgvLocMast getLocNo(int type, int floor) { // 鐩爣搴撲綅 AgvLocMast locMast = null; - if(Cools.isEmpty(agvWaitPakinList)){ - return getLocNoRule(floor); - } +// if(Cools.isEmpty(agvWaitPakinList)){ +// return getLocNoRule(type); // 1. 闅忔満搴撲綅 +// } - //搴撲綅瑙勫垯 - locMast = getLocByLocRule(agvWaitPakinList.get(0),floor); - if(!Cools.isEmpty(locMast)){ - return locMast; - } +// //搴撲綅瑙勫垯 +// locMast = getLocByLocRule(agvWaitPakinList.get(0),floor); // 2. 鎸夊簱浣嶈鍒欐悳绱� +// if(!Cools.isEmpty(locMast)){ +// return locMast; +// } +// +// +// //搴撲綅缂栫爜瑙勫垯 +// locMast = getLocByLocCodeRule(agvWaitPakinList.get(0),floor); +// if(!Cools.isEmpty(locMast)){ +// return locMast; +// } +// +// // 闈犺繎鎽嗘斁瑙勫垯 --- 鐩稿悓璁㈠崟鍙�, 鍚屽ぉ鍚岃鏍肩墿鏂� +// locMast = getLocByProximityRule(); +// if (locMast != null) { +// //鎵惧埌搴撲綅锛岃繑鍥瀌to +// //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; +// } - //搴撲綅缂栫爜瑙勫垯 - locMast = getLocByLocCodeRule(agvWaitPakinList.get(0),floor); - if(!Cools.isEmpty(locMast)){ - return locMast; - } - - // 闈犺繎鎽嗘斁瑙勫垯 --- 鐩稿悓璁㈠崟鍙�, 鍚屽ぉ鍚岃鏍肩墿鏂� - locMast = getLocByProximityRule(); - if (locMast != null) { - //鎵惧埌搴撲綅锛岃繑鍥瀌to - //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; - } - - - // 寮�濮嬫煡鎵惧簱浣� ==============================>> - locMast = getLocNoRule(floor); - if (locMast != null) { - return locMast; + try{ + // 寮�濮嬫煡鎵惧簱浣� ==============================>> + locMast = getLocNoRule(type,floor); + if (locMast != null) { + return locMast; + } + }catch (Exception e){ + throw new CoolException("妤煎眰鍙凤細"+floor+"锛涜妤煎眰娌℃湁绌哄簱浣�===>"+e.getMessage()); } //鎵句笉鍒板簱浣嶏紝鎶涘嚭寮傚父 - throw new CoolException("璇ユゼ灞傛病鏈夌┖搴撲綅"); + throw new CoolException("妤煎眰鍙凤細"+floor+"锛涜妤煎眰娌℃湁绌哄簱浣�"); } /* @@ -157,7 +163,7 @@ 搴撲綅瑙勫垯鏌ユ壘 */ private AgvLocMast getLocByLocCodeRule(AgvWaitPakin agvWaitPakin, int floor) { - if(Cools.isEmpty(agvWaitPakin.getBrand())){ + /*if(Cools.isEmpty(agvWaitPakin.getBrand())){ return null; } @@ -179,7 +185,7 @@ if(!Cools.isEmpty(agvLocMast)){ return agvLocMast; } - } + }*/ return null; } @@ -227,12 +233,105 @@ } //闅忔満鍙栦竴涓揣浣� - private AgvLocMast getLocNoRule(int floor){ - return agvLocMastService.selectOne(new EntityWrapper<AgvLocMast>() - .eq("floor",floor) - .eq("loc_sts","O") - .eq(false,"loc_type2",1)); + private AgvLocMast getLocNoRule(int type,int floor){ + try{ + List<AgvLocMast> agvLocMasts = agvLocMastService.selectList(new EntityWrapper<AgvLocMast>() + .eq("loc_sts", "O") + .eq("floor", floor) + .eq("loc_type1", type)); + 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")); + } + } -- Gitblit v1.9.1