#
Junjie
2025-01-08 0bd50999a23853adefa7a8ad72a3f777ea189097
src/main/java/com/zy/common/utils/NavigateMapData.java
@@ -5,9 +5,18 @@
import com.zy.asrs.entity.BasMap;
import com.zy.asrs.entity.LocMast;
import com.zy.asrs.service.LocMastService;
import com.zy.asrs.utils.Utils;
import com.zy.common.model.MapNode;
import com.zy.common.model.enums.NavigationMapType;
import com.zy.core.cache.SlaveConnection;
import com.zy.core.enums.MapNodeType;
import com.zy.core.enums.RedisKeyType;
import com.zy.core.enums.SlaveType;
import com.zy.core.model.ForkLiftSlave;
import com.zy.core.model.protocol.ForkLiftStaProtocol;
import com.zy.core.properties.SlaveProperties;
import com.zy.core.thread.ForkLiftThread;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.io.ClassPathResource;
import org.springframework.stereotype.Component;
@@ -20,6 +29,9 @@
 */
@Component
public class NavigateMapData {
    @Autowired
    private SlaveProperties slaveProperties;
    public int[][] getData(Integer lev, Integer mapType, List<int[]> whitePoints, List<int[]> shuttlePoints) {
        try {
@@ -295,12 +307,12 @@
                        || locMast.getLocSts().equals("R")
                        || locMast.getLocSts().equals("P")
                ) {
                    mapNode.setValue(-1);//禁用节点
                    mapNode.setValue(MapNodeType.DISABLE.id);//禁用节点
                }
            } else if (mapType == NavigationMapType.NORMAL.id) {
                //过滤库位状态X
                if (locMast.getLocSts().equals("X")) {
                    mapNode.setValue(-1);//禁用节点
                    mapNode.setValue(MapNodeType.DISABLE.id);//禁用节点
                }
            }
@@ -316,7 +328,7 @@
                int y = points[1];
                List<MapNode> list = lists.get(x);
                MapNode mapNode = list.get(y);
                mapNode.setValue(66);//设置为车辆代码66
                mapNode.setValue(MapNodeType.CAR.id);//设置为车辆代码66
                //更新list
                list.set(y, mapNode);
                lists.set(x, list);
@@ -343,6 +355,38 @@
            }
        }
        //加载货叉提升机放货点位数据
        for (ForkLiftSlave forkLiftSlave : slaveProperties.getForkLift()) {
            ForkLiftThread forkLiftThread = (ForkLiftThread) SlaveConnection.get(SlaveType.ForkLift, forkLiftSlave.getId());
            if (forkLiftThread == null) {
                continue;
            }
            for (ForkLiftStaProtocol staProtocol : forkLiftThread.getForkLiftStaProtocols()) {
                int row = Utils.getRow(staProtocol.getLocNo());
                int bay = Utils.getBay(staProtocol.getLocNo());
                List<MapNode> list = lists.get(row);
                MapNode mapNode = list.get(bay);
                if (mapType == NavigationMapType.DFX.id) {
                    //车辆有货
                    if (staProtocol.getHasTray() != null && staProtocol.getHasTray()) {
                        mapNode.setValue(MapNodeType.DISABLE.id);
                    }
                }else {
                    if (staProtocol.getHasCar() != null && staProtocol.getHasCar()) {
                        mapNode.setValue(MapNodeType.CAR.id);
                    }
                }
                //更新list
                list.set(bay, mapNode);
                lists.set(row, list);
            }
        }
        return lists;
    }