|
|
@@ -85,11 +85,15 @@ public class MesClient extends JFrame {
|
|
|
public static JTextField param2;
|
|
|
public static JTextField param3;
|
|
|
public static JTextField param4;
|
|
|
+ public static JTextField param5;
|
|
|
+ public static JTextField param6;
|
|
|
|
|
|
public static ModbusTcp plcA = new ModbusTcp(1, "192.168.1.7");
|
|
|
public static ModbusTcp plcB = new ModbusTcp(1, "192.168.1.8");
|
|
|
+ public static ModbusTcp plcC = new ModbusTcp(1, "192.168.1.9");
|
|
|
// public static ModbusTcp plcA = new ModbusTcp(1, "192.168.1.27");
|
|
|
// public static ModbusTcp plcB = new ModbusTcp(1, "192.168.1.28");
|
|
|
+// public static ModbusTcp plcC = new ModbusTcp(1, "192.168.1.29");
|
|
|
|
|
|
public static Timer cjTimer;
|
|
|
|
|
|
@@ -97,17 +101,21 @@ public class MesClient extends JFrame {
|
|
|
|
|
|
public static Timer cjTimer3;
|
|
|
|
|
|
- public static Short aSetNum = 40;
|
|
|
+ public static Short aSetNum = 81;
|
|
|
// public static Short aSetNum = 49;
|
|
|
public static Short sortA = 0;
|
|
|
public static Short aMax = 0;
|
|
|
public static Short aFinish = 0;
|
|
|
public static List<Map> alist = new ArrayList<>();
|
|
|
- public static Short bSetNum = 22;
|
|
|
+ public static Short bSetNum = 1;
|
|
|
// public static Short bSetNum = 27;
|
|
|
public static Short sortB = 0;
|
|
|
public static Short bMax = 0;
|
|
|
public static List<Map> blist = new ArrayList<>();
|
|
|
+ public static Short cSetNum = 1;
|
|
|
+ public static Short sortC = 0;
|
|
|
+ public static Short cMax = 0;
|
|
|
+ public static List<Map> clist = new ArrayList<>();
|
|
|
public static Short deviceControl = 0; // 0=本地 1=远程
|
|
|
public static Integer tjStatus = 0; // 1=提交失败
|
|
|
|
|
|
@@ -178,6 +186,15 @@ public class MesClient extends JFrame {
|
|
|
ModbusUtil.setPowerOn(plcB);
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ List<Boolean> yxstatusc = plcC.readCoil(3128,1);
|
|
|
+ if(yxstatusc.size() >= 1 && !yxstatusc.get(0)){
|
|
|
+ if(!MesClient.curSn.isEmpty() && MesClient.cMax > 0 && MesClient.cMax == MesClient.sortC){
|
|
|
+ ModbusUtil.setPowerOff(plcC);
|
|
|
+ }else{
|
|
|
+ ModbusUtil.setPowerOn(plcC);
|
|
|
+ }
|
|
|
+ }
|
|
|
}else{
|
|
|
List<Boolean> yxstatus = plcA.readCoil(3128,1);
|
|
|
if(yxstatus.size() >= 1 && yxstatus.get(0)){
|
|
|
@@ -188,6 +205,11 @@ public class MesClient extends JFrame {
|
|
|
if(yxstatusb.size() >= 1 && yxstatusb.get(0)){
|
|
|
ModbusUtil.setPowerOff(plcB);
|
|
|
}
|
|
|
+
|
|
|
+ List<Boolean> yxstatusc = plcC.readCoil(3128,1);
|
|
|
+ if(yxstatusc.size() >= 1 && yxstatusc.get(0)){
|
|
|
+ ModbusUtil.setPowerOff(plcC);
|
|
|
+ }
|
|
|
}
|
|
|
}catch (Exception e){
|
|
|
e.printStackTrace();
|
|
|
@@ -240,6 +262,15 @@ public class MesClient extends JFrame {
|
|
|
}catch (Exception e){
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
+
|
|
|
+ try{
|
|
|
+ if(work_status == 1){
|
|
|
+ ModbusUtil.getDataC(plcC);
|
|
|
+ }
|
|
|
+
|
|
|
+ }catch (Exception e){
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
}
|
|
|
}, 1000,500);
|
|
|
}
|
|
|
@@ -411,15 +442,20 @@ public class MesClient extends JFrame {
|
|
|
|
|
|
MesClient.aMax = 0;
|
|
|
MesClient.bMax = 0;
|
|
|
+ MesClient.cMax = 0;
|
|
|
MesClient.aFinish = 0;
|
|
|
MesClient.alist = new ArrayList<>();
|
|
|
MesClient.blist = new ArrayList<>();
|
|
|
+ MesClient.clist = new ArrayList<>();
|
|
|
MesClient.sortB = 0;
|
|
|
MesClient.sortA = 0;
|
|
|
+ MesClient.sortC = 0;
|
|
|
MesClient.param1.setText("");
|
|
|
MesClient.param2.setText("");
|
|
|
MesClient.param3.setText("");
|
|
|
MesClient.param4.setText("");
|
|
|
+ MesClient.param5.setText("");
|
|
|
+ MesClient.param6.setText("");
|
|
|
|
|
|
deviceControl = ModbusUtil.getControlModel(plcA);
|
|
|
if(deviceControl == 1){
|
|
|
@@ -428,11 +464,14 @@ public class MesClient extends JFrame {
|
|
|
|
|
|
// plcA.writeCoil(3128,false);
|
|
|
// plcB.writeCoil(3128,false);
|
|
|
+// plcC.writeCoil(3128,false);
|
|
|
ModbusUtil.setPowerOff(MesClient.plcA); // 远程关机
|
|
|
ModbusUtil.setPowerOff(MesClient.plcB); // 远程关机
|
|
|
+ ModbusUtil.setPowerOff(MesClient.plcC); // 远程关机
|
|
|
|
|
|
ModbusUtil.setTask(MesClient.plcA,MesClient.aSetNum);
|
|
|
ModbusUtil.setTask(MesClient.plcB,MesClient.bSetNum);
|
|
|
+ ModbusUtil.setTask(MesClient.plcC,MesClient.cSetNum);
|
|
|
|
|
|
updateMaterailData();
|
|
|
}
|
|
|
@@ -752,12 +791,12 @@ public class MesClient extends JFrame {
|
|
|
JLabel lblNewLabel = new JLabel("A\u67AA");
|
|
|
lblNewLabel.setHorizontalAlignment(SwingConstants.CENTER);
|
|
|
lblNewLabel.setFont(new Font("微软雅黑", Font.PLAIN, 20));
|
|
|
- lblNewLabel.setBounds(204, 186, 166, 28);
|
|
|
+ lblNewLabel.setBounds(100, 186, 166, 28);
|
|
|
indexPanelA.add(lblNewLabel);
|
|
|
|
|
|
JLabel lblNewLabel_1 = new JLabel("\u9884\u8BBE\u6570\u91CF");
|
|
|
lblNewLabel_1.setFont(new Font("微软雅黑", Font.PLAIN, 18));
|
|
|
- lblNewLabel_1.setBounds(204, 241, 83, 34);
|
|
|
+ lblNewLabel_1.setBounds(100, 241, 83, 34);
|
|
|
indexPanelA.add(lblNewLabel_1);
|
|
|
|
|
|
param1 = new JTextField();
|
|
|
@@ -765,13 +804,13 @@ public class MesClient extends JFrame {
|
|
|
param1.setFont(new Font("微软雅黑", Font.PLAIN, 18));
|
|
|
param1.setText("0");
|
|
|
param1.setEditable(false);
|
|
|
- param1.setBounds(288, 241, 83, 34);
|
|
|
+ param1.setBounds(184, 241, 83, 34);
|
|
|
indexPanelA.add(param1);
|
|
|
param1.setColumns(10);
|
|
|
|
|
|
JLabel lblNewLabel_1_1 = new JLabel("\u5B8C\u6210\u6570\u91CF");
|
|
|
lblNewLabel_1_1.setFont(new Font("微软雅黑", Font.PLAIN, 18));
|
|
|
- lblNewLabel_1_1.setBounds(204, 285, 83, 34);
|
|
|
+ lblNewLabel_1_1.setBounds(100, 285, 83, 34);
|
|
|
indexPanelA.add(lblNewLabel_1_1);
|
|
|
|
|
|
param2 = new JTextField();
|
|
|
@@ -780,18 +819,18 @@ public class MesClient extends JFrame {
|
|
|
param2.setText("0");
|
|
|
param2.setEditable(false);
|
|
|
param2.setColumns(10);
|
|
|
- param2.setBounds(288, 285, 83, 34);
|
|
|
+ param2.setBounds(184, 285, 83, 34);
|
|
|
indexPanelA.add(param2);
|
|
|
|
|
|
JLabel lblB = new JLabel("B\u67AA");
|
|
|
lblB.setHorizontalAlignment(SwingConstants.CENTER);
|
|
|
lblB.setFont(new Font("微软雅黑", Font.PLAIN, 20));
|
|
|
- lblB.setBounds(525, 186, 166, 28);
|
|
|
+ lblB.setBounds(380, 186, 166, 28);
|
|
|
indexPanelA.add(lblB);
|
|
|
|
|
|
JLabel lblNewLabel_1_2 = new JLabel("\u9884\u8BBE\u6570\u91CF");
|
|
|
lblNewLabel_1_2.setFont(new Font("微软雅黑", Font.PLAIN, 18));
|
|
|
- lblNewLabel_1_2.setBounds(525, 241, 83, 34);
|
|
|
+ lblNewLabel_1_2.setBounds(380, 241, 83, 34);
|
|
|
indexPanelA.add(lblNewLabel_1_2);
|
|
|
|
|
|
param3 = new JTextField();
|
|
|
@@ -800,12 +839,12 @@ public class MesClient extends JFrame {
|
|
|
param3.setFont(new Font("微软雅黑", Font.PLAIN, 18));
|
|
|
param3.setEditable(false);
|
|
|
param3.setColumns(10);
|
|
|
- param3.setBounds(608, 241, 83, 34);
|
|
|
+ param3.setBounds(463, 241, 83, 34);
|
|
|
indexPanelA.add(param3);
|
|
|
|
|
|
JLabel lblNewLabel_1_1_1 = new JLabel("\u5B8C\u6210\u6570\u91CF");
|
|
|
lblNewLabel_1_1_1.setFont(new Font("微软雅黑", Font.PLAIN, 18));
|
|
|
- lblNewLabel_1_1_1.setBounds(525, 285, 83, 34);
|
|
|
+ lblNewLabel_1_1_1.setBounds(380, 285, 83, 34);
|
|
|
indexPanelA.add(lblNewLabel_1_1_1);
|
|
|
|
|
|
param4 = new JTextField();
|
|
|
@@ -814,9 +853,43 @@ public class MesClient extends JFrame {
|
|
|
param4.setFont(new Font("微软雅黑", Font.PLAIN, 18));
|
|
|
param4.setEditable(false);
|
|
|
param4.setColumns(10);
|
|
|
- param4.setBounds(608, 285, 83, 34);
|
|
|
+ param4.setBounds(463, 285, 83, 34);
|
|
|
indexPanelA.add(param4);
|
|
|
|
|
|
+ JLabel lblC = new JLabel("C\u67AA");
|
|
|
+ lblC.setHorizontalAlignment(SwingConstants.CENTER);
|
|
|
+ lblC.setFont(new Font("微软雅黑", Font.PLAIN, 20));
|
|
|
+ lblC.setBounds(660, 186, 166, 28);
|
|
|
+ indexPanelA.add(lblC);
|
|
|
+
|
|
|
+ JLabel lblNewLabel_1_3 = new JLabel("\u9884\u8BBE\u6570\u91CF");
|
|
|
+ lblNewLabel_1_3.setFont(new Font("微软雅黑", Font.PLAIN, 18));
|
|
|
+ lblNewLabel_1_3.setBounds(660, 241, 83, 34);
|
|
|
+ indexPanelA.add(lblNewLabel_1_3);
|
|
|
+
|
|
|
+ param5 = new JTextField();
|
|
|
+ param5.setText("0");
|
|
|
+ param5.setHorizontalAlignment(SwingConstants.CENTER);
|
|
|
+ param5.setFont(new Font("微软雅黑", Font.PLAIN, 18));
|
|
|
+ param5.setEditable(false);
|
|
|
+ param5.setColumns(10);
|
|
|
+ param5.setBounds(743, 241, 83, 34);
|
|
|
+ indexPanelA.add(param5);
|
|
|
+
|
|
|
+ JLabel lblNewLabel_1_1_2 = new JLabel("\u5B8C\u6210\u6570\u91CF");
|
|
|
+ lblNewLabel_1_1_2.setFont(new Font("微软雅黑", Font.PLAIN, 18));
|
|
|
+ lblNewLabel_1_1_2.setBounds(660, 285, 83, 34);
|
|
|
+ indexPanelA.add(lblNewLabel_1_1_2);
|
|
|
+
|
|
|
+ param6 = new JTextField();
|
|
|
+ param6.setText("0");
|
|
|
+ param6.setHorizontalAlignment(SwingConstants.CENTER);
|
|
|
+ param6.setFont(new Font("微软雅黑", Font.PLAIN, 18));
|
|
|
+ param6.setEditable(false);
|
|
|
+ param6.setColumns(10);
|
|
|
+ param6.setBounds(743, 285, 83, 34);
|
|
|
+ indexPanelA.add(param6);
|
|
|
+
|
|
|
tabbedPane.addTab("工作面板", new ImageIcon(MesClient.class.getResource("/bg/a_side.png")), indexScrollPaneA, null);
|
|
|
tabbedPane.setEnabledAt(0, true);
|
|
|
|