Pārlūkot izejas kodu

钢印码解绑

wangxichen 4 dienas atpakaļ
vecāks
revīzija
aa6ad21976
1 mainītis faili ar 65 papildinājumiem un 1 dzēšanām
  1. 65 1
      src/com/mes/ui/MesClient.java

+ 65 - 1
src/com/mes/ui/MesClient.java

@@ -396,6 +396,10 @@ public class MesClient extends JFrame {
         updateManualSubmitButtons();
     }
     private static void requestUnbindSteelSn(String steelSn) {
+        requestUnbindSteelSn(steelSn, manualSteelSnInput);
+    }
+
+    private static void requestUnbindSteelSn(String steelSn, final JTextField steelSnInputToClear) {
         if (steelSn == null || steelSn.trim().length() != 11) {
             setMenuStatus("请输入11位钢印码", 1);
             updateManualSubmitButtons();
@@ -419,7 +423,9 @@ public class MesClient extends JFrame {
                         if (retObj != null && retObj.get("result") != null
                                 && "true".equalsIgnoreCase(retObj.get("result").toString())) {
                             setMenuStatus(retObj.getString("message"), 0);
-                            manualSteelSnInput.setText("");
+                            if (steelSnInputToClear != null) {
+                                steelSnInputToClear.setText("");
+                            }
                             product_sn.setText("");
                         } else {
                             String msg = retObj != null && retObj.get("message") != null
@@ -995,6 +1001,64 @@ public class MesClient extends JFrame {
         tabbedPane.addTab("工作面板", new ImageIcon(MesClient.class.getResource("/bg/a_side.png")), indexScrollPaneA, null);
         tabbedPane.setEnabledAt(0, true);
 
+        JPanel unbindPanel = new JPanel();
+        JScrollPane unbindScrollPane = new JScrollPane(unbindPanel);
+        unbindPanel.setLayout(null);
+
+        JLabel unbindTitle = new JLabel("钢印码解绑");
+        unbindTitle.setHorizontalAlignment(SwingConstants.CENTER);
+        unbindTitle.setForeground(Color.BLACK);
+        unbindTitle.setFont(new Font("微软雅黑", Font.PLAIN, 28));
+        unbindTitle.setBounds(260, 80, 420, 50);
+        unbindPanel.add(unbindTitle);
+
+        JLabel unbindInputLabel = new JLabel("钢印码");
+        unbindInputLabel.setHorizontalAlignment(SwingConstants.RIGHT);
+        unbindInputLabel.setForeground(Color.BLACK);
+        unbindInputLabel.setFont(new Font("微软雅黑", Font.PLAIN, 22));
+        unbindInputLabel.setBounds(170, 170, 120, 50);
+        unbindPanel.add(unbindInputLabel);
+
+        final JTextField unbindSteelSnInput = new JTextField();
+        unbindSteelSnInput.setHorizontalAlignment(SwingConstants.CENTER);
+        unbindSteelSnInput.setFont(new Font("微软雅黑", Font.PLAIN, 24));
+        unbindSteelSnInput.setToolTipText("输入11位钢印码");
+        unbindSteelSnInput.setBounds(320, 170, 340, 50);
+        unbindPanel.add(unbindSteelSnInput);
+
+        final JButton unbindSteelSnBt = new JButton("解绑钢印码");
+        unbindSteelSnBt.setEnabled(false);
+        unbindSteelSnBt.setFont(new Font("微软雅黑", Font.PLAIN, 24));
+        unbindSteelSnBt.setBounds(320, 250, 220, 60);
+        unbindSteelSnBt.addActionListener(new ActionListener() {
+            public void actionPerformed(ActionEvent e) {
+                requestUnbindSteelSn(unbindSteelSnInput.getText(), unbindSteelSnInput);
+            }
+        });
+        unbindPanel.add(unbindSteelSnBt);
+
+        unbindSteelSnInput.getDocument().addDocumentListener(new DocumentListener() {
+            private void update() {
+                boolean ready = unbindSteelSnInput.getText().trim().length() == 11;
+                boolean laserBusy = laserFlowManager != null && laserFlowManager.isWaitingComplete();
+                unbindSteelSnBt.setEnabled(ready && !laserBusy);
+            }
+
+            public void insertUpdate(DocumentEvent e) {
+                update();
+            }
+
+            public void removeUpdate(DocumentEvent e) {
+                update();
+            }
+
+            public void changedUpdate(DocumentEvent e) {
+                update();
+            }
+        });
+
+        tabbedPane.addTab("钢印解绑", new ImageIcon(MesClient.class.getResource("/bg/delete.png")), unbindScrollPane, null);
+
 //		searchScrollPane = new JScrollPane((Component) null);
 
         indexPanelC = new JPanel();