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; //小车模式切换错误 private boolean err7; //其他未知异常 private boolean err8; private String errorRgv; 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