From 16ad96d54cae5455436cda8673a4e8ee33149233 Mon Sep 17 00:00:00 2001
From: pang.jiabao <pang_jiabao@163.com>
Date: 星期三, 26 六月 2024 16:55:19 +0800
Subject: [PATCH] # led显示

---
 src/main/java/com/zy/core/thread/LedThread.java |   61 ++++++++----------------------
 1 files changed, 16 insertions(+), 45 deletions(-)

diff --git a/src/main/java/com/zy/core/thread/LedThread.java b/src/main/java/com/zy/core/thread/LedThread.java
index b263a9e..75a0f53 100644
--- a/src/main/java/com/zy/core/thread/LedThread.java
+++ b/src/main/java/com/zy/core/thread/LedThread.java
@@ -1,9 +1,7 @@
 package com.zy.core.thread;
 
-import com.alibaba.fastjson.JSON;
-import com.core.common.Cools;
-import com.zy.common.entity.Parameter;
 import com.zy.common.model.MatDto;
+import com.zy.common.utils.News;
 import com.zy.core.Slave;
 import com.zy.core.ThreadHandler;
 import com.zy.core.cache.MessageQueue;
@@ -63,7 +61,7 @@
     @Override
     @SuppressWarnings({"InfiniteLoopStatement", "unchecked"})
     public void run() {
-        connect();
+//        connect();
         close();
         while (true) {
             try {
@@ -116,17 +114,18 @@
         TextBxPage page = new TextBxPage();
         for (LedCommand command : list) {
             page.newLine(command.getTitle() +"锛�"+command.getWorkNo()+")");
-            page.newLine("搴撲綅锛�"+ (command.getIoType() < 100 ? command.getLocNo() : command.getSourceLocNo()));
-            page.newLine("鐩爣绔欙細"+command.getStaNo());
             if (!command.isEmptyMk()) {
                 for (MatDto matDto : command.getMatDtos()) {
                     //鍘绘帀灏忔暟鐐�
                     String strQty = matDto.getCount().toString();
                     int idx = strQty.lastIndexOf(".");
                     if(idx >= 0){
-                        strQty.substring(0,idx);
+                        strQty = strQty.substring(0,idx);
                     }
-                    page.newLine(matDto.getMaknx() + "[鏁伴噺" + strQty +"]");
+                    page.newLine(matDto.getMatnr());
+                    page.newLine(matDto.getMaknx());
+                    page.newLine("[鏁伴噺锛�" + strQty +  "/" +  matDto.getTotal().intValue()+"]");
+//                    page.newLine(matDto.getMaknx() + "[鏁伴噺" + strQty +"]");
 //                    page.newLine(matDto.getMaknx() + "銆愭暟閲�" + matDto.getCount() +"銆�");
                 }
             }
@@ -143,7 +142,7 @@
         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);
@@ -193,7 +192,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);
@@ -201,6 +200,7 @@
         }
         close();
     }
+
     private void write7(List<LedCommand> list) {
         commandList = list;
 
@@ -211,8 +211,9 @@
             sb.append("鐩爣绔欙細").append(command.getStaNo()).append("\n");
             if (!command.isEmptyMk()) {
                 for (MatDto matDto : command.getMatDtos()) {
-                    sb.append("鐗╂枡缂栫爜锛�").append(matDto.getMatNo()).append("\n");
+                    sb.append("鐗╂枡缂栫爜锛�").append(matDto.getMatnr()).append("\n");
                     sb.append("鏁伴噺锛�").append(matDto.getCount()).append("\n");
+                    sb.append("瑙勬牸锛�").append(matDto.getSpecs()).append("\n");
                 }
             }
             sb.append("\n");
@@ -249,16 +250,16 @@
         } catch (Exception ignore) {
         }
         if (connRes) {
-            log.info("led杩炴帴鎴愬姛 ===>> [id:{}] [ip:{}] [port:{}]", slave.getId(), slave.getIp(), slave.getPort());
+            News.info("Led"+" - 4"+" - led杩炴帴鎴愬姛 ===>> [id:{}] [ip:{}] [port:{}]", slave.getId(), slave.getIp(), slave.getPort());
         } else {
-            log.error("led杩炴帴澶辫触锛侊紒锛� ===>> [id:{}] [ip:{}] [port:{}]", slave.getId(), slave.getIp(), slave.getPort());
+            News.error("Led"+" - 5"+" - led杩炴帴澶辫触锛侊紒锛� ===>> [id:{}] [ip:{}] [port:{}]", slave.getId(), slave.getIp(), slave.getPort());
         }
         return connRes;
     }
 
     @Override
     public void close() {
-        screen.disconnect();
+
     }
 
 
@@ -308,7 +309,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);
@@ -318,36 +319,6 @@
         // 缁у紑涓庢帶鍒跺櫒涔嬮棿鐨勯摼鎺�
 //        screen.disconnect();
     }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
 
 
     public static void main1(String[] args) throws Exception {

--
Gitblit v1.9.1