|
@@ -8,6 +8,7 @@ import com.github.xingshuangs.iot.protocol.modbus.service.ModbusTcp;
|
|
|
import com.github.xingshuangs.iot.protocol.s7.enums.EPlcType;
|
|
import com.github.xingshuangs.iot.protocol.s7.enums.EPlcType;
|
|
|
import com.github.xingshuangs.iot.protocol.s7.service.S7PLC;
|
|
import com.github.xingshuangs.iot.protocol.s7.service.S7PLC;
|
|
|
import com.mes.component.MesRadio;
|
|
import com.mes.component.MesRadio;
|
|
|
|
|
+import com.mes.component.ProductTypePanel;
|
|
|
import com.mes.component.MesWebView;
|
|
import com.mes.component.MesWebView;
|
|
|
import com.mes.component.MyDialog;
|
|
import com.mes.component.MyDialog;
|
|
|
import com.mes.netty.NettyClient;
|
|
import com.mes.netty.NettyClient;
|
|
@@ -162,6 +163,16 @@ public class MesClient extends JFrame {
|
|
|
public static JPanel indexPanelB;
|
|
public static JPanel indexPanelB;
|
|
|
public static MesWebView jfxPanel = null;
|
|
public static MesWebView jfxPanel = null;
|
|
|
public static MesRadio mesRadioHj;
|
|
public static MesRadio mesRadioHj;
|
|
|
|
|
+ public static ProductTypePanel productTypePanel;
|
|
|
|
|
+ public static JLabel productTypeCurrentLabel;
|
|
|
|
|
+
|
|
|
|
|
+ public static final int PRODUCT_SN_LENGTH = 32;
|
|
|
|
|
+ public static final String PREFIX_ZJ = "000020021815-01000016"; //智界
|
|
|
|
|
+ public static final String PREFIX_SJ = "000020022029-01000016"; //尚界
|
|
|
|
|
+ public static final boolean PRODUCT_TYPE_SWITCH_ENABLED = false;
|
|
|
|
|
+ public static final String PRODUCT_TYPE_SWITCH_PASSWORD = "503833";
|
|
|
|
|
+ public static final String PRODUCT_TYPE_ZJ = ProductTypePanel.TYPE_ZJ;
|
|
|
|
|
+ public static final String PRODUCT_TYPE_SJ = ProductTypePanel.TYPE_SJ;
|
|
|
public static JPanel indexPanelC;
|
|
public static JPanel indexPanelC;
|
|
|
public static MesWebView jfxPanel2 = null;
|
|
public static MesWebView jfxPanel2 = null;
|
|
|
public static JPanel indexPanelDjB;
|
|
public static JPanel indexPanelDjB;
|
|
@@ -357,10 +368,12 @@ public class MesClient extends JFrame {
|
|
|
public static JTextField param1;
|
|
public static JTextField param1;
|
|
|
public static JTextField param2;
|
|
public static JTextField param2;
|
|
|
public static JTextField param3;
|
|
public static JTextField param3;
|
|
|
|
|
+ public static JTextField param4;
|
|
|
public static JTextField product_sn2;
|
|
public static JTextField product_sn2;
|
|
|
public static JTextField param21;
|
|
public static JTextField param21;
|
|
|
public static JTextField param22;
|
|
public static JTextField param22;
|
|
|
public static JTextField param23;
|
|
public static JTextField param23;
|
|
|
|
|
+ public static JTextField param24;
|
|
|
public static void startHeartBeatTimer() {
|
|
public static void startHeartBeatTimer() {
|
|
|
if(heartBeatTimer!=null) {
|
|
if(heartBeatTimer!=null) {
|
|
|
heartBeatTimer.cancel();
|
|
heartBeatTimer.cancel();
|
|
@@ -435,6 +448,7 @@ public class MesClient extends JFrame {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
public static void initWarehouseData(){
|
|
public static void initWarehouseData(){
|
|
|
|
|
+ loadProductTypeFromDb();
|
|
|
resetScanA();
|
|
resetScanA();
|
|
|
resetScanB();
|
|
resetScanB();
|
|
|
|
|
|
|
@@ -451,10 +465,12 @@ public class MesClient extends JFrame {
|
|
|
MesClient.param1.setText("");
|
|
MesClient.param1.setText("");
|
|
|
MesClient.param2.setText("");
|
|
MesClient.param2.setText("");
|
|
|
MesClient.param3.setText("");
|
|
MesClient.param3.setText("");
|
|
|
|
|
+ MesClient.param4.setText("");
|
|
|
|
|
|
|
|
MesClient.param21.setText("");
|
|
MesClient.param21.setText("");
|
|
|
MesClient.param22.setText("");
|
|
MesClient.param22.setText("");
|
|
|
MesClient.param23.setText("");
|
|
MesClient.param23.setText("");
|
|
|
|
|
+ MesClient.param24.setText("");
|
|
|
|
|
|
|
|
MesClient.curSna = "";
|
|
MesClient.curSna = "";
|
|
|
MesClient.tjFlaga = 0;
|
|
MesClient.tjFlaga = 0;
|
|
@@ -469,6 +485,7 @@ public class MesClient extends JFrame {
|
|
|
updateMaterailData(); // 更新物料
|
|
updateMaterailData(); // 更新物料
|
|
|
|
|
|
|
|
shiftUserCheck();
|
|
shiftUserCheck();
|
|
|
|
|
+ refreshProductTypeLock();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
public static int userLoginHours;//用户登录所处小时
|
|
public static int userLoginHours;//用户登录所处小时
|
|
@@ -505,10 +522,12 @@ public class MesClient extends JFrame {
|
|
|
MesClient.param1.setText("");
|
|
MesClient.param1.setText("");
|
|
|
MesClient.param2.setText("");
|
|
MesClient.param2.setText("");
|
|
|
MesClient.param3.setText("");
|
|
MesClient.param3.setText("");
|
|
|
|
|
+ MesClient.param4.setText("");
|
|
|
|
|
|
|
|
MesClient.param21.setText("");
|
|
MesClient.param21.setText("");
|
|
|
MesClient.param22.setText("");
|
|
MesClient.param22.setText("");
|
|
|
MesClient.param23.setText("");
|
|
MesClient.param23.setText("");
|
|
|
|
|
+ MesClient.param24.setText("");
|
|
|
MesClient.curSnb = "";
|
|
MesClient.curSnb = "";
|
|
|
MesClient.tjFlagb = 0;
|
|
MesClient.tjFlagb = 0;
|
|
|
MesClient.checkB = 0;
|
|
MesClient.checkB = 0;
|
|
@@ -522,6 +541,7 @@ public class MesClient extends JFrame {
|
|
|
updateMaterailData(); // 更新物料
|
|
updateMaterailData(); // 更新物料
|
|
|
|
|
|
|
|
// shiftUserCheck();
|
|
// shiftUserCheck();
|
|
|
|
|
+ refreshProductTypeLock();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
//閼惧嘲褰囬悽銊﹀煕20娴o拷
|
|
//閼惧嘲褰囬悽銊﹀煕20娴o拷
|
|
@@ -823,8 +843,10 @@ public class MesClient extends JFrame {
|
|
|
|
|
|
|
|
//妫f牠銆�
|
|
//妫f牠銆�
|
|
|
JPanel indexPanelA = new JPanel();
|
|
JPanel indexPanelA = new JPanel();
|
|
|
- indexScrollPaneA = new JScrollPane(indexPanelA);
|
|
|
|
|
indexPanelA.setLayout(null);
|
|
indexPanelA.setLayout(null);
|
|
|
|
|
+ indexScrollPaneA = new JScrollPane(indexPanelA);
|
|
|
|
|
+ indexScrollPaneA.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
|
|
|
|
|
+ indexScrollPaneA.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
|
|
|
|
|
|
|
|
product_sn = new JTextField();
|
|
product_sn = new JTextField();
|
|
|
product_sn.setText("");
|
|
product_sn.setText("");
|
|
@@ -1026,101 +1048,182 @@ public class MesClient extends JFrame {
|
|
|
scan_type_text.setBounds(752, 10, 132, 60);
|
|
scan_type_text.setBounds(752, 10, 132, 60);
|
|
|
indexPanelA.add(scan_type_text);
|
|
indexPanelA.add(scan_type_text);
|
|
|
|
|
|
|
|
- // 焊机1参数 - 纵向排列(标签在上,数值在下)
|
|
|
|
|
|
|
+ // 焊机参数:第一行 电压/电流/送丝速度,第二行 程序名(整行)
|
|
|
|
|
+ int welder1X = 26;
|
|
|
|
|
+ int welder1W = 446;
|
|
|
|
|
+ int welder2X = 517;
|
|
|
|
|
+ int welder2W = 446;
|
|
|
|
|
+ int metricColW = 140;
|
|
|
|
|
+ int metricLabelY = 328;
|
|
|
|
|
+ int metricFieldY = 348;
|
|
|
|
|
+ int metricFieldH = 28;
|
|
|
|
|
+ int progLabelY = 386;
|
|
|
|
|
+ int progFieldY = 406;
|
|
|
|
|
+ int progFieldH = 28;
|
|
|
|
|
+
|
|
|
JLabel lblDyA = new JLabel("电压");
|
|
JLabel lblDyA = new JLabel("电压");
|
|
|
lblDyA.setHorizontalAlignment(SwingConstants.CENTER);
|
|
lblDyA.setHorizontalAlignment(SwingConstants.CENTER);
|
|
|
- lblDyA.setFont(new Font("Microsoft YaHei UI", Font.PLAIN, 18));
|
|
|
|
|
- lblDyA.setBounds(169, 325, 158, 24);
|
|
|
|
|
|
|
+ lblDyA.setFont(new Font("Microsoft YaHei UI", Font.PLAIN, 16));
|
|
|
|
|
+ lblDyA.setBounds(welder1X, metricLabelY, metricColW, 20);
|
|
|
indexPanelA.add(lblDyA);
|
|
indexPanelA.add(lblDyA);
|
|
|
|
|
|
|
|
param1 = new JTextField();
|
|
param1 = new JTextField();
|
|
|
param1.setEnabled(false);
|
|
param1.setEnabled(false);
|
|
|
param1.setEditable(false);
|
|
param1.setEditable(false);
|
|
|
param1.setHorizontalAlignment(SwingConstants.CENTER);
|
|
param1.setHorizontalAlignment(SwingConstants.CENTER);
|
|
|
- param1.setFont(new Font("Microsoft YaHei UI", Font.PLAIN, 18));
|
|
|
|
|
- param1.setBounds(169, 350, 158, 32);
|
|
|
|
|
- param1.setColumns(10);
|
|
|
|
|
|
|
+ param1.setFont(new Font("Microsoft YaHei UI", Font.PLAIN, 16));
|
|
|
|
|
+ param1.setBounds(welder1X, metricFieldY, metricColW, metricFieldH);
|
|
|
indexPanelA.add(param1);
|
|
indexPanelA.add(param1);
|
|
|
|
|
|
|
|
JLabel lblDlA = new JLabel("电流");
|
|
JLabel lblDlA = new JLabel("电流");
|
|
|
lblDlA.setHorizontalAlignment(SwingConstants.CENTER);
|
|
lblDlA.setHorizontalAlignment(SwingConstants.CENTER);
|
|
|
- lblDlA.setFont(new Font("Microsoft YaHei UI", Font.PLAIN, 18));
|
|
|
|
|
- lblDlA.setBounds(169, 393, 158, 24);
|
|
|
|
|
|
|
+ lblDlA.setFont(new Font("Microsoft YaHei UI", Font.PLAIN, 16));
|
|
|
|
|
+ lblDlA.setBounds(welder1X + metricColW + 8, metricLabelY, metricColW, 20);
|
|
|
indexPanelA.add(lblDlA);
|
|
indexPanelA.add(lblDlA);
|
|
|
|
|
|
|
|
param2 = new JTextField();
|
|
param2 = new JTextField();
|
|
|
param2.setEnabled(false);
|
|
param2.setEnabled(false);
|
|
|
param2.setEditable(false);
|
|
param2.setEditable(false);
|
|
|
param2.setHorizontalAlignment(SwingConstants.CENTER);
|
|
param2.setHorizontalAlignment(SwingConstants.CENTER);
|
|
|
- param2.setFont(new Font("Microsoft YaHei UI", Font.PLAIN, 18));
|
|
|
|
|
- param2.setBounds(169, 418, 158, 32);
|
|
|
|
|
- param2.setColumns(10);
|
|
|
|
|
|
|
+ param2.setFont(new Font("Microsoft YaHei UI", Font.PLAIN, 16));
|
|
|
|
|
+ param2.setBounds(welder1X + metricColW + 8, metricFieldY, metricColW, metricFieldH);
|
|
|
indexPanelA.add(param2);
|
|
indexPanelA.add(param2);
|
|
|
|
|
|
|
|
JLabel lblSsA = new JLabel("送丝速度");
|
|
JLabel lblSsA = new JLabel("送丝速度");
|
|
|
lblSsA.setHorizontalAlignment(SwingConstants.CENTER);
|
|
lblSsA.setHorizontalAlignment(SwingConstants.CENTER);
|
|
|
- lblSsA.setFont(new Font("Microsoft YaHei UI", Font.PLAIN, 18));
|
|
|
|
|
- lblSsA.setBounds(169, 461, 158, 24);
|
|
|
|
|
|
|
+ lblSsA.setFont(new Font("Microsoft YaHei UI", Font.PLAIN, 16));
|
|
|
|
|
+ lblSsA.setBounds(welder1X + (metricColW + 8) * 2, metricLabelY, metricColW, 20);
|
|
|
indexPanelA.add(lblSsA);
|
|
indexPanelA.add(lblSsA);
|
|
|
|
|
|
|
|
param3 = new JTextField();
|
|
param3 = new JTextField();
|
|
|
param3.setEnabled(false);
|
|
param3.setEnabled(false);
|
|
|
param3.setEditable(false);
|
|
param3.setEditable(false);
|
|
|
param3.setHorizontalAlignment(SwingConstants.CENTER);
|
|
param3.setHorizontalAlignment(SwingConstants.CENTER);
|
|
|
- param3.setFont(new Font("Microsoft YaHei UI", Font.PLAIN, 18));
|
|
|
|
|
- param3.setBounds(169, 486, 158, 32);
|
|
|
|
|
- param3.setColumns(10);
|
|
|
|
|
|
|
+ param3.setFont(new Font("Microsoft YaHei UI", Font.PLAIN, 16));
|
|
|
|
|
+ param3.setBounds(welder1X + (metricColW + 8) * 2, metricFieldY, metricColW, metricFieldH);
|
|
|
indexPanelA.add(param3);
|
|
indexPanelA.add(param3);
|
|
|
|
|
|
|
|
- // 焊机2参数 - 纵向排列(标签在上,数值在下)
|
|
|
|
|
|
|
+ JLabel lblProgA = new JLabel("程序名");
|
|
|
|
|
+ lblProgA.setHorizontalAlignment(SwingConstants.CENTER);
|
|
|
|
|
+ lblProgA.setFont(new Font("Microsoft YaHei UI", Font.PLAIN, 16));
|
|
|
|
|
+ lblProgA.setBounds(welder1X, progLabelY, welder1W, 20);
|
|
|
|
|
+ indexPanelA.add(lblProgA);
|
|
|
|
|
+
|
|
|
|
|
+ param4 = new JTextField();
|
|
|
|
|
+ param4.setEnabled(false);
|
|
|
|
|
+ param4.setEditable(false);
|
|
|
|
|
+ param4.setHorizontalAlignment(SwingConstants.CENTER);
|
|
|
|
|
+ param4.setFont(new Font("Microsoft YaHei UI", Font.PLAIN, 16));
|
|
|
|
|
+ param4.setBounds(welder1X, progFieldY, welder1W, progFieldH);
|
|
|
|
|
+ indexPanelA.add(param4);
|
|
|
|
|
+
|
|
|
JLabel lblDyB = new JLabel("电压");
|
|
JLabel lblDyB = new JLabel("电压");
|
|
|
lblDyB.setHorizontalAlignment(SwingConstants.CENTER);
|
|
lblDyB.setHorizontalAlignment(SwingConstants.CENTER);
|
|
|
- lblDyB.setFont(new Font("Microsoft YaHei UI", Font.PLAIN, 18));
|
|
|
|
|
- lblDyB.setBounds(669, 325, 158, 24);
|
|
|
|
|
|
|
+ lblDyB.setFont(new Font("Microsoft YaHei UI", Font.PLAIN, 16));
|
|
|
|
|
+ lblDyB.setBounds(welder2X, metricLabelY, metricColW, 20);
|
|
|
indexPanelA.add(lblDyB);
|
|
indexPanelA.add(lblDyB);
|
|
|
|
|
|
|
|
param21 = new JTextField();
|
|
param21 = new JTextField();
|
|
|
param21.setEnabled(false);
|
|
param21.setEnabled(false);
|
|
|
param21.setEditable(false);
|
|
param21.setEditable(false);
|
|
|
param21.setHorizontalAlignment(SwingConstants.CENTER);
|
|
param21.setHorizontalAlignment(SwingConstants.CENTER);
|
|
|
- param21.setFont(new Font("Microsoft YaHei UI", Font.PLAIN, 18));
|
|
|
|
|
- param21.setBounds(669, 350, 158, 32);
|
|
|
|
|
- param21.setColumns(10);
|
|
|
|
|
|
|
+ param21.setFont(new Font("Microsoft YaHei UI", Font.PLAIN, 16));
|
|
|
|
|
+ param21.setBounds(welder2X, metricFieldY, metricColW, metricFieldH);
|
|
|
indexPanelA.add(param21);
|
|
indexPanelA.add(param21);
|
|
|
|
|
|
|
|
JLabel lblDlB = new JLabel("电流");
|
|
JLabel lblDlB = new JLabel("电流");
|
|
|
lblDlB.setHorizontalAlignment(SwingConstants.CENTER);
|
|
lblDlB.setHorizontalAlignment(SwingConstants.CENTER);
|
|
|
- lblDlB.setFont(new Font("Microsoft YaHei UI", Font.PLAIN, 18));
|
|
|
|
|
- lblDlB.setBounds(669, 393, 158, 24);
|
|
|
|
|
|
|
+ lblDlB.setFont(new Font("Microsoft YaHei UI", Font.PLAIN, 16));
|
|
|
|
|
+ lblDlB.setBounds(welder2X + metricColW + 8, metricLabelY, metricColW, 20);
|
|
|
indexPanelA.add(lblDlB);
|
|
indexPanelA.add(lblDlB);
|
|
|
|
|
|
|
|
param22 = new JTextField();
|
|
param22 = new JTextField();
|
|
|
param22.setEnabled(false);
|
|
param22.setEnabled(false);
|
|
|
param22.setEditable(false);
|
|
param22.setEditable(false);
|
|
|
param22.setHorizontalAlignment(SwingConstants.CENTER);
|
|
param22.setHorizontalAlignment(SwingConstants.CENTER);
|
|
|
- param22.setFont(new Font("Microsoft YaHei UI", Font.PLAIN, 18));
|
|
|
|
|
- param22.setBounds(669, 418, 158, 32);
|
|
|
|
|
- param22.setColumns(10);
|
|
|
|
|
|
|
+ param22.setFont(new Font("Microsoft YaHei UI", Font.PLAIN, 16));
|
|
|
|
|
+ param22.setBounds(welder2X + metricColW + 8, metricFieldY, metricColW, metricFieldH);
|
|
|
indexPanelA.add(param22);
|
|
indexPanelA.add(param22);
|
|
|
|
|
|
|
|
JLabel lblSsB = new JLabel("送丝速度");
|
|
JLabel lblSsB = new JLabel("送丝速度");
|
|
|
lblSsB.setHorizontalAlignment(SwingConstants.CENTER);
|
|
lblSsB.setHorizontalAlignment(SwingConstants.CENTER);
|
|
|
- lblSsB.setFont(new Font("Microsoft YaHei UI", Font.PLAIN, 18));
|
|
|
|
|
- lblSsB.setBounds(669, 461, 158, 24);
|
|
|
|
|
|
|
+ lblSsB.setFont(new Font("Microsoft YaHei UI", Font.PLAIN, 16));
|
|
|
|
|
+ lblSsB.setBounds(welder2X + (metricColW + 8) * 2, metricLabelY, metricColW, 20);
|
|
|
indexPanelA.add(lblSsB);
|
|
indexPanelA.add(lblSsB);
|
|
|
|
|
|
|
|
param23 = new JTextField();
|
|
param23 = new JTextField();
|
|
|
param23.setEnabled(false);
|
|
param23.setEnabled(false);
|
|
|
param23.setEditable(false);
|
|
param23.setEditable(false);
|
|
|
param23.setHorizontalAlignment(SwingConstants.CENTER);
|
|
param23.setHorizontalAlignment(SwingConstants.CENTER);
|
|
|
- param23.setFont(new Font("Microsoft YaHei UI", Font.PLAIN, 18));
|
|
|
|
|
- param23.setBounds(669, 486, 158, 32);
|
|
|
|
|
- param23.setColumns(10);
|
|
|
|
|
|
|
+ param23.setFont(new Font("Microsoft YaHei UI", Font.PLAIN, 16));
|
|
|
|
|
+ param23.setBounds(welder2X + (metricColW + 8) * 2, metricFieldY, metricColW, metricFieldH);
|
|
|
indexPanelA.add(param23);
|
|
indexPanelA.add(param23);
|
|
|
|
|
|
|
|
|
|
+ JLabel lblProgB = new JLabel("程序名");
|
|
|
|
|
+ lblProgB.setHorizontalAlignment(SwingConstants.CENTER);
|
|
|
|
|
+ lblProgB.setFont(new Font("Microsoft YaHei UI", Font.PLAIN, 16));
|
|
|
|
|
+ lblProgB.setBounds(welder2X, progLabelY, welder2W, 20);
|
|
|
|
|
+ indexPanelA.add(lblProgB);
|
|
|
|
|
+
|
|
|
|
|
+ param24 = new JTextField();
|
|
|
|
|
+ param24.setEnabled(false);
|
|
|
|
|
+ param24.setEditable(false);
|
|
|
|
|
+ param24.setHorizontalAlignment(SwingConstants.CENTER);
|
|
|
|
|
+ param24.setFont(new Font("Microsoft YaHei UI", Font.PLAIN, 16));
|
|
|
|
|
+ param24.setBounds(welder2X, progFieldY, welder2W, progFieldH);
|
|
|
|
|
+ indexPanelA.add(param24);
|
|
|
|
|
+
|
|
|
|
|
+ indexPanelA.setPreferredSize(new Dimension(993, 450));
|
|
|
|
|
+ indexPanelA.revalidate();
|
|
|
|
|
+
|
|
|
tabbedPane.addTab("工作面板", new ImageIcon(MesClient.class.getResource("/bg/a_side.png")), indexScrollPaneA, null);
|
|
tabbedPane.addTab("工作面板", new ImageIcon(MesClient.class.getResource("/bg/a_side.png")), indexScrollPaneA, null);
|
|
|
tabbedPane.setEnabledAt(0, true);
|
|
tabbedPane.setEnabledAt(0, true);
|
|
|
|
|
|
|
|
|
|
+ if (PRODUCT_TYPE_SWITCH_ENABLED) {
|
|
|
|
|
+ JPanel indexPanelProductType = new JPanel();
|
|
|
|
|
+ indexPanelProductType.setLayout(null);
|
|
|
|
|
+ JScrollPane productTypeScrollPane = new JScrollPane(indexPanelProductType);
|
|
|
|
|
+
|
|
|
|
|
+ JLabel productTypeTitle = new JLabel("生产类型设置");
|
|
|
|
|
+ productTypeTitle.setFont(new Font("微软雅黑", Font.BOLD, 28));
|
|
|
|
|
+ productTypeTitle.setForeground(new Color(64, 64, 64));
|
|
|
|
|
+ productTypeTitle.setHorizontalAlignment(SwingConstants.CENTER);
|
|
|
|
|
+ productTypeTitle.setBounds(81, 80, 810, 50);
|
|
|
|
|
+ indexPanelProductType.add(productTypeTitle);
|
|
|
|
|
+
|
|
|
|
|
+ JLabel productTypeHint = new JLabel("请选择当前生产的工件类型,切换后将保存到本地并用于扫码校验");
|
|
|
|
|
+ productTypeHint.setFont(new Font("微软雅黑", Font.PLAIN, 20));
|
|
|
|
|
+ productTypeHint.setForeground(new Color(140, 140, 140));
|
|
|
|
|
+ productTypeHint.setHorizontalAlignment(SwingConstants.CENTER);
|
|
|
|
|
+ productTypeHint.setBounds(81, 140, 810, 40);
|
|
|
|
|
+ indexPanelProductType.add(productTypeHint);
|
|
|
|
|
+
|
|
|
|
|
+ productTypePanel = new ProductTypePanel(PRODUCT_TYPE_SWITCH_PASSWORD);
|
|
|
|
|
+ productTypePanel.setBounds(276, 210, 420, 72);
|
|
|
|
|
+ productTypePanel.setOnChangeListener(() -> {
|
|
|
|
|
+ if (work_status == 0 && work_status2 == 0) {
|
|
|
|
|
+ saveProductTypeToDb();
|
|
|
|
|
+ if (PRODUCT_TYPE_SWITCH_ENABLED) {
|
|
|
|
|
+ setMenuStatus("当前生产类型:" + getProductTypeName() + ",请扫工件码",0);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ setMenuStatus("请扫工件码",0);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ refreshProductTypeCurrentLabel();
|
|
|
|
|
+ });
|
|
|
|
|
+ indexPanelProductType.add(productTypePanel);
|
|
|
|
|
+
|
|
|
|
|
+ productTypeCurrentLabel = new JLabel();
|
|
|
|
|
+ productTypeCurrentLabel.setFont(new Font("微软雅黑", Font.PLAIN, 22));
|
|
|
|
|
+ productTypeCurrentLabel.setForeground(new Color(64, 64, 64));
|
|
|
|
|
+ productTypeCurrentLabel.setHorizontalAlignment(SwingConstants.CENTER);
|
|
|
|
|
+ productTypeCurrentLabel.setBounds(81, 310, 810, 40);
|
|
|
|
|
+ refreshProductTypeCurrentLabel();
|
|
|
|
|
+ indexPanelProductType.add(productTypeCurrentLabel);
|
|
|
|
|
+
|
|
|
|
|
+ tabbedPane.addTab("生产类型", new ImageIcon(MesClient.class.getResource("/bg/menu_setting.png")), productTypeScrollPane, null);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
|
|
|
|
|
|
|
|
JPanel indexPanelGz = new JPanel();
|
|
JPanel indexPanelGz = new JPanel();
|
|
@@ -1270,6 +1373,93 @@ public class MesClient extends JFrame {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ public static void loadProductTypeFromDb() {
|
|
|
|
|
+ if (productTypePanel == null) {
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ String savedType = JdbcUtils.getClientConfig(
|
|
|
|
|
+ JdbcUtils.getProductTypeConfigKey(mes_gw),
|
|
|
|
|
+ PRODUCT_TYPE_ZJ
|
|
|
|
|
+ );
|
|
|
|
|
+ if (PRODUCT_TYPE_SJ.equals(savedType)) {
|
|
|
|
|
+ productTypePanel.setResult(PRODUCT_TYPE_SJ);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ productTypePanel.setResult(PRODUCT_TYPE_ZJ);
|
|
|
|
|
+ }
|
|
|
|
|
+ refreshProductTypeCurrentLabel();
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ public static void refreshProductTypeCurrentLabel() {
|
|
|
|
|
+ if (productTypeCurrentLabel != null) {
|
|
|
|
|
+ productTypeCurrentLabel.setText("当前选择:" + getProductTypeName() + "(前缀 " + getProductSnPrefix() + ")");
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ public static void saveProductTypeToDb() {
|
|
|
|
|
+ if (productTypePanel == null) {
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ JdbcUtils.saveClientConfig(
|
|
|
|
|
+ JdbcUtils.getProductTypeConfigKey(mes_gw),
|
|
|
|
|
+ productTypePanel.getResult()
|
|
|
|
|
+ );
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ public static String getProductSnPrefix() {
|
|
|
|
|
+ if (productTypePanel != null && PRODUCT_TYPE_SJ.equals(productTypePanel.getResult())) {
|
|
|
|
|
+ return PREFIX_SJ;
|
|
|
|
|
+ }
|
|
|
|
|
+ return PREFIX_ZJ;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ public static String getProductTypeName() {
|
|
|
|
|
+ if (productTypePanel != null) {
|
|
|
|
|
+ return productTypePanel.getTypeName();
|
|
|
|
|
+ }
|
|
|
|
|
+ return "智界";
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ private static String getProductTypeNameBySn(String sn) {
|
|
|
|
|
+ if (sn.startsWith(PREFIX_SJ)) {
|
|
|
|
|
+ return "尚界";
|
|
|
|
|
+ }
|
|
|
|
|
+ if (sn.startsWith(PREFIX_ZJ)) {
|
|
|
|
|
+ return "智界";
|
|
|
|
|
+ }
|
|
|
|
|
+ return "未知";
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ private static String validateProductSnMessage(String sn) {
|
|
|
|
|
+ if (sn == null || sn.isEmpty()) {
|
|
|
|
|
+ return "工件码为空,请重试";
|
|
|
|
|
+ }
|
|
|
|
|
+ if (sn.length() != PRODUCT_SN_LENGTH) {
|
|
|
|
|
+ return "工件码长度须为32位,当前" + sn.length() + "位";
|
|
|
|
|
+ }
|
|
|
|
|
+ if (!PRODUCT_TYPE_SWITCH_ENABLED) {
|
|
|
|
|
+ return null;
|
|
|
|
|
+ }
|
|
|
|
|
+ String prefix = getProductSnPrefix();
|
|
|
|
|
+ if (!sn.startsWith(prefix)) {
|
|
|
|
|
+ return "工件码前缀与当前类型(" + getProductTypeName() + ")不匹配,当前工件码为" + getProductTypeNameBySn(sn);
|
|
|
|
|
+ }
|
|
|
|
|
+ return null;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ private static void updateProductTypePanelEnabled(boolean enabled) {
|
|
|
|
|
+ if (productTypePanel != null) {
|
|
|
|
|
+ productTypePanel.setEnabled(enabled);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ private static void refreshProductTypeLock() {
|
|
|
|
|
+ boolean busy = (product_sn != null && !product_sn.getText().trim().isEmpty())
|
|
|
|
|
+ || (product_sn2 != null && !product_sn2.getText().trim().isEmpty())
|
|
|
|
|
+ || Boolean.TRUE.equals(mesQualityFlagA)
|
|
|
|
|
+ || Boolean.TRUE.equals(mesQualityFlagB);
|
|
|
|
|
+ updateProductTypePanelEnabled(!busy);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
public static void scanBarcode() {
|
|
public static void scanBarcode() {
|
|
|
String scanBarcodeSn = txtfa.getText().trim();
|
|
String scanBarcodeSn = txtfa.getText().trim();
|
|
|
txtfa.setText("");
|
|
txtfa.setText("");
|
|
@@ -1285,6 +1475,11 @@ public class MesClient extends JFrame {
|
|
|
MesClient.setMenuStatus("镭雕码不能为空",1);
|
|
MesClient.setMenuStatus("镭雕码不能为空",1);
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
|
|
+ String validateMsg = validateProductSnMessage(scanBarcodeSn);
|
|
|
|
|
+ if (validateMsg != null) {
|
|
|
|
|
+ MesClient.setMenuStatus(validateMsg, 1);
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
if(MesClient.curPage.equals("A")){
|
|
if(MesClient.curPage.equals("A")){
|
|
|
System.out.println("typeA");
|
|
System.out.println("typeA");
|
|
|
if(!product_sn.getText().isEmpty() && mesQualityFlagA){
|
|
if(!product_sn.getText().isEmpty() && mesQualityFlagA){
|
|
@@ -1301,6 +1496,7 @@ public class MesClient extends JFrame {
|
|
|
product_sn2.setText(scanBarcodeSn);
|
|
product_sn2.setText(scanBarcodeSn);
|
|
|
}
|
|
}
|
|
|
MesClient.setMenuStatus("扫码成功",0);
|
|
MesClient.setMenuStatus("扫码成功",0);
|
|
|
|
|
+ refreshProductTypeLock();
|
|
|
|
|
|
|
|
//刷新界面
|
|
//刷新界面
|
|
|
mesClientFrame.repaint();
|
|
mesClientFrame.repaint();
|