|  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public void initLocFloor1() { | 
|---|
|  |  |  | //1楼 13排 86列 12层 | 
|---|
|  |  |  | List<AgvLocMast> agvLocMastList = getLocMastList(1,45,1,33,1,1,1); | 
|---|
|  |  |  | this.insertBatch(agvLocMastList); | 
|---|
|  |  |  | this.insertBatch(getLocMastList(1, 22, 1, 39, 2, 2, 1)); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public void initLocFloor2() { | 
|---|
|  |  |  | //2楼 1-25排 1-33列 1层 | 
|---|
|  |  |  | this.insertBatch(getLocMastList(1, 25, 1, 33, 1, 1, 2)); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | public void initLocFloor3() { | 
|---|
|  |  |  | //3楼 1-33排 1-14列 8层 ------>  1-33排 1-17列 8层 | 
|---|
|  |  |  | //        this.insertBatch(getLocMastList(1, 33, 1, 17, 1, 8, 3)); | 
|---|
|  |  |  | // | 
|---|
|  |  |  | //        //3楼 1-27排 15-34列 8层 ------>  1-26排 18-25列 8层 | 
|---|
|  |  |  | //        this.insertBatch(getLocMastList(1, 27, 18, 25, 1, 8, 3)); | 
|---|
|  |  |  | // | 
|---|
|  |  |  | //        //3楼 1-25排 35-46列 8层 ------>  1-25排 26-35列 8层 | 
|---|
|  |  |  | //        this.insertBatch(getLocMastList(1, 25, 26, 35, 1, 8, 3)); | 
|---|
|  |  |  | // | 
|---|
|  |  |  | //        //3楼 3-25排 47-60列 8层 ------>  1-23排 36-70列 8层 | 
|---|
|  |  |  | //        this.insertBatch(getLocMastList(1, 23, 36, 70, 1, 8, 3)); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //3楼 3-23排 71-72列 8层 | 
|---|
|  |  |  | this.insertBatch(getLocMastList(3, 23, 71, 72, 1, 8, 3)); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //2楼 1-25排 1-33列 1层 | 
|---|
|  |  |  | this.insertBatch(getLocMastList(1, 26, 1, 34, 1, 1, 3)); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //根据排列层获取AGV库位列表 | 
|---|
|  |  |  | 
|---|
|  |  |  | for (int bay = bayIndex; bay <= bayMax; bay++) { | 
|---|
|  |  |  | for (int lev = levIndex; lev <= levMax; lev++) { | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if(!checkLocExist(row,bay,floor)){ | 
|---|
|  |  |  | if(!checkLocExistFloor1_2(row,bay)){ | 
|---|
|  |  |  | continue; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //                    if(floor == 1 && (row == 8 || row == 9)){ | 
|---|
|  |  |  | //                        if((bay >=8 && bay <=11) | 
|---|
|  |  |  | //                                || (bay >= 20 && bay <=23) | 
|---|
|  |  |  | //                                || (bay>=37 && bay <=39) | 
|---|
|  |  |  | //                                || (bay>=50 && bay <=52) | 
|---|
|  |  |  | //                                || (bay>=63 && bay <=64) | 
|---|
|  |  |  | //                                || (bay>=79 && bay <=80)){ | 
|---|
|  |  |  | //                            continue; | 
|---|
|  |  |  | //                        } | 
|---|
|  |  |  | //                    } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | AgvLocMast loc = new AgvLocMast(); | 
|---|
|  |  |  | String locRow = row < 10 ? "-00" + row : "-0" + row; | 
|---|
|  |  |  | String locBay = bay < 10 ? "-00" + bay : "-0" + bay; | 
|---|
|  |  |  | String locLev = lev < 10 ? "-0" + lev : "-" + lev; | 
|---|
|  |  |  | String locNo = "YZ" + locRow + locBay + locLev + "@" + floor; | 
|---|
|  |  |  | String locRow = row < 10 ? "_00" + row : "_0" + row; | 
|---|
|  |  |  | String locBay = bay < 10 ? "_00" + bay : "_0" + bay; | 
|---|
|  |  |  | String locLev = lev < 10 ? "_0" + lev : "_" + lev; | 
|---|
|  |  |  | String locNo = "YZ" + locRow + locBay + locLev + "F" + floor; | 
|---|
|  |  |  | loc.setLocNo(locNo); | 
|---|
|  |  |  | loc.setLocSts("O"); | 
|---|
|  |  |  | loc.setRow1(row); | 
|---|
|  |  |  | 
|---|
|  |  |  | loc.setModiTime(now); | 
|---|
|  |  |  | loc.setFirstTime(now); | 
|---|
|  |  |  | loc.setAppeTime(now); | 
|---|
|  |  |  | loc.setLocType1((short)3); | 
|---|
|  |  |  | //  loc.setLocType1(initLocMastSts3(row,bay)); | 
|---|
|  |  |  | agvLocMastList.add(loc); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | return  agvLocMastList; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 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)){ | 
|---|
|  |  |  | return false; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 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)){ | 
|---|
|  |  |  | return false; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if ((row == 10 || row == 11) && (bay == 7 || bay == 12 || bay == 23 || bay == 28 )) { | 
|---|
|  |  |  | return false; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if ((row == 9 || row == 13) && bay == 35 ) { | 
|---|
|  |  |  | return false; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if(row == 13 && (bay == 18 || bay == 19 || bay == 20)){ | 
|---|
|  |  |  | return false; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if(row == 9 && bay == 18){ | 
|---|
|  |  |  | return false; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if((row == 14 || row == 15) && bay > 37){ | 
|---|
|  |  |  | return false; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if(row >= 16 && bay >= 35){ | 
|---|
|  |  |  | return false; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if((row >= 2 && row <= 21) && bay == 17){ | 
|---|
|  |  |  | return false; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if(bay >= 33 && bay <= 34){ | 
|---|
|  |  |  | return false; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | return true; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 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 )) { | 
|---|
|  |  |  | return false; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if ((row == 7 || row == 13 || row == 21 || row == 26) && (bay == 12 || bay == 13 )) { | 
|---|
|  |  |  | return false; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (row >= 10 && bay == 1) { | 
|---|
|  |  |  | return false; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (row == 18 && bay <= 19) { | 
|---|
|  |  |  | return false; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (row == 25 && bay == 20) { | 
|---|
|  |  |  | return false; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if ((row >= 26 && row <=27) && (bay >=18 && bay <= 19)) { | 
|---|
|  |  |  | return false; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (row >= 28 && bay == 20) { | 
|---|
|  |  |  | return false; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | return true; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | private boolean checkLocExistFloor2(int row, int bay){ | 
|---|
|  |  |  | if(row <= 4 && bay >= 13){ | 
|---|
|  |  |  | return false; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if(row <= 7 && bay >= 25){ | 
|---|
|  |  |  | return false; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 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)){ | 
|---|
|  |  |  | return false; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if(row == 21 && bay == 15){ | 
|---|
|  |  |  | return false; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if(row == 23 && bay == 29){ | 
|---|
|  |  |  | return false; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | return true; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | private short initLocMastSts(int row, int bay){ | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if(row <= 11 && bay <= 14){ | 
|---|
|  |  |  | return 1; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if(row <= 7){ | 
|---|
|  |  |  | return 1; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if(row >= 21){ | 
|---|
|  |  |  | return 3; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | return 2; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | private boolean checkLocExistFloor3(int row, int bay){ | 
|---|
|  |  |  | if(row == 1 && (bay <= 15 || bay >= 30)){ | 
|---|
|  |  |  | return false; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if(row <= 6 && bay >= 30){ | 
|---|
|  |  |  | return false; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if((row >= 9 && row <= 16) && (bay <= 4 || bay >= 33)){ | 
|---|
|  |  |  | return false; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if(row == 17 && (bay <= 3 || bay >= 33)){ | 
|---|
|  |  |  | return false; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if(row <= 21 && row != 7 && row != 8 && bay >= 33){ | 
|---|
|  |  |  | return false; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if((row <= 24 && row != 7 && row != 8) && bay >= 34){ | 
|---|
|  |  |  | return false; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 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 >= 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; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 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; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | return true; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | private short initLocMastSts3(int row, int bay){ | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if(row <= 8){ | 
|---|
|  |  |  | return 1; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if(row <= 17){ | 
|---|
|  |  |  | return 2; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if(row <= 18 && bay >= 9){ | 
|---|
|  |  |  | return 2; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if(row <= 21){ | 
|---|
|  |  |  | return 4; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if(row >= 22){ | 
|---|
|  |  |  | return 3; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | return 2; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | private boolean checkLocExist(int row, int bay, int floor){ | 
|---|
|  |  |  | 
|---|
|  |  |  | 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) { | 
|---|
|  |  |  | public void updateLocStsByLocNo(String locNo, String locSts, String barcode,Short containerType) { | 
|---|
|  |  |  | AgvLocMast agvLocMast = this.selectById(locNo); | 
|---|
|  |  |  | agvLocMast.setLocSts(locSts); | 
|---|
|  |  |  | agvLocMast.setBarcode(barcode); | 
|---|
|  |  |  | agvLocMast.setLocType2(containerType); | 
|---|
|  |  |  | agvLocMast.setModiTime(new Date()); | 
|---|
|  |  |  | this.updateById(agvLocMast); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 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); | 
|---|
|  |  |  | agvLocMast.setLocType2(containerType); | 
|---|
|  |  |  | agvLocMast.setLocType(locType); | 
|---|
|  |  |  | agvLocMast.setLocType3(locType3); | 
|---|
|  |  |  | agvLocMast.setModiTime(new Date()); | 
|---|
|  |  |  | this.updateById(agvLocMast); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | public AgvLocMast selectEmptyZpallet(int type) { | 
|---|
|  |  |  | public AgvLocMast selectEmptyZpallet(int type, int floor) { | 
|---|
|  |  |  |  | 
|---|
|  |  |  | return this.selectOne(new EntityWrapper<AgvLocMast>().eq("loc_sts","D").eq("loc_type2",type)); | 
|---|
|  |  |  | return this.selectOne(new EntityWrapper<AgvLocMast>().eq("loc_sts","D").eq("loc_type2",type).eq("floor",floor)); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | public AgvLocMast selectEmptyZpalletByLocType1(int type) { | 
|---|
|  |  |  |  | 
|---|
|  |  |  | return this.selectOne(new EntityWrapper<AgvLocMast>().eq("loc_sts","D").eq("loc_type1",type)); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | public List<String> queryContainerTypeByLocType1(Short locType1) { | 
|---|
|  |  |  | return this.baseMapper.queryContainerTypeByLocType1(locType1); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | public List<AgvLocMast> selectDistinctLocByLevAndFloor(int lev, int floor) { | 
|---|
|  |  |  |  | 
|---|
|  |  |  | return this.agvLocMastMapper.selectDistinctLocByLevAndFloor(lev,floor); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | public List<AgvLocMast> selectDistinctLocByLevAndFloorMaprow1(int lev, int floor) { | 
|---|
|  |  |  |  | 
|---|
|  |  |  | return this.agvLocMastMapper.selectDistinctLocByLevAndFloorMaprow1(lev,floor); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | public List<AgvLocMast> selectDistinctLocByLevAndFloorMapbay1(int lev, int floor) { | 
|---|
|  |  |  |  | 
|---|
|  |  |  | return this.agvLocMastMapper.selectDistinctLocByLevAndFloorMapbay1(lev,floor); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|