package com.zy.core.model.protocol;
|
|
import com.zy.asrs.entity.BasRgv;
|
import com.zy.core.enums.RgvModeType;
|
import com.zy.core.enums.RgvStatusType;
|
import lombok.Data;
|
|
/**
|
* Created by vincent on 2020/8/7
|
*/
|
@Data
|
public class RgvProtocol {
|
|
private Integer RgvNo;
|
|
/**
|
* 1 = 手动模式
|
* 2 = 自动模式
|
* 3 = 电脑模式
|
*/
|
public Short mode = -1;
|
|
public RgvModeType modeType = RgvModeType.NONE;
|
|
/**
|
* RGV当前状态
|
* 0:空闲,无任务
|
* 1:作业中
|
* 2:报警
|
*/
|
public Short status = -1;
|
|
/**
|
* 状态枚举
|
*/
|
public RgvStatusType statusType = RgvStatusType.NONE;
|
|
/**
|
* 任务号
|
*/
|
public Long taskNo = 0L;
|
|
/**
|
* 有物
|
*/
|
public Short loaded = -1;//0 无物;1 有物
|
|
/**
|
* RGV当前位置
|
*/
|
public Long RgvPos = 0L;
|
|
/**
|
* RGV目的位置
|
*/
|
public Long RgvPosDestination = 0L;
|
|
/**
|
* 走行在定位
|
* 0 = 在定位
|
* 1 = 不在定位
|
*/
|
public Short walkPos;
|
|
/**
|
* 异常码
|
*/
|
public Short alarm;
|
|
/**
|
* X行走行速度m/min
|
*/
|
private Float xSpeed;
|
|
/**
|
* 累计走行距离km
|
*/
|
public Float xDistance;
|
|
/**
|
* 累计走行时长h
|
*/
|
public Float xDuration;
|
|
/**
|
* 车身
|
*/
|
public Long carBodyJiaoMing = 2000L;
|
|
/**
|
* 车身
|
*/
|
public Long carBodyKunPeng = 15000L;
|
|
/**
|
* 是否启用
|
*/
|
public boolean statusEnable;//0\1\2
|
|
|
|
// 急停
|
private boolean err1;
|
|
// 有物无资料
|
private boolean err2;
|
|
// 命令错误走行链条冲突
|
private boolean err3;
|
|
// 目标为超过走行极限
|
private boolean err4;
|
|
// 变频器异常
|
private boolean err5;
|
|
// 光电异常
|
private boolean err6;
|
|
public void setMode(Short mode) {
|
this.mode = mode;
|
this.modeType = RgvModeType.get(mode);
|
}
|
|
public void setMode(RgvModeType type) {
|
this.modeType = type;
|
this.mode = RgvModeType.get(type).id.shortValue();
|
}
|
|
public void setStatus(Short status){
|
this.status = status;
|
this.statusType = RgvStatusType.get(status);
|
}
|
|
public void setStatus(RgvStatusType type){
|
this.statusType = type;
|
this.status = RgvStatusType.get(type).id.shortValue();
|
}
|
|
public BasRgv toSqlModel(BasRgv basRgv){
|
if (alarm!=null) {
|
basRgv.setRgvErr(alarm.longValue());
|
}
|
basRgv.setWrkNo1(taskNo.intValue());
|
return basRgv;
|
}
|
|
public long getRgvPosDestinationOrPos(boolean sign){
|
if (!sign){
|
return RgvPosDestination>RgvPos? RgvPosDestination:RgvPos;
|
} else {
|
return RgvPosDestination<RgvPos? RgvPosDestination:RgvPos;
|
}
|
}
|
|
public void setxSpeed(Short xSpeed) {
|
this.xSpeed = Float.valueOf(xSpeed);
|
}
|
|
public void setxDistance(Short xDistance) {
|
this.xDistance = Float.valueOf(xDistance);
|
}
|
|
public void setxDuration(Short xDuration) {
|
this.xDuration = Float.valueOf(xDuration);
|
}
|
|
public int getAlarm$(){
|
if (err1){
|
return 1;
|
}
|
if (err2){
|
return 2;
|
}
|
if (err3){
|
return 3;
|
}
|
if (err4){
|
return 4;
|
}
|
if (err5){
|
return 5;
|
}
|
if (err6){
|
return 6;
|
}
|
return 0;
|
}
|
public String getAlarmM(){
|
switch (getAlarm$()){
|
case 1:
|
return "急停";
|
case 2:
|
return "有物无资料";
|
case 3:
|
return "命令错误走行链条冲突";
|
case 4:
|
return "目标为超过走行极限";
|
case 5:
|
return "变频器异常";
|
case 6:
|
return "光电异常";
|
}
|
return "正常";
|
}
|
|
}
|