#
luxiaotao1123
2024-04-07 b13b323ff03225cf76e7ef12edf29ce253b73e3a
#
3个文件已修改
72 ■■■■■ 已修改文件
zy-asrs-flow/src/pages/map/utils.js 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/map/entity/MapWsShuttleVo.java 5 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/map/websocket/MockScheduler.java 66 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-asrs-flow/src/pages/map/utils.js
@@ -617,6 +617,7 @@
    const mapVo = JSON.parse(data);
    // shuttle
    for (const shuttleVo of mapVo.shuttleVos) {
        console.log(shuttleVo);
        const shuttle = querySprite(SENSOR_TYPE.SHUTTLE, shuttleVo.shuttleNo);
        if (!shuttle && !shuttleVo.curLocNo) { continue; }
        const { row, bay, lev } = parseLocNo(shuttleVo.curLocNo);
zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/map/entity/MapWsShuttleVo.java
@@ -2,6 +2,9 @@
import lombok.Data;
import java.util.ArrayList;
import java.util.List;
/**
 * Created by vincent on 4/3/2024
 */
@@ -12,6 +15,6 @@
    private String curLocNo;
    private List<String> preTravelPath = new ArrayList<>();
}
zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/map/websocket/MockScheduler.java
@@ -7,6 +7,9 @@
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import java.util.ArrayList;
import java.util.List;
/**
 * Created by vincent on 4/3/2024
 */
@@ -16,6 +19,7 @@
    private int row = 1;
    private int bay = 1;
    private int lev = 1;
    private boolean shouldIncreaseBay = true;
    @Scheduled(cron = "0/1 * * * * ? ")
    public void mock() {
@@ -26,21 +30,79 @@
        shuttleVo.setShuttleNo("1");
        if (shouldIncreaseBay) {
        if (bay < 30) {
            bay ++;
        } else {
            bay = 1;
                // bay 达到 30 后,row 先增 1
            if (row < 10) {
                row ++;
            } else {
                row = 1;
                    row = 1;  // 如果 row 已经是最大,则回到起始位置
                }
                shouldIncreaseBay = false;
            }
        } else {
            if (bay > 1) {
                bay--;
            } else {
                // bay 减到 1 后,则 row 先增 1
                if (row < 10) {
                    row++;
                } else {
                    row = 1;  // 如果 row 已经是最大,则回到起始位置
                }
                shouldIncreaseBay = true;
            }
        }
        shuttleVo.setCurLocNo(Utils.getLocNo(row, bay, lev));
        List<String> preTravelPath = generatePreTravelPath(row, bay, lev, shouldIncreaseBay, 10);
        shuttleVo.setPreTravelPath(preTravelPath);
        wsVo.getShuttleVos().add(shuttleVo);
        MapWebSocket.broadcast(JSON.toJSONString(wsVo));
    }
    private List<String> generatePreTravelPath(int currentRow, int currentBay, int currentLev, boolean increasingBay, int pathLength) {
        List<String> path = new ArrayList<>();
        int tempRow = currentRow;
        int tempBay = currentBay;
        boolean tempIncreaseBay = increasingBay;
        for (int i = 0; i < pathLength; i++) {
            if (tempIncreaseBay) {
                if (tempBay < 30) {
                    tempBay++;
                } else {
                    if (tempRow < 10) {
                        tempRow++;
                    } else {
                        tempRow = 1;  // 如果 row 已经是最大,则回到起始位置
                    }
                    tempIncreaseBay = false;
                }
            } else {
                if (tempBay > 1) {
                    tempBay--;
                } else {
                    if (tempRow < 10) {
                        tempRow++;
                    } else {
                        tempRow = 1;  // 如果 row 已经是最大,则回到起始位置
                    }
                    tempIncreaseBay = true;
                }
            }
            // 将生成的库位号加入路径列表
            path.add(Utils.getLocNo(tempRow, tempBay, currentLev));
        }
        return path;
    }
}