From d0ab6eacebef135d530017e72d3fb6cab8393724 Mon Sep 17 00:00:00 2001
From: zjj <3272660260@qq.com>
Date: 星期五, 02 二月 2024 10:05:49 +0800
Subject: [PATCH] #输送线报错

---
 src/main/java/com/zy/asrs/controller/SiteController.java |  138 +++++++++++++++++++++++++++++++++++++++-------
 1 files changed, 117 insertions(+), 21 deletions(-)

diff --git a/src/main/java/com/zy/asrs/controller/SiteController.java b/src/main/java/com/zy/asrs/controller/SiteController.java
index 9cab390..b0abae8 100644
--- a/src/main/java/com/zy/asrs/controller/SiteController.java
+++ b/src/main/java/com/zy/asrs/controller/SiteController.java
@@ -2,6 +2,7 @@
 
 import com.baomidou.mybatisplus.mapper.EntityWrapper;
 import com.core.annotations.ManagerAuth;
+import com.core.common.Cools;
 import com.core.common.R;
 import com.zy.asrs.domain.vo.PlcErrorTableVo;
 import com.zy.asrs.domain.vo.SiteTableVo;
@@ -94,29 +95,12 @@
             Map<Integer, StaProtocol> station = devpThread.getStation();
 
             for(Map.Entry<Integer, StaProtocol> entry : station.entrySet()) {
-                StaProtocol staProtocol = entry.getValue();
-//                if (staProtocol) {
-//                    PlcErrorTableVo vo = new PlcErrorTableVo();
-//                    vo.setNo(entry.getKey());   //  搴忓彿
-//
-//                    vo.setPlcDesc("");  //  todo:luxiaotao plc閿欒鎻忚堪
-//                    vo.setError("");    //  todo:luxiaotao 寮傚父淇℃伅
-//                    list.add(vo);
-//                }
-            }
+                if (!Cools.isEmpty(staPlcErr(entry))){
+                    list.add(staPlcErr(entry).get(0)) ;
+                }
 
+            }
         }
-
-        list.sort((o1, o2) -> {
-            if (o1.getNo().compareTo(o2.getNo()) > 0){
-                return 1;
-            }else if (o1.getNo().compareTo(o2.getNo()) < 0){
-                return 0;
-            }else{
-                return -1;
-            }
-
-        });
         return R.ok().add(list);
     }
 
@@ -201,5 +185,117 @@
         return R.error("plc宸叉帀绾�");
     }
 
+    public List<PlcErrorTableVo> staPlcErr(Map.Entry<Integer, StaProtocol> entry){
+        List<PlcErrorTableVo> list = new ArrayList<>();
+        StaProtocol staProtocol = entry.getValue();
+        if (staProtocol.getBreakerErr()){
+            PlcErrorTableVo vo = new PlcErrorTableVo();
+            vo.setNo(entry.getKey());   //  搴忓彿
+            vo.setPlcDesc("鏂矾鍣ㄦ晠闅�");
+            vo.setError("鏂矾鍣ㄦ晠闅�");
+            list.add(vo);
+        }
+        if (staProtocol.getInfraredErr()){
+            PlcErrorTableVo vo = new PlcErrorTableVo();
+            vo.setNo(entry.getKey());   //  搴忓彿
+            vo.setPlcDesc("鍏夌數寮傚父");
+            vo.setError("鍏夌數寮傚父");
+            list.add(vo);
+        }
+        if (staProtocol.getOutTimeErr()){
+            PlcErrorTableVo vo = new PlcErrorTableVo();
+            vo.setNo(entry.getKey());   //  搴忓彿
+
+            vo.setPlcDesc("杩愯瓒呮椂");
+            vo.setError("杩愯瓒呮椂");
+            list.add(vo);
+        }
+        if (staProtocol.getSeizeSeatErr()){
+            PlcErrorTableVo vo = new PlcErrorTableVo();
+            vo.setNo(entry.getKey());   //  搴忓彿
+
+            vo.setPlcDesc("鍗犱綅瓒呮椂");
+            vo.setError("鍗犱綅瓒呮椂");
+            list.add(vo);
+        }
+        if (staProtocol.getWrkYgoodsN()){
+            PlcErrorTableVo vo = new PlcErrorTableVo();
+            vo.setNo(entry.getKey());   //  搴忓彿
+
+            vo.setPlcDesc("鏈変换鍔℃棤璐ф晠闅�");
+            vo.setError("鏈変换鍔℃棤璐ф晠闅�");
+            list.add(vo);
+        }
+        if (staProtocol.getInverterErr()){
+            PlcErrorTableVo vo = new PlcErrorTableVo();
+            vo.setNo(entry.getKey());   //  搴忓彿
+
+            vo.setPlcDesc("鍙橀鍣ㄦ晠闅�");
+            vo.setError("鍙橀鍣ㄦ晠闅�");
+            list.add(vo);
+        }
+        if (staProtocol.getContactErr()){
+            PlcErrorTableVo vo = new PlcErrorTableVo();
+            vo.setNo(entry.getKey());   //  搴忓彿
+
+            vo.setPlcDesc("鐢垫満鎺ヨЕ鍣ㄦ晠闅�");
+            vo.setError("鐢垫満鎺ヨЕ鍣ㄦ晠闅�");
+            list.add(vo);
+        }
+        if (staProtocol.getUpcontactErr()){
+            PlcErrorTableVo vo = new PlcErrorTableVo();
+            vo.setNo(entry.getKey());   //  搴忓彿
+
+            vo.setPlcDesc("椤跺崌鐢垫満鎺ヨЕ鍣ㄦ晠闅�");
+            vo.setError("椤跺崌鐢垫満鎺ヨЕ鍣ㄦ晠闅�");
+            list.add(vo);
+        }
+        if (staProtocol.isFrontErr()){
+            PlcErrorTableVo vo = new PlcErrorTableVo();
+            vo.setNo(entry.getKey());   //  搴忓彿
+            vo.setPlcDesc("鍓嶈秴闄�");
+            vo.setError("鍓嶈秴闄�");
+            list.add(vo);
+        }
+        if (staProtocol.isBackErr()){
+            PlcErrorTableVo vo = new PlcErrorTableVo();
+            vo.setNo(entry.getKey());   //  搴忓彿
+            vo.setPlcDesc("鍚庤秴闄�");
+            vo.setError("鍚庤秴闄�");
+            list.add(vo);
+        }
+        if (staProtocol.isHighErr()){
+            PlcErrorTableVo vo = new PlcErrorTableVo();
+            vo.setNo(entry.getKey());   //  搴忓彿
+            vo.setPlcDesc("楂樿秴闄�");
+            vo.setError("楂樿秴闄�");
+            list.add(vo);
+        }
+        if (staProtocol.isLeftErr()){
+            PlcErrorTableVo vo = new PlcErrorTableVo();
+            vo.setNo(entry.getKey());   //  搴忓彿
+            vo.setPlcDesc("宸﹁秴闄�");
+            vo.setError("宸﹁秴闄�");
+            list.add(vo);
+        }
+        if (staProtocol.isRightErr()){
+            PlcErrorTableVo vo = new PlcErrorTableVo();
+            vo.setNo(entry.getKey());   //  搴忓彿
+            vo.setPlcDesc("鍙宠秴闄�");
+            vo.setError("鍙宠秴闄�");
+            list.add(vo);
+        }
+        if (staProtocol.isBarcodeErr()){
+            PlcErrorTableVo vo = new PlcErrorTableVo();
+            vo.setNo(entry.getKey());   //  搴忓彿
+            vo.setPlcDesc("鎵爜澶辫触");
+            vo.setError("鎵爜澶辫触");
+            list.add(vo);
+        }
+
+
+        return list;
+    }
+
 
 }

--
Gitblit v1.9.1