|
|
@@ -5,6 +5,8 @@ import com.mes.component.MesRadio;
|
|
|
import com.mes.component.MesWebView;
|
|
|
import com.fazecast.jSerialComm.SerialPort;
|
|
|
import com.mes.component.ProductTypePanel;
|
|
|
+import com.mes.util.ClientVersionUtils;
|
|
|
+import com.mes.util.ClientUpgrade;
|
|
|
import com.mes.util.DateLocalUtils;
|
|
|
import com.mes.util.HttpUtils;
|
|
|
import com.mes.util.JdbcUtils;
|
|
|
@@ -42,7 +44,8 @@ public class MesClient extends JFrame {
|
|
|
public static String mes_server_ip = ""; // 服务器IP地址
|
|
|
public static int mes_heart_icon_cycle = 1;
|
|
|
public static boolean mes_ut5310_enable = false;
|
|
|
- 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_plc_ip = "192.168.0.3"; // PLC IP地址
|
|
|
|
|
|
public static final int PLC_PHASE_IDLE = 0;
|
|
|
@@ -130,6 +133,9 @@ public class MesClient extends JFrame {
|
|
|
private static final ExecutorService ut5310Executor = Executors.newSingleThreadExecutor();
|
|
|
|
|
|
public static void main(String[] args) {
|
|
|
+ if (ClientUpgrade.handleInstallArgs(args)) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
|
|
|
// if (LockUtil.getInstance().isAppActive() == false){
|
|
|
//// JOptionPane.showMessageDialog(null, "已有一个程序在运行,程序退出");
|
|
|
@@ -143,6 +149,11 @@ public class MesClient extends JFrame {
|
|
|
|
|
|
//读文件配置
|
|
|
readProperty();
|
|
|
+ if (ClientUpgrade.recoverIncompleteInstall()) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ ClientUpgrade.cleanupInstallLeftovers();
|
|
|
+ ClientUpgrade.checkIfConfigured(null);
|
|
|
|
|
|
// 显示界面
|
|
|
mesClientFrame = new MesClient();
|
|
|
@@ -160,6 +171,14 @@ 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{
|
|
|
String enconding = "UTF-8";
|
|
|
InputStream is = ClassLoader.getSystemResourceAsStream("config/config.properties");
|
|
|
@@ -173,6 +192,7 @@ public class MesClient extends JFrame {
|
|
|
Properties pro = new Properties();
|
|
|
BufferedReader br = new BufferedReader(new InputStreamReader(is, enconding));
|
|
|
pro.load(br);
|
|
|
+ client_version = parseClientVersion(pro.getProperty("mes.client.version"));
|
|
|
mes_gw = pro.getProperty("mes.gw");
|
|
|
mes_line_sn = pro.getProperty("mes.line_sn");
|
|
|
String plcIp = pro.getProperty("mes.plc_ip");
|