#
Junjie
2025-04-07 901f9ca15fb0ce3bcf2ebf956c569c260050c561
#
6个文件已修改
110 ■■■■ 已修改文件
zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/action/LiftAction.java 25 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/kernel/command/LiftCommandService.java 51 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/model/enums/LiftCommandModeType.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/utils/LiftDispatcher.java 22 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/utils/ShuttleDispatcher.java 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-asrs-wcs/src/main/resources/application.yml 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/action/LiftAction.java
@@ -6,6 +6,7 @@
import com.zy.asrs.wcs.core.model.command.*;
import com.zy.asrs.wcs.core.model.enums.LiftCommandModeType;
import com.zy.asrs.wcs.core.service.TaskService;
import com.zy.asrs.wcs.core.utils.LiftDispatcher;
import com.zy.asrs.wcs.core.utils.RedisUtil;
import com.zy.asrs.wcs.rcs.News;
import com.zy.asrs.wcs.rcs.cache.SlaveConnection;
@@ -33,6 +34,8 @@
    private TaskService taskService;
    @Autowired
    private BasLiftOptService basLiftOptService;
    @Autowired
    private LiftDispatcher liftDispatcher;
    public synchronized boolean assignWork(Device device, LiftAssignCommand assignCommand) {
        LiftThread liftThread = (LiftThread) SlaveConnection.get(SlaveType.Lift, device.getId().intValue());
@@ -109,9 +112,22 @@
                if (liftProtocol.getLev() == command.getTargetLev()) {
                    command.setComplete(true);
                }
            } else if (command.getMode() == LiftCommandModeType.PALLET_INOUT.id) {
                //托盘出入
                if (liftProtocol.getLev() == command.getTargetLev()) {
            } else if (command.getMode() == LiftCommandModeType.PALLET_IN.id) {
                //托盘入
                Integer target = liftDispatcher.getLiftLevLogic(liftThread.getDevice().getId().intValue(), command.getTargetLev());
                if (liftProtocol.getLev() == target) {
                    command.setComplete(true);
                }
                //判断提升机托盘是否存在
                if (!liftProtocol.getHasTray()) {
                    return false;
                }
            } else if (command.getMode() == LiftCommandModeType.PALLET_OUT.id) {
                //托盘出
                Integer target = liftDispatcher.getLiftLevLogic(liftThread.getDevice().getId().intValue(), command.getTargetLev());
                if (liftProtocol.getLev() == target) {
                    command.setComplete(true);
                }
@@ -119,7 +135,6 @@
                if (liftProtocol.getHasTray()) {
                    return false;
                }
            } else if (command.getMode() == LiftCommandModeType.RESET.id) {
                //复位
                command.setComplete(true);
@@ -203,7 +218,7 @@
        if (command.getMode() == LiftCommandModeType.MOVE.id) {
            response = liftThread.move(command);
        } else if (command.getMode() == LiftCommandModeType.PALLET_INOUT.id) {
        } else if (command.getMode() == LiftCommandModeType.PALLET_IN.id || command.getMode() == LiftCommandModeType.PALLET_OUT.id) {
            response = liftThread.palletInOut(command);
        } else if (command.getMode() == LiftCommandModeType.LOCK.id) {
            response = liftThread.lock(command);
zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/kernel/command/LiftCommandService.java
@@ -12,6 +12,7 @@
import com.zy.asrs.wcs.core.model.enums.MotionStsType;
import com.zy.asrs.wcs.core.service.MotionService;
import com.zy.asrs.wcs.core.service.TaskService;
import com.zy.asrs.wcs.core.utils.LiftDispatcher;
import com.zy.asrs.wcs.core.utils.Utils;
import com.zy.asrs.wcs.rcs.cache.SlaveConnection;
import com.zy.asrs.wcs.rcs.model.enums.LiftProtocolStatusType;
@@ -42,6 +43,8 @@
    private TaskService taskService;
    @Autowired
    private LiftAction liftAction;
    @Autowired
    private LiftDispatcher liftDispatcher;
    public Boolean accept(Motion motion) {
        Integer deviceNo = Integer.parseInt(motion.getDevice());
@@ -242,21 +245,22 @@
                    return false;
                }
                if (!liftProtocol.getLev().equals(Integer.valueOf(motion.getTarget()))) {
                Integer target = liftDispatcher.getLiftLevLogic(liftThread.getDevice().getId().intValue(), Integer.valueOf(motion.getTarget()));
                if (!liftProtocol.getLev().equals(target)) {
                    return false;
                }
                //判断提升机托盘是否存在
                if (liftProtocol.getHasTray()) {
                if (!liftProtocol.getHasTray()) {
                    return false;
                }
                //判断目标站是否有托盘
                Integer conveyorDeviceId = Integer.parseInt(motion.getDockNo());
                DevpThread devpThread = (DevpThread) SlaveConnection.get(SlaveType.Conveyor, conveyorDeviceId);
                if (devpThread == null) {
                    return false;
                }
//                //判断目标站是否有托盘
//                Integer conveyorDeviceId = Integer.parseInt(motion.getDockNo());
//                DevpThread devpThread = (DevpThread) SlaveConnection.get(SlaveType.Conveyor, conveyorDeviceId);
//                if (devpThread == null) {
//                    return false;
//                }
//                //*************此代码为标准版本代码********************
//                StaProtocol staProtocol = devpThread.getStation().get(motion.getTarDrt());
@@ -279,37 +283,6 @@
//                    }
//                }
//                //*************************************************
                //*************此代码为光泰定制代码********************
                ArrayList<Integer> staList = new ArrayList<>();
                staList.add(motion.getTarDrt());
                staList.add(31003);
                staList.add(31002);
                staList.add(31001);
                boolean check = false;
                for (Integer sta : staList) {
                    StaProtocol staProtocol = devpThread.getStation().get(sta);
                    if (staProtocol == null) {
                        continue;
                    }
                    if (!staProtocol.isAutoing()) {
                        continue;
                    }
                    if (!staProtocol.isLoading()) {
                        continue;
                    }
                    if (Integer.parseInt(motion.getTemp()) == staProtocol.getWorkNo().intValue()) {
                        check = true;
                        break;
                    }
                }
                if (!check) {
                    return false;
                }
                //*************************************************
                if (motion.getReleaseLift() == 1) {//释放提升机
                    task.setLiftNo(0);
zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/model/enums/LiftCommandModeType.java
@@ -4,7 +4,7 @@
    NONE(-1, "未知类型"),
    MOVE(1, "提升机升降"),
//    PALLET_INOUT(2, "托盘出入"),
    PALLET_INOUT(2, "托盘出入"),
    LOCK(3, "锁定提升机"),
    UNLOCK(4, "解锁提升机"),
    RESET(5, "复位"),
zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/utils/LiftDispatcher.java
@@ -208,15 +208,15 @@
        return standby.getLockPath$();
    }
    public Integer getLiftLevOffset(Integer deviceId,Integer lev) {
    public Integer getLiftLevOffset(Integer deviceId, Integer lev) {
        BasLift basLift = basLiftService.getOne(new LambdaQueryWrapper<BasLift>().eq(BasLift::getDeviceId, deviceId));
        if (basLift != null) {
            if(Cools.isEmpty(basLift.getLevOffset())) {
            if (Cools.isEmpty(basLift.getLevOffset())) {
                return lev;
            }
            List<BasLiftLevOffsetDto> levOffsetDtos = JSON.parseArray(basLift.getLevOffset(), BasLiftLevOffsetDto.class);
            for (BasLiftLevOffsetDto offsetDto : levOffsetDtos) {
                if(lev == offsetDto.getLogicLev()){
                if (lev == offsetDto.getLogicLev()) {
                    return offsetDto.getRealLev();
                }
            }
@@ -224,4 +224,20 @@
        return lev;
    }
    public Integer getLiftLevLogic(Integer deviceId, Integer lev) {
        BasLift basLift = basLiftService.getOne(new LambdaQueryWrapper<BasLift>().eq(BasLift::getDeviceId, deviceId));
        if (basLift != null) {
            if (Cools.isEmpty(basLift.getLevOffset())) {
                return lev;
            }
            List<BasLiftLevOffsetDto> levOffsetDtos = JSON.parseArray(basLift.getLevOffset(), BasLiftLevOffsetDto.class);
            for (BasLiftLevOffsetDto offsetDto : levOffsetDtos) {
                if (lev == offsetDto.getRealLev()) {
                    return offsetDto.getLogicLev();
                }
            }
        }
        return lev;
    }
}
zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/utils/ShuttleDispatcher.java
@@ -111,9 +111,11 @@
            resThread = this.searchDiffLevShuttle(diffLevDeviceMap, locNo, task);
        }
        Task result = generateMoveTask(resThread.getDevice(), locNo);
        if (result != null) {
            return resThread.getDevice();
        if (resThread != null) {
            Task result = generateMoveTask(resThread.getDevice(), locNo);
            if (result != null) {
                return resThread.getDevice();
            }
        }
        News.info("{}目标库位没有搜索到可用穿梭车", locNo);
zy-asrs-wcs/src/main/resources/application.yml
@@ -34,7 +34,7 @@
  redis:
    host: 127.0.0.1
    port: 6379
    database: 1
    database: 3
    password:
mybatis-plus: