|
@@ -3,6 +3,8 @@ package com.mes.ui;
|
|
|
import com.alibaba.fastjson2.JSONObject;
|
|
import com.alibaba.fastjson2.JSONObject;
|
|
|
import com.mes.component.MesRadio;
|
|
import com.mes.component.MesRadio;
|
|
|
import com.mes.component.MesWebView;
|
|
import com.mes.component.MesWebView;
|
|
|
|
|
+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;
|
|
@@ -35,7 +37,8 @@ public class MesClient extends JFrame {
|
|
|
public static String mes_gw_des = ""; // 工位名称
|
|
public static String mes_gw_des = ""; // 工位名称
|
|
|
public static String mes_server_ip = ""; // 服务器IP地址
|
|
public static String mes_server_ip = ""; // 服务器IP地址
|
|
|
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_sn_prefix = ""; // 工件码开头格式,多个用逗号分隔
|
|
public static String mes_sn_prefix = ""; // 工件码开头格式,多个用逗号分隔
|
|
|
|
|
|
|
|
//session
|
|
//session
|
|
@@ -80,7 +83,8 @@ public class MesClient extends JFrame {
|
|
|
|
|
|
|
|
public static JFrame welcomeWin;
|
|
public static JFrame welcomeWin;
|
|
|
|
|
|
|
|
- public static JPanel indexPanelB; // 已弃用,改为使用 WorkRecordPanel
|
|
|
|
|
|
|
+ public static JPanel indexPanelB;
|
|
|
|
|
+ public static WorkRecordPanel workRecordPanel;
|
|
|
public static MesWebView jfxPanel = null;
|
|
public static MesWebView jfxPanel = null;
|
|
|
public static JPanel indexPanelC;
|
|
public static JPanel indexPanelC;
|
|
|
public static MesWebView jfxPanel2 = null;
|
|
public static MesWebView jfxPanel2 = null;
|
|
@@ -93,6 +97,9 @@ public class MesClient extends JFrame {
|
|
|
public static JLabel fxlabel;
|
|
public static JLabel fxlabel;
|
|
|
|
|
|
|
|
public static void main(String[] args) {
|
|
public static void main(String[] args) {
|
|
|
|
|
+ if (ClientUpgrade.handleInstallArgs(args)) {
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
// if (LockUtil.getInstance().isAppActive() == false){
|
|
// if (LockUtil.getInstance().isAppActive() == false){
|
|
|
//// JOptionPane.showMessageDialog(null, "已有一个程序在运行,程序退出");
|
|
//// JOptionPane.showMessageDialog(null, "已有一个程序在运行,程序退出");
|
|
@@ -106,6 +113,11 @@ public class MesClient extends JFrame {
|
|
|
|
|
|
|
|
//读文件配置
|
|
//读文件配置
|
|
|
readProperty();
|
|
readProperty();
|
|
|
|
|
+ if (ClientUpgrade.recoverIncompleteInstall()) {
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ ClientUpgrade.cleanupInstallLeftovers();
|
|
|
|
|
+ ClientUpgrade.checkIfConfigured(null);
|
|
|
|
|
|
|
|
// 显示界面
|
|
// 显示界面
|
|
|
mesClientFrame = new MesClient();
|
|
mesClientFrame = new MesClient();
|
|
@@ -123,6 +135,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{
|
|
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");
|
|
@@ -137,6 +157,7 @@ public class MesClient extends JFrame {
|
|
|
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_line_sn = pro.getProperty("mes.line_sn");
|
|
mes_line_sn = pro.getProperty("mes.line_sn");
|
|
|
mes_sn_prefix = pro.getProperty("mes.sn_prefix");
|
|
mes_sn_prefix = pro.getProperty("mes.sn_prefix");
|
|
@@ -194,6 +215,18 @@ public class MesClient extends JFrame {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ public static void refreshWorkRecordPanel() {
|
|
|
|
|
+ if (indexPanelB == null) {
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ workRecordPanel = new WorkRecordPanel(mes_gw, mes_line_sn);
|
|
|
|
|
+ indexPanelB.removeAll();
|
|
|
|
|
+ indexPanelB.add(workRecordPanel, BorderLayout.CENTER);
|
|
|
|
|
+ indexPanelB.revalidate();
|
|
|
|
|
+ indexPanelB.repaint();
|
|
|
|
|
+ workRecordPanel.refreshData();
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
// 打开并切换到“软件设置”页签(实际访问权限由页签切换监听统一控制)
|
|
// 打开并切换到“软件设置”页签(实际访问权限由页签切换监听统一控制)
|
|
|
public static void openSoftwareSettings() {
|
|
public static void openSoftwareSettings() {
|
|
|
if (mesClientFrame != null) {
|
|
if (mesClientFrame != null) {
|
|
@@ -829,12 +862,9 @@ public class MesClient extends JFrame {
|
|
|
tabbedPane.addTab("开班点检", new ImageIcon(MesClient.class.getResource("/bg/menu_data_preprocess.png")), searchScrollPaneDj, null);
|
|
tabbedPane.addTab("开班点检", new ImageIcon(MesClient.class.getResource("/bg/menu_data_preprocess.png")), searchScrollPaneDj, null);
|
|
|
|
|
|
|
|
|
|
|
|
|
- // ========== 工作记录 Tab(改造:当前工位Tab + 所有工位Tab) ==========
|
|
|
|
|
- // 旧代码已注释:
|
|
|
|
|
- indexPanelB = new JPanel();
|
|
|
|
|
- searchScrollPane = new JScrollPane(indexPanelB);
|
|
|
|
|
- indexPanelB.setLayout(null);
|
|
|
|
|
- tabbedPane.addTab("工作记录", new ImageIcon(MesClient.class.getResource("/bg/menu_data_preprocess.png")), searchScrollPane, null);
|
|
|
|
|
|
|
+ // 工作记录:登录后由客户端表格拉取单部件加工记录
|
|
|
|
|
+ indexPanelB = new JPanel(new BorderLayout());
|
|
|
|
|
+ tabbedPane.addTab("工作记录", new ImageIcon(MesClient.class.getResource("/bg/menu_data_preprocess.png")), indexPanelB, null);
|
|
|
|
|
|
|
|
// 创建“软件设置”页面,并加入主Tab页签
|
|
// 创建“软件设置”页面,并加入主Tab页签
|
|
|
JPanel softwareSettingPanel = buildSoftwareSettingPanel();
|
|
JPanel softwareSettingPanel = buildSoftwareSettingPanel();
|
|
@@ -895,6 +925,9 @@ public class MesClient extends JFrame {
|
|
|
} else {
|
|
} else {
|
|
|
// 只记录非“软件设置”页签,便于校验失败时回退
|
|
// 只记录非“软件设置”页签,便于校验失败时回退
|
|
|
lastNonSoftwareTabIndex = selectedIndex;
|
|
lastNonSoftwareTabIndex = selectedIndex;
|
|
|
|
|
+ if ("工作记录".equals(tabbedPane.getTitleAt(selectedIndex)) && workRecordPanel != null) {
|
|
|
|
|
+ workRecordPanel.refreshData();
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|