|
@@ -4,6 +4,8 @@ import com.alibaba.fastjson2.JSONObject;
|
|
|
import com.mes.component.MesRadio;
|
|
import com.mes.component.MesRadio;
|
|
|
import com.mes.component.MesWebView;
|
|
import com.mes.component.MesWebView;
|
|
|
import com.mes.netty.NettyClient;
|
|
import com.mes.netty.NettyClient;
|
|
|
|
|
+import com.mes.plc.QmPlcMonitorPanel;
|
|
|
|
|
+import com.mes.plc.QmPlcPoller;
|
|
|
import com.mes.util.*;
|
|
import com.mes.util.*;
|
|
|
import org.slf4j.Logger;
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
import org.slf4j.LoggerFactory;
|
|
@@ -77,6 +79,8 @@ public class MesClient extends JFrame {
|
|
|
|
|
|
|
|
public static String user20 = "";
|
|
public static String user20 = "";
|
|
|
public static boolean mes_enable = true; // true=MES开启
|
|
public static boolean mes_enable = true; // true=MES开启
|
|
|
|
|
+ /** PLC 模式启用时,进站与结果由 QmPlcPoller 驱动,串口/WorkTimer 不参与上传 */
|
|
|
|
|
+ public static boolean qmPlcEnabled = false;
|
|
|
|
|
|
|
|
public static JFrame welcomeWin;
|
|
public static JFrame welcomeWin;
|
|
|
|
|
|
|
@@ -85,6 +89,7 @@ public class MesClient extends JFrame {
|
|
|
public static JPanel indexPanelC;
|
|
public static JPanel indexPanelC;
|
|
|
public static JPanel indexPanelD;
|
|
public static JPanel indexPanelD;
|
|
|
public static JPanel indexPanelTest;
|
|
public static JPanel indexPanelTest;
|
|
|
|
|
+ public static QmPlcMonitorPanel qmPlcMonitorPanel;
|
|
|
public static JTextField testPressureField;
|
|
public static JTextField testPressureField;
|
|
|
public static JTextField testLeakField;
|
|
public static JTextField testLeakField;
|
|
|
public static JTextField testStatusField;
|
|
public static JTextField testStatusField;
|
|
@@ -341,10 +346,12 @@ public class MesClient extends JFrame {
|
|
|
MesClient.finish_ok_bt.setEnabled(false);
|
|
MesClient.finish_ok_bt.setEnabled(false);
|
|
|
MesClient.finish_ng_bt.setEnabled(false);
|
|
MesClient.finish_ng_bt.setEnabled(false);
|
|
|
product_sn.setText("");
|
|
product_sn.setText("");
|
|
|
- product_sn.setEditable(true);
|
|
|
|
|
|
|
+ // PLC 模式下工件码只读显示框架码;非 PLC 模式允许手动扫码
|
|
|
|
|
+ product_sn.setEditable(!qmPlcEnabled);
|
|
|
tjFlag = 0;
|
|
tjFlag = 0;
|
|
|
mesStartFlag = 0;
|
|
mesStartFlag = 0;
|
|
|
WorkTimer.resetEndConfirm();
|
|
WorkTimer.resetEndConfirm();
|
|
|
|
|
+ QmPlcPoller.resetCycle();
|
|
|
curTaskName.setText("");
|
|
curTaskName.setText("");
|
|
|
curStabilizeTime = "";
|
|
curStabilizeTime = "";
|
|
|
curTestDuration = "";
|
|
curTestDuration = "";
|
|
@@ -358,7 +365,11 @@ public class MesClient extends JFrame {
|
|
|
// f_scan_data_bt_1.setIcon(new ImageIcon(MesClient.class.getResource("/bg/scan_barcode.png")));
|
|
// f_scan_data_bt_1.setIcon(new ImageIcon(MesClient.class.getResource("/bg/scan_barcode.png")));
|
|
|
// f_scan_data_bt_1.setText("扫码");
|
|
// f_scan_data_bt_1.setText("扫码");
|
|
|
// MesClient.f_scan_data_bt_1.setEnabled(true);
|
|
// MesClient.f_scan_data_bt_1.setEnabled(true);
|
|
|
- MesClient.setMenuStatus("请扫工件码",0);
|
|
|
|
|
|
|
+ if (qmPlcEnabled) {
|
|
|
|
|
+ MesClient.setMenuStatus("等待PLC扫码", 0);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ MesClient.setMenuStatus("请扫工件码", 0);
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
// MesClient.result.setText("等待结果");
|
|
// MesClient.result.setText("等待结果");
|
|
|
// MesClient.result.setForeground(Color.GRAY);
|
|
// MesClient.result.setForeground(Color.GRAY);
|
|
@@ -685,6 +696,10 @@ public class MesClient extends JFrame {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
public static void scanBarcode2() {
|
|
public static void scanBarcode2() {
|
|
|
|
|
+ if (qmPlcEnabled) {
|
|
|
|
|
+ MesClient.setMenuStatus("PLC模式:等待设备扫码", 0);
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
if(work_status == 1){
|
|
if(work_status == 1){
|
|
|
// MesClient.serialPortUtils.sendData("START");
|
|
// MesClient.serialPortUtils.sendData("START");
|
|
|
return;
|
|
return;
|
|
@@ -1001,13 +1016,16 @@ public class MesClient extends JFrame {
|
|
|
|
|
|
|
|
product_sn = new JTextField();
|
|
product_sn = new JTextField();
|
|
|
product_sn.setHorizontalAlignment(SwingConstants.LEFT);
|
|
product_sn.setHorizontalAlignment(SwingConstants.LEFT);
|
|
|
- product_sn.setEditable(true);
|
|
|
|
|
|
|
+ product_sn.setEditable(false);
|
|
|
product_sn.setFont(new Font("微软雅黑", Font.PLAIN, 28));
|
|
product_sn.setFont(new Font("微软雅黑", Font.PLAIN, 28));
|
|
|
- product_sn.setBounds(81, 70, 602, 70);
|
|
|
|
|
|
|
+ product_sn.setBounds(81, 70, 810, 70);
|
|
|
indexPanelA.add(product_sn);
|
|
indexPanelA.add(product_sn);
|
|
|
product_sn.setColumns(10);
|
|
product_sn.setColumns(10);
|
|
|
product_sn.addActionListener(new ActionListener() {
|
|
product_sn.addActionListener(new ActionListener() {
|
|
|
public void actionPerformed(ActionEvent e) {
|
|
public void actionPerformed(ActionEvent e) {
|
|
|
|
|
+ if (qmPlcEnabled) {
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
scan_type = 1;
|
|
scan_type = 1;
|
|
|
scanBarcode2();
|
|
scanBarcode2();
|
|
|
}
|
|
}
|
|
@@ -1024,7 +1042,8 @@ public class MesClient extends JFrame {
|
|
|
// f_scan_data_bt_1.setIcon(new ImageIcon(MesClient.class.getResource("/bg/scan_barcode.png")));
|
|
// f_scan_data_bt_1.setIcon(new ImageIcon(MesClient.class.getResource("/bg/scan_barcode.png")));
|
|
|
f_scan_data_bt_1.setFont(new Font("微软雅黑", Font.PLAIN, 32));
|
|
f_scan_data_bt_1.setFont(new Font("微软雅黑", Font.PLAIN, 32));
|
|
|
f_scan_data_bt_1.setBounds(693, 70, 198, 70);
|
|
f_scan_data_bt_1.setBounds(693, 70, 198, 70);
|
|
|
- indexPanelA.add(f_scan_data_bt_1);
|
|
|
|
|
|
|
+ f_scan_data_bt_1.setVisible(false);
|
|
|
|
|
+// indexPanelA.add(f_scan_data_bt_1);
|
|
|
|
|
|
|
|
JLabel lblNewLabel = new JLabel("测试压");
|
|
JLabel lblNewLabel = new JLabel("测试压");
|
|
|
lblNewLabel.setFont(new Font("微软雅黑", Font.PLAIN, 20));
|
|
lblNewLabel.setFont(new Font("微软雅黑", Font.PLAIN, 20));
|
|
@@ -1693,76 +1712,9 @@ public class MesClient extends JFrame {
|
|
|
|
|
|
|
|
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);
|
|
|
|
|
|
|
|
- // 通讯测试页:手动发送读取实时压力/泄漏
|
|
|
|
|
- indexPanelTest = new JPanel();
|
|
|
|
|
- JScrollPane searchScrollPaneTest = new JScrollPane(indexPanelTest);
|
|
|
|
|
- indexPanelTest.setLayout(null);
|
|
|
|
|
-
|
|
|
|
|
- JLabel testTitle = new JLabel("气密仪实时数据读取(点击发送读取压力/泄漏)");
|
|
|
|
|
- testTitle.setFont(new Font("微软雅黑", Font.PLAIN, 20));
|
|
|
|
|
- testTitle.setBounds(80, 30, 700, 40);
|
|
|
|
|
- indexPanelTest.add(testTitle);
|
|
|
|
|
-
|
|
|
|
|
- JLabel testPressureLabel = new JLabel("测试压");
|
|
|
|
|
- testPressureLabel.setHorizontalAlignment(SwingConstants.RIGHT);
|
|
|
|
|
- testPressureLabel.setFont(new Font("微软雅黑", Font.PLAIN, 20));
|
|
|
|
|
- testPressureLabel.setBounds(80, 100, 120, 40);
|
|
|
|
|
- indexPanelTest.add(testPressureLabel);
|
|
|
|
|
-
|
|
|
|
|
- testPressureField = new JTextField();
|
|
|
|
|
- testPressureField.setEditable(false);
|
|
|
|
|
- testPressureField.setFont(new Font("微软雅黑", Font.PLAIN, 20));
|
|
|
|
|
- testPressureField.setBounds(220, 100, 280, 40);
|
|
|
|
|
- indexPanelTest.add(testPressureField);
|
|
|
|
|
-
|
|
|
|
|
- JLabel testLeakLabel = new JLabel("泄露值");
|
|
|
|
|
- testLeakLabel.setHorizontalAlignment(SwingConstants.RIGHT);
|
|
|
|
|
- testLeakLabel.setFont(new Font("微软雅黑", Font.PLAIN, 20));
|
|
|
|
|
- testLeakLabel.setBounds(80, 160, 120, 40);
|
|
|
|
|
- indexPanelTest.add(testLeakLabel);
|
|
|
|
|
-
|
|
|
|
|
- testLeakField = new JTextField();
|
|
|
|
|
- testLeakField.setEditable(false);
|
|
|
|
|
- testLeakField.setFont(new Font("微软雅黑", Font.PLAIN, 20));
|
|
|
|
|
- testLeakField.setBounds(220, 160, 280, 40);
|
|
|
|
|
- indexPanelTest.add(testLeakField);
|
|
|
|
|
-
|
|
|
|
|
- JLabel testStatusLabel = new JLabel("状态码");
|
|
|
|
|
- testStatusLabel.setHorizontalAlignment(SwingConstants.RIGHT);
|
|
|
|
|
- testStatusLabel.setFont(new Font("微软雅黑", Font.PLAIN, 20));
|
|
|
|
|
- testStatusLabel.setBounds(80, 220, 120, 40);
|
|
|
|
|
- indexPanelTest.add(testStatusLabel);
|
|
|
|
|
-
|
|
|
|
|
- testStatusField = new JTextField();
|
|
|
|
|
- testStatusField.setEditable(false);
|
|
|
|
|
- testStatusField.setFont(new Font("微软雅黑", Font.PLAIN, 20));
|
|
|
|
|
- testStatusField.setBounds(220, 220, 280, 40);
|
|
|
|
|
- indexPanelTest.add(testStatusField);
|
|
|
|
|
-
|
|
|
|
|
- testSendBtn = new JButton("发送");
|
|
|
|
|
- testSendBtn.setFont(new Font("微软雅黑", Font.PLAIN, 28));
|
|
|
|
|
- testSendBtn.setBounds(540, 100, 160, 100);
|
|
|
|
|
- testSendBtn.addActionListener(new ActionListener() {
|
|
|
|
|
- public void actionPerformed(ActionEvent e) {
|
|
|
|
|
- sendDeviceTestRead();
|
|
|
|
|
- }
|
|
|
|
|
- });
|
|
|
|
|
- indexPanelTest.add(testSendBtn);
|
|
|
|
|
-
|
|
|
|
|
- JLabel testTipLabel = new JLabel("说明:泄漏=先发 10 30 04,再发 03 22 0A 00 02;设备需为 ateq");
|
|
|
|
|
- testTipLabel.setFont(new Font("微软雅黑", Font.PLAIN, 14));
|
|
|
|
|
- testTipLabel.setBounds(80, 280, 700, 30);
|
|
|
|
|
- indexPanelTest.add(testTipLabel);
|
|
|
|
|
-
|
|
|
|
|
- testLogArea = new JTextArea();
|
|
|
|
|
- testLogArea.setEditable(false);
|
|
|
|
|
- testLogArea.setFont(new Font("微软雅黑", Font.PLAIN, 14));
|
|
|
|
|
- testLogArea.setLineWrap(true);
|
|
|
|
|
- JScrollPane testLogScroll = new JScrollPane(testLogArea);
|
|
|
|
|
- testLogScroll.setBounds(80, 320, 700, 180);
|
|
|
|
|
- indexPanelTest.add(testLogScroll);
|
|
|
|
|
-
|
|
|
|
|
- tabbedPane.addTab("通讯测试", new ImageIcon(MesClient.class.getResource("/bg/menu_data_preprocess.png")), searchScrollPaneTest, null);
|
|
|
|
|
|
|
+ // 原「通讯测试」页已隐藏;改为 PLC 调试页,读取 DB200 全部点位
|
|
|
|
|
+ qmPlcMonitorPanel = new QmPlcMonitorPanel();
|
|
|
|
|
+ tabbedPane.addTab("PLC调试", new ImageIcon(MesClient.class.getResource("/bg/menu_data_preprocess.png")), qmPlcMonitorPanel, null);
|
|
|
|
|
|
|
|
JPanel indexPanelTask = new JPanel();
|
|
JPanel indexPanelTask = new JPanel();
|
|
|
searchScrollPaneTask = new JScrollPane(indexPanelTask);
|
|
searchScrollPaneTask = new JScrollPane(indexPanelTask);
|
|
@@ -2102,16 +2054,34 @@ public class MesClient extends JFrame {
|
|
|
tabbedPane.addChangeListener(new ChangeListener() {
|
|
tabbedPane.addChangeListener(new ChangeListener() {
|
|
|
@Override
|
|
@Override
|
|
|
public void stateChanged(ChangeEvent e) {
|
|
public void stateChanged(ChangeEvent e) {
|
|
|
- JTabbedPane tabbedPane = (JTabbedPane) e.getSource();
|
|
|
|
|
- int selectedIndex = tabbedPane.getSelectedIndex();
|
|
|
|
|
- if(selectedIndex == 1){
|
|
|
|
|
-
|
|
|
|
|
|
|
+ JTabbedPane pane = (JTabbedPane) e.getSource();
|
|
|
|
|
+ int selectedIndex = pane.getSelectedIndex();
|
|
|
|
|
+ String title = pane.getTitleAt(selectedIndex);
|
|
|
|
|
+ if ("PLC调试".equals(title)) {
|
|
|
|
|
+ if (qmPlcMonitorPanel != null) {
|
|
|
|
|
+ qmPlcMonitorPanel.startMonitor();
|
|
|
|
|
+ }
|
|
|
|
|
+ } else if (qmPlcMonitorPanel != null) {
|
|
|
|
|
+ qmPlcMonitorPanel.stopMonitor();
|
|
|
|
|
+ }
|
|
|
|
|
+ if (selectedIndex == 1) {
|
|
|
|
|
+ JdbcUtils.getTestData();
|
|
|
}
|
|
}
|
|
|
- JdbcUtils.getTestData();
|
|
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ /** PLC 启用后:隐藏启动按钮、工件码只读 */
|
|
|
|
|
+ public static void applyPlcWorkUi() {
|
|
|
|
|
+ if (f_scan_data_bt_1 != null) {
|
|
|
|
|
+ f_scan_data_bt_1.setVisible(false);
|
|
|
|
|
+ }
|
|
|
|
|
+ if (product_sn != null) {
|
|
|
|
|
+ product_sn.setEditable(false);
|
|
|
|
|
+ product_sn.setBounds(81, 70, 810, 70);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
public static void setMenuStatus(String msg,int error){
|
|
public static void setMenuStatus(String msg,int error){
|
|
|
if(error == 0){
|
|
if(error == 0){
|
|
|
MesClient.status_menu.setForeground(Color.GREEN);
|
|
MesClient.status_menu.setForeground(Color.GREEN);
|