| | |
| | | package com.zy.asrs.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.baomidou.mybatisplus.service.impl.ServiceImpl; |
| | | import com.zy.asrs.entity.AgvLocMast; |
| | | import com.zy.asrs.entity.AgvLocRule; |
| | |
| | | public class AgvLocMastServiceImpl extends ServiceImpl<AgvLocMastMapper, AgvLocMast> implements AgvLocMastService { |
| | | |
| | | @Autowired |
| | | AgvLocMastMapper agvLockMastMapper; |
| | | AgvLocMastMapper agvLocMastMapper; |
| | | |
| | | public void clearLoc(){ |
| | | agvLockMastMapper.deleteAll(); |
| | | agvLocMastMapper.deleteAll(); |
| | | } |
| | | |
| | | public void initLocFloor1() { |
| | | //1楼 13排 86列 12层 |
| | | List<AgvLocMast> agvLocMastList = getLocMastList(1,13,1,86,1,12,1); |
| | | List<AgvLocMast> agvLocMastList = getLocMastList(1,45,1,33,1,1,1); |
| | | this.insertBatch(agvLocMastList); |
| | | } |
| | | |
| | | |
| | | public void initLocFloor3() { |
| | | //3楼 1-33排 1-14列 8层 |
| | | this.insertBatch(getLocMastList(1, 33, 1, 14, 1, 8, 3)); |
| | | |
| | | //3楼 1-27排 15-34列 8层 |
| | | this.insertBatch(getLocMastList(1, 27, 15, 34, 1, 8, 3)); |
| | | |
| | | //3楼 1-25排 35-46列 8层 |
| | | this.insertBatch(getLocMastList(1, 25, 35, 46, 1, 8, 3)); |
| | | |
| | | //3楼 3-25排 47-60列 8层 |
| | | this.insertBatch(getLocMastList(3, 25, 47, 60, 1, 8, 3)); |
| | | |
| | | //3楼 4-25排 61-70列 8层 |
| | | this.insertBatch(getLocMastList(4, 25, 61, 70, 1, 8, 3)); |
| | | |
| | | public void initLocFloor2() { |
| | | //2楼 1-25排 1-33列 1层 |
| | | this.insertBatch(getLocMastList(1, 25, 1, 33, 1, 1, 2)); |
| | | } |
| | | |
| | | //根据排列层获取AGV库位列表 |
| | |
| | | for(int row=rowIndex; row<=rowMax; row++) { |
| | | for (int bay = bayIndex; bay <= bayMax; bay++) { |
| | | for (int lev = levIndex; lev <= levMax; lev++) { |
| | | |
| | | if(!checkLocExistFloor2(row,bay)){ |
| | | 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 = "SK" + locRow + locBay + locLev + "@" + floor; |
| | | String locNo = "YZ" + locRow + locBay + locLev + "@" + floor; |
| | | loc.setLocNo(locNo); |
| | | loc.setLocSts("O"); |
| | | loc.setRow1(row); |
| | |
| | | loc.setModiTime(now); |
| | | loc.setFirstTime(now); |
| | | loc.setAppeTime(now); |
| | | loc.setLocType1(initLocMastSts(row,bay)); |
| | | agvLocMastList.add(loc); |
| | | } |
| | | } |
| | | } |
| | | |
| | | return agvLocMastList; |
| | | } |
| | | |
| | | private boolean checkLocExistFloor2(int row, int bay){ |
| | | if(row <= 4 && bay >= 17){ |
| | | return false; |
| | | } |
| | | |
| | | if(row <= 7 && bay >= 26){ |
| | | 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; |
| | | } |
| | | |
| | | 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 checkLocExist(int row, int bay, int floor){ |
| | | //if(floor == 1 && (row == 2)){ |
| | | // 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)){ |
| | | // return false; |
| | | // } |
| | | //} |
| | | 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) { |
| | | return false; |
| | | } else if (row == 1) { |
| | | if (bay < 19) { |
| | | return false; |
| | | } |
| | | } else if (row == 3 || row == 4) { |
| | | if (bay < 19 || bay == 26) { |
| | | return false; |
| | | } |
| | | } else if (row == 6) { |
| | | if (bay < 20 || bay == 26 || bay == 30) { |
| | | return false; |
| | | } |
| | | } else if (row == 7) { |
| | | if (bay < 4 || bay == 26) { |
| | | return false; |
| | | } |
| | | } else if (row == 9 || row ==10 ) { |
| | | if (bay < 4 || bay == 12 || bay == 26) { |
| | | return false; |
| | | } |
| | | } else if (row == 12) { |
| | | if (bay < 4) { |
| | | return false; |
| | | } |
| | | } else if (row == 15 || row == 18 || row == 20 || row == 21 || row == 24 || row == 26 || row == 27 || row == 40) { |
| | | if (bay == 12 || bay == 26) { |
| | | 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) { |
| | | return false; |
| | | } |
| | | } else if (row == 42) { |
| | | if (bay == 5 || bay == 12 || bay == 26) { |
| | | return false; |
| | | } |
| | | } else if (row == 43) { |
| | | if (bay < 6 || bay == 12 || bay == 26) { |
| | | return false; |
| | | } |
| | | } else if (row == 45) { |
| | | if (bay < 6) { |
| | | return false; |
| | | } |
| | | } else { |
| | | return true; |
| | | } |
| | | } |
| | | |
| | | if(floor == 3){ |
| | | if(row == 1 && bay > 63){ |
| | | return false; |
| | | } |
| | | if(row == 2 && bay > 65){ |
| | | return false; |
| | | } |
| | | 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){ |
| | | return false; |
| | | } |
| | | } |
| | | } |
| | | return true; |
| | | } |
| | | |
| | | @Override |
| | |
| | | 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) { |
| | | 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); |
| | | this.updateById(agvLocMast); |
| | | } |
| | | |
| | | public List<String> queryGroupEmptyStock(int floor) { |
| | | return this.baseMapper.queryGroupEmptyStock(floor); |
| | | } |
| | | |
| | | public List<AgvLocMast> selectLocByLevAndFloor(int lev, int floor) { |
| | | |
| | | List<AgvLocMast> agvLocMastList = this.selectList(new EntityWrapper<AgvLocMast>().eq("lev1", lev).eq("floor", floor)); |
| | | return agvLocMastList; |
| | | //return this.agvLocMastMapper.selectLocByLevAndFloor(lev,floor); |
| | | } |
| | | |
| | | @Override |
| | | public AgvLocMast selectEmptyZpallet(int type) { |
| | | |
| | | return this.selectOne(new EntityWrapper<AgvLocMast>().eq("loc_sts","D").eq("loc_type2",type)); |
| | | |
| | | } |
| | | |
| | | } |