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;
|
import lombok.extern.slf4j.Slf4j;
|
|
@Slf4j
|
@Data
|
public class LiftProtocol implements Cloneable {
|
|
//**********************必须存在属性**********************
|
/**
|
* 提升机号
|
*/
|
private Integer liftNo;
|
|
/**
|
* 任务号
|
*/
|
private Integer taskNo;
|
|
/**
|
* 四向穿梭车号
|
*/
|
private Integer shuttleNo = 0;
|
|
/**
|
* 当前提升机状态(内部自我维护)
|
*/
|
private Integer protocolStatus = -1;
|
|
/**
|
* 当前提升机状态枚举
|
*/
|
private LiftProtocolStatusType protocolStatusType = LiftProtocolStatusType.NONE;
|
|
/**
|
* 模式 => 自动/手动
|
*/
|
private Boolean model;
|
|
/**
|
* 运行状态
|
*/
|
private Boolean run;
|
|
/**
|
* 就绪状态
|
*/
|
private Boolean ready;
|
|
/**
|
* 前超限
|
*/
|
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 String errorCode;
|
|
/**
|
* 任务地址
|
*/
|
private Short taskAddress;
|
|
/**
|
* 目的地址
|
*/
|
private Short distAddress;
|
|
/**
|
* 已完成的任务号
|
*/
|
private String completeTaskNo;
|
|
/**
|
* 层
|
*/
|
private Integer lev;
|
|
/**
|
* 作业标记
|
*/
|
private Boolean pakMk = false;
|
|
/**
|
* 指令下发时间
|
*/
|
private Long sendTime = 0L;
|
|
/**
|
* 日志采集时间
|
*/
|
private Long deviceDataLog = System.currentTimeMillis();
|
|
/**
|
* 设备信息
|
*/
|
private Device device;
|
|
/**
|
* 扩展字段
|
*/
|
private Object extend;
|
|
/**
|
* 设置提升机状态
|
*/
|
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 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;
|
}
|
|
}
|