|
|
@@ -10,7 +10,6 @@ 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;
|
|
|
@@ -43,33 +42,12 @@ 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
|
|
|
public static Boolean isSubmitting2 = false; // 150B是否正在提交结果到MES
|
|
|
|
|
|
- // 工位1冷板相关变量
|
|
|
- public static JTextField product_sn_lb_1; // 冷板码输入框
|
|
|
- public static JButton f_scan_data_bt_lb_1; // 扫冷板码按钮
|
|
|
- public static JButton btnUnbindLb_1; // 解绑按钮
|
|
|
- public static boolean coldPlateValidated_1 = false; // 冷板是否校验通过
|
|
|
- public static String coldPlateCode_1 = ""; // 存储冷板码
|
|
|
- public static boolean bindLbStatus_1 = false; // 冷板绑定状态
|
|
|
- public static boolean scan_status_1 = false; // 是否已扫码,防止重复扫码
|
|
|
-
|
|
|
- // 工位2冷板相关变量
|
|
|
- public static JTextField product_sn_lb_2; // 冷板码输入框
|
|
|
- public static JButton f_scan_data_bt_lb_2; // 扫冷板码按钮
|
|
|
- public static JButton btnUnbindLb_2; // 解绑按钮
|
|
|
- public static boolean coldPlateValidated_2 = false; // 冷板是否校验通过
|
|
|
- public static String coldPlateCode_2 = ""; // 存储冷板码
|
|
|
- public static boolean bindLbStatus_2 = false; // 冷板绑定状态
|
|
|
- public static boolean scan_status_2 = false; // 是否已扫码,防止重复扫码
|
|
|
-
|
|
|
-
|
|
|
public static JButton finish_ok_bt_1;
|
|
|
public static JButton finish_ng_bt_1;
|
|
|
public static JTextField product_sn_1;
|
|
|
@@ -91,18 +69,13 @@ 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 JPanel indexPanelB;
|
|
|
- public static MesWebView jfxPanel = null;
|
|
|
- public static JPanel indexPanelC;
|
|
|
- public static MesWebView jfxPanel2 = null;
|
|
|
+ public static WorkRecordPanel workRecordPanel; // 本地工作记录面板
|
|
|
public static MesRadio mesRadioHj;
|
|
|
public static JTable table;
|
|
|
public static Object[] columnNames = {"物料名称", "绑定批次", "剩余次数", "操作"};
|
|
|
@@ -422,8 +395,6 @@ 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;
|
|
|
- scan_status_1 = false;
|
|
|
|
|
|
//停止心跳,设备将自动停止
|
|
|
heartBeatFlag = false;
|
|
|
@@ -431,14 +402,6 @@ public class MesClient extends JFrame {
|
|
|
log.info("resetScanA 清空工件码");
|
|
|
product_sn_1.setText("");
|
|
|
|
|
|
- // 重置冷板相关状态
|
|
|
- bindLbStatus_1 = false;
|
|
|
- coldPlateValidated_1 = false;
|
|
|
- coldPlateCode_1 = "";
|
|
|
- product_sn_lb_1.setText("");
|
|
|
- f_scan_data_bt_lb_1.setEnabled(false);
|
|
|
- btnUnbindLb_1.setEnabled(false);
|
|
|
-
|
|
|
// 重置拉铆数量
|
|
|
MesClient.aMax = 0;
|
|
|
MesClient.aFinish = 0;
|
|
|
@@ -470,8 +433,6 @@ 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;
|
|
|
- scan_status_2 = false;
|
|
|
|
|
|
//停止心跳,设备将自动停止
|
|
|
heartBeatFlag2 = false;
|
|
|
@@ -479,14 +440,6 @@ public class MesClient extends JFrame {
|
|
|
log.info("resetScanB 清空工件码");
|
|
|
product_sn_2.setText("");
|
|
|
|
|
|
- // 重置冷板相关状态
|
|
|
- bindLbStatus_2 = false;
|
|
|
- coldPlateValidated_2 = false;
|
|
|
- coldPlateCode_2 = "";
|
|
|
- product_sn_lb_2.setText("");
|
|
|
- f_scan_data_bt_lb_2.setEnabled(false);
|
|
|
- btnUnbindLb_2.setEnabled(false);
|
|
|
-
|
|
|
// 重置拉铆数量
|
|
|
MesClient.bMax = 0;
|
|
|
MesClient.bFinish = 0;
|
|
|
@@ -593,26 +546,6 @@ public class MesClient extends JFrame {
|
|
|
return sb.toString();
|
|
|
}
|
|
|
|
|
|
- // 校验冷板码是否以任一允许的前缀开头
|
|
|
- private static boolean matchColdplatePrefix(String barcode) {
|
|
|
- for (String prefix : Config.coldplate_prefix) {
|
|
|
- if (barcode.startsWith(prefix.trim())) {
|
|
|
- return true;
|
|
|
- }
|
|
|
- }
|
|
|
- return false;
|
|
|
- }
|
|
|
-
|
|
|
- // 拼接所有允许的冷板前缀,用于错误提示
|
|
|
- private static String coldplatePrefixHint() {
|
|
|
- StringBuilder sb = new StringBuilder();
|
|
|
- for (int i = 0; i < Config.coldplate_prefix.length; i++) {
|
|
|
- if (i > 0) sb.append("/");
|
|
|
- sb.append(Config.coldplate_prefix[i].trim());
|
|
|
- }
|
|
|
- return sb.toString();
|
|
|
- }
|
|
|
-
|
|
|
public static void scanBarcode1() {
|
|
|
if (work_status1 == 1) {
|
|
|
JOptionPane.showMessageDialog(mesClientFrame, "工作中,勿扫码", "提示窗口", JOptionPane.INFORMATION_MESSAGE);
|
|
|
@@ -642,16 +575,8 @@ public class MesClient extends JFrame {
|
|
|
//刷新界面
|
|
|
mesClientFrame.repaint();
|
|
|
|
|
|
- if (!tcp_connect_flag) {
|
|
|
- JOptionPane.showMessageDialog(mesClientFrame, "设备未连接Mes服务器", "提示窗口", JOptionPane.INFORMATION_MESSAGE);
|
|
|
- return;
|
|
|
- }
|
|
|
-
|
|
|
- // 查询工件质量
|
|
|
- Boolean sendret = DataUtil.checkQuality(nettyClient, scanBarcode.trim(), user20, Config.gw_1);
|
|
|
- if (!sendret) {
|
|
|
- JOptionPane.showMessageDialog(mesClientFrame, "消息发送失败,请重试", "提示窗口", JOptionPane.INFORMATION_MESSAGE);
|
|
|
- }
|
|
|
+ // 不做MES质量检查,前缀校验通过即启动
|
|
|
+ startWorkA(scanBarcode.trim());
|
|
|
} else {
|
|
|
JOptionPane.showMessageDialog(mesClientFrame, "请扫工件码", "提示窗口", JOptionPane.INFORMATION_MESSAGE);
|
|
|
}
|
|
|
@@ -686,19 +611,55 @@ public class MesClient extends JFrame {
|
|
|
//刷新界面
|
|
|
mesClientFrame.repaint();
|
|
|
|
|
|
- if (!tcp_connect_flag) {
|
|
|
- JOptionPane.showMessageDialog(mesClientFrame, "设备未连接Mes服务器", "提示窗口", JOptionPane.INFORMATION_MESSAGE);
|
|
|
- return;
|
|
|
+ // 不做MES质量检查,前缀校验通过即启动
|
|
|
+ startWorkB(scanBarcode.trim());
|
|
|
+ } else {
|
|
|
+ JOptionPane.showMessageDialog(mesClientFrame, "请扫工件码", "提示窗口", JOptionPane.INFORMATION_MESSAGE);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // 工位1开工:不做MES质量检查,扫码通过前缀校验即启动设备
|
|
|
+ public static void startWorkA(String barcode) {
|
|
|
+ if (work_status1 != 0) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ getUser();
|
|
|
+ work_status1 = 1;
|
|
|
+ f_scan_data_bt_1.setEnabled(false);
|
|
|
+
|
|
|
+ // 给PLC地址8写1并启动心跳,设备可以运行
|
|
|
+ try {
|
|
|
+ if (plcA != null) {
|
|
|
+ plcA.writeInt16(8, (short) 1);
|
|
|
+ log.info("A工位扫码完成,向地址8写入1,读取验证值:" + plcA.readInt16(8));
|
|
|
}
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error("A工位向地址8写入1失败:" + e.getMessage());
|
|
|
+ }
|
|
|
+ heartBeatFlag = true;
|
|
|
+ setMenuState_1("设备已启动,拉铆中", 0);
|
|
|
+ }
|
|
|
|
|
|
- // 查询工件质量
|
|
|
- Boolean sendret = DataUtil.checkQuality(nettyClient, scanBarcode.trim(), user20, Config.gw_2);
|
|
|
- if (!sendret) {
|
|
|
- JOptionPane.showMessageDialog(mesClientFrame, "消息发送失败,请重试", "提示窗口", JOptionPane.INFORMATION_MESSAGE);
|
|
|
+ // 工位2开工
|
|
|
+ public static void startWorkB(String barcode) {
|
|
|
+ if (work_status2 != 0) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ getUser();
|
|
|
+ work_status2 = 1;
|
|
|
+ f_scan_data_bt_2.setEnabled(false);
|
|
|
+
|
|
|
+ // 给PLC地址8写1并启动心跳,设备可以运行
|
|
|
+ try {
|
|
|
+ if (plcB != null) {
|
|
|
+ plcB.writeInt16(8, (short) 1);
|
|
|
+ log.info("B工位扫码完成,向地址8写入1,读取验证值:" + plcB.readInt16(8));
|
|
|
}
|
|
|
- } else {
|
|
|
- JOptionPane.showMessageDialog(mesClientFrame, "请扫工件码", "提示窗口", JOptionPane.INFORMATION_MESSAGE);
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error("B工位向地址8写入1失败:" + e.getMessage());
|
|
|
}
|
|
|
+ heartBeatFlag2 = true;
|
|
|
+ setMenuState_2("设备已启动,拉铆中", 0);
|
|
|
}
|
|
|
|
|
|
public static void logoff() {
|
|
|
@@ -738,7 +699,7 @@ public class MesClient extends JFrame {
|
|
|
|
|
|
public MesClient() {
|
|
|
setIconImage(Toolkit.getDefaultToolkit().getImage(MesClient.class.getResource("/bg/logo.png")));
|
|
|
- setTitle("MES系统客户端:OP150- " + Config.gw_des_1);
|
|
|
+ setTitle("MES系统客户端:OP245- " + Config.gw_des_1);
|
|
|
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
|
|
setBounds(0, 0, 1024, 768);
|
|
|
|
|
|
@@ -1066,7 +1027,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("OP150A");
|
|
|
+ JLabel state_label_1 = new JLabel("OP245A");
|
|
|
state_label_1.setHorizontalAlignment(SwingConstants.LEFT);
|
|
|
state_label_1.setForeground(Color.BLACK);
|
|
|
state_label_1.setFont(new Font("微软雅黑", Font.PLAIN, 20));
|
|
|
@@ -1113,61 +1074,6 @@ public class MesClient extends JFrame {
|
|
|
param2.setColumns(10);
|
|
|
//8.30//
|
|
|
|
|
|
- // 工位1冷板相关UI
|
|
|
- JLabel lbLabel_1 = new JLabel("冷板码:");
|
|
|
- lbLabel_1.setFont(new Font("微软雅黑", Font.PLAIN, 20));
|
|
|
- lbLabel_1.setBounds(10, 185, 70, 50);
|
|
|
- indexPanelA.add(lbLabel_1);
|
|
|
-
|
|
|
- product_sn_lb_1 = new JTextField();
|
|
|
- product_sn_lb_1.setHorizontalAlignment(SwingConstants.CENTER);
|
|
|
- product_sn_lb_1.setEditable(false);
|
|
|
- product_sn_lb_1.setFont(new Font("微软雅黑", Font.PLAIN, 18));
|
|
|
- product_sn_lb_1.setBounds(73, 185, 277, 50);
|
|
|
- indexPanelA.add(product_sn_lb_1);
|
|
|
- product_sn_lb_1.setColumns(10);
|
|
|
-
|
|
|
- f_scan_data_bt_lb_1 = new JButton("");//扫码
|
|
|
- f_scan_data_bt_lb_1.addActionListener(new ActionListener() {
|
|
|
- public void actionPerformed(ActionEvent e) {
|
|
|
- if (!scan_status_1){
|
|
|
- setMenuState_1("请在工件上料完成后扫码!",1);
|
|
|
- return;
|
|
|
- }
|
|
|
- if (work_status1 == 1 && check_quality_result1){
|
|
|
- scanBarcodeLb1();
|
|
|
- }else{
|
|
|
- setMenuState_1("请在工件质量检测合格后扫码!",1);
|
|
|
- }
|
|
|
- }
|
|
|
- });
|
|
|
- f_scan_data_bt_lb_1.setIcon(new ImageIcon(MesClient.class.getResource("/bg/scan_barcode.png")));
|
|
|
- f_scan_data_bt_lb_1.setFont(new Font("微软雅黑", Font.PLAIN, 24));
|
|
|
- f_scan_data_bt_lb_1.setBounds(348, 185, 70, 50);
|
|
|
- f_scan_data_bt_lb_1.setEnabled(false);
|
|
|
- indexPanelA.add(f_scan_data_bt_lb_1);
|
|
|
-
|
|
|
- btnUnbindLb_1 = new JButton("");//解绑
|
|
|
- btnUnbindLb_1.addActionListener(new ActionListener() {
|
|
|
- public void actionPerformed(ActionEvent e) {
|
|
|
- // 检查是否有冷板码需要处理
|
|
|
- if (!coldPlateValidated_1 && coldPlateCode_1.isEmpty()){
|
|
|
- setMenuState_1("没有冷板码需要清除!",1);
|
|
|
- return;
|
|
|
- }
|
|
|
- // 直接重置冷板相关的所有状态
|
|
|
- // 停止心跳,拉铆枪停止工作
|
|
|
- heartBeatFlag = false;
|
|
|
- resetlb1();
|
|
|
- setMenuState_1("冷板状态已重置,拉铆枪已停止",0);
|
|
|
- }
|
|
|
- });
|
|
|
- btnUnbindLb_1.setIcon(new ImageIcon(MesClient.class.getResource("/bg/delete.png")));
|
|
|
- btnUnbindLb_1.setFont(new Font("微软雅黑", Font.PLAIN, 24));
|
|
|
- btnUnbindLb_1.setBounds(420, 185, 70, 50);
|
|
|
- btnUnbindLb_1.setEnabled(false);
|
|
|
- indexPanelA.add(btnUnbindLb_1);
|
|
|
-
|
|
|
// 工位2
|
|
|
|
|
|
//8.30
|
|
|
@@ -1202,61 +1108,6 @@ public class MesClient extends JFrame {
|
|
|
param4.setColumns(10);
|
|
|
//8.30//
|
|
|
|
|
|
- // 工位2冷板相关UI
|
|
|
- JLabel lbLabel_2 = new JLabel("冷板码:");
|
|
|
- lbLabel_2.setFont(new Font("微软雅黑", Font.PLAIN, 20));
|
|
|
- lbLabel_2.setBounds(502, 185, 70, 50);
|
|
|
- indexPanelA.add(lbLabel_2);
|
|
|
-
|
|
|
- product_sn_lb_2 = new JTextField();
|
|
|
- product_sn_lb_2.setHorizontalAlignment(SwingConstants.CENTER);
|
|
|
- product_sn_lb_2.setEditable(false);
|
|
|
- product_sn_lb_2.setFont(new Font("微软雅黑", Font.PLAIN, 18));
|
|
|
- product_sn_lb_2.setBounds(565, 185, 287, 50);
|
|
|
- indexPanelA.add(product_sn_lb_2);
|
|
|
- product_sn_lb_2.setColumns(10);
|
|
|
-
|
|
|
- f_scan_data_bt_lb_2 = new JButton("");//扫码
|
|
|
- f_scan_data_bt_lb_2.addActionListener(new ActionListener() {
|
|
|
- public void actionPerformed(ActionEvent e) {
|
|
|
- if (!scan_status_2){
|
|
|
- setMenuState_2("请在工件上料完成后扫码!",1);
|
|
|
- return;
|
|
|
- }
|
|
|
- if (work_status2 == 1 && check_quality_result2){
|
|
|
- scanBarcodeLb2();
|
|
|
- }else{
|
|
|
- setMenuState_2("请在工件质量检测合格后扫码!",1);
|
|
|
- }
|
|
|
- }
|
|
|
- });
|
|
|
- f_scan_data_bt_lb_2.setIcon(new ImageIcon(MesClient.class.getResource("/bg/scan_barcode.png")));
|
|
|
- f_scan_data_bt_lb_2.setFont(new Font("微软雅黑", Font.PLAIN, 24));
|
|
|
- f_scan_data_bt_lb_2.setBounds(850, 185, 70, 50);
|
|
|
- f_scan_data_bt_lb_2.setEnabled(false);
|
|
|
- indexPanelA.add(f_scan_data_bt_lb_2);
|
|
|
-
|
|
|
- btnUnbindLb_2 = new JButton("");//解绑
|
|
|
- btnUnbindLb_2.addActionListener(new ActionListener() {
|
|
|
- public void actionPerformed(ActionEvent e) {
|
|
|
- // 检查是否有冷板码需要处理
|
|
|
- if (!coldPlateValidated_2 && coldPlateCode_2.isEmpty()){
|
|
|
- setMenuState_2("没有冷板码需要清除!",1);
|
|
|
- return;
|
|
|
- }
|
|
|
- // 直接重置冷板相关的所有状态
|
|
|
- // 停止心跳,拉铆枪停止工作
|
|
|
- heartBeatFlag2 = false;
|
|
|
- resetlb2();
|
|
|
- setMenuState_2("冷板状态已重置,拉铆枪已停止",0);
|
|
|
- }
|
|
|
- });
|
|
|
- btnUnbindLb_2.setIcon(new ImageIcon(MesClient.class.getResource("/bg/delete.png")));
|
|
|
- btnUnbindLb_2.setFont(new Font("微软雅黑", Font.PLAIN, 24));
|
|
|
- btnUnbindLb_2.setBounds(922, 185, 70, 50);
|
|
|
- btnUnbindLb_2.setEnabled(false);
|
|
|
- indexPanelA.add(btnUnbindLb_2);
|
|
|
-
|
|
|
product_sn_2 = new JTextField();
|
|
|
product_sn_2.setHorizontalAlignment(SwingConstants.CENTER);
|
|
|
product_sn_2.setEditable(false);
|
|
|
@@ -1312,7 +1163,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("OP150B");
|
|
|
+ JLabel state_label_2 = new JLabel("OP245B");
|
|
|
state_label_2.setHorizontalAlignment(SwingConstants.LEFT);
|
|
|
state_label_2.setForeground(Color.BLACK);
|
|
|
state_label_2.setFont(new Font("微软雅黑", Font.PLAIN, 20));
|
|
|
@@ -1333,27 +1184,17 @@ public class MesClient extends JFrame {
|
|
|
tabbedPane.addTab("工作面板", new ImageIcon(MesClient.class.getResource("/bg/a_side.png")), indexScrollPaneA, null);
|
|
|
tabbedPane.setEnabledAt(0, true);
|
|
|
|
|
|
- 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);
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
+ // 工作记录改为读本地SQLite,不再加载MES网页
|
|
|
+ workRecordPanel = new WorkRecordPanel();
|
|
|
+ tabbedPane.addTab("工作记录", new ImageIcon(MesClient.class.getResource("/bg/menu_data_preprocess.png")), workRecordPanel, null);
|
|
|
|
|
|
tabbedPane.addChangeListener(new ChangeListener() {
|
|
|
@Override
|
|
|
public void stateChanged(ChangeEvent e) {
|
|
|
JTabbedPane tabbedPane = (JTabbedPane) e.getSource();
|
|
|
- int selectedIndex = tabbedPane.getSelectedIndex();
|
|
|
- if (selectedIndex == 1) {
|
|
|
-
|
|
|
+ // 切到工作记录页时刷新本地数据
|
|
|
+ if (tabbedPane.getSelectedComponent() == workRecordPanel && workRecordPanel != null) {
|
|
|
+ workRecordPanel.reload();
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
@@ -1473,147 +1314,4 @@ public class MesClient extends JFrame {
|
|
|
tabbedPane.addTab("绑定物料", new ImageIcon(MesClient.class.getResource("/bg/menu_data_preprocess.png")), indexScrollPaneB, null);
|
|
|
}
|
|
|
|
|
|
- // 工位1扫冷板码
|
|
|
- public static void scanBarcodeLb1() {
|
|
|
- String scanBarcodeTitle = "";
|
|
|
- product_sn_lb_1.setText("");
|
|
|
- scanBarcodeTitle = "请扫冷板码";
|
|
|
-
|
|
|
- //弹窗扫工件码
|
|
|
- String scanBarcode = JOptionPane.showInputDialog(null, scanBarcodeTitle);
|
|
|
- log.info("工位1冷板码=" + scanBarcode);
|
|
|
-
|
|
|
- if(scanBarcode != null && !scanBarcode.equalsIgnoreCase("")) {
|
|
|
- // 校验冷板码前缀
|
|
|
- if(!matchColdplatePrefix(scanBarcode)) {
|
|
|
- setMenuState_1("冷板前缀错误,必须以" + coldplatePrefixHint() + "开头", 1);
|
|
|
- product_sn_lb_1.setText("");
|
|
|
- // 前缀错误,自动重新弹出扫码框
|
|
|
- scanBarcodeLb1();
|
|
|
- return;
|
|
|
- }
|
|
|
-
|
|
|
- //获取用户
|
|
|
- getUser();
|
|
|
- //获取扫码内容36位
|
|
|
- String barcode36 = getBarcode(scanBarcode);//处理36为码
|
|
|
- product_sn_lb_1.setText(scanBarcode);
|
|
|
-
|
|
|
- //刷新界面
|
|
|
- mesClientFrame.repaint();
|
|
|
-
|
|
|
- if(!scanBarcode.isEmpty()) {
|
|
|
- if(tcp_connect_flag) {
|
|
|
- // 发送冷板校验请求到服务端
|
|
|
- String warehouseSn = getBarcode(product_sn_lb_1.getText());
|
|
|
- String sn = getBarcode(product_sn_1.getText());
|
|
|
- getUser();
|
|
|
-
|
|
|
- // 保存冷板码,等待服务端校验结果
|
|
|
- coldPlateCode_1 = scanBarcode;
|
|
|
- setMenuState_1("正在校验冷板...", 0);
|
|
|
-
|
|
|
- // 调用服务端校验冷板绑定状态
|
|
|
- Boolean sendResult = DataUtil.validateColdPlate(nettyClient, sn, warehouseSn, user20, "400004", Config.gw_1);
|
|
|
- if(!sendResult) {
|
|
|
- setMenuState_1("校验请求发送失败,请重试", 1);
|
|
|
- coldPlateCode_1 = "";
|
|
|
- return;
|
|
|
- }
|
|
|
- }else{
|
|
|
- setMenuState_1("设备未连接Mes服务器",1);
|
|
|
- return;
|
|
|
- }
|
|
|
- }else {
|
|
|
- setMenuState_1("冷板码为空,请重新扫码",1);
|
|
|
- return;
|
|
|
- }
|
|
|
- }else {
|
|
|
- setMenuState_1("冷板码为空,请重新扫码",1);
|
|
|
- return;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- // 工位2扫冷板码
|
|
|
- public static void scanBarcodeLb2() {
|
|
|
- String scanBarcodeTitle = "";
|
|
|
- product_sn_lb_2.setText("");
|
|
|
- scanBarcodeTitle = "请扫冷板码";
|
|
|
-
|
|
|
- //弹窗扫工件码
|
|
|
- String scanBarcode = JOptionPane.showInputDialog(null, scanBarcodeTitle);
|
|
|
- log.info("工位2冷板码=" + scanBarcode);
|
|
|
-
|
|
|
- if(scanBarcode != null && !scanBarcode.equalsIgnoreCase("")) {
|
|
|
- // 校验冷板码前缀
|
|
|
- if(!matchColdplatePrefix(scanBarcode)) {
|
|
|
- setMenuState_2("冷板前缀错误,必须以" + coldplatePrefixHint() + "开头", 1);
|
|
|
- product_sn_lb_2.setText("");
|
|
|
- // 前缀错误,自动重新弹出扫码框
|
|
|
- scanBarcodeLb2();
|
|
|
- return;
|
|
|
- }
|
|
|
-
|
|
|
- //获取用户
|
|
|
- getUser();
|
|
|
- //获取扫码内容36位
|
|
|
- String barcode36 = getBarcode(scanBarcode);//处理36为码
|
|
|
- product_sn_lb_2.setText(scanBarcode);
|
|
|
-
|
|
|
- //刷新界面
|
|
|
- mesClientFrame.repaint();
|
|
|
-
|
|
|
- if(!scanBarcode.isEmpty()) {
|
|
|
- if(tcp_connect_flag) {
|
|
|
- // 发送冷板校验请求到服务端
|
|
|
- String warehouseSn = getBarcode(product_sn_lb_2.getText());
|
|
|
- String sn = getBarcode(product_sn_2.getText());
|
|
|
- getUser();
|
|
|
-
|
|
|
- // 保存冷板码,等待服务端校验结果
|
|
|
- coldPlateCode_2 = scanBarcode;
|
|
|
- setMenuState_2("正在校验冷板...", 0);
|
|
|
-
|
|
|
- // 调用服务端校验冷板绑定状态
|
|
|
- Boolean sendResult = DataUtil.validateColdPlate(nettyClient, sn, warehouseSn, user20, "400004", Config.gw_2);
|
|
|
- if(!sendResult) {
|
|
|
- setMenuState_2("校验请求发送失败,请重试", 1);
|
|
|
- coldPlateCode_2 = "";
|
|
|
- return;
|
|
|
- }
|
|
|
- }else{
|
|
|
- setMenuState_2("设备未连接Mes服务器",1);
|
|
|
- return;
|
|
|
- }
|
|
|
- }else {
|
|
|
- setMenuState_2("冷板码为空,请重新扫码",1);
|
|
|
- return;
|
|
|
- }
|
|
|
- }else {
|
|
|
- setMenuState_2("冷板码为空,请重新扫码",1);
|
|
|
- return;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- // 工位1重置冷板
|
|
|
- public static void resetlb1() {
|
|
|
- product_sn_lb_1.setText("");
|
|
|
- f_scan_data_bt_lb_1.setEnabled(true);
|
|
|
- btnUnbindLb_1.setEnabled(false);
|
|
|
- bindLbStatus_1 = false;
|
|
|
- coldPlateValidated_1 = false;
|
|
|
- coldPlateCode_1 = "";
|
|
|
- heartBeatFlag = false; // 停止心跳,设备将自动停止
|
|
|
- }
|
|
|
-
|
|
|
- // 工位2重置冷板
|
|
|
- public static void resetlb2() {
|
|
|
- product_sn_lb_2.setText("");
|
|
|
- f_scan_data_bt_lb_2.setEnabled(true);
|
|
|
- btnUnbindLb_2.setEnabled(false);
|
|
|
- bindLbStatus_2 = false;
|
|
|
- coldPlateValidated_2 = false;
|
|
|
- coldPlateCode_2 = "";
|
|
|
- heartBeatFlag2 = false; // 停止心跳,设备将自动停止
|
|
|
- }
|
|
|
}
|