自动化立体仓库 - WCS系统
#
Junjie
2025-03-29 d4c18c350c1607e09305bcf71befbefa0b5b194a
src/main/java/com/zy/core/model/protocol/ForkLiftProtocol.java
@@ -1,11 +1,14 @@
package com.zy.core.model.protocol;
import com.core.common.Cools;
import com.core.common.SpringUtils;
import com.zy.asrs.entity.BasLiftErr;
import com.zy.asrs.service.BasLiftErrService;
import com.zy.common.utils.RedisUtil;
import com.zy.core.enums.ForkLiftIoModeType;
import com.zy.core.enums.ForkLiftProtocolStatusType;
import com.zy.core.enums.ForkLiftTaskModeType;
import com.zy.core.enums.RedisKeyType;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
@@ -22,7 +25,7 @@
    private Integer liftNo;
    /**
     * 模式0单机 1联机
     * 模式0手动 1单机 2联机
     */
    private Integer model;
@@ -30,6 +33,11 @@
     * 任务号
     */
    private Integer taskNo = 0;
    /**
     * PLC任务号
     */
    private Integer wrkNo;
    /**
     * 任务状态
@@ -44,7 +52,7 @@
    /**
     * 任务模式
     */
    private Integer mode = ForkLiftTaskModeType.NONE.id;
    private Integer taskMode = ForkLiftTaskModeType.NONE.id;
    /**
     * 任务模式枚举
@@ -115,17 +123,17 @@
    /**
     * 设置任务模式
     */
    public void setMode(Integer mode) {
        this.mode = mode;
        this.modeType = ForkLiftTaskModeType.get(mode);
    public void setTaskMode(Integer taskMode) {
        this.taskMode = taskMode;
        this.modeType = ForkLiftTaskModeType.get(taskMode);
    }
    /**
     * 设置任务模式
     */
    public void setMode(ForkLiftTaskModeType mode) {
        this.mode = mode.id;
        this.modeType = mode;
    public void setMode(ForkLiftTaskModeType taskMode) {
        this.taskMode = taskMode.id;
        this.modeType = taskMode;
    }
    /**
@@ -159,6 +167,65 @@
        return basLiftErr.getErrName();
    }
    public Integer getTaskNo() {
        RedisUtil redisUtil = SpringUtils.getBean(RedisUtil.class);
        if (null != redisUtil) {
            Object o = redisUtil.get(RedisKeyType.FORK_LIFT_FLAG.key + this.liftNo);
            if (!Cools.isEmpty(o)) {
                this.taskNo = Integer.parseInt(String.valueOf(o));
            }
        }
        return this.taskNo == null ? 0 : this.taskNo;
    }
    public synchronized void setSyncTaskNo(Integer taskNo) {
        RedisUtil redisUtil = SpringUtils.getBean(RedisUtil.class);
        if (null != redisUtil) {
            redisUtil.set(RedisKeyType.FORK_LIFT_FLAG.key + this.liftNo, taskNo);
            this.taskNo = taskNo;
        }
    }
    public String getModel$() {
        if (this.model == null) {
            return "";
        }
        String name = "";
        if (this.model == 0) {
            name = "手动";
        } else if (this.model == 1) {
            name = "单机";
        }else if (this.model == 2) {
            name = "联机";
        }
        return name;
    }
    public String getProtocolStatus$() {
        if (this.protocolStatus == null) {
            return "";
        }
        return ForkLiftProtocolStatusType.get(this.protocolStatus).desc;
    }
    public String getTaskMode$() {
        if (this.taskMode == null) {
            return "";
        }
        return ForkLiftTaskModeType.get(this.taskMode).desc;
    }
    public String getIOMode$() {
        if (this.iOMode == null) {
            return "";
        }
        return ForkLiftIoModeType.get(this.iOMode).desc;
    }
    @Override
    public ForkLiftProtocol clone() {
        try {