自动化立体仓库 - WCS系统
Junjie
2024-11-22 ab39e1f220db502ed235b0fca3492ff7fdbfe308
src/main/java/com/zy/core/model/protocol/LiftProtocol.java
@@ -1,5 +1,8 @@
package com.zy.core.model.protocol;
import com.core.common.SpringUtils;
import com.zy.asrs.entity.BasLiftErr;
import com.zy.asrs.service.BasLiftErrService;
import com.zy.core.enums.LiftProtocolStatusType;
import com.zy.core.model.command.LiftAssignCommand;
import lombok.Data;
@@ -93,6 +96,11 @@
    private Boolean deviceError;
    /**
     * 故障码
     */
    private Short errorCode;
    /**
     * 任务地址
     */
    private Short taskAddress;
@@ -115,12 +123,29 @@
    /**
     * 作业标记
     */
    private Boolean pakMk = true;
    private Boolean pakMk = false;
    /**
     * 独占令牌
     * 未被任务占据,令牌为0
     * 被任务占据,将任务号赋值给令牌
     */
    private Integer token = 0;
    /**
     * 任务命令
     */
    private LiftAssignCommand assignCommand;
    /**
     * 指令下发时间
     */
    private Long sendTime = 0L;
    /**
     * 日志采集时间
     */
    private Long deviceDataLog = System.currentTimeMillis();
    /**
     * 设置提升机状态
@@ -140,20 +165,22 @@
    // 是否处于空闲待命状态
    public Boolean isIdle(Short taskNo) {
        if(this.taskNo == null
                || this.busy == null
        if(this.busy == null
                || this.model == null
                || this.deviceError == null
                || this.pakMk == null
                || this.token == null
        ){
            return false;
        }
        boolean res = (this.taskNo == 0 || this.taskNo.intValue() == taskNo.intValue())
                && !this.busy
        boolean res =
//                (this.taskNo.equals(this.completeTaskNo) || this.taskNo.intValue() == taskNo.intValue())
                !this.busy
                && this.model
                && this.pakMk.equals(true)
                && !this.pakMk
                && !this.deviceError
                && this.protocolStatusType.equals(LiftProtocolStatusType.IDLE)
                ;
        return res;
    }
@@ -165,23 +192,26 @@
                || this.model == null
                || this.deviceError == null
                || this.pakMk == null
                || this.token == null
        ){
            return false;
        }
        boolean res = this.taskNo == 0
                && !this.busy
        boolean res =
//                this.taskNo.equals(this.completeTaskNo)
                !this.busy
                && this.model
                && this.pakMk.equals(true)
                && !this.pakMk
                && !this.deviceError
                && this.token == 0
                && this.protocolStatusType.equals(LiftProtocolStatusType.IDLE)
                ;
        return res;
    }
    // 是否处于空闲待命状态,不判断任务号
    public Boolean isIdleNoTask() {
        if(this.taskNo == null
                || this.busy == null
        if(this.busy == null
                || this.model == null
                || this.deviceError == null
                || this.pakMk == null
@@ -191,11 +221,23 @@
        boolean res = !this.busy
                && this.model
                && this.pakMk.equals(true)
                && !this.pakMk
                && !this.deviceError
                ;
        return res;
    }
    public String getErrCode$() {
        if (this.errorCode == null) {
            return "";
        }
        BasLiftErrService basLiftErrService = SpringUtils.getBean(BasLiftErrService.class);
        BasLiftErr basLiftErr = basLiftErrService.selectById(this.errorCode);
        if (basLiftErr == null) {
            return String.valueOf(this.errorCode);
        }
        return basLiftErr.getErrName();
    }
}