|
|
@@ -10,6 +10,7 @@ import com.google.zxing.client.j2se.MatrixToImageWriter;
|
|
|
import com.google.zxing.common.BitMatrix;
|
|
|
import com.google.zxing.qrcode.QRCodeWriter;
|
|
|
import com.mes.component.MesRadio;
|
|
|
+import com.mes.component.MesWebView;
|
|
|
import com.mes.netty.NettyClient;
|
|
|
import com.mes.util.*;
|
|
|
import org.slf4j.Logger;
|
|
|
@@ -42,7 +43,9 @@ public class MesClient extends JFrame {
|
|
|
public static String sessionid = "";
|
|
|
public static NettyClient nettyClient;
|
|
|
|
|
|
+ public static Boolean check_quality_result1 = false;
|
|
|
public static Integer work_status1 = 0;
|
|
|
+ public static Boolean check_quality_result2 = false;
|
|
|
public static Integer work_status2 = 0;
|
|
|
|
|
|
public static Boolean isSubmitting1 = false; // 150A是否正在提交结果到MES
|
|
|
@@ -69,13 +72,18 @@ public class MesClient extends JFrame {
|
|
|
public static MesClient mesClientFrame;
|
|
|
public static JTabbedPane tabbedPane;
|
|
|
public static JScrollPane indexScrollPaneA;
|
|
|
+ public static JScrollPane searchScrollPane;
|
|
|
+ public static JScrollPane searchScrollPaneDj;
|
|
|
|
|
|
|
|
|
|
|
|
public static JButton heart_beat_menu;
|
|
|
public static JButton user_menu;
|
|
|
public static JFrame welcomeWin;
|
|
|
- public static WorkRecordPanel workRecordPanel; // 本地工作记录面板
|
|
|
+ public static JPanel indexPanelB; // 工作记录(MES网页)
|
|
|
+ public static MesWebView jfxPanel = null;
|
|
|
+ public static JPanel indexPanelC; // 开班点检(MES网页)
|
|
|
+ public static MesWebView jfxPanel2 = null;
|
|
|
public static MesRadio mesRadioHj;
|
|
|
public static JTable table;
|
|
|
public static Object[] columnNames = {"物料名称", "绑定批次", "剩余次数", "操作"};
|
|
|
@@ -395,6 +403,7 @@ public class MesClient extends JFrame {
|
|
|
MesClient.finish_ng_bt_1.setEnabled(false);
|
|
|
MesClient.f_scan_data_bt_1.setEnabled(true);
|
|
|
work_status1 = 0;
|
|
|
+ check_quality_result1 = false;
|
|
|
|
|
|
//停止心跳,设备将自动停止
|
|
|
heartBeatFlag = false;
|
|
|
@@ -433,6 +442,7 @@ public class MesClient extends JFrame {
|
|
|
MesClient.finish_ng_bt_2.setEnabled(false);
|
|
|
MesClient.f_scan_data_bt_2.setEnabled(true);
|
|
|
work_status2 = 0;
|
|
|
+ check_quality_result2 = false;
|
|
|
|
|
|
//停止心跳,设备将自动停止
|
|
|
heartBeatFlag2 = false;
|
|
|
@@ -575,8 +585,16 @@ public class MesClient extends JFrame {
|
|
|
//刷新界面
|
|
|
mesClientFrame.repaint();
|
|
|
|
|
|
- // 不做MES质量检查,前缀校验通过即启动
|
|
|
- startWorkA(scanBarcode.trim());
|
|
|
+ if (!tcp_connect_flag) {
|
|
|
+ JOptionPane.showMessageDialog(mesClientFrame, "设备未连接Mes服务器", "提示窗口", JOptionPane.INFORMATION_MESSAGE);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ // 查询工件质量,合格(UD)后由 MesRevice.checkQualityRevice 回调启动设备
|
|
|
+ Boolean sendret = DataUtil.checkQuality(nettyClient, scanBarcode.trim(), user20, Config.gw_1);
|
|
|
+ if (!sendret) {
|
|
|
+ JOptionPane.showMessageDialog(mesClientFrame, "消息发送失败,请重试", "提示窗口", JOptionPane.INFORMATION_MESSAGE);
|
|
|
+ }
|
|
|
} else {
|
|
|
JOptionPane.showMessageDialog(mesClientFrame, "请扫工件码", "提示窗口", JOptionPane.INFORMATION_MESSAGE);
|
|
|
}
|
|
|
@@ -611,19 +629,30 @@ public class MesClient extends JFrame {
|
|
|
//刷新界面
|
|
|
mesClientFrame.repaint();
|
|
|
|
|
|
- // 不做MES质量检查,前缀校验通过即启动
|
|
|
- startWorkB(scanBarcode.trim());
|
|
|
+ if (!tcp_connect_flag) {
|
|
|
+ JOptionPane.showMessageDialog(mesClientFrame, "设备未连接Mes服务器", "提示窗口", JOptionPane.INFORMATION_MESSAGE);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ // 查询工件质量,合格(UD)后由 MesRevice.checkQualityRevice 回调启动设备
|
|
|
+ Boolean sendret = DataUtil.checkQuality(nettyClient, scanBarcode.trim(), user20, Config.gw_2);
|
|
|
+ if (!sendret) {
|
|
|
+ JOptionPane.showMessageDialog(mesClientFrame, "消息发送失败,请重试", "提示窗口", JOptionPane.INFORMATION_MESSAGE);
|
|
|
+ }
|
|
|
} else {
|
|
|
JOptionPane.showMessageDialog(mesClientFrame, "请扫工件码", "提示窗口", JOptionPane.INFORMATION_MESSAGE);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- // 工位1开工:不做MES质量检查,扫码通过前缀校验即启动设备
|
|
|
+ // 工位1开工:由质量查询回调(UD合格)触发
|
|
|
public static void startWorkA(String barcode) {
|
|
|
if (work_status1 != 0) {
|
|
|
return;
|
|
|
}
|
|
|
getUser();
|
|
|
+ // 通知MES开始加工
|
|
|
+ DataUtil.startWork(nettyClient, getBarcode(barcode), user20, Config.gw_1);
|
|
|
+
|
|
|
work_status1 = 1;
|
|
|
f_scan_data_bt_1.setEnabled(false);
|
|
|
|
|
|
@@ -640,12 +669,15 @@ public class MesClient extends JFrame {
|
|
|
setMenuState_1("设备已启动,拉铆中", 0);
|
|
|
}
|
|
|
|
|
|
- // 工位2开工
|
|
|
+ // 工位2开工:由质量查询回调(UD合格)触发
|
|
|
public static void startWorkB(String barcode) {
|
|
|
if (work_status2 != 0) {
|
|
|
return;
|
|
|
}
|
|
|
getUser();
|
|
|
+ // 通知MES开始加工
|
|
|
+ DataUtil.startWork(nettyClient, getBarcode(barcode), user20, Config.gw_2);
|
|
|
+
|
|
|
work_status2 = 1;
|
|
|
f_scan_data_bt_2.setEnabled(false);
|
|
|
|
|
|
@@ -699,7 +731,7 @@ public class MesClient extends JFrame {
|
|
|
|
|
|
public MesClient() {
|
|
|
setIconImage(Toolkit.getDefaultToolkit().getImage(MesClient.class.getResource("/bg/logo.png")));
|
|
|
- setTitle("MES系统客户端:OP245- " + Config.gw_des_1);
|
|
|
+ setTitle("MES系统客户端:" + OprnoUtil.formatOprno(Config.gw_1) + "- " + Config.gw_des_1);
|
|
|
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
|
|
setBounds(0, 0, 1024, 768);
|
|
|
|
|
|
@@ -1027,7 +1059,7 @@ public class MesClient extends JFrame {
|
|
|
status_menu_1.setBounds(100, 38, 369, 53);
|
|
|
indexPanelA.add(status_menu_1);
|
|
|
|
|
|
- JLabel state_label_1 = new JLabel("OP245A");
|
|
|
+ JLabel state_label_1 = new JLabel(Config.gw_1);
|
|
|
state_label_1.setHorizontalAlignment(SwingConstants.LEFT);
|
|
|
state_label_1.setForeground(Color.BLACK);
|
|
|
state_label_1.setFont(new Font("微软雅黑", Font.PLAIN, 20));
|
|
|
@@ -1163,7 +1195,7 @@ public class MesClient extends JFrame {
|
|
|
status_menu_2.setBounds(597, 38, 369, 53);
|
|
|
indexPanelA.add(status_menu_2);
|
|
|
|
|
|
- JLabel state_label_2 = new JLabel("OP245B");
|
|
|
+ JLabel state_label_2 = new JLabel(Config.gw_2);
|
|
|
state_label_2.setHorizontalAlignment(SwingConstants.LEFT);
|
|
|
state_label_2.setForeground(Color.BLACK);
|
|
|
state_label_2.setFont(new Font("微软雅黑", Font.PLAIN, 20));
|
|
|
@@ -1184,17 +1216,23 @@ public class MesClient extends JFrame {
|
|
|
tabbedPane.addTab("工作面板", new ImageIcon(MesClient.class.getResource("/bg/a_side.png")), indexScrollPaneA, null);
|
|
|
tabbedPane.setEnabledAt(0, true);
|
|
|
|
|
|
- // 工作记录改为读本地SQLite,不再加载MES网页
|
|
|
- workRecordPanel = new WorkRecordPanel();
|
|
|
- tabbedPane.addTab("工作记录", new ImageIcon(MesClient.class.getResource("/bg/menu_data_preprocess.png")), workRecordPanel, null);
|
|
|
+ indexPanelC = new JPanel();
|
|
|
+ searchScrollPaneDj = new JScrollPane(indexPanelC);
|
|
|
+ indexPanelC.setLayout(null);
|
|
|
+ tabbedPane.addTab("开班点检", new ImageIcon(MesClient.class.getResource("/bg/menu_data_preprocess.png")), searchScrollPaneDj, null);
|
|
|
+
|
|
|
+ indexPanelB = new JPanel();
|
|
|
+ searchScrollPane = new JScrollPane(indexPanelB);
|
|
|
+ indexPanelB.setLayout(null);
|
|
|
+ tabbedPane.addTab("工作记录", new ImageIcon(MesClient.class.getResource("/bg/menu_data_preprocess.png")), searchScrollPane, null);
|
|
|
|
|
|
tabbedPane.addChangeListener(new ChangeListener() {
|
|
|
@Override
|
|
|
public void stateChanged(ChangeEvent e) {
|
|
|
JTabbedPane tabbedPane = (JTabbedPane) e.getSource();
|
|
|
- // 切到工作记录页时刷新本地数据
|
|
|
- if (tabbedPane.getSelectedComponent() == workRecordPanel && workRecordPanel != null) {
|
|
|
- workRecordPanel.reload();
|
|
|
+ int selectedIndex = tabbedPane.getSelectedIndex();
|
|
|
+ if (selectedIndex == 1) {
|
|
|
+
|
|
|
}
|
|
|
}
|
|
|
});
|