From d7b48f2e68180b36ca39c6675b2a861601c831df Mon Sep 17 00:00:00 2001
From: Junjie <fallin.jie@qq.com>
Date: 星期二, 01 八月 2023 16:52:47 +0800
Subject: [PATCH] 充电

---
 src/main/java/com/zy/core/model/protocol/NyShuttleProtocol.java |   56 +++++++++++++++++++++++++++++++++++++++++++++++++++++---
 1 files changed, 53 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 f6cd422..cabfb2d 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;
@@ -63,7 +65,7 @@
     /**
      * 浣滀笟鏍囪
      */
-    private Boolean pakMk = false;
+    private Boolean pakMk = true;
 
     /**
      * 鎵嬪姩鐘舵��/鑷姩鐘舵��
@@ -375,7 +377,7 @@
         if (this.getPoint() == null) {
             return "";
         }
-        return NavigatePositionConvert.xyzToLocNo(this.getPoint().getX(), this.getPoint().getY(), this.getPoint().getZ());
+        return NavigatePositionConvert.nyXyzToLocNo(this.getPoint().getX(), this.getPoint().getY(), this.getPoint().getZ());
     }
 
     public String getCoord$() {
@@ -386,7 +388,7 @@
     }
 
     public void setPoint(NyShuttlePointClass point) {
-        String locNo = NavigatePositionConvert.xyzToLocNo(point.getX(), point.getY(), point.getZ());
+        String locNo = NavigatePositionConvert.nyXyzToLocNo(point.getX(), point.getY(), point.getZ());
         this.point = point;
         this.currentLocNo = locNo;
     }
@@ -438,4 +440,52 @@
         }
     }
 
+    // 鏄惁澶勪簬绌洪棽寰呭懡鐘舵��
+    public Boolean isIdleNoCharge() {
+        boolean res = this.free == ShuttleStatusType.IDLE.id
+                && this.pakMk.equals(true)
+                && 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