|
@@ -75,8 +75,18 @@ public class MesClient extends JFrame {
|
|
|
public static Integer work_status2 = 0;
|
|
public static Integer work_status2 = 0;
|
|
|
public static Boolean check_quality_result2 = false;
|
|
public static Boolean check_quality_result2 = false;
|
|
|
|
|
|
|
|
- public static Integer batch_status = 0; //A面 1=已绑定 0=未绑定
|
|
|
|
|
- public static Integer batch_status2 = 0; //B面 1=已绑定 0=未绑定
|
|
|
|
|
|
|
+ public static Integer batch_status = 0; //A面 1=压铸件已绑定 0=未绑定
|
|
|
|
|
+ public static Integer batch_status2 = 0; //B面 1=压铸件已绑定 0=未绑定
|
|
|
|
|
+
|
|
|
|
|
+ public static final String YZJ_CRAFT = "400002";
|
|
|
|
|
+ public static final String[] YZJ_SN_OVERSEAS_PREFIXES = {
|
|
|
|
|
+ "500313660065119990", "500313660005119990", "501901660057119990"
|
|
|
|
|
+ };
|
|
|
|
|
+ public static final String[] YZJ_SN_DOMESTIC_PREFIXES = {
|
|
|
|
|
+ "501901660034119990", "501901660051119990"
|
|
|
|
|
+ };
|
|
|
|
|
+ public static final String YZJ_WSN_OVERSEAS_PREFIX = "02.02.000179";
|
|
|
|
|
+ public static final String YZJ_WSN_DOMESTIC_PREFIX = "02.02.000156";
|
|
|
|
|
|
|
|
public static JButton heart_beat_menu;
|
|
public static JButton heart_beat_menu;
|
|
|
public static JButton status_menu;
|
|
public static JButton status_menu;
|
|
@@ -88,8 +98,15 @@ public class MesClient extends JFrame {
|
|
|
public static JButton finish_ng_bt;
|
|
public static JButton finish_ng_bt;
|
|
|
public static JButton finish_ng_bt2;
|
|
public static JButton finish_ng_bt2;
|
|
|
public static JTextField product_sn;
|
|
public static JTextField product_sn;
|
|
|
|
|
+ public static JTextField product_yzj;
|
|
|
|
|
+ public static JTextField product_yzj2;
|
|
|
public static JLabel pxstatus1;
|
|
public static JLabel pxstatus1;
|
|
|
public static JLabel pxstatus2;
|
|
public static JLabel pxstatus2;
|
|
|
|
|
+ public static JLabel yzj_label_a;
|
|
|
|
|
+ public static JLabel yzj_label_b;
|
|
|
|
|
+
|
|
|
|
|
+ public static JButton rescan_yzj_a;
|
|
|
|
|
+ public static JButton rescan_yzj_b;
|
|
|
|
|
|
|
|
public static JButton batch_scan_1;
|
|
public static JButton batch_scan_1;
|
|
|
public static JButton batch_scan_2;
|
|
public static JButton batch_scan_2;
|
|
@@ -188,13 +205,25 @@ public class MesClient extends JFrame {
|
|
|
cjTimerText = new Timer();
|
|
cjTimerText = new Timer();
|
|
|
cjTimerText.schedule(new TimerTask() {
|
|
cjTimerText.schedule(new TimerTask() {
|
|
|
public void run() {
|
|
public void run() {
|
|
|
- txtfa.requestFocusInWindow();
|
|
|
|
|
-
|
|
|
|
|
- MesClient.curPage = PlcUtil.getCurAside(s7PLC);
|
|
|
|
|
- if(MesClient.curPage .equals("A")){
|
|
|
|
|
- page_text.setText("当前:A面");
|
|
|
|
|
- }else{
|
|
|
|
|
- page_text.setText("当前:B面");
|
|
|
|
|
|
|
+ try{
|
|
|
|
|
+ MesClient.curPage = PlcUtil.getCurAside(s7PLC);
|
|
|
|
|
+ final String pageLabel = MesClient.curPage.equals("A") ? "当前:A面" : "当前:B面";
|
|
|
|
|
+ SwingUtilities.invokeLater(new Runnable() {
|
|
|
|
|
+ public void run() {
|
|
|
|
|
+ if(page_text != null){
|
|
|
|
|
+ page_text.setText(pageLabel);
|
|
|
|
|
+ }
|
|
|
|
|
+ refreshScanInputState();
|
|
|
|
|
+ if(txtyzj != null && txtyzj.isEnabled()){
|
|
|
|
|
+ txtyzj.requestFocusInWindow();
|
|
|
|
|
+ }else if(txtfa != null && txtfa.isEnabled()
|
|
|
|
|
+ && mesClientFrame != null && mesClientFrame.isDisplayable()){
|
|
|
|
|
+ txtfa.requestFocusInWindow();
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ }catch (Exception e){
|
|
|
|
|
+ e.printStackTrace();
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}, 1000,1000);
|
|
}, 1000,1000);
|
|
@@ -409,7 +438,11 @@ public class MesClient extends JFrame {
|
|
|
MesClient.finish_ok_bt.setEnabled(false);
|
|
MesClient.finish_ok_bt.setEnabled(false);
|
|
|
MesClient.mesQualityFlagA = false;
|
|
MesClient.mesQualityFlagA = false;
|
|
|
product_sn.setText("");
|
|
product_sn.setText("");
|
|
|
|
|
+ if(product_yzj != null){
|
|
|
|
|
+ product_yzj.setText("");
|
|
|
|
|
+ }
|
|
|
MesClient.pxstatus1.setText("A");
|
|
MesClient.pxstatus1.setText("A");
|
|
|
|
|
+ MesClient.batch_status = 0;
|
|
|
|
|
|
|
|
// PlcUtil.changeEnable(s7PLC,false);
|
|
// PlcUtil.changeEnable(s7PLC,false);
|
|
|
|
|
|
|
@@ -429,11 +462,8 @@ public class MesClient extends JFrame {
|
|
|
MesClient.tjFlaga = 0;
|
|
MesClient.tjFlaga = 0;
|
|
|
MesClient.checkA = 0;
|
|
MesClient.checkA = 0;
|
|
|
|
|
|
|
|
-// MesClient.batch_status = 0;
|
|
|
|
|
-// MesClient.textField.setText("");
|
|
|
|
|
-// MesClient.batch_scan_1.setEnabled(false);
|
|
|
|
|
MesClient.formatScanType(1);
|
|
MesClient.formatScanType(1);
|
|
|
-// PlcUtil.changeEnable(MesClient.s7PLC,false);
|
|
|
|
|
|
|
+ MesClient.refreshScanInputState();
|
|
|
|
|
|
|
|
finish_ok_bt.setEnabled(false);
|
|
finish_ok_bt.setEnabled(false);
|
|
|
finish_ng_bt.setEnabled(false);
|
|
finish_ng_bt.setEnabled(false);
|
|
@@ -447,6 +477,8 @@ public class MesClient extends JFrame {
|
|
|
public static JTextField textField;
|
|
public static JTextField textField;
|
|
|
public static JTextField textField_1;
|
|
public static JTextField textField_1;
|
|
|
public static JTextField txtfa;
|
|
public static JTextField txtfa;
|
|
|
|
|
+ public static JTextField txtyzj;
|
|
|
|
|
+ public static JLabel yzj_scan_label;
|
|
|
public static JLabel scan_type_text;
|
|
public static JLabel scan_type_text;
|
|
|
public static JLabel page_text;
|
|
public static JLabel page_text;
|
|
|
//换班用户信息检查
|
|
//换班用户信息检查
|
|
@@ -473,6 +505,10 @@ public class MesClient extends JFrame {
|
|
|
MesClient.finish_ng_bt.setEnabled(false);
|
|
MesClient.finish_ng_bt.setEnabled(false);
|
|
|
MesClient.mesQualityFlagB = false;
|
|
MesClient.mesQualityFlagB = false;
|
|
|
product_sn2.setText("");
|
|
product_sn2.setText("");
|
|
|
|
|
+ if(product_yzj2 != null){
|
|
|
|
|
+ product_yzj2.setText("");
|
|
|
|
|
+ }
|
|
|
|
|
+ MesClient.batch_status2 = 0;
|
|
|
|
|
|
|
|
// PlcUtil.changeEnable(s7PLC,false);
|
|
// PlcUtil.changeEnable(s7PLC,false);
|
|
|
|
|
|
|
@@ -492,11 +528,8 @@ public class MesClient extends JFrame {
|
|
|
MesClient.tjFlagb = 0;
|
|
MesClient.tjFlagb = 0;
|
|
|
MesClient.checkB = 0;
|
|
MesClient.checkB = 0;
|
|
|
|
|
|
|
|
-// MesClient.batch_status2 = 0;
|
|
|
|
|
-// MesClient.textField_1.setText("");
|
|
|
|
|
-// MesClient.batch_scan_2.setEnabled(false);
|
|
|
|
|
MesClient.formatScanType(1);
|
|
MesClient.formatScanType(1);
|
|
|
-// PlcUtil.changeEnable(MesClient.s7PLC,false);
|
|
|
|
|
|
|
+ MesClient.refreshScanInputState();
|
|
|
finish_ok_bt2.setEnabled(false);
|
|
finish_ok_bt2.setEnabled(false);
|
|
|
finish_ng_bt2.setEnabled(false);
|
|
finish_ng_bt2.setEnabled(false);
|
|
|
|
|
|
|
@@ -747,11 +780,37 @@ public class MesClient extends JFrame {
|
|
|
product_sn.setText("");
|
|
product_sn.setText("");
|
|
|
product_sn.setHorizontalAlignment(SwingConstants.CENTER);
|
|
product_sn.setHorizontalAlignment(SwingConstants.CENTER);
|
|
|
product_sn.setEditable(false);
|
|
product_sn.setEditable(false);
|
|
|
- product_sn.setFont(new Font("Microsoft YaHei UI", Font.PLAIN, 22));
|
|
|
|
|
- product_sn.setBounds(26, 152, 446, 70);
|
|
|
|
|
|
|
+ product_sn.setFont(new Font("Microsoft YaHei UI", Font.PLAIN, 18));
|
|
|
|
|
+ product_sn.setBounds(26, 140, 446, 48);
|
|
|
indexPanelA.add(product_sn);
|
|
indexPanelA.add(product_sn);
|
|
|
product_sn.setColumns(10);
|
|
product_sn.setColumns(10);
|
|
|
|
|
|
|
|
|
|
+ yzj_label_a = new JLabel("\u538b\u94f8\u4ef6\u4e8c\u7ef4\u7801");
|
|
|
|
|
+ yzj_label_a.setHorizontalAlignment(SwingConstants.CENTER);
|
|
|
|
|
+ yzj_label_a.setForeground(new Color(0, 128, 192));
|
|
|
|
|
+ yzj_label_a.setFont(new Font("Microsoft YaHei UI", Font.PLAIN, 14));
|
|
|
|
|
+ yzj_label_a.setBounds(26, 188, 446, 22);
|
|
|
|
|
+ indexPanelA.add(yzj_label_a);
|
|
|
|
|
+
|
|
|
|
|
+ product_yzj = new JTextField();
|
|
|
|
|
+ product_yzj.setText("");
|
|
|
|
|
+ product_yzj.setHorizontalAlignment(SwingConstants.CENTER);
|
|
|
|
|
+ product_yzj.setEditable(false);
|
|
|
|
|
+ product_yzj.setFont(new Font("Microsoft YaHei UI", Font.PLAIN, 16));
|
|
|
|
|
+ product_yzj.setBounds(26, 208, 320, 40);
|
|
|
|
|
+ indexPanelA.add(product_yzj);
|
|
|
|
|
+ product_yzj.setColumns(10);
|
|
|
|
|
+
|
|
|
|
|
+ rescan_yzj_a = new JButton("\u91cd\u626b\u538b\u94f8\u4ef6-A");
|
|
|
|
|
+ rescan_yzj_a.setFont(new Font("Microsoft YaHei UI", Font.PLAIN, 14));
|
|
|
|
|
+ rescan_yzj_a.setBounds(352, 208, 120, 40);
|
|
|
|
|
+ rescan_yzj_a.addActionListener(new ActionListener() {
|
|
|
|
|
+ public void actionPerformed(ActionEvent e) {
|
|
|
|
|
+ rescanYzj("A");
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ indexPanelA.add(rescan_yzj_a);
|
|
|
|
|
+
|
|
|
// String[] hjtitles = new String[]{"閻掑﹥婧�1","閻掑﹥婧�2","閻掑﹥婧�3"};
|
|
// String[] hjtitles = new String[]{"閻掑﹥婧�1","閻掑﹥婧�2","閻掑﹥婧�3"};
|
|
|
// String[] hjvals = new String[]{"HJ001","HJ002","HJ003"};
|
|
// String[] hjvals = new String[]{"HJ001","HJ002","HJ003"};
|
|
|
// mesRadioHj = new MesRadio(hjtitles,hjvals);
|
|
// mesRadioHj = new MesRadio(hjtitles,hjvals);
|
|
@@ -993,19 +1052,45 @@ public class MesClient extends JFrame {
|
|
|
product_sn2 = new JTextField();
|
|
product_sn2 = new JTextField();
|
|
|
product_sn2.setText("");
|
|
product_sn2.setText("");
|
|
|
product_sn2.setHorizontalAlignment(SwingConstants.CENTER);
|
|
product_sn2.setHorizontalAlignment(SwingConstants.CENTER);
|
|
|
- product_sn2.setFont(new Font("Microsoft YaHei UI", Font.PLAIN, 22));
|
|
|
|
|
|
|
+ product_sn2.setFont(new Font("Microsoft YaHei UI", Font.PLAIN, 18));
|
|
|
product_sn2.setEditable(false);
|
|
product_sn2.setEditable(false);
|
|
|
product_sn2.setColumns(10);
|
|
product_sn2.setColumns(10);
|
|
|
- product_sn2.setBounds(517, 152, 446, 70);
|
|
|
|
|
|
|
+ product_sn2.setBounds(517, 140, 446, 48);
|
|
|
indexPanelA.add(product_sn2);
|
|
indexPanelA.add(product_sn2);
|
|
|
|
|
|
|
|
|
|
+ yzj_label_b = new JLabel("\u538b\u94f8\u4ef6\u4e8c\u7ef4\u7801");
|
|
|
|
|
+ yzj_label_b.setHorizontalAlignment(SwingConstants.CENTER);
|
|
|
|
|
+ yzj_label_b.setForeground(new Color(0, 128, 192));
|
|
|
|
|
+ yzj_label_b.setFont(new Font("Microsoft YaHei UI", Font.PLAIN, 14));
|
|
|
|
|
+ yzj_label_b.setBounds(517, 188, 446, 22);
|
|
|
|
|
+ indexPanelA.add(yzj_label_b);
|
|
|
|
|
+
|
|
|
|
|
+ product_yzj2 = new JTextField();
|
|
|
|
|
+ product_yzj2.setText("");
|
|
|
|
|
+ product_yzj2.setHorizontalAlignment(SwingConstants.CENTER);
|
|
|
|
|
+ product_yzj2.setEditable(false);
|
|
|
|
|
+ product_yzj2.setFont(new Font("Microsoft YaHei UI", Font.PLAIN, 16));
|
|
|
|
|
+ product_yzj2.setColumns(10);
|
|
|
|
|
+ product_yzj2.setBounds(517, 208, 320, 40);
|
|
|
|
|
+ indexPanelA.add(product_yzj2);
|
|
|
|
|
+
|
|
|
|
|
+ rescan_yzj_b = new JButton("\u91cd\u626b\u538b\u94f8\u4ef6-B");
|
|
|
|
|
+ rescan_yzj_b.setFont(new Font("Microsoft YaHei UI", Font.PLAIN, 14));
|
|
|
|
|
+ rescan_yzj_b.setBounds(843, 208, 120, 40);
|
|
|
|
|
+ rescan_yzj_b.addActionListener(new ActionListener() {
|
|
|
|
|
+ public void actionPerformed(ActionEvent e) {
|
|
|
|
|
+ rescanYzj("B");
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ indexPanelA.add(rescan_yzj_b);
|
|
|
|
|
+
|
|
|
JSeparator separator = new JSeparator();
|
|
JSeparator separator = new JSeparator();
|
|
|
separator.setBounds(450, 247, 0, 120);
|
|
separator.setBounds(450, 247, 0, 120);
|
|
|
indexPanelA.add(separator);
|
|
indexPanelA.add(separator);
|
|
|
|
|
|
|
|
JSeparator separator_1 = new JSeparator();
|
|
JSeparator separator_1 = new JSeparator();
|
|
|
separator_1.setOrientation(SwingConstants.VERTICAL);
|
|
separator_1.setOrientation(SwingConstants.VERTICAL);
|
|
|
- separator_1.setBounds(495, 91, 23, 250);
|
|
|
|
|
|
|
+ separator_1.setBounds(495, 100, 2, 150);
|
|
|
indexPanelA.add(separator_1);
|
|
indexPanelA.add(separator_1);
|
|
|
|
|
|
|
|
JLabel lblNewLabel_3 = new JLabel("电压");
|
|
JLabel lblNewLabel_3 = new JLabel("电压");
|
|
@@ -1097,15 +1182,15 @@ public class MesClient extends JFrame {
|
|
|
pxstatus1 = new JLabel("A");
|
|
pxstatus1 = new JLabel("A");
|
|
|
pxstatus1.setForeground(new Color(255, 128, 64));
|
|
pxstatus1.setForeground(new Color(255, 128, 64));
|
|
|
pxstatus1.setHorizontalAlignment(SwingConstants.CENTER);
|
|
pxstatus1.setHorizontalAlignment(SwingConstants.CENTER);
|
|
|
- pxstatus1.setFont(new Font("Microsoft YaHei UI", Font.PLAIN, 20));
|
|
|
|
|
- pxstatus1.setBounds(26, 98, 446, 44);
|
|
|
|
|
|
|
+ pxstatus1.setFont(new Font("Microsoft YaHei UI", Font.PLAIN, 18));
|
|
|
|
|
+ pxstatus1.setBounds(26, 100, 446, 36);
|
|
|
indexPanelA.add(pxstatus1);
|
|
indexPanelA.add(pxstatus1);
|
|
|
|
|
|
|
|
pxstatus2 = new JLabel("B");
|
|
pxstatus2 = new JLabel("B");
|
|
|
pxstatus2.setForeground(new Color(255, 128, 64));
|
|
pxstatus2.setForeground(new Color(255, 128, 64));
|
|
|
pxstatus2.setHorizontalAlignment(SwingConstants.CENTER);
|
|
pxstatus2.setHorizontalAlignment(SwingConstants.CENTER);
|
|
|
- pxstatus2.setFont(new Font("Microsoft YaHei UI", Font.PLAIN, 20));
|
|
|
|
|
- pxstatus2.setBounds(517, 98, 446, 44);
|
|
|
|
|
|
|
+ pxstatus2.setFont(new Font("Microsoft YaHei UI", Font.PLAIN, 18));
|
|
|
|
|
+ pxstatus2.setBounds(517, 100, 446, 36);
|
|
|
indexPanelA.add(pxstatus2);
|
|
indexPanelA.add(pxstatus2);
|
|
|
|
|
|
|
|
JSeparator separator_2 = new JSeparator();
|
|
JSeparator separator_2 = new JSeparator();
|
|
@@ -1236,9 +1321,9 @@ public class MesClient extends JFrame {
|
|
|
|
|
|
|
|
txtfa = new JTextField();
|
|
txtfa = new JTextField();
|
|
|
txtfa.setHorizontalAlignment(SwingConstants.LEFT);
|
|
txtfa.setHorizontalAlignment(SwingConstants.LEFT);
|
|
|
- txtfa.setFont(new Font("Microsoft YaHei UI", Font.PLAIN, 22));
|
|
|
|
|
|
|
+ txtfa.setFont(new Font("Microsoft YaHei UI", Font.PLAIN, 20));
|
|
|
txtfa.setColumns(10);
|
|
txtfa.setColumns(10);
|
|
|
- txtfa.setBounds(239, 10, 503, 60);
|
|
|
|
|
|
|
+ txtfa.setBounds(239, 6, 503, 42);
|
|
|
indexPanelA.add(txtfa);
|
|
indexPanelA.add(txtfa);
|
|
|
txtfa.addActionListener(new ActionListener() {
|
|
txtfa.addActionListener(new ActionListener() {
|
|
|
public void actionPerformed(ActionEvent e) {
|
|
public void actionPerformed(ActionEvent e) {
|
|
@@ -1246,18 +1331,38 @@ public class MesClient extends JFrame {
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
|
|
+ yzj_scan_label = new JLabel("\u538b\u94f8\u4ef6\u4e8c\u7ef4\u7801");
|
|
|
|
|
+ yzj_scan_label.setForeground(new Color(0, 128, 192));
|
|
|
|
|
+ yzj_scan_label.setHorizontalAlignment(SwingConstants.RIGHT);
|
|
|
|
|
+ yzj_scan_label.setFont(new Font("微软雅黑", Font.PLAIN, 16));
|
|
|
|
|
+ yzj_scan_label.setBounds(97, 52, 132, 36);
|
|
|
|
|
+ indexPanelA.add(yzj_scan_label);
|
|
|
|
|
+
|
|
|
|
|
+ txtyzj = new JTextField();
|
|
|
|
|
+ txtyzj.setHorizontalAlignment(SwingConstants.LEFT);
|
|
|
|
|
+ txtyzj.setFont(new Font("Microsoft YaHei UI", Font.PLAIN, 18));
|
|
|
|
|
+ txtyzj.setColumns(10);
|
|
|
|
|
+ txtyzj.setBounds(239, 52, 503, 36);
|
|
|
|
|
+ txtyzj.setEnabled(false);
|
|
|
|
|
+ indexPanelA.add(txtyzj);
|
|
|
|
|
+ txtyzj.addActionListener(new ActionListener() {
|
|
|
|
|
+ public void actionPerformed(ActionEvent e) {
|
|
|
|
|
+ scanYzjBarcode();
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
page_text = new JLabel("当前:A面");
|
|
page_text = new JLabel("当前:A面");
|
|
|
page_text.setForeground(new Color(0, 255, 64));
|
|
page_text.setForeground(new Color(0, 255, 64));
|
|
|
- page_text.setFont(new Font("微软雅黑", Font.PLAIN, 20));
|
|
|
|
|
|
|
+ page_text.setFont(new Font("微软雅黑", Font.PLAIN, 18));
|
|
|
page_text.setHorizontalAlignment(SwingConstants.RIGHT);
|
|
page_text.setHorizontalAlignment(SwingConstants.RIGHT);
|
|
|
- page_text.setBounds(97, 10, 132, 60);
|
|
|
|
|
|
|
+ page_text.setBounds(97, 6, 132, 42);
|
|
|
indexPanelA.add(page_text);
|
|
indexPanelA.add(page_text);
|
|
|
|
|
|
|
|
scan_type_text = new JLabel("镭雕码");
|
|
scan_type_text = new JLabel("镭雕码");
|
|
|
scan_type_text.setForeground(new Color(255, 128, 64));
|
|
scan_type_text.setForeground(new Color(255, 128, 64));
|
|
|
scan_type_text.setHorizontalAlignment(SwingConstants.LEFT);
|
|
scan_type_text.setHorizontalAlignment(SwingConstants.LEFT);
|
|
|
- scan_type_text.setFont(new Font("微软雅黑", Font.PLAIN, 20));
|
|
|
|
|
- scan_type_text.setBounds(752, 10, 132, 60);
|
|
|
|
|
|
|
+ scan_type_text.setFont(new Font("微软雅黑", Font.PLAIN, 18));
|
|
|
|
|
+ scan_type_text.setBounds(752, 6, 132, 42);
|
|
|
indexPanelA.add(scan_type_text);
|
|
indexPanelA.add(scan_type_text);
|
|
|
|
|
|
|
|
tabbedPane.addTab("工作面板", new ImageIcon(MesClient.class.getResource("/bg/a_side.png")), indexScrollPaneA, null);
|
|
tabbedPane.addTab("工作面板", new ImageIcon(MesClient.class.getResource("/bg/a_side.png")), indexScrollPaneA, null);
|
|
@@ -1304,12 +1409,203 @@ public class MesClient extends JFrame {
|
|
|
if(scan_type == 1){
|
|
if(scan_type == 1){
|
|
|
scan_type_text.setText("镭雕码");
|
|
scan_type_text.setText("镭雕码");
|
|
|
}else if(scan_type == 2){
|
|
}else if(scan_type == 2){
|
|
|
- scan_type_text.setText("后梁码");
|
|
|
|
|
|
|
+ scan_type_text.setText("\u538b\u94f8\u4ef6\u4e8c\u7ef4\u7801");
|
|
|
}else{
|
|
}else{
|
|
|
scan_type_text.setText("");
|
|
scan_type_text.setText("");
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ /** 质量通过后允许扫压铸件二维码 */
|
|
|
|
|
+ public static void enableYzjScan(){
|
|
|
|
|
+ SwingUtilities.invokeLater(new Runnable() {
|
|
|
|
|
+ public void run() {
|
|
|
|
|
+ formatScanType(2);
|
|
|
|
|
+ refreshScanInputState();
|
|
|
|
|
+ if(txtyzj != null && txtyzj.isEnabled()){
|
|
|
|
|
+ txtyzj.requestFocusInWindow();
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /** 根据当前面状态切换镭雕码/压铸件输入框可用状态 */
|
|
|
|
|
+ public static void refreshScanInputState(){
|
|
|
|
|
+ if(txtfa == null || txtyzj == null){
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ boolean needYzj = false;
|
|
|
|
|
+ if("A".equals(curPage)){
|
|
|
|
|
+ needYzj = mesQualityFlagA && batch_status == 0 && product_sn != null
|
|
|
|
|
+ && !product_sn.getText().trim().isEmpty();
|
|
|
|
|
+ }else if("B".equals(curPage)){
|
|
|
|
|
+ needYzj = mesQualityFlagB && batch_status2 == 0 && product_sn2 != null
|
|
|
|
|
+ && !product_sn2.getText().trim().isEmpty();
|
|
|
|
|
+ }
|
|
|
|
|
+ if(needYzj){
|
|
|
|
|
+ formatScanType(2);
|
|
|
|
|
+ txtfa.setEnabled(false);
|
|
|
|
|
+ txtyzj.setEnabled(true);
|
|
|
|
|
+ }else{
|
|
|
|
|
+ formatScanType(1);
|
|
|
|
|
+ txtfa.setEnabled(true);
|
|
|
|
|
+ txtyzj.setEnabled(false);
|
|
|
|
|
+ txtyzj.setText("");
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ public static boolean checkYzjVersionLocal(String yzjSn, String sn){
|
|
|
|
|
+ if(yzjSn == null || sn == null){
|
|
|
|
|
+ return false;
|
|
|
|
|
+ }
|
|
|
|
|
+ if(sn.length() != 28 || yzjSn.length() != 28){
|
|
|
|
|
+ return false;
|
|
|
|
|
+ }
|
|
|
|
|
+ boolean snOverseas = false;
|
|
|
|
|
+ for(String p : YZJ_SN_OVERSEAS_PREFIXES){
|
|
|
|
|
+ if(sn.startsWith(p)){
|
|
|
|
|
+ snOverseas = true;
|
|
|
|
|
+ break;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ boolean snDomestic = false;
|
|
|
|
|
+ for(String p : YZJ_SN_DOMESTIC_PREFIXES){
|
|
|
|
|
+ if(sn.startsWith(p)){
|
|
|
|
|
+ snDomestic = true;
|
|
|
|
|
+ break;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ if(!snOverseas && !snDomestic){
|
|
|
|
|
+ return false;
|
|
|
|
|
+ }
|
|
|
|
|
+ if(snOverseas){
|
|
|
|
|
+ return yzjSn.startsWith(YZJ_WSN_OVERSEAS_PREFIX);
|
|
|
|
|
+ }
|
|
|
|
|
+ return yzjSn.startsWith(YZJ_WSN_DOMESTIC_PREFIX);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /** 重扫压铸件:仅刷新本地状态,重新扫码后绑定会覆盖MES数据 */
|
|
|
|
|
+ public static void rescanYzj(String side){
|
|
|
|
|
+ if("A".equals(side)){
|
|
|
|
|
+ if(MesClient.tjFlaga >= 2){
|
|
|
|
|
+ setMenuStatus("A面设备运行中或已结束,无法重扫压铸件",1);
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ product_yzj.setText("");
|
|
|
|
|
+ batch_status = 0;
|
|
|
|
|
+ tjFlaga = 0;
|
|
|
|
|
+ if(mesQualityFlagA){
|
|
|
|
|
+ pxstatus1.setText("A:质量OK,请扫压铸件二维码");
|
|
|
|
|
+ setMenuStatus("A面请重新扫压铸件二维码",0);
|
|
|
|
|
+ }else{
|
|
|
|
|
+ pxstatus1.setText("A");
|
|
|
|
|
+ setMenuStatus("A面已刷新",0);
|
|
|
|
|
+ }
|
|
|
|
|
+ }else if("B".equals(side)){
|
|
|
|
|
+ if(MesClient.tjFlagb >= 2){
|
|
|
|
|
+ setMenuStatus("B面设备运行中或已结束,无法重扫压铸件",1);
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ product_yzj2.setText("");
|
|
|
|
|
+ batch_status2 = 0;
|
|
|
|
|
+ tjFlagb = 0;
|
|
|
|
|
+ if(mesQualityFlagB){
|
|
|
|
|
+ pxstatus2.setText("B:质量OK,请扫压铸件二维码");
|
|
|
|
|
+ setMenuStatus("B面请重新扫压铸件二维码",0);
|
|
|
|
|
+ }else{
|
|
|
|
|
+ pxstatus2.setText("B");
|
|
|
|
|
+ setMenuStatus("B面已刷新",0);
|
|
|
|
|
+ }
|
|
|
|
|
+ }else{
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ formatBatchSn();
|
|
|
|
|
+ refreshScanInputState();
|
|
|
|
|
+ if(side.equals(curPage) && txtyzj != null && txtyzj.isEnabled()){
|
|
|
|
|
+ txtyzj.requestFocusInWindow();
|
|
|
|
|
+ }
|
|
|
|
|
+ mesClientFrame.repaint();
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /** 扫压铸件二维码并绑定到工艺号400002 */
|
|
|
|
|
+ public static void scanYzjBarcode(){
|
|
|
|
|
+ if(txtyzj == null || !txtyzj.isEnabled()){
|
|
|
|
|
+ setMenuStatus("请先扫镭雕码并通过质量校验",1);
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ String yzjSn = txtyzj.getText().trim();
|
|
|
|
|
+ txtyzj.setText("");
|
|
|
|
|
+ if(yzjSn.isEmpty()){
|
|
|
|
|
+ setMenuStatus("\u538b\u94f8\u4ef6\u4e8c\u7ef4\u7801\u4e0d\u80fd\u4e3a\u7a7a",1);
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ if(yzjSn.length() != 28){
|
|
|
|
|
+ setMenuStatus("\u538b\u94f8\u4ef6\u4e8c\u7ef4\u7801\u987b\u4e3a28\u4f4d",1);
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ String sn;
|
|
|
|
|
+ if("A".equals(curPage)){
|
|
|
|
|
+ if(!mesQualityFlagA || product_sn.getText().trim().isEmpty()){
|
|
|
|
|
+ setMenuStatus("请先扫A面镭雕码",1);
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ if(batch_status == 1){
|
|
|
|
|
+ setMenuStatus("A面压铸件已绑定,勿重复扫码",1);
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ sn = product_sn.getText().trim();
|
|
|
|
|
+ }else{
|
|
|
|
|
+ if(!mesQualityFlagB || product_sn2.getText().trim().isEmpty()){
|
|
|
|
|
+ setMenuStatus("请先扫B面镭雕码",1);
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ if(batch_status2 == 1){
|
|
|
|
|
+ setMenuStatus("B面压铸件已绑定,勿重复扫码",1);
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ sn = product_sn2.getText().trim();
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ if(sn.length() != 28){
|
|
|
|
|
+ setMenuStatus("镭雕码须为28位",1);
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ if(!checkYzjVersionLocal(yzjSn, sn)){
|
|
|
|
|
+ setMenuStatus("压铸件二维码与镭雕码版本不匹配(国内/海外)",1);
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ getUser();
|
|
|
|
|
+ JSONObject retObj = DataUtil.bindYzjHttp(sn, yzjSn, user20, YZJ_CRAFT);
|
|
|
|
|
+ if(retObj == null){
|
|
|
|
|
+ setMenuStatus("请求失败,压铸件绑定失败,请重试",-1);
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ if(retObj.get("result") != null && retObj.get("result").toString().equalsIgnoreCase("true")){
|
|
|
|
|
+ if("A".equals(curPage)){
|
|
|
|
|
+ product_yzj.setText(yzjSn);
|
|
|
|
|
+ batch_status = 1;
|
|
|
|
|
+ tjFlaga = 1;
|
|
|
|
|
+ pxstatus1.setText("A:可以加工,等待设备启动");
|
|
|
|
|
+ }else{
|
|
|
|
|
+ product_yzj2.setText(yzjSn);
|
|
|
|
|
+ batch_status2 = 1;
|
|
|
|
|
+ tjFlagb = 1;
|
|
|
|
|
+ pxstatus2.setText("B:可以加工,等待设备启动");
|
|
|
|
|
+ }
|
|
|
|
|
+ setMenuStatus("压铸件绑定成功,可启动设备",0);
|
|
|
|
|
+ refreshScanInputState();
|
|
|
|
|
+ formatBatchSn();
|
|
|
|
|
+ mesClientFrame.repaint();
|
|
|
|
|
+ }else{
|
|
|
|
|
+ if(retObj.get("result") == null){
|
|
|
|
|
+ setMenuStatus("请求失败,请重试",-1);
|
|
|
|
|
+ }else{
|
|
|
|
|
+ setMenuStatus(retObj.getString("message"),-1);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
public static void scanBarcode() {
|
|
public static void scanBarcode() {
|
|
|
String scanBarcodeSn = txtfa.getText().trim();
|
|
String scanBarcodeSn = txtfa.getText().trim();
|
|
|
txtfa.setText("");
|
|
txtfa.setText("");
|