|
|
@@ -70,6 +70,7 @@ 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 manual_ng_bt; // 人工判定NG按钮
|
|
|
public static JTextField product_sn;
|
|
|
public static JButton f_scan_data_bt_1;
|
|
|
|
|
|
@@ -350,6 +351,10 @@ public class MesClient extends JFrame {
|
|
|
closeWeldButtons();
|
|
|
// 停止倒计时
|
|
|
stopCountdown();
|
|
|
+ // 隐藏人工判定NG按钮
|
|
|
+ if (manual_ng_bt != null) {
|
|
|
+ manual_ng_bt.setVisible(false);
|
|
|
+ }
|
|
|
// 清空待提交数据
|
|
|
pendingTestParam = null;
|
|
|
deviceResult = "";
|
|
|
@@ -1071,6 +1076,23 @@ public class MesClient extends JFrame {
|
|
|
|
|
|
topContainer.add(countdownRow);
|
|
|
|
|
|
+ // 人工判定NG按钮
|
|
|
+ JPanel manualNgRow = new JPanel(new FlowLayout(FlowLayout.CENTER, 10, 5));
|
|
|
+ manual_ng_bt = new JButton("人工判定NG");
|
|
|
+ manual_ng_bt.setFont(new Font("微软雅黑", Font.BOLD, 18));
|
|
|
+ manual_ng_bt.setForeground(Color.WHITE);
|
|
|
+ manual_ng_bt.setBackground(new Color(255, 140, 0));
|
|
|
+ manual_ng_bt.setPreferredSize(new Dimension(200, 50));
|
|
|
+ manual_ng_bt.setVisible(false); // 初始隐藏
|
|
|
+ manual_ng_bt.addActionListener(new ActionListener() {
|
|
|
+ @Override
|
|
|
+ public void actionPerformed(ActionEvent e) {
|
|
|
+ handleManualNgButton();
|
|
|
+ }
|
|
|
+ });
|
|
|
+ manualNgRow.add(manual_ng_bt);
|
|
|
+ topContainer.add(manualNgRow);
|
|
|
+
|
|
|
indexPanelA.add(topContainer, BorderLayout.NORTH);
|
|
|
|
|
|
// 中间面板:漏点按钮
|
|
|
@@ -1761,6 +1783,8 @@ public class MesClient extends JFrame {
|
|
|
btn.setBackground(Color.GREEN);
|
|
|
weldClickStates[index] = true;
|
|
|
}
|
|
|
+ // 更新NG按钮状态
|
|
|
+ updateNgButtonState();
|
|
|
}
|
|
|
});
|
|
|
panel.add(weldButtons[i]);
|
|
|
@@ -1800,6 +1824,30 @@ public class MesClient extends JFrame {
|
|
|
weldClickStates[i] = false;
|
|
|
}
|
|
|
}
|
|
|
+ // 监听漏点选择状态,动态启用NG按钮
|
|
|
+ updateNgButtonState();
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 更新NG按钮状态(至少选1个漏点才能点击)
|
|
|
+ */
|
|
|
+ public static void updateNgButtonState() {
|
|
|
+ boolean hasSelected = false;
|
|
|
+ for (boolean state : weldClickStates) {
|
|
|
+ if (state) {
|
|
|
+ hasSelected = true;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // 只有在人工判定NG或设备判NG时,才根据漏点选择状态控制NG按钮
|
|
|
+ if (deviceResult.equals("OK") && countdownTimer == null) {
|
|
|
+ // 人工判定NG后的状态
|
|
|
+ finish_ng_bt.setEnabled(hasSelected);
|
|
|
+ } else if (deviceResult.equals("NG")) {
|
|
|
+ // 设备判NG的状态
|
|
|
+ finish_ng_bt.setEnabled(hasSelected);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -1835,9 +1883,12 @@ public class MesClient extends JFrame {
|
|
|
countdownLabel.setText("5秒后自动提交OK...");
|
|
|
countdownLabel.setVisible(true);
|
|
|
|
|
|
- // 启用NG按钮,允许改判
|
|
|
- finish_ng_bt.setEnabled(true);
|
|
|
+ // 显示人工判定NG按钮
|
|
|
+ manual_ng_bt.setVisible(true);
|
|
|
+
|
|
|
+ // 禁用OK/NG按钮(倒计时期间不显示)
|
|
|
finish_ok_bt.setEnabled(false);
|
|
|
+ finish_ng_bt.setEnabled(false);
|
|
|
|
|
|
// 启动定时器
|
|
|
if (countdownTimer != null) {
|
|
|
@@ -1872,6 +1923,9 @@ public class MesClient extends JFrame {
|
|
|
if (countdownLabel != null) {
|
|
|
countdownLabel.setVisible(false);
|
|
|
}
|
|
|
+ if (manual_ng_bt != null) {
|
|
|
+ manual_ng_bt.setVisible(false);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -1886,6 +1940,16 @@ public class MesClient extends JFrame {
|
|
|
if (MesClient.mes_enable) {
|
|
|
JSONObject retObj = DataUtil.qmResultData(pendingTestParam);
|
|
|
if (retObj != null && retObj.get("result") != null && retObj.get("result").toString().equalsIgnoreCase("true")) {
|
|
|
+ // MES提交成功后打印标签
|
|
|
+ if (MesClient.configParam.getPrintLabel().equals("是")) {
|
|
|
+ String testDate = pendingTestParam.getCreateTime();
|
|
|
+ PrintUtil.printLabel(
|
|
|
+ pendingTestParam.getSn(),
|
|
|
+ pendingTestParam.getParam1() + pendingTestParam.getParam2(),
|
|
|
+ pendingTestParam.getParam3() + pendingTestParam.getParam4(),
|
|
|
+ testDate
|
|
|
+ );
|
|
|
+ }
|
|
|
resetScanA();
|
|
|
setMenuStatus("测试结果上传成功,请扫下一件", 0);
|
|
|
} else {
|
|
|
@@ -1909,18 +1973,39 @@ public class MesClient extends JFrame {
|
|
|
// 启用漏点按钮
|
|
|
enableWeldButtons();
|
|
|
|
|
|
- // 启用NG按钮
|
|
|
- finish_ng_bt.setEnabled(true);
|
|
|
+ // OK按钮显示但禁用,NG按钮初始禁用(需要选漏点)
|
|
|
finish_ok_bt.setEnabled(false);
|
|
|
+ finish_ng_bt.setEnabled(false);
|
|
|
|
|
|
setMenuStatus("设备判定NG,请选择漏点位置", 1);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
+ * 人工判定NG按钮处理
|
|
|
+ */
|
|
|
+ private static void handleManualNgButton() {
|
|
|
+ if (pendingTestParam == null) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ // 终止倒计时
|
|
|
+ stopCountdown();
|
|
|
+
|
|
|
+ // 启用漏点按钮
|
|
|
+ enableWeldButtons();
|
|
|
+
|
|
|
+ // OK按钮显示但禁用,NG按钮初始禁用(需要选漏点)
|
|
|
+ finish_ok_bt.setEnabled(false);
|
|
|
+ finish_ng_bt.setEnabled(false);
|
|
|
+
|
|
|
+ setMenuStatus("请至少选择1个漏点,然后点击NG提交", 1);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
* OK按钮处理
|
|
|
*/
|
|
|
private static void handleOkButton() {
|
|
|
- // OK按钮在倒计时时不启用,这里预留逻辑
|
|
|
+ // OK按钮在当前流程中不使用
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -1933,29 +2018,14 @@ public class MesClient extends JFrame {
|
|
|
|
|
|
String leakPoints = getSelectedLeakPoints();
|
|
|
|
|
|
- // 如果是设备判OK,工人改判NG
|
|
|
- if (deviceResult.equals("OK")) {
|
|
|
- // 停止倒计时
|
|
|
- stopCountdown();
|
|
|
-
|
|
|
- if (leakPoints.isEmpty()) {
|
|
|
- setMenuStatus("请至少选择1个漏点位置", -1);
|
|
|
- return;
|
|
|
- }
|
|
|
-
|
|
|
- // 提交NG + 漏点
|
|
|
- submitNgWithLeakPoints(leakPoints, true);
|
|
|
+ if (leakPoints.isEmpty()) {
|
|
|
+ setMenuStatus("请至少选择1个漏点位置", -1);
|
|
|
+ return;
|
|
|
}
|
|
|
- // 如果是设备判NG
|
|
|
- else if (deviceResult.equals("NG")) {
|
|
|
- if (leakPoints.isEmpty()) {
|
|
|
- setMenuStatus("请至少选择1个漏点位置", -1);
|
|
|
- return;
|
|
|
- }
|
|
|
|
|
|
- // 提交NG + 漏点
|
|
|
- submitNgWithLeakPoints(leakPoints, false);
|
|
|
- }
|
|
|
+ // 提交NG + 漏点(人工改判或设备判NG都走这里)
|
|
|
+ boolean isManualOverride = deviceResult.equals("OK");
|
|
|
+ submitNgWithLeakPoints(leakPoints, isManualOverride);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -1983,6 +2053,16 @@ public class MesClient extends JFrame {
|
|
|
);
|
|
|
|
|
|
if (leakRet != null && leakRet.get("result") != null && leakRet.get("result").toString().equalsIgnoreCase("true")) {
|
|
|
+ // 3. MES提交成功后打印标签(根据配置决定是否打印NG标签)
|
|
|
+ if (MesClient.configParam.getPrintLabel().equals("是")) {
|
|
|
+ String testDate = pendingTestParam.getCreateTime();
|
|
|
+ PrintUtil.printLabel(
|
|
|
+ pendingTestParam.getSn(),
|
|
|
+ pendingTestParam.getParam1() + pendingTestParam.getParam2(),
|
|
|
+ pendingTestParam.getParam3() + pendingTestParam.getParam4(),
|
|
|
+ testDate
|
|
|
+ );
|
|
|
+ }
|
|
|
resetScanA();
|
|
|
setMenuStatus("结果上传成功(含漏点记录),请扫下一件", 0);
|
|
|
} else {
|