#
zjj
2024-06-22 8a830f3e5f9ff3bca3161b5bf800abeb1a64e866
#
7个文件已修改
1个文件已添加
137 ■■■■■ 已修改文件
zy-asrs-flow/src/pages/map/utils.js 53 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/domain/dto/MapLockPathDto.java 17 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/kernel/AnalyzeService.java 10 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/kernel/command/ShuttleCommandService.java 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/map/entity/MapWsVo.java 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/map/websocket/MapRealTimeDataScheduler.java 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/model/command/ShuttleAssignCommand.java 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/utils/NavigateMapUtils.java 22 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-asrs-flow/src/pages/map/utils.js
@@ -689,38 +689,43 @@
    }).start();
}
export const showLockPath = (nodes, curFloor, setCurSPrite) => {
    const pathLineName = 'lockPath-' + curFloor;
export const showLockPath = (lockPath, curFloor, setCurSPrite) => {
    const pathLineName = 'lockPath';
    let pathLine = mapContainer.getChildByName(pathLineName);
    if (pathLine) {
        mapContainer.removeChild(pathLine);
    }
    pathLine = new PIXI.Graphics();
    pathLine.name = pathLineName;
    pathLine.lineStyle(3 * (1 / mapContainer.scale.x), 0xff0000, 0.8);
    pathLine.zIndex = SENSOR_ZINDEX.TRAVEL_PATH;
    let firstNode = true;
    for (let i = 0; i < lockPath.length; i++) {
        const item = lockPath[i]
        if(item.lev != curFloor) {continue}
        const nodes = item.path;
    for (let i = 0; i < nodes.length; i++) {
        const node = nodes[i];
        if (node.z !== curFloor) { continue }
        const shelf = querySprite(SENSOR_TYPE.SHELF, node.x + '-' + node.y);
        if (!shelf) { continue }
        let position = shelf.position;
        let x = position.x;
        let y = position.y;
        if (firstNode) {
            pathLine.moveTo(x, y);
            firstNode = false;
        } else {
            pathLine.lineTo(x, y);
        pathLine = new PIXI.Graphics();
        pathLine.name = pathLineName;
        pathLine.lineStyle(3 * (1 / mapContainer.scale.x), 0xff0000, 0.8);
        pathLine.zIndex = SENSOR_ZINDEX.TRAVEL_PATH;
        let firstNode = true;
        for (let i = 0; i < nodes.length; i++) {
            const node = nodes[i];
            const shelf = querySprite(SENSOR_TYPE.SHELF, node.x + '-' + node.y);
            if (!shelf) { continue }
            let position = shelf.position;
            let x = position.x;
            let y = position.y;
            if (firstNode) {
                pathLine.moveTo(x, y);
                firstNode = false;
            } else {
                pathLine.lineTo(x, y);
            }
        }
        mapContainer.addChild(pathLine);
    }
    mapContainer.addChild(pathLine);
}
export const showConveyorSta = (conveyorSta, curFloor, setCurSPrite) => {
zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/domain/dto/MapLockPathDto.java
New file
@@ -0,0 +1,17 @@
package com.zy.asrs.wcs.core.domain.dto;
import com.zy.asrs.wcs.core.model.NavigateNode;
import lombok.Data;
import java.util.List;
@Data
public class MapLockPathDto {
    //层
    private Integer lev;
    //nodes
    private List<NavigateNode> path;
}
zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/kernel/AnalyzeService.java
@@ -815,17 +815,17 @@
                        MotionDto.build((dto -> {
                            dto.setShuttleNo(shuttleDevice.getId().intValue());
                            dto.setLiftNo(transferLiftDevice.getId().intValue());
                            dto.setLocNo(standbyLocNoTo);
                            dto.setLocNo(standbyLocNoFrom);
                        })),
                        MotionCtgType.SHUTTLE_MOVE
                ));
                // 提升机空载移动到穿梭车层
                // 提升机空载移动到目标层
                motionList.addAll(kernelService.liftMove(
                        null
                        , MotionDto.build((dto -> {
                            dto.setLiftNo(transferLiftDevice.getId().intValue());
                            dto.setLev(Utils.getLev(shuttleLocNo));
                            dto.setLev(Utils.getLev(originLoc));
                        }))
                ));
@@ -841,12 +841,12 @@
                motionList.addAll(kernelService.shuttleMove(
                        MotionDto.build((dto -> {
                            dto.setShuttleNo(shuttleDevice.getId().intValue());
                            dto.setLocNo(standbyLocNoTo);
                            dto.setLocNo(standbyLocNoFrom);
                        })),
                        MotionDto.build((dto -> {
                            dto.setShuttleNo(shuttleDevice.getId().intValue());
                            dto.setLiftNo(transferLiftDevice.getId().intValue());
                            dto.setLocNo(liftLocNoTo);
                            dto.setLocNo(liftLocNoFrom);
                        })),
                        MotionCtgType.SHUTTLE_MOVE_TO_LIFT
                ));
zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/kernel/command/ShuttleCommandService.java
@@ -10,10 +10,7 @@
import com.zy.asrs.wcs.core.entity.BasShuttle;
import com.zy.asrs.wcs.core.entity.Loc;
import com.zy.asrs.wcs.core.model.NavigateNode;
import com.zy.asrs.wcs.core.model.command.LiftAssignCommand;
import com.zy.asrs.wcs.core.model.command.LiftCommand;
import com.zy.asrs.wcs.core.model.command.ShuttleAssignCommand;
import com.zy.asrs.wcs.core.model.command.ShuttleCommand;
import com.zy.asrs.wcs.core.model.command.*;
import com.zy.asrs.wcs.core.model.enums.*;
import com.zy.asrs.wcs.core.service.BasShuttleService;
import com.zy.asrs.wcs.core.service.LocService;
@@ -22,7 +19,6 @@
import com.zy.asrs.wcs.rcs.News;
import com.zy.asrs.wcs.rcs.cache.SlaveConnection;
import com.zy.asrs.wcs.core.entity.Motion;
import com.zy.asrs.wcs.rcs.constant.DeviceRedisConstant;
import com.zy.asrs.wcs.rcs.model.enums.ShuttleProtocolStatusType;
import com.zy.asrs.wcs.rcs.model.enums.SlaveType;
import com.zy.asrs.wcs.rcs.model.protocol.LiftProtocol;
@@ -242,7 +238,7 @@
        if (motion.getOrigin() != null && motion.getTarget() != null) {
            //所使用的路径进行锁定禁用
            boolean lockResult = navigateMapUtils.writeNavigateNodeToRedisMap(Utils.getLev(motion.getTarget()), shuttleProtocol.getShuttleNo(), assignCommand.getNodes(), true);//所使用的路径进行锁定禁用
            boolean lockResult = navigateMapUtils.writeNavigateNodeToRedisMap(Utils.getLev(motion.getTarget()), shuttleProtocol.getShuttleNo(), assignCommand.getNodesDeepCopy(), true);//所使用的路径进行锁定禁用
            if (!lockResult) {
                return false;//锁定失败
            }
zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/map/entity/MapWsVo.java
@@ -1,5 +1,6 @@
package com.zy.asrs.wcs.core.map.entity;
import com.zy.asrs.wcs.core.domain.dto.MapLockPathDto;
import com.zy.asrs.wcs.core.entity.BasConveyorSta;
import com.zy.asrs.wcs.core.model.NavigateNode;
import lombok.Data;
@@ -15,7 +16,7 @@
    private List<MapWsShuttleVo> shuttleVos = new ArrayList<>();
    private List<NavigateNode> lockPath = new ArrayList<>();
    private List<MapLockPathDto> lockPath = new ArrayList<>();
    private List<BasConveyorSta> conveyorSta = new ArrayList<>();
zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/map/websocket/MapRealTimeDataScheduler.java
@@ -4,6 +4,7 @@
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.zy.asrs.framework.common.Cools;
import com.zy.asrs.wcs.core.domain.dto.MapLockPathDto;
import com.zy.asrs.wcs.core.entity.BasConveyorSta;
import com.zy.asrs.wcs.core.entity.BasShuttle;
import com.zy.asrs.wcs.core.map.entity.MapWsShuttleVo;
@@ -106,8 +107,8 @@
        return shuttleVos;
    }
    private List<NavigateNode> getMapLocPath() {
        List<NavigateNode> navigateNodes = new ArrayList<>();
    private List<MapLockPathDto> getMapLocPath() {
        List<MapLockPathDto> list = new ArrayList<>();
        Dict dict = dictService.getOne(new LambdaQueryWrapper<Dict>()
                .eq(Dict::getFlag, "floor-list")
                .eq(Dict::getStatus, 1));
@@ -116,10 +117,14 @@
                JSONObject jsonObject = JSON.parseObject(o.toString());
                Integer lev = jsonObject.getInteger("value");
                List<NavigateNode> path = navigateMapUtils.getLockPath(lev);
                navigateNodes.addAll(path);
                MapLockPathDto lockPathDto = new MapLockPathDto();
                lockPathDto.setPath(path);
                lockPathDto.setLev(lev);
                list.add(lockPathDto);
            }
        }
        return navigateNodes;
        return list;
    }
    private List<BasConveyorSta> getMapConveyorSta() {
zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/model/command/ShuttleAssignCommand.java
@@ -1,5 +1,8 @@
package com.zy.asrs.wcs.core.model.command;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.zy.asrs.wcs.core.model.NavigateNode;
import lombok.Data;
@@ -77,4 +80,12 @@
     */
    private List<NavigateNode> nodes;
    public List<NavigateNode> getNodesDeepCopy() {
        List<NavigateNode> navigateNodes = new ArrayList<>();
        for (NavigateNode node : nodes) {
            navigateNodes.add(node.clone());
        }
        return navigateNodes;
    }
}
zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/utils/NavigateMapUtils.java
@@ -107,12 +107,22 @@
        Object o = redisUtil.get(DeviceRedisConstant.LOCK_PATH + lev);
        List<NavigateNode> navigateNodes = new ArrayList<>();
        if (o != null) {
            navigateNodes = JSON.parseArray(o.toString(), NavigateNode.class);
            try {
                navigateNodes = objectMapper.readValue(o.toString(), new TypeReference<List<NavigateNode>>() {});
            } catch (JsonProcessingException e) {
                throw new RuntimeException(e);
            }
        }
        String nodeStr = null;
        if (lock) {
            navigateNodes.addAll(nodes);
            redisUtil.set(DeviceRedisConstant.LOCK_PATH + lev, JSON.toJSONString(navigateNodes, SerializerFeature.DisableCircularReferenceDetect));
            try {
                nodeStr = objectMapper.writeValueAsString(navigateNodes);
            } catch (JsonProcessingException e) {
                throw new RuntimeException(e);
            }
            redisUtil.set(DeviceRedisConstant.LOCK_PATH + lev, nodeStr);
        }else {
            List<NavigateNode> tmp = new ArrayList<>();
            for (NavigateNode navigateNode : navigateNodes) {
@@ -131,7 +141,12 @@
                }
            }
            redisUtil.set(DeviceRedisConstant.LOCK_PATH + lev, JSON.toJSONString(tmp, SerializerFeature.DisableCircularReferenceDetect));
            try {
                nodeStr = objectMapper.writeValueAsString(tmp);
            } catch (JsonProcessingException e) {
                throw new RuntimeException(e);
            }
            redisUtil.set(DeviceRedisConstant.LOCK_PATH + lev, nodeStr);
        }
    }
@@ -146,7 +161,6 @@
                throw new RuntimeException(e);
            }
        }
        return navigateNodes;
    }