|
|
@@ -1,7 +1,6 @@
|
|
|
package com.mes.ui;
|
|
|
|
|
|
import com.mes.config.MesClientProperties;
|
|
|
-import com.mes.service.DcBatchPrinter;
|
|
|
import com.mes.service.MesFlexQueuePushClient;
|
|
|
import com.mes.util.SingleInstanceLock;
|
|
|
import com.mes.util.UiImages;
|
|
|
@@ -24,7 +23,6 @@ import java.util.concurrent.atomic.AtomicInteger;
|
|
|
|
|
|
/**
|
|
|
* 一拖二大冲主窗:两台压机各自独立周期 / 结案;取批次订 SSE 门铃 + 断线慢轮询兜底。
|
|
|
- * 支持手动打印模式:结案入打印列表,工人确认后再送打。
|
|
|
*/
|
|
|
public class MainFrame extends JFrame {
|
|
|
|
|
|
@@ -40,8 +38,6 @@ public class MainFrame extends JFrame {
|
|
|
private static MesClientProperties props;
|
|
|
private static final List<StationPanel> stationPanels = new ArrayList<StationPanel>();
|
|
|
private static WorkRecordPanel workRecordPanel;
|
|
|
- /** 打印列表页(结案入队 / 手动送打后刷新) */
|
|
|
- private static PrintListPanel printListPanel;
|
|
|
/** 取码队列 SSE(入队门铃 / 清码) */
|
|
|
private static MesFlexQueuePushClient pushClient;
|
|
|
/** SSE 断线时 IDLE 慢轮询 nextBatch */
|
|
|
@@ -102,9 +98,7 @@ public class MainFrame extends JFrame {
|
|
|
if (mes_app_title.isEmpty()) {
|
|
|
mes_app_title = "MES 一拖二大冲";
|
|
|
}
|
|
|
- DcBatchPrinter.setPrinterName(p.getPrinterName());
|
|
|
mes_allow_enabled = p.isMesAllowEnabled();
|
|
|
- log.info("打印机配置 name={}", trim(p.getPrinterName()).isEmpty() ? "(系统默认)" : trim(p.getPrinterName()));
|
|
|
log.info("MES允许开关 mes-allow-enabled={}", Boolean.valueOf(mes_allow_enabled));
|
|
|
List<MesClientProperties.StationConfig> list = p.getStations();
|
|
|
if (list == null || list.isEmpty()) {
|
|
|
@@ -149,7 +143,7 @@ public class MainFrame extends JFrame {
|
|
|
}
|
|
|
|
|
|
public MainFrame() {
|
|
|
- setIconImage(Toolkit.getDefaultToolkit().getImage(UiImages.icon("logo.png")));
|
|
|
+ setIconImage(Toolkit.getDefaultToolkit().getImage(UiImages.icon("dayang-mes.png")));
|
|
|
setTitle(mes_app_title);
|
|
|
setBounds(40, 40, 1280, 720);
|
|
|
setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);
|
|
|
@@ -208,7 +202,6 @@ public class MainFrame extends JFrame {
|
|
|
cards.setOpaque(false);
|
|
|
final List<JButton> stationNavBtns = new ArrayList<JButton>();
|
|
|
final JButton btnRecord = navBtn("工作记录", false);
|
|
|
- final JButton btnPrintList = navBtn("打印列表", false);
|
|
|
|
|
|
for (int i = 0; i < stations.size(); i++) {
|
|
|
MesClientProperties.StationConfig sc = stations.get(i);
|
|
|
@@ -228,14 +221,11 @@ public class MainFrame extends JFrame {
|
|
|
styleNavSelected(stationNavBtns.get(j), j == idx);
|
|
|
}
|
|
|
styleNavSelected(btnRecord, false);
|
|
|
- styleNavSelected(btnPrintList, false);
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
workRecordPanel = new WorkRecordPanel();
|
|
|
- printListPanel = new PrintListPanel();
|
|
|
cards.add(workRecordPanel, "record");
|
|
|
- cards.add(printListPanel, "print");
|
|
|
|
|
|
final JButton btnSettings = navBtn("设置", false);
|
|
|
// 重量级弹出,避免被卡片层盖住像点了没反应
|
|
|
@@ -265,34 +255,9 @@ public class MainFrame extends JFrame {
|
|
|
});
|
|
|
settingsMenu.add(miNext);
|
|
|
settingsMenu.add(miManual);
|
|
|
- settingsMenu.addSeparator();
|
|
|
- // 设置 → 打印:总开关;关则自动/列表都不送打
|
|
|
- final JCheckBoxMenuItem miPrint = new JCheckBoxMenuItem("打印");
|
|
|
- miPrint.setFont(new Font("微软雅黑", Font.PLAIN, 14));
|
|
|
- miPrint.setSelected(DcBatchPrinter.isPrintEnabled());
|
|
|
- miPrint.addActionListener(new ActionListener() {
|
|
|
- @Override
|
|
|
- public void actionPerformed(ActionEvent e) {
|
|
|
- DcBatchPrinter.setPrintEnabled(miPrint.isSelected());
|
|
|
- }
|
|
|
- });
|
|
|
- settingsMenu.add(miPrint);
|
|
|
- // 设置 → 手动打印:开=结案入列表;关=结案自动打
|
|
|
- final JCheckBoxMenuItem miManualPrint = new JCheckBoxMenuItem("手动打印");
|
|
|
- miManualPrint.setFont(new Font("微软雅黑", Font.PLAIN, 14));
|
|
|
- miManualPrint.setSelected(DcBatchPrinter.isManualPrintMode());
|
|
|
- miManualPrint.addActionListener(new ActionListener() {
|
|
|
- @Override
|
|
|
- public void actionPerformed(ActionEvent e) {
|
|
|
- DcBatchPrinter.setManualPrintMode(miManualPrint.isSelected());
|
|
|
- }
|
|
|
- });
|
|
|
- settingsMenu.add(miManualPrint);
|
|
|
btnSettings.addActionListener(new ActionListener() {
|
|
|
@Override
|
|
|
public void actionPerformed(ActionEvent e) {
|
|
|
- miPrint.setSelected(DcBatchPrinter.isPrintEnabled());
|
|
|
- miManualPrint.setSelected(DcBatchPrinter.isManualPrintMode());
|
|
|
settingsMenu.show(btnSettings, 0, btnSettings.getHeight());
|
|
|
}
|
|
|
});
|
|
|
@@ -304,21 +269,6 @@ public class MainFrame extends JFrame {
|
|
|
styleNavSelected(stationNavBtns.get(j), false);
|
|
|
}
|
|
|
styleNavSelected(btnRecord, true);
|
|
|
- styleNavSelected(btnPrintList, false);
|
|
|
- }
|
|
|
- });
|
|
|
- btnPrintList.addActionListener(new ActionListener() {
|
|
|
- @Override
|
|
|
- public void actionPerformed(ActionEvent e) {
|
|
|
- ((CardLayout) cards.getLayout()).show(cards, "print");
|
|
|
- for (int j = 0; j < stationNavBtns.size(); j++) {
|
|
|
- styleNavSelected(stationNavBtns.get(j), false);
|
|
|
- }
|
|
|
- styleNavSelected(btnRecord, false);
|
|
|
- styleNavSelected(btnPrintList, true);
|
|
|
- if (printListPanel != null) {
|
|
|
- printListPanel.reload();
|
|
|
- }
|
|
|
}
|
|
|
});
|
|
|
|
|
|
@@ -331,7 +281,6 @@ public class MainFrame extends JFrame {
|
|
|
nav.add(b);
|
|
|
}
|
|
|
nav.add(btnRecord);
|
|
|
- nav.add(btnPrintList);
|
|
|
|
|
|
JPanel page = new JPanel(new BorderLayout(0, 0));
|
|
|
page.setOpaque(false);
|
|
|
@@ -379,21 +328,9 @@ public class MainFrame extends JFrame {
|
|
|
});
|
|
|
}
|
|
|
|
|
|
- /** 结案入队 / 送打后刷新打印列表 */
|
|
|
- public static void refreshPrintList() {
|
|
|
- SwingUtilities.invokeLater(new Runnable() {
|
|
|
- @Override
|
|
|
- public void run() {
|
|
|
- if (printListPanel != null) {
|
|
|
- printListPanel.reload();
|
|
|
- }
|
|
|
- }
|
|
|
- });
|
|
|
- }
|
|
|
-
|
|
|
/** 每台压机各自 startStationLoop,共享 Timer/线程池一律不用 */
|
|
|
private static void startStationLoops() {
|
|
|
- int period = 500;
|
|
|
+ int period = 1000;
|
|
|
if (props != null && props.getTickMs() > 0) {
|
|
|
period = props.getTickMs();
|
|
|
}
|