自动化立体仓库 - WCS系统
Junjie
2023-06-17 928bc386bea03b9d3157e6d66dcb7afc843e9964
src/main/java/com/zy/core/model/protocol/LiftProtocol.java
@@ -1,7 +1,11 @@
package com.zy.core.model.protocol;
import com.zy.core.enums.LiftProtocolStatusType;
import com.zy.core.model.command.LiftAssignCommand;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import java.util.Date;
/**
 * 提升机
@@ -16,9 +20,29 @@
    private Short liftNo;
    /**
     * 提升机内部二维码
     */
    private Short barcode = 1699;
    /**
     * 任务号
     */
    private Short taskNo = 0;
    /**
     * 四向穿梭车号
     */
    private Short shuttleNo = 0;
    /**
     * 当前提升机状态(内部自我维护)
     */
    private Integer protocolStatus = 1;
    /**
     * 当前提升机状态枚举
     */
    private LiftProtocolStatusType protocolStatusType = LiftProtocolStatusType.IDLE;
    /**
     * 层
@@ -161,8 +185,129 @@
     */
    private Short liftActualSpeed;
    /**
     * 作业标记
     */
    private Boolean pakMk = true;
    /**
     * 四向穿梭车调度提升机时,需要锁定此标记
     */
    private Boolean securityMk = false;
    /**
     * 任务命令
     */
    private LiftAssignCommand assignCommand;
    /**
     * 出入库模式,1:入库,2:出库
     */
    private Integer outInModel;
    /**
     * 出入库模式起始站点
     */
    private Integer startSta;
    /**
     * 出入库模式目标站点
     */
    private Integer distSta;
    /**
     * 出入库模式步数
     */
    private Integer outInModelStep;
    /**
     * 工作时间
     */
    private Date wrkTime;
    public Short getLiftLockShortValue() {
        return liftLock ? (short) 1 : (short) 0;
    }
    /**
     * 设置提升机状态
     */
    public void setProtocolStatus(Integer status) {
        this.protocolStatus = status;
        this.protocolStatusType = LiftProtocolStatusType.get(status);
    }
    /**
     * 设置提升机状态
     */
    public void setProtocolStatus(LiftProtocolStatusType status) {
        this.protocolStatus = status.id;
        this.protocolStatusType = status;
    }
    // 是否处于空闲待命状态
    public Boolean isIdle() {
        if(this.taskNo == null
                || this.liftLock == null
                || this.ready == null
                || this.running == null
                || this.mode == null
                || this.pakMk == null
        ){
            return false;
        }
        boolean res = this.taskNo == 0
                && !this.liftLock
//                && this.ready
                && !this.running
                && this.mode
                && this.pakMk.equals(true)
                && !this.securityMk
                ;
        return res;
    }
    public void setPositionArrivalFeedback(Short position) {
        Short lev = 1;
        switch (position) {
            case 1:
                lev = 1;
                break;
            case 4:
                lev = 2;
                break;
            case 8:
                lev = 3;
                break;
            case 16:
                lev = 4;
                break;
        }
        this.lev = lev;//层高
        this.positionArrivalFeedback = position;//位置到达反馈
    }
    public Integer getPositionArrivalFeedback$() {
        if (this.positionArrivalFeedback == null) {
            return null;
        }
        switch (this.positionArrivalFeedback) {
            case 1:
                return 1;
            case 2:
                return 2;
            case 4:
                return 3;
            case 8:
                return 4;
            case 16:
                return 5;
        }
        return null;
    }
}