|
|
@@ -153,6 +153,8 @@ public class MesClient extends JFrame {
|
|
|
try{
|
|
|
//鐠囩粯鏋冩禒鍫曞帳缂冿拷
|
|
|
readProperty();
|
|
|
+ s7PLC.setConnectTimeout(1000);
|
|
|
+ s7PLC.setReceiveTimeout(1000);
|
|
|
|
|
|
// 閺勫墽銇氶悾宀勬桨
|
|
|
mesClientFrame = new MesClient();
|
|
|
@@ -189,13 +191,24 @@ public class MesClient extends JFrame {
|
|
|
cjTimerText = new Timer();
|
|
|
cjTimerText.schedule(new TimerTask() {
|
|
|
public void run() {
|
|
|
- txtfa.requestFocusInWindow();
|
|
|
+ try{
|
|
|
+ if(txtfa != null && mesClientFrame != null && mesClientFrame.isDisplayable()){
|
|
|
+ txtfa.requestFocusInWindow();
|
|
|
+ }
|
|
|
|
|
|
- MesClient.curPage = PlcUtil.getCurAside(s7PLC);
|
|
|
- if(MesClient.curPage .equals("A")){
|
|
|
- page_text.setText("当前:A面");
|
|
|
- }else{
|
|
|
- page_text.setText("当前:B面");
|
|
|
+ MesClient.curPage = PlcUtil.getCurAside(s7PLC);
|
|
|
+ final String pageLabel = MesClient.curPage.equals("A") ? "当前:A面" : "当前:B面";
|
|
|
+ final String modelText = PlcUtil.getModelTypeText(s7PLC);
|
|
|
+ SwingUtilities.invokeLater(new Runnable() {
|
|
|
+ public void run() {
|
|
|
+ if(page_text != null){
|
|
|
+ page_text.setText(pageLabel);
|
|
|
+ }
|
|
|
+ applyModelTypeText(modelText);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }catch (Exception e){
|
|
|
+ e.printStackTrace();
|
|
|
}
|
|
|
}
|
|
|
}, 1000,1000);
|
|
|
@@ -287,11 +300,10 @@ 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_gwflag = pro.getProperty("mes.gwflag");
|
|
|
|
|
|
mes_gw_des = OprnoUtil.getGwDes(mes_line_sn,mes_gw);
|
|
|
|
|
|
- mes_gwflag = pro.getProperty("mes.gwflag");
|
|
|
-
|
|
|
System.out.println(mes_gw + ";" + mes_gw_des + ";" + mes_server_ip + ";" + mes_tcp_port + ";" + mes_heart_beat_cycle);
|
|
|
}
|
|
|
|
|
|
@@ -448,6 +460,7 @@ public class MesClient extends JFrame {
|
|
|
public static JTextField textField;
|
|
|
public static JTextField textField_1;
|
|
|
public static JTextField txtfa;
|
|
|
+ public static JLabel model_type_text;
|
|
|
public static JLabel scan_type_text;
|
|
|
public static JLabel page_text;
|
|
|
//换班用户信息检查
|
|
|
@@ -910,14 +923,14 @@ public class MesClient extends JFrame {
|
|
|
lblNewLabel.setHorizontalAlignment(SwingConstants.RIGHT);
|
|
|
lblNewLabel.setFont(new Font("Microsoft YaHei UI", Font.PLAIN, 18));
|
|
|
lblNewLabel.setBounds(26, 340, 100, 40);
|
|
|
- lblNewLabel.setVisible(false);
|
|
|
+ lblNewLabel.setVisible(true);
|
|
|
indexPanelA.add(lblNewLabel);
|
|
|
|
|
|
JLabel lblNewLabel_1 = new JLabel("电流");
|
|
|
lblNewLabel_1.setHorizontalAlignment(SwingConstants.RIGHT);
|
|
|
lblNewLabel_1.setFont(new Font("Microsoft YaHei UI", Font.PLAIN, 18));
|
|
|
lblNewLabel_1.setBounds(226, 340, 100, 40);
|
|
|
- lblNewLabel_1.setVisible(false);
|
|
|
+ lblNewLabel_1.setVisible(true);
|
|
|
indexPanelA.add(lblNewLabel_1);
|
|
|
|
|
|
param1 = new JTextField();
|
|
|
@@ -926,7 +939,7 @@ public class MesClient extends JFrame {
|
|
|
param1.setHorizontalAlignment(SwingConstants.CENTER);
|
|
|
param1.setFont(new Font("Microsoft YaHei UI", Font.PLAIN, 18));
|
|
|
param1.setBounds(136, 340, 70, 40);
|
|
|
- param1.setVisible(false);
|
|
|
+ param1.setVisible(true);
|
|
|
indexPanelA.add(param1);
|
|
|
param1.setColumns(10);
|
|
|
|
|
|
@@ -937,14 +950,14 @@ public class MesClient extends JFrame {
|
|
|
param2.setFont(new Font("Microsoft YaHei UI", Font.PLAIN, 18));
|
|
|
param2.setColumns(10);
|
|
|
param2.setBounds(345, 340, 70, 40);
|
|
|
- param2.setVisible(false);
|
|
|
+ param2.setVisible(true);
|
|
|
indexPanelA.add(param2);
|
|
|
|
|
|
JLabel lblNewLabel_2 = new JLabel("送丝速度");
|
|
|
lblNewLabel_2.setHorizontalAlignment(SwingConstants.RIGHT);
|
|
|
lblNewLabel_2.setFont(new Font("Microsoft YaHei UI", Font.PLAIN, 18));
|
|
|
lblNewLabel_2.setBounds(26, 401, 100, 40);
|
|
|
- lblNewLabel_2.setVisible(false);
|
|
|
+ lblNewLabel_2.setVisible(true);
|
|
|
indexPanelA.add(lblNewLabel_2);
|
|
|
|
|
|
param3 = new JTextField();
|
|
|
@@ -954,14 +967,14 @@ public class MesClient extends JFrame {
|
|
|
param3.setFont(new Font("Microsoft YaHei UI", Font.PLAIN, 18));
|
|
|
param3.setColumns(10);
|
|
|
param3.setBounds(136, 401, 70, 40);
|
|
|
- param3.setVisible(false);
|
|
|
+ param3.setVisible(true);
|
|
|
indexPanelA.add(param3);
|
|
|
|
|
|
JLabel lblNewLabel_1_1 = new JLabel("错误代码");
|
|
|
lblNewLabel_1_1.setHorizontalAlignment(SwingConstants.RIGHT);
|
|
|
lblNewLabel_1_1.setFont(new Font("Microsoft YaHei UI", Font.PLAIN, 18));
|
|
|
lblNewLabel_1_1.setBounds(213, 401, 122, 40);
|
|
|
- lblNewLabel_1_1.setVisible(false);
|
|
|
+ lblNewLabel_1_1.setVisible(true);
|
|
|
indexPanelA.add(lblNewLabel_1_1);
|
|
|
|
|
|
param4 = new JTextField();
|
|
|
@@ -971,7 +984,7 @@ public class MesClient extends JFrame {
|
|
|
param4.setFont(new Font("Microsoft YaHei UI", Font.PLAIN, 18));
|
|
|
param4.setColumns(10);
|
|
|
param4.setBounds(345, 401, 70, 40);
|
|
|
- param4.setVisible(false);
|
|
|
+ param4.setVisible(true);
|
|
|
indexPanelA.add(param4);
|
|
|
|
|
|
param5 = new JTextField();
|
|
|
@@ -981,14 +994,14 @@ public class MesClient extends JFrame {
|
|
|
param5.setFont(new Font("Microsoft YaHei UI", Font.PLAIN, 18));
|
|
|
param5.setColumns(10);
|
|
|
param5.setBounds(226, 470, 70, 40);
|
|
|
- param5.setVisible(false);
|
|
|
+ param5.setVisible(true);
|
|
|
indexPanelA.add(param5);
|
|
|
|
|
|
JLabel lblNewLabel_1_1_1 = new JLabel("JOB号");
|
|
|
lblNewLabel_1_1_1.setHorizontalAlignment(SwingConstants.RIGHT);
|
|
|
lblNewLabel_1_1_1.setFont(new Font("Microsoft YaHei UI", Font.PLAIN, 18));
|
|
|
lblNewLabel_1_1_1.setBounds(106, 470, 122, 40);
|
|
|
- lblNewLabel_1_1_1.setVisible(false);
|
|
|
+ lblNewLabel_1_1_1.setVisible(true);
|
|
|
indexPanelA.add(lblNewLabel_1_1_1);
|
|
|
|
|
|
product_sn2 = new JTextField();
|
|
|
@@ -1013,7 +1026,7 @@ public class MesClient extends JFrame {
|
|
|
lblNewLabel_3.setHorizontalAlignment(SwingConstants.RIGHT);
|
|
|
lblNewLabel_3.setFont(new Font("Microsoft YaHei UI", Font.PLAIN, 18));
|
|
|
lblNewLabel_3.setBounds(528, 340, 100, 40);
|
|
|
- lblNewLabel_3.setVisible(false);
|
|
|
+ lblNewLabel_3.setVisible(true);
|
|
|
indexPanelA.add(lblNewLabel_3);
|
|
|
|
|
|
param21 = new JTextField();
|
|
|
@@ -1023,14 +1036,14 @@ public class MesClient extends JFrame {
|
|
|
param21.setFont(new Font("Microsoft YaHei UI", Font.PLAIN, 18));
|
|
|
param21.setColumns(10);
|
|
|
param21.setBounds(638, 340, 70, 40);
|
|
|
- param21.setVisible(false);
|
|
|
+ param21.setVisible(true);
|
|
|
indexPanelA.add(param21);
|
|
|
|
|
|
JLabel lblNewLabel_1_2 = new JLabel("电流");
|
|
|
lblNewLabel_1_2.setHorizontalAlignment(SwingConstants.RIGHT);
|
|
|
lblNewLabel_1_2.setFont(new Font("Microsoft YaHei UI", Font.PLAIN, 18));
|
|
|
lblNewLabel_1_2.setBounds(742, 340, 100, 40);
|
|
|
- lblNewLabel_1_2.setVisible(false);
|
|
|
+ lblNewLabel_1_2.setVisible(true);
|
|
|
indexPanelA.add(lblNewLabel_1_2);
|
|
|
|
|
|
param22 = new JTextField();
|
|
|
@@ -1040,14 +1053,14 @@ public class MesClient extends JFrame {
|
|
|
param22.setFont(new Font("Microsoft YaHei UI", Font.PLAIN, 18));
|
|
|
param22.setColumns(10);
|
|
|
param22.setBounds(852, 340, 70, 40);
|
|
|
- param22.setVisible(false);
|
|
|
+ param22.setVisible(true);
|
|
|
indexPanelA.add(param22);
|
|
|
|
|
|
JLabel lblNewLabel_2_1 = new JLabel("送丝速度");
|
|
|
lblNewLabel_2_1.setHorizontalAlignment(SwingConstants.RIGHT);
|
|
|
lblNewLabel_2_1.setFont(new Font("Microsoft YaHei UI", Font.PLAIN, 18));
|
|
|
lblNewLabel_2_1.setBounds(528, 401, 100, 40);
|
|
|
- lblNewLabel_2_1.setVisible(false);
|
|
|
+ lblNewLabel_2_1.setVisible(true);
|
|
|
indexPanelA.add(lblNewLabel_2_1);
|
|
|
|
|
|
param23 = new JTextField();
|
|
|
@@ -1057,14 +1070,14 @@ public class MesClient extends JFrame {
|
|
|
param23.setFont(new Font("Microsoft YaHei UI", Font.PLAIN, 18));
|
|
|
param23.setColumns(10);
|
|
|
param23.setBounds(638, 401, 70, 40);
|
|
|
- param23.setVisible(false);
|
|
|
+ param23.setVisible(true);
|
|
|
indexPanelA.add(param23);
|
|
|
|
|
|
JLabel lblNewLabel_1_1_2 = new JLabel("错误代码");
|
|
|
lblNewLabel_1_1_2.setHorizontalAlignment(SwingConstants.RIGHT);
|
|
|
lblNewLabel_1_1_2.setFont(new Font("Microsoft YaHei UI", Font.PLAIN, 18));
|
|
|
lblNewLabel_1_1_2.setBounds(718, 401, 122, 40);
|
|
|
- lblNewLabel_1_1_2.setVisible(false);
|
|
|
+ lblNewLabel_1_1_2.setVisible(true);
|
|
|
indexPanelA.add(lblNewLabel_1_1_2);
|
|
|
|
|
|
param24 = new JTextField();
|
|
|
@@ -1074,15 +1087,14 @@ public class MesClient extends JFrame {
|
|
|
param24.setFont(new Font("Microsoft YaHei UI", Font.PLAIN, 18));
|
|
|
param24.setColumns(10);
|
|
|
param24.setBounds(852, 401, 70, 40);
|
|
|
- param24.setVisible(false);
|
|
|
+ param24.setVisible(true);
|
|
|
indexPanelA.add(param24);
|
|
|
|
|
|
JLabel lblNewLabel_1_1_1_1 = new JLabel("JOB号");
|
|
|
lblNewLabel_1_1_1_1.setHorizontalAlignment(SwingConstants.RIGHT);
|
|
|
lblNewLabel_1_1_1_1.setFont(new Font("Microsoft YaHei UI", Font.PLAIN, 18));
|
|
|
lblNewLabel_1_1_1_1.setBounds(609, 470, 122, 40);
|
|
|
- lblNewLabel_1_1_1_1.setVisible(false);
|
|
|
- lblNewLabel_1_1_1_1.setVisible(false);
|
|
|
+ lblNewLabel_1_1_1_1.setVisible(true);
|
|
|
indexPanelA.add(lblNewLabel_1_1_1_1);
|
|
|
|
|
|
param25 = new JTextField();
|
|
|
@@ -1092,7 +1104,7 @@ public class MesClient extends JFrame {
|
|
|
param25.setFont(new Font("Microsoft YaHei UI", Font.PLAIN, 18));
|
|
|
param25.setColumns(10);
|
|
|
param25.setBounds(742, 470, 70, 40);
|
|
|
- param25.setVisible(false);
|
|
|
+ param25.setVisible(true);
|
|
|
indexPanelA.add(param25);
|
|
|
|
|
|
pxstatus1 = new JLabel("A");
|
|
|
@@ -1117,15 +1129,15 @@ public class MesClient extends JFrame {
|
|
|
lblNewLabel_4.setHorizontalAlignment(SwingConstants.CENTER);
|
|
|
lblNewLabel_4.setFont(new Font("微软雅黑", Font.PLAIN, 24));
|
|
|
lblNewLabel_4.setBounds(170, 290, 156, 40);
|
|
|
- lblNewLabel_4.setVisible(false);
|
|
|
-// indexPanelA.add(lblNewLabel_4);
|
|
|
+ lblNewLabel_4.setVisible(true);
|
|
|
+ indexPanelA.add(lblNewLabel_4);
|
|
|
|
|
|
JLabel lblNewLabel_4_1 = new JLabel("\u710A\u673A2");
|
|
|
lblNewLabel_4_1.setHorizontalAlignment(SwingConstants.CENTER);
|
|
|
lblNewLabel_4_1.setFont(new Font("微软雅黑", Font.PLAIN, 24));
|
|
|
lblNewLabel_4_1.setBounds(670, 287, 156, 40);
|
|
|
- lblNewLabel_4_1.setVisible(false);
|
|
|
-// indexPanelA.add(lblNewLabel_4_1);
|
|
|
+ lblNewLabel_4_1.setVisible(true);
|
|
|
+ indexPanelA.add(lblNewLabel_4_1);
|
|
|
|
|
|
JSeparator separator_1_1 = new JSeparator();
|
|
|
separator_1_1.setOrientation(SwingConstants.VERTICAL);
|
|
|
@@ -1258,9 +1270,16 @@ public class MesClient extends JFrame {
|
|
|
scan_type_text.setForeground(new Color(255, 128, 64));
|
|
|
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.setBounds(900, 10, 90, 60);
|
|
|
indexPanelA.add(scan_type_text);
|
|
|
|
|
|
+ model_type_text = new JLabel("");
|
|
|
+ model_type_text.setForeground(new Color(0, 128, 255));
|
|
|
+ model_type_text.setHorizontalAlignment(SwingConstants.LEFT);
|
|
|
+ model_type_text.setFont(new Font("微软雅黑", Font.BOLD, 20));
|
|
|
+ model_type_text.setBounds(752, 10, 140, 60);
|
|
|
+ indexPanelA.add(model_type_text);
|
|
|
+
|
|
|
tabbedPane.addTab("工作面板", new ImageIcon(MesClient.class.getResource("/bg/a_side.png")), indexScrollPaneA, null);
|
|
|
tabbedPane.setEnabledAt(0, true);
|
|
|
|
|
|
@@ -1271,11 +1290,11 @@ public class MesClient extends JFrame {
|
|
|
indexPanelGz.setLayout(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);
|
|
|
+// 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();
|
|
|
@@ -1311,6 +1330,36 @@ public class MesClient extends JFrame {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ public static void updateModelTypeText(){
|
|
|
+ if(model_type_text == null){
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ try{
|
|
|
+ final String modelText = PlcUtil.getModelTypeText(s7PLC);
|
|
|
+ SwingUtilities.invokeLater(new Runnable() {
|
|
|
+ public void run() {
|
|
|
+ applyModelTypeText(modelText);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }catch (Exception e){
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ private static void applyModelTypeText(String modelText){
|
|
|
+ if(model_type_text == null){
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ model_type_text.setText(modelText);
|
|
|
+ if("47车型".equals(modelText)){
|
|
|
+ model_type_text.setForeground(new Color(0, 128, 255));
|
|
|
+ }else if("27车型".equals(modelText)){
|
|
|
+ model_type_text.setForeground(new Color(255, 128, 0));
|
|
|
+ }else{
|
|
|
+ model_type_text.setForeground(Color.GRAY);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
public static void scanBarcode() {
|
|
|
String scanBarcodeSn = txtfa.getText().trim();
|
|
|
txtfa.setText("");
|