#
Junjie
2024-04-23 2d07710d47f88a1d76e12cda1144cb2f288bf5ae
zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/rcs/model/protocol/LiftProtocol.java
@@ -1,5 +1,9 @@
package com.zy.asrs.wcs.rcs.model.protocol;
import com.zy.asrs.framework.common.Cools;
import com.zy.asrs.framework.common.SpringUtils;
import com.zy.asrs.wcs.core.utils.RedisUtil;
import com.zy.asrs.wcs.rcs.constant.DeviceRedisConstant;
import com.zy.asrs.wcs.rcs.entity.Device;
import com.zy.asrs.wcs.rcs.model.enums.LiftProtocolStatusType;
import lombok.Data;
@@ -7,18 +11,18 @@
@Slf4j
@Data
public class LiftProtocol {
public class LiftProtocol implements Cloneable {
    //**********************必须存在属性**********************
    /**
     * 提升机号
     */
    private String liftNo;
    private Integer liftNo;
    /**
     * 任务号
     */
    private String taskNo;
    private Integer taskNo;
    /**
     * 四向穿梭车号
@@ -121,6 +125,11 @@
    private Boolean pakMk = false;
    /**
     * 指令下发时间
     */
    private Long sendTime = 0L;
    /**
     * 日志采集时间
     */
    private Long deviceDataLog = System.currentTimeMillis();
@@ -129,6 +138,35 @@
     * 设备信息
     */
    private Device device;
    /**
     * 扩展字段
     */
    private Object extend;
    public String getRun$() {
        if (this.run == null) {
            return "未知";
        }
        return this.run ? "运行中" : "空闲";
    }
    public String getReady$() {
        if (this.ready == null) {
            return "未知";
        }
        return this.ready ? "就绪" : "未就绪";
    }
    public String getModel$() {
        if (this.model == null) {
            return "未知";
        }
        return this.model ? "自动" : "手动";
    }
    /**
     * 设置提升机状态
@@ -146,4 +184,33 @@
        this.protocolStatusType = status;
    }
    public synchronized void setTaskNo(Integer taskNo) {
        RedisUtil redisUtil = SpringUtils.getBean(RedisUtil.class);
        if (null != redisUtil) {
            redisUtil.set(DeviceRedisConstant.LIFT_FLAG + this.liftNo, taskNo);
            this.taskNo = taskNo;
        }
    }
    public Integer getTaskNo() {
        RedisUtil redisUtil = SpringUtils.getBean(RedisUtil.class);
        if (null != redisUtil) {
            Object o = redisUtil.get(DeviceRedisConstant.LIFT_FLAG + this.liftNo);
            if (!Cools.isEmpty(o)) {
                this.taskNo = Integer.valueOf(String.valueOf(o));
            }
        }
        return this.taskNo == null ? 0 : this.taskNo;
    }
    @Override
    public LiftProtocol clone() {
        try {
            return (LiftProtocol) super.clone();
        } catch (CloneNotSupportedException e) {
            e.printStackTrace();
        }
        return null;
    }
}