liuwei 1 hete
szülő
commit
6bbb98fdb3
1 módosított fájl, 119 hozzáadás és 22 törlés
  1. 119 22
      src/com/mes/ui/MesClient.java

+ 119 - 22
src/com/mes/ui/MesClient.java

@@ -77,9 +77,18 @@ public class MesClient extends JFrame {
     public static int scan_type = 0;
     public static JButton finish_ok_bt;
     public static JButton finish_ng_bt;
+    public static JButton nextBtn1; // 面板1的下一步
+    public static JButton prevBtn2; // 面板2的上一步
+    public static JButton nextBtn2; // 面板2的下一步
+    public static JButton prevBtn3; // 面板3的上一步
     public static JTextField product_sn;
     public static JButton f_scan_data_bt_1;
 
+    // 工作面板翻页区间(与三张焊缝图对齐)
+    private static final int WELD_PAGE1_END = 97;   // 1..69,共97个
+    private static final int WELD_PAGE2_END = 126;  // 70-1..90,共29个
+    // page3: 126..180 = 91-1..109,共54个
+
     public static String user20 = "";
 
     public static JFrame welcomeWin;
@@ -522,7 +531,7 @@ public class MesClient extends JFrame {
         tabbedPane.setFont(new Font("宋体", Font.BOLD, 15));
         contentPane.add(tabbedPane);
 
-        // ==================== 工作面板(单页,含全部焊缝编号) ====================
+        // ==================== 工作面板 1:焊缝1-69 (Index 0) ====================
         JPanel indexPanelA = new JPanel();
         indexScrollPaneA = new JScrollPane(indexPanelA);
         indexPanelA.setLayout(new BorderLayout(10, 10));
@@ -549,19 +558,15 @@ public class MesClient extends JFrame {
 
         indexPanelA.add(scanRow, BorderLayout.NORTH);
 
-        JPanel centerPanel = new JPanel();
-        centerPanel.setLayout(new BorderLayout(10, 10));
-        centerPanel.setBorder(new EmptyBorder(10, 20, 10, 20));
+        JPanel centerPanel1 = new JPanel();
+        centerPanel1.setLayout(new BorderLayout(10, 10));
+        centerPanel1.setBorder(new EmptyBorder(10, 20, 10, 20));
 
-        // 180 个焊缝按钮,滚动查看;文案与图纸编号一致(如 16-1)
-        JPanel weldPanel = new JPanel();
-        weldPanel.setLayout(new GridLayout(0, 10, 6, 6));
-        weldPanel.setOpaque(false);
-        addWeldButtonsToPanel(weldPanel, 0, WELD_LABELS.length);
-        JScrollPane weldScroll = new JScrollPane(weldPanel);
-        weldScroll.setBorder(null);
-        weldScroll.getVerticalScrollBar().setUnitIncrement(16);
-        centerPanel.add(weldScroll, BorderLayout.CENTER);
+        JPanel weldPanel1 = new JPanel();
+        weldPanel1.setLayout(new GridLayout(0, 10, 6, 6));
+        weldPanel1.setOpaque(false);
+        addWeldButtonsToPanel(weldPanel1, 0, WELD_PAGE1_END);
+        centerPanel1.add(weldPanel1, BorderLayout.CENTER);
 
         fxlabel = new JLabel("该工件为返修件,请仔细检查");
         fxlabel.setFont(new Font("微软雅黑", Font.PLAIN, 38));
@@ -569,13 +574,95 @@ public class MesClient extends JFrame {
         fxlabel.setHorizontalAlignment(SwingConstants.CENTER);
         fxlabel.setPreferredSize(new Dimension(810, 70));
         fxlabel.setVisible(false);
-        centerPanel.add(fxlabel, BorderLayout.SOUTH);
+        centerPanel1.add(fxlabel, BorderLayout.SOUTH);
+
+        indexPanelA.add(centerPanel1, BorderLayout.CENTER);
 
-        indexPanelA.add(centerPanel, BorderLayout.CENTER);
+        JPanel bottomPanel1 = new JPanel();
+        bottomPanel1.setLayout(new FlowLayout(FlowLayout.CENTER, 20, 10));
+        bottomPanel1.setBorder(new EmptyBorder(10, 10, 20, 10));
 
-        JPanel bottomPanel = new JPanel();
-        bottomPanel.setLayout(new FlowLayout(FlowLayout.CENTER, 20, 10));
-        bottomPanel.setBorder(new EmptyBorder(10, 10, 20, 10));
+        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);
+
+        tabbedPane.addTab("工作面板1-69", new ImageIcon(MesClient.class.getResource("/bg/a_side.png")), indexScrollPaneA, null);
+
+        // ==================== 工作面板 2:焊缝70-90 (Index 1) ====================
+        JPanel indexPanelA2 = new JPanel();
+        JScrollPane indexScrollPaneA2 = new JScrollPane(indexPanelA2);
+        indexPanelA2.setLayout(new BorderLayout(10, 10));
+
+        JPanel weldPanel2 = new JPanel();
+        weldPanel2.setLayout(new GridLayout(0, 10, 6, 6));
+        weldPanel2.setOpaque(false);
+        weldPanel2.setBorder(new EmptyBorder(20, 20, 20, 20));
+        addWeldButtonsToPanel(weldPanel2, WELD_PAGE1_END, WELD_PAGE2_END);
+        indexPanelA2.add(weldPanel2, BorderLayout.CENTER);
+
+        JPanel bottomPanel2 = new JPanel();
+        bottomPanel2.setLayout(new FlowLayout(FlowLayout.CENTER, 20, 10));
+        bottomPanel2.setBorder(new EmptyBorder(10, 10, 20, 10));
+
+        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);
+
+        nextBtn2 = new JButton("下一步");
+        nextBtn2.setFont(new Font("微软雅黑", Font.PLAIN, 24));
+        nextBtn2.setPreferredSize(new Dimension(200, 60));
+        nextBtn2.addActionListener(new ActionListener() {
+            @Override
+            public void actionPerformed(ActionEvent e) {
+                tabbedPane.setSelectedIndex(2);
+            }
+        });
+        bottomPanel2.add(nextBtn2);
+        indexPanelA2.add(bottomPanel2, BorderLayout.SOUTH);
+
+        tabbedPane.addTab("工作面板70-90", new ImageIcon(MesClient.class.getResource("/bg/a_side.png")), indexScrollPaneA2, null);
+
+        // ==================== 工作面板 3:焊缝91-109 (Index 2) ====================
+        JPanel indexPanelA3 = new JPanel();
+        JScrollPane indexScrollPaneA3 = new JScrollPane(indexPanelA3);
+        indexPanelA3.setLayout(new BorderLayout(10, 10));
+
+        JPanel weldPanel3 = new JPanel();
+        weldPanel3.setLayout(new GridLayout(0, 10, 6, 6));
+        weldPanel3.setOpaque(false);
+        weldPanel3.setBorder(new EmptyBorder(20, 20, 20, 20));
+        addWeldButtonsToPanel(weldPanel3, WELD_PAGE2_END, WELD_LABELS.length);
+        indexPanelA3.add(weldPanel3, BorderLayout.CENTER);
+
+        JPanel bottomPanel3 = new JPanel();
+        bottomPanel3.setLayout(new FlowLayout(FlowLayout.CENTER, 20, 10));
+        bottomPanel3.setBorder(new EmptyBorder(10, 10, 20, 10));
+
+        prevBtn3 = new JButton("上一步");
+        prevBtn3.setFont(new Font("微软雅黑", Font.PLAIN, 24));
+        prevBtn3.setPreferredSize(new Dimension(200, 60));
+        prevBtn3.addActionListener(new ActionListener() {
+            @Override
+            public void actionPerformed(ActionEvent e) {
+                tabbedPane.setSelectedIndex(1);
+            }
+        });
+        bottomPanel3.add(prevBtn3);
 
         finish_ok_bt = new JButton("OK");
         finish_ok_bt.setEnabled(false);
@@ -607,7 +694,7 @@ public class MesClient extends JFrame {
         finish_ok_bt.setFont(new Font("微软雅黑", Font.PLAIN, 32));
         finish_ok_bt.setPreferredSize(new Dimension(240, 80));
         finish_ok_bt.setEnabled(false);
-        bottomPanel.add(finish_ok_bt);
+        bottomPanel3.add(finish_ok_bt);
 
         finish_ng_bt = new JButton("NG");
         finish_ng_bt.setEnabled(false);
@@ -642,12 +729,14 @@ public class MesClient extends JFrame {
         finish_ng_bt.setFont(new Font("微软雅黑", Font.PLAIN, 32));
         finish_ng_bt.setPreferredSize(new Dimension(240, 80));
         finish_ng_bt.setEnabled(false);
-        bottomPanel.add(finish_ng_bt);
+        bottomPanel3.add(finish_ng_bt);
 
-        indexPanelA.add(bottomPanel, BorderLayout.SOUTH);
+        indexPanelA3.add(bottomPanel3, BorderLayout.SOUTH);
 
-        tabbedPane.addTab("工作面板", new ImageIcon(MesClient.class.getResource("/bg/a_side.png")), indexScrollPaneA, null);
+        tabbedPane.addTab("工作面板91-109", new ImageIcon(MesClient.class.getResource("/bg/a_side.png")), indexScrollPaneA3, null);
         tabbedPane.setEnabledAt(0, true);
+        tabbedPane.setEnabledAt(1, true);
+        tabbedPane.setEnabledAt(2, true);
 
         indexPanelC = new JPanel();
         searchScrollPaneDj = new JScrollPane(indexPanelC);
@@ -890,6 +979,10 @@ public class MesClient extends JFrame {
             }
             weldClickStates[i] = false; // 重置状态
         }
+        if (nextBtn1 != null) nextBtn1.setEnabled(true);
+        if (prevBtn2 != null) prevBtn2.setEnabled(true);
+        if (nextBtn2 != null) nextBtn2.setEnabled(true);
+        if (prevBtn3 != null) prevBtn3.setEnabled(true);
     }
 
     // 关闭焊缝按钮
@@ -901,6 +994,10 @@ public class MesClient extends JFrame {
                 weldButtons[i].setEnabled(false);
             }
         }
+        if (nextBtn1 != null) nextBtn1.setEnabled(false);
+        if (prevBtn2 != null) prevBtn2.setEnabled(false);
+        if (nextBtn2 != null) nextBtn2.setEnabled(false);
+        if (prevBtn3 != null) prevBtn3.setEnabled(false);
     }
 
     // 获取已选焊缝编号(与图纸一致,如 16-1,70-2)