Ver Fonte

气密点位对应

17491 há 1 semana atrás
pai
commit
33b0cbb9ea
2 ficheiros alterados com 23 adições e 72 exclusões
  1. 21 70
      src/com/mes/ui/MesClient.java
  2. 2 2
      src/resources/config/config.properties

+ 21 - 70
src/com/mes/ui/MesClient.java

@@ -76,8 +76,6 @@ public class MesClient extends JFrame {
     public static JButton finish_ng_bt;
     public static JTextField product_sn;
     public static JButton f_scan_data_bt_1;
-    public static JButton nextBtn1; // 面板1的下一步
-    public static JButton prevBtn2; // 面板2的上一步
 
     public static String user20 = "";
 
@@ -99,8 +97,8 @@ public class MesClient extends JFrame {
     public static boolean timer_flag = false; // 开始计时标志 false=非工作开始计时 true=工件开始计时
     public static long timer_nums = 0; // 秒数
 
-    public static JButton[] weldButtons = new JButton[116]; // 存储按钮对象
-    public static boolean[] weldClickStates = new boolean[116]; // 存储点击状态
+    public static JButton[] weldButtons = new JButton[39]; // 存储按钮对象
+    public static boolean[] weldClickStates = new boolean[39]; // 存储点击状态
     public static JButton btnNormal;
     public static JButton btnRepair;
     public static int isRepair = 0; // 默认 0:正常, 1:返修
@@ -604,11 +602,11 @@ public class MesClient extends JFrame {
         centerPanel1.setLayout(new BorderLayout(10, 10));
         centerPanel1.setBorder(new EmptyBorder(10, 20, 10, 20));
 
-        // 3. 漏点按钮 1-58 (数组下标 0-57)
+        // 3. 点位按钮:A1-A9、B1-B16、C1-C2、D1-D12
         JPanel weldPanel1 = new JPanel();
-        weldPanel1.setLayout(new GridLayout(8, 8, 10, 10)); // 8行8列
+        weldPanel1.setLayout(new GridLayout(5, 8, 10, 10));
         weldPanel1.setOpaque(false);
-        addWeldButtonsToPanel(weldPanel1, 0, 58); // 调用辅助方法
+        addWeldButtonsToPanel(weldPanel1, 0, weldButtons.length);
         centerPanel1.add(weldPanel1, BorderLayout.CENTER);
 
         // 4. 返修标签
@@ -622,58 +620,16 @@ public class MesClient extends JFrame {
 
         indexPanelA.add(centerPanel1, BorderLayout.CENTER);
 
-        // 底部面板:下一步按钮
+        // 底部面板:结果按钮
         JPanel bottomPanel1 = new JPanel();
         bottomPanel1.setLayout(new FlowLayout(FlowLayout.CENTER, 20, 10));
         bottomPanel1.setBorder(new EmptyBorder(10, 10, 20, 10));
 
-        // 5. 下一步按钮 (跳转到面板2 - Tab Index 1)
-        nextBtn1 = new JButton("下一步");
-        nextBtn1.setFont(new Font("微软雅黑", Font.PLAIN, 24));
-        nextBtn1.setPreferredSize(new Dimension(200, 60));
-        nextBtn1.addActionListener(new ActionListener() {
-            @Override
-            public void actionPerformed(ActionEvent e) {
-                tabbedPane.setSelectedIndex(1); // 跳转到第二个标签页
-            }
-        });
-        bottomPanel1.add(nextBtn1);
-
         indexPanelA.add(bottomPanel1, BorderLayout.SOUTH);
 
         // 添加面板1到Tab
-        tabbedPane.addTab("工作面板1-58", new ImageIcon(MesClient.class.getResource("/bg/a_side.png")), indexScrollPaneA, null);
-
-
-        // ==================== 工作面板 2 (Index 1) ====================
-        JPanel indexPanelA2 = new JPanel();
-        JScrollPane indexScrollPaneA2 = new JScrollPane(indexPanelA2);
-        indexPanelA2.setLayout(new BorderLayout(10, 10));
-
-        // 1. 漏点按钮 59-116 (数组下标 58-115)
-        JPanel weldPanel2 = new JPanel();
-        weldPanel2.setLayout(new GridLayout(8, 8, 10, 10));
-        weldPanel2.setOpaque(false);
-        weldPanel2.setBorder(new EmptyBorder(20, 20, 20, 20));
-        addWeldButtonsToPanel(weldPanel2, 58, 116);
-        indexPanelA2.add(weldPanel2, BorderLayout.CENTER);
-
-        // 2. 底部按钮面板
-        JPanel bottomPanel2 = new JPanel();
-        bottomPanel2.setLayout(new FlowLayout(FlowLayout.CENTER, 20, 10));
-        bottomPanel2.setBorder(new EmptyBorder(10, 10, 20, 10));
-
-        // 上一步按钮 (跳转到面板1 - Tab Index 0)
-        prevBtn2 = new JButton("上一步");
-        prevBtn2.setFont(new Font("微软雅黑", Font.PLAIN, 24));
-        prevBtn2.setPreferredSize(new Dimension(200, 60));
-        prevBtn2.addActionListener(new ActionListener() {
-            @Override
-            public void actionPerformed(ActionEvent e) {
-                tabbedPane.setSelectedIndex(0);
-            }
-        });
-        bottomPanel2.add(prevBtn2);
+        tabbedPane.addTab("工作面板1-39", new ImageIcon(MesClient.class.getResource("/bg/a_side.png")), indexScrollPaneA, null);
+
 
         // OK 按钮
         finish_ok_bt = new JButton("OK");
@@ -709,7 +665,7 @@ public class MesClient extends JFrame {
                 }
             }
         });
-        bottomPanel2.add(finish_ok_bt);
+        bottomPanel1.add(finish_ok_bt);
 
         // NG 按钮
         finish_ng_bt = new JButton("NG");
@@ -744,15 +700,9 @@ public class MesClient extends JFrame {
                 }
             }
         });
-        bottomPanel2.add(finish_ng_bt);
-
-        indexPanelA2.add(bottomPanel2, BorderLayout.SOUTH);
-
-        // 添加面板2到Tab
-        tabbedPane.addTab("工作面板59-116", new ImageIcon(MesClient.class.getResource("/bg/a_side.png")), indexScrollPaneA2, null);
+        bottomPanel1.add(finish_ng_bt);
 
         tabbedPane.setEnabledAt(0, true);
-        tabbedPane.setEnabledAt(1, true);
 
 //		searchScrollPane = new JScrollPane((Component) null);
 
@@ -1011,8 +961,6 @@ public class MesClient extends JFrame {
             weldButtons[i].setEnabled(true);
             weldClickStates[i] = false; // 重置状态
         }
-        if(nextBtn1 != null) nextBtn1.setEnabled(true);
-        if(prevBtn2 != null) prevBtn2.setEnabled(true);
     }
 
     // 关闭漏点按钮和下一步,上一步按钮
@@ -1022,9 +970,6 @@ public class MesClient extends JFrame {
             weldButtons[i].setBackground(null); // 重置颜色
             weldButtons[i].setEnabled(false);
         }
-        // 关闭下一步,上一步按钮
-        if(nextBtn1 != null) nextBtn1.setEnabled(false);
-        if(prevBtn2 != null) prevBtn2.setEnabled(false);
     }
 
     //获取按钮下标
@@ -1033,12 +978,11 @@ public class MesClient extends JFrame {
         boolean first = true;
 
         for (int i = 0; i < weldClickStates.length; i++) {
-            // 直接判断布尔值
             if (weldClickStates[i]) {
                 if (!first) {
                     sb.append(",");
                 }
-                sb.append(i+1);
+                sb.append(getPointLabel(i));
                 first = false;
             }
         }
@@ -1124,7 +1068,7 @@ public class MesClient extends JFrame {
             if (i >= weldButtons.length) break;
             int index = i; // 供内部类使用
 
-            weldButtons[i] = new JButton("漏点" + (i + 1));
+            weldButtons[i] = new JButton(getPointLabel(i));
             weldButtons[i].setFont(new Font("微软雅黑", Font.PLAIN, 13));
             weldButtons[i].setEnabled(false); // 初始时禁用
 
@@ -1138,18 +1082,25 @@ public class MesClient extends JFrame {
                         // 取消选中
                         btn.setBackground(null);
                         weldClickStates[index] = false;
-                        log.info("已取消按钮: 漏点" + (index + 1));
+                        log.info("已取消按钮: " + getPointLabel(index));
                     } else {
                         // 选中
                         btn.setBackground(Color.GREEN);
                         weldClickStates[index] = true;
-                        log.info("已选中按钮: 漏点" + (index + 1));
+                        log.info("已选中按钮: " + getPointLabel(index));
                     }
                 }
             });
             panel.add(weldButtons[i]);
         }
     }
+
+    private static String getPointLabel(int index) {
+        if (index < 9) return "A" + (index + 1);
+        if (index < 25) return "B" + (index - 8);
+        if (index < 27) return "C" + (index - 24);
+        return "D" + (index - 26);
+    }
     /**
      * 密码验证后退出系统
      */

+ 2 - 2
src/resources/config/config.properties

@@ -1,6 +1,6 @@
 mes.gw=INSP030
-#mes.server_ip=127.0.0.1
-mes.server_ip=192.168.114.99
+mes.server_ip=127.0.0.1
+#mes.server_ip=192.168.114.99
 mes.tcp_port=3000
 
 mes.heart_beat_cycle=60