|
@@ -41,6 +41,7 @@ public class MesClient extends JFrame {
|
|
|
public static int mes_heart_beat_cycle = 10; // 蹇冭烦鍛ㄦ湡
|
|
public static int mes_heart_beat_cycle = 10; // 蹇冭烦鍛ㄦ湡
|
|
|
public static int mes_heart_icon_cycle = 1;
|
|
public static int mes_heart_icon_cycle = 1;
|
|
|
public static String mes_line_sn = ""; // 浜х嚎缂栧彿
|
|
public static String mes_line_sn = ""; // 浜х嚎缂栧彿
|
|
|
|
|
+ public static String mes_sn_prefix = ""; // 工件码开头格式,多个用逗号分隔
|
|
|
|
|
|
|
|
//TCP杩炴帴
|
|
//TCP杩炴帴
|
|
|
public static NettyClient nettyClient;
|
|
public static NettyClient nettyClient;
|
|
@@ -194,6 +195,10 @@ public class MesClient extends JFrame {
|
|
|
mes_tcp_port = Integer.parseInt(pro.getProperty("mes.tcp_port"));
|
|
mes_tcp_port = Integer.parseInt(pro.getProperty("mes.tcp_port"));
|
|
|
mes_heart_beat_cycle = Integer.parseInt(pro.getProperty("mes.heart_beat_cycle"));
|
|
mes_heart_beat_cycle = Integer.parseInt(pro.getProperty("mes.heart_beat_cycle"));
|
|
|
mes_line_sn = pro.getProperty("mes.line_sn");
|
|
mes_line_sn = pro.getProperty("mes.line_sn");
|
|
|
|
|
+ mes_sn_prefix = pro.getProperty("mes.sn_prefix");
|
|
|
|
|
+ if (mes_sn_prefix == null) {
|
|
|
|
|
+ mes_sn_prefix = "";
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
mes_gw_des = OprnoUtil.getGwDes(mes_line_sn,mes_gw);
|
|
mes_gw_des = OprnoUtil.getGwDes(mes_line_sn,mes_gw);
|
|
|
|
|
|
|
@@ -404,14 +409,7 @@ public class MesClient extends JFrame {
|
|
|
Boolean uploadRet = DataUtil.uploadPressRivetData(product_sn.getText(), pressRivetMap);
|
|
Boolean uploadRet = DataUtil.uploadPressRivetData(product_sn.getText(), pressRivetMap);
|
|
|
String serverMsg = DataUtil.lastUploadPressRivetMessage;
|
|
String serverMsg = DataUtil.lastUploadPressRivetMessage;
|
|
|
if (uploadRet) {
|
|
if (uploadRet) {
|
|
|
- clearPressRivetData();
|
|
|
|
|
- tjFlag = 0;
|
|
|
|
|
- tjStatus = 0;
|
|
|
|
|
- work_status = 0;
|
|
|
|
|
- check_quality_result = false;
|
|
|
|
|
- if (f_scan_data_bt_1 != null) {
|
|
|
|
|
- f_scan_data_bt_1.setEnabled(true);
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ resetScanA();
|
|
|
setMenuStatus(serverMsg == null || serverMsg.trim().isEmpty() ? successMsg : serverMsg, 0);
|
|
setMenuStatus(serverMsg == null || serverMsg.trim().isEmpty() ? successMsg : serverMsg, 0);
|
|
|
return true;
|
|
return true;
|
|
|
}
|
|
}
|
|
@@ -506,6 +504,27 @@ public class MesClient extends JFrame {
|
|
|
return barcodeRet;
|
|
return barcodeRet;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 校验扫码内容是否以配置的工件码开头格式匹配。
|
|
|
|
|
+ * 未配置前缀时不做校验;多个前缀用逗号分隔,命中任一即可。
|
|
|
|
|
+ */
|
|
|
|
|
+ public static boolean matchSnPrefix(String sn) {
|
|
|
|
|
+ if (mes_sn_prefix == null || mes_sn_prefix.trim().isEmpty()) {
|
|
|
|
|
+ return true;
|
|
|
|
|
+ }
|
|
|
|
|
+ if (sn == null) {
|
|
|
|
|
+ return false;
|
|
|
|
|
+ }
|
|
|
|
|
+ String[] prefixes = mes_sn_prefix.split(",");
|
|
|
|
|
+ for (String prefix : prefixes) {
|
|
|
|
|
+ String p = prefix == null ? "" : prefix.trim();
|
|
|
|
|
+ if (!p.isEmpty() && sn.startsWith(p)) {
|
|
|
|
|
+ return true;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ return false;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
public static void scanBarcode() {
|
|
public static void scanBarcode() {
|
|
|
if(work_status == 1){
|
|
if(work_status == 1){
|
|
|
JOptionPane.showMessageDialog(mesClientFrame,"工作中,勿扫码","提示窗口", JOptionPane.INFORMATION_MESSAGE);
|
|
JOptionPane.showMessageDialog(mesClientFrame,"工作中,勿扫码","提示窗口", JOptionPane.INFORMATION_MESSAGE);
|
|
@@ -522,6 +541,14 @@ public class MesClient extends JFrame {
|
|
|
//寮圭獥鎵伐浠剁爜
|
|
//寮圭獥鎵伐浠剁爜
|
|
|
String scanBarcode = JOptionPane.showInputDialog(null, scanBarcodeTitle);
|
|
String scanBarcode = JOptionPane.showInputDialog(null, scanBarcodeTitle);
|
|
|
if(scanBarcode!=null&&!scanBarcode.equalsIgnoreCase("")) {
|
|
if(scanBarcode!=null&&!scanBarcode.equalsIgnoreCase("")) {
|
|
|
|
|
+ // 质量查询前校验工件码开头格式
|
|
|
|
|
+ if (!matchSnPrefix(scanBarcode)) {
|
|
|
|
|
+ MesClient.check_quality_result = false;
|
|
|
|
|
+ MesClient.work_status = 0;
|
|
|
|
|
+ MesClient.setMenuStatus("工件码格式不正确,请重试", -1);
|
|
|
|
|
+ JOptionPane.showMessageDialog(mesClientFrame, "工件码开头不符合配置格式", "提示窗口", JOptionPane.INFORMATION_MESSAGE);
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
//鑾峰彇鐢ㄦ埛
|
|
//鑾峰彇鐢ㄦ埛
|
|
|
getUser();
|
|
getUser();
|
|
|
//鑾峰彇鎵爜鍐呭36浣?
|
|
//鑾峰彇鎵爜鍐呭36浣?
|