|
|
@@ -105,16 +105,26 @@ public class MesClient extends JFrame {
|
|
|
|
|
|
public static SerialPort serialPort; // 串口对象
|
|
|
|
|
|
- // 镭雕相关
|
|
|
- public static JButton laser_get_code_bt; // 获取镭雕码按钮
|
|
|
- public static JButton laser_reset_bt; // 人工复位按钮
|
|
|
+ // 镭雕相关(新方案:定时轮询 + 手动补录 + 手动补打 + 解绑)
|
|
|
public static LaserFlowManager laserFlowManager;
|
|
|
- public static JTextField manualSteelSnInput;
|
|
|
- public static JButton manualGetCodeBt;
|
|
|
- public static JButton manualFinishOkBt;
|
|
|
- public static JButton manualUnbindBt;
|
|
|
- private static boolean manualWaitingComplete = false;
|
|
|
- private static boolean manualCompleting = false;
|
|
|
+ public static com.mes.component.SwitchButton autoPrintToggleBt; // 自动打印开关(左右拨动)
|
|
|
+ public static JLabel pendingCountLabel; // 待打印数量显示
|
|
|
+ public static JTextField manualSteelSnInput; // 手工输入钢印码
|
|
|
+ public static JButton submitAndPrintBt; // 提交并打印(本地补录)
|
|
|
+ // 5 行队列 UI:有已打印时顶部占一行绿框,否则全部行显示 pending,末尾每行一个"打印"按钮
|
|
|
+ public static final int QUEUE_ROWS = 5;
|
|
|
+ public static JPanel[] queueRowPanels = new JPanel[QUEUE_ROWS];
|
|
|
+ public static JLabel[] queueSteelLabels = new JLabel[QUEUE_ROWS];
|
|
|
+ public static JLabel[] queueCustomerLabels = new JLabel[QUEUE_ROWS];
|
|
|
+ public static JLabel[] queueStatusLabels = new JLabel[QUEUE_ROWS];
|
|
|
+ public static JButton[] queuePrintButtons = new JButton[QUEUE_ROWS];
|
|
|
+ private static final javax.swing.border.Border BORDER_EMPTY_ROW =
|
|
|
+ BorderFactory.createLineBorder(new Color(220, 220, 220), 1);
|
|
|
+ private static final javax.swing.border.Border BORDER_PENDING_ROW =
|
|
|
+ BorderFactory.createLineBorder(new Color(160, 160, 160), 1);
|
|
|
+ private static final javax.swing.border.Border BORDER_DONE_ROW =
|
|
|
+ BorderFactory.createLineBorder(new Color(46, 160, 67), 3);
|
|
|
+ private static boolean laserBusy = false; // 打印进行中,禁用按钮防止重复点击
|
|
|
private static final ExecutorService laserActionExecutor = Executors.newSingleThreadExecutor();
|
|
|
|
|
|
public static void main(String[] args) {
|
|
|
@@ -378,27 +388,63 @@ public class MesClient extends JFrame {
|
|
|
return manualSteelSnInput != null && manualSteelSnInput.getText().trim().length() == 11;
|
|
|
}
|
|
|
|
|
|
+ /** 根据当前 laserBusy 和输入框状态更新按钮 enable */
|
|
|
private static void updateManualSubmitButtons() {
|
|
|
boolean ready = isManualSteelSnReady();
|
|
|
- if (manualGetCodeBt != null) {
|
|
|
- manualGetCodeBt.setEnabled(!manualWaitingComplete && ready);
|
|
|
+ if (submitAndPrintBt != null) {
|
|
|
+ submitAndPrintBt.setEnabled(!laserBusy && ready);
|
|
|
}
|
|
|
- if (manualFinishOkBt != null) {
|
|
|
- manualFinishOkBt.setEnabled(manualWaitingComplete && !manualCompleting);
|
|
|
- }
|
|
|
- if (manualUnbindBt != null) {
|
|
|
- manualUnbindBt.setEnabled(!manualWaitingComplete && !manualCompleting && ready);
|
|
|
+ // 队列每行的打印按钮:只有非 busy 且该行是"待打印"状态才可用
|
|
|
+ for (int i = 0; i < queuePrintButtons.length; i++) {
|
|
|
+ if (queuePrintButtons[i] != null && queuePrintButtons[i].isVisible()) {
|
|
|
+ queuePrintButtons[i].setEnabled(!laserBusy);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- private static void resetManualSubmitPanel(boolean clearInput) {
|
|
|
- manualWaitingComplete = false;
|
|
|
- manualCompleting = false;
|
|
|
- if (clearInput && manualSteelSnInput != null) {
|
|
|
- manualSteelSnInput.setText("");
|
|
|
+ /** 刷新一行队列 UI,row 参数可以为 null(空行) */
|
|
|
+ private static void refreshQueueRow(int idx, com.mes.laser.LaserFlowManager.QueueRow row) {
|
|
|
+ if (idx < 0 || idx >= queueRowPanels.length) return;
|
|
|
+ if (queueRowPanels[idx] == null) return;
|
|
|
+ JButton btn = queuePrintButtons[idx];
|
|
|
+ if (row == null) {
|
|
|
+ queueSteelLabels[idx].setText(" ");
|
|
|
+ queueCustomerLabels[idx].setText(" ");
|
|
|
+ queueStatusLabels[idx].setText(" ");
|
|
|
+ queueStatusLabels[idx].setOpaque(false);
|
|
|
+ queueRowPanels[idx].setBorder(BORDER_EMPTY_ROW);
|
|
|
+ if (btn != null) {
|
|
|
+ btn.setVisible(false);
|
|
|
+ btn.putClientProperty("customerSn", null);
|
|
|
+ btn.putClientProperty("steelSn", null);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ queueSteelLabels[idx].setText("钢印: " + row.steelSn);
|
|
|
+ queueCustomerLabels[idx].setText("客户: " + row.customerSn);
|
|
|
+ if (row.done) {
|
|
|
+ queueStatusLabels[idx].setText(" 已打印 ");
|
|
|
+ queueStatusLabels[idx].setForeground(Color.WHITE);
|
|
|
+ queueStatusLabels[idx].setBackground(new Color(46, 160, 67));
|
|
|
+ queueStatusLabels[idx].setOpaque(true);
|
|
|
+ queueRowPanels[idx].setBorder(BORDER_DONE_ROW);
|
|
|
+ if (btn != null) btn.setVisible(false);
|
|
|
+ } else {
|
|
|
+ queueStatusLabels[idx].setText(" 待打印 ");
|
|
|
+ queueStatusLabels[idx].setForeground(Color.DARK_GRAY);
|
|
|
+ queueStatusLabels[idx].setBackground(new Color(230, 230, 230));
|
|
|
+ queueStatusLabels[idx].setOpaque(true);
|
|
|
+ queueRowPanels[idx].setBorder(BORDER_PENDING_ROW);
|
|
|
+ if (btn != null) {
|
|
|
+ btn.setVisible(true);
|
|
|
+ btn.setEnabled(!laserBusy);
|
|
|
+ btn.putClientProperty("customerSn", row.customerSn);
|
|
|
+ btn.putClientProperty("steelSn", row.steelSn);
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
- updateManualSubmitButtons();
|
|
|
+ queueRowPanels[idx].repaint();
|
|
|
}
|
|
|
+
|
|
|
private static void requestUnbindSteelSn(String steelSn) {
|
|
|
requestUnbindSteelSn(steelSn, manualSteelSnInput);
|
|
|
}
|
|
|
@@ -406,40 +452,25 @@ public class MesClient extends JFrame {
|
|
|
private static void requestUnbindSteelSn(String steelSn, final JTextField steelSnInputToClear) {
|
|
|
if (steelSn == null || steelSn.trim().length() != 11) {
|
|
|
setMenuStatus("请输入11位钢印码", 1);
|
|
|
- updateManualSubmitButtons();
|
|
|
- return;
|
|
|
- }
|
|
|
- if (laserFlowManager != null && laserFlowManager.isWaitingComplete()) {
|
|
|
- setMenuStatus("镭雕进行中,不能解绑", 1);
|
|
|
return;
|
|
|
}
|
|
|
- manualCompleting = true;
|
|
|
- updateManualSubmitButtons();
|
|
|
final String steelSnTrim = steelSn.trim();
|
|
|
- laserActionExecutor.submit(new Runnable() {
|
|
|
- @Override
|
|
|
- public void run() {
|
|
|
- JSONObject retObj = DataUtil.unbindSteelSn(steelSnTrim);
|
|
|
- SwingUtilities.invokeLater(new Runnable() {
|
|
|
- @Override
|
|
|
- public void run() {
|
|
|
- manualCompleting = false;
|
|
|
- if (retObj != null && retObj.get("result") != null
|
|
|
- && "true".equalsIgnoreCase(retObj.get("result").toString())) {
|
|
|
- setMenuStatus(retObj.getString("message"), 0);
|
|
|
- if (steelSnInputToClear != null) {
|
|
|
- steelSnInputToClear.setText("");
|
|
|
- }
|
|
|
- product_sn.setText("");
|
|
|
- } else {
|
|
|
- String msg = retObj != null && retObj.get("message") != null
|
|
|
- ? retObj.get("message").toString() : "解绑失败,请重试";
|
|
|
- setMenuStatus(msg, 1);
|
|
|
- }
|
|
|
- updateManualSubmitButtons();
|
|
|
+ laserActionExecutor.submit(() -> {
|
|
|
+ JSONObject retObj = DataUtil.unbindSteelSn(steelSnTrim);
|
|
|
+ SwingUtilities.invokeLater(() -> {
|
|
|
+ if (retObj != null && retObj.get("result") != null
|
|
|
+ && "true".equalsIgnoreCase(retObj.get("result").toString())) {
|
|
|
+ setMenuStatus(retObj.getString("message"), 0);
|
|
|
+ if (steelSnInputToClear != null) {
|
|
|
+ steelSnInputToClear.setText("");
|
|
|
}
|
|
|
- });
|
|
|
- }
|
|
|
+ product_sn.setText("");
|
|
|
+ } else {
|
|
|
+ String msg = retObj != null && retObj.get("message") != null
|
|
|
+ ? retObj.get("message").toString() : "解绑失败,请重试";
|
|
|
+ setMenuStatus(msg, 1);
|
|
|
+ }
|
|
|
+ });
|
|
|
});
|
|
|
}
|
|
|
public static void scanBarcode() {
|
|
|
@@ -536,7 +567,7 @@ public class MesClient extends JFrame {
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
- // 初始化镭雕流程管理器
|
|
|
+ // 初始化镭雕流程管理器:拉服务端待打印队列 → 建档 → 打印 → ack
|
|
|
public static void initLaserFlow(){
|
|
|
laserFlowManager = new LaserFlowManager(new LaserFlowManager.UiCallback() {
|
|
|
@Override
|
|
|
@@ -547,12 +578,8 @@ public class MesClient extends JFrame {
|
|
|
@Override
|
|
|
public void onLockButton(boolean lock) {
|
|
|
SwingUtilities.invokeLater(() -> {
|
|
|
- if(laser_get_code_bt != null){
|
|
|
- laser_get_code_bt.setEnabled(!lock);
|
|
|
- }
|
|
|
- if (!lock && manualWaitingComplete) {
|
|
|
- resetManualSubmitPanel(true);
|
|
|
- }
|
|
|
+ laserBusy = lock;
|
|
|
+ updateManualSubmitButtons();
|
|
|
});
|
|
|
}
|
|
|
|
|
|
@@ -565,6 +592,25 @@ public class MesClient extends JFrame {
|
|
|
public boolean onSubmitResult(String customerSn, String qret) {
|
|
|
return submitLaserResult(customerSn, qret);
|
|
|
}
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void onPendingCount(int count) {
|
|
|
+ SwingUtilities.invokeLater(() -> {
|
|
|
+ if (pendingCountLabel != null) {
|
|
|
+ pendingCountLabel.setText("待打印:" + count);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void onQueueUpdated(java.util.List<com.mes.laser.LaserFlowManager.QueueRow> rows) {
|
|
|
+ SwingUtilities.invokeLater(() -> {
|
|
|
+ for (int i = 0; i < QUEUE_ROWS; i++) {
|
|
|
+ com.mes.laser.LaserFlowManager.QueueRow row = (i < rows.size()) ? rows.get(i) : null;
|
|
|
+ refreshQueueRow(i, row);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
});
|
|
|
laserFlowManager.startCompleteServer();
|
|
|
}
|
|
|
@@ -743,42 +789,95 @@ public class MesClient extends JFrame {
|
|
|
indexScrollPaneA = new JScrollPane(indexPanelA);
|
|
|
indexPanelA.setLayout(null);
|
|
|
|
|
|
- // 镭雕:获取镭雕码 / 复位按钮,放在扫码框(回显框)上方
|
|
|
- laser_get_code_bt = new JButton("获取镭雕码");
|
|
|
- laser_get_code_bt.addActionListener(new ActionListener() {
|
|
|
+ // 「自动打印」标签
|
|
|
+ JLabel autoLabel = new JLabel("自动打印");
|
|
|
+ autoLabel.setFont(new Font("微软雅黑", Font.PLAIN, 24));
|
|
|
+ autoLabel.setBounds(81, 40, 130, 50);
|
|
|
+ indexPanelA.add(autoLabel);
|
|
|
+
|
|
|
+ // 自动打印开关:左右拨动,绿色=开
|
|
|
+ boolean initAuto = laserFlowManager != null && laserFlowManager.isAutoMode();
|
|
|
+ autoPrintToggleBt = new com.mes.component.SwitchButton(initAuto);
|
|
|
+ autoPrintToggleBt.setBounds(220, 45, 90, 40);
|
|
|
+ autoPrintToggleBt.addActionListener(new ActionListener() {
|
|
|
public void actionPerformed(ActionEvent e) {
|
|
|
- laserFlowManager.startLaserFlow(mes_gw, mes_line_sn);
|
|
|
+ if (laserFlowManager == null) return;
|
|
|
+ laserFlowManager.setAutoMode(autoPrintToggleBt.isSelected());
|
|
|
}
|
|
|
});
|
|
|
- laser_get_code_bt.setFont(new Font("微软雅黑", Font.PLAIN, 24));
|
|
|
- laser_get_code_bt.setBounds(81, 40, 300, 50);
|
|
|
- indexPanelA.add(laser_get_code_bt);
|
|
|
+ indexPanelA.add(autoPrintToggleBt);
|
|
|
|
|
|
- // 镭雕:人工复位按钮(完成信号超时或异常时使用,强制解锁并作废当前请求)
|
|
|
- laser_reset_bt = new JButton("复位");
|
|
|
- laser_reset_bt.addActionListener(new ActionListener() {
|
|
|
- public void actionPerformed(ActionEvent e) {
|
|
|
- int result = JOptionPane.showConfirmDialog(MesClient.this,
|
|
|
- "复位会取消当前镭雕流程,确定要继续吗?", "确认复位",
|
|
|
- JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE);
|
|
|
- if (result == JOptionPane.YES_OPTION) {
|
|
|
- laserFlowManager.manualReset();
|
|
|
- resetManualSubmitPanel(true);
|
|
|
- }
|
|
|
- }
|
|
|
- });
|
|
|
- laser_reset_bt.setFont(new Font("微软雅黑", Font.PLAIN, 24));
|
|
|
- laser_reset_bt.setBounds(400, 40, 150, 50);
|
|
|
- indexPanelA.add(laser_reset_bt);
|
|
|
+ // 待打印数量显示(由 LaserFlowManager 每次轮询自动刷新)
|
|
|
+ pendingCountLabel = new JLabel("待打印:0");
|
|
|
+ pendingCountLabel.setFont(new Font("微软雅黑", Font.PLAIN, 24));
|
|
|
+ pendingCountLabel.setHorizontalAlignment(SwingConstants.CENTER);
|
|
|
+ pendingCountLabel.setBounds(400, 40, 300, 50);
|
|
|
+ indexPanelA.add(pendingCountLabel);
|
|
|
|
|
|
+ // product_sn 字段保留(其他流程 scanBarcode/解绑 仍会 setText),但不加到 UI 显示,
|
|
|
+ // 客户码回显直接体现在打印队列 3 行里
|
|
|
product_sn = new JTextField();
|
|
|
- product_sn.setHorizontalAlignment(SwingConstants.CENTER);
|
|
|
product_sn.setEditable(false);
|
|
|
- product_sn.setFont(new Font("微软雅黑", Font.PLAIN, 28));
|
|
|
- product_sn.setBounds(81, 100, 602, 70);
|
|
|
- indexPanelA.add(product_sn);
|
|
|
product_sn.setColumns(10);
|
|
|
|
|
|
+ // ===== 打印队列(3 行):顶部=最近已打,其余=服务端 pending 最早 2 条 =====
|
|
|
+ // 参考原 product_sn 尺寸:602 宽、70 高、字号大
|
|
|
+ JLabel queueTitle = new JLabel("打印队列");
|
|
|
+ queueTitle.setFont(new Font("微软雅黑", Font.PLAIN, 16));
|
|
|
+ queueTitle.setForeground(Color.GRAY);
|
|
|
+ queueTitle.setBounds(81, 100, 200, 20);
|
|
|
+ indexPanelA.add(queueTitle);
|
|
|
+
|
|
|
+ int rowH = 48;
|
|
|
+ int rowGap = 8;
|
|
|
+ int rowY0 = 125;
|
|
|
+ for (int i = 0; i < QUEUE_ROWS; i++) {
|
|
|
+ JPanel row = new JPanel(null);
|
|
|
+ row.setBounds(81, rowY0 + i * (rowH + rowGap), 602, rowH);
|
|
|
+ row.setBackground(Color.WHITE);
|
|
|
+ row.setBorder(BORDER_EMPTY_ROW);
|
|
|
+
|
|
|
+ JLabel steelLbl = new JLabel(" ");
|
|
|
+ steelLbl.setFont(new Font("微软雅黑", Font.PLAIN, 16));
|
|
|
+ steelLbl.setBounds(15, 12, 200, 24);
|
|
|
+ row.add(steelLbl);
|
|
|
+
|
|
|
+ JLabel snLbl = new JLabel(" ");
|
|
|
+ snLbl.setFont(new Font("微软雅黑", Font.PLAIN, 16));
|
|
|
+ snLbl.setBounds(220, 12, 250, 24);
|
|
|
+ row.add(snLbl);
|
|
|
+
|
|
|
+ JLabel statusLbl = new JLabel(" ");
|
|
|
+ statusLbl.setFont(new Font("微软雅黑", Font.PLAIN, 13));
|
|
|
+ statusLbl.setHorizontalAlignment(SwingConstants.CENTER);
|
|
|
+ statusLbl.setBounds(465, 12, 70, 24);
|
|
|
+ row.add(statusLbl);
|
|
|
+
|
|
|
+ // 打印按钮:只有"待打印"行显示,点击打印这一条
|
|
|
+ JButton printBt = new JButton("打印");
|
|
|
+ printBt.setFont(new Font("微软雅黑", Font.PLAIN, 13));
|
|
|
+ printBt.setBounds(542, 9, 55, 30);
|
|
|
+ printBt.setMargin(new Insets(2, 2, 2, 2));
|
|
|
+ printBt.setVisible(false);
|
|
|
+ printBt.addActionListener(new ActionListener() {
|
|
|
+ public void actionPerformed(ActionEvent e) {
|
|
|
+ Object csn = printBt.getClientProperty("customerSn");
|
|
|
+ Object ssn = printBt.getClientProperty("steelSn");
|
|
|
+ if (csn == null || ssn == null || laserFlowManager == null) return;
|
|
|
+ laserFlowManager.printSpecific(csn.toString(), ssn.toString());
|
|
|
+ }
|
|
|
+ });
|
|
|
+ row.add(printBt);
|
|
|
+
|
|
|
+ queueRowPanels[i] = row;
|
|
|
+ queueSteelLabels[i] = steelLbl;
|
|
|
+ queueCustomerLabels[i] = snLbl;
|
|
|
+ queueStatusLabels[i] = statusLbl;
|
|
|
+ queuePrintButtons[i] = printBt;
|
|
|
+ indexPanelA.add(row);
|
|
|
+ }
|
|
|
+ // ===== 打印队列结束 =====
|
|
|
+
|
|
|
// 原扫码按钮不再需要,隐藏但保留逻辑(scanBarcode等方法仍被其他流程复用)
|
|
|
f_scan_data_bt_1 = new JButton("扫码");
|
|
|
f_scan_data_bt_1.addActionListener(new ActionListener() {
|
|
|
@@ -895,98 +994,43 @@ public class MesClient extends JFrame {
|
|
|
finish_ng_bt.setVisible(false);
|
|
|
indexPanelA.add(finish_ng_bt);
|
|
|
|
|
|
- // ===== 手动模式面板 =====
|
|
|
- JLabel debugTitle = new JLabel("手动模式");
|
|
|
- debugTitle.setFont(new Font("微软雅黑", Font.PLAIN, 16));
|
|
|
- debugTitle.setForeground(Color.GRAY);
|
|
|
- debugTitle.setHorizontalAlignment(SwingConstants.CENTER);
|
|
|
- debugTitle.setVisible(true);
|
|
|
- debugTitle.setBounds(760, 40, 220, 30);
|
|
|
- indexPanelA.add(debugTitle);
|
|
|
+ // ===== 右侧手动操作面板:手动录入 / 补打 / 解绑 =====
|
|
|
+ JLabel manualTitle = new JLabel("手动操作");
|
|
|
+ manualTitle.setFont(new Font("微软雅黑", Font.PLAIN, 16));
|
|
|
+ manualTitle.setForeground(Color.GRAY);
|
|
|
+ manualTitle.setHorizontalAlignment(SwingConstants.CENTER);
|
|
|
+ manualTitle.setBounds(760, 40, 220, 30);
|
|
|
+ indexPanelA.add(manualTitle);
|
|
|
|
|
|
+ // 钢印码输入框(供"提交并打印"和"解绑"共用)
|
|
|
manualSteelSnInput = new JTextField();
|
|
|
manualSteelSnInput.setFont(new Font("微软雅黑", Font.PLAIN, 16));
|
|
|
manualSteelSnInput.setBounds(760, 80, 220, 40);
|
|
|
manualSteelSnInput.setToolTipText("输入11位钢印码");
|
|
|
manualSteelSnInput.getDocument().addDocumentListener(new DocumentListener() {
|
|
|
- public void insertUpdate(DocumentEvent e) {
|
|
|
- updateManualSubmitButtons();
|
|
|
- }
|
|
|
-
|
|
|
- public void removeUpdate(DocumentEvent e) {
|
|
|
- updateManualSubmitButtons();
|
|
|
- }
|
|
|
-
|
|
|
- public void changedUpdate(DocumentEvent e) {
|
|
|
- updateManualSubmitButtons();
|
|
|
- }
|
|
|
+ public void insertUpdate(DocumentEvent e) { updateManualSubmitButtons(); }
|
|
|
+ public void removeUpdate(DocumentEvent e) { updateManualSubmitButtons(); }
|
|
|
+ public void changedUpdate(DocumentEvent e) { updateManualSubmitButtons(); }
|
|
|
});
|
|
|
indexPanelA.add(manualSteelSnInput);
|
|
|
|
|
|
- manualGetCodeBt = new JButton("模拟获取镭雕码");
|
|
|
- manualGetCodeBt.setEnabled(false);
|
|
|
- manualGetCodeBt.addActionListener(new ActionListener() {
|
|
|
+ // 提交并打印:把钢印码提交给服务端,服务端生成客户码后本地建档 + 打印
|
|
|
+ submitAndPrintBt = new JButton("提交并打印");
|
|
|
+ submitAndPrintBt.setEnabled(false);
|
|
|
+ submitAndPrintBt.addActionListener(new ActionListener() {
|
|
|
public void actionPerformed(ActionEvent e) {
|
|
|
if (!isManualSteelSnReady()) {
|
|
|
- MesClient.setMenuStatus("请输入11位钢印码", 1);
|
|
|
- updateManualSubmitButtons();
|
|
|
+ setMenuStatus("请输入11位钢印码", 1);
|
|
|
return;
|
|
|
}
|
|
|
- if (laserFlowManager.isWaitingComplete()) {
|
|
|
- MesClient.setMenuStatus("镭雕进行中,请先完成或复位", 1);
|
|
|
- return;
|
|
|
- }
|
|
|
- manualWaitingComplete = true;
|
|
|
- manualCompleting = false;
|
|
|
- laserFlowManager.simulateGetCode(manualSteelSnInput.getText());
|
|
|
- updateManualSubmitButtons();
|
|
|
- }
|
|
|
- });
|
|
|
- manualGetCodeBt.setFont(new Font("微软雅黑", Font.PLAIN, 16));
|
|
|
- manualGetCodeBt.setBounds(760, 130, 220, 50);
|
|
|
- indexPanelA.add(manualGetCodeBt);
|
|
|
-
|
|
|
- manualFinishOkBt = new JButton("模拟完成信号(OK)");
|
|
|
- manualFinishOkBt.setEnabled(false);
|
|
|
- manualFinishOkBt.addActionListener(new ActionListener() {
|
|
|
- public void actionPerformed(ActionEvent e) {
|
|
|
- manualCompleting = true;
|
|
|
- updateManualSubmitButtons();
|
|
|
- laserFlowManager.simulateComplete("OK", "");
|
|
|
+ laserFlowManager.submitAndPrint(manualSteelSnInput.getText());
|
|
|
}
|
|
|
});
|
|
|
- manualFinishOkBt.setFont(new Font("微软雅黑", Font.PLAIN, 16));
|
|
|
- manualFinishOkBt.setBounds(760, 190, 220, 50);
|
|
|
- indexPanelA.add(manualFinishOkBt);
|
|
|
+ submitAndPrintBt.setFont(new Font("微软雅黑", Font.PLAIN, 16));
|
|
|
+ submitAndPrintBt.setBounds(760, 130, 220, 50);
|
|
|
+ indexPanelA.add(submitAndPrintBt);
|
|
|
|
|
|
- manualUnbindBt = new JButton("解绑钢印码");
|
|
|
- manualUnbindBt.setEnabled(false);
|
|
|
- manualUnbindBt.addActionListener(new ActionListener() {
|
|
|
- public void actionPerformed(ActionEvent e) {
|
|
|
- requestUnbindSteelSn(manualSteelSnInput.getText());
|
|
|
- }
|
|
|
- });
|
|
|
- manualUnbindBt.setFont(new Font("微软雅黑", Font.PLAIN, 16));
|
|
|
- manualUnbindBt.setBounds(760, 250, 220, 50);
|
|
|
- indexPanelA.add(manualUnbindBt);
|
|
|
- JButton debugSimNgBtn = new JButton("模拟完成信号(NG)");
|
|
|
- debugSimNgBtn.setVisible(false);
|
|
|
- debugSimNgBtn.addActionListener(new ActionListener() {
|
|
|
- public void actionPerformed(ActionEvent e) {
|
|
|
- laserFlowManager.simulateComplete("NG", "模拟打码失败");
|
|
|
- }
|
|
|
- });
|
|
|
- indexPanelA.add(debugSimNgBtn);
|
|
|
-
|
|
|
- JButton debugGenSnBtn = new JButton("测试生成客户编码");
|
|
|
- debugGenSnBtn.setVisible(false);
|
|
|
- debugGenSnBtn.addActionListener(new ActionListener() {
|
|
|
- public void actionPerformed(ActionEvent e) {
|
|
|
- laserFlowManager.manualGenCustomerSn(manualSteelSnInput.getText());
|
|
|
- }
|
|
|
- });
|
|
|
- indexPanelA.add(debugGenSnBtn);
|
|
|
- // ===== 手动模式面板结束 =====
|
|
|
+ // ===== 手动操作面板结束(打印靠队列行的"打印"按钮;解绑在独立 tab)=====
|
|
|
|
|
|
JButton modbusBtn = new JButton("关");
|
|
|
modbusBtn.addActionListener(new ActionListener() {
|
|
|
@@ -1062,7 +1106,6 @@ public class MesClient extends JFrame {
|
|
|
unbindSteelSnInput.getDocument().addDocumentListener(new DocumentListener() {
|
|
|
private void update() {
|
|
|
boolean ready = unbindSteelSnInput.getText().trim().length() == 11;
|
|
|
- boolean laserBusy = laserFlowManager != null && laserFlowManager.isWaitingComplete();
|
|
|
unbindSteelSnBt.setEnabled(ready && !laserBusy);
|
|
|
}
|
|
|
|