From b82892d4b6d7ddd51d550871223036e993f76cf6 Mon Sep 17 00:00:00 2001
From: Junjie <fallin.jie@qq.com>
Date: 星期三, 02 八月 2023 14:32:50 +0800
Subject: [PATCH] 提升机、穿梭车独占令牌页面显示与控制
---
src/main/java/com/zy/core/model/protocol/NyShuttleProtocol.java | 53 ++++++++++++++++++++++++++++++++++++++++++++++++++---
1 files changed, 50 insertions(+), 3 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 6904bbc..dcde899 100644
--- a/src/main/java/com/zy/core/model/protocol/NyShuttleProtocol.java
+++ b/src/main/java/com/zy/core/model/protocol/NyShuttleProtocol.java
@@ -2,9 +2,11 @@
import com.alibaba.fastjson.JSON;
import com.core.common.SpringUtils;
+import com.zy.asrs.entity.BasShuttle;
import com.zy.asrs.service.BasShuttleService;
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;
@@ -189,6 +191,13 @@
* 闈炶嚜鍔ㄧ姸鎬佹椂闂磋鏃�(S)
*/
private Integer errTime;
+
+ /**
+ * 鐙崰浠ょ墝
+ * 鏈浠诲姟鍗犳嵁锛屼护鐗屼负0
+ * 琚换鍔″崰鎹紝灏嗕换鍔″彿璧嬪�肩粰浠ょ墝
+ */
+ private Integer token = 0;
//鎬婚噷绋嬫暟
@Data
@@ -394,7 +403,7 @@
// 鏄惁澶勪簬绌洪棽寰呭懡鐘舵��
public Boolean isIdle() {
boolean res = this.free == ShuttleStatusType.IDLE.id
- && this.pakMk.equals(true)
+ && !this.pakMk
&& this.errState == 0
&& this.taskNo == 0
&& this.protocolStatus == ShuttleProtocolStatusType.IDLE.id
@@ -419,7 +428,7 @@
// 鏄惁澶勪簬绌洪棽寰呭懡鐘舵�侊紝浼犲叆鐨則askNo鍜屽綋鍓峵askNo鐩稿悓鏃跺厑璁告斁琛�
public Boolean isIdle(int taskNo) {
boolean res = this.free == ShuttleStatusType.IDLE.id
- && this.pakMk.equals(true)
+ && !this.pakMk
&& this.errState == 0
&& (this.taskNo == 0 || this.taskNo == taskNo)
&& this.protocolStatus.intValue() == ShuttleProtocolStatusType.IDLE.id
@@ -441,11 +450,49 @@
// 鏄惁澶勪簬绌洪棽寰呭懡鐘舵��
public Boolean isIdleNoCharge() {
boolean res = this.free == ShuttleStatusType.IDLE.id
- && this.pakMk.equals(true)
+ && !this.pakMk
&& this.errState == 0
&& this.taskNo == 0
&& this.protocolStatus == ShuttleProtocolStatusType.IDLE.id
;
return res;
}
+
+ // 鏄惁婊¤冻鍏呯數鐘舵��
+ public Boolean isRequireCharge() {
+ if (this.free == null || this.pakMk == null || this.errState == null || this.taskNo == null) {
+ return false;
+ }
+
+ boolean res = this.free == ShuttleStatusType.IDLE.id
+ && !this.pakMk
+ && this.errState == 0
+ && this.taskNo == 0
+ && this.protocolStatusType.id == ShuttleProtocolStatusType.IDLE.id
+ ;
+ if (!res) {
+ return res;
+ } else {
+ // 鐢甸噺灏忎簬闃堝�兼垨鏈�浣庣數鑺數鍘嬪皬浜�2900mv锛岄渶瑕佽繘琛屽厖鐢�
+ try {
+ BasShuttleService shuttleService = SpringUtils.getBean(BasShuttleService.class);
+ if (shuttleService == null) {
+ return false;
+
+ }
+ BasShuttle basShuttle = shuttleService.selectById(this.shuttleNo);
+ if (basShuttle == null) {
+ return false;
+ }
+ Integer chargeLine = basShuttle.getChargeLine();
+ if (chargeLine == null) {
+ return false;
+ }
+ return this.getPowerPercent() < chargeLine || this.minCellVoltage < 2900;
+ } catch (Exception e) {
+ News.error("fail", e);
+ return false;
+ }
+ }
+ }
}
--
Gitblit v1.9.1