MesClientProperties.java 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  1. package com.mes.config;
  2. import org.springframework.boot.context.properties.ConfigurationProperties;
  3. import java.util.ArrayList;
  4. import java.util.List;
  5. /**
  6. * 一拖二大冲工控机配置,对应 application.yml 中 {@code mes.*}。
  7. */
  8. @ConfigurationProperties(prefix = "mes")
  9. public class MesClientProperties {
  10. /** 窗口标题 */
  11. private String appTitle = "MES 一拖二大冲";
  12. /** MES 服务器 IP */
  13. private String serverIp = "";
  14. /** 刷新周期毫秒 */
  15. private int tickMs = 500;
  16. /** 结案小票打印机名;空=系统默认 */
  17. private String printerName = "";
  18. /**
  19. * 是否写 PLC MES 允许运行点。
  20. * false:开批/结案/清码都不写允许信号,本地仍可取批盯冲次。
  21. * yml:{@code mes-allow-enabled}
  22. */
  23. private boolean mesAllowEnabled = true;
  24. /** 两台压机工位 */
  25. private List<StationConfig> stations = new ArrayList<StationConfig>();
  26. /**
  27. * 单台压机:取批次 →(可选)MES允许=true → 盯冲次差 → 结案允许=false → 打印。
  28. */
  29. public static class StationConfig {
  30. private int id = 1;
  31. /** 工位编码(与 MES 工位主数据 / 队列一致) */
  32. private String stationSn = "";
  33. /** PLC IP */
  34. private String plcIp = "";
  35. /** S7 端口,默认 102 */
  36. private int plcPort = 102;
  37. /**
  38. * 机型点表:TE2_800 / TL4_1600。
  39. */
  40. private String pressProfile = "TE2_800";
  41. /**
  42. * MES 允许运行 BOOL(两台都有,地址未定时留空预留)。
  43. */
  44. private String mesAllowAddr = "";
  45. /** Tab / 顶栏显示名 */
  46. private String title = "";
  47. public int getId() {
  48. return id;
  49. }
  50. public void setId(int id) {
  51. this.id = id;
  52. }
  53. public String getStationSn() {
  54. return stationSn;
  55. }
  56. public void setStationSn(String stationSn) {
  57. this.stationSn = stationSn;
  58. }
  59. public String getPlcIp() {
  60. return plcIp;
  61. }
  62. public void setPlcIp(String plcIp) {
  63. this.plcIp = plcIp;
  64. }
  65. public int getPlcPort() {
  66. return plcPort;
  67. }
  68. public void setPlcPort(int plcPort) {
  69. this.plcPort = plcPort;
  70. }
  71. public String getPressProfile() {
  72. return pressProfile;
  73. }
  74. public void setPressProfile(String pressProfile) {
  75. this.pressProfile = pressProfile;
  76. }
  77. public String getMesAllowAddr() {
  78. return mesAllowAddr;
  79. }
  80. public void setMesAllowAddr(String mesAllowAddr) {
  81. this.mesAllowAddr = mesAllowAddr;
  82. }
  83. public String getTitle() {
  84. return title;
  85. }
  86. public void setTitle(String title) {
  87. this.title = title;
  88. }
  89. /** 解析机型枚举 */
  90. public DcPressProfiles resolveProfile() {
  91. return DcPressProfiles.of(pressProfile);
  92. }
  93. }
  94. public String getAppTitle() {
  95. return appTitle;
  96. }
  97. public void setAppTitle(String appTitle) {
  98. this.appTitle = appTitle;
  99. }
  100. public String getServerIp() {
  101. return serverIp;
  102. }
  103. public void setServerIp(String serverIp) {
  104. this.serverIp = serverIp;
  105. }
  106. public int getTickMs() {
  107. return tickMs;
  108. }
  109. public void setTickMs(int tickMs) {
  110. this.tickMs = tickMs;
  111. }
  112. public String getPrinterName() {
  113. return printerName;
  114. }
  115. public void setPrinterName(String printerName) {
  116. this.printerName = printerName;
  117. }
  118. /** 是否写 PLC MES 允许运行点 */
  119. public boolean isMesAllowEnabled() {
  120. return mesAllowEnabled;
  121. }
  122. public void setMesAllowEnabled(boolean mesAllowEnabled) {
  123. this.mesAllowEnabled = mesAllowEnabled;
  124. }
  125. public List<StationConfig> getStations() {
  126. return stations;
  127. }
  128. public void setStations(List<StationConfig> stations) {
  129. this.stations = stations;
  130. }
  131. }