自动化立体仓库 - WMS系统
zyx
2024-03-29 16a3dbbf28606a90dd6dadeffe843f53f72d3955
src/main/java/com/zy/asrs/controller/MapController.java
@@ -50,22 +50,9 @@
    @GetMapping("/map/getData/{lev}/auth")
    @ManagerAuth
    public String getMapData(@PathVariable("lev") Integer lev) {
        try {
            String mapFilename = "map.json";
            String fileName = this.getClass().getClassLoader().getResource(mapFilename).getPath();//获取文件路径
            File file = new File(fileName);
            StringBuffer stringBuffer = new StringBuffer();
            if (file.isFile() && file.exists()) {
                InputStreamReader isr = new InputStreamReader(new FileInputStream(file), "GBK");
                BufferedReader br = new BufferedReader(isr);
                String lineTxt = null;
                while ((lineTxt = br.readLine()) != null) {
                    stringBuffer.append(lineTxt);
                }
                br.close();
                //解析json地图数据
                List<ArrayList> arrayLists = JSON.parseArray(stringBuffer.toString(), ArrayList.class);
        BasMap basMap = basMapService.selectLatestMap(lev);
        //解析json地图数据
        List<ArrayList> arrayLists = JSON.parseArray(basMap.getData(), ArrayList.class);
//                ArrayList<HashMap<String, Integer>> lineRows = new ArrayList<>();
//                int dataRow = 0;
//                int dataRowCount = 0;
@@ -95,11 +82,11 @@
//                    }
//                }
                //获取当前楼层库位数据
                List<LocMast> locMasts = locMastService.selectLocByLev(lev);
                for (LocMast locMast : locMasts) {
                    Integer row = locMast.getRow1();
                    Integer bay = locMast.getBay1();
        //获取当前楼层库位数据
        List<LocMast> locMasts = locMastService.selectLocByLev(lev);
        for (LocMast locMast : locMasts) {
            Integer row = locMast.getRow1();
            Integer bay = locMast.getBay1();
//                    for (HashMap<String, Integer> lineRow : lineRows) {
//                        if (row > lineRow.get("start") && row <= lineRow.get("end")) {
//                            row += lineRow.get("count");
@@ -107,28 +94,21 @@
//                        }
//                    }
                    ArrayList rowData = arrayLists.get(row);
                    Object o = rowData.get(bay);
                    JSONObject jsonObject = JSON.parseObject(o.toString());
                    if (DISABLE_LOC_NO.contains(locMast.getLocNo())) {
                        //禁止库位
                        jsonObject.put("value", 10);//将禁用库位进行设置
                    }
                    jsonObject.put("locNo", locMast.getLocNo());//设置库位号
                    jsonObject.put("locSts", locMast.getLocSts());//库位状态
                    //更新list
                    rowData.set(bay, jsonObject);
                    arrayLists.set(row, rowData);
                }
                return JSONObject.toJSONString(arrayLists);
            } else {
                System.out.println("文件不存在!");
            ArrayList rowData = arrayLists.get(row);
            Object o = rowData.get(bay);
            JSONObject jsonObject = JSON.parseObject(o.toString());
            if (DISABLE_LOC_NO.contains(locMast.getLocNo())) {
                //禁止库位
                jsonObject.put("value", 10);//将禁用库位进行设置
            }
        } catch (IOException ioException) {
            ioException.printStackTrace();
            jsonObject.put("locNo", locMast.getLocNo());//设置库位号
            jsonObject.put("locSts", locMast.getLocSts());//库位状态
            //更新list
            rowData.set(bay, jsonObject);
            arrayLists.set(row, rowData);
        }
        return null;
        return JSONObject.toJSONString(arrayLists);
    }
    @RequestMapping("/map/searchData/auth")