Jelajahi Sumber

气密加设备判定NG可以手动改判OK

wangxichen 2 hari lalu
induk
melakukan
66ecd15c6d
1 mengubah file dengan 52 tambahan dan 10 penghapusan
  1. 52 10
      src/com/mes/ui/MesClient.java

+ 52 - 10
src/com/mes/ui/MesClient.java

@@ -1852,12 +1852,21 @@ public class MesClient extends JFrame {
             }
         }
 
-        // 只有在人工判定NG或设备判NG时,才根据漏点选择状态控制NG按钮
-        if (deviceResult.equals("OK") && countdownTimer == null) {
-            // 人工判定NG后的状态
-            finish_ng_bt.setEnabled(hasSelected);
-        } else if (deviceResult.equals("NG")) {
-            // 设备判NG的状态
+        // 设备判NG时的按钮互斥逻辑
+        if (deviceResult.equals("NG")) {
+            if (hasSelected) {
+                // 选了漏点:NG可点,OK不可点
+                finish_ng_bt.setEnabled(true);
+                finish_ok_bt.setEnabled(false);
+            } else {
+                // 没选漏点:OK可点,NG不可点
+                finish_ok_bt.setEnabled(true);
+                finish_ng_bt.setEnabled(false);
+            }
+        }
+        // 设备判OK,人工改判NG的情况
+        else if (deviceResult.equals("OK") && countdownTimer == null) {
+            // 人工判定NG后的状态:选了漏点才能点NG
             finish_ng_bt.setEnabled(hasSelected);
         }
     }
@@ -1977,11 +1986,11 @@ public class MesClient extends JFrame {
         // 启用漏点按钮
         enableWeldButtons();
 
-        // OK按钮显示但禁用,NG按钮初始禁用(需要选漏点)
-        finish_ok_bt.setEnabled(false);
+        // OK按钮启用(允许人工改判OK),NG按钮初始禁用(需要选漏点)
+        finish_ok_bt.setEnabled(true);
         finish_ng_bt.setEnabled(false);
 
-        setMenuStatus("设备判定NG,请选择漏点位置", 1);
+        setMenuStatus("设备判定NG,可人工改判OK或选漏点提交NG", 1);
     }
 
     /**
@@ -2009,7 +2018,40 @@ public class MesClient extends JFrame {
      * OK按钮处理
      */
     private static void handleOkButton() {
-        // OK按钮在当前流程中不使用
+        // 设备判NG,人工改判OK
+        if (pendingTestParam == null) {
+            return;
+        }
+
+        // 确认改判
+        int confirm = JOptionPane.showConfirmDialog(
+                mesClientFrame,
+                "设备判定为NG,确定人工改判为OK吗?",
+                "确认改判",
+                JOptionPane.YES_NO_OPTION,
+                JOptionPane.QUESTION_MESSAGE
+        );
+
+        if (confirm != JOptionPane.YES_OPTION) {
+            return;
+        }
+
+        // 提交OK结果
+        pendingTestParam.setResult("OK");
+        if (MesClient.mes_enable) {
+            JSONObject retObj = DataUtil.qmResultData(pendingTestParam);
+            if (retObj != null && retObj.get("result") != null && retObj.get("result").toString().equalsIgnoreCase("true")) {
+                // MES提交成功后打印标签
+                printLabelIfEnabled();
+                resetScanA();
+                setMenuStatus("人工改判OK已提交,请扫下一件", 0);
+            } else {
+                setMenuStatus("测试结果上传失败,请重试", -1);
+            }
+        } else {
+            printLabelIfEnabled();
+            resetScanA();
+        }
     }
 
     /**