|
|
@@ -5,7 +5,9 @@ import com.alibaba.fastjson2.JSONObject;
|
|
|
import com.github.xingshuangs.iot.protocol.modbus.service.ModbusTcp;
|
|
|
import com.mes.component.MesRadio;
|
|
|
import com.mes.component.MesWebView;
|
|
|
+import com.mes.device.DeviceStateReporter;
|
|
|
import com.mes.netty.NettyClient;
|
|
|
+import com.mes.update.ClientAutoUpdater;
|
|
|
import com.mes.util.DateLocalUtils;
|
|
|
import com.mes.util.JdbcUtils;
|
|
|
import javafx.embed.swing.JFXPanel;
|
|
|
@@ -41,6 +43,8 @@ public class MesClient extends JFrame {
|
|
|
public static String mes_line_sn = ""; // 产线编号
|
|
|
|
|
|
public static boolean mes_shield_flag = false; // MES 屏蔽标志
|
|
|
+ public static int mes_device_heartbeat_minutes = 5; // 设备状态上报间隔(分钟)
|
|
|
+
|
|
|
|
|
|
//TCP连接
|
|
|
public static NettyClient nettyClient;
|
|
|
@@ -88,11 +92,23 @@ public class MesClient extends JFrame {
|
|
|
public static JTextField param6;
|
|
|
public static JTextField param7;
|
|
|
public static JTextField param8;
|
|
|
+ public static JTextField param9;
|
|
|
+ public static JTextField param10;
|
|
|
+ public static JTextField param11;
|
|
|
+ public static JTextField param12;
|
|
|
+ public static JTextField param13;
|
|
|
+ public static JTextField param14;
|
|
|
+ public static JTextField param15;
|
|
|
+ public static JTextField param16;
|
|
|
|
|
|
public static ModbusTcp plcA;
|
|
|
public static ModbusTcp plcB;
|
|
|
+ public static ModbusTcp plcC;
|
|
|
+ public static ModbusTcp plcD;
|
|
|
public static String curIpA = "";
|
|
|
public static String curIpB = "";
|
|
|
+ public static String curIpC = "";
|
|
|
+ public static String curIpD = "";
|
|
|
// public static ModbusTcp plcA = new ModbusTcp(1, "192.168.1.27");
|
|
|
// public static ModbusTcp plcB = new ModbusTcp(1, "192.168.1.28");
|
|
|
|
|
|
@@ -112,7 +128,18 @@ public class MesClient extends JFrame {
|
|
|
// public static Short bSetNum = 27;
|
|
|
public static Short sortB = 0;
|
|
|
public static Short bMax = 0;
|
|
|
+ public static Short bFinish = 0;
|
|
|
public static List<Map> blist = new ArrayList<>();
|
|
|
+ public static Short cSetNum = 14;
|
|
|
+ public static Short sortC = 0;
|
|
|
+ public static Short cMax = 0;
|
|
|
+ public static Short cFinish = 0;
|
|
|
+ public static List<Map> clist = new ArrayList<>();
|
|
|
+ public static Short dSetNum = 14;
|
|
|
+ public static Short sortD = 0;
|
|
|
+ public static Short dMax = 0;
|
|
|
+ public static Short dFinish = 0;
|
|
|
+ public static List<Map> dlist = new ArrayList<>();
|
|
|
public static Short deviceControl = 0; // 0=本地 1=远程
|
|
|
public static Integer tjStatus = 0; // 1=提交失败
|
|
|
public static JPanel indexPanelB;
|
|
|
@@ -122,6 +149,8 @@ public class MesClient extends JFrame {
|
|
|
// 铆接参数区间配置(内存缓存)
|
|
|
public static List<RivetParamRange> rivetParamRangesA = new ArrayList<>();
|
|
|
public static List<RivetParamRange> rivetParamRangesB = new ArrayList<>();
|
|
|
+ public static List<RivetParamRange> rivetParamRangesC = new ArrayList<>();
|
|
|
+ public static List<RivetParamRange> rivetParamRangesD = new ArrayList<>();
|
|
|
|
|
|
public static String tjFlagTextErr = "结果上传MES失败,请重试";
|
|
|
|
|
|
@@ -143,8 +172,11 @@ public class MesClient extends JFrame {
|
|
|
@Override
|
|
|
public void run() {
|
|
|
try{
|
|
|
- // 读文件配置
|
|
|
- readProperty();
|
|
|
+ Properties config = readProperty();
|
|
|
+ // 程序启动时先检查是否有当前工位的新 jar;如需升级,会退出并交给外部 bat 替换 jar。
|
|
|
+ if (ClientAutoUpdater.checkAndUpdate(config)) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
|
|
|
JdbcUtils.getConn();
|
|
|
|
|
|
@@ -186,6 +218,8 @@ public class MesClient extends JFrame {
|
|
|
if (work_status == 1) {
|
|
|
keepGunRunningIfNeeded(plcA, sortA, aMax);
|
|
|
keepGunRunningIfNeeded(plcB, sortB, bMax);
|
|
|
+ keepGunRunningIfNeeded(plcC, sortC, cMax);
|
|
|
+ keepGunRunningIfNeeded(plcD, sortD, dMax);
|
|
|
}
|
|
|
return;
|
|
|
}
|
|
|
@@ -207,6 +241,24 @@ 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);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ List<Boolean> yxstatusd = plcD.readCoil(3128,1);
|
|
|
+ if(yxstatusd.size() >= 1 && !yxstatusd.get(0)){
|
|
|
+ if(!MesClient.curSn.isEmpty() && MesClient.dMax > 0 && MesClient.dMax == MesClient.sortD){
|
|
|
+ ModbusUtil.setPowerOff(plcD);
|
|
|
+ }else{
|
|
|
+ ModbusUtil.setPowerOn(plcD);
|
|
|
+ }
|
|
|
+ }
|
|
|
}else{
|
|
|
List<Boolean> yxstatus = plcA.readCoil(3128,1);
|
|
|
if(yxstatus.size() >= 1 && yxstatus.get(0)){
|
|
|
@@ -217,6 +269,16 @@ 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);
|
|
|
+ }
|
|
|
+
|
|
|
+ List<Boolean> yxstatusd = plcD.readCoil(3128,1);
|
|
|
+ if(yxstatusd.size() >= 1 && yxstatusd.get(0)){
|
|
|
+ ModbusUtil.setPowerOff(plcD);
|
|
|
+ }
|
|
|
}
|
|
|
}catch (Exception e){
|
|
|
e.printStackTrace();
|
|
|
@@ -227,6 +289,9 @@ public class MesClient extends JFrame {
|
|
|
|
|
|
// MES屏蔽期间:任务未完成时保持拉铆枪运行
|
|
|
private static void keepGunRunningIfNeeded(ModbusTcp plc, Short sort, Short max) {
|
|
|
+ if (plc == null) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
try {
|
|
|
List<Boolean> yxstatus = plc.readCoil(3128, 1);
|
|
|
if (yxstatus.size() >= 1 && !yxstatus.get(0)) {
|
|
|
@@ -240,7 +305,7 @@ public class MesClient extends JFrame {
|
|
|
}
|
|
|
|
|
|
//读配置文件
|
|
|
- private static void readProperty() throws IOException{
|
|
|
+ private static Properties readProperty() throws IOException{
|
|
|
String enconding = "UTF-8";
|
|
|
InputStream is = ClassLoader.getSystemResourceAsStream("config/config.properties");
|
|
|
Properties pro = new Properties();
|
|
|
@@ -255,8 +320,16 @@ public class MesClient extends JFrame {
|
|
|
mes_line_sn = pro.getProperty("mes.line_sn");
|
|
|
|
|
|
mes_gw_des = OprnoUtil.getGwDes(mes_line_sn,mes_gw);
|
|
|
-
|
|
|
+ try {
|
|
|
+ mes_device_heartbeat_minutes = Integer.parseInt(pro.getProperty("mes.device.heartbeat.minutes", "5").trim());
|
|
|
+ } catch (Exception e) {
|
|
|
+ mes_device_heartbeat_minutes = 5;
|
|
|
+ }
|
|
|
+ if (mes_device_heartbeat_minutes <= 0) {
|
|
|
+ mes_device_heartbeat_minutes = 5;
|
|
|
+ }
|
|
|
System.out.println(mes_gw + ";" + mes_gw_des + ";" + mes_server_ip + ";" + mes_tcp_port + ";" + mes_heart_beat_cycle);
|
|
|
+ return pro;
|
|
|
}
|
|
|
|
|
|
private static void initLocalConfig() {
|
|
|
@@ -264,24 +337,38 @@ public class MesClient extends JFrame {
|
|
|
if (config.size() > 0) {
|
|
|
aSetNum = (Short) config.get("a_set_num");
|
|
|
bSetNum = (Short) config.get("b_set_num");
|
|
|
+ cSetNum = (Short) config.get("c_set_num");
|
|
|
+ dSetNum = (Short) config.get("d_set_num");
|
|
|
curIpA = (String) config.get("plc_ip_a");
|
|
|
curIpB = (String) config.get("plc_ip_b");
|
|
|
+ curIpC = (String) config.get("plc_ip_c");
|
|
|
+ curIpD = (String) config.get("plc_ip_d");
|
|
|
plcA = new ModbusTcp(1, curIpA);
|
|
|
plcB = new ModbusTcp(1, curIpB);
|
|
|
+ plcC = new ModbusTcp(1, curIpC);
|
|
|
+ plcD = new ModbusTcp(1, curIpD);
|
|
|
|
|
|
// 初始化工作面板显示的预设数量
|
|
|
if (param1 != null) param1.setText(String.valueOf(aSetNum));
|
|
|
if (param3 != null) param3.setText(String.valueOf(bSetNum));
|
|
|
+ if (param9 != null) param9.setText(String.valueOf(cSetNum));
|
|
|
+ if (param11 != null) param11.setText(String.valueOf(dSetNum));
|
|
|
|
|
|
System.out.println("加载本地配置成功:aSetNum=" + aSetNum + ", bSetNum=" + bSetNum + ", plcA=" + curIpA + ", plcB=" + curIpB);
|
|
|
} else {
|
|
|
// 兜底默认值
|
|
|
aSetNum = 41;
|
|
|
bSetNum = 14;
|
|
|
+ cSetNum = 14;
|
|
|
+ dSetNum = 14;
|
|
|
curIpA = "192.168.1.7";
|
|
|
curIpB = "192.168.1.8";
|
|
|
+ curIpC = "192.168.1.9";
|
|
|
+ curIpD = "192.168.1.10";
|
|
|
plcA = new ModbusTcp(1, curIpA);
|
|
|
plcB = new ModbusTcp(1, curIpB);
|
|
|
+ plcC = new ModbusTcp(1, curIpC);
|
|
|
+ plcD = new ModbusTcp(1, curIpD);
|
|
|
System.out.println("未找到本地配置,使用默认值");
|
|
|
}
|
|
|
loadRivetParamConfig();
|
|
|
@@ -291,6 +378,8 @@ public class MesClient extends JFrame {
|
|
|
public static void loadRivetParamConfig() {
|
|
|
rivetParamRangesA = JdbcUtils.getRivetParams("A");
|
|
|
rivetParamRangesB = JdbcUtils.getRivetParams("B");
|
|
|
+ rivetParamRangesC = JdbcUtils.getRivetParams("C");
|
|
|
+ rivetParamRangesD = JdbcUtils.getRivetParams("D");
|
|
|
}
|
|
|
|
|
|
public static void getPlcParam() {
|
|
|
@@ -317,6 +406,24 @@ public class MesClient extends JFrame {
|
|
|
}catch (Exception e){
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
+
|
|
|
+ try{
|
|
|
+ if(work_status == 1 && !mes_shield_flag){
|
|
|
+ ModbusUtil.getDataC(plcC);
|
|
|
+ }
|
|
|
+
|
|
|
+ }catch (Exception e){
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+
|
|
|
+ try{
|
|
|
+ if(work_status == 1 && !mes_shield_flag){
|
|
|
+ ModbusUtil.getDataD(plcD);
|
|
|
+ }
|
|
|
+
|
|
|
+ }catch (Exception e){
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
}
|
|
|
}, 1000,500);
|
|
|
}
|
|
|
@@ -602,6 +709,8 @@ public class MesClient extends JFrame {
|
|
|
|
|
|
ModbusUtil.setPowerOff(plcA);
|
|
|
ModbusUtil.setPowerOff(plcB);
|
|
|
+ ModbusUtil.setPowerOff(plcC);
|
|
|
+ ModbusUtil.setPowerOff(plcD);
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
@@ -655,15 +764,28 @@ public class MesClient extends JFrame {
|
|
|
|
|
|
MesClient.aMax = 0;
|
|
|
MesClient.bMax = 0;
|
|
|
+ MesClient.cMax = 0;
|
|
|
+ MesClient.dMax = 0;
|
|
|
MesClient.aFinish = 0;
|
|
|
+ MesClient.bFinish = 0;
|
|
|
+ MesClient.cFinish = 0;
|
|
|
+ MesClient.dFinish = 0;
|
|
|
MesClient.alist = new ArrayList<>();
|
|
|
MesClient.blist = new ArrayList<>();
|
|
|
+ MesClient.clist = new ArrayList<>();
|
|
|
+ MesClient.dlist = new ArrayList<>();
|
|
|
MesClient.sortB = 0;
|
|
|
MesClient.sortA = 0;
|
|
|
+ MesClient.sortC = 0;
|
|
|
+ MesClient.sortD = 0;
|
|
|
MesClient.param1.setText(String.valueOf(aSetNum));
|
|
|
MesClient.param2.setText("");
|
|
|
MesClient.param3.setText(String.valueOf(bSetNum));
|
|
|
MesClient.param4.setText("");
|
|
|
+ MesClient.param9.setText(String.valueOf(cSetNum));
|
|
|
+ MesClient.param10.setText("");
|
|
|
+ MesClient.param11.setText(String.valueOf(dSetNum));
|
|
|
+ MesClient.param12.setText("");
|
|
|
resetForceStrokeDisplay();
|
|
|
|
|
|
deviceControl = ModbusUtil.getControlModel(plcA);
|
|
|
@@ -676,8 +798,13 @@ public class MesClient extends JFrame {
|
|
|
ModbusUtil.setPowerOff(MesClient.plcA); // 远程关机
|
|
|
ModbusUtil.setPowerOff(MesClient.plcB); // 远程关机
|
|
|
|
|
|
+ ModbusUtil.setPowerOff(MesClient.plcC);
|
|
|
+ ModbusUtil.setPowerOff(MesClient.plcD);
|
|
|
+
|
|
|
ModbusUtil.setTask(MesClient.plcA, MesClient.aSetNum, "A");
|
|
|
ModbusUtil.setTask(MesClient.plcB, MesClient.bSetNum, "B");
|
|
|
+ ModbusUtil.setTask(MesClient.plcC, MesClient.cSetNum, "C");
|
|
|
+ ModbusUtil.setTask(MesClient.plcD, MesClient.dSetNum, "D");
|
|
|
|
|
|
updateMaterailData();
|
|
|
}
|
|
|
@@ -721,6 +848,10 @@ public class MesClient extends JFrame {
|
|
|
if (param6 != null) param6.setText("-");
|
|
|
if (param7 != null) param7.setText("-");
|
|
|
if (param8 != null) param8.setText("-");
|
|
|
+ if (param13 != null) param13.setText("-");
|
|
|
+ if (param14 != null) param14.setText("-");
|
|
|
+ if (param15 != null) param15.setText("-");
|
|
|
+ if (param16 != null) param16.setText("-");
|
|
|
}
|
|
|
|
|
|
public static void logoff() {
|
|
|
@@ -904,6 +1035,7 @@ public class MesClient extends JFrame {
|
|
|
JPanel indexPanelA = new JPanel();
|
|
|
indexScrollPaneA = new JScrollPane(indexPanelA);
|
|
|
indexPanelA.setLayout(null);
|
|
|
+ indexPanelA.setPreferredSize(new Dimension(960, 720));
|
|
|
|
|
|
product_sn = new JTextField();
|
|
|
product_sn.setHorizontalAlignment(SwingConstants.CENTER);
|
|
|
@@ -930,7 +1062,7 @@ public class MesClient extends JFrame {
|
|
|
finish_ok_bt.setIcon(new ImageIcon(MesClient.class.getResource("/bg/ok_bg.png")));
|
|
|
finish_ok_bt.setFont(new Font("微软雅黑", Font.PLAIN, 32));
|
|
|
// finish_ok_bt.setBounds(185, 291, 240, 80);
|
|
|
- finish_ok_bt.setBounds(185, 371, 240, 80);
|
|
|
+ finish_ok_bt.setBounds(185, 430, 240, 80);
|
|
|
finish_ok_bt.setEnabled(false);
|
|
|
indexPanelA.add(finish_ok_bt);
|
|
|
|
|
|
@@ -943,19 +1075,19 @@ public class MesClient extends JFrame {
|
|
|
});
|
|
|
finish_ng_bt.setIcon(new ImageIcon(MesClient.class.getResource("/bg/ng_bg.png")));
|
|
|
finish_ng_bt.setFont(new Font("微软雅黑", Font.PLAIN, 32));
|
|
|
- finish_ng_bt.setBounds(508, 371, 240, 80);
|
|
|
+ finish_ng_bt.setBounds(508, 430, 240, 80);
|
|
|
finish_ng_bt.setEnabled(false);
|
|
|
indexPanelA.add(finish_ng_bt);
|
|
|
|
|
|
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(80, 186, 190, 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(80, 241, 83, 34);
|
|
|
indexPanelA.add(lblNewLabel_1);
|
|
|
|
|
|
param1 = new JTextField();
|
|
|
@@ -963,13 +1095,13 @@ public class MesClient extends JFrame {
|
|
|
param1.setFont(new Font("微软雅黑", Font.PLAIN, 18));
|
|
|
param1.setText(String.valueOf(aSetNum));
|
|
|
param1.setEditable(false);
|
|
|
- param1.setBounds(288, 241, 83, 34);
|
|
|
+ param1.setBounds(164, 241, 65, 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(80, 285, 83, 34);
|
|
|
indexPanelA.add(lblNewLabel_1_1);
|
|
|
|
|
|
param2 = new JTextField();
|
|
|
@@ -978,18 +1110,18 @@ public class MesClient extends JFrame {
|
|
|
param2.setText("0");
|
|
|
param2.setEditable(false);
|
|
|
param2.setColumns(10);
|
|
|
- param2.setBounds(288, 285, 83, 34);
|
|
|
+ param2.setBounds(164, 285, 65, 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(295, 186, 190, 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(295, 241, 83, 34);
|
|
|
indexPanelA.add(lblNewLabel_1_2);
|
|
|
|
|
|
param3 = new JTextField();
|
|
|
@@ -998,12 +1130,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(379, 241, 65, 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(295, 285, 83, 34);
|
|
|
indexPanelA.add(lblNewLabel_1_1_1);
|
|
|
|
|
|
param4 = new JTextField();
|
|
|
@@ -1012,12 +1144,12 @@ 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(379, 285, 65, 34);
|
|
|
indexPanelA.add(param4);
|
|
|
|
|
|
JLabel lblForceA = new JLabel("\u62c9\u529b");
|
|
|
lblForceA.setFont(new Font("微软雅黑", Font.PLAIN, 18));
|
|
|
- lblForceA.setBounds(204, 329, 50, 34);
|
|
|
+ lblForceA.setBounds(80, 329, 45, 34);
|
|
|
indexPanelA.add(lblForceA);
|
|
|
|
|
|
param5 = new JTextField();
|
|
|
@@ -1026,12 +1158,12 @@ public class MesClient extends JFrame {
|
|
|
param5.setText("-");
|
|
|
param5.setEditable(false);
|
|
|
param5.setColumns(10);
|
|
|
- param5.setBounds(260, 329, 65, 34);
|
|
|
+ param5.setBounds(125, 329, 55, 34);
|
|
|
indexPanelA.add(param5);
|
|
|
|
|
|
JLabel lblStrokeA = new JLabel("\u884c\u7a0b");
|
|
|
lblStrokeA.setFont(new Font("微软雅黑", Font.PLAIN, 18));
|
|
|
- lblStrokeA.setBounds(330, 329, 50, 34);
|
|
|
+ lblStrokeA.setBounds(185, 329, 45, 34);
|
|
|
indexPanelA.add(lblStrokeA);
|
|
|
|
|
|
param6 = new JTextField();
|
|
|
@@ -1040,12 +1172,12 @@ public class MesClient extends JFrame {
|
|
|
param6.setText("-");
|
|
|
param6.setEditable(false);
|
|
|
param6.setColumns(10);
|
|
|
- param6.setBounds(380, 329, 65, 34);
|
|
|
+ param6.setBounds(230, 329, 55, 34);
|
|
|
indexPanelA.add(param6);
|
|
|
|
|
|
JLabel lblForceB = new JLabel("\u62c9\u529b");
|
|
|
lblForceB.setFont(new Font("微软雅黑", Font.PLAIN, 18));
|
|
|
- lblForceB.setBounds(525, 329, 50, 34);
|
|
|
+ lblForceB.setBounds(295, 329, 45, 34);
|
|
|
indexPanelA.add(lblForceB);
|
|
|
|
|
|
param7 = new JTextField();
|
|
|
@@ -1054,12 +1186,12 @@ public class MesClient extends JFrame {
|
|
|
param7.setText("-");
|
|
|
param7.setEditable(false);
|
|
|
param7.setColumns(10);
|
|
|
- param7.setBounds(581, 329, 65, 34);
|
|
|
+ param7.setBounds(340, 329, 55, 34);
|
|
|
indexPanelA.add(param7);
|
|
|
|
|
|
JLabel lblStrokeB = new JLabel("\u884c\u7a0b");
|
|
|
lblStrokeB.setFont(new Font("微软雅黑", Font.PLAIN, 18));
|
|
|
- lblStrokeB.setBounds(651, 329, 50, 34);
|
|
|
+ lblStrokeB.setBounds(400, 329, 45, 34);
|
|
|
indexPanelA.add(lblStrokeB);
|
|
|
|
|
|
param8 = new JTextField();
|
|
|
@@ -1068,9 +1200,133 @@ public class MesClient extends JFrame {
|
|
|
param8.setText("-");
|
|
|
param8.setEditable(false);
|
|
|
param8.setColumns(10);
|
|
|
- param8.setBounds(701, 329, 65, 34);
|
|
|
+ param8.setBounds(445, 329, 55, 34);
|
|
|
indexPanelA.add(param8);
|
|
|
|
|
|
+ JLabel lblC = new JLabel("C\u67AA");
|
|
|
+ lblC.setHorizontalAlignment(SwingConstants.CENTER);
|
|
|
+ lblC.setFont(new Font("\u5fae\u8f6f\u96c5\u9ed1", Font.PLAIN, 20));
|
|
|
+ lblC.setBounds(510, 186, 190, 28);
|
|
|
+ indexPanelA.add(lblC);
|
|
|
+
|
|
|
+ JLabel lblCSet = new JLabel("\u9884\u8BBE\u6570\u91CF");
|
|
|
+ lblCSet.setFont(new Font("\u5fae\u8f6f\u96c5\u9ed1", Font.PLAIN, 18));
|
|
|
+ lblCSet.setBounds(510, 241, 83, 34);
|
|
|
+ indexPanelA.add(lblCSet);
|
|
|
+
|
|
|
+ param9 = new JTextField();
|
|
|
+ param9.setHorizontalAlignment(SwingConstants.CENTER);
|
|
|
+ param9.setFont(new Font("\u5fae\u8f6f\u96c5\u9ed1", Font.PLAIN, 18));
|
|
|
+ param9.setText(String.valueOf(cSetNum));
|
|
|
+ param9.setEditable(false);
|
|
|
+ param9.setBounds(594, 241, 65, 34);
|
|
|
+ indexPanelA.add(param9);
|
|
|
+ param9.setColumns(10);
|
|
|
+
|
|
|
+ JLabel lblCDone = new JLabel("\u5B8C\u6210\u6570\u91CF");
|
|
|
+ lblCDone.setFont(new Font("\u5fae\u8f6f\u96c5\u9ed1", Font.PLAIN, 18));
|
|
|
+ lblCDone.setBounds(510, 285, 83, 34);
|
|
|
+ indexPanelA.add(lblCDone);
|
|
|
+
|
|
|
+ param10 = new JTextField();
|
|
|
+ param10.setHorizontalAlignment(SwingConstants.CENTER);
|
|
|
+ param10.setFont(new Font("\u5fae\u8f6f\u96c5\u9ed1", Font.PLAIN, 18));
|
|
|
+ param10.setText("0");
|
|
|
+ param10.setEditable(false);
|
|
|
+ param10.setColumns(10);
|
|
|
+ param10.setBounds(594, 285, 65, 34);
|
|
|
+ indexPanelA.add(param10);
|
|
|
+
|
|
|
+ JLabel lblD = new JLabel("D\u67AA");
|
|
|
+ lblD.setHorizontalAlignment(SwingConstants.CENTER);
|
|
|
+ lblD.setFont(new Font("\u5fae\u8f6f\u96c5\u9ed1", Font.PLAIN, 20));
|
|
|
+ lblD.setBounds(725, 186, 190, 28);
|
|
|
+ indexPanelA.add(lblD);
|
|
|
+
|
|
|
+ JLabel lblDSet = new JLabel("\u9884\u8BBE\u6570\u91CF");
|
|
|
+ lblDSet.setFont(new Font("\u5fae\u8f6f\u96c5\u9ed1", Font.PLAIN, 18));
|
|
|
+ lblDSet.setBounds(725, 241, 83, 34);
|
|
|
+ indexPanelA.add(lblDSet);
|
|
|
+
|
|
|
+ param11 = new JTextField();
|
|
|
+ param11.setText(String.valueOf(dSetNum));
|
|
|
+ param11.setHorizontalAlignment(SwingConstants.CENTER);
|
|
|
+ param11.setFont(new Font("\u5fae\u8f6f\u96c5\u9ed1", Font.PLAIN, 18));
|
|
|
+ param11.setEditable(false);
|
|
|
+ param11.setColumns(10);
|
|
|
+ param11.setBounds(809, 241, 65, 34);
|
|
|
+ indexPanelA.add(param11);
|
|
|
+
|
|
|
+ JLabel lblDDone = new JLabel("\u5B8C\u6210\u6570\u91CF");
|
|
|
+ lblDDone.setFont(new Font("\u5fae\u8f6f\u96c5\u9ed1", Font.PLAIN, 18));
|
|
|
+ lblDDone.setBounds(725, 285, 83, 34);
|
|
|
+ indexPanelA.add(lblDDone);
|
|
|
+
|
|
|
+ param12 = new JTextField();
|
|
|
+ param12.setText("0");
|
|
|
+ param12.setHorizontalAlignment(SwingConstants.CENTER);
|
|
|
+ param12.setFont(new Font("\u5fae\u8f6f\u96c5\u9ed1", Font.PLAIN, 18));
|
|
|
+ param12.setEditable(false);
|
|
|
+ param12.setColumns(10);
|
|
|
+ param12.setBounds(809, 285, 65, 34);
|
|
|
+ indexPanelA.add(param12);
|
|
|
+
|
|
|
+ JLabel lblForceC = new JLabel("\u62c9\u529b");
|
|
|
+ lblForceC.setFont(new Font("\u5fae\u8f6f\u96c5\u9ed1", Font.PLAIN, 18));
|
|
|
+ lblForceC.setBounds(510, 329, 45, 34);
|
|
|
+ indexPanelA.add(lblForceC);
|
|
|
+
|
|
|
+ param13 = new JTextField();
|
|
|
+ param13.setHorizontalAlignment(SwingConstants.CENTER);
|
|
|
+ param13.setFont(new Font("\u5fae\u8f6f\u96c5\u9ed1", Font.PLAIN, 18));
|
|
|
+ param13.setText("-");
|
|
|
+ param13.setEditable(false);
|
|
|
+ param13.setColumns(10);
|
|
|
+ param13.setBounds(555, 329, 55, 34);
|
|
|
+ indexPanelA.add(param13);
|
|
|
+
|
|
|
+ JLabel lblStrokeC = new JLabel("\u884c\u7a0b");
|
|
|
+ lblStrokeC.setFont(new Font("\u5fae\u8f6f\u96c5\u9ed1", Font.PLAIN, 18));
|
|
|
+ lblStrokeC.setBounds(615, 329, 45, 34);
|
|
|
+ indexPanelA.add(lblStrokeC);
|
|
|
+
|
|
|
+ param14 = new JTextField();
|
|
|
+ param14.setHorizontalAlignment(SwingConstants.CENTER);
|
|
|
+ param14.setFont(new Font("\u5fae\u8f6f\u96c5\u9ed1", Font.PLAIN, 18));
|
|
|
+ param14.setText("-");
|
|
|
+ param14.setEditable(false);
|
|
|
+ param14.setColumns(10);
|
|
|
+ param14.setBounds(660, 329, 55, 34);
|
|
|
+ indexPanelA.add(param14);
|
|
|
+
|
|
|
+ JLabel lblForceD = new JLabel("\u62c9\u529b");
|
|
|
+ lblForceD.setFont(new Font("\u5fae\u8f6f\u96c5\u9ed1", Font.PLAIN, 18));
|
|
|
+ lblForceD.setBounds(725, 329, 45, 34);
|
|
|
+ indexPanelA.add(lblForceD);
|
|
|
+
|
|
|
+ param15 = new JTextField();
|
|
|
+ param15.setHorizontalAlignment(SwingConstants.CENTER);
|
|
|
+ param15.setFont(new Font("\u5fae\u8f6f\u96c5\u9ed1", Font.PLAIN, 18));
|
|
|
+ param15.setText("-");
|
|
|
+ param15.setEditable(false);
|
|
|
+ param15.setColumns(10);
|
|
|
+ param15.setBounds(770, 329, 55, 34);
|
|
|
+ indexPanelA.add(param15);
|
|
|
+
|
|
|
+ JLabel lblStrokeD = new JLabel("\u884c\u7a0b");
|
|
|
+ lblStrokeD.setFont(new Font("\u5fae\u8f6f\u96c5\u9ed1", Font.PLAIN, 18));
|
|
|
+ lblStrokeD.setBounds(830, 329, 45, 34);
|
|
|
+ indexPanelA.add(lblStrokeD);
|
|
|
+
|
|
|
+ param16 = new JTextField();
|
|
|
+ param16.setHorizontalAlignment(SwingConstants.CENTER);
|
|
|
+ param16.setFont(new Font("\u5fae\u8f6f\u96c5\u9ed1", Font.PLAIN, 18));
|
|
|
+ param16.setText("-");
|
|
|
+ param16.setEditable(false);
|
|
|
+ param16.setColumns(10);
|
|
|
+ param16.setBounds(875, 329, 55, 34);
|
|
|
+ indexPanelA.add(param16);
|
|
|
+
|
|
|
tabbedPane.addTab("工作面板", new ImageIcon(MesClient.class.getResource("/bg/a_side.png")), indexScrollPaneA, null);
|
|
|
tabbedPane.setEnabledAt(0, true);
|
|
|
|
|
|
@@ -1227,5 +1483,48 @@ public class MesClient extends JFrame {
|
|
|
indexPanelBB.setLayout(null);
|
|
|
tabbedPane.addTab("绑定物料", new ImageIcon(MesClient.class.getResource("/bg/menu_data_preprocess.png")), indexScrollPaneB, null);
|
|
|
}
|
|
|
+ // 设备状态定时上报
|
|
|
+ public static java.util.Timer deviceReportTimer;
|
|
|
+ /**
|
|
|
+ * 启动设备状态定时上报
|
|
|
+ */
|
|
|
+ public static void startDeviceReportTimer() {
|
|
|
+ stopDeviceReportTimer();
|
|
|
+ long intervalMs = mes_device_heartbeat_minutes * 60L * 1000L;
|
|
|
+ deviceReportTimer = new Timer("device-report-timer", true);
|
|
|
+ deviceReportTimer.schedule(new TimerTask() {
|
|
|
+ @Override
|
|
|
+ public void run() {
|
|
|
+ DeviceStateReporter.getInstance().reportAsync(DeviceStateReporter.STATE_RUNNING, "运行心跳");
|
|
|
+ }
|
|
|
+ }, intervalMs, intervalMs);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 停止设备状态定时上报
|
|
|
+ */
|
|
|
+ public static void stopDeviceReportTimer() {
|
|
|
+ if (deviceReportTimer != null) {
|
|
|
+ deviceReportTimer.cancel();
|
|
|
+ deviceReportTimer = null;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 登录成功后上报设备运行状态
|
|
|
+ */
|
|
|
+ public static void reportDeviceRunning() {
|
|
|
+ DeviceStateReporter.getInstance().init(mes_server_ip, mes_gw, mes_line_sn);
|
|
|
+ DeviceStateReporter.getInstance().reportAsync(DeviceStateReporter.STATE_RUNNING, "工位登录,开始运行");
|
|
|
+ startDeviceReportTimer();
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 退出时停止上报并发送停止状态
|
|
|
+ */
|
|
|
+ public static void reportDeviceStopped() {
|
|
|
+ stopDeviceReportTimer();
|
|
|
+ DeviceStateReporter.getInstance().reportSync(DeviceStateReporter.STATE_STOP, "工位退出,停止运行");
|
|
|
+ }
|
|
|
|
|
|
}
|