|
|
@@ -69,7 +69,14 @@ public class MesClient extends JFrame {
|
|
|
public static JButton finish_ok_bt;
|
|
|
public static JButton finish_ng_bt;
|
|
|
public static JTextField product_sn;
|
|
|
+ public static JTextField product_sn_lb;
|
|
|
public static JButton f_scan_data_bt_1;
|
|
|
+ public static JButton f_scan_data_bt_2;
|
|
|
+
|
|
|
+ /** 液冷板绑定工艺号(与工艺模板配置一致) */
|
|
|
+ public static final String COLD_PLATE_CRAFT = "400006";
|
|
|
+ /** 液冷板是否已绑定成功(绑定成功后才允许开启拉铆) */
|
|
|
+ public static Boolean cold_plate_bound = false;
|
|
|
|
|
|
public static String user20 = "";
|
|
|
|
|
|
@@ -86,10 +93,15 @@ public class MesClient extends JFrame {
|
|
|
public static JTextField param3;
|
|
|
public static JTextField param4;
|
|
|
|
|
|
-// public static ModbusTcp plcA = new ModbusTcp(1, "192.168.1.7");
|
|
|
-// public static ModbusTcp plcB = new ModbusTcp(1, "192.168.1.8");
|
|
|
- public static ModbusTcp plcA = new ModbusTcp(1, "192.168.1.27");
|
|
|
- public static ModbusTcp plcB = new ModbusTcp(1, "192.168.1.28");
|
|
|
+
|
|
|
+
|
|
|
+// tw -210b
|
|
|
+// public static ModbusTcp plcA = new ModbusTcp(1, "192.168.1.7");//81
|
|
|
+// public static ModbusTcp plcB = new ModbusTcp(1, "192.168.1.8");//1
|
|
|
+
|
|
|
+// tw-op130b
|
|
|
+ public static ModbusTcp plcA = new ModbusTcp(1, "192.168.1.7");//29
|
|
|
+ public static ModbusTcp plcB = new ModbusTcp(1, "192.168.1.8");//26
|
|
|
|
|
|
public static Timer cjTimer;
|
|
|
|
|
|
@@ -97,14 +109,15 @@ public class MesClient extends JFrame {
|
|
|
|
|
|
public static Timer cjTimer3;
|
|
|
|
|
|
- public static Short aSetNum = 19;
|
|
|
-// public static Short aSetNum = 49;
|
|
|
+ public static Short aSetNum = 29;
|
|
|
+//public static Short aSetNum = 81;
|
|
|
+
|
|
|
public static Short sortA = 0;
|
|
|
public static Short aMax = 0;
|
|
|
public static Short aFinish = 0;
|
|
|
public static List<Map> alist = new ArrayList<>();
|
|
|
- public static Short bSetNum = 50;
|
|
|
-// public static Short bSetNum = 27;
|
|
|
+ public static Short bSetNum = 26;
|
|
|
+//public static Short bSetNum = 1;
|
|
|
public static Short sortB = 0;
|
|
|
public static Short bMax = 0;
|
|
|
public static Short bFinish = 0;
|
|
|
@@ -184,7 +197,7 @@ public class MesClient extends JFrame {
|
|
|
cjTimer4.schedule(new TimerTask() {
|
|
|
public void run() {
|
|
|
try{
|
|
|
- if(work_status == 1){
|
|
|
+ if(work_status == 1 && cold_plate_bound){
|
|
|
List<Boolean> yxstatus = plcA.readCoil(3128,1);
|
|
|
if(yxstatus.size() >= 1 && !yxstatus.get(0)){
|
|
|
if(!MesClient.curSn.isEmpty() && MesClient.aMax > 0 && MesClient.aMax == MesClient.sortA){
|
|
|
@@ -425,10 +438,17 @@ public class MesClient extends JFrame {
|
|
|
public static void resetScanA() {
|
|
|
work_status = 0;
|
|
|
check_quality_result = false;
|
|
|
+ cold_plate_bound = false;
|
|
|
MesClient.finish_ok_bt.setEnabled(false);
|
|
|
MesClient.finish_ng_bt.setEnabled(false);
|
|
|
product_sn.setText("");
|
|
|
curSn = "";
|
|
|
+ if (product_sn_lb != null) {
|
|
|
+ product_sn_lb.setText("");
|
|
|
+ }
|
|
|
+ if (f_scan_data_bt_2 != null) {
|
|
|
+ f_scan_data_bt_2.setEnabled(false);
|
|
|
+ }
|
|
|
|
|
|
MesClient.f_scan_data_bt_1.setEnabled(true);
|
|
|
MesClient.setMenuStatus("请扫工件码",0);
|
|
|
@@ -726,6 +746,38 @@ public class MesClient extends JFrame {
|
|
|
f_scan_data_bt_1.setBounds(693, 70, 198, 70);
|
|
|
indexPanelA.add(f_scan_data_bt_1);
|
|
|
|
|
|
+ JLabel lbLabel = new JLabel("液冷板:");
|
|
|
+ lbLabel.setFont(new Font("微软雅黑", Font.PLAIN, 24));
|
|
|
+ lbLabel.setBounds(10, 155, 90, 50);
|
|
|
+ indexPanelA.add(lbLabel);
|
|
|
+ product_sn_lb = new JTextField();
|
|
|
+ product_sn_lb.setHorizontalAlignment(SwingConstants.CENTER);
|
|
|
+ product_sn_lb.setEditable(false);
|
|
|
+ product_sn_lb.setFont(new Font("微软雅黑", Font.PLAIN, 28));
|
|
|
+ product_sn_lb.setBounds(100, 150, 580, 60);
|
|
|
+ indexPanelA.add(product_sn_lb);
|
|
|
+ product_sn_lb.setColumns(10);
|
|
|
+
|
|
|
+ f_scan_data_bt_2 = new JButton("扫码");
|
|
|
+ f_scan_data_bt_2.addActionListener(new ActionListener() {
|
|
|
+ public void actionPerformed(ActionEvent e) {
|
|
|
+ if (product_sn.getText().isEmpty()){
|
|
|
+ setMenuStatus("请在扫完工件码后扫液冷板码!",1);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (work_status == 1 && check_quality_result){
|
|
|
+ scanBarcodeLb();
|
|
|
+ }else{
|
|
|
+ setMenuStatus("请在工件质量检测合格后扫液冷板码!",1);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ f_scan_data_bt_2.setIcon(new ImageIcon(MesClient.class.getResource("/bg/scan_barcode.png")));
|
|
|
+ f_scan_data_bt_2.setFont(new Font("微软雅黑", Font.PLAIN, 30));
|
|
|
+ f_scan_data_bt_2.setBounds(693, 150, 198, 60);
|
|
|
+ f_scan_data_bt_2.setEnabled(false);
|
|
|
+ indexPanelA.add(f_scan_data_bt_2);
|
|
|
+
|
|
|
// String[] hjtitles = new String[]{"焊机1","焊机2","焊机3"};
|
|
|
// String[] hjvals = new String[]{"HJ001","HJ002","HJ003"};
|
|
|
// mesRadioHj = new MesRadio(hjtitles,hjvals);
|
|
|
@@ -738,6 +790,10 @@ public class MesClient extends JFrame {
|
|
|
finish_ok_bt.addActionListener(new ActionListener() {
|
|
|
public void actionPerformed(ActionEvent e) {
|
|
|
if(work_status == 1 && check_quality_result){
|
|
|
+ if (!cold_plate_bound){
|
|
|
+ JOptionPane.showMessageDialog(MesClient.mesClientFrame,"请绑定液冷板码","提示窗口", JOptionPane.INFORMATION_MESSAGE);
|
|
|
+ return;
|
|
|
+ }
|
|
|
|
|
|
String sn = getBarcode(product_sn.getText());
|
|
|
getUser();
|
|
|
@@ -754,7 +810,7 @@ public class MesClient extends JFrame {
|
|
|
});
|
|
|
finish_ok_bt.setIcon(new ImageIcon(MesClient.class.getResource("/bg/ok_bg.png")));
|
|
|
finish_ok_bt.setFont(new Font("微软雅黑", Font.PLAIN, 32));
|
|
|
- finish_ok_bt.setBounds(185, 395, 240, 80);
|
|
|
+ finish_ok_bt.setBounds(185, 470, 240, 80);
|
|
|
finish_ok_bt.setEnabled(false);
|
|
|
indexPanelA.add(finish_ok_bt);
|
|
|
|
|
|
@@ -777,19 +833,19 @@ public class MesClient extends JFrame {
|
|
|
});
|
|
|
finish_ng_bt.setIcon(new ImageIcon(MesClient.class.getResource("/bg/ng_bg.png")));
|
|
|
finish_ng_bt.setFont(new Font("微软雅黑", Font.PLAIN, 32));
|
|
|
- finish_ng_bt.setBounds(508, 395, 240, 80);
|
|
|
+ finish_ng_bt.setBounds(508, 470, 240, 80);
|
|
|
finish_ng_bt.setEnabled(false);
|
|
|
indexPanelA.add(finish_ng_bt);
|
|
|
|
|
|
JLabel lblNewLabel = new JLabel("A\u67AA");
|
|
|
lblNewLabel.setHorizontalAlignment(SwingConstants.CENTER);
|
|
|
lblNewLabel.setFont(new Font("微软雅黑", Font.PLAIN, 20));
|
|
|
- lblNewLabel.setBounds(204, 186, 166, 28);
|
|
|
+ lblNewLabel.setBounds(204, 230, 166, 28);
|
|
|
indexPanelA.add(lblNewLabel);
|
|
|
|
|
|
JLabel lblNewLabel_1 = new JLabel("\u9884\u8BBE\u6570\u91CF");
|
|
|
lblNewLabel_1.setFont(new Font("微软雅黑", Font.PLAIN, 18));
|
|
|
- lblNewLabel_1.setBounds(204, 241, 83, 34);
|
|
|
+ lblNewLabel_1.setBounds(204, 275, 83, 34);
|
|
|
indexPanelA.add(lblNewLabel_1);
|
|
|
|
|
|
param1 = new JTextField();
|
|
|
@@ -797,13 +853,13 @@ public class MesClient extends JFrame {
|
|
|
param1.setFont(new Font("微软雅黑", Font.PLAIN, 18));
|
|
|
param1.setText("0");
|
|
|
param1.setEditable(false);
|
|
|
- param1.setBounds(288, 241, 83, 34);
|
|
|
+ param1.setBounds(288, 275, 83, 34);
|
|
|
indexPanelA.add(param1);
|
|
|
param1.setColumns(10);
|
|
|
|
|
|
JLabel lblNewLabel_1_1 = new JLabel("\u5B8C\u6210\u6570\u91CF");
|
|
|
lblNewLabel_1_1.setFont(new Font("微软雅黑", Font.PLAIN, 18));
|
|
|
- lblNewLabel_1_1.setBounds(204, 285, 83, 34);
|
|
|
+ lblNewLabel_1_1.setBounds(204, 319, 83, 34);
|
|
|
indexPanelA.add(lblNewLabel_1_1);
|
|
|
|
|
|
param2 = new JTextField();
|
|
|
@@ -812,18 +868,18 @@ public class MesClient extends JFrame {
|
|
|
param2.setText("0");
|
|
|
param2.setEditable(false);
|
|
|
param2.setColumns(10);
|
|
|
- param2.setBounds(288, 285, 83, 34);
|
|
|
+ param2.setBounds(288, 319, 83, 34);
|
|
|
indexPanelA.add(param2);
|
|
|
|
|
|
JLabel lblB = new JLabel("B\u67AA");
|
|
|
lblB.setHorizontalAlignment(SwingConstants.CENTER);
|
|
|
lblB.setFont(new Font("微软雅黑", Font.PLAIN, 20));
|
|
|
- lblB.setBounds(525, 186, 166, 28);
|
|
|
+ lblB.setBounds(525, 230, 166, 28);
|
|
|
indexPanelA.add(lblB);
|
|
|
|
|
|
JLabel lblNewLabel_1_2 = new JLabel("\u9884\u8BBE\u6570\u91CF");
|
|
|
lblNewLabel_1_2.setFont(new Font("微软雅黑", Font.PLAIN, 18));
|
|
|
- lblNewLabel_1_2.setBounds(525, 241, 83, 34);
|
|
|
+ lblNewLabel_1_2.setBounds(525, 275, 83, 34);
|
|
|
indexPanelA.add(lblNewLabel_1_2);
|
|
|
|
|
|
param3 = new JTextField();
|
|
|
@@ -832,12 +888,12 @@ public class MesClient extends JFrame {
|
|
|
param3.setFont(new Font("微软雅黑", Font.PLAIN, 18));
|
|
|
param3.setEditable(false);
|
|
|
param3.setColumns(10);
|
|
|
- param3.setBounds(608, 241, 83, 34);
|
|
|
+ param3.setBounds(608, 275, 83, 34);
|
|
|
indexPanelA.add(param3);
|
|
|
|
|
|
JLabel lblNewLabel_1_1_1 = new JLabel("\u5B8C\u6210\u6570\u91CF");
|
|
|
lblNewLabel_1_1_1.setFont(new Font("微软雅黑", Font.PLAIN, 18));
|
|
|
- lblNewLabel_1_1_1.setBounds(525, 285, 83, 34);
|
|
|
+ lblNewLabel_1_1_1.setBounds(525, 319, 83, 34);
|
|
|
indexPanelA.add(lblNewLabel_1_1_1);
|
|
|
|
|
|
param4 = new JTextField();
|
|
|
@@ -846,17 +902,17 @@ public class MesClient extends JFrame {
|
|
|
param4.setFont(new Font("微软雅黑", Font.PLAIN, 18));
|
|
|
param4.setEditable(false);
|
|
|
param4.setColumns(10);
|
|
|
- param4.setBounds(608, 285, 83, 34);
|
|
|
+ param4.setBounds(608, 319, 83, 34);
|
|
|
indexPanelA.add(param4);
|
|
|
|
|
|
JLabel lblNgJudgeA = new JLabel("NG\u590d\u5224");
|
|
|
lblNgJudgeA.setFont(new Font("微软雅黑", Font.PLAIN, 14));
|
|
|
- lblNgJudgeA.setBounds(204, 322, 167, 22);
|
|
|
+ lblNgJudgeA.setBounds(204, 358, 167, 22);
|
|
|
indexPanelA.add(lblNgJudgeA);
|
|
|
|
|
|
JLabel lblNgJudgeB = new JLabel("NG\u590d\u5224");
|
|
|
lblNgJudgeB.setFont(new Font("微软雅黑", Font.PLAIN, 14));
|
|
|
- lblNgJudgeB.setBounds(525, 322, 167, 22);
|
|
|
+ lblNgJudgeB.setBounds(525, 358, 167, 22);
|
|
|
indexPanelA.add(lblNgJudgeB);
|
|
|
|
|
|
resetResultA = new JButton("重拉");
|
|
|
@@ -879,7 +935,9 @@ public class MesClient extends JFrame {
|
|
|
smaxA = "";
|
|
|
sminA = "";
|
|
|
curA = "";
|
|
|
- ModbusUtil.setPowerOn(plcA);
|
|
|
+ if(cold_plate_bound){
|
|
|
+ ModbusUtil.setPowerOn(plcA);
|
|
|
+ }
|
|
|
}else{
|
|
|
setMenuStatus("NG中断未审核",-1);
|
|
|
}
|
|
|
@@ -888,7 +946,7 @@ public class MesClient extends JFrame {
|
|
|
});
|
|
|
resetResultA.setEnabled(false);
|
|
|
resetResultA.setFont(new Font("微软雅黑", Font.PLAIN, 14));
|
|
|
- resetResultA.setBounds(204, 348, 70, 36);
|
|
|
+ resetResultA.setBounds(204, 384, 70, 36);
|
|
|
indexPanelA.add(resetResultA);
|
|
|
|
|
|
okResultA = new JButton("OK");
|
|
|
@@ -923,7 +981,7 @@ public class MesClient extends JFrame {
|
|
|
okResultA.setEnabled(false);
|
|
|
okResultA.setForeground(new Color(0, 128, 0));
|
|
|
okResultA.setFont(new Font("微软雅黑", Font.PLAIN, 14));
|
|
|
- okResultA.setBounds(281, 348, 70, 36);
|
|
|
+ okResultA.setBounds(281, 384, 70, 36);
|
|
|
indexPanelA.add(okResultA);
|
|
|
|
|
|
ngResultA = new JButton("NG");
|
|
|
@@ -957,7 +1015,7 @@ public class MesClient extends JFrame {
|
|
|
ngResultA.setEnabled(false);
|
|
|
ngResultA.setForeground(new Color(255, 0, 0));
|
|
|
ngResultA.setFont(new Font("微软雅黑", Font.PLAIN, 14));
|
|
|
- ngResultA.setBounds(358, 348, 70, 36);
|
|
|
+ ngResultA.setBounds(358, 384, 70, 36);
|
|
|
indexPanelA.add(ngResultA);
|
|
|
|
|
|
resetResultB = new JButton("重拉");
|
|
|
@@ -989,7 +1047,7 @@ public class MesClient extends JFrame {
|
|
|
});
|
|
|
resetResultB.setEnabled(false);
|
|
|
resetResultB.setFont(new Font("微软雅黑", Font.PLAIN, 14));
|
|
|
- resetResultB.setBounds(525, 348, 70, 36);
|
|
|
+ resetResultB.setBounds(525, 384, 70, 36);
|
|
|
indexPanelA.add(resetResultB);
|
|
|
|
|
|
okResultB = new JButton("OK");
|
|
|
@@ -1024,7 +1082,7 @@ public class MesClient extends JFrame {
|
|
|
okResultB.setEnabled(false);
|
|
|
okResultB.setForeground(new Color(0, 128, 0));
|
|
|
okResultB.setFont(new Font("微软雅黑", Font.PLAIN, 14));
|
|
|
- okResultB.setBounds(602, 348, 70, 36);
|
|
|
+ okResultB.setBounds(602, 384, 70, 36);
|
|
|
indexPanelA.add(okResultB);
|
|
|
|
|
|
ngResultB = new JButton("NG");
|
|
|
@@ -1058,7 +1116,7 @@ public class MesClient extends JFrame {
|
|
|
ngResultB.setEnabled(false);
|
|
|
ngResultB.setForeground(new Color(255, 0, 0));
|
|
|
ngResultB.setFont(new Font("微软雅黑", Font.PLAIN, 14));
|
|
|
- ngResultB.setBounds(679, 348, 70, 36);
|
|
|
+ ngResultB.setBounds(679, 384, 70, 36);
|
|
|
indexPanelA.add(ngResultB);
|
|
|
|
|
|
tabbedPane.addTab("工作面板", new ImageIcon(MesClient.class.getResource("/bg/a_side.png")), indexScrollPaneA, null);
|
|
|
@@ -1199,4 +1257,61 @@ public class MesClient extends JFrame {
|
|
|
tabbedPane.addTab("绑定物料", new ImageIcon(MesClient.class.getResource("/bg/menu_data_preprocess.png")), indexScrollPaneB, null);
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 扫液冷板码并调用 bindWarehouse 绑定,成功后开启拉铆
|
|
|
+ */
|
|
|
+ public static void scanBarcodeLb() {
|
|
|
+ product_sn_lb.setText("");
|
|
|
+ cold_plate_bound = false;
|
|
|
+ String scanBarcode = JOptionPane.showInputDialog(null, "请扫液冷板码");
|
|
|
+ if(scanBarcode == null || scanBarcode.trim().isEmpty()) {
|
|
|
+ setMenuStatus("液冷板码为空,请重新扫码",1);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ scanBarcode = scanBarcode.trim();
|
|
|
+
|
|
|
+ getUser();
|
|
|
+ String warehouseSn = getBarcode(scanBarcode);
|
|
|
+ product_sn_lb.setText(scanBarcode);
|
|
|
+ mesClientFrame.repaint();
|
|
|
+
|
|
|
+ if(work_status != 1) {
|
|
|
+ product_sn_lb.setText("");
|
|
|
+ setMenuStatus("请先扫工件码",1);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ String sn = getBarcode(product_sn.getText());
|
|
|
+ getUser();
|
|
|
+ JSONObject retObj = DataUtil.bindWarehouseHttp(sn, warehouseSn, user20, COLD_PLATE_CRAFT);
|
|
|
+
|
|
|
+ if(retObj == null){
|
|
|
+ product_sn_lb.setText("");
|
|
|
+ cold_plate_bound = false;
|
|
|
+ MesClient.setMenuStatus("请求失败,请重试",-1);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if(retObj.get("result")!=null&&retObj.get("result").toString().equalsIgnoreCase("true")) {
|
|
|
+ cold_plate_bound = true;
|
|
|
+ MesClient.setMenuStatus("液冷板绑定成功,可开始拉铆",0);
|
|
|
+ enableRiveting();
|
|
|
+ }else{
|
|
|
+ product_sn_lb.setText("");
|
|
|
+ cold_plate_bound = false;
|
|
|
+ if(retObj.get("result")==null){
|
|
|
+ MesClient.setMenuStatus("请求失败,请重试",-1);
|
|
|
+ }else if(retObj.get("result").toString().equalsIgnoreCase("false")){
|
|
|
+ MesClient.setMenuStatus(retObj.getString("message"),-1);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 液冷板绑定成功后开启拉铆枪 */
|
|
|
+ public static void enableRiveting() {
|
|
|
+ ModbusUtil.setPowerOn(MesClient.plcA);
|
|
|
+ ModbusUtil.setPowerOn(MesClient.plcB);
|
|
|
+ ModbusUtil.setTask(MesClient.plcA,MesClient.aSetNum);
|
|
|
+ ModbusUtil.setTask(MesClient.plcB,MesClient.bSetNum);
|
|
|
+ }
|
|
|
+
|
|
|
}
|