|
@@ -6,6 +6,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.*;
|
|
import com.mes.util.*;
|
|
|
|
|
|
|
|
import javax.swing.*;
|
|
import javax.swing.*;
|
|
@@ -38,7 +40,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 管理版本号对齐 // 产线编号
|
|
|
public static String mes_serial_port = "COM1"; // 称重仪串口号
|
|
public static String mes_serial_port = "COM1"; // 称重仪串口号
|
|
|
public static int mes_serial_baud = 9600; // 称重仪波特率
|
|
public static int mes_serial_baud = 9600; // 称重仪波特率
|
|
|
|
|
|
|
@@ -105,6 +108,9 @@ public class MesClient extends JFrame {
|
|
|
public static Timer cjTimer2; //串口定时器2
|
|
public static Timer cjTimer2; //串口定时器2
|
|
|
private static final String TARGET_DEVICE_ADDRESS = "001135390238";
|
|
private static final String TARGET_DEVICE_ADDRESS = "001135390238";
|
|
|
public static void main(String[] args) {
|
|
public static void main(String[] args) {
|
|
|
|
|
+ if (ClientUpgrade.handleInstallArgs(args)) {
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
//EventQueue.invokeLater(new Runnable() )是SwingUtilities类中的一个静态方法,
|
|
//EventQueue.invokeLater(new Runnable() )是SwingUtilities类中的一个静态方法,
|
|
|
// 用于在事件调度线程中执行指定的Runnable。
|
|
// 用于在事件调度线程中执行指定的Runnable。
|
|
|
//事件调度线程是Swing的核心线程,负责处理所有Swing组件的事件。
|
|
//事件调度线程是Swing的核心线程,负责处理所有Swing组件的事件。
|
|
@@ -115,6 +121,11 @@ public class MesClient extends JFrame {
|
|
|
|
|
|
|
|
//读文件配置(新增串口号和波特率)
|
|
//读文件配置(新增串口号和波特率)
|
|
|
readProperty();
|
|
readProperty();
|
|
|
|
|
+ if (ClientUpgrade.recoverIncompleteInstall()) {
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ ClientUpgrade.cleanupInstallLeftovers();
|
|
|
|
|
+ ClientUpgrade.checkIfConfigured(null);
|
|
|
//检查串口连接(定时器定时检查串口连接)
|
|
//检查串口连接(定时器定时检查串口连接)
|
|
|
checkComPort();
|
|
checkComPort();
|
|
|
// 显示界面
|
|
// 显示界面
|
|
@@ -188,12 +199,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");
|