|
|
@@ -64,6 +64,11 @@ public class MesClient extends JFrame {
|
|
|
|
|
|
public static String user20 = "";
|
|
|
|
|
|
+ // 产品PN号(195/196/198),决定长码前缀 F95621032519X
|
|
|
+ public static final String[] PN_LIST = {"195", "196", "198"};
|
|
|
+ public static JComboBox<String> pnCombo;
|
|
|
+ public static String pnCacheKey = "pn_";
|
|
|
+
|
|
|
public static JFrame welcomeWin;
|
|
|
|
|
|
// public static JPanel indexPanelB;
|
|
|
@@ -95,12 +100,13 @@ public class MesClient extends JFrame {
|
|
|
//读文件配置
|
|
|
readProperty();
|
|
|
|
|
|
+ // 先连本地库,界面初始化时读取产品PN缓存
|
|
|
+ JdbcUtils.getConn();
|
|
|
+
|
|
|
// 显示界面
|
|
|
mesClientFrame = new MesClient();
|
|
|
mesClientFrame.setVisible(false);
|
|
|
|
|
|
- JdbcUtils.getConn();
|
|
|
-
|
|
|
welcomeWin = new LoginFarme();
|
|
|
welcomeWin.setVisible(true);
|
|
|
|
|
|
@@ -140,6 +146,7 @@ public class MesClient extends JFrame {
|
|
|
mes_server_ip = pro.getProperty("mes.server_ip");
|
|
|
mes_line_sn = pro.getProperty("mes.line_sn");
|
|
|
mes_gw_des = OprnoUtil.getGwDes(mes_line_sn,mes_gw);
|
|
|
+ pnCacheKey = "pn_" + mes_gw; // 产品PN按工位缓存
|
|
|
log.info(mes_gw + ";" + mes_gw_des + ";" + mes_server_ip + ";");
|
|
|
}
|
|
|
|
|
|
@@ -222,6 +229,11 @@ public class MesClient extends JFrame {
|
|
|
|
|
|
}
|
|
|
|
|
|
+ // 当前选中的产品PN号,未选择时默认195
|
|
|
+ public static String getPn() {
|
|
|
+ return pnCombo == null ? PN_LIST[0] : String.valueOf(pnCombo.getSelectedItem());
|
|
|
+ }
|
|
|
+
|
|
|
//获取用户20位
|
|
|
public static void getUser() {
|
|
|
user20 = user_menu.getText().toString();
|
|
|
@@ -468,6 +480,27 @@ public class MesClient extends JFrame {
|
|
|
indexPanelA.add(product_sn);
|
|
|
product_sn.setColumns(10);
|
|
|
|
|
|
+ // 产品PN选择:决定长码前缀,选择后存本地,重启保持
|
|
|
+ JLabel pnLabel = new JLabel("产品PN:");
|
|
|
+ pnLabel.setFont(new Font("微软雅黑", Font.PLAIN, 20));
|
|
|
+ pnLabel.setBounds(81, 15, 100, 40);
|
|
|
+ indexPanelA.add(pnLabel);
|
|
|
+
|
|
|
+ pnCombo = new JComboBox<>(PN_LIST);
|
|
|
+ pnCombo.setFont(new Font("微软雅黑", Font.PLAIN, 20));
|
|
|
+ pnCombo.setBounds(185, 15, 140, 40);
|
|
|
+ String cachePn = JdbcUtils.getCacheValue(pnCacheKey);
|
|
|
+ pnCombo.setSelectedItem(cachePn.isEmpty() ? PN_LIST[0] : cachePn);
|
|
|
+ pnCombo.addActionListener(new ActionListener() {
|
|
|
+ public void actionPerformed(ActionEvent e) {
|
|
|
+ String pn = getPn();
|
|
|
+ JdbcUtils.setCacheValue(pnCacheKey, pn);
|
|
|
+ setMenuStatus("当前产品:" + pn, 0);
|
|
|
+ log.info("切换产品PN: {}", pn);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ indexPanelA.add(pnCombo);
|
|
|
+
|
|
|
f_scan_data_bt_1 = new JButton("扫码");
|
|
|
f_scan_data_bt_1.addActionListener(new ActionListener() {
|
|
|
public void actionPerformed(ActionEvent e) {
|