liuwei преди 1 седмица
родител
ревизия
e57d008de7
променени са 1 файла, в които са добавени 51 реда и са изтрити 26 реда
  1. 51 26
      src/com/mes/ui/MesClient.java

+ 51 - 26
src/com/mes/ui/MesClient.java

@@ -128,7 +128,8 @@ public class MesClient extends JFrame {
     public static Integer curc = 0; // 9号枪当前数
     public static List<String> ctids = new ArrayList<>();
 
-    public static Integer maxd = 28; // 7号枪任务数
+    public static final boolean ENABLE_GUN_D = false; // 隐藏枪D
+    public static Integer maxd = ENABLE_GUN_D ? 28 : 0; // 7号枪任务数(隐藏时为0,不参与完成判定)
     public static Integer curd = 0; // 7号枪当前数
     public static List<String> dtids = new ArrayList<>();
 
@@ -295,8 +296,8 @@ public class MesClient extends JFrame {
                 }
             }
 
-            // 枪D
-            if(ygslClient4==null) {
+            // 枪D(已隐藏,不连接)
+            if(ENABLE_GUN_D && ygslClient4==null) {
                 ygslClient4 = new YgslClient4();
                 try{
                     ygslClient4.run();
@@ -354,16 +355,18 @@ public class MesClient extends JFrame {
                     MesClient.initYgslTcpConnection();
                 }
 
-                // 枪D心跳
-                if(ygslClient4!=null && ygsl_tcp_connect_flag4) {
-                    System.out.println("发送心跳报文ygslD");
-                    YgslUtil4.comHeart(ygslClient4);
-                }else{
-                    System.out.println("发送心跳报文ygslD离线");
-                    MesClient.ygsl_tcp_connect_flag4 = false;
-                    MesClient.ygsl_connect_request_flag4 = true;
-                    MesClient.ygslClient4 = null;
-                    MesClient.initYgslTcpConnection();
+                // 枪D心跳(已隐藏则跳过)
+                if(ENABLE_GUN_D) {
+                    if(ygslClient4!=null && ygsl_tcp_connect_flag4) {
+                        System.out.println("发送心跳报文ygslD");
+                        YgslUtil4.comHeart(ygslClient4);
+                    }else{
+                        System.out.println("发送心跳报文ygslD离线");
+                        MesClient.ygsl_tcp_connect_flag4 = false;
+                        MesClient.ygsl_connect_request_flag4 = true;
+                        MesClient.ygslClient4 = null;
+                        MesClient.initYgslTcpConnection();
+                    }
                 }
             }
         }, 100,10*1000);
@@ -418,15 +421,17 @@ public class MesClient extends JFrame {
                         ygslmC.setForeground(Color.WHITE);
                     }
 
-                    // 枪D在线状态
-                    if(ygslClient4!=null && ygsl_tcp_connect_flag4) {
-                        ygslmD.setText("5号枪:在线");
-                        ygslmD.setBackground(Color.GREEN);
-                        ygslmD.setForeground(Color.WHITE);
-                    }else{
-                        ygslmD.setText("5号枪:离线");
-                        ygslmD.setBackground(Color.RED);
-                        ygslmD.setForeground(Color.WHITE);
+                    // 枪D在线状态(已隐藏则跳过)
+                    if(ENABLE_GUN_D) {
+                        if(ygslClient4!=null && ygsl_tcp_connect_flag4) {
+                            ygslmD.setText("5号枪:在线");
+                            ygslmD.setBackground(Color.GREEN);
+                            ygslmD.setForeground(Color.WHITE);
+                        }else{
+                            ygslmD.setText("5号枪:离线");
+                            ygslmD.setBackground(Color.RED);
+                            ygslmD.setForeground(Color.WHITE);
+                        }
                     }
 
                     // 工作状态下控制枪的使能/禁用
@@ -539,7 +544,9 @@ public class MesClient extends JFrame {
         YgslUtil.disableTool(ygslClient);
         YgslUtil2.disableTool(ygslClient2);
         YgslUtil3.disableTool(ygslClient3);
-        YgslUtil4.disableTool(ygslClient4);
+        if(ENABLE_GUN_D) {
+            YgslUtil4.disableTool(ygslClient4);
+        }
 
         updateMaterailData();
         shiftUserCheck();
@@ -638,7 +645,7 @@ public class MesClient extends JFrame {
                 MesClient.finish_ok_bt.setEnabled(false);
                 MesClient.finish_ng_bt.setEnabled(false);
 
-                // 启动四把枪
+                // 启动扭力枪(枪D已隐藏)
 //                YgslUtil.pSet(MesClient.ygslClient);
 //                YgslUtil2.pSet(MesClient.ygslClient2);
 //                YgslUtil3.pSet(MesClient.ygslClient3);
@@ -646,7 +653,9 @@ public class MesClient extends JFrame {
                 YgslUtil.uploadVin(MesClient.ygslClient,scanBarcode);
                 YgslUtil2.uploadVin(MesClient.ygslClient2,scanBarcode);
                 YgslUtil3.uploadVin(MesClient.ygslClient3,scanBarcode);
-                YgslUtil4.uploadVin(MesClient.ygslClient4,scanBarcode);
+                if(ENABLE_GUN_D) {
+                    YgslUtil4.uploadVin(MesClient.ygslClient4,scanBarcode);
+                }
 
                 MesClient.atids.clear();
                 MesClient.btids.clear();
@@ -1041,7 +1050,7 @@ public class MesClient extends JFrame {
         anglec.setBounds(682, 250, 100, 30);
         indexPanelA.add(anglec);
 
-        // 7号枪按钮
+        // 7号枪按钮(枪D,可通过 ENABLE_GUN_D 隐藏)
         ygslmD = new JButton("7号枪:离线");
         ygslmD.addActionListener(new ActionListener() {
             public void actionPerformed(ActionEvent e) {
@@ -1087,6 +1096,16 @@ public class MesClient extends JFrame {
         angled.setBounds(682, 300, 100, 30);
         indexPanelA.add(angled);
 
+        if(!ENABLE_GUN_D) {
+            ygslmD.setVisible(false);
+            lblD.setVisible(false);
+            scheduled.setVisible(false);
+            lblTorqueD.setVisible(false);
+            torqued.setVisible(false);
+            lblAngleD.setVisible(false);
+            angled.setVisible(false);
+        }
+
 
         // ----- 在 8号枪标签和进度 代码块下方添加 -----
         subBtnA = new JButton("未订阅");
@@ -1138,6 +1157,9 @@ public class MesClient extends JFrame {
             }
         });
         indexPanelA.add(subBtnD);
+        if(!ENABLE_GUN_D) {
+            subBtnD.setVisible(false);
+        }
 
 
         tabbedPane.addTab("工作面板", new ImageIcon(MesClient.class.getResource("/bg/a_side.png")), indexScrollPaneA, null);
@@ -1475,6 +1497,9 @@ public class MesClient extends JFrame {
 
     // 7号枪订阅操作
     public static void handleSubscriptionD() {
+        if(!ENABLE_GUN_D) {
+            return;
+        }
         System.out.println("执行7号枪订阅相关逻辑...");
         YgslUtil4.lastTighteningResultSubscribe(MesClient.ygslClient4);
     }