|
@@ -1,6 +1,7 @@
|
|
|
package com.mes.ui;
|
|
package com.mes.ui;
|
|
|
|
|
|
|
|
import com.github.xingshuangs.iot.protocol.s7.service.S7PLC;
|
|
import com.github.xingshuangs.iot.protocol.s7.service.S7PLC;
|
|
|
|
|
+import com.mes.config.HgLineProfiles;
|
|
|
import com.mes.config.MesClientProperties;
|
|
import com.mes.config.MesClientProperties;
|
|
|
import com.mes.service.MesFlexQueuePushClient;
|
|
import com.mes.service.MesFlexQueuePushClient;
|
|
|
import com.mes.util.SingleInstanceLock;
|
|
import com.mes.util.SingleInstanceLock;
|
|
@@ -111,9 +112,8 @@ public class MainFrame extends JFrame {
|
|
|
UiTheme.applyLookAndFeel();
|
|
UiTheme.applyLookAndFeel();
|
|
|
mesClientFrame = new MainFrame();
|
|
mesClientFrame = new MainFrame();
|
|
|
mesClientFrame.setVisible(true);
|
|
mesClientFrame.setVisible(true);
|
|
|
- startTickTimer();
|
|
|
|
|
startPush();
|
|
startPush();
|
|
|
- // PLC 在后台连:假 IP/离线时不卡 EDT
|
|
|
|
|
|
|
+ // 先串行连 PLC,再开 tick,避免与 maintainConnection 抢连、重复打「已连接」日志
|
|
|
new Thread(new Runnable() {
|
|
new Thread(new Runnable() {
|
|
|
@Override
|
|
@Override
|
|
|
public void run() {
|
|
public void run() {
|
|
@@ -124,6 +124,7 @@ public class MainFrame extends JFrame {
|
|
|
log.warn("PLC 初始化异常: {}", ex.getMessage());
|
|
log.warn("PLC 初始化异常: {}", ex.getMessage());
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
+ startTickTimer();
|
|
|
}
|
|
}
|
|
|
}, "hg-plc-init").start();
|
|
}, "hg-plc-init").start();
|
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
@@ -165,14 +166,22 @@ public class MainFrame extends JFrame {
|
|
|
user20 = mes_user_code;
|
|
user20 = mes_user_code;
|
|
|
mes_auto_next_on_push = p.isAutoNextOnPush();
|
|
mes_auto_next_on_push = p.isAutoNextOnPush();
|
|
|
List<MesClientProperties.StationConfig> list = p.getStations();
|
|
List<MesClientProperties.StationConfig> list = p.getStations();
|
|
|
|
|
+ // 产线开关:按 T13J / T1E / T1GC 自动套五站 PLC IP
|
|
|
|
|
+ String line = HgLineProfiles.applyToStations(p.getLineProfile(), list);
|
|
|
|
|
+ p.setLineProfile(line);
|
|
|
if (list == null || list.isEmpty()) {
|
|
if (list == null || list.isEmpty()) {
|
|
|
log.warn("mes.stations 为空,请在 application.yml 配置五工位");
|
|
log.warn("mes.stations 为空,请在 application.yml 配置五工位");
|
|
|
} else {
|
|
} else {
|
|
|
- log.info("加载工位数={} upload={} profile={}", list.size(), mes_upload_path, mes_param_profile);
|
|
|
|
|
|
|
+ log.info("加载工位数={} 产线={} upload={} profile={}",
|
|
|
|
|
+ list.size(), line, mes_upload_path, mes_param_profile);
|
|
|
for (MesClientProperties.StationConfig s : list) {
|
|
for (MesClientProperties.StationConfig s : list) {
|
|
|
log.info("工位 id={} sn={} plc={}", s.getId(), s.getStationSn(), s.getPlcIp());
|
|
log.info("工位 id={} sn={} plc={}", s.getId(), s.getStationSn(), s.getPlcIp());
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
+ // 标题带上产线,现场一眼能看出来
|
|
|
|
|
+ if (mes_app_title.indexOf(line) < 0) {
|
|
|
|
|
+ mes_app_title = mes_app_title + " [" + line + "]";
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
public MainFrame() {
|
|
public MainFrame() {
|