|
@@ -85,6 +85,7 @@ public class MesClient extends JFrame {
|
|
|
public static final int PRODUCT_SN_LENGTH = 32;
|
|
public static final int PRODUCT_SN_LENGTH = 32;
|
|
|
public static final String PREFIX_ZJ = "000020021815-01000016"; //智界
|
|
public static final String PREFIX_ZJ = "000020021815-01000016"; //智界
|
|
|
public static final String PREFIX_SJ = "000020022029-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_SWITCH_PASSWORD = "503833";
|
|
|
public static final String PRODUCT_TYPE_ZJ = ProductTypePanel.TYPE_ZJ;
|
|
public static final String PRODUCT_TYPE_ZJ = ProductTypePanel.TYPE_ZJ;
|
|
|
public static final String PRODUCT_TYPE_SJ = ProductTypePanel.TYPE_SJ;
|
|
public static final String PRODUCT_TYPE_SJ = ProductTypePanel.TYPE_SJ;
|
|
@@ -425,13 +426,19 @@ public class MesClient extends JFrame {
|
|
|
lastDataReady = false;
|
|
lastDataReady = false;
|
|
|
PlcService.setMesConnected(false);
|
|
PlcService.setMesConnected(false);
|
|
|
PlcService.setCollectComplete(false);
|
|
PlcService.setCollectComplete(false);
|
|
|
|
|
+ PlcService.clearScanCode();
|
|
|
MesClient.finish_ok_bt.setEnabled(false);
|
|
MesClient.finish_ok_bt.setEnabled(false);
|
|
|
MesClient.finish_ng_bt.setEnabled(false);
|
|
MesClient.finish_ng_bt.setEnabled(false);
|
|
|
product_sn.setText("");
|
|
product_sn.setText("");
|
|
|
MesClient.fxlabel.setVisible(false);
|
|
MesClient.fxlabel.setVisible(false);
|
|
|
|
|
|
|
|
MesClient.f_scan_data_bt_1.setEnabled(true);
|
|
MesClient.f_scan_data_bt_1.setEnabled(true);
|
|
|
- MesClient.setMenuStatus("请扫工件码",0);
|
|
|
|
|
|
|
+ updateProductTypePanelEnabled(true);
|
|
|
|
|
+ if (PRODUCT_TYPE_SWITCH_ENABLED) {
|
|
|
|
|
+ MesClient.setMenuStatus("当前生产类型:" + getProductTypeName() + ",请扫工件码",0);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ MesClient.setMenuStatus("请扫工件码",0);
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
updateMaterailData();
|
|
updateMaterailData();
|
|
|
}
|
|
}
|
|
@@ -654,12 +661,14 @@ public class MesClient extends JFrame {
|
|
|
updateProductTypePanelEnabled(false);
|
|
updateProductTypePanelEnabled(false);
|
|
|
|
|
|
|
|
if (!PlcService.ensureConnected()) {
|
|
if (!PlcService.ensureConnected()) {
|
|
|
|
|
+ updateProductTypePanelEnabled(true);
|
|
|
MesClient.setMenuStatus("PLC未连接,请检查网络", -1);
|
|
MesClient.setMenuStatus("PLC未连接,请检查网络", -1);
|
|
|
updatePlcStatus(false);
|
|
updatePlcStatus(false);
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
updatePlcStatus(true);
|
|
updatePlcStatus(true);
|
|
|
if (!PlcService.setCollectComplete(false)) {
|
|
if (!PlcService.setCollectComplete(false)) {
|
|
|
|
|
+ updateProductTypePanelEnabled(true);
|
|
|
MesClient.setMenuStatus("写入V2800.3=0失败", -1);
|
|
MesClient.setMenuStatus("写入V2800.3=0失败", -1);
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
@@ -670,13 +679,22 @@ public class MesClient extends JFrame {
|
|
|
MesClient.check_quality_result = false;
|
|
MesClient.check_quality_result = false;
|
|
|
MesClient.work_status = 0;
|
|
MesClient.work_status = 0;
|
|
|
PlcService.setMesConnected(false);
|
|
PlcService.setMesConnected(false);
|
|
|
|
|
+ updateProductTypePanelEnabled(true);
|
|
|
MesClient.setMenuStatus("请求失败,请重试",-1);
|
|
MesClient.setMenuStatus("请求失败,请重试",-1);
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
if(retObj.get("result")!=null&&retObj.get("result").toString().equalsIgnoreCase("true")) {
|
|
if(retObj.get("result")!=null&&retObj.get("result").toString().equalsIgnoreCase("true")) {
|
|
|
|
|
+ if (!PlcService.writeScanCode(scanBarcode)) {
|
|
|
|
|
+ MesClient.check_quality_result = false;
|
|
|
|
|
+ MesClient.work_status = 0;
|
|
|
|
|
+ updateProductTypePanelEnabled(true);
|
|
|
|
|
+ MesClient.setMenuStatus("写入VB3500二维码失败", -1);
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
if (!PlcService.setMesConnected(true)) {
|
|
if (!PlcService.setMesConnected(true)) {
|
|
|
MesClient.check_quality_result = false;
|
|
MesClient.check_quality_result = false;
|
|
|
MesClient.work_status = 0;
|
|
MesClient.work_status = 0;
|
|
|
|
|
+ updateProductTypePanelEnabled(true);
|
|
|
MesClient.setMenuStatus("写入V2800.7=1失败", -1);
|
|
MesClient.setMenuStatus("写入V2800.7=1失败", -1);
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
@@ -693,6 +711,7 @@ public class MesClient extends JFrame {
|
|
|
MesClient.check_quality_result = false;
|
|
MesClient.check_quality_result = false;
|
|
|
MesClient.work_status = 0;
|
|
MesClient.work_status = 0;
|
|
|
PlcService.setMesConnected(false);
|
|
PlcService.setMesConnected(false);
|
|
|
|
|
+ updateProductTypePanelEnabled(true);
|
|
|
if(retObj.get("result")==null){
|
|
if(retObj.get("result")==null){
|
|
|
MesClient.setMenuStatus("请求失败,请重试",-1);
|
|
MesClient.setMenuStatus("请求失败,请重试",-1);
|
|
|
}else{
|
|
}else{
|
|
@@ -866,6 +885,7 @@ public class MesClient extends JFrame {
|
|
|
toolBar.add(space_4);
|
|
toolBar.add(space_4);
|
|
|
|
|
|
|
|
tabbedPane = new JTabbedPane(JTabbedPane.TOP);
|
|
tabbedPane = new JTabbedPane(JTabbedPane.TOP);
|
|
|
|
|
+ tabbedPane.setTabLayoutPolicy(JTabbedPane.SCROLL_TAB_LAYOUT);
|
|
|
tabbedPane.setMinimumSize(new Dimension(400, 50));
|
|
tabbedPane.setMinimumSize(new Dimension(400, 50));
|
|
|
tabbedPane.setFont(new Font("宋体", Font.BOLD, 22));
|
|
tabbedPane.setFont(new Font("宋体", Font.BOLD, 22));
|
|
|
contentPane.add(tabbedPane);
|
|
contentPane.add(tabbedPane);
|
|
@@ -1009,10 +1029,9 @@ public class MesClient extends JFrame {
|
|
|
|
|
|
|
|
// searchScrollPane = new JScrollPane((Component) null);
|
|
// searchScrollPane = new JScrollPane((Component) null);
|
|
|
|
|
|
|
|
- indexPanelC = new JPanel();
|
|
|
|
|
- searchScrollPaneDj = new JScrollPane(indexPanelC);
|
|
|
|
|
- indexPanelC.setLayout(null);
|
|
|
|
|
|
|
+ indexPanelC = new JPanel(new BorderLayout());
|
|
|
|
|
|
|
|
|
|
+ if (PRODUCT_TYPE_SWITCH_ENABLED) {
|
|
|
//新增的面板
|
|
//新增的面板
|
|
|
JPanel indexPanelProductType = new JPanel();
|
|
JPanel indexPanelProductType = new JPanel();
|
|
|
indexPanelProductType.setLayout(null);
|
|
indexPanelProductType.setLayout(null);
|
|
@@ -1037,7 +1056,11 @@ public class MesClient extends JFrame {
|
|
|
productTypePanel.setOnChangeListener(() -> {
|
|
productTypePanel.setOnChangeListener(() -> {
|
|
|
if (work_status == 0) {
|
|
if (work_status == 0) {
|
|
|
saveProductTypeToDb();
|
|
saveProductTypeToDb();
|
|
|
- setMenuStatus("当前生产类型:" + getProductTypeName() + ",请扫工件码", 0);
|
|
|
|
|
|
|
+ if (PRODUCT_TYPE_SWITCH_ENABLED) {
|
|
|
|
|
+ setMenuStatus("当前生产类型:" + getProductTypeName() + ",请扫工件码",0);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ setMenuStatus("请扫工件码",0);
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
refreshProductTypeCurrentLabel();
|
|
refreshProductTypeCurrentLabel();
|
|
|
});
|
|
});
|
|
@@ -1052,9 +1075,10 @@ public class MesClient extends JFrame {
|
|
|
indexPanelProductType.add(productTypeCurrentLabel);
|
|
indexPanelProductType.add(productTypeCurrentLabel);
|
|
|
|
|
|
|
|
tabbedPane.addTab("生产类型", new ImageIcon(MesClient.class.getResource("/bg/menu_setting.png")), productTypeScrollPane, null);
|
|
tabbedPane.addTab("生产类型", new ImageIcon(MesClient.class.getResource("/bg/menu_setting.png")), productTypeScrollPane, null);
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
|
|
|
|
|
- tabbedPane.addTab("开班点检", new ImageIcon(MesClient.class.getResource("/bg/menu_data_preprocess.png")), searchScrollPaneDj, null);
|
|
|
|
|
|
|
+ tabbedPane.addTab("开班点检", new ImageIcon(MesClient.class.getResource("/bg/menu_data_preprocess.png")), indexPanelC, null);
|
|
|
|
|
|
|
|
|
|
|
|
|
// ========== 工作记录 Tab(改造:当前工位Tab + 所有工位Tab) ==========
|
|
// ========== 工作记录 Tab(改造:当前工位Tab + 所有工位Tab) ==========
|
|
@@ -1135,6 +1159,9 @@ public class MesClient extends JFrame {
|
|
|
if (sn.length() != PRODUCT_SN_LENGTH) {
|
|
if (sn.length() != PRODUCT_SN_LENGTH) {
|
|
|
return "工件码长度须为32位,当前" + sn.length() + "位";
|
|
return "工件码长度须为32位,当前" + sn.length() + "位";
|
|
|
}
|
|
}
|
|
|
|
|
+ if (!PRODUCT_TYPE_SWITCH_ENABLED) {
|
|
|
|
|
+ return null;
|
|
|
|
|
+ }
|
|
|
String prefix = getProductSnPrefix();
|
|
String prefix = getProductSnPrefix();
|
|
|
if (!sn.startsWith(prefix)) {
|
|
if (!sn.startsWith(prefix)) {
|
|
|
return "工件码前缀与当前类型(" + getProductTypeName() + ")不匹配,当前工件码为" + getProductTypeNameBySn(sn);
|
|
return "工件码前缀与当前类型(" + getProductTypeName() + ")不匹配,当前工件码为" + getProductTypeNameBySn(sn);
|