#
Junjie
6 天以前 81d537833adcbd5ef5333453e495eae2cac9f496
#
6个文件已修改
1个文件已添加
113 ■■■■ 已修改文件
src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/task/main/ShuttleTaskExecuteScheduler.java 20 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/common/model/NavigateNode.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/common/utils/NavigateUtils.java 74 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/common/utils/ShuttleOperaUtils.java 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/core/MainProcess.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/application.yml 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
@@ -1301,7 +1301,7 @@
                return false;
            }
            if (shuttleProtocol.getCurrentLocNo().equals(wrkMast.getLocNo())) {
            if (wrkMast.getLocNo().equals(shuttleProtocol.getCurrentLocNo())) {
                //小车在充电桩位置
                wrkMast.setWrkSts(WrkStsType.CHARGE_SHUTTLE_RUN_COMPLETE.sts);
                wrkMast.setModiTime(new Date());
src/main/java/com/zy/asrs/task/main/ShuttleTaskExecuteScheduler.java
New file
@@ -0,0 +1,20 @@
package com.zy.asrs.task.main;
import com.zy.asrs.service.impl.MainServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
@Component
public class ShuttleTaskExecuteScheduler {
    @Autowired
    private MainServiceImpl mainService;
    @Scheduled(cron = "0/3 * * * * ? ")
    public void shuttleFinished() {
        //四向穿梭车任务完成
        mainService.shuttleFinished();
    }
}
src/main/java/com/zy/common/model/NavigateNode.java
@@ -21,6 +21,7 @@
    private String direction;//行走方向
    private Integer moveDistance;//行走距离
    private Integer nodeValue;//节点数据
    private Boolean linePartAllowGo = false;//直线段部分,允许直接行走
    public NavigateNode(int x, int y) {
        this.x = x;
src/main/java/com/zy/common/utils/NavigateUtils.java
@@ -189,7 +189,7 @@
    }
    //计算带末端段落路径
    public ArrayList<ArrayList<NavigateNode>> calcEndPath(String startPoint, String endPoint, List<NavigationMapType> mapTypes, List<int[]> shuttlePoints, List<int[]> whites, int lastPathPart) {
    public List<List<NavigateNode>> calcEndPath(String startPoint, String endPoint, List<NavigationMapType> mapTypes, List<int[]> shuttlePoints, List<int[]> whites, int lastPathPart) {
        //计算路径
        List<NavigateNode> navigateNodes = calc(startPoint, endPoint, mapTypes, shuttlePoints, whites);
        if (navigateNodes == null) {
@@ -198,7 +198,7 @@
        }
        //获取分段路径
        ArrayList<ArrayList<NavigateNode>> partList = this.getSectionPath(navigateNodes);
        List<List<NavigateNode>> partList = this.getSectionPath(navigateNodes);
        //根据传入的末端段落路径,找到末端点位
        int partResult = partList.size() - lastPathPart;
        if (partResult == 0) {//路径数量相同无需分割
@@ -207,7 +207,7 @@
            throw new CoolException("分段路径与末端路径数量计算异常");
        }
        int pathIdx = partResult - 1;
        ArrayList<ArrayList<NavigateNode>> filterList = new ArrayList<>();
        List<List<NavigateNode>> filterList = new ArrayList<>();
        for (int i = 0; i <= pathIdx; i++) {
            filterList.add(partList.get(i));
        }
@@ -216,7 +216,7 @@
    //计算末端段落地址
    public String calcEndLocation(String startPoint, String endPoint, List<NavigationMapType> mapTypes, List<int[]> shuttlePoints, List<int[]> whites, int lastPathPart) {
        ArrayList<ArrayList<NavigateNode>> endPath = calcEndPath(startPoint, endPoint, mapTypes, shuttlePoints, whites, lastPathPart);
        List<List<NavigateNode>> endPath = calcEndPath(startPoint, endPoint, mapTypes, shuttlePoints, whites, lastPathPart);
        if (endPath == null) {
            return null;
        }
@@ -224,13 +224,8 @@
        return findTargetLocation(endPath);
    }
    public String findTargetLocation(List<NavigateNode> nodeList) {
        ArrayList<ArrayList<NavigateNode>> sectionPath = this.getSectionPath(nodeList);
        return findTargetLocation(sectionPath);
    }
    public String findTargetLocation(ArrayList<ArrayList<NavigateNode>> partList) {
        ArrayList<NavigateNode> nodes = partList.get(partList.size() - 1);
    public String findTargetLocation(List<List<NavigateNode>> partList) {
        List<NavigateNode> nodes = partList.get(partList.size() - 1);
        NavigateNode targetNode = nodes.get(0);
        String locNo = NavigatePositionConvert.nodeToLocNo(targetNode);
        return locNo;
@@ -292,10 +287,10 @@
     * 加转弯节点
     * 获取分段路径,每当有一个拐点则进行一次分段,最终返回总分段数据
     */
    public ArrayList<ArrayList<NavigateNode>> getSectionPath(List<NavigateNode> mapList) {
        ArrayList<ArrayList<NavigateNode>> list = new ArrayList<>();
    public List<List<NavigateNode>> getSectionPath(List<NavigateNode> mapList) {
        List<List<NavigateNode>> list = new ArrayList<>();
        ArrayList<NavigateNode> data = new ArrayList<>();
        List<NavigateNode> data = new ArrayList<>();
        String direction = mapList.get(0).getDirection();//行走方向
        for (NavigateNode navigateNode : mapList) {
@@ -318,7 +313,52 @@
        //将最后一段数据添加进入
        list.add(data);
        return list;
        List<List<NavigateNode>> paths = getSectionPathToSplitOverLength(list);
        return paths;
    }
    //分段路径-处理超长直线段路径
    public List<List<NavigateNode>> getSectionPathToSplitOverLength(List<List<NavigateNode>> list) {
        List<List<NavigateNode>> paths = new ArrayList<>();
        int overLength = 9;
        for (List<NavigateNode> nodes : list) {
            if (nodes.size() > overLength) {
                List<NavigateNode> copy = JSON.parseArray(JSON.toJSONString(nodes), NavigateNode.class);
                List<NavigateNode> tmp = new ArrayList<>();
                int tmpCount = 0;
                NavigateNode lastNode = null;
                for (NavigateNode node : copy) {
                    tmp.add(node);
                    tmpCount++;
                    if(tmpCount >= overLength) {
                        if (lastNode == null) {
                            NavigateNode startNode = tmp.get(0);
                            startNode.setLinePartAllowGo(true);//直线段超长部分允许直接行走
                            tmp.set(0, startNode);
                        }
                        NavigateNode targetNode = tmp.get(tmp.size() - 1);
                        targetNode.setLinePartAllowGo(true);//直线段超长部分允许直接行走
                        if (lastNode != null) {
                            tmp.add(0, lastNode);
                        }
                        paths.add(tmp);
                        tmp = new ArrayList<>();
                        tmpCount = 0;
                        lastNode = targetNode;
                    }
                }
                if (tmpCount > 0) {
                    tmp.add(0, lastNode);
                    paths.add(tmp);
                }
            }else {
                paths.add(nodes);
            }
        }
        return paths;
    }
    //获取从x点到下一点的行走距离
@@ -348,9 +388,9 @@
     * 根据原始节点结果,计算总行走距离
     */
    public Integer getOriginPathAllDistance(List<NavigateNode> path) {
        ArrayList<ArrayList<NavigateNode>> sectionPath = getSectionPath(path);
        List<List<NavigateNode>> sectionPath = getSectionPath(path);
        Integer allDistance = 0;
        for (ArrayList<NavigateNode> navigateNodes : sectionPath) {
        for (List<NavigateNode> navigateNodes : sectionPath) {
            Integer distance = getCurrentPathAllDistance(navigateNodes);
            allDistance += distance;
        }
src/main/java/com/zy/common/utils/ShuttleOperaUtils.java
@@ -93,9 +93,9 @@
        List<ShuttleCommand> commands = new ArrayList<>();
        //获取分段路径
        ArrayList<ArrayList<NavigateNode>> data = navigateUtils.getSectionPath(nodeList);
        List<List<NavigateNode>> data = navigateUtils.getSectionPath(nodeList);
        //将每一段路径分成command指令
        for (ArrayList<NavigateNode> nodes : data) {
        for (List<NavigateNode> nodes : data) {
            //开始路径
            NavigateNode startPath = nodes.get(0);
@@ -160,9 +160,9 @@
        List<ShuttleCommand> commands = new ArrayList<>();
        //获取分段路径
        ArrayList<ArrayList<NavigateNode>> data = navigateUtils.getSectionPath(nodeList);
        List<List<NavigateNode>> data = navigateUtils.getSectionPath(nodeList);
        //将每一段路径分成command指令
        for (ArrayList<NavigateNode> nodes : data) {
        for (List<NavigateNode> nodes : data) {
            //开始路径
            NavigateNode startPath = nodes.get(0);
src/main/java/com/zy/core/MainProcess.java
@@ -51,8 +51,8 @@
                    mainService.shuttleInExecute();
                    // 出库  ===>>  四向穿梭车出库作业下发
                    mainService.shuttleOutExecute();
                    //四向穿梭车任务完成
                    mainService.shuttleFinished();
//                    //四向穿梭车任务完成
//                    mainService.shuttleFinished();
                    //执行移库任务
                    mainService.shuttleLocMoveExecute();
                    //货叉提升机任务
src/main/resources/application.yml
@@ -21,6 +21,10 @@
    port: 6379
    database: 0
#    password: 123456
  task:
    scheduling:
      pool:
        size: 3
mybatis-plus:
  mapper-locations: classpath:mapper/*.xml