From f510760823f431891a501cd556928e215702ddb7 Mon Sep 17 00:00:00 2001
From: zhangc <zc@123>
Date: 星期六, 19 四月 2025 13:36:11 +0800
Subject: [PATCH] 999
---
src/main/java/com/zy/core/model/protocol/LiftProtocol.java | 244 ++++++++++++++++++++++++++++++++++--------------
1 files changed, 170 insertions(+), 74 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 032a63d..4451b72 100644
--- a/src/main/java/com/zy/core/model/protocol/LiftProtocol.java
+++ b/src/main/java/com/zy/core/model/protocol/LiftProtocol.java
@@ -1,51 +1,59 @@
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.LiftProtocolStatusType;
-import com.zy.core.model.command.LiftAssignCommand;
+import com.zy.core.enums.RedisKeyType;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
-/**
- * 鎻愬崌鏈�
- */
@Slf4j
@Data
-public class LiftProtocol {
+public class LiftProtocol implements Cloneable {
+ //**********************蹇呴』瀛樺湪灞炴��**********************
/**
* 鎻愬崌鏈哄彿
*/
- private Short liftNo;
+ private Integer liftNo;
/**
* 浠诲姟鍙�
*/
- private Short taskNo = 0;
+ private Integer taskNo;
/**
* 鍥涘悜绌挎杞﹀彿
*/
- private Short shuttleNo = 0;
+ private Integer shuttleNo = 0;
/**
* 褰撳墠鎻愬崌鏈虹姸鎬侊紙鍐呴儴鑷垜缁存姢锛�
*/
- private Integer protocolStatus = 1;
+ private Integer protocolStatus = -1;
/**
* 褰撳墠鎻愬崌鏈虹姸鎬佹灇涓�
*/
- private LiftProtocolStatusType protocolStatusType = LiftProtocolStatusType.IDLE;
+ private LiftProtocolStatusType protocolStatusType = LiftProtocolStatusType.NONE;
/**
- * 妯″紡
+ * 妯″紡 => 鑷姩/鎵嬪姩
*/
private Boolean model;
/**
- * 蹇欓棽
+ * 杩愯鐘舵��
*/
- private Boolean busy;
+ private Boolean run;
+
+ /**
+ * 灏辩华鐘舵��
+ */
+ private Boolean ready;
/**
* 鍓嶈秴闄�
@@ -88,9 +96,14 @@
private Boolean hasCar;
/**
- * 璁惧鏁呴殰
+ * 鏁呴殰
*/
- private Boolean deviceError;
+ private Boolean error;
+
+ /**
+ * 鏁呴殰鐮�
+ */
+ private String errorCode;
/**
* 浠诲姟鍦板潃
@@ -105,29 +118,128 @@
/**
* 宸插畬鎴愮殑浠诲姟鍙�
*/
- private Short completeTaskNo;
+ private String completeTaskNo;
/**
* 灞�
*/
- private Short lev;
+ private Integer lev;
/**
* 浣滀笟鏍囪
*/
- private Boolean pakMk = false;
+ private Boolean pakMk = true;
/**
- * 鐙崰浠ょ墝
- * 鏈浠诲姟鍗犳嵁锛屼护鐗屼负0
- * 琚换鍔″崰鎹紝灏嗕换鍔″彿璧嬪�肩粰浠ょ墝
+ * 鎸囦护涓嬪彂鏃堕棿
*/
- private Integer token = 0;
+ private Long sendTime = 0L;
/**
- * 浠诲姟鍛戒护
+ * 鏃ュ織閲囬泦鏃堕棿
*/
- private LiftAssignCommand assignCommand;
+ private Long deviceDataLog = System.currentTimeMillis();
+
+ /**
+ * 鎵╁睍瀛楁
+ */
+ private Object extend;
+
+ public String getRun$() {
+ if (this.run == null) {
+ return "鏈煡";
+ }
+
+ return this.run ? "杩愯涓�" : "绌洪棽";
+ }
+
+ public String getReady$() {
+ if (this.ready == null) {
+ return "鏈煡";
+ }
+
+ return this.ready ? "灏辩华" : "鏈氨缁�";
+ }
+
+ public String getModel$() {
+ if (this.model == null) {
+ return "鏈煡";
+ }
+
+ return this.model ? "鑷姩" : "鎵嬪姩";
+ }
+
+ public String getHasTray$() {
+ if (this.hasTray == null) {
+ return "鏈煡";
+ }
+
+ return this.hasTray ? "Y" : "N";
+ }
+
+ public String getHasCar$() {
+ if (this.hasCar == null) {
+ return "鏈煡";
+ }
+
+ return this.hasCar ? "Y" : "N";
+ }
+
+ public String getFrontOverrun$() {
+ if (this.frontOverrun == null) {
+ return "鏈煡";
+ }
+
+ return this.frontOverrun ? "Y" : "N";
+ }
+
+ public String getBackOverrun$() {
+ if (this.backOverrun == null) {
+ return "鏈煡";
+ }
+
+ return this.backOverrun ? "Y" : "N";
+ }
+
+ public String getLeftOverrun$() {
+ if (this.leftOverrun == null) {
+ return "鏈煡";
+ }
+
+ return this.leftOverrun ? "Y" : "N";
+ }
+
+ public String getRightOverrun$() {
+ if (this.rightOverrun == null) {
+ return "鏈煡";
+ }
+
+ return this.rightOverrun ? "Y" : "N";
+ }
+
+ public String getOverHeight$() {
+ if (this.overHeight == null) {
+ return "鏈煡";
+ }
+
+ return this.overHeight ? "Y" : "N";
+ }
+
+ public String getOverWeight$() {
+ if (this.overWeight == null) {
+ return "鏈煡";
+ }
+
+ return this.overWeight ? "Y" : "N";
+ }
+
+ public String getProtocolStatus$() {
+ if (this.protocolStatusType == null) {
+ return "鏈煡";
+ }
+
+ return this.protocolStatusType.desc;
+ }
/**
* 璁剧疆鎻愬崌鏈虹姸鎬�
@@ -145,64 +257,48 @@
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;
+ public synchronized void setTaskNo(Integer taskNo) {
+ RedisUtil redisUtil = SpringUtils.getBean(RedisUtil.class);
+ if (null != redisUtil) {
+ redisUtil.set(RedisKeyType.LIFT_FLAG.key + this.liftNo, taskNo);
+ this.taskNo = taskNo;
}
-
- boolean res = (this.taskNo == 0 || this.taskNo.intValue() == taskNo.intValue())
- && !this.busy
- && this.model
- && !this.pakMk
- && !this.deviceError
- ;
- return res;
}
- // 鏄惁澶勪簬绌洪棽寰呭懡鐘舵��
- public Boolean isIdle() {
- if(this.taskNo == null
- || this.busy == null
- || this.model == null
- || this.deviceError == null
- || this.pakMk == null
- ){
- return false;
+ 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.valueOf(String.valueOf(o));
+ }
}
-
- boolean res = this.taskNo == 0
- && !this.busy
- && this.model
- && !this.pakMk
- && !this.deviceError
- ;
- return res;
+ return this.taskNo == null ? 0 : this.taskNo;
}
- // 鏄惁澶勪簬绌洪棽寰呭懡鐘舵�侊紝涓嶅垽鏂换鍔″彿
- public Boolean isIdleNoTask() {
- if(this.taskNo == null
- || this.busy == null
- || this.model == null
- || this.deviceError == null
- || this.pakMk == null
- ){
- return false;
+ /**
+ * 閿欒鐮�
+ */
+ public String getErrCode$() {
+ if (this.errorCode == null) {
+ return "";
}
-
- boolean res = !this.busy
- && this.model
- && !this.pakMk
- && !this.deviceError
- ;
- return res;
+ BasLiftErrService basLiftErrService = SpringUtils.getBean(BasLiftErrService.class);
+ BasLiftErr basLiftErr = basLiftErrService.selectById(this.errorCode);
+ if (basLiftErr == null) {
+ return String.valueOf(this.errorCode);
+ }
+ return basLiftErr.getErrName();
}
+ @Override
+ public LiftProtocol clone() {
+ try {
+ return (LiftProtocol) super.clone();
+ } catch (CloneNotSupportedException e) {
+ e.printStackTrace();
+ }
+ return null;
+ }
}
--
Gitblit v1.9.1