|
|
@@ -65,6 +65,9 @@ public class MesClient extends JFrame {
|
|
|
public static int mes_heart_icon_cycle = 1;
|
|
|
public static String mes_line_sn = "";
|
|
|
public static String mes_gwflag = ""; // 工位标识
|
|
|
+ public static String mes_sn_prefix = ""; // 工件码开头格式(共用回退),多个用逗号分隔
|
|
|
+ public static String mes_sn_prefix_a = ""; // 第1码(OP030)开头格式
|
|
|
+ public static String mes_sn_prefix_b = ""; // 第2码(OP031)开头格式
|
|
|
|
|
|
public static NettyClient nettyClient;
|
|
|
public static boolean tcp_connect_flag = false;
|
|
|
@@ -522,15 +525,52 @@ public class MesClient extends JFrame {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- private static void checkQualityForScan(String scanBarcodeSn, String displayName, String face){
|
|
|
+ /** 铸件走 OP030,后边框走 OP031(后者才会进 validateDbjEntry) */
|
|
|
+ private static void checkQualityForScan(String scanBarcodeSn, String displayName, String oprno){
|
|
|
setMenuStatus(displayName + " 扫码成功,质量查询中", 0);
|
|
|
getUser();
|
|
|
- Boolean sendret = DataUtil.checkQuality(nettyClient, scanBarcodeSn, user20, getQualityOprnoByFace(face));
|
|
|
+ Boolean sendret = DataUtil.checkQuality(nettyClient, scanBarcodeSn, user20, oprno);
|
|
|
if(!sendret){
|
|
|
setMenuStatus("消息发送失败,请重试", 1);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 校验扫码内容是否以配置的工件码开头格式匹配。
|
|
|
+ * 未配置前缀时不做校验;多个前缀用逗号分隔,命中任一即可。
|
|
|
+ */
|
|
|
+ public static boolean matchSnPrefix(String sn, String prefixConfig) {
|
|
|
+ if (prefixConfig == null || prefixConfig.trim().isEmpty()) {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ if (sn == null) {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ String[] prefixes = prefixConfig.split(",");
|
|
|
+ for (String prefix : prefixes) {
|
|
|
+ String p = prefix == null ? "" : prefix.trim();
|
|
|
+ if (!p.isEmpty() && sn.startsWith(p)) {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ /** @deprecated 使用 matchSnPrefix(sn, prefixConfig) */
|
|
|
+ public static boolean matchSnPrefix(String sn) {
|
|
|
+ return matchSnPrefix(sn, mes_sn_prefix);
|
|
|
+ }
|
|
|
+
|
|
|
+ private static boolean checkSnPrefixBeforeQuality(String scanBarcodeSn, String prefixConfig, String codeLabel){
|
|
|
+ if (matchSnPrefix(scanBarcodeSn, prefixConfig)) {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ String tip = codeLabel + "工件码错误";
|
|
|
+ setMenuStatus(tip, 1);
|
|
|
+// JOptionPane.showMessageDialog(mesClientFrame, tip, "提示窗口", JOptionPane.INFORMATION_MESSAGE);
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
private static void scanCurrentFace(String scanBarcodeSn){
|
|
|
if(isFaceCodesComplete(curPage)){
|
|
|
setMenuStatus(("A".equals(curPage) ? "A" : "B") + "面两个码已扫完", 1);
|
|
|
@@ -542,11 +582,17 @@ public class MesClient extends JFrame {
|
|
|
setMenuStatus(getDisplayOprno030A() + "已存在,勿重复扫码", 1);
|
|
|
return;
|
|
|
}
|
|
|
+ if(!checkSnPrefixBeforeQuality(scanBarcodeSn, mes_sn_prefix_a, "第1码")){
|
|
|
+ return;
|
|
|
+ }
|
|
|
product_sn.setText(scanBarcodeSn);
|
|
|
- checkQualityForScan(scanBarcodeSn, getDisplayOprno030A(), "A");
|
|
|
+ checkQualityForScan(scanBarcodeSn, getDisplayOprno030A(), getOprno030A());
|
|
|
}else{
|
|
|
+ if(!checkSnPrefixBeforeQuality(scanBarcodeSn, mes_sn_prefix_b, "第2码")){
|
|
|
+ return;
|
|
|
+ }
|
|
|
textField.setText(scanBarcodeSn);
|
|
|
- checkQualityForScan(scanBarcodeSn, getDisplayOprno031A(), "A");
|
|
|
+ checkQualityForScan(scanBarcodeSn, getDisplayOprno031A(), getOprno031A());
|
|
|
tryStartBothWorks();
|
|
|
}
|
|
|
}else{
|
|
|
@@ -555,11 +601,17 @@ public class MesClient extends JFrame {
|
|
|
setMenuStatus(getDisplayOprno030B() + "已存在,勿重复扫码", 1);
|
|
|
return;
|
|
|
}
|
|
|
+ if(!checkSnPrefixBeforeQuality(scanBarcodeSn, mes_sn_prefix_a, "第1码")){
|
|
|
+ return;
|
|
|
+ }
|
|
|
product_sn2.setText(scanBarcodeSn);
|
|
|
- checkQualityForScan(scanBarcodeSn, getDisplayOprno030B(), "B");
|
|
|
+ checkQualityForScan(scanBarcodeSn, getDisplayOprno030B(), getOprno030B());
|
|
|
}else{
|
|
|
+ if(!checkSnPrefixBeforeQuality(scanBarcodeSn, mes_sn_prefix_b, "第2码")){
|
|
|
+ return;
|
|
|
+ }
|
|
|
textField_1.setText(scanBarcodeSn);
|
|
|
- checkQualityForScan(scanBarcodeSn, getDisplayOprno031B(), "B");
|
|
|
+ checkQualityForScan(scanBarcodeSn, getDisplayOprno031B(), getOprno031B());
|
|
|
tryStartBothWorks();
|
|
|
}
|
|
|
}
|
|
|
@@ -650,6 +702,18 @@ public class MesClient extends JFrame {
|
|
|
mes_tcp_port = Integer.parseInt(pro.getProperty("mes.tcp_port"));
|
|
|
mes_heart_beat_cycle = Integer.parseInt(pro.getProperty("mes.heart_beat_cycle"));
|
|
|
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_sn_prefix_a = pro.getProperty("mes.sn_prefix.a");
|
|
|
+ if (mes_sn_prefix_a == null || mes_sn_prefix_a.trim().isEmpty()) {
|
|
|
+ mes_sn_prefix_a = mes_sn_prefix;
|
|
|
+ }
|
|
|
+ mes_sn_prefix_b = pro.getProperty("mes.sn_prefix.b");
|
|
|
+ if (mes_sn_prefix_b == null || mes_sn_prefix_b.trim().isEmpty()) {
|
|
|
+ mes_sn_prefix_b = mes_sn_prefix;
|
|
|
+ }
|
|
|
|
|
|
mes_gw_des = OprnoUtil.getGwDes(mes_line_sn,mes_gw);
|
|
|
if(!mes_gw_b.equals(mes_gw)){
|
|
|
@@ -700,10 +764,12 @@ public class MesClient extends JFrame {
|
|
|
public static JTextField param1;
|
|
|
public static JTextField param2;
|
|
|
public static JTextField param3;
|
|
|
+ public static JTextField param4;
|
|
|
public static JTextField product_sn2;
|
|
|
public static JTextField param21;
|
|
|
public static JTextField param22;
|
|
|
public static JTextField param23;
|
|
|
+ public static JTextField param24;
|
|
|
public static void startHeartBeatTimer() {
|
|
|
if(heartBeatTimer!=null) {
|
|
|
heartBeatTimer.cancel();
|
|
|
@@ -796,10 +862,12 @@ public class MesClient extends JFrame {
|
|
|
MesClient.param1.setText("");
|
|
|
MesClient.param2.setText("");
|
|
|
MesClient.param3.setText("");
|
|
|
+ MesClient.param4.setText("");
|
|
|
|
|
|
MesClient.param21.setText("");
|
|
|
MesClient.param22.setText("");
|
|
|
MesClient.param23.setText("");
|
|
|
+ MesClient.param24.setText("");
|
|
|
|
|
|
MesClient.curSna = "";
|
|
|
MesClient.tjFlaga = 0;
|
|
|
@@ -852,10 +920,12 @@ public class MesClient extends JFrame {
|
|
|
MesClient.param1.setText("");
|
|
|
MesClient.param2.setText("");
|
|
|
MesClient.param3.setText("");
|
|
|
+ MesClient.param4.setText("");
|
|
|
|
|
|
MesClient.param21.setText("");
|
|
|
MesClient.param22.setText("");
|
|
|
MesClient.param23.setText("");
|
|
|
+ MesClient.param24.setText("");
|
|
|
MesClient.curSnb = "";
|
|
|
MesClient.tjFlagb = 0;
|
|
|
MesClient.checkB = 0;
|
|
|
@@ -1218,9 +1288,11 @@ public class MesClient extends JFrame {
|
|
|
|
|
|
//妫f牠銆�
|
|
|
JPanel indexPanelA = new JPanel();
|
|
|
- indexScrollPaneA = new JScrollPane(indexPanelA);
|
|
|
indexPanelA.setLayout(null);
|
|
|
- indexPanelA.setPreferredSize(new Dimension(1010, 520));
|
|
|
+ indexScrollPaneA = new JScrollPane(indexPanelA);
|
|
|
+ indexScrollPaneA.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
|
|
|
+ indexScrollPaneA.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
|
|
|
+ indexPanelA.setPreferredSize(new Dimension(1010, 450));
|
|
|
|
|
|
// ---- 顶部扫码输入区 y=8~64 ----
|
|
|
page_text = new JLabel("当前:A面 请扫主码");
|
|
|
@@ -1326,7 +1398,7 @@ public class MesClient extends JFrame {
|
|
|
// ---- 焊机参数区 y=272~510 ----
|
|
|
JSeparator separator_1_1 = new JSeparator();
|
|
|
separator_1_1.setOrientation(SwingConstants.VERTICAL);
|
|
|
- separator_1_1.setBounds(495, 272, 2, 230);
|
|
|
+ separator_1_1.setBounds(495, 272, 2, 180);
|
|
|
indexPanelA.add(separator_1_1);
|
|
|
|
|
|
JLabel lblNewLabel_4 = new JLabel("A面");
|
|
|
@@ -1418,98 +1490,133 @@ public class MesClient extends JFrame {
|
|
|
// mesRadioHj.setBounds(190,170,500,50);
|
|
|
// indexPanelA.add(mesRadioHj);
|
|
|
|
|
|
- // 焊机1参数 - 纵向排列(标签在上,数值在下)
|
|
|
+ // 焊机参数:第一行 电压/电流/送丝速度,第二行 程序名(整行)
|
|
|
+ int welder1X = 26;
|
|
|
+ int welder1W = 446;
|
|
|
+ int welder2X = 517;
|
|
|
+ int welder2W = 446;
|
|
|
+ int metricColW = 140;
|
|
|
+ int metricLabelY = 318;
|
|
|
+ int metricFieldY = 338;
|
|
|
+ int metricFieldH = 28;
|
|
|
+ int progLabelY = 376;
|
|
|
+ int progFieldY = 396;
|
|
|
+ int progFieldH = 28;
|
|
|
+
|
|
|
JLabel lblDyA = new JLabel("电压");
|
|
|
lblDyA.setHorizontalAlignment(SwingConstants.CENTER);
|
|
|
- lblDyA.setFont(new Font("Microsoft YaHei UI", Font.PLAIN, 18));
|
|
|
- lblDyA.setBounds(169, 318, 158, 22);
|
|
|
+ lblDyA.setFont(new Font("Microsoft YaHei UI", Font.PLAIN, 16));
|
|
|
+ lblDyA.setBounds(welder1X, metricLabelY, metricColW, 20);
|
|
|
indexPanelA.add(lblDyA);
|
|
|
|
|
|
param1 = new JTextField();
|
|
|
param1.setEnabled(false);
|
|
|
param1.setEditable(false);
|
|
|
param1.setHorizontalAlignment(SwingConstants.CENTER);
|
|
|
- param1.setFont(new Font("Microsoft YaHei UI", Font.PLAIN, 18));
|
|
|
- param1.setBounds(169, 342, 158, 30);
|
|
|
- param1.setColumns(10);
|
|
|
+ param1.setFont(new Font("Microsoft YaHei UI", Font.PLAIN, 16));
|
|
|
+ param1.setBounds(welder1X, metricFieldY, metricColW, metricFieldH);
|
|
|
indexPanelA.add(param1);
|
|
|
|
|
|
JLabel lblDlA = new JLabel("电流");
|
|
|
lblDlA.setHorizontalAlignment(SwingConstants.CENTER);
|
|
|
- lblDlA.setFont(new Font("Microsoft YaHei UI", Font.PLAIN, 18));
|
|
|
- lblDlA.setBounds(169, 378, 158, 22);
|
|
|
+ lblDlA.setFont(new Font("Microsoft YaHei UI", Font.PLAIN, 16));
|
|
|
+ lblDlA.setBounds(welder1X + metricColW + 8, metricLabelY, metricColW, 20);
|
|
|
indexPanelA.add(lblDlA);
|
|
|
|
|
|
param2 = new JTextField();
|
|
|
param2.setEnabled(false);
|
|
|
param2.setEditable(false);
|
|
|
param2.setHorizontalAlignment(SwingConstants.CENTER);
|
|
|
- param2.setFont(new Font("Microsoft YaHei UI", Font.PLAIN, 18));
|
|
|
- param2.setBounds(169, 402, 158, 30);
|
|
|
- param2.setColumns(10);
|
|
|
+ param2.setFont(new Font("Microsoft YaHei UI", Font.PLAIN, 16));
|
|
|
+ param2.setBounds(welder1X + metricColW + 8, metricFieldY, metricColW, metricFieldH);
|
|
|
indexPanelA.add(param2);
|
|
|
|
|
|
JLabel lblSsA = new JLabel("送丝速度");
|
|
|
lblSsA.setHorizontalAlignment(SwingConstants.CENTER);
|
|
|
- lblSsA.setFont(new Font("Microsoft YaHei UI", Font.PLAIN, 18));
|
|
|
- lblSsA.setBounds(169, 438, 158, 22);
|
|
|
+ lblSsA.setFont(new Font("Microsoft YaHei UI", Font.PLAIN, 16));
|
|
|
+ lblSsA.setBounds(welder1X + (metricColW + 8) * 2, metricLabelY, metricColW, 20);
|
|
|
indexPanelA.add(lblSsA);
|
|
|
|
|
|
param3 = new JTextField();
|
|
|
param3.setEnabled(false);
|
|
|
param3.setEditable(false);
|
|
|
param3.setHorizontalAlignment(SwingConstants.CENTER);
|
|
|
- param3.setFont(new Font("Microsoft YaHei UI", Font.PLAIN, 18));
|
|
|
- param3.setBounds(169, 462, 158, 30);
|
|
|
- param3.setColumns(10);
|
|
|
+ param3.setFont(new Font("Microsoft YaHei UI", Font.PLAIN, 16));
|
|
|
+ param3.setBounds(welder1X + (metricColW + 8) * 2, metricFieldY, metricColW, metricFieldH);
|
|
|
indexPanelA.add(param3);
|
|
|
|
|
|
- // 焊机2参数 - 纵向排列(标签在上,数值在下)
|
|
|
+ JLabel lblProgA = new JLabel("程序名");
|
|
|
+ lblProgA.setHorizontalAlignment(SwingConstants.CENTER);
|
|
|
+ lblProgA.setFont(new Font("Microsoft YaHei UI", Font.PLAIN, 16));
|
|
|
+ lblProgA.setBounds(welder1X, progLabelY, welder1W, 20);
|
|
|
+ indexPanelA.add(lblProgA);
|
|
|
+
|
|
|
+ param4 = new JTextField();
|
|
|
+ param4.setEnabled(false);
|
|
|
+ param4.setEditable(false);
|
|
|
+ param4.setHorizontalAlignment(SwingConstants.CENTER);
|
|
|
+ param4.setFont(new Font("Microsoft YaHei UI", Font.PLAIN, 16));
|
|
|
+ param4.setBounds(welder1X, progFieldY, welder1W, progFieldH);
|
|
|
+ indexPanelA.add(param4);
|
|
|
+
|
|
|
JLabel lblDyB = new JLabel("电压");
|
|
|
lblDyB.setHorizontalAlignment(SwingConstants.CENTER);
|
|
|
- lblDyB.setFont(new Font("Microsoft YaHei UI", Font.PLAIN, 18));
|
|
|
- lblDyB.setBounds(669, 318, 158, 22);
|
|
|
+ lblDyB.setFont(new Font("Microsoft YaHei UI", Font.PLAIN, 16));
|
|
|
+ lblDyB.setBounds(welder2X, metricLabelY, metricColW, 20);
|
|
|
indexPanelA.add(lblDyB);
|
|
|
|
|
|
param21 = new JTextField();
|
|
|
param21.setEnabled(false);
|
|
|
param21.setEditable(false);
|
|
|
param21.setHorizontalAlignment(SwingConstants.CENTER);
|
|
|
- param21.setFont(new Font("Microsoft YaHei UI", Font.PLAIN, 18));
|
|
|
- param21.setBounds(669, 342, 158, 30);
|
|
|
- param21.setColumns(10);
|
|
|
+ param21.setFont(new Font("Microsoft YaHei UI", Font.PLAIN, 16));
|
|
|
+ param21.setBounds(welder2X, metricFieldY, metricColW, metricFieldH);
|
|
|
indexPanelA.add(param21);
|
|
|
|
|
|
JLabel lblDlB = new JLabel("电流");
|
|
|
lblDlB.setHorizontalAlignment(SwingConstants.CENTER);
|
|
|
- lblDlB.setFont(new Font("Microsoft YaHei UI", Font.PLAIN, 18));
|
|
|
- lblDlB.setBounds(669, 378, 158, 22);
|
|
|
+ lblDlB.setFont(new Font("Microsoft YaHei UI", Font.PLAIN, 16));
|
|
|
+ lblDlB.setBounds(welder2X + metricColW + 8, metricLabelY, metricColW, 20);
|
|
|
indexPanelA.add(lblDlB);
|
|
|
|
|
|
param22 = new JTextField();
|
|
|
param22.setEnabled(false);
|
|
|
param22.setEditable(false);
|
|
|
param22.setHorizontalAlignment(SwingConstants.CENTER);
|
|
|
- param22.setFont(new Font("Microsoft YaHei UI", Font.PLAIN, 18));
|
|
|
- param22.setBounds(669, 402, 158, 30);
|
|
|
- param22.setColumns(10);
|
|
|
+ param22.setFont(new Font("Microsoft YaHei UI", Font.PLAIN, 16));
|
|
|
+ param22.setBounds(welder2X + metricColW + 8, metricFieldY, metricColW, metricFieldH);
|
|
|
indexPanelA.add(param22);
|
|
|
|
|
|
JLabel lblSsB = new JLabel("送丝速度");
|
|
|
lblSsB.setHorizontalAlignment(SwingConstants.CENTER);
|
|
|
- lblSsB.setFont(new Font("Microsoft YaHei UI", Font.PLAIN, 18));
|
|
|
- lblSsB.setBounds(669, 438, 158, 22);
|
|
|
+ lblSsB.setFont(new Font("Microsoft YaHei UI", Font.PLAIN, 16));
|
|
|
+ lblSsB.setBounds(welder2X + (metricColW + 8) * 2, metricLabelY, metricColW, 20);
|
|
|
indexPanelA.add(lblSsB);
|
|
|
|
|
|
param23 = new JTextField();
|
|
|
param23.setEnabled(false);
|
|
|
param23.setEditable(false);
|
|
|
param23.setHorizontalAlignment(SwingConstants.CENTER);
|
|
|
- param23.setFont(new Font("Microsoft YaHei UI", Font.PLAIN, 18));
|
|
|
- param23.setBounds(669, 462, 158, 30);
|
|
|
- param23.setColumns(10);
|
|
|
+ param23.setFont(new Font("Microsoft YaHei UI", Font.PLAIN, 16));
|
|
|
+ param23.setBounds(welder2X + (metricColW + 8) * 2, metricFieldY, metricColW, metricFieldH);
|
|
|
indexPanelA.add(param23);
|
|
|
|
|
|
+ JLabel lblProgB = new JLabel("程序名");
|
|
|
+ lblProgB.setHorizontalAlignment(SwingConstants.CENTER);
|
|
|
+ lblProgB.setFont(new Font("Microsoft YaHei UI", Font.PLAIN, 16));
|
|
|
+ lblProgB.setBounds(welder2X, progLabelY, welder2W, 20);
|
|
|
+ indexPanelA.add(lblProgB);
|
|
|
+
|
|
|
+ param24 = new JTextField();
|
|
|
+ param24.setEnabled(false);
|
|
|
+ param24.setEditable(false);
|
|
|
+ param24.setHorizontalAlignment(SwingConstants.CENTER);
|
|
|
+ param24.setFont(new Font("Microsoft YaHei UI", Font.PLAIN, 16));
|
|
|
+ param24.setBounds(welder2X, progFieldY, welder2W, progFieldH);
|
|
|
+ indexPanelA.add(param24);
|
|
|
+
|
|
|
+ indexPanelA.revalidate();
|
|
|
+
|
|
|
tabbedPane.addTab("工作面板", new ImageIcon(MesClient.class.getResource("/bg/a_side.png")), indexScrollPaneA, null);
|
|
|
tabbedPane.setEnabledAt(0, true);
|
|
|
|