| | |
| | | import java.io.*; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | |
| | | @RestController |
| | | |
| | |
| | | private LocDetlService locDetlService; |
| | | |
| | | private static final List<String> DISABLE_LOC_NO = new ArrayList<String>() {{ |
| | | add("0200101"); |
| | | add("0300101"); |
| | | add("0400101"); |
| | | add("0500101"); |
| | | add("0600101"); |
| | | add("0700101"); |
| | | add("0800101"); |
| | | add("0900101"); |
| | | add("1000101"); |
| | | add("1100101"); |
| | | add("1200101"); |
| | | |
| | | }}; |
| | | |
| | | @GetMapping("/map/getData/{lev}/auth") |
| | | @GetMapping("/map/getData/auth") |
| | | @ManagerAuth |
| | | public String getMapData(@PathVariable("lev") Integer lev) { |
| | | public String getMapData(@RequestParam Integer lev,@RequestParam Integer area) { |
| | | try { |
| | | String mapFilename = "map.json"; |
| | | String fileName = Objects.requireNonNull(this.getClass().getClassLoader().getResource(mapFilename)).getPath();//获取文件路径 |
| | | // String fileName ="file:" + new ClassPathResource(mapFilename).getPath(); |
| | | //获取当前楼层库位数据 |
| | | List<LocMast> locMasts = locMastService.selectNodeLocByLev(lev); |
| | | |
| | | String fileName = this.getClass().getClassLoader().getResource(mapFilename).getPath();//获取文件路径 |
| | | // File file = new File("D:\\workspace\\zy-asrs\\src\\main\\resources\\map.json"); |
| | | File file = new File(fileName); |
| | | StringBuffer stringBuffer = new StringBuffer(); |
| | | if (file.isFile() && file.exists()) { |
| | |
| | | arrayLists.set(row, rowData); |
| | | } |
| | | |
| | | //获取当前楼层库位数据 |
| | | List<LocMast> locMasts = locMastService.selectLocByLev(lev); |
| | | |
| | | |
| | | for (LocMast locMast : locMasts) { |
| | | |
| | | Integer row = locMast.getRow1(); |
| | | Integer bay = locMast.getBay1(); |
| | | if (row >= 2 && row <= 12) { |
| | | row++; |
| | | }else if (row == 13) { |
| | | row += 2; |
| | | } |
| | | |
| | | // switch (area){ |
| | | // case 1: |
| | | // if (row % 4 == 0 || (row+1) % 4 == 0) { |
| | | // row=row+locMast.getCrnNo(); |
| | | // }else{ |
| | | // row=row+locMast.getCrnNo()-1; |
| | | // } |
| | | // bay=32-bay; |
| | | // break; |
| | | // case 2: |
| | | // case 3: |
| | | //// if (row<=3 || row>=5){ |
| | | //// if (row%1==0){ |
| | | //// row=row+(row/1)-1; |
| | | //// }else { |
| | | //// row=row+((row+1)/1)-1; |
| | | //// } |
| | | //// }else { |
| | | //// if (row%2==0){ |
| | | //// row=row+(row/2); |
| | | //// }else { |
| | | //// row=row+((row-1)/2); |
| | | //// } |
| | | //// } |
| | | //// if (row == 9){ |
| | | //// row= row -1; |
| | | //// } |
| | | // |
| | | // if (row ==7) { |
| | | // row=row+2; |
| | | // }else{ |
| | | // if (row>7){ |
| | | // row=row+locMast.getCrnNo()+1; |
| | | // }else { |
| | | // row=row+locMast.getCrnNo()-1; |
| | | // } |
| | | // } |
| | | // break; |
| | | //// case 4: |
| | | ////// if (row<=11){ |
| | | //////// if (row%2==0){ |
| | | //////// row=row+(row/2)-1; |
| | | //////// }else { |
| | | //////// row=row+((row+1)/2)-1; |
| | | //////// } |
| | | //////// }else { |
| | | //////// if (row%2==0){ |
| | | //////// row=row+(row/2); |
| | | //////// }else { |
| | | //////// row=row+((row-1)/2); |
| | | //////// } |
| | | //////// } |
| | | //// |
| | | //// if (row % 10 == 0) { |
| | | //// row=row+2; |
| | | //// }else{ |
| | | //// if (row>10){ |
| | | //// row=row+locMast.getCrnNo()+1; |
| | | //// }else { |
| | | //// row=row+locMast.getCrnNo()-1; |
| | | //// } |
| | | //// } |
| | | //// break; |
| | | // case 5: |
| | | //// if (row<=11){ |
| | | //// if (row%2==0){ |
| | | //// row=row+(row/2)-1; |
| | | //// }else { |
| | | //// row=row+((row+1)/2)-1; |
| | | //// } |
| | | //// }else { |
| | | //// if (row%2==0){ |
| | | //// row=row+(row/2); |
| | | //// }else { |
| | | //// row=row+((row-1)/2); |
| | | //// } |
| | | //// } |
| | | // |
| | | // if (row % 7 == 0) { |
| | | // row=row+2; |
| | | // }else{ |
| | | // if (row>7){ |
| | | // row=row+locMast.getCrnNo()+1; |
| | | // }else { |
| | | // row=row+locMast.getCrnNo()-1; |
| | | // } |
| | | // } |
| | | // break; |
| | | // |
| | | // |
| | | // |
| | | // } |
| | | |
| | | ArrayList rowData = arrayLists.get(row); |
| | | Object o = rowData.get(bay); |
| | | JSONObject jsonObject = JSON.parseObject(o.toString()); |
| | | jsonObject.put("locNo", locMast.getLocNo());//设置库位号 |
| | | jsonObject.put("locSts", locMast.getLocSts());//库位状态 |
| | | jsonObject.put("locSts$", locMast.getLocSts$());//库位状态 |
| | | //jsonObject.put("locSts$", locMast.getLocSts$());//库位状态 |
| | | //更新list |
| | | rowData.set(bay, jsonObject); |
| | | arrayLists.set(row, rowData); |
| | | |
| | | |
| | | |
| | | // if (area == 1 || area == 6){ |
| | | // ArrayList rowData = arrayLists.get(row); |
| | | // Object o = rowData.get(bay); |
| | | // JSONObject jsonObject = JSON.parseObject(o.toString()); |
| | | // jsonObject.put("locNo", locMast.getLocNo());//设置库位号 |
| | | // jsonObject.put("locSts", locMast.getLocSts());//库位状态 |
| | | // //jsonObject.put("locSts$", locMast.getLocSts$());//库位状态 |
| | | // //更新list |
| | | // rowData.set(bay, jsonObject); |
| | | // arrayLists.set(row, rowData); |
| | | // }else { |
| | | // ArrayList rowData = arrayLists.get(bay); |
| | | // Object o = rowData.get(row); |
| | | // JSONObject jsonObject = JSON.parseObject(o.toString()); |
| | | // jsonObject.put("locNo", locMast.getLocNo());//设置库位号 |
| | | // jsonObject.put("locSts", locMast.getLocSts());//库位状态 |
| | | // //jsonObject.put("locSts$", locMast.getLocSts$());//库位状态 |
| | | // //更新list |
| | | // rowData.set(row, jsonObject); |
| | | // arrayLists.set(bay, rowData); |
| | | // } |
| | | |
| | | |
| | | |
| | | } |
| | | |
| | | return JSONObject.toJSONString(arrayLists); |
| | |
| | | @RequestParam("specs") String specs, |
| | | @RequestParam("matnr") String matnr, |
| | | @RequestParam("maktx") String maktx |
| | | ) { |
| | | List<LocDetl> locDetls = locDetlService.searchByLike(orderNo, matnr, maktx, specs, locNo); |
| | | ) { |
| | | List<LocDetl> locDetls = locDetlService.searchByLike(orderNo, matnr, maktx, specs, ""); |
| | | ArrayList<LocDetl> lists = new ArrayList<>(); |
| | | for (LocDetl locDetl : locDetls) {//过滤掉不是当前楼层的数据 |
| | | int lev1 = Utils.getLev(locDetl.getLocNo()); |
| | |
| | | lists.add(locDetl); |
| | | } |
| | | } |
| | | |
| | | //搜索指定库位号,即使库位为空,也可以返回数据 |
| | | LocMast locMast = locMastService.selectById(locNo); |
| | | if (locMast != null) { |
| | | LocDetl locDetl = new LocDetl(); |
| | | locDetl.setLocNo(locMast.getLocNo()); |
| | | lists.add(locDetl); |
| | | } |
| | | return R.ok().add(lists); |
| | | } |
| | | |