自动化立体仓库 - WMS系统
Junjie
2023-06-03 c973c7dd78f7e3ffcba3747f3ab0ad1083a813a7
库位地图优化
2个文件已修改
78 ■■■■■ 已修改文件
src/main/java/com/zy/asrs/controller/MapController.java 70 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/webapp/views/home/map.html 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/controller/MapController.java
@@ -15,6 +15,7 @@
import java.io.*;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
@RestController
@@ -58,21 +59,33 @@
                //解析json地图数据
                List<ArrayList> arrayLists = JSON.parseArray(stringBuffer.toString(), ArrayList.class);
                for (String locNo : DISABLE_LOC_NO) {//禁用设置库位
                    int row = Utils.getRow(locNo);
                    int bay = Utils.getBay(locNo);
//                    if (row >= 2 && row <= 12) {
//                        row++;
//                    }else if (row == 13) {
//                        row += 2;
//                    }
                    ArrayList rowData = arrayLists.get(row);
                    Object o = rowData.get(bay);
                    JSONObject jsonObject = JSON.parseObject(o.toString());
                    jsonObject.put("value", 10);//将禁用库位进行设置
                    //更新list
                    rowData.set(bay, jsonObject);
                    arrayLists.set(row, rowData);
                ArrayList<HashMap<String, Integer>> lineRows = new ArrayList<>();
                int dataRow = 0;
                int dataRowCount = 0;
                for (int i = 1; i < arrayLists.size(); i++) {
                    boolean flag = true;
                    ArrayList rows = arrayLists.get(i);
                    for (int j = 1; j < rows.size() - 1; j++) {
                        Object o = rows.get(j);
                        JSONObject jsonObject = JSON.parseObject(o.toString());
                        int value = Integer.parseInt(jsonObject.get("value").toString());
                        if (value >= 0 && value != 3) {
                            //只有该行中的任一一列有数据,则不需要创建空白行
                            flag = false;
                        }
                    }
                    if (flag) {
                        //空白行需要跳过
                        HashMap<String, Integer> map = new HashMap<>();
                        map.put("start", dataRow);
                        int end = i - 1 - dataRowCount;
                        map.put("end", end);
                        map.put("count", dataRowCount);
                        dataRow = end;
                        dataRowCount++;
                        lineRows.add(map);
                    }
                }
                //获取当前楼层库位数据
@@ -80,17 +93,22 @@
                for (LocMast locMast : locMasts) {
                    Integer row = locMast.getRow1();
                    Integer bay = locMast.getBay1();
//                    if (row >= 2 && row <= 12) {
//                        row++;
//                    }else if (row == 13) {
//                        row += 2;
//                    }
                    for (HashMap<String, Integer> lineRow : lineRows) {
                        if (row > lineRow.get("start") && row <= lineRow.get("end")) {
                            row += lineRow.get("count");
                             break;
                        }
                    }
                    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());//库位状态
//                    jsonObject.put("locSts$", locMast.getLocSts$());//库位状态
                    //更新list
                    rowData.set(bay, jsonObject);
                    arrayLists.set(row, rowData);
@@ -115,7 +133,7 @@
                       @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());
@@ -123,6 +141,14 @@
                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);
    }
src/main/webapp/views/home/map.html
@@ -390,13 +390,13 @@
                        <!--库位-->
                        <div v-else-if="map[index][idx].value  == 0" @contextmenu.prevent="rightEvent(index,idx,$event)">
                            <div v-if="map[index][idx].locSts == 'O'" class="pointBox pointBoxBlue">{{ map[index][idx].locSts }}</div>
                            <div v-if="map[index][idx].locSts == 'O'" :class="{'pointBoxSearch':map[index][idx].searchStatus}" class="pointBox pointBoxBlue">{{ map[index][idx].locSts }}</div>
                            <div v-else-if="map[index][idx].locSts == 'F'" @click.left="selectLoc(index,idx)" :class="{'pointBoxSelected':map[index][idx].locOutSelected,'pointBoxSearch':map[index][idx].searchStatus}" class="pointBox pointBoxRed">{{ map[index][idx].locSts }}</div>
                            <div v-else-if="map[index][idx].locSts == 'D'" class="pointBox pointBoxEmpty">{{ map[index][idx].locSts }}</div>
                            <div v-else-if="map[index][idx].locSts == 'P'" class="pointBox pointBoxOut">{{ map[index][idx].locSts }}</div>
                            <div v-else-if="map[index][idx].locSts == 'D'" :class="{'pointBoxSearch':map[index][idx].searchStatus}" class="pointBox pointBoxEmpty">{{ map[index][idx].locSts }}</div>
                            <div v-else-if="map[index][idx].locSts == 'P'" :class="{'pointBoxSearch':map[index][idx].searchStatus}" class="pointBox pointBoxOut">{{ map[index][idx].locSts }}</div>
                            <div v-else-if="map[index][idx].locSts == 'R'" :class="{'pointBoxSearch':map[index][idx].searchStatus}" class="pointBox pointBoxOutYy">{{ map[index][idx].locSts }}</div>
                            <div v-else-if="map[index][idx].locSts == 'S'" class="pointBox pointBoxInYy">{{ map[index][idx].locSts }}</div>
                            <div v-else class="pointBox pointBoxDefault">{{ map[index][idx].locSts }}</div>
                            <div v-else class="pointBox pointBoxDefault" :class="{'pointBoxSearch':map[index][idx].searchStatus}">{{ map[index][idx].locSts }}</div>
                        </div>
                        <!--母轨道-->