#
zjj
22 小时以前 c9c80ecde06d151f4f2f3ccf46d3f4c0e65cd8a1
#
5个文件已修改
175 ■■■■■ 已修改文件
src/main/java/com/zy/asrs/utils/MapExcelUtils.java 109 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/common/utils/ShuttleOperaUtils.java 22 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/core/thread/ShuttleThread.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/core/thread/impl/NyShuttleThread.java 33 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/webapp/views/admin/debugParam/debugParam.html 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/utils/MapExcelUtils.java
@@ -4,6 +4,7 @@
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.serializer.SerializerFeature;
import com.core.common.Cools;
import com.core.exception.CoolException;
import com.zy.asrs.domain.enums.MapExcelNodeType;
import com.zy.common.model.MapNode;
import com.zy.core.enums.MapNodeType;
@@ -15,10 +16,7 @@
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.*;
@Component
public class MapExcelUtils {
@@ -72,6 +70,8 @@
                for (int bay = 1; bay <= finalBay; bay++) {
                    MapNode node = new MapNode();
                    node.setId(row + "-" + bay);
                    node.setRow(row);
                    node.setBay(bay);
                    HashMap<String, Object> nodeData = excelData.get(row + 1).get(bay + 1);
                    String nodeType = nodeData.get("bgColor").toString();
@@ -102,6 +102,7 @@
                mapList.add(rows);
            }
            MapNode baseMapNode = null;
            //生成小车地图坐标间距数据
            for (int row = 1; row <= finalRow; row++) {
                for (int bay = 1; bay <= finalBay; bay++) {
@@ -114,6 +115,29 @@
                    Integer left = bayData.getInteger("left");
                    Integer right = bayData.getInteger("right");
                    HashMap<String, Object> nodeData = excelData.get(row + 1).get(bay + 1);
                    String nodeValue = nodeData.get("value").toString();
                    if (Utils.isJSON(nodeValue)) {
                        JSONObject jsonData = JSON.parseObject(nodeValue);
                        if (jsonData.containsKey("top")) {
                            top = jsonData.getInteger("top");
                        }
                        if (jsonData.containsKey("bottom")) {
                            bottom = jsonData.getInteger("bottom");
                        }
                        if (jsonData.containsKey("left")) {
                            left = jsonData.getInteger("left");
                        }
                        if (jsonData.containsKey("right")) {
                            right = jsonData.getInteger("right");
                        }
                        if (jsonData.containsKey("xBase")) {
                            //基点
                            baseMapNode = mapNode;
                        }
                    }
                    mapNode.setTop(top);
                    mapNode.setBottom(bottom);
                    mapNode.setLeft(left);
@@ -121,51 +145,58 @@
                }
            }
            //生成牛眼Y坐标基准数据
            for (int bay = 1; bay <= finalBay; bay++) {
                int yBase = 10000;
            if (baseMapNode == null) {
                throw new CoolException("未设置基准点");
            }
            List<Integer> rowList = new ArrayList<>();
            List<Integer> bayList = new ArrayList<>();
                for (int row = 1; row <= finalRow; row++) {
                rowList.add(row);
            }
            for (int bay = 1; bay <= finalBay; bay++) {
                bayList.add(bay);
            }
            if (baseMapNode.getRow() != 1) {
                Collections.reverse(rowList);
            }
            if (baseMapNode.getBay() != 1) {
                Collections.reverse(bayList);
            }
            //生成牛眼Y坐标基准数据
            for (int i = 0; i < bayList.size(); i++) {
                Integer bay = bayList.get(i);
                int yBase = 10000;
                for (int j = 0; j < rowList.size(); j++) {
                    Integer row = rowList.get(j);
                    MapNode mapNode = mapList.get(row - 1).get(bay - 1);
                    HashMap<String, Object> nodeData = excelData.get(row + 1).get(bay + 1);
                    JSONObject rowData = rowMap.get(row);
                    Integer bottom = rowData.getInteger("bottom");
                    String nodeValue = nodeData.get("value").toString();
                    if (Utils.isJSON(nodeValue)) {
                        JSONObject jsonData = JSON.parseObject(nodeValue);
                        if (jsonData.containsKey("bottom")) {
                            bottom = jsonData.getInteger("bottom");
                        }
                    }
                    if (row != 1) {
                        yBase += bottom;
                    }
                    mapNode.setYBase(yBase);
                    if (baseMapNode.getRow() == 1) {
                        yBase += mapNode.getBottom();
                    }else {
                        yBase += mapNode.getTop();
                    }
                }
            }
            //生成牛眼X坐标基准数据
            for (int row = 1; row <= finalRow; row++) {
            for (int i = 0; i < rowList.size(); i++) {
                Integer row = rowList.get(i);
                int xBase = 10000;
                for (int bay = 1; bay <= finalBay; bay++) {
                for (int j = 0; j < bayList.size(); j++) {
                    Integer bay = bayList.get(j);
                    MapNode mapNode = mapList.get(row - 1).get(bay - 1);
                    HashMap<String, Object> nodeData = excelData.get(row + 1).get(bay + 1);
                    JSONObject bayData = bayMap.get(bay);
                    Integer right = bayData.getInteger("right");
                    String nodeValue = nodeData.get("value").toString();
                    if (Utils.isJSON(nodeValue)) {
                        JSONObject jsonData = JSON.parseObject(nodeValue);
                        if (jsonData.containsKey("right")) {
                            right = jsonData.getInteger("right");
                        }
                    }
                    if (bay != 1) {
                        xBase += right;
                    }
                    mapNode.setXBase(xBase);
                    if (baseMapNode.getBay() == 1) {
                        xBase += mapNode.getRight();
                    }else {
                        xBase += mapNode.getLeft();
                    }
                }
            }
src/main/java/com/zy/common/utils/ShuttleOperaUtils.java
@@ -72,6 +72,17 @@
            }
        }
        Object systemConfigMapObj = redisUtil.get(RedisKeyType.SYSTEM_CONFIG_MAP.key);
        //小车(x,y)命令运行方向颠倒
        boolean shuttleDirectionReverse = false;
        if (systemConfigMapObj != null) {
            HashMap<String, String> systemConfigMap = (HashMap<String, String>) systemConfigMapObj;
            if (systemConfigMap.get("shuttleDirectionReverse").equals("Y")) {
                shuttleDirectionReverse = true;
            }
        }
        long calcStartTime = System.currentTimeMillis();
        List<NavigateNode> nodeList = navigateUtils.calc(startLocNo, endLocNo, mapTypes, Utils.getShuttlePoints(shuttleNo, Utils.getLev(startLocNo)), whites);
        if (nodeList == null) {
@@ -133,15 +144,15 @@
            long startGetMoveCommandTime = System.currentTimeMillis();
            //获取移动命令
            ShuttleCommand command = shuttleThread.getMoveCommand(assignCommand.getDeviceTaskNo(), startCodeNum, distCodeNum, allDistance, ShuttleRunDirection.get(startPath.getDirection()).id.intValue(), runSpeed, nodes);
            ShuttleCommand command = shuttleThread.getMoveCommand(assignCommand.getDeviceTaskNo(), startCodeNum, distCodeNum, allDistance, ShuttleRunDirection.get(startPath.getDirection()).id.intValue(), runSpeed, nodes, shuttleDirectionReverse);
            News.info("[RCS Debug] getMoveCommand idx:{} time:{}", i, (System.currentTimeMillis() - startGetMoveCommandTime));
            if (i + 1 == data.size()) {
                long startGetInOutLiftTime = System.currentTimeMillis();
                if (moveType.equals("inLift")) {
                    command = shuttleThread.getMoveLiftCommand(assignCommand.getDeviceTaskNo(), startCodeNum, distCodeNum, allDistance, ShuttleRunDirection.get(startPath.getDirection()).id.intValue(), runSpeed, nodes, true);
                    command = shuttleThread.getMoveLiftCommand(assignCommand.getDeviceTaskNo(), startCodeNum, distCodeNum, allDistance, ShuttleRunDirection.get(startPath.getDirection()).id.intValue(), runSpeed, nodes, true, shuttleDirectionReverse);
                }else if (moveType.equals("outLift")) {
                    command = shuttleThread.getMoveLiftCommand(assignCommand.getDeviceTaskNo(), startCodeNum, distCodeNum, allDistance, ShuttleRunDirection.get(startPath.getDirection()).id.intValue(), runSpeed, nodes, false);
                    command = shuttleThread.getMoveLiftCommand(assignCommand.getDeviceTaskNo(), startCodeNum, distCodeNum, allDistance, ShuttleRunDirection.get(startPath.getDirection()).id.intValue(), runSpeed, nodes, false, shuttleDirectionReverse);
                }
                News.info("[RCS Debug] getInOutLiftTime idx:{} time:{}", i, (System.currentTimeMillis() - startGetInOutLiftTime));
            }
@@ -156,9 +167,8 @@
        //小车移动连续下发指令
        boolean shuttleMoveCommandsContinuously = false;
        Object object = redisUtil.get(RedisKeyType.SYSTEM_CONFIG_MAP.key);
        if (object != null) {
            HashMap<String, String> systemConfigMap = (HashMap<String, String>) object;
        if (systemConfigMapObj != null) {
            HashMap<String, String> systemConfigMap = (HashMap<String, String>) systemConfigMapObj;
            String shuttleMoveCommandsContinuouslyConfig = systemConfigMap.get("shuttleMoveCommandsContinuously");
            if (shuttleMoveCommandsContinuouslyConfig != null && shuttleMoveCommandsContinuouslyConfig.equals("Y")) {
                shuttleMoveCommandsContinuously = true;
src/main/java/com/zy/core/thread/ShuttleThread.java
@@ -81,9 +81,9 @@
    //***************获取命令*****************
    ShuttleCommand getMoveCommand(Integer taskNo, String startCodeNum, String distCodeNum, Integer allDistance, Integer runDirection, Integer runSpeed, List<NavigateNode> nodes);//获取移动命令
    ShuttleCommand getMoveCommand(Integer taskNo, String startCodeNum, String distCodeNum, Integer allDistance, Integer runDirection, Integer runSpeed, List<NavigateNode> nodes, Boolean shuttleDirectionReverse);//获取移动命令
    ShuttleCommand getMoveLiftCommand(Integer taskNo, String startCodeNum, String distCodeNum, Integer allDistance, Integer runDirection, Integer runSpeed, List<NavigateNode> nodes, Boolean moveIn);//获取移动命令
    ShuttleCommand getMoveLiftCommand(Integer taskNo, String startCodeNum, String distCodeNum, Integer allDistance, Integer runDirection, Integer runSpeed, List<NavigateNode> nodes, Boolean moveIn, Boolean shuttleDirectionReverse);//获取移动命令
    ShuttleCommand getLiftCommand(Integer taskNo, Boolean lift);//顶升命令 true=>顶升 false=>下降
src/main/java/com/zy/core/thread/impl/NyShuttleThread.java
@@ -989,7 +989,7 @@
    }
    @Override
    public ShuttleCommand getMoveCommand(Integer taskNo, String startCodeNum, String distCodeNum, Integer allDistance, Integer runDirection, Integer runSpeed, List<NavigateNode> nodes) {
    public ShuttleCommand getMoveCommand(Integer taskNo, String startCodeNum, String distCodeNum, Integer allDistance, Integer runDirection, Integer runSpeed, List<NavigateNode> nodes, Boolean shuttleDirectionReverse) {
        NavigateMapData navigateMapData = SpringUtils.getBean(NavigateMapData.class);
        NyShuttleHttpCommand httpStandard = getHttpStandard(deviceConfig.getDeviceNo(), taskNo);
        NyShuttleHttpCommand.NyRequest request = httpStandard.getRequest();
@@ -1009,8 +1009,14 @@
            HashMap<String, Object> data = new HashMap<>();
            String codeNum = NavigatePositionConvert.xyToPosition(node.getX(), node.getY(), node.getZ());
            Map<String, Object> nyNode = navigateNodeToNyPointNode(NavigatePositionConvert.codeToNode(codeNum));
            int xp = Integer.parseInt(String.valueOf(nyNode.get("y")));
            int yp = Integer.parseInt(String.valueOf(nyNode.get("x")));
            int xp = Integer.parseInt(String.valueOf(nyNode.get("x")));
            int yp = Integer.parseInt(String.valueOf(nyNode.get("y")));
            if (shuttleDirectionReverse) {
                xp = Integer.parseInt(String.valueOf(nyNode.get("y")));
                yp = Integer.parseInt(String.valueOf(nyNode.get("x")));
            }
            int z = Integer.parseInt(String.valueOf(nyNode.get("z")));
            List<MapNode> mapNodes = mapData.get(node.getX());
@@ -1040,7 +1046,7 @@
    }
    @Override
    public ShuttleCommand getMoveLiftCommand(Integer taskNo, String startCodeNum, String distCodeNum, Integer allDistance, Integer runDirection, Integer runSpeed, List<NavigateNode> nodes, Boolean moveIn) {
    public ShuttleCommand getMoveLiftCommand(Integer taskNo, String startCodeNum, String distCodeNum, Integer allDistance, Integer runDirection, Integer runSpeed, List<NavigateNode> nodes, Boolean moveIn, Boolean shuttleDirectionReverse) {
        NavigateMapData navigateMapData = SpringUtils.getBean(NavigateMapData.class);
        NyShuttleHttpCommand httpStandard = getHttpStandard(deviceConfig.getDeviceNo(), taskNo);
        NyShuttleHttpCommand.NyRequest request = httpStandard.getRequest();
@@ -1064,8 +1070,14 @@
            HashMap<String, Object> data = new HashMap<>();
            String codeNum = NavigatePositionConvert.xyToPosition(node.getX(), node.getY(), node.getZ());
            Map<String, Object> nyNode = navigateNodeToNyPointNode(NavigatePositionConvert.codeToNode(codeNum));
            int xp = Integer.parseInt(String.valueOf(nyNode.get("y")));
            int yp = Integer.parseInt(String.valueOf(nyNode.get("x")));
            int xp = Integer.parseInt(String.valueOf(nyNode.get("x")));
            int yp = Integer.parseInt(String.valueOf(nyNode.get("y")));
            if (shuttleDirectionReverse) {
                xp = Integer.parseInt(String.valueOf(nyNode.get("y")));
                yp = Integer.parseInt(String.valueOf(nyNode.get("x")));
            }
            int z = Integer.parseInt(String.valueOf(nyNode.get("z")));
            List<MapNode> mapNodes = mapData.get(node.getX());
@@ -1330,13 +1342,6 @@
    //WCS系统坐标转牛眼坐标
    private static int[] WCSXyzToNyXyz(int x, int y, int z) {
//        //WCS系统Y轴 => 牛眼X轴转换公式
//        int x1 = Math.abs(y - 61) + 11;
//        //WCS系统X轴 => 牛眼Y轴转换公式
//        int y1 = x + 10;
//        int x1 = x + 10;
//        int y1 = y + 10;
        LocMastService locMastService = SpringUtils.getBean(LocMastService.class);
        LocMast locMast = locMastService.selectOne(new EntityWrapper<LocMast>()
                .eq("row1", x)
@@ -1349,7 +1354,7 @@
        String qrCodeValue = locMast.getQrCodeValue();
        JSONObject data = JSON.parseObject(qrCodeValue);
        return new int[]{data.getInteger("y"), data.getInteger("x"), z};
        return new int[]{data.getInteger("x"), data.getInteger("y"), z};
    }
    @Override
src/main/webapp/views/admin/debugParam/debugParam.html
@@ -55,6 +55,12 @@
                        </div>
                        <div class="show-box">
                            <div>小车(x,y)命令运行方向颠倒</div>
                            <el-radio border v-model="codeMap.shuttleDirectionReverse" label="Y">开</el-radio>
                            <el-radio border v-model="codeMap.shuttleDirectionReverse" label="N">关</el-radio>
                        </div>
                        <div class="show-box">
                            <div>小车出提升机近点距离</div>
                            <el-input v-model="codeMap.shuttleOutLiftLocationDistance" style="width: 60%;"></el-input>
                        </div>
@@ -257,6 +263,7 @@
                            data.push('avoidInnerCircle');
                            data.push('avoidOuterCircle');
                            data.push('direction_map');
                            data.push('shuttleDirectionReverse');
                            data.push('shuttleOutLiftLocationDistance');
                            data.push('shuttleMoveCommandsContinuously');
                            data.push('trafficControlRestartCalcPath');