From 16b12d978e1055e5800e2a4a0da897e057987ec0 Mon Sep 17 00:00:00 2001 From: Junjie <fallin.jie@qq.com> Date: 星期二, 25 七月 2023 10:09:34 +0800 Subject: [PATCH] 捡料 --- src/main/java/com/zy/core/model/protocol/LiftProtocol.java | 190 +++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 190 insertions(+), 0 deletions(-) diff --git a/src/main/java/com/zy/core/model/protocol/LiftProtocol.java b/src/main/java/com/zy/core/model/protocol/LiftProtocol.java index cd00e23..a080395 100644 --- a/src/main/java/com/zy/core/model/protocol/LiftProtocol.java +++ b/src/main/java/com/zy/core/model/protocol/LiftProtocol.java @@ -1,7 +1,11 @@ package com.zy.core.model.protocol; +import com.zy.core.enums.LiftProtocolStatusType; +import com.zy.core.model.command.LiftAssignCommand; import lombok.Data; import lombok.extern.slf4j.Slf4j; + +import java.util.Date; /** * 鎻愬崌鏈� @@ -16,9 +20,29 @@ private Short liftNo; /** + * 鎻愬崌鏈哄唴閮ㄤ簩缁寸爜 + */ + private Short barcode = 1661; + + /** * 浠诲姟鍙� */ private Short taskNo = 0; + + /** + * 鍥涘悜绌挎杞﹀彿 + */ + private Short shuttleNo = 0; + + /** + * 褰撳墠鎻愬崌鏈虹姸鎬侊紙鍐呴儴鑷垜缁存姢锛� + */ + private Integer protocolStatus = 1; + + /** + * 褰撳墠鎻愬崌鏈虹姸鎬佹灇涓� + */ + private LiftProtocolStatusType protocolStatusType = LiftProtocolStatusType.IDLE; /** * 灞� @@ -161,8 +185,174 @@ */ private Short liftActualSpeed; + /** + * 浣滀笟鏍囪 + */ + private Boolean pakMk = true; + + /** + * 鍥涘悜绌挎杞﹁皟搴︽彁鍗囨満鏃讹紝闇�瑕侀攣瀹氭鏍囪 + */ + private Boolean securityMk = false; + + /** + * 浠诲姟鍛戒护 + */ + private LiftAssignCommand assignCommand; + + /** + * 鍑哄叆搴撴ā寮忥紝1锛氬叆搴擄紝2锛氬嚭搴� + */ + private Integer outInModel; + + /** + * 鍑哄叆搴撴ā寮忚捣濮嬬珯鐐� + */ + private Integer startSta; + + /** + * 鍑哄叆搴撴ā寮忕洰鏍囩珯鐐� + */ + private Integer distSta; + + /** + * 鍑哄叆搴撴ā寮忔鏁� + */ + private Integer outInModelStep; + + /** + * 宸ヤ綔鏃堕棿 + */ + private Date wrkTime; + public Short getLiftLockShortValue() { return liftLock ? (short) 1 : (short) 0; } + /** + * 璁剧疆鎻愬崌鏈虹姸鎬� + */ + public void setProtocolStatus(Integer status) { + this.protocolStatus = status; + this.protocolStatusType = LiftProtocolStatusType.get(status); + } + + /** + * 璁剧疆鎻愬崌鏈虹姸鎬� + */ + public void setProtocolStatus(LiftProtocolStatusType status) { + this.protocolStatus = status.id; + this.protocolStatusType = status; + } + + // 鏄惁澶勪簬绌洪棽寰呭懡鐘舵�� + public Boolean isIdle(Short taskNo) { + if(this.taskNo == null + || this.liftLock == null + || this.ready == null + || this.running == null + || this.mode == null + || this.pakMk == null + ){ + return false; + } + + boolean res = (this.taskNo == 0 || this.taskNo.intValue() == taskNo.intValue()) + && !this.liftLock +// && this.ready + && !this.running + && this.mode + && this.pakMk.equals(true) + && !this.securityMk + ; + return res; + } + + // 鏄惁澶勪簬绌洪棽寰呭懡鐘舵�� + public Boolean isIdle() { + if(this.taskNo == null + || this.liftLock == null + || this.ready == null + || this.running == null + || this.mode == null + || this.pakMk == null + ){ + return false; + } + + boolean res = this.taskNo == 0 + && !this.liftLock +// && this.ready + && !this.running + && this.mode + && this.pakMk.equals(true) + && !this.securityMk + ; + return res; + } + + // 鏄惁澶勪簬绌洪棽寰呭懡鐘舵�侊紝涓嶅垽鏂换鍔″彿 + public Boolean isIdleNoTask() { + if(this.taskNo == null + || this.liftLock == null + || this.ready == null + || this.running == null + || this.mode == null + || this.pakMk == null + ){ + return false; + } + + boolean res = !this.liftLock +// && this.ready + && !this.running + && this.mode + && this.pakMk + && !this.securityMk + ; + return res; + } + + public void setPositionArrivalFeedback(Short position) { + Short lev = null; + switch (position) { + case 1: + lev = 1; + break; + case 4: + lev = 2; + break; + case 8: + lev = 3; + break; + case 16: + lev = 4; + break; + } + this.lev = lev;//灞傞珮 + this.positionArrivalFeedback = position;//浣嶇疆鍒拌揪鍙嶉 + } + + public Integer getPositionArrivalFeedback$() { + if (this.positionArrivalFeedback == null) { + return null; + } + + switch (this.positionArrivalFeedback) { + case 1: + return 1; + case 2: + return 2; + case 4: + return 3; + case 8: + return 4; + case 16: + return 5; + } + + return null; + } + + } -- Gitblit v1.9.1