|
|
@@ -4,8 +4,9 @@ import com.alibaba.fastjson2.JSONArray;
|
|
|
import com.alibaba.fastjson2.JSONObject;
|
|
|
import com.mes.config.MesClientProperties;
|
|
|
import com.mes.entity.WeldParams;
|
|
|
-import com.mes.service.TuHanModbusClient;
|
|
|
import com.mes.service.MesFlexApiClient;
|
|
|
+import com.mes.service.TuHanPlcClient;
|
|
|
+import com.mes.util.TuHanParamData;
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
|
|
|
@@ -22,95 +23,61 @@ import java.util.Map;
|
|
|
import java.util.concurrent.atomic.AtomicBoolean;
|
|
|
|
|
|
/**
|
|
|
- * 凸焊工位面板:柔性取码队列 + Modbus 读参。
|
|
|
+ * 凸焊工位面板:柔性取码队列 + S7 DB37。
|
|
|
* <p>
|
|
|
- * 取码 → 等焊机「运行」→ 每秒采参 → 运行结束 → uploadAndSubmit。
|
|
|
+ * 对齐 RealHuHan:MES允许/屏蔽/开始/结束仅作握手逻辑,页面只回显生产过程参数。
|
|
|
+ * 取码 → 写允许运行 → 等运行开始 → 每秒采参 → 运行结束 → uploadAndSubmit。
|
|
|
* </p>
|
|
|
*/
|
|
|
public class StationPanel extends JPanel {
|
|
|
|
|
|
- /** 日志 */
|
|
|
private static final Logger log = LoggerFactory.getLogger(StationPanel.class);
|
|
|
|
|
|
- /** 运行中采参最小间隔(毫秒),默认 1 秒一条 */
|
|
|
private static final long SAMPLE_INTERVAL_MS = 1000L;
|
|
|
|
|
|
- /**
|
|
|
- * 本工位业务阶段:
|
|
|
- * IDLE=空闲可取码;HOLD=已取码等焊机运行;RUN=焊接中采参;UPLOAD=正在上传过站。
|
|
|
- */
|
|
|
public enum Phase {
|
|
|
IDLE, HOLD, RUN, UPLOAD
|
|
|
}
|
|
|
|
|
|
- /** 本工位 yml 配置(工位编码、串口、标题等) */
|
|
|
private final MesClientProperties.StationConfig cfg;
|
|
|
- /** 凸焊 Modbus 客户端:连串口、读运行状态与过程参数 */
|
|
|
- private final TuHanModbusClient device;
|
|
|
- /** MES 服务 IP(拼 HTTP 地址用) */
|
|
|
+ private final TuHanPlcClient device;
|
|
|
private final String serverIp;
|
|
|
- /** 报工人工号;空则用 system(部分校验放行,过站仍按服务端规则) */
|
|
|
private final String userCode;
|
|
|
|
|
|
- /** 当前业务阶段(多线程可见,故 volatile) */
|
|
|
private volatile Phase phase = Phase.IDLE;
|
|
|
- /** 当前加工工件码;空表示本机还没有码 */
|
|
|
private volatile String currentSn = "";
|
|
|
- /** 本件焊接面标识(凸焊现固定/写入 TUHAN 一类值,历史上来自 A/B 面) */
|
|
|
private volatile String activeSide = "";
|
|
|
- /** 本件是否已经进入过「运行中」;用来判断「曾运行过又停下=焊接结束」 */
|
|
|
private volatile boolean seenRunning;
|
|
|
- /** 上次采参时间戳(毫秒),配合 SAMPLE_INTERVAL_MS 做节流 */
|
|
|
private volatile long lastSampleAtMs;
|
|
|
- /**
|
|
|
- * 运行中采到的参数列表;焊完后一次性 uploadAndSubmit,不在循环里逐条打库。
|
|
|
- * 主要由 tick / 上传线程访问。
|
|
|
- */
|
|
|
private final List<WeldParams> sampleBuffer = new ArrayList<WeldParams>();
|
|
|
- /**
|
|
|
- * 异步忙锁:取码/清码/上传进行中为 true。
|
|
|
- * true 时 tick 直接跳过,并挡住重复点击。
|
|
|
- */
|
|
|
private final AtomicBoolean busy = new AtomicBoolean(false);
|
|
|
|
|
|
- /** 顶栏:工位名称 */
|
|
|
private final JLabel lblStation;
|
|
|
- /** 顶栏:焊机串口连接状态文案 */
|
|
|
private final JLabel lblPlc;
|
|
|
- /** 顶栏:与 MES 的 SSE 心跳灯(绿=已连,红=断开) */
|
|
|
private final BreathingLight serverHeartbeat;
|
|
|
- /** 当前工件码显示框(只读) */
|
|
|
private final JTextField txtSn;
|
|
|
- /** 状态提示条(空闲/运行中/失败原因等) */
|
|
|
private final JLabel lblStatus;
|
|
|
- /** 过程参数:焊接电压 */
|
|
|
- private final JTextField txtVoltage;
|
|
|
- /** 过程参数:电流 */
|
|
|
- private final JTextField txtCurrent;
|
|
|
- /** 过程参数:加压时间(字段名沿用 wire,映射凸焊量) */
|
|
|
- private final JTextField txtWire;
|
|
|
- /** 过程参数:修模状态等(字段名沿用 side) */
|
|
|
- private final JTextField txtSide;
|
|
|
- /** 过程参数:JOB 号 */
|
|
|
- private final JTextField txtJobNo;
|
|
|
- /** 过程参数:错误码 */
|
|
|
- private final JTextField txtErrorCode;
|
|
|
- /** 过程参数:设备类型展示 */
|
|
|
- private final JTextField txtDeviceType;
|
|
|
- /** 按钮:向 MES 取下一个工件码 */
|
|
|
+
|
|
|
+ /** 生产过程参数回显(对齐 RealHuHan:只展示采参量,不展示握手点位) */
|
|
|
+ private final JTextField txtWeld1Current;
|
|
|
+ private final JTextField txtWeld1Time;
|
|
|
+ private final JTextField txtWeld2Current;
|
|
|
+ private final JTextField txtWeld2Time;
|
|
|
+ private final JTextField txtWeld3Current;
|
|
|
+ private final JTextField txtWeld3Time;
|
|
|
+ private final JTextField txtProduction;
|
|
|
+ private final JTextField txtFinished;
|
|
|
+
|
|
|
private final JButton btnNext;
|
|
|
- /** 按钮:调服务端清码并复位本机 */
|
|
|
private final JButton btnClear;
|
|
|
- /** 按钮:仅复位本机界面,不调服务端清码 */
|
|
|
private final JButton btnReset;
|
|
|
- /** 按钮:异常时强制把已采集合上传并过站 */
|
|
|
private final JButton btnForceUpload;
|
|
|
|
|
|
public StationPanel(MesClientProperties.StationConfig cfg, String serverIp, String userCode) {
|
|
|
this.cfg = cfg;
|
|
|
this.serverIp = serverIp == null ? "" : serverIp.trim();
|
|
|
this.userCode = (userCode == null || userCode.trim().isEmpty()) ? "system" : userCode.trim();
|
|
|
- this.device = new TuHanModbusClient(cfg);
|
|
|
+ this.device = new TuHanPlcClient(cfg);
|
|
|
|
|
|
setLayout(new BorderLayout(0, 0));
|
|
|
setBackground(UiTheme.BG);
|
|
|
@@ -135,7 +102,7 @@ public class StationPanel extends JPanel {
|
|
|
titleCol.add(lblStation);
|
|
|
titleCol.add(Box.createVerticalStrut(3));
|
|
|
titleCol.add(lblCode);
|
|
|
- lblPlc = new JLabel("焊机 " + device.getPortDesc() + " · 未连接");
|
|
|
+ lblPlc = new JLabel("PLC " + device.getPortDesc() + " · 未连接");
|
|
|
lblPlc.setFont(UiTheme.FONT_BODY);
|
|
|
UiTheme.stylePlcPill(lblPlc, false);
|
|
|
serverHeartbeat = new BreathingLight();
|
|
|
@@ -188,26 +155,27 @@ public class StationPanel extends JPanel {
|
|
|
|
|
|
JPanel paramCard = UiTheme.card();
|
|
|
paramCard.setLayout(new BorderLayout(0, 12));
|
|
|
- paramCard.add(UiTheme.sectionTitle("凸焊过程参数(运行中每秒刷新,结束后集合上传)"), BorderLayout.NORTH);
|
|
|
+ paramCard.add(UiTheme.sectionTitle("过程参数(运行中每秒刷新,结束后集合上传)"), BorderLayout.NORTH);
|
|
|
JPanel paramGrid = new JPanel(new GridLayout(4, 2, 12, 12));
|
|
|
paramGrid.setOpaque(false);
|
|
|
- txtVoltage = UiTheme.valueField();
|
|
|
- txtCurrent = UiTheme.valueField();
|
|
|
- txtWire = UiTheme.valueField();
|
|
|
- txtSide = UiTheme.valueField();
|
|
|
- txtJobNo = UiTheme.valueField();
|
|
|
- txtErrorCode = UiTheme.valueField();
|
|
|
- txtDeviceType = UiTheme.valueField();
|
|
|
- paramGrid.add(UiTheme.paramTile("焊接电压", txtVoltage, UiTheme.STRIPE_VOLT));
|
|
|
- paramGrid.add(UiTheme.paramTile("电流", txtCurrent, UiTheme.STRIPE_AMP));
|
|
|
- paramGrid.add(UiTheme.paramTile("加压时间", txtWire, UiTheme.STRIPE_WIRE));
|
|
|
- paramGrid.add(UiTheme.paramTile("修模状态", txtSide, UiTheme.STRIPE_SIDE));
|
|
|
- paramGrid.add(UiTheme.paramTile("JOB号", txtJobNo, UiTheme.STRIPE_JOB));
|
|
|
- paramGrid.add(UiTheme.paramTile("错误代码", txtErrorCode, UiTheme.STRIPE_ERR));
|
|
|
- paramGrid.add(UiTheme.paramTile("设备", txtDeviceType, UiTheme.STRIPE_DEV));
|
|
|
- JPanel filler = new JPanel();
|
|
|
- filler.setOpaque(false);
|
|
|
- paramGrid.add(filler);
|
|
|
+
|
|
|
+ txtWeld1Current = UiTheme.valueField();
|
|
|
+ txtWeld1Time = UiTheme.valueField();
|
|
|
+ txtWeld2Current = UiTheme.valueField();
|
|
|
+ txtWeld2Time = UiTheme.valueField();
|
|
|
+ txtWeld3Current = UiTheme.valueField();
|
|
|
+ txtWeld3Time = UiTheme.valueField();
|
|
|
+ txtProduction = UiTheme.valueField();
|
|
|
+ txtFinished = UiTheme.valueField();
|
|
|
+
|
|
|
+ paramGrid.add(UiTheme.paramTile("焊1电流", txtWeld1Current, UiTheme.STRIPE_AMP));
|
|
|
+ paramGrid.add(UiTheme.paramTile("焊1时间", txtWeld1Time, UiTheme.STRIPE_WIRE));
|
|
|
+ paramGrid.add(UiTheme.paramTile("焊2电流", txtWeld2Current, UiTheme.STRIPE_AMP));
|
|
|
+ paramGrid.add(UiTheme.paramTile("焊2时间", txtWeld2Time, UiTheme.STRIPE_WIRE));
|
|
|
+ paramGrid.add(UiTheme.paramTile("焊3电流", txtWeld3Current, UiTheme.STRIPE_AMP));
|
|
|
+ paramGrid.add(UiTheme.paramTile("焊3时间", txtWeld3Time, UiTheme.STRIPE_WIRE));
|
|
|
+ paramGrid.add(UiTheme.paramTile("生产量计数", txtProduction, UiTheme.STRIPE_JOB));
|
|
|
+ paramGrid.add(UiTheme.paramTile("成品产量计数", txtFinished, UiTheme.STRIPE_VOLT));
|
|
|
paramGrid.setPreferredSize(new Dimension(680, 320));
|
|
|
paramCard.add(paramGrid, BorderLayout.CENTER);
|
|
|
|
|
|
@@ -229,7 +197,7 @@ public class StationPanel extends JPanel {
|
|
|
actions.setBorder(BorderFactory.createCompoundBorder(
|
|
|
BorderFactory.createMatteBorder(3, 0, 0, 0, UiTheme.ACCENT),
|
|
|
new EmptyBorder(12, 16, 14, 16)));
|
|
|
- JLabel tip = UiTheme.mutedLabel("取码后等焊机运行 → 运行中每秒采参 → 结束 uploadAndSubmit;扫错可清码");
|
|
|
+ JLabel tip = UiTheme.mutedLabel("取码写允许运行 → 等运行开始采参 → 运行结束 uploadAndSubmit;扫错可清码");
|
|
|
JPanel btns = new JPanel(new FlowLayout(FlowLayout.RIGHT, 10, 0));
|
|
|
btns.setOpaque(false);
|
|
|
btnReset = UiTheme.ghostBtn("复位");
|
|
|
@@ -237,6 +205,7 @@ public class StationPanel extends JPanel {
|
|
|
btnReset.addActionListener(new ActionListener() {
|
|
|
@Override
|
|
|
public void actionPerformed(ActionEvent e) {
|
|
|
+ device.setMesAllowEntry(false);
|
|
|
resetToIdle("已手动复位");
|
|
|
}
|
|
|
});
|
|
|
@@ -296,7 +265,6 @@ public class StationPanel extends JPanel {
|
|
|
return phase;
|
|
|
}
|
|
|
|
|
|
- /** SSE / 兜底:空闲则取码(工位级,不分 A/B) */
|
|
|
public void tryAutoNextFromPush() {
|
|
|
if (phase != Phase.IDLE) {
|
|
|
log.debug("工位[{}] phase={} 忽略推送取码", cfg.getStationSn(), phase);
|
|
|
@@ -305,7 +273,6 @@ public class StationPanel extends JPanel {
|
|
|
requestNextAsync();
|
|
|
}
|
|
|
|
|
|
- /** 兼容带工位参数的门铃(忽略面,只认本工位) */
|
|
|
public void tryAutoNextFromPush(String enqueueStationSn) {
|
|
|
if (!ownsStationSn(enqueueStationSn)) {
|
|
|
return;
|
|
|
@@ -313,10 +280,6 @@ public class StationPanel extends JPanel {
|
|
|
tryAutoNextFromPush();
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * SSE 清码门铃:若本机正占用同一工件码,复位界面并关 L180。
|
|
|
- * 不匹配则忽略(本工位其它码或空闲)。
|
|
|
- */
|
|
|
public void applyClearedFromPush(String clearedSn) {
|
|
|
String local = nvl(currentSn);
|
|
|
String remote = nvl(clearedSn);
|
|
|
@@ -345,35 +308,42 @@ public class StationPanel extends JPanel {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * HOLD:等焊机进入「运行」;
|
|
|
- * RUN:运行中每秒采参;回到非运行则集合一次性上传。
|
|
|
- * 凸焊无 A/B 面,activeSide 固定 TW。
|
|
|
+ * HOLD:读握手位等运行开始;
|
|
|
+ * RUN:每秒采生产参数回显;运行结束则上传。
|
|
|
*/
|
|
|
public void tick() {
|
|
|
if (busy.get()) {
|
|
|
+ uiPlcLabel();
|
|
|
+ uiServerHeartbeat();
|
|
|
return;
|
|
|
}
|
|
|
try {
|
|
|
if (phase == Phase.HOLD) {
|
|
|
- if (device.isRunning()) {
|
|
|
+ TuHanParamData d = device.readRaw();
|
|
|
+ if (d != null && d.connected && d.runStart) {
|
|
|
activeSide = "TUHAN";
|
|
|
seenRunning = false;
|
|
|
lastSampleAtMs = 0L;
|
|
|
sampleBuffer.clear();
|
|
|
- device.setMesAllowEntry(false);
|
|
|
phase = Phase.RUN;
|
|
|
- setStatusUi("焊机运行中,每秒采参...");
|
|
|
+ setStatusUi(d.mesShield ? "MES已屏蔽,设备已开始,每秒采参..." : "设备运行中,每秒采参...");
|
|
|
collectSampleIfDue(true);
|
|
|
+ } else if (d != null && d.connected && d.mesShield) {
|
|
|
+ setStatusUi("已取码,MES已屏蔽(设备可不经允许运行)");
|
|
|
}
|
|
|
} else if (phase == Phase.RUN) {
|
|
|
- boolean running = device.isRunning();
|
|
|
+ TuHanParamData d = device.readRaw();
|
|
|
+ boolean running = d != null && d.connected && d.runStart;
|
|
|
+ boolean ended = d != null && d.connected && d.runEnd;
|
|
|
if (running) {
|
|
|
seenRunning = true;
|
|
|
collectSampleIfDue(false);
|
|
|
- setStatusUi("焊机运行中,已采 " + sampleBuffer.size() + " 点");
|
|
|
- } else if (seenRunning) {
|
|
|
+ setStatusUi("设备运行中,已采 " + sampleBuffer.size() + " 点"
|
|
|
+ + (d.mesShield ? "(MES屏蔽)" : ""));
|
|
|
+ }
|
|
|
+ if (ended || (seenRunning && !running)) {
|
|
|
collectSampleIfDue(true);
|
|
|
- setStatusUi("焊接结束,上传 " + sampleBuffer.size() + " 点...");
|
|
|
+ setStatusUi("运行结束,上传 " + sampleBuffer.size() + " 点...");
|
|
|
uploadAndSubmitAsync();
|
|
|
}
|
|
|
}
|
|
|
@@ -384,9 +354,6 @@ public class StationPanel extends JPanel {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * 运行中采参:默认每秒一条;force=true 时忽略间隔(进入 RUN / 结束前补采)。
|
|
|
- */
|
|
|
private void collectSampleIfDue(boolean force) {
|
|
|
long now = System.currentTimeMillis();
|
|
|
if (!force && lastSampleAtMs > 0L && (now - lastSampleAtMs) < SAMPLE_INTERVAL_MS) {
|
|
|
@@ -411,12 +378,9 @@ public class StationPanel extends JPanel {
|
|
|
busy.set(false);
|
|
|
}
|
|
|
}
|
|
|
- }, "hg-next-" + cfg.getStationSn()).start();
|
|
|
+ }, "tuhan-next-" + cfg.getStationSn()).start();
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * 清码前确认:必须有当前工件码;确认后调服务端 clear(sn+stationSn)。
|
|
|
- */
|
|
|
private void requestClearWithConfirm() {
|
|
|
final String sn = nvl(currentSn);
|
|
|
if (sn.isEmpty()) {
|
|
|
@@ -439,7 +403,6 @@ public class StationPanel extends JPanel {
|
|
|
requestClearAsync(sn);
|
|
|
}
|
|
|
|
|
|
- /** 异步清码:调 mesFlexQueue/clear,成功后复位 */
|
|
|
private void requestClearAsync(final String sn) {
|
|
|
if (!busy.compareAndSet(false, true)) {
|
|
|
return;
|
|
|
@@ -454,7 +417,7 @@ public class StationPanel extends JPanel {
|
|
|
busy.set(false);
|
|
|
}
|
|
|
}
|
|
|
- }, "hg-clear-" + cfg.getStationSn()).start();
|
|
|
+ }, "tuhan-clear-" + cfg.getStationSn()).start();
|
|
|
}
|
|
|
|
|
|
private void doClear(String sn) {
|
|
|
@@ -496,11 +459,14 @@ public class StationPanel extends JPanel {
|
|
|
@Override
|
|
|
public void run() {
|
|
|
txtSn.setText(sn);
|
|
|
- txtSide.setText("");
|
|
|
}
|
|
|
});
|
|
|
- device.setMesAllowEntry(true);
|
|
|
- setStatusUi("已取码,等待焊机进入运行");
|
|
|
+ boolean allowOk = device.setMesAllowEntry(true);
|
|
|
+ if (!allowOk) {
|
|
|
+ setStatusUi("已取码,但写 MES允许运行 失败,请检查 PLC");
|
|
|
+ } else {
|
|
|
+ setStatusUi("已取码,已写允许运行,等待运行开始");
|
|
|
+ }
|
|
|
MainFrame.setMenuStatus(cfg.getStationSn() + " 取码成功 " + sn, 0);
|
|
|
}
|
|
|
|
|
|
@@ -535,10 +501,6 @@ public class StationPanel extends JPanel {
|
|
|
}, "tuhan-upload-" + cfg.getStationSn()).start();
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * 把运行中采样集合一次性 uploadAndSubmit。
|
|
|
- * 字段对齐 mesFlexHg;凸焊过程量映射到 voltage/current/wireSpeed(加压时间)/side(修模状态)。
|
|
|
- */
|
|
|
private void doUploadAndSubmit() {
|
|
|
final String sn = currentSn;
|
|
|
if (sn == null || sn.trim().isEmpty()) {
|
|
|
@@ -583,7 +545,6 @@ public class StationPanel extends JPanel {
|
|
|
MainFrame.setMenuStatus(cfg.getStationSn() + " 完成 " + sn, 0);
|
|
|
}
|
|
|
|
|
|
- /** 采样集合 → JSON 数组字符串(服务端 samples / samplesJson) */
|
|
|
private static String toSamplesJson(List<WeldParams> samples) {
|
|
|
JSONArray arr = new JSONArray();
|
|
|
if (samples != null) {
|
|
|
@@ -599,6 +560,18 @@ public class StationPanel extends JPanel {
|
|
|
o.put("jobNo", nvl(wp.jobNo));
|
|
|
o.put("errorCode", nvl(wp.errorCode));
|
|
|
o.put("side", nvl(wp.side));
|
|
|
+ o.put("production", wp.productionCount);
|
|
|
+ o.put("finished", wp.finishedCount);
|
|
|
+ o.put("weld1Current", wp.weld1Current);
|
|
|
+ o.put("weld1Time", wp.weld1Time);
|
|
|
+ o.put("weld2Current", wp.weld2Current);
|
|
|
+ o.put("weld2Time", wp.weld2Time);
|
|
|
+ o.put("weld3Current", wp.weld3Current);
|
|
|
+ o.put("weld3Time", wp.weld3Time);
|
|
|
+ o.put("upperDress", wp.upperElectrodeDressCount);
|
|
|
+ o.put("lowerDress", wp.lowerElectrodeDressCount);
|
|
|
+ o.put("upperReplace", wp.upperElectrodeReplaceCount);
|
|
|
+ o.put("lowerReplace", wp.lowerElectrodeReplaceCount);
|
|
|
arr.add(o);
|
|
|
}
|
|
|
}
|
|
|
@@ -616,13 +589,14 @@ public class StationPanel extends JPanel {
|
|
|
@Override
|
|
|
public void run() {
|
|
|
txtSn.setText("");
|
|
|
- txtVoltage.setText("");
|
|
|
- txtCurrent.setText("");
|
|
|
- txtWire.setText("");
|
|
|
- txtSide.setText("");
|
|
|
- txtJobNo.setText("");
|
|
|
- txtErrorCode.setText("");
|
|
|
- txtDeviceType.setText("");
|
|
|
+ txtWeld1Current.setText("");
|
|
|
+ txtWeld1Time.setText("");
|
|
|
+ txtWeld2Current.setText("");
|
|
|
+ txtWeld2Time.setText("");
|
|
|
+ txtWeld3Current.setText("");
|
|
|
+ txtWeld3Time.setText("");
|
|
|
+ txtProduction.setText("");
|
|
|
+ txtFinished.setText("");
|
|
|
lblStatus.setText(msg);
|
|
|
}
|
|
|
});
|
|
|
@@ -634,11 +608,11 @@ public class StationPanel extends JPanel {
|
|
|
public void run() {
|
|
|
lblStatus.setText(text == null ? "" : text);
|
|
|
String t = text == null ? "" : text;
|
|
|
- if (t.contains("失败") || t.contains("异常")) {
|
|
|
+ if (t.contains("失败") || t.contains("异常") || t.contains("报警")) {
|
|
|
lblStatus.setBackground(UiTheme.ERR_BG);
|
|
|
lblStatus.setForeground(UiTheme.ERR_FG);
|
|
|
- } else if (t.contains("运行") || t.contains("上传") || t.contains("过站") || t.contains("取码")
|
|
|
- || t.contains("等待") || t.contains("识别") || t.contains("采")) {
|
|
|
+ } else if (t.contains("屏蔽") || t.contains("运行") || t.contains("上传") || t.contains("过站")
|
|
|
+ || t.contains("取码") || t.contains("等待") || t.contains("采")) {
|
|
|
lblStatus.setBackground(UiTheme.RUN_BG);
|
|
|
lblStatus.setForeground(UiTheme.RUN_FG);
|
|
|
} else {
|
|
|
@@ -656,13 +630,14 @@ public class StationPanel extends JPanel {
|
|
|
SwingUtilities.invokeLater(new Runnable() {
|
|
|
@Override
|
|
|
public void run() {
|
|
|
- txtVoltage.setText(nvl(wp.voltage));
|
|
|
- txtCurrent.setText(nvl(wp.currentVal));
|
|
|
- txtWire.setText(nvl(wp.wireSpeed));
|
|
|
- txtSide.setText(nvl(wp.side));
|
|
|
- txtJobNo.setText(nvl(wp.jobNo));
|
|
|
- txtErrorCode.setText(nvl(wp.errorCode));
|
|
|
- txtDeviceType.setText(nvl(wp.deviceType));
|
|
|
+ txtWeld1Current.setText(String.valueOf(wp.weld1Current));
|
|
|
+ txtWeld1Time.setText(String.valueOf(wp.weld1Time));
|
|
|
+ txtWeld2Current.setText(String.valueOf(wp.weld2Current));
|
|
|
+ txtWeld2Time.setText(String.valueOf(wp.weld2Time));
|
|
|
+ txtWeld3Current.setText(String.valueOf(wp.weld3Current));
|
|
|
+ txtWeld3Time.setText(String.valueOf(wp.weld3Time));
|
|
|
+ txtProduction.setText(String.valueOf(wp.productionCount));
|
|
|
+ txtFinished.setText(String.valueOf(wp.finishedCount));
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
@@ -670,21 +645,27 @@ public class StationPanel extends JPanel {
|
|
|
private void uiPlcLabel() {
|
|
|
final boolean ok = device.isConnected();
|
|
|
final boolean run = ok && device.isDeviceRunning();
|
|
|
+ final boolean shield = ok && device.isMesShield();
|
|
|
SwingUtilities.invokeLater(new Runnable() {
|
|
|
@Override
|
|
|
public void run() {
|
|
|
if (ok) {
|
|
|
- lblPlc.setText("焊机 " + device.getPortDesc() + " · 已连接" + (run ? " · 设备运行" : ""));
|
|
|
+ String extra = "";
|
|
|
+ if (shield) {
|
|
|
+ extra = " · MES屏蔽";
|
|
|
+ } else if (run) {
|
|
|
+ extra = " · 设备运行";
|
|
|
+ }
|
|
|
+ lblPlc.setText("PLC " + device.getPortDesc() + " · 已连接" + extra);
|
|
|
UiTheme.stylePlcPill(lblPlc, true);
|
|
|
} else {
|
|
|
- lblPlc.setText("焊机 " + device.getPortDesc() + " · 未连接");
|
|
|
+ lblPlc.setText("PLC " + device.getPortDesc() + " · 未连接");
|
|
|
UiTheme.stylePlcPill(lblPlc, false);
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
|
|
|
- /** 按 MainFrame SSE 连接状态刷新呼吸灯 */
|
|
|
private void uiServerHeartbeat() {
|
|
|
final boolean online = MainFrame.isMesServerOnline();
|
|
|
SwingUtilities.invokeLater(new Runnable() {
|