|
@@ -7,6 +7,8 @@ import com.mes.component.MesRadio;
|
|
|
import com.mes.component.MesWebView;
|
|
import com.mes.component.MesWebView;
|
|
|
import com.mes.component.ProductTypePanel;
|
|
import com.mes.component.ProductTypePanel;
|
|
|
import com.mes.netty.NettyClient;
|
|
import com.mes.netty.NettyClient;
|
|
|
|
|
+import com.mes.util.ClientVersionUtils;
|
|
|
|
|
+import com.mes.util.ClientUpgrade;
|
|
|
import com.mes.util.DateLocalUtils;
|
|
import com.mes.util.DateLocalUtils;
|
|
|
import com.mes.util.HttpUtils;
|
|
import com.mes.util.HttpUtils;
|
|
|
import com.mes.util.JdbcUtils;
|
|
import com.mes.util.JdbcUtils;
|
|
@@ -50,7 +52,8 @@ public class MesClient extends JFrame {
|
|
|
public static int mes_tcp_port = 3000; // TCP服务端口
|
|
public static int mes_tcp_port = 3000; // TCP服务端口
|
|
|
public static int mes_heart_beat_cycle = 10; // 心跳周期
|
|
public static int mes_heart_beat_cycle = 10; // 心跳周期
|
|
|
public static int mes_heart_icon_cycle = 1;
|
|
public static int mes_heart_icon_cycle = 1;
|
|
|
- public static String mes_line_sn = ""; // 产线编号
|
|
|
|
|
|
|
+ public static String mes_line_sn = "";
|
|
|
|
|
+ public static String client_version = "0.0.0"; // 打包发布版本,需和后台 JAR 管理版本号对齐 // 产线编号
|
|
|
|
|
|
|
|
//TCP连接
|
|
//TCP连接
|
|
|
public static NettyClient nettyClient;
|
|
public static NettyClient nettyClient;
|
|
@@ -150,6 +153,9 @@ public class MesClient extends JFrame {
|
|
|
public static String programNo = "";
|
|
public static String programNo = "";
|
|
|
|
|
|
|
|
public static void main(String[] args) {
|
|
public static void main(String[] args) {
|
|
|
|
|
+ if (ClientUpgrade.handleInstallArgs(args)) {
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
if (LockUtil.getInstance().isAppActive() == true){
|
|
if (LockUtil.getInstance().isAppActive() == true){
|
|
|
// JOptionPane.showMessageDialog(null, "已有一个程序在运行,程序退出");
|
|
// JOptionPane.showMessageDialog(null, "已有一个程序在运行,程序退出");
|
|
|
return;
|
|
return;
|
|
@@ -160,6 +166,11 @@ public class MesClient extends JFrame {
|
|
|
try{
|
|
try{
|
|
|
//读文件配置
|
|
//读文件配置
|
|
|
readProperty();
|
|
readProperty();
|
|
|
|
|
+ if (ClientUpgrade.recoverIncompleteInstall()) {
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ ClientUpgrade.cleanupInstallLeftovers();
|
|
|
|
|
+ ClientUpgrade.checkIfConfigured(null);
|
|
|
|
|
|
|
|
// S7Util.sendStartSignal(true);
|
|
// S7Util.sendStartSignal(true);
|
|
|
// S7Util.sendMesStatus(true);
|
|
// S7Util.sendMesStatus(true);
|
|
@@ -195,12 +206,21 @@ public class MesClient extends JFrame {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
//读配置文件
|
|
//读配置文件
|
|
|
|
|
+
|
|
|
|
|
+ private static String parseClientVersion(String value) {
|
|
|
|
|
+ if (value == null || value.trim().isEmpty()) {
|
|
|
|
|
+ return "0.0.0";
|
|
|
|
|
+ }
|
|
|
|
|
+ return ClientVersionUtils.normalize(value.trim());
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
private static void readProperty() throws IOException{
|
|
private static void readProperty() throws IOException{
|
|
|
String enconding = "UTF-8";
|
|
String enconding = "UTF-8";
|
|
|
InputStream is = ClassLoader.getSystemResourceAsStream("config/config.properties");
|
|
InputStream is = ClassLoader.getSystemResourceAsStream("config/config.properties");
|
|
|
Properties pro = new Properties();
|
|
Properties pro = new Properties();
|
|
|
BufferedReader br = new BufferedReader(new InputStreamReader(is, enconding));
|
|
BufferedReader br = new BufferedReader(new InputStreamReader(is, enconding));
|
|
|
pro.load(br);
|
|
pro.load(br);
|
|
|
|
|
+ client_version = parseClientVersion(pro.getProperty("mes.client.version"));
|
|
|
mes_gw = pro.getProperty("mes.gw");
|
|
mes_gw = pro.getProperty("mes.gw");
|
|
|
mes_server_ip = pro.getProperty("mes.server_ip");
|
|
mes_server_ip = pro.getProperty("mes.server_ip");
|
|
|
mes_tcp_port = Integer.parseInt(pro.getProperty("mes.tcp_port"));
|
|
mes_tcp_port = Integer.parseInt(pro.getProperty("mes.tcp_port"));
|