From b63790fa580ea78777f16bff6bc79373d675dd10 Mon Sep 17 00:00:00 2001 From: Junjie <540245094@qq.com> Date: 星期四, 21 八月 2025 16:50:47 +0800 Subject: [PATCH] # --- src/main/java/com/zy/core/model/protocol/LiftProtocol.java | 262 ++++++++++++++++++++++++++++++++++++--------------- 1 files changed, 184 insertions(+), 78 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 bbdc2f7..c5b94b5 100644 --- a/src/main/java/com/zy/core/model/protocol/LiftProtocol.java +++ b/src/main/java/com/zy/core/model/protocol/LiftProtocol.java @@ -1,5 +1,11 @@ package com.zy.core.model.protocol; +import com.core.common.Cools; +import com.core.common.SpringUtils; +import com.zy.asrs.entity.BasLiftErr; +import com.zy.asrs.service.BasLiftErrService; +import com.zy.common.utils.RedisUtil; +import com.zy.core.enums.*; import lombok.Data; import lombok.extern.slf4j.Slf4j; @@ -8,157 +14,257 @@ */ @Slf4j @Data -public class LiftProtocol { +public class LiftProtocol implements Cloneable { /** * 鎻愬崌鏈哄彿 */ - private Short liftNo; + private Integer liftNo; + + /** + * 妯″紡0鎵嬪姩 1鍗曟満 2鑱旀満 + */ + private Integer model; /** * 浠诲姟鍙� */ - private Short taskNo = 0; + private Integer taskNo = 0; /** - * 灞� + * PLC浠诲姟鍙� */ - private Short lev; + private Integer plcTaskNo; /** - * 鎻愬崌鏈洪攣瀹� + * 浠诲姟鐘舵�� */ - private Short liftLock; + private Integer protocolStatus = LiftProtocolStatusType.IDLE.id; /** - * 浣嶇疆鍒拌揪鍙嶉 + * 浠诲姟鐘舵�佹灇涓� */ - private Short positionArrivalFeedback; + private LiftProtocolStatusType protocolStatusType = LiftProtocolStatusType.IDLE; /** - * 鍑嗗灏辩华 - * 灏辩华涓�1锛屾湭灏辩华涓�0 + * 璁惧鐘舵�� */ - private Boolean ready; + private Integer deviceStatus = LiftDeviceStatusType.NONE.id; /** - * 杩愯涓� - * 杩愯涓负1锛屾湭杩愯涓�0 + * 璁惧鐘舵�佹灇涓� */ - private Boolean running; + private LiftDeviceStatusType deviceStatusType = LiftDeviceStatusType.NONE; /** - * 鑱旀満/鍗曟満 - * 鑱旀満涓�1锛屽崟鏈轰负0 + * 浠诲姟妯″紡 */ - private Boolean mode; + private Integer taskMode = LiftTaskModeType.NONE.id; /** - * 杈撻�佺嚎鍓嶇鍏夌數鏈夎揣 - * 鏈夎揣涓�1锛屾棤璐т负0锛堝墠绔寚闈犺繎璐ф灦渚э級 + * 浠诲姟妯″紡鏋氫妇 */ - private Boolean lineFrontHasStock; + private LiftTaskModeType modeType = LiftTaskModeType.NONE; /** - * 杈撻�佺嚎姝h浆鍙嶉 - * 姝h浆杩愯涓�1锛屽惁鍒欎负0 + * 鍙栬揣鏁版嵁 */ - private Boolean forwardRotationFeedback; + private Integer pick; /** - * 杈撻�佺嚎鍙嶈浆鍙嶉 - * 鍙嶈浆杩愯涓�1锛屽惁鍒欎负0 + * 鏀捐揣鏁版嵁 */ - private Boolean reverseFeedback; + private Integer put; /** - * 杈撻�佺嚎鐢垫満杩囪浇 - * 杩囪浇涓�0锛屾甯镐负1 + * 鏈夋墭鐩� */ - private Boolean motorOverload; + private Boolean hasTray; /** - * 杈撻�佺嚎鏈鍏夌數鏈夎揣 - * 鏈夎揣涓�1锛屾棤璐т负0 + * 鏈夊皬杞� */ - private Boolean lineEndHasStock; + private Boolean hasCar; /** - * 杩涜緭閫佺嚎鍗℃墭鐩樻姤璀� - * 鎶ヨ涓�1锛屾湭鎶ヨ涓�0 + * 鍑哄叆搴撴ā寮� */ - private Boolean inConveyLineCardTrayAlarm; + private Integer iOMode = LiftIoModeType.NONE.id; /** - * 鍑鸿緭閫佺嚎鍗℃墭鐩樻姤璀� - * 鎶ヨ涓�1锛屾湭鎶ヨ涓�0 + * 鍑哄叆搴撴ā寮忔灇涓� */ - private Boolean outConveyLineCardTrayAlarm; + private LiftIoModeType iOModeType = LiftIoModeType.NONE; /** - * 骞冲彴浣嶇疆鍋忓樊鎶ヨ - * 鎶ヨ涓�1锛屾湭鎶ヨ涓�0 + * 鏁呴殰鐮� */ - private Boolean platPositionDeviationAlarm; + private Integer errorCode; /** - * 骞冲彴鎵煩鍋忓樊鎶ヨ - * 鎶ヨ涓�1锛屾湭鎶ヨ涓�0 + * 褰撳墠灞� */ - private Boolean platTorqueDeviationAlarm; + private Integer lev; /** - * 骞冲彴鍥涘悜杞︽娴� - * 鏈夎溅涓�1锛屾棤杞︿负0 + * 浣滀笟鏍囪 */ - private Boolean platShuttleCheck; + private Boolean pakMk = false; /** - * 鏈氨缁姸鎬� - * 1. 涓嶅湪鎸囧畾灞� - * 2. 鍥涜酱涓嶅悓姝� - * 3. 骞冲彴鍓嶉檺鍏夌數琚尅鍒帮紙闈犺繎璐ф灦锛� - * 4. 骞冲彴鍚庨檺鍏夌數琚尅鍒帮紙杩滅璐ф灦锛� - * 5. 骞冲彴涓婇檺浣嶆姤璀� - * 6. 骞冲彴涓嬮檺浣嶆姤璀� - * 7. 鐢垫煖鎬ュ仠鎶ヨ - * 8. 杈撻�佺嚎鍓嶉檺浣嶈鎸″埌锛堥潬杩戣揣鏋讹級 - * 9. 杈撻�佺嚎鍚庨檺浣嶈鎸″埌锛堣繙绂昏揣鏋讹級 - * 10. 瑙︽懜灞忕揣鎬ュ仠姝㈣鎸変笅 - * 11. 鍥涜酱鍔ㄥ姏绾挎柇绾� - * 12. 鍗曟満妯″紡 - * 13. 鍥涜酱鎶ヨ - * 14. 浣嶇疆鍋忓樊杩囧ぇ - * 15. 鎵煩鍋忓樊杩囧ぇ - * 16. 杈撻�佺嚎杩囪浇 - * 17. 杩涙彁鍗囨満鍗℃墭鐩� - * 18. 鍑烘彁鍗囨満鍗℃墭鐩� + * 鎸囦护涓嬪彂鏃堕棿 */ - private Short notReady; + private Long sendTime = 0L; /** - * 浼烘湇1閿欒 + * 鏃ュ織閲囬泦鏃堕棿 */ - private Short servoError1; + private Long deviceDataLog = System.currentTimeMillis(); /** - * 浼烘湇2閿欒 + * 鎵╁睍瀛楁 */ - private Short servoError2; + private Object extend; /** - * 浼烘湇3閿欒 + * 璁剧疆浠诲姟鐘舵�� */ - private Short servoError3; + public void setProtocolStatus(Integer status) { + this.protocolStatus = status; + this.protocolStatusType = LiftProtocolStatusType.get(status); + } /** - * 浼烘湇4閿欒 + * 璁剧疆浠诲姟鐘舵�� */ - private Short servoError4; + public void setProtocolStatus(LiftProtocolStatusType status) { + this.protocolStatus = status.id; + this.protocolStatusType = status; + } /** - * 鎻愬崌鏈哄疄闄呴�熷害鍙嶉 + * 璁剧疆浠诲姟妯″紡 */ - private Short liftActualSpeed; + public void setTaskMode(Integer taskMode) { + this.taskMode = taskMode; + this.modeType = LiftTaskModeType.get(taskMode); + } + + /** + * 璁剧疆浠诲姟妯″紡 + */ + public void setMode(LiftTaskModeType taskMode) { + this.taskMode = taskMode.id; + this.modeType = taskMode; + } + + /** + * 璁剧疆鍑哄叆搴撴ā寮� + */ + public void setIOMode(Integer ioMode) { + this.iOMode = ioMode; + this.iOModeType = LiftIoModeType.get(ioMode); + } + + /** + * 璁剧疆鍑哄叆搴撴ā寮� + */ + public void setIOMode(LiftIoModeType ioMode) { + this.iOMode = ioMode.id; + this.iOModeType = ioMode; + } + + /** + * 閿欒鐮� + */ + public String getErrCode$() { + if (this.errorCode == null) { + return ""; + } + BasLiftErrService basLiftErrService = SpringUtils.getBean(BasLiftErrService.class); + BasLiftErr basLiftErr = basLiftErrService.selectById(this.errorCode); + if (basLiftErr == null) { + return String.valueOf(this.errorCode); + } + return basLiftErr.getErrName(); + } + + public Integer getTaskNo() { + RedisUtil redisUtil = SpringUtils.getBean(RedisUtil.class); + if (null != redisUtil) { + Object o = redisUtil.get(RedisKeyType.LIFT_FLAG.key + this.liftNo); + if (!Cools.isEmpty(o)) { + this.taskNo = Integer.parseInt(String.valueOf(o)); + } + } + return this.taskNo == null ? 0 : this.taskNo; + } + + public synchronized void setSyncTaskNo(Integer taskNo) { + RedisUtil redisUtil = SpringUtils.getBean(RedisUtil.class); + if (null != redisUtil) { + redisUtil.set(RedisKeyType.LIFT_FLAG.key + this.liftNo, taskNo); + this.taskNo = taskNo; + } + } + + public String getModel$() { + if (this.model == null) { + return ""; + } + + String name = ""; + if (this.model == 0) { + name = "鎵嬪姩"; + } else if (this.model == 1) { + name = "鍗曟満"; + }else if (this.model == 2) { + name = "鑱旀満"; + } + return name; + } + + public String getProtocolStatus$() { + if (this.protocolStatus == null) { + return ""; + } + + return LiftProtocolStatusType.get(this.protocolStatus).desc; + } + + public String getDeviceStatus$() { + if (this.deviceStatus == null) { + return ""; + } + + return LiftDeviceStatusType.get(this.deviceStatus).desc; + } + + public String getTaskMode$() { + if (this.taskMode == null) { + return ""; + } + + return LiftTaskModeType.get(this.taskMode).desc; + } + + public String getIOMode$() { + if (this.iOMode == null) { + return ""; + } + + return LiftIoModeType.get(this.iOMode).desc; + } + + @Override + public LiftProtocol clone() { + try { + return (LiftProtocol) super.clone(); + } catch (CloneNotSupportedException e) { + e.printStackTrace(); + } + return null; + } + } -- Gitblit v1.9.1