From 9bd955804174cd26cfe275d672a33220ae5a199f Mon Sep 17 00:00:00 2001 From: Junjie <fallin.jie@qq.com> Date: 星期二, 16 五月 2023 14:31:18 +0800 Subject: [PATCH] 堆垛机管理 --- src/main/java/com/zy/core/model/protocol/CrnProtocol.java | 406 ++++++++++++++++++++++++++++++++++++++++++++++++++++------ 1 files changed, 364 insertions(+), 42 deletions(-) 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 63a2a49..87c0781 100644 --- a/src/main/java/com/zy/core/model/protocol/CrnProtocol.java +++ b/src/main/java/com/zy/core/model/protocol/CrnProtocol.java @@ -1,5 +1,7 @@ package com.zy.core.model.protocol; +import com.zy.asrs.entity.BasCrnp; +import com.zy.core.enums.*; import lombok.Data; /** @@ -12,57 +14,170 @@ * 1 = 鎵嬪姩妯″紡 * 2 = 鑷姩妯″紡 * 3 = 鐢佃剳妯″紡 - * 4 = 鎵嬪姩妯″紡鍚姩涓� - * 5 = 鑷姩妯″紡鍚姩涓� - * 6 = 鐢佃剳妯″紡鍚姩涓� */ - public short mode; + public Short mode; + + public CrnModeType modeType; + + /** + * 鍫嗗灈鏈轰换鍔″畬鎴� + */ + public Short taskFinish; + + /** + * 鏍¢獙缁撴灉 1琛ㄧず妫�楠屾垚鍔� + */ + public Short valid; /** * 1 = 鎬ュ仠 */ - public short eStop; - - /** - * 寮傚父鐮� - */ - public short alarm; + public Short eStop; /** * 浠诲姟鍙� */ - public short taskNo; + public Short taskNo = 0; /** * 鍫嗗灈鏈哄綋鍓嶇姸鎬� - * 0 = 鏈煡 - * 1 = 绌洪棽 - * 2 = 妫�鏌ヤ换鍔℃暟鎹� - * 3 = 瀹氫綅鍒板彇璐т綅 - * 7 = 鍙栬揣瀹屾垚 - * 8 = 绛夊緟璋冨害鏌滃厑璁� - * 9 = 绉诲姩鍒版斁璐т綅缃� - * 10 = 鏀捐揣涓� - * 13 = 鎼繍瀹屾垚 - * 14 = 绌鸿浇閬胯 - * 15 = 妫�鏌ヤ换鍔℃暟鎹� - * 20 = 妫�鏌ユ簮浣嶇疆 - * 21 = 妫�鏌ョ洰鏍囦綅缃� - * 50 = 绉诲姩浠诲姟 - * 98 = 浠诲姟瀹屾垚锛寃cs鏈‘璁� - * 99 = 鎶ヨ + * 0锛氱┖闂诧紝鏃犱换鍔� + * 1锛氬彇璐у畾浣嶄腑 + * 2锛氬彇璐т腑 + * 3锛氬彇璐у畬鎴愶紝鏀捐揣瀹氫綅涓� + * 4锛氭斁璐т腑 + * 5锛氬洖鍘熺偣涓� + * 6锛氬弽鍘熺偣 + * 7锛氬簱浣嶇Щ浣� + * 90锛氫换鍔″畬鎴愮瓑寰匴CS纭 + * 99锛氭姤璀� */ - public short status; + public Short status; + + /** + * 鐘舵�佹灇涓� + */ + public CrnStatusType statusType; /** * 鍫嗗灈鏈哄綋鍓嶅垪鍙� */ - public short bay; + public Short bay; /** * 鍫嗗灈鏈哄綋鍓嶅眰鍙� */ - public short level; + public Short level; + + /** + * 鍫嗗灈鏈哄綋鍓嶆帓 + */ + public Short row; + + /** + * 鍫嗗灈鏈哄綋鍓嶅贩閬撳彿 + */ + public Short lane; + + /** + * 鍫嗗灈鏈洪�氳鐘舵�� + */ + public Boolean connStatus; + + /** + * 鐢宠鍏ュ簱淇 + */ + public Boolean correction; + + /** + * 鎵樼洏鍙烽敊 + */ + public Boolean tuError; + + /** + * 鍙栬揣鏃犵 + */ + public Boolean noneError; + + /** + * 鍙岄噸鍏ュ簱 + */ + public Boolean stockError; + + /** + * 浣滀笟鏁版嵁鏃犳晥 + */ + public Boolean jobInvalid; + + /** + * 绌洪棽鐘舵�� + */ + public Boolean idle; + + /** + * 鎺у埗鏌滀娇鑳� + */ + public Boolean control; + + /** + * 鍋滃噯 + */ + public Boolean stopQuasi; + + /** + * 杩愯 + */ + public Boolean running; + + /** + * 鏁呴殰 + */ + public Boolean fault; + + /** + * 璐у弶涓綅 + */ + public Boolean forkHome; + /** + * 鍗曚几浣嶈揣鍙夊乏浣� + */ + public Boolean forkSingleLeft; + /** + * 鍗曚几浣嶈揣鍙夊彸浣� + */ + public Boolean forkSingleRight; + /** + * 鍙屼几浣嶈揣鍙夊乏浣� + */ + public Boolean forkDoubleLeft; + /** + * 鍙屼几浣嶈揣鍙夊彸浣� + */ + public Boolean forkDoubleRight; + /** + * 鍗曚几浣嶉珮浣� + */ + public Boolean singleHigh; + /** + * 鍗曚几浣嶄綆浣� + */ + public Boolean singleLow; + /** + * 鍙屼几浣嶉珮浣� + */ + public Boolean doubleHigh; + /** + * 鍙屼几浣嶄綆浣� + */ + public Boolean doubleLow; + /** + * 绔欏彴楂樹綅 + */ + public Boolean platformHigh; + /** + * 绔欏彴浣庝綅 + */ + public Boolean platformLow; /** * 褰撳墠璐у弶浣嶇疆 @@ -70,45 +185,252 @@ * 1 = 璐у弶鍦ㄥ乏渚� * 2 = 璐у弶鍦ㄥ彸渚� */ - public short forkPos; + public Short forkPos = -1; + + public CrnForkPosType forkPosType = CrnForkPosType.NONE; /** * 褰撳墠杞借揣鍙颁綅缃� * 0 = 涓嬪畾浣� * 1 = 涓婂畾浣� */ - public short liftPos; + public Short liftPos = -1; + + public CrnLiftPosType liftPosType = CrnLiftPosType.ERROR; /** * 璧拌鍦ㄥ畾浣� * 0 = 鍦ㄥ畾浣� * 1 = 涓嶅湪瀹氫綅 */ - public short walkPos; + public Short walkPos = 0; /** - * 鍫嗗灈鏈轰换鍔″畬鎴� + * 鎷ㄦ寚浣嶇疆 + * 0 = 涓嶅湪瀹氫綅 + * 1 = 涓婂畾浣� + * 2 = 涓嬪畾浣� */ - public short taskFinish; + public Short fingerPos; + + public CrnFingerPosType fingerPosType; /** * 杞借揣鍙版湁鐗� */ - public short loaded; + public Short loaded; /** - * 鍫嗗灈鏈虹疮璁¤蛋琛岃窛绂� + * 鍫嗗灈鏈哄瀭鐩存晠闅滀唬鐮侊紙鏁板�兼樉绀猴級 */ - public int xDistance; + private Integer alarm1 = 0; /** - * 鍫嗗灈鏈虹疮璁″崌闄嶈窛绂� + * 鍫嗗灈鏈烘按骞虫晠闅滀唬鐮侊紙鏁板�兼樉绀猴級 */ - public int yDistance; + private Integer alarm2 = 0;; /** - * 鍫嗗灈鏈虹疮璁¤繍琛屾椂闀� + * 鍫嗗灈鏈鸿揣鍙夋晠闅滀唬鐮侊紙鏁板�兼樉绀猴級 */ - public int duration; + private Integer alarm3 = 0;; + /** + * 鍫嗗灈鏈虹姸鎬佹晠闅滀唬鐮侊紙鏁板�兼樉绀猴級 + */ + private Integer alarm4 = 0;; + + /** + * 寮傚父1 + */ + private boolean[] error1; + + private CrnError1 crnError1; + + /** + * 寮傚父2 + */ + private boolean[] error2; + + private CrnError2 crnError2; + + /** + * 寮傚父3 + */ + private boolean[] error3; + + private CrnError3 crnError3; + + /** + * 寮傚父4 + */ + private boolean[] error4; + + private CrnError4 crnError4; + + /** + * X琛岃蛋绾块�熷害m/min + */ + private Float xSpeed = 0F; + + /** + * Y琛岃蛋绾块�熷害m/min + */ + private Float ySpeed = 0F; + + /** + * Z琛岃蛋绾块�熷害m/min + */ + private Float zSpeed = 0F; + + /** + * 鍫嗗灈鏈虹疮璁¤蛋琛岃窛绂籯m + */ + public Float xDistance = 0F; + + /** + * 鍫嗗灈鏈虹疮璁″崌闄嶈窛绂籯m + */ + public Float yDistance = 0F; + + /** + * 鍫嗗灈鏈虹疮璁¤蛋琛屾椂闀縣 + */ + public Float xDuration = 0F; + + /**w + * 鍫嗗灈鏈虹疮璁″崌闄嶆椂闀縣 + */ + public Float yDuration = 0F; + + public void setMode(Short mode) { + this.mode = mode; + this.modeType = CrnModeType.get(mode); + } + + public void setMode(CrnModeType type) { + this.modeType = type; + this.mode = CrnModeType.get(type).id.shortValue(); + } + + public void setForkPos(Short forkPos) { + this.forkPos = forkPos; + this.forkPosType = CrnForkPosType.get(forkPos); + } + + public void setForkPos(CrnForkPosType type) { + this.forkPosType = type; + 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); + } + + public void setStatus(CrnStatusType type){ + this.statusType = type; + this.status = CrnStatusType.get(type).id.shortValue(); + } + + public void setFingerPos(Short type) { + this.fingerPos = type; + this.fingerPosType = CrnFingerPosType.get(type); + } + + public void setError1(boolean[] error1){ + this.error1 = error1; + this.crnError1 = new CrnError1(); + this.crnError1.remoteStop = error1[0]; + this.crnError1.mainStop = error1[1]; + this.crnError1.controlStop = error1[2]; + this.crnError1.xCoverErr = error1[3]; + this.crnError1.yCoverErr = error1[4]; + this.crnError1.zCoverErr = error1[5]; + this.crnError1.laserErr = error1[6]; + this.crnError1.barcodeErr = error1[7]; + this.crnError1.xFrontLimitErr = error1[8]; + this.crnError1.xBackLimitErr = error1[9]; + this.crnError1.yUpLimitErr = error1[10]; + this.crnError1.yDownLimitErr = error1[11]; + this.crnError1.zLeftLimitErr = error1[12]; + this.crnError1.zRightLimitErr = error1[13]; + this.crnError1.leftOverWidthErr1 = error1[14]; + this.crnError1.leftOverWidthErr2 = error1[15]; + } + + public void setError2(boolean[] error2){ + this.error2 = error2; + this.crnError2 = new CrnError2(); + this.crnError2.leftOverLenErr1 = error2[0]; + this.crnError2.leftOverLenErr2 = error2[1]; + this.crnError2.leftOverHighErr = error2[2]; + this.crnError2.rightOverWidthErr1 = error2[3]; + this.crnError2.rightOverWidthErr2 = error2[4]; + this.crnError2.rightOverLenErr1 = error2[5]; + this.crnError2.rightOverLenErr2 = error2[6]; + this.crnError2.rightOverHighErr = error2[7]; + this.crnError2.leftLooseRopeErr = error2[8]; + this.crnError2.rightLooseRopeErr = error2[9]; + this.crnError2.frontDoorErr = error2[10]; + this.crnError2.backDoorErr = error2[11]; + this.crnError2.startupErr = error2[12]; + this.crnError2.xFrontLocaUpErr = error2[13]; + this.crnError2.xFrontLocaDownErr = error2[14]; + this.crnError2.xBackLocaUpErr = error2[15]; + } + + public void setError3(boolean[] error3) { + this.error3 = error3; + this.crnError3 = new CrnError3(); + this.crnError3.xBackLocaDownErr = error3[0]; + this.crnError3.yUpLocaUpErr = error3[1]; + this.crnError3.yUpLocaDownErr = error3[2]; + this.crnError3.yDownLocaUpErr = error3[3]; + this.crnError3.yDownLocaDownErr = error3[4]; + this.crnError3.zLeftLocaUpErr = error3[5]; + this.crnError3.zLeftLocaDownErr = error3[6]; + this.crnError3.zRightLocaUpErr = error3[7]; + this.crnError3.zRightLocaDownErr = error3[8]; + this.crnError3.leftTakeNoneErr = error3[9]; + this.crnError3.rightTakeNoneErr = error3[10]; + this.crnError3.leftTakeThenLoadErr = error3[11]; + this.crnError3.rightTakeThenLoadErr = error3[12]; + this.crnError3.leftPutAndLoadErr = error3[13]; + this.crnError3.rightPutAndLoadErr = error3[14]; + this.crnError3.leftPutThenNoneErr = error3[15]; + } + + public void setError4(boolean[] error4) { + this.error4 = error4; + this.crnError4 = new CrnError4(); + this.crnError4.rightPutThenNoneErr = error4[0]; + this.crnError4.xLooseBrakeTimeout = error4[1]; + this.crnError4.yLooseBrakeTimeout = error4[2]; + this.crnError4.zLooseBrakeTimeout = error4[3]; + } + + /** + * 鏈�杩戜竴娆″叆鍑哄簱绫诲瀷 + * I:鍏ュ簱 + * O:鍑哄簱 + */ + private String lastIo = "I"; + + + public BasCrnp toSqlModel(BasCrnp basCrnp){ + basCrnp.setCrnErr(alarm1.longValue()); + basCrnp.setWrkNo(taskNo.intValue()); + return basCrnp; + } } -- Gitblit v1.9.1