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;
|
|
public RgvModeType modeType;
|
|
/**
|
* RGV当前状态
|
* 0:空闲,无任务
|
* 1:作业中
|
* 2:报警
|
*/
|
public Short status;
|
|
/**
|
* 状态枚举
|
*/
|
public RgvStatusType statusType;
|
|
/**
|
* 工位1任务号
|
*/
|
public Short taskNo1 = 0;
|
|
/**
|
* RGV工位1当前状态
|
* 0:空闲,无任务
|
* 11:取货中
|
* 12:放货中
|
* 10:任务完成等待WCS确认
|
*/
|
public Short status1;
|
|
/**
|
* 状态枚举
|
*/
|
public RgvStatusType statusType1;
|
|
/**
|
* 工位1有物
|
*/
|
public Short loaded1;
|
|
/**
|
* RGV当前位置
|
*/
|
public Short RgvPos;
|
|
/**
|
* 走行在定位
|
* 0 = 在定位
|
* 1 = 不在定位
|
*/
|
public Short walkPos;
|
|
////////////////////// 工位2定义 //////////////////////////////////////////////////
|
/**
|
* 工位2任务号
|
*/
|
public Short taskNo2 = 0;
|
|
/**
|
* RGV工位2当前状态
|
* 0:空闲,无任务
|
* 11:取货中
|
* 12:放货中
|
* 10:任务完成等待WCS确认
|
*/
|
public Short status2;
|
|
/**
|
* 状态枚举
|
*/
|
public RgvStatusType statusType2;
|
|
/**
|
* 工位2有物
|
*/
|
public Short loaded2;
|
///////////////////////////////////////////////////////////////////////////////////////
|
|
/**
|
* 异常码
|
*/
|
public Short alarm;
|
|
/**
|
* 心跳指令 1-2每秒切换一次
|
*/
|
public Short heart;
|
|
private Short temp1;
|
|
private Short temp2;
|
|
private Short temp3;
|
|
private Short temp4;
|
|
private Short temp5;
|
|
/**
|
* X行走行速度m/min
|
*/
|
private Float xSpeed;
|
|
/**
|
* 堆垛机累计走行距离km
|
*/
|
public Float xDistance;
|
|
/**
|
* 堆垛机累计走行时长h
|
*/
|
public Float xDuration;
|
|
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 void setStatus1(Short status1){
|
this.status1 = status1;
|
this.statusType1 = RgvStatusType.get(status1);
|
}
|
|
public void setStatus1(RgvStatusType type1){
|
this.statusType1 = type1;
|
this.status1 = RgvStatusType.get(type1).id.shortValue();
|
}
|
|
public void setStatus2(Short status2){
|
this.status2 = status2;
|
this.statusType2 = RgvStatusType.get(status2);
|
}
|
|
public void setStatus2(RgvStatusType type2){
|
this.statusType2 = type2;
|
this.status2 = RgvStatusType.get(type2).id.shortValue();
|
}
|
|
/**
|
* 最近一次入出库类型
|
* I:入库
|
* O:出库
|
*/
|
private String lastIo = "I";
|
|
|
public BasRgv toSqlModel(BasRgv basRgv){
|
if (alarm!=null) {
|
basRgv.setRgvErr(alarm.longValue());
|
}
|
basRgv.setWrkNo1(taskNo1.intValue());
|
basRgv.setWrkNo2(taskNo2.intValue());
|
return basRgv;
|
}
|
|
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 Integer getRgvPosI(){
|
//需要根据现场改造 根据读到的值获取对应站点位置
|
if (RgvPos==null) return 0;
|
return RgvPos.intValue();
|
}
|
|
}
|