From 0368c0b26c52b032e3ef86b3fda548d34fbfa4f7 Mon Sep 17 00:00:00 2001 From: ZY <zc857179121@qq.com> Date: 星期日, 27 四月 2025 14:28:21 +0800 Subject: [PATCH] 1 --- src/main/java/com/zy/asrs/service/impl/AgvLocMastServiceImpl.java | 169 ++++++++++++++++++++++++++++--------------------------- 1 files changed, 86 insertions(+), 83 deletions(-) diff --git a/src/main/java/com/zy/asrs/service/impl/AgvLocMastServiceImpl.java b/src/main/java/com/zy/asrs/service/impl/AgvLocMastServiceImpl.java index 060173b..b1d9bb2 100644 --- a/src/main/java/com/zy/asrs/service/impl/AgvLocMastServiceImpl.java +++ b/src/main/java/com/zy/asrs/service/impl/AgvLocMastServiceImpl.java @@ -1,8 +1,8 @@ package com.zy.asrs.service.impl; +import com.baomidou.mybatisplus.enums.SqlLike; import com.baomidou.mybatisplus.mapper.EntityWrapper; import com.baomidou.mybatisplus.service.impl.ServiceImpl; -import com.core.exception.CoolException; import com.zy.asrs.entity.AgvLocMast; import com.zy.asrs.entity.AgvLocRule; import com.zy.asrs.mapper.AgvLocMastMapper; @@ -22,7 +22,7 @@ @Autowired AgvLocMastMapper agvLocMastMapper; - public void clearLoc(){ + public void clearLoc() { agvLocMastMapper.deleteAll(); } @@ -35,20 +35,21 @@ //2妤� 1-25鎺� 1-33鍒� 1灞� this.insertBatch(getLocMastList(1, 25, 1, 33, 1, 1, 2)); } + public void initLocFloor3() { //2妤� 1-25鎺� 1-33鍒� 1灞� this.insertBatch(getLocMastList(1, 26, 1, 34, 1, 1, 3)); } //鏍规嵁鎺掑垪灞傝幏鍙朅GV搴撲綅鍒楄〃 - private List<AgvLocMast> getLocMastList(int rowIndex, int rowMax, int bayIndex, int bayMax, int levIndex, int levMax, int floor){ + private List<AgvLocMast> getLocMastList(int rowIndex, int rowMax, int bayIndex, int bayMax, int levIndex, int levMax, int floor) { List<AgvLocMast> agvLocMastList = new ArrayList<>(); Date now = new Date(); - for(int row=rowIndex; row<=rowMax; row++) { + for (int row = rowIndex; row <= rowMax; row++) { for (int bay = bayIndex; bay <= bayMax; bay++) { for (int lev = levIndex; lev <= levMax; lev++) { - if(!checkLocExistFloor1_2(row,bay)){ + if (!checkLocExistFloor1_2(row, bay)) { continue; } @@ -66,68 +67,69 @@ loc.setModiTime(now); loc.setFirstTime(now); loc.setAppeTime(now); - loc.setLocType1((short)3); + loc.setLocType1((short) 3); // loc.setLocType1(initLocMastSts3(row,bay)); agvLocMastList.add(loc); } } } - return agvLocMastList; + return agvLocMastList; } - private boolean checkLocExistFloor1_2(int row, int bay){ - if(row == 4 && bay == 19){ + private boolean checkLocExistFloor1_2(int row, int bay) { + if (row == 4 && bay == 19) { return false; } - if(row == 5 && (bay == 3 || bay == 8 || bay == 13 || bay == 18 || bay == 19 || bay == 24 || bay == 29)){ + if (row == 5 && (bay == 3 || bay == 8 || bay == 13 || bay == 18 || bay == 19 || bay == 24 || bay == 29)) { return false; } - if((row == 6 || row == 7) && bay == 39){ + if ((row == 6 || row == 7) && bay == 39) { return false; } - if((row == 9 || row == 10 || row == 14 || row == 18) && (bay == 3 || bay == 8 || bay == 13 || bay == 14 || bay == 19 || bay == 24 || bay == 29 || bay == 30)){ + if ((row == 9 || row == 10 || row == 14 || row == 18) && (bay == 3 || bay == 8 || bay == 13 || bay == 14 || bay == 19 || bay == 24 || bay == 29 || bay == 30)) { return false; } - if ((row == 10 || row == 11) && (bay == 7 || bay == 12 || bay == 23 || bay == 28 )) { + if ((row == 10 || row == 11) && (bay == 7 || bay == 12 || bay == 23 || bay == 28)) { return false; } - if ((row == 9 || row == 13) && bay == 35 ) { + if ((row == 9 || row == 13) && bay == 35) { return false; } - if(row == 13 && (bay == 18 || bay == 19 || bay == 20)){ + if (row == 13 && (bay == 18 || bay == 19 || bay == 20)) { return false; } - if(row == 9 && bay == 18){ + if (row == 9 && bay == 18) { return false; } - if((row == 14 || row == 15) && bay > 37){ + if ((row == 14 || row == 15) && bay > 37) { return false; } - if(row >= 16 && bay >= 35){ + if (row >= 16 && bay >= 35) { return false; } - if((row >= 2 && row <= 21) && bay == 17){ + if ((row >= 2 && row <= 21) && bay == 17) { return false; } - if(bay >= 33 && bay <= 34){ + if (bay >= 33 && bay <= 34) { return false; } return true; } - private boolean checkLocExistFloor1_1(int row, int bay){ - if(row <= 2 && bay >= 20){ + + private boolean checkLocExistFloor1_1(int row, int bay) { + if (row <= 2 && bay >= 20) { return false; } - if ((row == 4 || row == 9 || row == 14 || row == 20 || row == 25 || row == 30) && (bay == 7 || bay == 11 || bay == 12 || bay == 16 )) { + if ((row == 4 || row == 9 || row == 14 || row == 20 || row == 25 || row == 30) && (bay == 7 || bay == 11 || bay == 12 || bay == 16)) { return false; } - if ((row == 7 || row == 13 || row == 21 || row == 26) && (bay == 12 || bay == 13 )) { + if ((row == 7 || row == 13 || row == 21 || row == 26) && (bay == 12 || bay == 13)) { return false; } if (row >= 10 && bay == 1) { @@ -139,7 +141,7 @@ if (row == 25 && bay == 20) { return false; } - if ((row >= 26 && row <=27) && (bay >=18 && bay <= 19)) { + if ((row >= 26 && row <= 27) && (bay >= 18 && bay <= 19)) { return false; } if (row >= 28 && bay == 20) { @@ -149,129 +151,130 @@ return true; } - private boolean checkLocExistFloor2(int row, int bay){ - if(row <= 4 && bay >= 13){ + private boolean checkLocExistFloor2(int row, int bay) { + if (row <= 4 && bay >= 13) { return false; } - if(row <= 7 && bay >= 25){ + if (row <= 7 && bay >= 25) { return false; } - if(row >= 24 && bay >= 29){ + if (row >= 24 && bay >= 29) { return false; } - if((row != 20 && row != 25) && (bay ==8 || bay ==22)){ - return false; - } - - if((row == 3 || row == 12 || row == 16 || row == 21) && (bay ==4 || bay ==9 || bay == 14 || bay == 20 || bay == 25 || bay ==30 || bay == 31)){ + if ((row != 20 && row != 25) && (bay == 8 || bay == 22)) { return false; } - if(row == 21 && bay == 15){ + if ((row == 3 || row == 12 || row == 16 || row == 21) && (bay == 4 || bay == 9 || bay == 14 || bay == 20 || bay == 25 || bay == 30 || bay == 31)) { return false; } - if(row == 23 && bay == 29){ + if (row == 21 && bay == 15) { + return false; + } + + if (row == 23 && bay == 29) { return false; } return true; } - private short initLocMastSts(int row, int bay){ + private short initLocMastSts(int row, int bay) { - if(row <= 11 && bay <= 14){ + if (row <= 11 && bay <= 14) { return 1; } - if(row <= 7){ + if (row <= 7) { return 1; } - if(row >= 21){ + if (row >= 21) { return 3; } return 2; } - private boolean checkLocExistFloor3(int row, int bay){ - if(row == 1 && (bay <= 15 || bay >= 30)){ + + private boolean checkLocExistFloor3(int row, int bay) { + if (row == 1 && (bay <= 15 || bay >= 30)) { return false; } - if(row <= 6 && bay >= 30){ + if (row <= 6 && bay >= 30) { return false; } - if((row >= 9 && row <= 16) && (bay <= 4 || bay >= 33)){ + if ((row >= 9 && row <= 16) && (bay <= 4 || bay >= 33)) { return false; } - if(row == 17 && (bay <= 3 || bay >= 33)){ + if (row == 17 && (bay <= 3 || bay >= 33)) { return false; } - if(row <= 21 && row != 7 && row != 8 && bay >= 33){ + if (row <= 21 && row != 7 && row != 8 && bay >= 33) { return false; } - if((row <= 24 && row != 7 && row != 8) && bay >= 34){ + if ((row <= 24 && row != 7 && row != 8) && bay >= 34) { return false; } - if(row >= 25 && row <= 26 && bay >= 29){ + if (row >= 25 && row <= 26 && bay >= 29) { return false; } - if((row != 8 && row != 21 && row != 23 && row != 24 && row != 25 && row != 26) && bay == 15){ - return false; + if ((row != 8 && row != 21 && row != 23 && row != 24 && row != 25 && row != 26) && bay == 15) { + return false; } - if((row >= 22 && row != 26 ) && bay == 16){ - return false; + if ((row >= 22 && row != 26) && bay == 16) { + return false; } if (row == 4 && (bay == 3 || bay == 4 || bay == 9 || bay == 14 || bay == 19 || bay == 20 || bay == 25)) { - return false; + return false; } - if ((row == 13 || row == 17) && (bay == 8 || bay == 14 || bay == 19 || bay == 24 )) { - return false; + if ((row == 13 || row == 17) && (bay == 8 || bay == 14 || bay == 19 || bay == 24)) { + return false; } - if (row == 22 && (bay == 4 || bay == 9 || bay == 14 || bay == 20 || bay == 25 )) { - return false; + if (row == 22 && (bay == 4 || bay == 9 || bay == 14 || bay == 20 || bay == 25)) { + return false; } return true; } - private short initLocMastSts3(int row, int bay){ + private short initLocMastSts3(int row, int bay) { - if(row <= 8){ + if (row <= 8) { return 1; } - if(row <= 17){ + if (row <= 17) { return 2; } - if(row <= 18 && bay >= 9){ + if (row <= 18 && bay >= 9) { return 2; } - if(row <= 21){ + if (row <= 21) { return 4; } - if(row >= 22){ + if (row >= 22) { return 3; } return 2; } - private boolean checkLocExist(int row, int bay, int floor){ + private boolean checkLocExist(int row, int bay, int floor) { //if(floor == 1 && (row == 2)){ // if((bay >=8 && bay <=11) // || (bay >= 20 && bay <=23) @@ -285,7 +288,7 @@ if (floor == 1) { if (row == 2 || row == 5 || row == 8 || row == 11 || row == 14 || row == 17 || row == 19 || row == 22 || row == 25 - || row == 28 || (row >29 && row <39)|| row == 41|| row == 44) { + || row == 28 || (row > 29 && row < 39) || row == 41 || row == 44) { return false; } else if (row == 1) { if (bay < 19) { @@ -303,7 +306,7 @@ if (bay < 4 || bay == 26) { return false; } - } else if (row == 9 || row ==10 ) { + } else if (row == 9 || row == 10) { if (bay < 4 || bay == 12 || bay == 26) { return false; } @@ -316,7 +319,7 @@ return false; } } else if (row == 16 || row == 23 || row == 39) { - if (bay == 3 || bay == 4 || bay == 9 || bay == 12 || bay == 14 || bay == 20 || bay == 25 || bay == 26) { + if (bay == 3 || bay == 4 || bay == 9 || bay == 12 || bay == 14 || bay == 20 || bay == 25 || bay == 26) { return false; } } else if (row == 42) { @@ -336,19 +339,19 @@ } } - if(floor == 3){ - if(row == 1 && bay > 63){ + if (floor == 3) { + if (row == 1 && bay > 63) { return false; } - if(row == 2 && bay > 65){ + if (row == 2 && bay > 65) { return false; } - if(row > 23 && bay == 1){ + if (row > 23 && bay == 1) { return false; } - if(bay > 35 && bay < 39){ - if(row == 4 || row == 5 || row == 10 || row == 11 || row == 17 || row == 18){ + if (bay > 35 && bay < 39) { + if (row == 4 || row == 5 || row == 10 || row == 11 || row == 17 || row == 18) { return false; } } @@ -363,10 +366,10 @@ @Override public void updateLocType2ByRBL(Integer locType2, AgvLocRule locRule) { - this.baseMapper.updateLocType2(locType2,locRule.getRowBeg(),locRule.getRowEnd(),locRule.getBayBeg(),locRule.getBayEnd(),locRule.getLevBeg(),locRule.getLevEnd(),locRule.getFloor()); + this.baseMapper.updateLocType2(locType2, locRule.getRowBeg(), locRule.getRowEnd(), locRule.getBayBeg(), locRule.getBayEnd(), locRule.getLevBeg(), locRule.getLevEnd(), locRule.getFloor()); } - public void updateLocStsByLocNo(String locNo, String locSts, String barcode,Short containerType) { + public void updateLocStsByLocNo(String locNo, String locSts, String barcode, Short containerType) { AgvLocMast agvLocMast = this.selectById(locNo); agvLocMast.setLocSts(locSts); agvLocMast.setBarcode(barcode); @@ -375,7 +378,7 @@ this.updateById(agvLocMast); } - public void updateLocStsByLocNo(String locNo, String locSts, String barcode,Short containerType,String ctnNo) { + public void updateLocStsByLocNo(String locNo, String locSts, String barcode, Short containerType, String ctnNo) { AgvLocMast agvLocMast = this.selectById(locNo); agvLocMast.setLocSts(locSts); agvLocMast.setBarcode(barcode); @@ -385,7 +388,7 @@ this.updateById(agvLocMast); } - public void updateLocStsByLocNo(String locNo, String locSts, String barcode,Short containerType,String locType,Short locType3) { + public void updateLocStsByLocNo(String locNo, String locSts, String barcode, Short containerType, String locType, Short locType3) { AgvLocMast agvLocMast = this.selectById(locNo); agvLocMast.setLocSts(locSts); agvLocMast.setBarcode(barcode); @@ -410,21 +413,21 @@ @Override public AgvLocMast selectEmptyZpallet(int type, int floor) { - return this.selectOne(new EntityWrapper<AgvLocMast>().eq("loc_sts","D").eq("loc_type2",type).eq("floor",floor).orderBy("lev1",true)); + return this.selectOne(new EntityWrapper<AgvLocMast>().eq("loc_sts", "D").like("barcode", type + "", SqlLike.RIGHT).eq("floor", floor).orderBy("lev1", true)); } @Override public AgvLocMast select30EmptyZpallet() { - return this.selectOne(new EntityWrapper<AgvLocMast>().eq("loc_sts","D").eq("loc_type2",30).eq("floor",1).eq("lev1",2)); + return this.selectOne(new EntityWrapper<AgvLocMast>().eq("loc_sts", "D").eq("loc_type2", 30).eq("floor", 1).eq("lev1", 2)); } @Override public AgvLocMast selectEmptyZpalletByLocType1(int type) { - return this.selectOne(new EntityWrapper<AgvLocMast>().eq("loc_sts","D").eq("loc_type1",type)); + return this.selectOne(new EntityWrapper<AgvLocMast>().eq("loc_sts", "D").eq("loc_type1", type)); } @@ -436,19 +439,19 @@ @Override public List<AgvLocMast> selectDistinctLocByLevAndFloor(int lev, int floor) { - return this.agvLocMastMapper.selectDistinctLocByLevAndFloor(lev,floor); + return this.agvLocMastMapper.selectDistinctLocByLevAndFloor(lev, floor); } @Override public List<AgvLocMast> selectDistinctLocByLevAndFloorMaprow1(int lev, int floor) { - return this.agvLocMastMapper.selectDistinctLocByLevAndFloorMaprow1(lev,floor); + return this.agvLocMastMapper.selectDistinctLocByLevAndFloorMaprow1(lev, floor); } @Override public List<AgvLocMast> selectDistinctLocByLevAndFloorMapbay1(int lev, int floor) { - return this.agvLocMastMapper.selectDistinctLocByLevAndFloorMapbay1(lev,floor); + return this.agvLocMastMapper.selectDistinctLocByLevAndFloorMapbay1(lev, floor); } } -- Gitblit v1.9.1