From 39a7c54ceffb921258ac0148f58ccea60da0c87e Mon Sep 17 00:00:00 2001
From: Junjie <fallin.jie@qq.com>
Date: 星期四, 06 四月 2023 14:03:42 +0800
Subject: [PATCH] 充电逻辑
---
src/main/java/com/zy/core/model/protocol/ShuttleProtocol.java | 60 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++--
1 files changed, 58 insertions(+), 2 deletions(-)
diff --git a/src/main/java/com/zy/core/model/protocol/ShuttleProtocol.java b/src/main/java/com/zy/core/model/protocol/ShuttleProtocol.java
index 0214f58..302507e 100644
--- a/src/main/java/com/zy/core/model/protocol/ShuttleProtocol.java
+++ b/src/main/java/com/zy/core/model/protocol/ShuttleProtocol.java
@@ -1,13 +1,13 @@
package com.zy.core.model.protocol;
import com.core.common.SpringUtils;
+import com.zy.asrs.entity.LocMast;
import com.zy.asrs.service.BasShuttleService;
-import com.zy.asrs.service.BasSteService;
+import com.zy.asrs.service.LocMastService;
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.enums.SteStatusType;
import com.zy.core.model.command.ShuttleAssignCommand;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
@@ -230,4 +230,60 @@
}
}
+ // 鏄惁澶勪簬绌洪棽寰呭懡鐘舵�侊紝浼犲叆鐨則askNo鍜屽綋鍓峵askNo鐩稿悓鏃跺厑璁告斁琛�
+ public Boolean isIdle(Short taskNo) {
+ boolean res = this.busyStatusType.equals(ShuttleStatusType.IDLE)
+ && this.pakMk.equals(true)
+ && this.errorCodeType.equals(ShuttleErrorCodeType.NORMAL)
+ && (this.taskNo == 0 || this.taskNo == taskNo)
+ ;
+ if (!res) {
+ return res;
+ } else {
+ // 鐢甸噺
+ try {
+ Integer chargeLine = SpringUtils.getBean(BasShuttleService.class).selectById(this.shuttleNo).getChargeLine();
+ return this.getBatteryPower$() > chargeLine;
+ } catch (Exception e) {
+ News.error("fail", e);
+ return false;
+ }
+ }
+ }
+
+ // 鏄惁婊¤冻鍏呯數鐘舵��
+ public Boolean isRequireCharge() {
+ boolean res = this.busyStatusType.equals(ShuttleStatusType.IDLE)
+ && this.pakMk.equals(true)
+ && this.errorCodeType.equals(ShuttleErrorCodeType.NORMAL)
+ && this.taskNo == 0
+ ;
+ if (!res) {
+ return res;
+ } else {
+ // 鐢甸噺
+ try {
+ Integer chargeLine = SpringUtils.getBean(BasShuttleService.class).selectById(this.shuttleNo).getChargeLine();
+ return this.getBatteryPower$() < chargeLine;
+ } catch (Exception e) {
+ News.error("fail", e);
+ return false;
+ }
+ }
+ }
+
+ //閫氳繃褰撳墠浜岀淮鐮佽幏鍙栧綋鍓嶅簱浣嶅彿
+ public String getCurrentLocNo() {
+ LocMastService locMastService = SpringUtils.getBean(LocMastService.class);
+ if (locMastService == null) {
+ return null;
+ }
+ //婧愬簱浣�(灏忚溅褰撳墠浣嶇疆)
+ LocMast currentLocMast = locMastService.queryByQrCode(this.currentCode.toString());
+ if (currentLocMast == null) {
+ return null;
+ }
+ return currentLocMast.getLocNo();
+ }
+
}
--
Gitblit v1.9.1