|
|
@@ -8,6 +8,8 @@ import com.google.zxing.common.BitMatrix;
|
|
|
import com.google.zxing.qrcode.QRCodeWriter;
|
|
|
import com.github.xingshuangs.iot.protocol.modbus.service.ModbusTcp;
|
|
|
import com.mes.component.*;
|
|
|
+import com.mes.util.ClientVersionUtils;
|
|
|
+import com.mes.util.ClientUpgrade;
|
|
|
import com.mes.util.DateLocalUtils;
|
|
|
import com.mes.util.JdbcUtils;
|
|
|
import com.mes.util.TCPClient;
|
|
|
@@ -40,7 +42,8 @@ public class MesClient extends JFrame {
|
|
|
public static String mes_gw = ""; // 工位号
|
|
|
public static String mes_gw_des = ""; // 工位名称
|
|
|
public static String mes_server_ip = ""; // 服务器IP地址
|
|
|
- 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_line_pos = "";
|
|
|
public static String mes_plc_ip = "192.168.1.100";
|
|
|
public static int mes_plc_port = 502;
|
|
|
@@ -112,12 +115,21 @@ public class MesClient extends JFrame {
|
|
|
public static CncStationRecordPanel cncStationRecordPanel;
|
|
|
|
|
|
public static void main(String[] args) {
|
|
|
+ if (ClientUpgrade.handleInstallArgs(args)) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
EventQueue.invokeLater(new Runnable() {
|
|
|
@Override
|
|
|
public void run() {
|
|
|
try{
|
|
|
//读文件配置
|
|
|
readProperty();
|
|
|
+ ClientUpgrade.setStationOprno("OP090A");
|
|
|
+ if (ClientUpgrade.recoverIncompleteInstall()) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ ClientUpgrade.cleanupInstallLeftovers();
|
|
|
+ ClientUpgrade.checkIfConfigured(null);
|
|
|
|
|
|
JdbcUtils.getConn();
|
|
|
|
|
|
@@ -168,12 +180,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{
|
|
|
String enconding = "UTF-8";
|
|
|
InputStream is = ClassLoader.getSystemResourceAsStream("config/config.properties");
|
|
|
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_gw_des = pro.getProperty("mes.gw_des");
|
|
|
mes_server_ip = pro.getProperty("mes.server_ip");
|