|
@@ -91,7 +91,7 @@ public class MesClient extends JFrame {
|
|
|
public static JLabel curTaskName;
|
|
public static JLabel curTaskName;
|
|
|
|
|
|
|
|
public static JTable table;
|
|
public static JTable table;
|
|
|
- public static Object[] columnNames = {"工件码", "测试日期", "压力", "泄露值","结果"};
|
|
|
|
|
|
|
+ public static Object[] columnNames = {"工件码", "测试日期", "压力", "泄露值","结果","上传状态"};
|
|
|
// public static Object[][] rowData = null;
|
|
// public static Object[][] rowData = null;
|
|
|
// public static Object[][] rowData = {
|
|
// public static Object[][] rowData = {
|
|
|
// {"151245P00001213100100024120700111","2024-12-09 12:30:30","60","60","60","200kPa","3ml/min","OK"},
|
|
// {"151245P00001213100100024120700111","2024-12-09 12:30:30","60","60","60","200kPa","3ml/min","OK"},
|
|
@@ -99,7 +99,7 @@ public class MesClient extends JFrame {
|
|
|
// {"151245P00001213100100024120700113","2024-12-09 14:30:30","60","60","60","200kPa","3ml/min","OK"},
|
|
// {"151245P00001213100100024120700113","2024-12-09 14:30:30","60","60","60","200kPa","3ml/min","OK"},
|
|
|
// {"151245P00001213100100024120700113","2024-12-09 14:30:30","60","60","60","200kPa","3ml/min","OK"},
|
|
// {"151245P00001213100100024120700113","2024-12-09 14:30:30","60","60","60","200kPa","3ml/min","OK"},
|
|
|
// };
|
|
// };
|
|
|
- public static Object[][] rowData = new Object[12][5];
|
|
|
|
|
|
|
+ public static Object[][] rowData = new Object[12][6];
|
|
|
public static JLabel pageLabel;
|
|
public static JLabel pageLabel;
|
|
|
public static int pageNo=1 ; // 当前页
|
|
public static int pageNo=1 ; // 当前页
|
|
|
public static int totalPages; // 总页数
|
|
public static int totalPages; // 总页数
|
|
@@ -181,13 +181,34 @@ public class MesClient extends JFrame {
|
|
|
cjTimerText = new Timer();
|
|
cjTimerText = new Timer();
|
|
|
cjTimerText.schedule(new TimerTask() {
|
|
cjTimerText.schedule(new TimerTask() {
|
|
|
public void run() {
|
|
public void run() {
|
|
|
- if(work_status == 0){
|
|
|
|
|
- product_sn.requestFocusInWindow();
|
|
|
|
|
|
|
+ if(work_status != 0 || product_sn == null){
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ // 正在编辑胶圈相关控件时,不要抢焦点,否则阈值输入不了
|
|
|
|
|
+ if (isSealRingInputFocused()) {
|
|
|
|
|
+ return;
|
|
|
}
|
|
}
|
|
|
|
|
+ SwingUtilities.invokeLater(() -> {
|
|
|
|
|
+ if (work_status == 0 && product_sn != null && !isSealRingInputFocused()) {
|
|
|
|
|
+ product_sn.requestFocusInWindow();
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
}
|
|
}
|
|
|
}, 1000,1000);
|
|
}, 1000,1000);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ private static boolean isSealRingInputFocused() {
|
|
|
|
|
+ Component focus = KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner();
|
|
|
|
|
+ if (focus == null) {
|
|
|
|
|
+ return false;
|
|
|
|
|
+ }
|
|
|
|
|
+ return focus == sealRingLimitField
|
|
|
|
|
+ || focus == sealRingSaveLimitBt
|
|
|
|
|
+ || focus == sealRingResetBt
|
|
|
|
|
+ || focus == sealRingCountLabel
|
|
|
|
|
+ || focus == sealRingEnable;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
public static java.util.Timer dateBeatTimer;
|
|
public static java.util.Timer dateBeatTimer;
|
|
|
public static void startDateTimer() {
|
|
public static void startDateTimer() {
|
|
|
if (dateBeatTimer != null) {
|
|
if (dateBeatTimer != null) {
|
|
@@ -376,6 +397,14 @@ public class MesClient extends JFrame {
|
|
|
public static JTextField oprno;
|
|
public static JTextField oprno;
|
|
|
public static JTextField oprnoTitle;
|
|
public static JTextField oprnoTitle;
|
|
|
public static JTextField lineSn;
|
|
public static JTextField lineSn;
|
|
|
|
|
+ public static JComboBox sealRingEnable;
|
|
|
|
|
+
|
|
|
|
|
+ public static JLabel sealRingTitle;
|
|
|
|
|
+ public static JLabel sealRingCountLabel;
|
|
|
|
|
+ public static JLabel sealRingLimitLbl;
|
|
|
|
|
+ public static JTextField sealRingLimitField;
|
|
|
|
|
+ public static JButton sealRingSaveLimitBt;
|
|
|
|
|
+ public static JButton sealRingResetBt;
|
|
|
|
|
|
|
|
public static JLabel taskName;
|
|
public static JLabel taskName;
|
|
|
public static JTextField taskMaxNumA;
|
|
public static JTextField taskMaxNumA;
|
|
@@ -420,6 +449,9 @@ public class MesClient extends JFrame {
|
|
|
oprno.setEnabled(ret);
|
|
oprno.setEnabled(ret);
|
|
|
oprnoTitle.setEnabled(ret);
|
|
oprnoTitle.setEnabled(ret);
|
|
|
lineSn.setEnabled(ret);
|
|
lineSn.setEnabled(ret);
|
|
|
|
|
+ if (sealRingEnable != null) {
|
|
|
|
|
+ sealRingEnable.setEnabled(ret);
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
public static void formatConfigData(){
|
|
public static void formatConfigData(){
|
|
@@ -550,6 +582,14 @@ public class MesClient extends JFrame {
|
|
|
}
|
|
}
|
|
|
lineSn.setText(configParam.getLineSn());
|
|
lineSn.setText(configParam.getLineSn());
|
|
|
|
|
|
|
|
|
|
+ if(configParam.getSealRingEnable() == null||configParam.getSealRingEnable().isEmpty()){
|
|
|
|
|
+ configParam.setSealRingEnable("否");
|
|
|
|
|
+ }
|
|
|
|
|
+ if (sealRingEnable != null) {
|
|
|
|
|
+ sealRingEnable.setSelectedItem(configParam.getSealRingEnable());
|
|
|
|
|
+ }
|
|
|
|
|
+ applySealRingUiVisibility();
|
|
|
|
|
+
|
|
|
if(!oprnoTitle.getText().isEmpty()){
|
|
if(!oprnoTitle.getText().isEmpty()){
|
|
|
String stationInfo = oprno.getText() +"-"+ oprnoTitle.getText();
|
|
String stationInfo = oprno.getText() +"-"+ oprnoTitle.getText();
|
|
|
welcomeWin.setTitle("气密检测客户端--"+stationInfo);
|
|
welcomeWin.setTitle("气密检测客户端--"+stationInfo);
|
|
@@ -1031,6 +1071,49 @@ public class MesClient extends JFrame {
|
|
|
result.setBounds(290, 332, 356, 89);
|
|
result.setBounds(290, 332, 356, 89);
|
|
|
indexPanelA.add(result);
|
|
indexPanelA.add(result);
|
|
|
|
|
|
|
|
|
|
+ // 胶圈次数(由软件设置启用后显示)
|
|
|
|
|
+ sealRingTitle = new JLabel("胶圈次数");
|
|
|
|
|
+ sealRingTitle.setHorizontalAlignment(SwingConstants.RIGHT);
|
|
|
|
|
+ sealRingTitle.setFont(new Font("微软雅黑", Font.PLAIN, 20));
|
|
|
|
|
+ sealRingTitle.setBounds(60, 440, 100, 50);
|
|
|
|
|
+ indexPanelA.add(sealRingTitle);
|
|
|
|
|
+
|
|
|
|
|
+ sealRingCountLabel = new JLabel("已提交 0 / 200 次");
|
|
|
|
|
+ sealRingCountLabel.setOpaque(true);
|
|
|
|
|
+ sealRingCountLabel.setBackground(new Color(240, 248, 255));
|
|
|
|
|
+ sealRingCountLabel.setBorder(BorderFactory.createLineBorder(new Color(70, 130, 180)));
|
|
|
|
|
+ sealRingCountLabel.setFont(new Font("微软雅黑", Font.BOLD, 24));
|
|
|
|
|
+ sealRingCountLabel.setForeground(new Color(0, 128, 0));
|
|
|
|
|
+ sealRingCountLabel.setHorizontalAlignment(SwingConstants.CENTER);
|
|
|
|
|
+ sealRingCountLabel.setBounds(170, 440, 280, 50);
|
|
|
|
|
+ indexPanelA.add(sealRingCountLabel);
|
|
|
|
|
+
|
|
|
|
|
+ sealRingLimitLbl = new JLabel("更换阈值");
|
|
|
|
|
+ sealRingLimitLbl.setHorizontalAlignment(SwingConstants.RIGHT);
|
|
|
|
|
+ sealRingLimitLbl.setFont(new Font("微软雅黑", Font.PLAIN, 18));
|
|
|
|
|
+ sealRingLimitLbl.setBounds(470, 440, 90, 50);
|
|
|
|
|
+ indexPanelA.add(sealRingLimitLbl);
|
|
|
|
|
+
|
|
|
|
|
+ sealRingLimitField = new JTextField();
|
|
|
|
|
+ sealRingLimitField.setFont(new Font("微软雅黑", Font.PLAIN, 22));
|
|
|
|
|
+ sealRingLimitField.setHorizontalAlignment(SwingConstants.CENTER);
|
|
|
|
|
+ sealRingLimitField.setBounds(570, 445, 80, 40);
|
|
|
|
|
+ indexPanelA.add(sealRingLimitField);
|
|
|
|
|
+
|
|
|
|
|
+ sealRingSaveLimitBt = new JButton("保存");
|
|
|
|
|
+ sealRingSaveLimitBt.setFont(new Font("微软雅黑", Font.PLAIN, 16));
|
|
|
|
|
+ sealRingSaveLimitBt.setBounds(660, 445, 80, 40);
|
|
|
|
|
+ sealRingSaveLimitBt.addActionListener(e -> saveSealRingLimit());
|
|
|
|
|
+ indexPanelA.add(sealRingSaveLimitBt);
|
|
|
|
|
+
|
|
|
|
|
+ sealRingResetBt = new JButton("已更换胶圈");
|
|
|
|
|
+ sealRingResetBt.setFont(new Font("微软雅黑", Font.PLAIN, 16));
|
|
|
|
|
+ sealRingResetBt.setBounds(750, 445, 120, 40);
|
|
|
|
|
+ sealRingResetBt.addActionListener(e -> resetSealRingCount());
|
|
|
|
|
+ indexPanelA.add(sealRingResetBt);
|
|
|
|
|
+
|
|
|
|
|
+ applySealRingUiVisibility();
|
|
|
|
|
+
|
|
|
finish_ok_bt = new JButton("OK");
|
|
finish_ok_bt = new JButton("OK");
|
|
|
finish_ok_bt.setEnabled(false);
|
|
finish_ok_bt.setEnabled(false);
|
|
|
finish_ok_bt.addActionListener(new ActionListener() {
|
|
finish_ok_bt.addActionListener(new ActionListener() {
|
|
@@ -1487,6 +1570,9 @@ public class MesClient extends JFrame {
|
|
|
configParam.setOprno(oprno.getText().trim());
|
|
configParam.setOprno(oprno.getText().trim());
|
|
|
configParam.setOprnoTitle(oprnoTitle.getText().trim());
|
|
configParam.setOprnoTitle(oprnoTitle.getText().trim());
|
|
|
configParam.setLineSn(lineSn.getText().trim());
|
|
configParam.setLineSn(lineSn.getText().trim());
|
|
|
|
|
+ if (sealRingEnable != null && sealRingEnable.getSelectedItem() != null) {
|
|
|
|
|
+ configParam.setSealRingEnable(sealRingEnable.getSelectedItem().toString());
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
System.out.println("configParam:"+JSONObject.toJSONString(configParam));
|
|
System.out.println("configParam:"+JSONObject.toJSONString(configParam));
|
|
|
|
|
|
|
@@ -1497,20 +1583,6 @@ public class MesClient extends JFrame {
|
|
|
}
|
|
}
|
|
|
isConfigEdit = 0;
|
|
isConfigEdit = 0;
|
|
|
|
|
|
|
|
-// MesClient.indexPanelB.removeAll();
|
|
|
|
|
-// System.out.println("indexPanelB:"+MesClient.indexPanelB.getComponentCount());
|
|
|
|
|
-// MesClient.jfxPanel2 = null;
|
|
|
|
|
-// if(MesClient.jfxPanel2 == null){
|
|
|
|
|
-// String url = "http://"+ MesClient.mes_server_ip+":8980/js/a/mes/mesProcessCheckRecord/ulist?ucode="+MesClient.user_menu.getText()+"&oprno="+MesClient.configParam.getOprno()+"&lineSn="+MesClient.mes_line_sn;
|
|
|
|
|
-// MesClient.jfxPanel2 = new MesWebView(url);
|
|
|
|
|
-// MesClient.jfxPanel2.setSize(990, 550);
|
|
|
|
|
-// MesClient.indexPanelB.add(MesClient.jfxPanel2);
|
|
|
|
|
-// System.out.println("indexPanelBB:"+MesClient.indexPanelB.getComponentCount());
|
|
|
|
|
-// MesClient.indexPanelB.revalidate(); // 重新验证布局(如果需要)
|
|
|
|
|
-// MesClient.indexPanelB.repaint();
|
|
|
|
|
-// System.out.println("indexPanelCC:"+MesClient.indexPanelB.getComponentCount());
|
|
|
|
|
-// }
|
|
|
|
|
-
|
|
|
|
|
formatConfigData();
|
|
formatConfigData();
|
|
|
serialPortUtils.closePort();
|
|
serialPortUtils.closePort();
|
|
|
serialPortUtils = new SerialPortUtils(configParam.getSerialPort(),configParam.getOprno(),configParam.getOprnoTitle(),configParam.getDevice());
|
|
serialPortUtils = new SerialPortUtils(configParam.getSerialPort(),configParam.getOprno(),configParam.getOprnoTitle(),configParam.getDevice());
|
|
@@ -1627,6 +1699,19 @@ public class MesClient extends JFrame {
|
|
|
lineSn.setBounds(762, 195, 200, 30);
|
|
lineSn.setBounds(762, 195, 200, 30);
|
|
|
indexPanelD.add(lineSn);
|
|
indexPanelD.add(lineSn);
|
|
|
|
|
|
|
|
|
|
+ JLabel lblSealRingEnable = new JLabel("胶圈次数");
|
|
|
|
|
+ lblSealRingEnable.setHorizontalAlignment(SwingConstants.RIGHT);
|
|
|
|
|
+ lblSealRingEnable.setFont(new Font("微软雅黑", Font.PLAIN, 16));
|
|
|
|
|
+ lblSealRingEnable.setBounds(10, 445, 120, 30);
|
|
|
|
|
+ indexPanelD.add(lblSealRingEnable);
|
|
|
|
|
+
|
|
|
|
|
+ sealRingEnable = new JComboBox();
|
|
|
|
|
+ sealRingEnable.setModel(new DefaultComboBoxModel(new String[] {"否", "是"}));
|
|
|
|
|
+ sealRingEnable.setFont(new Font("微软雅黑", Font.PLAIN, 16));
|
|
|
|
|
+ sealRingEnable.setBounds(140, 445, 200, 30);
|
|
|
|
|
+ sealRingEnable.setEnabled(false);
|
|
|
|
|
+ indexPanelD.add(sealRingEnable);
|
|
|
|
|
+
|
|
|
tabbedPane.addTab("软件设置", new ImageIcon(MesClient.class.getResource("/bg/menu_setting.png")), searchScrollPaneD, null);
|
|
tabbedPane.addTab("软件设置", new ImageIcon(MesClient.class.getResource("/bg/menu_setting.png")), searchScrollPaneD, null);
|
|
|
|
|
|
|
|
JPanel indexPanelTask = new JPanel();
|
|
JPanel indexPanelTask = new JPanel();
|
|
@@ -1965,6 +2050,103 @@ public class MesClient extends JFrame {
|
|
|
MesClient.status_menu.setText(msg);
|
|
MesClient.status_menu.setText(msg);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ public static boolean isSealRingEnabled() {
|
|
|
|
|
+ return configParam != null && "是".equals(configParam.getSealRingEnable());
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ public static void applySealRingUiVisibility() {
|
|
|
|
|
+ boolean enabled = isSealRingEnabled();
|
|
|
|
|
+ if (sealRingTitle != null) {
|
|
|
|
|
+ sealRingTitle.setVisible(enabled);
|
|
|
|
|
+ }
|
|
|
|
|
+ if (sealRingCountLabel != null) {
|
|
|
|
|
+ sealRingCountLabel.setVisible(enabled);
|
|
|
|
|
+ }
|
|
|
|
|
+ if (sealRingLimitLbl != null) {
|
|
|
|
|
+ sealRingLimitLbl.setVisible(enabled);
|
|
|
|
|
+ }
|
|
|
|
|
+ if (sealRingLimitField != null) {
|
|
|
|
|
+ sealRingLimitField.setVisible(enabled);
|
|
|
|
|
+ }
|
|
|
|
|
+ if (sealRingSaveLimitBt != null) {
|
|
|
|
|
+ sealRingSaveLimitBt.setVisible(enabled);
|
|
|
|
|
+ }
|
|
|
|
|
+ if (sealRingResetBt != null) {
|
|
|
|
|
+ sealRingResetBt.setVisible(enabled);
|
|
|
|
|
+ }
|
|
|
|
|
+ if (enabled) {
|
|
|
|
|
+ refreshSealRingUi();
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /** 测试结果成功落库/上传后累计胶圈使用次数,达到阈值则报警 */
|
|
|
|
|
+ public static void onSealRingUploadSuccess() {
|
|
|
|
|
+ if (!isSealRingEnabled()) {
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ int count = JdbcUtils.incrementSealRingCount();
|
|
|
|
|
+ int limit = JdbcUtils.getSealRingLimit();
|
|
|
|
|
+ refreshSealRingUi();
|
|
|
|
|
+ if (count >= limit) {
|
|
|
|
|
+ setMenuStatus("胶圈已达更换阈值(" + count + "/" + limit + "),请更换胶圈!", -1);
|
|
|
|
|
+ JOptionPane.showMessageDialog(mesClientFrame,
|
|
|
|
|
+ "胶圈已提交 " + count + " 次,达到更换阈值 " + limit + " 次。\n请更换胶圈后点击「已更换胶圈」清零。",
|
|
|
|
|
+ "胶圈更换提醒",
|
|
|
|
|
+ JOptionPane.WARNING_MESSAGE);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ public static void refreshSealRingUi() {
|
|
|
|
|
+ int count = JdbcUtils.getSealRingCount();
|
|
|
|
|
+ int limit = JdbcUtils.getSealRingLimit();
|
|
|
|
|
+ if (sealRingLimitField != null) {
|
|
|
|
|
+ sealRingLimitField.setText(String.valueOf(limit));
|
|
|
|
|
+ }
|
|
|
|
|
+ if (sealRingCountLabel != null) {
|
|
|
|
|
+ sealRingCountLabel.setText("已提交 " + count + " / " + limit + " 次");
|
|
|
|
|
+ if (count >= limit) {
|
|
|
|
|
+ sealRingCountLabel.setForeground(Color.RED);
|
|
|
|
|
+ } else if (limit > 0 && count >= limit * 0.9) {
|
|
|
|
|
+ sealRingCountLabel.setForeground(new Color(200, 120, 0));
|
|
|
|
|
+ } else {
|
|
|
|
|
+ sealRingCountLabel.setForeground(new Color(0, 128, 0));
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ private static void saveSealRingLimit() {
|
|
|
|
|
+ if (sealRingLimitField == null) {
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ String text = sealRingLimitField.getText().trim();
|
|
|
|
|
+ try {
|
|
|
|
|
+ int limit = Integer.parseInt(text);
|
|
|
|
|
+ if (limit <= 0) {
|
|
|
|
|
+ JOptionPane.showMessageDialog(mesClientFrame, "更换阈值必须大于 0", "提示", JOptionPane.WARNING_MESSAGE);
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ JdbcUtils.setSealRingLimit(limit);
|
|
|
|
|
+ refreshSealRingUi();
|
|
|
|
|
+ setMenuStatus("胶圈更换阈值已保存为 " + limit + " 次", 0);
|
|
|
|
|
+ } catch (NumberFormatException e) {
|
|
|
|
|
+ JOptionPane.showMessageDialog(mesClientFrame, "请输入正确的数字", "提示", JOptionPane.WARNING_MESSAGE);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ private static void resetSealRingCount() {
|
|
|
|
|
+ int confirm = JOptionPane.showConfirmDialog(mesClientFrame,
|
|
|
|
|
+ "确认已更换胶圈?\n将把提交次数清零。",
|
|
|
|
|
+ "更换胶圈确认",
|
|
|
|
|
+ JOptionPane.YES_NO_OPTION,
|
|
|
|
|
+ JOptionPane.QUESTION_MESSAGE);
|
|
|
|
|
+ if (confirm != JOptionPane.YES_OPTION) {
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ JdbcUtils.resetSealRingCount();
|
|
|
|
|
+ refreshSealRingUi();
|
|
|
|
|
+ setMenuStatus("胶圈计数已清零,可继续生产", 0);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
public static void getTask(){
|
|
public static void getTask(){
|
|
|
taskParamList = JdbcUtils.getTask();
|
|
taskParamList = JdbcUtils.getTask();
|
|
|
System.out.println("taskParamList:"+taskParamList.size());
|
|
System.out.println("taskParamList:"+taskParamList.size());
|