From 95678b2302b7efa540b9c4e8795fbcfed16f0ea3 Mon Sep 17 00:00:00 2001
From: qlsxk <qlsxk@qq.com>
Date: 星期二, 14 十月 2025 13:21:48 +0800
Subject: [PATCH] #
---
src/main/java/com/zy/core/model/protocol/LiftProtocol.java | 263 ++++++++++++++++++++++++++++++++--------------------
1 files changed, 162 insertions(+), 101 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 abc2b26..08041ee 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 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;
@@ -10,72 +14,67 @@
*/
@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 shuttleNo = 0;
+ private Integer plcTaskNo;
/**
- * 褰撳墠鎻愬崌鏈虹姸鎬侊紙鍐呴儴鑷垜缁存姢锛�
+ * 浠诲姟鐘舵��
*/
- private Integer protocolStatus = 1;
+ private Integer protocolStatus = LiftProtocolStatusType.IDLE.id;
/**
- * 褰撳墠鎻愬崌鏈虹姸鎬佹灇涓�
+ * 浠诲姟鐘舵�佹灇涓�
*/
private LiftProtocolStatusType protocolStatusType = LiftProtocolStatusType.IDLE;
/**
- * 妯″紡
+ * 璁惧鐘舵��
*/
- private Boolean model;
+ private Integer deviceStatus = LiftDeviceStatusType.NONE.id;
/**
- * 蹇欓棽
+ * 璁惧鐘舵�佹灇涓�
*/
- private Boolean busy;
+ private LiftDeviceStatusType deviceStatusType = LiftDeviceStatusType.NONE;
/**
- * 鍓嶈秴闄�
+ * 浠诲姟妯″紡
*/
- private Boolean frontOverrun;
+ private Integer taskMode = LiftTaskModeType.NONE.id;
/**
- * 鍚庤秴闄�
+ * 浠诲姟妯″紡鏋氫妇
*/
- private Boolean backOverrun;
+ private LiftTaskModeType modeType = LiftTaskModeType.NONE;
/**
- * 宸﹁秴闄�
+ * 鍙栬揣鏁版嵁
*/
- private Boolean leftOverrun;
+ private Integer pick;
/**
- * 鍙宠秴闄�
+ * 鏀捐揣鏁版嵁
*/
- private Boolean rightOverrun;
-
- /**
- * 瓒呴珮
- */
- private Boolean overHeight;
-
- /**
- * 瓒呴噸
- */
- private Boolean overWeight;
+ private Integer put;
/**
* 鏈夋墭鐩�
@@ -88,42 +87,47 @@
private Boolean hasCar;
/**
- * 璁惧鏁呴殰
+ * 鍑哄叆搴撴ā寮�
*/
- private Boolean deviceError;
+ private Integer iOMode = LiftIoModeType.NONE.id;
/**
- * 浠诲姟鍦板潃
+ * 鍑哄叆搴撴ā寮忔灇涓�
*/
- private Short taskAddress;
+ private LiftIoModeType iOModeType = LiftIoModeType.NONE;
/**
- * 鐩殑鍦板潃
+ * 鏁呴殰鐮�
*/
- private Short distAddress;
+ private Integer errorCode;
/**
- * 宸插畬鎴愮殑浠诲姟鍙�
+ * 褰撳墠灞�
*/
- private Short completeTaskNo;
-
- /**
- * 灞�
- */
- private Short lev;
+ private Integer lev;
/**
* 浣滀笟鏍囪
*/
- private Boolean pakMk = true;
+ private Boolean pakMk = false;
/**
- * 浠诲姟鍛戒护
+ * 鎸囦护涓嬪彂鏃堕棿
*/
- private LiftAssignCommand assignCommand;
+ private Long sendTime = 0L;
/**
- * 璁剧疆鎻愬崌鏈虹姸鎬�
+ * 鏃ュ織閲囬泦鏃堕棿
+ */
+ private Long deviceDataLog = System.currentTimeMillis();
+
+ /**
+ * 鎵╁睍瀛楁
+ */
+ private Object extend;
+
+ /**
+ * 璁剧疆浠诲姟鐘舵��
*/
public void setProtocolStatus(Integer status) {
this.protocolStatus = status;
@@ -131,70 +135,127 @@
}
/**
- * 璁剧疆鎻愬崌鏈虹姸鎬�
+ * 璁剧疆浠诲姟鐘舵��
*/
public void setProtocolStatus(LiftProtocolStatusType status) {
this.protocolStatus = status.id;
this.protocolStatusType = status;
}
- // 鏄惁澶勪簬绌洪棽寰呭懡鐘舵��
- public Boolean isIdle(Short taskNo) {
- if(this.taskNo == null
- || this.busy == null
- || this.model == null
- || this.deviceError == null
- || this.pakMk == null
- ){
- return false;
- }
-
- boolean res = (this.taskNo == 0 || this.taskNo.intValue() == taskNo.intValue())
- && !this.busy
- && this.model
- && this.pakMk.equals(true)
- && !this.deviceError
- ;
- return res;
+ /**
+ * 璁剧疆浠诲姟妯″紡
+ */
+ public void setTaskMode(Integer taskMode) {
+ this.taskMode = taskMode;
+ this.modeType = LiftTaskModeType.get(taskMode);
}
- // 鏄惁澶勪簬绌洪棽寰呭懡鐘舵��
- public Boolean isIdle() {
- if(this.taskNo == null
- || this.busy == null
- || this.model == null
- || this.deviceError == null
- || this.pakMk == null
- ){
- return false;
- }
-
- boolean res = this.taskNo == 0
- && !this.busy
- && this.model
- && this.pakMk.equals(true)
- && !this.deviceError
- ;
- return res;
+ /**
+ * 璁剧疆浠诲姟妯″紡
+ */
+ public void setMode(LiftTaskModeType taskMode) {
+ this.taskMode = taskMode.id;
+ this.modeType = taskMode;
}
- // 鏄惁澶勪簬绌洪棽寰呭懡鐘舵�侊紝涓嶅垽鏂换鍔″彿
- public Boolean isIdleNoTask() {
- if(this.taskNo == null
- || this.busy == null
- || this.model == null
- || this.deviceError == null
- || this.pakMk == null
- ){
- return false;
+ /**
+ * 璁剧疆鍑哄叆搴撴ā寮�
+ */
+ 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 String getModel$() {
+ if (this.model == null) {
+ return "";
}
- boolean res = !this.busy
- && this.model
- && this.pakMk.equals(true)
- && !this.deviceError
- ;
- return res;
+ 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