From b427e1d0102d4b3b4263c7c6e572f29f9c50bef9 Mon Sep 17 00:00:00 2001
From: 野心家 <1051256694@qq.com>
Date: 星期四, 08 五月 2025 11:01:04 +0800
Subject: [PATCH] 初始化

---
 src/main/java/com/zy/core/thread/LedThread.java |  106 +++++++++-------------------------------------------
 1 files changed, 19 insertions(+), 87 deletions(-)

diff --git a/src/main/java/com/zy/core/thread/LedThread.java b/src/main/java/com/zy/core/thread/LedThread.java
index 2e77421..10a1af3 100644
--- a/src/main/java/com/zy/core/thread/LedThread.java
+++ b/src/main/java/com/zy/core/thread/LedThread.java
@@ -2,6 +2,7 @@
 
 import com.alibaba.fastjson.JSON;
 import com.core.common.Cools;
+import com.zy.asrs.utils.News;
 import com.zy.common.entity.Parameter;
 import com.zy.common.model.MatDto;
 import com.zy.core.Slave;
@@ -56,7 +57,7 @@
 //            screen = new Bx5GScreenClient("my");
         } catch (Exception e) {
             e.printStackTrace();
-            log.info("led杩炴帴鏋勯�犲櫒閿欒 ===>> [id:{}] [ip:{}] [port:{}]", slave.getId(), slave.getIp(), slave.getPort());
+            News.info("Led"+" - 1"+" - led杩炴帴鏋勯�犲櫒閿欒 ===>> [id:{}] [ip:{}] [port:{}]", slave.getId(), slave.getIp(), slave.getPort());
         }
     }
 
@@ -64,7 +65,7 @@
     @SuppressWarnings({"InfiniteLoopStatement", "unchecked"})
     public void run() {
 //        connect();
-//        close();
+        close();
         while (true) {
             try {
                 Task task = MessageQueue.poll(SlaveType.Led, slave.getId());
@@ -73,10 +74,6 @@
                         // 鍐欐暟鎹�
                         case 1:
                             write((List<LedCommand>)task.getData());
-                            break;
-                        // 鍐欐暟鎹�
-                        case 9:
-                            write9((List<LedCommand>)task.getData());
                             break;
                         // 澶嶄綅
                         case 2:
@@ -130,7 +127,7 @@
                     if(idx >= 0){
                         strQty.substring(0,idx);
                     }
-                    page.newLine(matDto.getMaknx() + "[鏁伴噺" + strQty +"]");
+                    page.newLine(matDto.getMaktx() + "[鏁伴噺" + strQty +"]");
 //                    page.newLine(matDto.getMaknx() + "銆愭暟閲�" + matDto.getCount() +"銆�");
                 }
             }
@@ -147,41 +144,7 @@
         area.addPage(page);
         pf.addArea(area);
         if (pf.validate() != null) {
-            log.info("pf out of range");
-        } else {
-            // 鏇存柊鑺傜洰
-            screen.writeProgram(pf);
-//            resetStatus = false;
-        }
-        close();
-    }
-
-    private void write9(List<LedCommand> list) throws Bx5GException {
-        if (!connect()) {
-            return;
-        }
-        pf = new ProgramBxFile( 0, screen.getProfile());
-        pf.setFrameShow(false);
-        // 鍒嗗埆杈撳叆X锛孻锛寃idth锛宧eight
-        area = new TextCaptionBxArea( 0,0,96,48, screen.getProfile());
-        // 鍒涘缓涓�涓暟鎹〉
-        TextBxPage page = new TextBxPage();
-        for (LedCommand command : list) {
-            page.newLine(command.getTitle());
-            page.newLine("\n");
-        }
-
-        // 璁剧疆瀛椾綋
-        page.setFont(new Font("瀹嬩綋",Font.PLAIN,12));
-        // 璁剧疆鏂囨湰棰滆壊
-        page.setForeground(Color.red);
-        // 璁剧疆鏄剧ず鐗规妧涓哄揩閫熸墦鍑�
-        page.setDisplayStyle(styles[6]);
-        area.clearPages();
-        area.addPage(page);
-        pf.addArea(area);
-        if (pf.validate() != null) {
-            log.info("pf out of range");
+            News.info("Led"+" - 2"+" - pf out of range");
         } else {
             // 鏇存柊鑺傜洰
             screen.writeProgram(pf);
@@ -231,7 +194,7 @@
         pf.addArea(area);
         // 鏇存柊鑺傜洰
         if (pf.validate() != null) {
-            log.info("pf out of range");
+            News.info("Led"+" - 3"+" - pf out of range");
         } else {
             // 鏇存柊鑺傜洰
             screen.writeProgram(pf);
@@ -239,6 +202,7 @@
         }
         close();
     }
+
     private void write7(List<LedCommand> list) {
         commandList = list;
 
@@ -250,10 +214,8 @@
             if (!command.isEmptyMk()) {
                 for (MatDto matDto : command.getMatDtos()) {
                     sb.append("鐗╂枡缂栫爜锛�").append(matDto.getMatnr()).append("\n");
-                    sb.append("鍚嶇О锛�").append(matDto.getMaknx()).append("\n");
                     sb.append("鏁伴噺锛�").append(matDto.getCount()).append("\n");
                     sb.append("瑙勬牸锛�").append(matDto.getSpecs()).append("\n");
-                    sb.append("鍥惧彿锛�").append(matDto.getModel()).append("\n");
                 }
             }
             sb.append("\n");
@@ -284,22 +246,22 @@
     @Override
     public boolean connect() {
         boolean connRes = false;
-//        try {
-//            connRes = screen.connect(slave.getIp(),slave.getPort());
-//            screen.turnOn();
-//        } catch (Exception ignore) {
-//        }
-//        if (connRes) {
-//            log.info("led杩炴帴鎴愬姛 ===>> [id:{}] [ip:{}] [port:{}]", slave.getId(), slave.getIp(), slave.getPort());
-//        } else {
-//            log.error("led杩炴帴澶辫触锛侊紒锛� ===>> [id:{}] [ip:{}] [port:{}]", slave.getId(), slave.getIp(), slave.getPort());
-//        }
+        try {
+            connRes = screen.connect(slave.getIp(),slave.getPort());
+            screen.turnOn();
+        } catch (Exception ignore) {
+        }
+        if (connRes) {
+            News.info("Led"+" - 4"+" - led杩炴帴鎴愬姛 ===>> [id:{}] [ip:{}] [port:{}]", slave.getId(), slave.getIp(), slave.getPort());
+        } else {
+            News.error("Led"+" - 5"+" - led杩炴帴澶辫触锛侊紒锛� ===>> [id:{}] [ip:{}] [port:{}]", slave.getId(), slave.getIp(), slave.getPort());
+        }
         return connRes;
     }
 
     @Override
     public void close() {
-//        screen.disconnect();
+
     }
 
 
@@ -349,7 +311,7 @@
             // 鏇存柊鑺傜洰
             if (pf.validate() != null) {
                 System.out.println("pf out of range");
-                log.info("pf out of range");
+                News.info("Led"+" - 6"+" - pf out of range");
             } else {
                 // 鏇存柊鑺傜洰
                 screen.writeProgram(pf);
@@ -359,36 +321,6 @@
         // 缁у紑涓庢帶鍒跺櫒涔嬮棿鐨勯摼鎺�
 //        screen.disconnect();
     }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
 
 
     public static void main1(String[] args) throws Exception {

--
Gitblit v1.9.1