| | |
| | | @Autowired |
| | | private RedisUtil redisUtil; |
| | | |
| | | private Integer max = 10000; |
| | | |
| | | private static final List<String> DISABLE_LOC_NO = new ArrayList<String>() {{ |
| | | // add("0200101"); |
| | | // add("0300101"); |
| | |
| | | @GetMapping("/map/getData/{floor}/{lev}/auth") |
| | | @ManagerAuth |
| | | public String getMapData(@PathVariable("floor") Integer floor, @PathVariable("lev") Integer lev) { |
| | | BasMap basMap = agvBasMapService.selectLatestMap(1,floor); |
| | | |
| | | //to do |
| | | // floor = 2; |
| | | |
| | | BasMap basMap = agvBasMapService.selectLatestMap(lev, floor); |
| | | //解析json地图数据 |
| | | List<ArrayList> arrayLists = JSON.parseArray(basMap.getData(), ArrayList.class); |
| | | |
| | | |
| | | //获取当前楼层库位数据 |
| | | List<AgvLocMast> locMasts = agvLocMastService.selectLocByLevAndFloor(lev,floor); |
| | | List<AgvLocMast> locMasts = agvLocMastService.selectLocByLevAndFloor(lev, floor); |
| | | for (AgvLocMast locMast : locMasts) { |
| | | Integer row = locMast.getRow1(); |
| | | Integer bay = locMast.getBay1(); |
| | |
| | | |
| | | int x = bay; |
| | | int y = row; |
| | | //1楼 |
| | | if(floor == 1){ |
| | | x = generateMap1Row(row); |
| | | y = generateMap1Bay(bay); |
| | | //2楼 |
| | | if (floor == 1 && lev == 1) { |
| | | x = generateMap1Bay(bay); |
| | | } |
| | | //3楼 |
| | | if(floor == 3){ |
| | | if (floor == 1 && lev == 2) { |
| | | y = generateMap4Row(row); |
| | | } |
| | | //2楼 |
| | | if (floor == 2) { |
| | | y = generateMap2Row(row); |
| | | //y = generateMap2Bay(bay); |
| | | } |
| | | ////3楼 |
| | | if (floor == 3) { |
| | | y = generateMap3Row(row); |
| | | x = generateMap3Bay(bay); |
| | | // x = generateMap3Bay(bay); |
| | | } |
| | | |
| | | ArrayList rowData = arrayLists.get(x); |
| | | Object o = rowData.get(y); |
| | | |
| | | JSONObject jsonObject = JSON.parseObject(o.toString()); |
| | | jsonObject.put("value","0"); |
| | | jsonObject.put("value", "0"); |
| | | |
| | | jsonObject.put("locNo", locMast.getLocNo());//设置库位号 |
| | | jsonObject.put("locSts", locMast.getLocSts());//库位状态 |
| | |
| | | return JSONObject.toJSONString(arrayLists); |
| | | } |
| | | |
| | | private Integer generateMap1Row(int row){ |
| | | int x = 21-row; |
| | | if(row > 1){ |
| | | x --; |
| | | } |
| | | if(row > 3){ |
| | | x --; |
| | | } |
| | | if(row > 5){ |
| | | x --; |
| | | } |
| | | if(row > 7){ |
| | | x --; |
| | | } |
| | | if(row > 9){ |
| | | x --; |
| | | } |
| | | if(row > 10){ |
| | | x --; |
| | | } |
| | | if(row > 12){ |
| | | x --; |
| | | } |
| | | return x; |
| | | |
| | | } |
| | | |
| | | private Integer generateMap1Bay(int bay){ |
| | | private Integer generateMap1Bay(int bay) { |
| | | int y = bay; |
| | | if(y > 28){ |
| | | y ++; |
| | | } |
| | | if(y > 57){ |
| | | y ++; |
| | | } |
| | | return y; |
| | | } |
| | | |
| | | private Integer generateMap3Row(int row){ |
| | | int x = row; |
| | | Integer[] rowAdd = {2,4,6,7,8,10,12,13,15,17,19,21,23,24,26,28,30,32}; |
| | | for(int i=0; i<rowAdd.length; i++){ |
| | | if(row >= rowAdd[i]){ |
| | | x ++; |
| | | Integer[] bayAdd = {1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, 39, 41, 43, 45, 47, 49, 51, 53, 55, 57, 59, 61, 63, 65, 67, 69, 71, 73, 75, 77, 79, 81, 83, 85, 87, 89, 91, 93, 95, 97, 99, 101, 103, 105}; |
| | | for (int i = 0; i < bayAdd.length; i++) { |
| | | if (bay > bayAdd[i]) { |
| | | y++; |
| | | } |
| | | } |
| | | |
| | | return y; |
| | | |
| | | } |
| | | |
| | | private Integer generateMap4Row(int row) { |
| | | int x = row; |
| | | Integer[] rowAdd = {1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, 39, 41, 43, 45, 47, 49, 51, 53, 55, 57, 59, 61, 63, 65, 67, 69, 71, 73, 75, 77, 79, 81, 83, 85, 87, 89, 91, 93, 95, 97, 99, 101, 103, 105, 107, 109, 111, 113, 115, 117, 119}; |
| | | for (int i = 0; i < rowAdd.length; i++) { |
| | | if (row > rowAdd[i]) { |
| | | x++; |
| | | } |
| | | } |
| | | |
| | | return x; |
| | | |
| | | } |
| | | |
| | | private Integer generateMap2Row(int row) { |
| | | int x = row; |
| | | Integer[] rowAdd = {2, 4, 6, 7, 8, 10, 12, 13, 15, 17, 19, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42, 44, 46, 48, 50, 52, 54, 56, 58, 60, 62, 64, 66, 68, 70, 72, 74, 76, 78, 80, 82, 84, 86, 88, 90, 92, 94, 96, 98, 100, 102, 104, 106, 108, 110, 112, 114, 116}; |
| | | for (int i = 0; i < rowAdd.length; i++) { |
| | | if (row > rowAdd[i]) { |
| | | x++; |
| | | } |
| | | } |
| | | if (row > 20) x += 9; |
| | | |
| | | return x; |
| | | |
| | | } |
| | | |
| | | private Integer generateMap2Bay(int bay) { |
| | | int y = bay; |
| | | if (y > 28) { |
| | | y++; |
| | | } |
| | | if (y > 57) { |
| | | y++; |
| | | } |
| | | return y; |
| | | } |
| | | |
| | | private Integer generateMap3Row(int row) { |
| | | int x = row; |
| | | Integer[] rowAdd = {2, 4, 6, 8, 10, 12, 14, 15, 17, 19, 21, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42, 44, 46, 48, 50, 52, 54, 56, 58, 60, 62, 64, 66, 68, 70, 72, 74, 76, 78, 80, 82, 84, 86, 88, 90, 92, 94, 96, 98, 100, 102, 104, 106, 108, 110, 112, 114, 116, 118, 120, 122}; |
| | | for (int i = 0; i < rowAdd.length; i++) { |
| | | if (row >= rowAdd[i]) { |
| | | x++; |
| | | } |
| | | } |
| | | if (row > 8) x += 9; |
| | | return x; |
| | | } |
| | | |
| | | private Integer generateMap3Bay(int bay){ |
| | | int y = 76-bay; |
| | | if(bay >= 18) y --; |
| | | if(bay >= 26) y --; |
| | | if(bay >= 50) y --; |
| | | private Integer generateMap3Bay(int bay) { |
| | | int y = 76 - bay; |
| | | if (bay >= 18) y--; |
| | | if (bay >= 26) y--; |
| | | if (bay >= 50) y--; |
| | | return y; |
| | | } |
| | | |
| | | |
| | | public static void main(String[] args) { |
| | | AgvMapController a = new AgvMapController(); |
| | | System.out.println(a.generateMap4Row(4)); |
| | | |
| | | System.out.println(a.process(1)); |
| | | } |
| | | |
| | | private List<Integer> process(int start) { |
| | | List<Integer> l = new ArrayList<>(); |
| | | while (start <= max) { |
| | | l.add(start); |
| | | start = start + 2; |
| | | } |
| | | return l; |
| | | } |
| | | |
| | | |
| | | @RequestMapping("/map/searchData/auth") |
| | | @ManagerAuth |
| | |
| | | @RequestParam("specs") String specs, |
| | | @RequestParam("matnr") String matnr, |
| | | @RequestParam("maktx") String maktx |
| | | ) { |
| | | ) { |
| | | |
| | | List<AgvLocDetl> locDetls = agvLocDetlService.searchByLike(orderNo, matnr, maktx, specs, locNo); |
| | | ArrayList<AgvLocDetl> lists = new ArrayList<>(); |