From e42c649b6e14af84202c2df7e35c486ea0b5442c Mon Sep 17 00:00:00 2001 From: luxiaotao1123 <t1341870251@163.com> Date: 星期六, 08 八月 2020 17:23:43 +0800 Subject: [PATCH] # --- src/main/java/com/zy/core/enums/CrnLiftPosType.java | 39 +++++++++++++++++++++++++++++++++++++++ src/main/java/com/zy/core/model/protocol/CrnProtocol.java | 13 +++++++++++++ 2 files changed, 52 insertions(+), 0 deletions(-) diff --git a/src/main/java/com/zy/core/enums/CrnLiftPosType.java b/src/main/java/com/zy/core/enums/CrnLiftPosType.java new file mode 100644 index 0000000..403ba89 --- /dev/null +++ b/src/main/java/com/zy/core/enums/CrnLiftPosType.java @@ -0,0 +1,39 @@ +package com.zy.core.enums; + +public enum CrnLiftPosType { + + UP(0), // 璐у弶鍘熶綅 + DOWN(1), // 璐у弶鍦ㄥ乏渚� + NONE(2), // 璐у弶鍦ㄥ彸渚� + ; + + public Integer id; + CrnLiftPosType(Integer id) { + this.id = id; + } + + public static CrnLiftPosType get(Short id) { + if (null == id) { + return null; + } + for (CrnLiftPosType type : CrnLiftPosType.values()) { + if (type.id.equals(id.intValue())) { + return type; + } + } + return null; + } + + public static CrnLiftPosType get(CrnLiftPosType type) { + if (null == type) { + return null; + } + for (CrnLiftPosType crnLiftPosType : CrnLiftPosType.values()) { + if (crnLiftPosType == type) { + return crnLiftPosType; + } + } + return null; + } + +} diff --git a/src/main/java/com/zy/core/model/protocol/CrnProtocol.java b/src/main/java/com/zy/core/model/protocol/CrnProtocol.java index 1c2e3d9..49a760b 100644 --- a/src/main/java/com/zy/core/model/protocol/CrnProtocol.java +++ b/src/main/java/com/zy/core/model/protocol/CrnProtocol.java @@ -1,6 +1,7 @@ package com.zy.core.model.protocol; import com.zy.core.enums.CrnForkPosType; +import com.zy.core.enums.CrnLiftPosType; import com.zy.core.enums.CrnModeType; import com.zy.core.enums.CrnStatusType; import lombok.Data; @@ -91,6 +92,8 @@ */ public short liftPos; + public CrnLiftPosType liftPosType; + /** * 璧拌鍦ㄥ畾浣� * 0 = 鍦ㄥ畾浣� @@ -143,6 +146,16 @@ this.forkPos = CrnForkPosType.get(type).id.shortValue(); } + public void setLiftPos(Short liftPos) { + this.liftPos = liftPos; + this.liftPosType = CrnLiftPosType.get(liftPos); + } + + public void setLiftPos(CrnLiftPosType type) { + this.liftPosType = type; + this.liftPos = CrnLiftPosType.get(type).id.shortValue(); + } + public void setStatus(Short status){ this.status = status; this.statusType = CrnStatusType.get(status); -- Gitblit v1.9.1