自动化立体仓库 - WCS系统
#
Junjie
2023-10-04 d9271883338de97164a36ea9a1e5fc7eef73e64d
src/main/java/com/zy/core/model/protocol/LiftProtocol.java
@@ -5,8 +5,6 @@
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import java.util.Date;
/**
 * 提升机
 */
@@ -18,11 +16,6 @@
     * 提升机号
     */
    private Short liftNo;
    /**
     * 提升机内部二维码
     */
    private Short barcode = 1699;
    /**
     * 任务号
@@ -45,189 +38,96 @@
    private LiftProtocolStatusType protocolStatusType = LiftProtocolStatusType.IDLE;
    /**
     * 模式
     */
    private Boolean model;
    /**
     * 忙闲
     */
    private Boolean busy;
    /**
     * 前超限
     */
    private Boolean frontOverrun;
    /**
     * 后超限
     */
    private Boolean backOverrun;
    /**
     * 左超限
     */
    private Boolean leftOverrun;
    /**
     * 右超限
     */
    private Boolean rightOverrun;
    /**
     * 超高
     */
    private Boolean overHeight;
    /**
     * 超重
     */
    private Boolean overWeight;
    /**
     * 有托盘
     */
    private Boolean hasTray;
    /**
     * 有小车
     */
    private Boolean hasCar;
    /**
     * 设备故障
     */
    private Boolean deviceError;
    /**
     * 任务地址
     */
    private Short taskAddress;
    /**
     * 目的地址
     */
    private Short distAddress;
    /**
     * 已完成的任务号
     */
    private Short completeTaskNo;
    /**
     * 层
     */
    private Short lev;
    /**
     * 提升机锁定
     */
    private Boolean liftLock;
    /**
     * 位置到达反馈
     */
    private Short positionArrivalFeedback;
    /**
     * 准备就绪
     * 就绪为1,未就绪为0
     */
    private Boolean ready;
    /**
     * 运行中
     * 运行中为1,未运行为0
     */
    private Boolean running;
    /**
     * 联机/单机
     * 联机为1,单机为0
     */
    private Boolean mode;
    /**
     * 输送线前端光电有货
     * 有货为1,无货为0(前端指靠近货架侧)
     */
    private Boolean lineFrontHasStock;
    /**
     * 输送线正转反馈
     * 正转运行为1,否则为0
     */
    private Boolean forwardRotationFeedback;
    /**
     * 输送线反转反馈
     * 反转运行为1,否则为0
     */
    private Boolean reverseFeedback;
    /**
     * 输送线电机过载
     * 过载为0,正常为1
     */
    private Boolean motorOverload;
    /**
     * 输送线末端光电有货
     * 有货为1,无货为0
     */
    private Boolean lineEndHasStock;
    /**
     * 进输送线卡托盘报警
     * 报警为1,未报警为0
     */
    private Boolean inConveyLineCardTrayAlarm;
    /**
     * 出输送线卡托盘报警
     * 报警为1,未报警为0
     */
    private Boolean outConveyLineCardTrayAlarm;
    /**
     * 平台位置偏差报警
     * 报警为1,未报警为0
     */
    private Boolean platPositionDeviationAlarm;
    /**
     * 平台扭矩偏差报警
     * 报警为1,未报警为0
     */
    private Boolean platTorqueDeviationAlarm;
    /**
     * 平台四向车检测
     * 有车为1,无车为0
     */
    private Boolean platShuttleCheck;
    /**
     * 未就绪状态
     * 1.   不在指定层
     * 2.   四轴不同步
     * 3.   平台前限光电被挡到(靠近货架)
     * 4.   平台后限光电被挡到(远离货架)
     * 5.   平台上限位报警
     * 6.   平台下限位报警
     * 7.   电柜急停报警
     * 8.   输送线前限位被挡到(靠近货架)
     * 9.   输送线后限位被挡到(远离货架)
     * 10.   触摸屏紧急停止被按下
     * 11.   四轴动力线断线
     * 12.   单机模式
     * 13.   四轴报警
     * 14.   位置偏差过大
     * 15.   扭矩偏差过大
     * 16.   输送线过载
     * 17.   进提升机卡托盘
     * 18.   出提升机卡托盘
     */
    private Short notReady;
    /**
     * 伺服1错误
     */
    private Short servoError1;
    /**
     * 伺服2错误
     */
    private Short servoError2;
    /**
     * 伺服3错误
     */
    private Short servoError3;
    /**
     * 伺服4错误
     */
    private Short servoError4;
    /**
     * 提升机实际速度反馈
     */
    private Short liftActualSpeed;
    /**
     * 作业标记
     */
    private Boolean pakMk = true;
    private Boolean pakMk = false;
    /**
     * 四向穿梭车调度提升机时,需要锁定此标记
     * 独占令牌
     * 未被任务占据,令牌为0
     * 被任务占据,将任务号赋值给令牌
     */
    private Boolean securityMk = false;
    private Integer token = 0;
    /**
     * 任务命令
     */
    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;
    }
    /**
     * 设置提升机状态
@@ -246,67 +146,67 @@
    }
    // 是否处于空闲待命状态
    public Boolean isIdle(Short taskNo) {
        if(this.busy == null
                || this.model == null
                || this.deviceError == null
                || this.pakMk == null
                || this.token == null
        ){
            return false;
        }
        boolean res =
//                (this.taskNo.equals(this.completeTaskNo) || this.taskNo.intValue() == taskNo.intValue())
                !this.busy
                && this.model
                && !this.pakMk
                && !this.deviceError
                && this.protocolStatusType.equals(LiftProtocolStatusType.IDLE)
                ;
        return res;
    }
    // 是否处于空闲待命状态
    public Boolean isIdle() {
        if(this.taskNo == null
                || this.liftLock == null
                || this.ready == null
                || this.running == null
                || this.mode == null
                || this.busy == null
                || this.model == null
                || this.deviceError == null
                || this.pakMk == null
                || this.token == null
        ){
            return false;
        }
        boolean res =
//                this.taskNo.equals(this.completeTaskNo)
                !this.busy
                && this.model
                && !this.pakMk
                && !this.deviceError
                && this.token == 0
                && this.protocolStatusType.equals(LiftProtocolStatusType.IDLE)
                ;
        return res;
    }
    // 是否处于空闲待命状态,不判断任务号
    public Boolean isIdleNoTask() {
        if(this.busy == null
                || this.model == null
                || this.deviceError == 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
        boolean res = !this.busy
                && this.model
                && !this.pakMk
                && !this.deviceError
                ;
        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;
    }