package com.mes.config; import org.springframework.boot.context.properties.ConfigurationProperties; import java.util.ArrayList; import java.util.List; /** * 一拖二大冲工控机配置,对应 application.yml 中 {@code mes.*}。 */ @ConfigurationProperties(prefix = "mes") public class MesClientProperties { /** 窗口标题 */ private String appTitle = "MES 一拖二大冲"; /** MES 服务器 IP */ private String serverIp = ""; /** 刷新周期毫秒 */ private int tickMs = 500; /** 结案小票打印机名;空=系统默认 */ private String printerName = ""; /** * 是否写 PLC MES 允许运行点。 * false:开批/结案/清码都不写允许信号,本地仍可取批盯冲次。 * yml:{@code mes-allow-enabled} */ private boolean mesAllowEnabled = true; /** 两台压机工位 */ private List stations = new ArrayList(); /** * 单台压机:取批次 →(可选)MES允许=true → 盯冲次差 → 结案允许=false → 打印。 */ public static class StationConfig { private int id = 1; /** 工位编码(与 MES 工位主数据 / 队列一致) */ private String stationSn = ""; /** PLC IP */ private String plcIp = ""; /** S7 端口,默认 102 */ private int plcPort = 102; /** * 机型点表:TE2_800 / TL4_1600。 */ private String pressProfile = "TE2_800"; /** * MES 允许运行 BOOL(两台都有,地址未定时留空预留)。 */ private String mesAllowAddr = ""; /** Tab / 顶栏显示名 */ private String title = ""; public int getId() { return id; } public void setId(int id) { this.id = id; } public String getStationSn() { return stationSn; } public void setStationSn(String stationSn) { this.stationSn = stationSn; } public String getPlcIp() { return plcIp; } public void setPlcIp(String plcIp) { this.plcIp = plcIp; } public int getPlcPort() { return plcPort; } public void setPlcPort(int plcPort) { this.plcPort = plcPort; } public String getPressProfile() { return pressProfile; } public void setPressProfile(String pressProfile) { this.pressProfile = pressProfile; } public String getMesAllowAddr() { return mesAllowAddr; } public void setMesAllowAddr(String mesAllowAddr) { this.mesAllowAddr = mesAllowAddr; } public String getTitle() { return title; } public void setTitle(String title) { this.title = title; } /** 解析机型枚举 */ public DcPressProfiles resolveProfile() { return DcPressProfiles.of(pressProfile); } } public String getAppTitle() { return appTitle; } public void setAppTitle(String appTitle) { this.appTitle = appTitle; } public String getServerIp() { return serverIp; } public void setServerIp(String serverIp) { this.serverIp = serverIp; } public int getTickMs() { return tickMs; } public void setTickMs(int tickMs) { this.tickMs = tickMs; } public String getPrinterName() { return printerName; } public void setPrinterName(String printerName) { this.printerName = printerName; } /** 是否写 PLC MES 允许运行点 */ public boolean isMesAllowEnabled() { return mesAllowEnabled; } public void setMesAllowEnabled(boolean mesAllowEnabled) { this.mesAllowEnabled = mesAllowEnabled; } public List getStations() { return stations; } public void setStations(List stations) { this.stations = stations; } }