|
|
@@ -118,6 +118,10 @@ public class StationPanel extends JPanel {
|
|
|
|
|
|
private final JLabel lblStation;
|
|
|
private final JLabel lblStatus;
|
|
|
+ /** 顶栏运行态徽章:采集中 / 空闲·待扫码 / 空闲·已开批 / 上传收尾 */
|
|
|
+ private final JLabel lblPhase;
|
|
|
+ /** 本批区运行态示值(与徽章同步) */
|
|
|
+ private final JTextField txtPhase;
|
|
|
private final JTextField txtBatch;
|
|
|
private final JTextField txtDieHeight;
|
|
|
private final JTextField txtStrokeCount;
|
|
|
@@ -177,10 +181,17 @@ public class StationPanel extends JPanel {
|
|
|
lblPlcState = headerStateLabel("未连接");
|
|
|
lampMesAllow = new StatusLight();
|
|
|
lblMesAllowState = headerStateLabel("关");
|
|
|
+ lblPhase = new JLabel("空闲·待扫码");
|
|
|
+ lblPhase.setFont(new Font("微软雅黑", Font.BOLD, 18));
|
|
|
+ lblPhase.setOpaque(true);
|
|
|
+ lblPhase.setBorder(new EmptyBorder(6, 14, 6, 14));
|
|
|
+ lblPhase.setBackground(UiTheme.OK_BG);
|
|
|
+ lblPhase.setForeground(UiTheme.OK_FG);
|
|
|
|
|
|
JPanel east = new JPanel(new FlowLayout(FlowLayout.RIGHT, 14, 0));
|
|
|
east.setOpaque(false);
|
|
|
- // 每台压机一套:MES 服务端呼吸灯 + PLC + MES允许
|
|
|
+ // 每台压机一套:运行态 + MES 服务端呼吸灯 + PLC + MES允许
|
|
|
+ east.add(lblPhase);
|
|
|
east.add(headerBreathingItem("MES", serverHeartbeat));
|
|
|
east.add(headerLampItem("PLC", lampPlc, lblPlcState));
|
|
|
east.add(headerLampItem("MES允许", lampMesAllow, lblMesAllowState));
|
|
|
@@ -207,11 +218,14 @@ public class StationPanel extends JPanel {
|
|
|
JPanel batchCard = UiTheme.card();
|
|
|
batchCard.setLayout(new BorderLayout(0, 10));
|
|
|
batchCard.add(UiTheme.sectionTitle("本批"), BorderLayout.NORTH);
|
|
|
- JPanel batchGrid = new JPanel(new GridLayout(1, 1, 14, 0));
|
|
|
+ JPanel batchGrid = new JPanel(new GridLayout(1, 2, 14, 0));
|
|
|
batchGrid.setOpaque(false);
|
|
|
batchGrid.setPreferredSize(new Dimension(10, UiTheme.TILE_PREF_H));
|
|
|
txtBatch = roField();
|
|
|
+ txtPhase = roField();
|
|
|
+ txtPhase.setText("空闲·待扫码");
|
|
|
batchGrid.add(UiTheme.paramTile("批次码", txtBatch, UiTheme.STRIPE_SIDE));
|
|
|
+ batchGrid.add(UiTheme.paramTile("运行状态", txtPhase, UiTheme.STRIPE_SIDE));
|
|
|
batchCard.add(batchGrid, BorderLayout.CENTER);
|
|
|
|
|
|
JPanel runCard = UiTheme.card();
|
|
|
@@ -1741,17 +1755,49 @@ public class StationPanel extends JPanel {
|
|
|
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("开批")) {
|
|
|
+ } else if (t.contains("采集中") || t.contains("生产中") || t.contains("已开") || t.contains("开批")) {
|
|
|
lblStatus.setBackground(UiTheme.RUN_BG);
|
|
|
lblStatus.setForeground(UiTheme.RUN_FG);
|
|
|
} else {
|
|
|
lblStatus.setBackground(UiTheme.OK_BG);
|
|
|
lblStatus.setForeground(UiTheme.OK_FG);
|
|
|
}
|
|
|
+ refreshPhaseBadgeOnEdt();
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 刷新顶栏/本批「运行状态」:采集中、空闲·待扫码、空闲·已开批、上传收尾。
|
|
|
+ * 须在 EDT 调用(由 setStatusUi 等触发)。
|
|
|
+ */
|
|
|
+ private void refreshPhaseBadgeOnEdt() {
|
|
|
+ String label;
|
|
|
+ Color bg;
|
|
|
+ Color fg;
|
|
|
+ if (phase == Phase.RUN) {
|
|
|
+ label = "采集中";
|
|
|
+ bg = UiTheme.RUN_BG;
|
|
|
+ fg = UiTheme.RUN_FG;
|
|
|
+ } else if (phase == Phase.DONE) {
|
|
|
+ label = "上传收尾";
|
|
|
+ bg = UiTheme.ERR_BG;
|
|
|
+ fg = UiTheme.ERR_FG;
|
|
|
+ } else if (!nvl(batchCode).isEmpty()) {
|
|
|
+ label = "空闲·已开批";
|
|
|
+ bg = new Color(254, 243, 199);
|
|
|
+ fg = UiTheme.WARN_FG;
|
|
|
+ } else {
|
|
|
+ label = "空闲·待扫码";
|
|
|
+ bg = UiTheme.OK_BG;
|
|
|
+ fg = UiTheme.OK_FG;
|
|
|
+ }
|
|
|
+ lblPhase.setText(label);
|
|
|
+ lblPhase.setBackground(bg);
|
|
|
+ lblPhase.setForeground(fg);
|
|
|
+ setText(txtPhase, label);
|
|
|
+ }
|
|
|
+
|
|
|
private static JTextField roField() {
|
|
|
JTextField t = new JTextField();
|
|
|
t.setEditable(false);
|