|
|
@@ -3,11 +3,13 @@ package com.mes.config;
|
|
|
import org.springframework.boot.context.properties.ConfigurationProperties;
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
+import java.util.LinkedHashMap;
|
|
|
import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
|
|
|
/**
|
|
|
* 柔性线一拖五客户端配置,对应 application.yml 中 {@code mes.*}。
|
|
|
- * 工位列表驱动多 PLC;upload 路径/参数档由各工位类型客户端自行配置。
|
|
|
+ * 三条产线各 5 站工位编码在 {@code line-stations} 自配;切 {@code line-profile} 启用其中一组。
|
|
|
*/
|
|
|
@ConfigurationProperties(prefix = "mes")
|
|
|
public class MesClientProperties {
|
|
|
@@ -38,10 +40,17 @@ public class MesClientProperties {
|
|
|
private boolean autoNextOnPush = true;
|
|
|
/**
|
|
|
* 产线开关:T13J / T1E / T1GC。
|
|
|
- * 启动时按 {@link HgLineProfiles} 自动填充五站 plc-ip。
|
|
|
+ * 启动时从 {@link #lineStations} 取出该线 5 站,再按 {@link HgLineProfiles} 填 PLC IP。
|
|
|
*/
|
|
|
private String lineProfile = HgLineProfiles.DEFAULT;
|
|
|
- /** 五工位配置(编码 + Tab;plc-ip 由 line-profile 自动适配) */
|
|
|
+ /**
|
|
|
+ * 三条产线各自的五站配置(共 15 个工位编码),key=T13J/T1E/T1GC。
|
|
|
+ * 工位编码、标题在 yml 自配。
|
|
|
+ */
|
|
|
+ private Map<String, List<StationConfig>> lineStations = new LinkedHashMap<String, List<StationConfig>>();
|
|
|
+ /**
|
|
|
+ * 当前启用产线的五站(启动时由 line-profile + line-stations 解析填入,业务只读这里)。
|
|
|
+ */
|
|
|
private List<StationConfig> stations = new ArrayList<StationConfig>();
|
|
|
|
|
|
/** 兼容旧字段,主流程不读 */
|
|
|
@@ -57,11 +66,11 @@ public class MesClientProperties {
|
|
|
public static class StationConfig {
|
|
|
/** 序号 1~5 */
|
|
|
private int id;
|
|
|
- /** 柔性工位编码(入队/取码/过站,不分 A/B) */
|
|
|
+ /** 柔性工位编码(入队/取码/过站),在 line-stations 里配 */
|
|
|
private String stationSn = "";
|
|
|
/** 该站 PLC IP(三菱);启动时由 line-profile 自动填充 */
|
|
|
private String plcIp = "";
|
|
|
- /** Tab 显示名 */
|
|
|
+ /** Tab 显示名,在 line-stations 里配 */
|
|
|
private String title = "";
|
|
|
|
|
|
public int getId() {
|
|
|
@@ -169,6 +178,14 @@ public class MesClientProperties {
|
|
|
this.lineProfile = lineProfile;
|
|
|
}
|
|
|
|
|
|
+ public Map<String, List<StationConfig>> getLineStations() {
|
|
|
+ return lineStations;
|
|
|
+ }
|
|
|
+
|
|
|
+ public void setLineStations(Map<String, List<StationConfig>> lineStations) {
|
|
|
+ this.lineStations = lineStations;
|
|
|
+ }
|
|
|
+
|
|
|
public List<StationConfig> getStations() {
|
|
|
return stations;
|
|
|
}
|
|
|
@@ -177,6 +194,27 @@ public class MesClientProperties {
|
|
|
this.stations = stations;
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 按产线名取出 yml 里配置的五站(不改 IP)。
|
|
|
+ * key 大小写不敏感;找不到则空列表。
|
|
|
+ */
|
|
|
+ public List<StationConfig> stationsOfLine(String profile) {
|
|
|
+ String p = HgLineProfiles.normalize(profile);
|
|
|
+ if (lineStations == null || lineStations.isEmpty()) {
|
|
|
+ return new ArrayList<StationConfig>();
|
|
|
+ }
|
|
|
+ List<StationConfig> hit = lineStations.get(p);
|
|
|
+ if (hit != null) {
|
|
|
+ return hit;
|
|
|
+ }
|
|
|
+ for (Map.Entry<String, List<StationConfig>> e : lineStations.entrySet()) {
|
|
|
+ if (e.getKey() != null && p.equalsIgnoreCase(e.getKey().trim())) {
|
|
|
+ return e.getValue() == null ? new ArrayList<StationConfig>() : e.getValue();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return new ArrayList<StationConfig>();
|
|
|
+ }
|
|
|
+
|
|
|
public String getGw() {
|
|
|
return gw;
|
|
|
}
|