From 9c9294d671e9dd65e848f583e519645ec9ce3e1d Mon Sep 17 00:00:00 2001
From: Junjie <fallin.jie@qq.com>
Date: 星期一, 23 十二月 2024 16:55:30 +0800
Subject: [PATCH] #
---
src/main/java/com/zy/core/model/protocol/NyShuttleProtocol.java | 147 ++++++++++++++++++++++++++++++++++++++----------
1 files changed, 116 insertions(+), 31 deletions(-)
diff --git a/src/main/java/com/zy/core/model/protocol/NyShuttleProtocol.java b/src/main/java/com/zy/core/model/protocol/NyShuttleProtocol.java
index 8d62e39..4e60dab 100644
--- a/src/main/java/com/zy/core/model/protocol/NyShuttleProtocol.java
+++ b/src/main/java/com/zy/core/model/protocol/NyShuttleProtocol.java
@@ -3,18 +3,17 @@
import com.alibaba.fastjson.JSON;
import com.core.common.SpringUtils;
import com.zy.asrs.entity.BasShuttle;
+import com.zy.asrs.entity.BasShuttleErr;
+import com.zy.asrs.service.BasShuttleErrService;
import com.zy.asrs.service.BasShuttleService;
import com.zy.asrs.utils.Utils;
import com.zy.common.utils.NavigatePositionConvert;
import com.zy.core.News;
-import com.zy.core.enums.ShuttleErrorCodeType;
import com.zy.core.enums.ShuttleProtocolStatusType;
import com.zy.core.enums.ShuttleStatusType;
import com.zy.core.model.command.ShuttleAssignCommand;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
-
-import java.util.List;
/**
* 鐗涚溂鍥涘悜绌挎杞�
@@ -204,6 +203,61 @@
* 琚换鍔″崰鎹紝灏嗕换鍔″彿璧嬪�肩粰浠ょ墝
*/
private Integer token = 0;
+
+ /**
+ * 璺戝簱鐘舵��
+ */
+ private Boolean moveLoc = false;
+
+ /**
+ * 璺戝簱绫诲瀷锛�0:璺戣建閬擄紝1锛氳窇搴撲綅
+ */
+ private Integer moveType = 0;
+
+ /**
+ * 璺戝簱X璧风偣
+ */
+ private Integer xStart = 0;
+
+ /**
+ * 璺戝簱X缁堢偣
+ */
+ private Integer xTarget = 0;
+
+ /**
+ * 璺戝簱X褰撳墠鐐逛綅
+ */
+ private Integer xCurrent = 0;
+
+ /**
+ * 璺戝簱Y璧风偣
+ */
+ private Integer yStart = 0;
+
+ /**
+ * 璺戝簱Y缁堢偣
+ */
+ private Integer yTarget = 0;
+
+ /**
+ * 璺戝簱Y褰撳墠鐐逛綅
+ */
+ private Integer yCurrent = 0;
+
+ /**
+ * 鎸囦护涓嬪彂鏃堕棿
+ */
+ private Long sendTime = 0L;
+
+ /**
+ * 鏃ュ織閲囬泦鏃堕棿
+ */
+ private Long deviceDataLog = System.currentTimeMillis();
+
+ /**
+ * 鏈�杩戜竴娆″湪绾挎椂闂�
+ */
+ private Long lastOnlineTime = System.currentTimeMillis();
//鎬婚噷绋嬫暟
@Data
@@ -414,6 +468,18 @@
return JSON.toJSONString(this.getCoord());
}
+ public String getErrCode$() {
+ if (this.getErrCode() == null) {
+ return "";
+ }
+ BasShuttleErrService basShuttleErrService = SpringUtils.getBean(BasShuttleErrService.class);
+ BasShuttleErr basShuttleErr = basShuttleErrService.selectById(this.getErrCode());
+ if (basShuttleErr == null) {
+ return this.getErrCode().toString();
+ }
+ return basShuttleErr.getErrName();
+ }
+
public void setPoint(NyShuttlePointClass point) {
String locNo = NavigatePositionConvert.nyXyzToLocNo(point.getX(), point.getY(), point.getZ());
this.point = point;
@@ -433,21 +499,22 @@
&& this.taskNo == 0
&& this.protocolStatus == ShuttleProtocolStatusType.IDLE.id
;
- if (!res) {
- return res;
- } else {
- // 鐢甸噺
- try {
- Integer chargeLine = SpringUtils.getBean(BasShuttleService.class).selectById(this.shuttleNo).getChargeLine();
- if (chargeLine == null) {
- return false;
- }
- return this.getPowerPercent() >= chargeLine;
- } catch (Exception e) {
- News.error("fail", e);
- return false;
- }
- }
+ return res;
+// if (!res) {
+// return res;
+// } else {
+// // 鐢甸噺
+// try {
+// Integer chargeLine = SpringUtils.getBean(BasShuttleService.class).selectById(this.shuttleNo).getChargeLine();
+// if (chargeLine == null) {
+// return false;
+// }
+// return this.getPowerPercent() >= chargeLine;
+// } catch (Exception e) {
+// News.error("fail", e);
+// return false;
+// }
+// }
}
// 鏄惁澶勪簬绌洪棽寰呭懡鐘舵�侊紝浼犲叆鐨則askNo鍜屽綋鍓峵askNo鐩稿悓鏃跺厑璁告斁琛�
@@ -458,18 +525,19 @@
&& (this.taskNo == 0 || this.taskNo == taskNo)
&& this.protocolStatus.intValue() == ShuttleProtocolStatusType.IDLE.id
;
- if (!res) {
- return res;
- } else {
- // 鐢甸噺
- try {
- Integer chargeLine = SpringUtils.getBean(BasShuttleService.class).selectById(this.shuttleNo).getChargeLine();
- return this.getPowerPercent() > chargeLine;
- } catch (Exception e) {
- News.error("fail", e);
- return false;
- }
- }
+ return res;
+// if (!res) {
+// return res;
+// } else {
+// // 鐢甸噺
+// try {
+// Integer chargeLine = SpringUtils.getBean(BasShuttleService.class).selectById(this.shuttleNo).getChargeLine();
+// return this.getPowerPercent() > chargeLine;
+// } catch (Exception e) {
+// News.error("fail", e);
+// return false;
+// }
+// }
}
// 鏄惁澶勪簬绌洪棽寰呭懡鐘舵��
@@ -478,6 +546,17 @@
&& !this.pakMk
&& this.errState == 0
&& this.taskNo == 0
+ && this.protocolStatus == ShuttleProtocolStatusType.IDLE.id
+ ;
+ return res;
+ }
+
+ // 鏄惁澶勪簬绌洪棽寰呭懡鐘舵��
+ public Boolean isIdleNoCharge(int taskNo) {
+ boolean res = this.free == ShuttleStatusType.IDLE.id
+ && !this.pakMk
+ && this.errState == 0
+ && (this.taskNo == 0 || this.taskNo == taskNo)
&& this.protocolStatus == ShuttleProtocolStatusType.IDLE.id
;
return res;
@@ -513,11 +592,17 @@
if (chargeLine == null) {
return false;
}
- return this.getPowerPercent() < chargeLine || this.minCellVoltage < 2900;
+ return this.getPowerPercent() < chargeLine;
} catch (Exception e) {
News.error("fail", e);
return false;
}
}
}
+
+ public void setShuttleNo(Short shuttleNo) {
+ if (shuttleNo != 0) {
+ this.shuttleNo = shuttleNo;
+ }
+ }
}
--
Gitblit v1.9.1