|
|
@@ -48,6 +48,7 @@ public class MesClient extends JFrame {
|
|
|
public static int mes_heart_beat_cycle = 10; // 心跳周期
|
|
|
public static int mes_heart_icon_cycle = 1;
|
|
|
public static String mes_line_sn = ""; // 产线编号
|
|
|
+ public static String ui_design_password = "mes123"; // UI面板密码
|
|
|
|
|
|
//TCP连接
|
|
|
public static NettyClient nettyClient;
|
|
|
@@ -107,8 +108,10 @@ public class MesClient extends JFrame {
|
|
|
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;
|
|
|
+ private static final ExecutorService laserActionExecutor = Executors.newSingleThreadExecutor();
|
|
|
|
|
|
public static void main(String[] args) {
|
|
|
if (LockUtil.getInstance().isAppActive() == true){
|
|
|
@@ -182,6 +185,7 @@ public class MesClient extends JFrame {
|
|
|
mes_tcp_port = Integer.parseInt(pro.getProperty("mes.tcp_port"));
|
|
|
mes_heart_beat_cycle = Integer.parseInt(pro.getProperty("mes.heart_beat_cycle"));
|
|
|
mes_line_sn = pro.getProperty("mes.line_sn");
|
|
|
+ ui_design_password = pro.getProperty("mes.ui.design.password", "123456").trim();
|
|
|
|
|
|
mes_gw_des = OprnoUtil.getGwDes(mes_line_sn,mes_gw);
|
|
|
|
|
|
@@ -378,6 +382,9 @@ public class MesClient extends JFrame {
|
|
|
if (manualFinishOkBt != null) {
|
|
|
manualFinishOkBt.setEnabled(manualWaitingComplete && !manualCompleting);
|
|
|
}
|
|
|
+ if (manualUnbindBt != null) {
|
|
|
+ manualUnbindBt.setEnabled(!manualWaitingComplete && !manualCompleting && ready);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
private static void resetManualSubmitPanel(boolean clearInput) {
|
|
|
@@ -388,6 +395,43 @@ public class MesClient extends JFrame {
|
|
|
}
|
|
|
updateManualSubmitButtons();
|
|
|
}
|
|
|
+ private static void requestUnbindSteelSn(String steelSn) {
|
|
|
+ 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);
|
|
|
+ manualSteelSnInput.setText("");
|
|
|
+ product_sn.setText("");
|
|
|
+ } else {
|
|
|
+ String msg = retObj != null && retObj.get("message") != null
|
|
|
+ ? retObj.get("message").toString() : "解绑失败,请重试";
|
|
|
+ setMenuStatus(msg, 1);
|
|
|
+ }
|
|
|
+ updateManualSubmitButtons();
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
public static void scanBarcode() {
|
|
|
String scanBarcodeTitle = "";
|
|
|
switch(scan_type) {
|
|
|
@@ -887,6 +931,16 @@ public class MesClient extends JFrame {
|
|
|
manualFinishOkBt.setBounds(760, 190, 220, 50);
|
|
|
indexPanelA.add(manualFinishOkBt);
|
|
|
|
|
|
+ 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() {
|
|
|
@@ -958,7 +1012,7 @@ public class MesClient extends JFrame {
|
|
|
|
|
|
VisualUiEditorPanel visualEditorPanel = new VisualUiEditorPanel(indexPanelA);
|
|
|
final JDialog visualEditorToolWindow = new JDialog(this, false);
|
|
|
- visualEditorToolWindow.setTitle("UI设计工具");
|
|
|
+ visualEditorToolWindow.setTitle("UI");
|
|
|
visualEditorToolWindow.setContentPane(visualEditorPanel.createExternalToolPanel());
|
|
|
visualEditorToolWindow.pack();
|
|
|
addComponentListener(new ComponentAdapter() {
|
|
|
@@ -974,7 +1028,38 @@ public class MesClient extends JFrame {
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
- tabbedPane.addTab("UI\u8bbe\u8ba1", null, visualEditorPanel, null);
|
|
|
+ // UI面板默认隐藏,三击时间状态栏并输入密码后再显示。
|
|
|
+ heart_beat_menu.addMouseListener(new MouseAdapter() {
|
|
|
+ @Override
|
|
|
+ public void mouseClicked(MouseEvent e) {
|
|
|
+ if (e.getClickCount() != 3) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ JPasswordField passwordField = new JPasswordField();
|
|
|
+ int ret = JOptionPane.showConfirmDialog(
|
|
|
+ MesClient.this,
|
|
|
+ passwordField,
|
|
|
+ "请输入UI密码",
|
|
|
+ JOptionPane.OK_CANCEL_OPTION,
|
|
|
+ JOptionPane.PLAIN_MESSAGE);
|
|
|
+ if (ret != JOptionPane.OK_OPTION) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ String password = new String(passwordField.getPassword());
|
|
|
+ if (!ui_design_password.equals(password)) {
|
|
|
+ setMenuStatus("UI密码错误", 1);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ int index = tabbedPane.indexOfComponent(visualEditorPanel);
|
|
|
+ if (index < 0) {
|
|
|
+ tabbedPane.addTab("UI", null, visualEditorPanel, null);
|
|
|
+ index = tabbedPane.indexOfComponent(visualEditorPanel);
|
|
|
+ }
|
|
|
+ tabbedPane.setSelectedIndex(index);
|
|
|
+ positionVisualEditorToolWindow(visualEditorToolWindow);
|
|
|
+ visualEditorToolWindow.setVisible(true);
|
|
|
+ }
|
|
|
+ });
|
|
|
|
|
|
|
|
|
tabbedPane.addChangeListener(new ChangeListener() {
|
|
|
@@ -983,7 +1068,7 @@ public class MesClient extends JFrame {
|
|
|
JTabbedPane tabbedPane = (JTabbedPane) e.getSource();
|
|
|
int selectedIndex = tabbedPane.getSelectedIndex();
|
|
|
System.out.println("selectedIndex:"+selectedIndex);
|
|
|
- boolean visualEditorSelected = tabbedPane.getComponentAt(selectedIndex) == visualEditorPanel;
|
|
|
+ boolean visualEditorSelected = selectedIndex >= 0 && tabbedPane.getComponentAt(selectedIndex) == visualEditorPanel;
|
|
|
if (visualEditorSelected) {
|
|
|
positionVisualEditorToolWindow(visualEditorToolWindow);
|
|
|
visualEditorToolWindow.setVisible(true);
|