#
Junjie
2025-07-06 0d04bc5d8080b82338302fba0a59fccff2eaedfc
zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/action/LiftAction.java
@@ -1,8 +1,11 @@
package com.zy.asrs.wcs.core.action;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.zy.asrs.wcs.core.entity.Task;
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.RedisUtil;
import com.zy.asrs.wcs.rcs.News;
import com.zy.asrs.wcs.rcs.cache.SlaveConnection;
@@ -22,6 +25,8 @@
    @Autowired
    private RedisUtil redisUtil;
    @Autowired
    private TaskService taskService;
    public synchronized boolean assignWork(Device device, LiftAssignCommand assignCommand) {
        LiftThread liftThread = (LiftThread) SlaveConnection.get(SlaveType.Lift, device.getId().intValue());
@@ -50,6 +55,11 @@
    public synchronized boolean executeWork(Device device, Integer taskNo) {
        Object obj = redisUtil.get(DeviceRedisConstant.LIFT_WORK_FLAG + taskNo);
        if (obj == null) {
            return false;
        }
        Task task = taskService.getOne(new LambdaQueryWrapper<Task>().eq(Task::getTaskNo, taskNo));
        if (task == null) {
            return false;
        }
@@ -98,6 +108,25 @@
                if (liftProtocol.getLev() == command.getTargetLev()) {
                    command.setComplete(true);
                }
                if (task.getTaskSts() < 100) {//入库判断托盘是否进入提升机
                    if (!liftProtocol.getHasTray()) {
                        return false;
                    }
                } else if (task.getTaskSts() >= 100 && task.getTaskSts() < 200) {//出库判断托盘是否离开提升机
                    if (liftProtocol.getHasTray()) {
                        return false;
                    }
                }
            } else if (command.getMode() == LiftCommandModeType.RESET.id) {
                //复位
                command.setComplete(true);
            } else if (command.getMode() == LiftCommandModeType.LOCK.id) {
                //复位
                command.setComplete(true);
            } else if (command.getMode() == LiftCommandModeType.UNLOCK.id) {
                //复位
                command.setComplete(true);
            }
            // 更新redis数据