From cf2e4086d44e51bcd7407133d460dda498b45eff Mon Sep 17 00:00:00 2001
From: whycq <you@example.com>
Date: 星期三, 28 六月 2023 21:55:29 +0800
Subject: [PATCH] #

---
 src/main/java/com/zy/core/model/protocol/SteProtocol.java |   82 ++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 80 insertions(+), 2 deletions(-)

diff --git a/src/main/java/com/zy/core/model/protocol/SteProtocol.java b/src/main/java/com/zy/core/model/protocol/SteProtocol.java
index 90f2103..cda2621 100644
--- a/src/main/java/com/zy/core/model/protocol/SteProtocol.java
+++ b/src/main/java/com/zy/core/model/protocol/SteProtocol.java
@@ -1,14 +1,20 @@
 package com.zy.core.model.protocol;
 
+import com.core.common.Cools;
+import com.core.common.SpringUtils;
 import com.zy.asrs.entity.BasSte;
+import com.zy.asrs.service.BasSteService;
+import com.zy.common.utils.News;
 import com.zy.core.enums.SteHisTaskStatusType;
 import com.zy.core.enums.SteLocaType;
 import com.zy.core.enums.SteStatusType;
 import lombok.Data;
+import lombok.extern.slf4j.Slf4j;
 
 /**
  * Created by vincent on 2020/8/7
  */
+@Slf4j
 @Data
 public class SteProtocol {
 
@@ -18,6 +24,7 @@
     private Short steNo;
 
     /**
+     * -1 = 绂荤嚎
      * 1 = 鑱旀満妯″紡
      * 0 = 鑴辨満妯″紡
      */
@@ -36,7 +43,7 @@
     /**
      * 浠诲姟鍙�
      */
-    public Integer taskNo = 0;
+    public Short taskNo = 0;
 
     /**
      * 姝e湪鎵ц浠诲姟
@@ -180,6 +187,17 @@
      */
     public Short crnAllowRun;
 
+    /**
+     * 鍏呯數鐘舵��  1锛氬湪鍏呯數锛�0锛氫笉鍦ㄥ厖鐢�
+     */
+    private Short chargeStatus;
+
+    // 鍏ュ簱鍙栫┖
+    private Boolean inEmpty;
+
+    // 鍑哄簱鍙栫┖
+    private Boolean outEmpty;
+
     public void setStatus(Short status){
         this.status = status;
         this.statusType = SteStatusType.get(status);
@@ -217,12 +235,72 @@
      */
     private String lastIo = "I";
 
+    private String pakMk = "-";
 
     public BasSte toSqlModel(BasSte basSte){
         if (alarm!=null) {
             basSte.setSteErr(alarm.longValue());
         }
-        basSte.setWrkNo(taskNo);
+        basSte.setWrkNo(taskNo.intValue());
+//        if (basSte.getPakMk().equals("N")) {
+//            if (!Cools.isEmpty(row)) {
+//                basSte.setRow(row.intValue());
+//            }
+//            if (!Cools.isEmpty(bay)) {
+//                basSte.setBay(bay.intValue());
+//            }
+//            if (!Cools.isEmpty(lev)) {
+//                basSte.setLev(lev.intValue());
+//            }
+//        }
         return basSte;
     }
+
+    // 鏄惁澶勪簬绌洪棽寰呭懡鐘舵��
+    public Boolean isIdle() {
+        boolean res = this.statusType.equals(SteStatusType.IDLE)
+                && this.pakMk.equals("N")
+                && !isAlarm()
+                && this.chargeStatus == 0
+                && isEnable()
+                && this.getMode()==1
+                ;
+        if (!res) {
+            return res;
+        } else {
+            // 鐢甸噺
+            try {
+                String chargeLine = SpringUtils.getBean(BasSteService.class).selectById(this.steNo).getChargeLine();
+                return charge > Float.parseFloat(chargeLine);
+            } catch (Exception e) {
+                News.error("fail", e);
+                return false;
+            }
+        }
+    }
+
+    // 鏄惁澶勪簬鎶ヨ鐘舵��
+    public Boolean isAlarm() {
+        return this.alarm > 1;
+    }
+
+    public Boolean isEnable() {
+        if (Cools.isEmpty(row)) {
+            if (row == 0) {
+                return false;
+            }
+        }
+        if (Cools.isEmpty(bay)) {
+            if (bay == 0) {
+                return false;
+            }
+        }
+        if (Cools.isEmpty(lev)) {
+            if (lev == 0) {
+                return false;
+            }
+        }
+        return true;
+    }
+
 }

--
Gitblit v1.9.1