package com.zy.core.model.protocol; import com.zy.core.enums.DualCrnForkPosType; import com.zy.core.enums.DualCrnLiftPosType; import com.zy.core.enums.DualCrnModeType; import com.zy.core.enums.DualCrnStatusType; import lombok.Data; import java.util.Map; @Data public class DualCrnProtocol { private Integer crnNo; /** * 1 = 手动模式 * 2 = 自动模式 * 3 = 电脑模式 */ public Integer mode; public DualCrnModeType modeType; /** * 异常码 */ public Integer alarm; /** * 工位1任务号 */ public Integer taskNo = 0; /** * 工位2任务号 */ public Integer taskNoTwo = 0; /** * 工位1当前状态 * 0:空闲,无任务 * 1:取货定位中 * 2:取货中 * 3:取货完成,放货定位中 * 4:放货中 * 5:回原点中 * 6:反原点 * 7:库位移位 * 90:任务完成等待WCS确认 * 99:报警 */ public Integer status; /** * 工位2当前状态 */ public Integer statusTwo; /** * 工位1状态枚举 */ public DualCrnStatusType statusType; /** * 工位2状态枚举 */ public DualCrnStatusType statusTypeTwo; /** * 工位1堆垛机当前列号 */ public Integer bay; /** * 工位2堆垛机当前列号 */ public Integer bayTwo; /** * 工位1堆垛机当前层号 */ public Integer level; /** * 工位2堆垛机当前层号 */ public Integer levelTwo; /** * 工位1当前货叉位置 * 0 = 货叉原位 * 1 = 货叉在左侧 * 2 = 货叉在右侧 */ public Integer forkPos; /** * 工位2当前货叉位置 * 0 = 货叉原位 * 1 = 货叉在左侧 * 2 = 货叉在右侧 */ public Integer forkPosTwo; public DualCrnForkPosType forkPosType; public DualCrnForkPosType forkPosTypeTwo; /** * 当前载货台位置 * 0 = 下定位 * 1 = 上定位 */ public Integer liftPos; public Integer liftPosTwo; public DualCrnLiftPosType liftPosType; public DualCrnLiftPosType liftPosTypeTwo; /** * 走行在定位 * 0 = 在定位 * 1 = 不在定位 */ public Integer walkPos; public Integer walkPosTwo; /** * 载货台有物 */ public Integer loaded; public Integer loadedTwo; /** * 任务接收状态 * 0 = 未接收 * 1 = 已接收 */ public Integer taskReceive; public Integer taskReceiveTwo; private Integer temp1; private Integer temp2; private Integer temp3; private Integer temp4; /** * X行走线速度m/min */ private Integer xSpeed; /** * Y行走线速度m/min */ private Integer ySpeed; /** * Z行走线速度m/min */ private Integer zSpeed; /** * 堆垛机累计走行距离km */ public Integer xDistance; /** * 堆垛机累计升降距离km */ public Integer yDistance; /** * 堆垛机累计走行时长h */ public Integer xDuration; /** * 堆垛机累计升降时长h */ public Integer yDuration; /** * 最近一次入出库类型 * I:入库 * O:出库 */ private String lastIo = "I"; /** * 堆垛机所在巷道 */ private Integer crnLane = 1; /** * 日志采集时间 */ private Long deviceDataLog = System.currentTimeMillis(); /** * 上一次指令下发时间 */ private Long lastCommandTime = System.currentTimeMillis(); /** * 扩展数据 */ private Map extend; public void setMode(Integer mode) { this.mode = mode; this.modeType = DualCrnModeType.get(mode); } public void setMode(DualCrnModeType type) { this.modeType = type; this.mode = DualCrnModeType.get(type).id; } public void setForkPos(Integer forkPos) { this.forkPos = forkPos; this.forkPosType = DualCrnForkPosType.get(forkPos); } public void setForkPosTwo(Integer forkPosTwo) { this.forkPosTwo = forkPosTwo; this.forkPosTypeTwo = DualCrnForkPosType.get(forkPosTwo); } public void setForkPos(DualCrnForkPosType type) { this.forkPosType = type; this.forkPos = DualCrnForkPosType.get(type).id; } public void setForkPosTwo(DualCrnForkPosType type) { this.forkPosTypeTwo = type; this.forkPosTwo = DualCrnForkPosType.get(type).id; } public void setLiftPos(Integer liftPos) { this.liftPos = liftPos; this.liftPosType = DualCrnLiftPosType.get(liftPos); } public void setLiftPosTwo(Integer liftPosTwo) { this.liftPosTwo = liftPosTwo; this.liftPosTypeTwo = DualCrnLiftPosType.get(liftPosTwo); } public void setLiftPos(DualCrnLiftPosType type) { this.liftPosType = type; this.liftPos = DualCrnLiftPosType.get(type).id; } public void setLiftPosTwo(DualCrnLiftPosType type) { this.liftPosTypeTwo = type; this.liftPosTwo = DualCrnLiftPosType.get(type).id; } public void setStatus(Integer status){ this.status = status; this.statusType = DualCrnStatusType.get(status); } public void setStatus(DualCrnStatusType type){ this.statusType = type; this.status = DualCrnStatusType.get(type).id; } public void setStatusTwo(Integer statusTwo){ this.statusTwo = statusTwo; this.statusTypeTwo = DualCrnStatusType.get(statusTwo); } public void setStatusTwo(DualCrnStatusType type){ this.statusTypeTwo = type; this.statusTwo = DualCrnStatusType.get(type).id; } }