From 02e5449fc0e582a1d3bbd160f6557218eca013b0 Mon Sep 17 00:00:00 2001
From: pjb <123456>
Date: 星期二, 02 七月 2024 12:44:12 +0800
Subject: [PATCH] 修改led显示

---
 src/main/java/com/zy/core/thread/LedThread.java             |   58 ++++++++++++++++------------
 src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java |   16 ++++----
 2 files changed, 41 insertions(+), 33 deletions(-)

diff --git a/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java b/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
index e5a7768..976588f 100644
--- a/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
+++ b/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
@@ -226,7 +226,7 @@
                         // led 寮傚父鏄剧ず
                         if (ledThread != null) {
                             String errorMsg = "宸ヤ綔妗e凡瀛樺湪璇ユ潯鐮佸彿===>>" + barcode;
-                            MessageQueue.offer(SlaveType.Led, inSta.getLed(), new Task(5, errorMsg));
+//                            MessageQueue.offer(SlaveType.Led, inSta.getLed(), new Task(5, errorMsg));
                         }
                         continue;
                     }
@@ -277,9 +277,9 @@
                                 ledCommand.setBarcode(barcode);
                                 commands.add(ledCommand);
                                 if (devp.getId() == 1) {
-                                     if (MessageQueue.offer(SlaveType.Led, inSta.getLed(), new Task(1, commands))){
-                                         ledThread.setLedMk(false);
-                                     }
+//                                     if (MessageQueue.offer(SlaveType.Led, inSta.getLed(), new Task(1, commands))){
+//                                         ledThread.setLedMk(false);
+//                                     }
                                 } else {
                                     if (MessageQueue.offer(SlaveType.Led, inSta.getLed(), new Task(3, commands))){
                                         ledThread.setLedMk(false);
@@ -538,9 +538,9 @@
                     ledCommand.setMatDtos(matDtos);
                     commands.add(ledCommand);
                     if (devp.getId() == 1) {
-                        if (MessageQueue.offer(SlaveType.Led, pickSta.getLed(), new Task(1, commands))) {
-                            ledThread.setLedMk(false);
-                        }
+//                        if (MessageQueue.offer(SlaveType.Led, pickSta.getLed(), new Task(1, commands))) {
+//                            ledThread.setLedMk(false);
+//                        }
                     } else {
                         if (MessageQueue.offer(SlaveType.Led, pickSta.getLed(), new Task(3, commands))){
                             ledThread.setLedMk(false);
@@ -1604,7 +1604,7 @@
                                 ledCommand.setMatDtos(matDtos);
                                 commands.add(ledCommand);
                                 if (devp.getId() == 1) {
-                                    MessageQueue.offer(SlaveType.Led, emptyInSta.getLed(), new Task(1, commands));
+//                                    MessageQueue.offer(SlaveType.Led, emptyInSta.getLed(), new Task(1, commands));
                                 } else {
                                     MessageQueue.offer(SlaveType.Led, emptyInSta.getLed(), new Task(3, commands));
                                 }
diff --git a/src/main/java/com/zy/core/thread/LedThread.java b/src/main/java/com/zy/core/thread/LedThread.java
index 259ef47..d7d061f 100644
--- a/src/main/java/com/zy/core/thread/LedThread.java
+++ b/src/main/java/com/zy/core/thread/LedThread.java
@@ -103,6 +103,7 @@
     }
 
     private void write(List<LedCommand> list) throws Bx5GException {
+        try {
         if (!connect()) {
             return;
         }
@@ -155,21 +156,25 @@
 //            resetStatus = false;
         }
         close();
+        }catch (Exception e){
+
+        }
     }
 
     private void reset() throws Bx5GException {
-        if (!connect()) {
-            return;
-        }
+        try {
+            if (!connect()) {
+                return;
+            }
 //        if (resetStatus) {
 //            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();
+            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();
 
 //        List<String> list = null;
 //        try {
@@ -185,26 +190,29 @@
 //            page.newLine("鑷姩鍖栫珛浣撲粨搴�");
 //            page.newLine("瑗挎牸杩堣偂浠芥湁闄愬叕鍙�");
 //        }
-        page.newLine("鎹蜂紬鏅鸿兘浠撳偍");
+            page.newLine("鎹蜂紬鏅鸿兘浠撳偍");
 
-        // 璁剧疆瀛椾綋
-        page.setFont(new Font("瀹嬩綋",Font.PLAIN,13));
-        // 璁剧疆鏂囨湰棰滆壊
-        page.setForeground(Color.red);
-        // 璁剧疆鏄剧ず鐗规妧涓哄揩閫熸墦鍑�
-        page.setDisplayStyle(styles[6]);
-        area.clearPages();
-        area.addPage(page);
-        pf.addArea(area);
-        // 鏇存柊鑺傜洰
-        if (pf.validate() != null) {
-            News.info("Led"+" - 3"+" - pf out of range");
-        } else {
+            // 璁剧疆瀛椾綋
+            page.setFont(new Font("瀹嬩綋", Font.PLAIN, 13));
+            // 璁剧疆鏂囨湰棰滆壊
+            page.setForeground(Color.red);
+            // 璁剧疆鏄剧ず鐗规妧涓哄揩閫熸墦鍑�
+            page.setDisplayStyle(styles[6]);
+            area.clearPages();
+            area.addPage(page);
+            pf.addArea(area);
             // 鏇存柊鑺傜洰
-            screen.writeProgram(pf);
+            if (pf.validate() != null) {
+                News.info("Led" + " - 3" + " - pf out of range");
+            } else {
+                // 鏇存柊鑺傜洰
+                screen.writeProgram(pf);
 //            resetStatus = true;
+            }
+            close();
+        } catch (Exception e){
+
         }
-        close();
     }
 
     private void write7(List<LedCommand> list) {

--
Gitblit v1.9.1