|
@@ -11,6 +11,8 @@ import com.mes.component.MesRadio;
|
|
|
import com.mes.component.ProductTypePanel;
|
|
import com.mes.component.ProductTypePanel;
|
|
|
import com.mes.component.MesWebView;
|
|
import com.mes.component.MesWebView;
|
|
|
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.JdbcUtils;
|
|
import com.mes.util.JdbcUtils;
|
|
|
import javafx.embed.swing.JFXPanel;
|
|
import javafx.embed.swing.JFXPanel;
|
|
@@ -47,7 +49,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;
|
|
@@ -174,6 +177,9 @@ public class MesClient extends JFrame {
|
|
|
public static S7PLC s7PLC = new S7PLC(EPlcType.S1200,"10.88.10.180");
|
|
public static S7PLC s7PLC = new S7PLC(EPlcType.S1200,"10.88.10.180");
|
|
|
|
|
|
|
|
public static void main(String[] args) {
|
|
public static void main(String[] args) {
|
|
|
|
|
+ if (ClientUpgrade.handleInstallArgs(args)) {
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
// 设置全局 UI 字体,解决中文乱码问题
|
|
// 设置全局 UI 字体,解决中文乱码问题
|
|
|
setUIFont(new Font("微软雅黑", Font.PLAIN, 18));
|
|
setUIFont(new Font("微软雅黑", Font.PLAIN, 18));
|
|
|
|
|
|
|
@@ -191,6 +197,11 @@ public class MesClient extends JFrame {
|
|
|
|
|
|
|
|
//读文件配置
|
|
//读文件配置
|
|
|
readProperty();
|
|
readProperty();
|
|
|
|
|
+ if (ClientUpgrade.recoverIncompleteInstall()) {
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ ClientUpgrade.cleanupInstallLeftovers();
|
|
|
|
|
+ ClientUpgrade.checkIfConfigured(null);
|
|
|
|
|
|
|
|
// 显示界面
|
|
// 显示界面
|
|
|
mesClientFrame = new MesClient();
|
|
mesClientFrame = new MesClient();
|
|
@@ -413,12 +424,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_gw_des = pro.getProperty("mes.gw_des");
|
|
// mes_gw_des = pro.getProperty("mes.gw_des");
|