张田野 hai 4 días
pai
achega
828d61967c

+ 21 - 2
src/com/mes/ui/DataUtil.java

@@ -157,6 +157,24 @@ public class DataUtil {
 //        }
 //    }
 
+    /**
+     * 按工位标识映射上传工位号:
+     * gwflag=A:A面->OP080A,B面->OP080B
+     * gwflag=B:A面->OP080C,B面->OP080D
+     */
+    public static String buildGwOprno(String mesGw, String sideOp){
+        String gw = mesGw == null ? "" : mesGw.trim();
+        String op = sideOp == null ? "" : sideOp;
+        if("B".equals(MesClient.mes_gwflag)){
+            if("A".equals(op)){
+                op = "C";
+            }else if("B".equals(op)){
+                op = "D";
+            }
+        }
+        return rightPad(gw + op, 6);
+    }
+
     public static Boolean sendMessage(NettyClient nettyClient,String msgType,String craft,String lx,String sn,String result,String user,String paramNums,String params,String op){
         try{
             String enconding = "UTF-8";
@@ -165,10 +183,11 @@ public class DataUtil {
             BufferedReader br = new BufferedReader(new InputStreamReader(is, enconding));
             pro.load(br);
 
-            if(MesClient.mes_gwflag.equals("B")){
+            // 080A机:AB面上传OP080A/OP080B;080B机:AB面上传OP080C/OP080D
+            if(MesClient.mes_gwflag != null && MesClient.mes_gwflag.equals("B")){
                 if(op.equals("A")){
                     op = "C";
-                }else{
+                }else if(op.equals("B")){
                     op = "D";
                 }
             }

+ 4 - 4
src/com/mes/ui/LoginFarme.java

@@ -194,10 +194,10 @@ public class LoginFarme extends JFrame {
                     }
 
                     if(MesClient.jfxPanel2 == null){
-                        String url = "http://"+ MesClient.mes_server_ip+":8980/js/a/mes/mesProcessCheckRecord/ulist?__sid="+MesClient.sessionid+"&oprno="+MesClient.mes_gw+"&lineSn="+MesClient.mes_line_sn;
-                        MesClient.jfxPanel2 = new MesWebView(url);
-                        MesClient.jfxPanel2.setSize(990, 550);
-                        MesClient.indexPanelC.add(MesClient.jfxPanel2);
+//                        String url = "http://"+ MesClient.mes_server_ip+":8980/js/a/mes/mesProcessCheckRecord/ulist?__sid="+MesClient.sessionid+"&oprno="+MesClient.mes_gw+"&lineSn="+MesClient.mes_line_sn;
+//                        MesClient.jfxPanel2 = new MesWebView(url);
+//                        MesClient.jfxPanel2.setSize(990, 550);
+//                        MesClient.indexPanelC.add(MesClient.jfxPanel2);
                     }
 
                     MesClient.initWarehouseData();

+ 88 - 39
src/com/mes/ui/MesClient.java

@@ -153,6 +153,8 @@ public class MesClient extends JFrame {
                 try{
                     //鐠囩粯鏋冩禒鍫曞帳缂冿拷
                     readProperty();
+                    s7PLC.setConnectTimeout(1000);
+                    s7PLC.setReceiveTimeout(1000);
 
                     // 閺勫墽銇氶悾宀勬桨
                     mesClientFrame = new MesClient();
@@ -189,13 +191,24 @@ public class MesClient extends JFrame {
         cjTimerText = new Timer();
         cjTimerText.schedule(new TimerTask() {
             public void run() {
-                txtfa.requestFocusInWindow();
+                try{
+                    if(txtfa != null && mesClientFrame != null && mesClientFrame.isDisplayable()){
+                        txtfa.requestFocusInWindow();
+                    }
 
-                MesClient.curPage = PlcUtil.getCurAside(s7PLC);
-                if(MesClient.curPage .equals("A")){
-                    page_text.setText("当前:A面");
-                }else{
-                    page_text.setText("当前:B面");
+                    MesClient.curPage = PlcUtil.getCurAside(s7PLC);
+                    final String pageLabel = MesClient.curPage.equals("A") ? "当前:A面" : "当前:B面";
+                    final String modelText = PlcUtil.getModelTypeText(s7PLC);
+                    SwingUtilities.invokeLater(new Runnable() {
+                        public void run() {
+                            if(page_text != null){
+                                page_text.setText(pageLabel);
+                            }
+                            applyModelTypeText(modelText);
+                        }
+                    });
+                }catch (Exception e){
+                    e.printStackTrace();
                 }
             }
         }, 1000,1000);
@@ -287,11 +300,10 @@ 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");
+        mes_gwflag = pro.getProperty("mes.gwflag");
 
         mes_gw_des = OprnoUtil.getGwDes(mes_line_sn,mes_gw);
 
-        mes_gwflag = pro.getProperty("mes.gwflag");
-
         System.out.println(mes_gw + ";" + mes_gw_des + ";" + mes_server_ip + ";" + mes_tcp_port + ";" + mes_heart_beat_cycle);
     }
 
@@ -448,6 +460,7 @@ public class MesClient extends JFrame {
     public static JTextField textField;
     public static JTextField textField_1;
     public static JTextField txtfa;
+    public static JLabel model_type_text;
     public static JLabel scan_type_text;
     public static JLabel page_text;
     //换班用户信息检查
@@ -910,14 +923,14 @@ public class MesClient extends JFrame {
         lblNewLabel.setHorizontalAlignment(SwingConstants.RIGHT);
         lblNewLabel.setFont(new Font("Microsoft YaHei UI", Font.PLAIN, 18));
         lblNewLabel.setBounds(26, 340, 100, 40);
-        lblNewLabel.setVisible(false);
+        lblNewLabel.setVisible(true);
         indexPanelA.add(lblNewLabel);
 
         JLabel lblNewLabel_1 = new JLabel("电流");
         lblNewLabel_1.setHorizontalAlignment(SwingConstants.RIGHT);
         lblNewLabel_1.setFont(new Font("Microsoft YaHei UI", Font.PLAIN, 18));
         lblNewLabel_1.setBounds(226, 340, 100, 40);
-        lblNewLabel_1.setVisible(false);
+        lblNewLabel_1.setVisible(true);
         indexPanelA.add(lblNewLabel_1);
 
         param1 = new JTextField();
@@ -926,7 +939,7 @@ public class MesClient extends JFrame {
         param1.setHorizontalAlignment(SwingConstants.CENTER);
         param1.setFont(new Font("Microsoft YaHei UI", Font.PLAIN, 18));
         param1.setBounds(136, 340, 70, 40);
-        param1.setVisible(false);
+        param1.setVisible(true);
         indexPanelA.add(param1);
         param1.setColumns(10);
 
@@ -937,14 +950,14 @@ public class MesClient extends JFrame {
         param2.setFont(new Font("Microsoft YaHei UI", Font.PLAIN, 18));
         param2.setColumns(10);
         param2.setBounds(345, 340, 70, 40);
-        param2.setVisible(false);
+        param2.setVisible(true);
         indexPanelA.add(param2);
 
         JLabel lblNewLabel_2 = new JLabel("送丝速度");
         lblNewLabel_2.setHorizontalAlignment(SwingConstants.RIGHT);
         lblNewLabel_2.setFont(new Font("Microsoft YaHei UI", Font.PLAIN, 18));
         lblNewLabel_2.setBounds(26, 401, 100, 40);
-        lblNewLabel_2.setVisible(false);
+        lblNewLabel_2.setVisible(true);
         indexPanelA.add(lblNewLabel_2);
 
         param3 = new JTextField();
@@ -954,14 +967,14 @@ public class MesClient extends JFrame {
         param3.setFont(new Font("Microsoft YaHei UI", Font.PLAIN, 18));
         param3.setColumns(10);
         param3.setBounds(136, 401, 70, 40);
-        param3.setVisible(false);
+        param3.setVisible(true);
         indexPanelA.add(param3);
 
         JLabel lblNewLabel_1_1 = new JLabel("错误代码");
         lblNewLabel_1_1.setHorizontalAlignment(SwingConstants.RIGHT);
         lblNewLabel_1_1.setFont(new Font("Microsoft YaHei UI", Font.PLAIN, 18));
         lblNewLabel_1_1.setBounds(213, 401, 122, 40);
-        lblNewLabel_1_1.setVisible(false);
+        lblNewLabel_1_1.setVisible(true);
         indexPanelA.add(lblNewLabel_1_1);
 
         param4 = new JTextField();
@@ -971,7 +984,7 @@ public class MesClient extends JFrame {
         param4.setFont(new Font("Microsoft YaHei UI", Font.PLAIN, 18));
         param4.setColumns(10);
         param4.setBounds(345, 401, 70, 40);
-        param4.setVisible(false);
+        param4.setVisible(true);
         indexPanelA.add(param4);
 
         param5 = new JTextField();
@@ -981,14 +994,14 @@ public class MesClient extends JFrame {
         param5.setFont(new Font("Microsoft YaHei UI", Font.PLAIN, 18));
         param5.setColumns(10);
         param5.setBounds(226, 470, 70, 40);
-        param5.setVisible(false);
+        param5.setVisible(true);
         indexPanelA.add(param5);
 
         JLabel lblNewLabel_1_1_1 = new JLabel("JOB号");
         lblNewLabel_1_1_1.setHorizontalAlignment(SwingConstants.RIGHT);
         lblNewLabel_1_1_1.setFont(new Font("Microsoft YaHei UI", Font.PLAIN, 18));
         lblNewLabel_1_1_1.setBounds(106, 470, 122, 40);
-        lblNewLabel_1_1_1.setVisible(false);
+        lblNewLabel_1_1_1.setVisible(true);
         indexPanelA.add(lblNewLabel_1_1_1);
 
         product_sn2 = new JTextField();
@@ -1013,7 +1026,7 @@ public class MesClient extends JFrame {
         lblNewLabel_3.setHorizontalAlignment(SwingConstants.RIGHT);
         lblNewLabel_3.setFont(new Font("Microsoft YaHei UI", Font.PLAIN, 18));
         lblNewLabel_3.setBounds(528, 340, 100, 40);
-        lblNewLabel_3.setVisible(false);
+        lblNewLabel_3.setVisible(true);
         indexPanelA.add(lblNewLabel_3);
 
         param21 = new JTextField();
@@ -1023,14 +1036,14 @@ public class MesClient extends JFrame {
         param21.setFont(new Font("Microsoft YaHei UI", Font.PLAIN, 18));
         param21.setColumns(10);
         param21.setBounds(638, 340, 70, 40);
-        param21.setVisible(false);
+        param21.setVisible(true);
         indexPanelA.add(param21);
 
         JLabel lblNewLabel_1_2 = new JLabel("电流");
         lblNewLabel_1_2.setHorizontalAlignment(SwingConstants.RIGHT);
         lblNewLabel_1_2.setFont(new Font("Microsoft YaHei UI", Font.PLAIN, 18));
         lblNewLabel_1_2.setBounds(742, 340, 100, 40);
-        lblNewLabel_1_2.setVisible(false);
+        lblNewLabel_1_2.setVisible(true);
         indexPanelA.add(lblNewLabel_1_2);
 
         param22 = new JTextField();
@@ -1040,14 +1053,14 @@ public class MesClient extends JFrame {
         param22.setFont(new Font("Microsoft YaHei UI", Font.PLAIN, 18));
         param22.setColumns(10);
         param22.setBounds(852, 340, 70, 40);
-        param22.setVisible(false);
+        param22.setVisible(true);
         indexPanelA.add(param22);
 
         JLabel lblNewLabel_2_1 = new JLabel("送丝速度");
         lblNewLabel_2_1.setHorizontalAlignment(SwingConstants.RIGHT);
         lblNewLabel_2_1.setFont(new Font("Microsoft YaHei UI", Font.PLAIN, 18));
         lblNewLabel_2_1.setBounds(528, 401, 100, 40);
-        lblNewLabel_2_1.setVisible(false);
+        lblNewLabel_2_1.setVisible(true);
         indexPanelA.add(lblNewLabel_2_1);
 
         param23 = new JTextField();
@@ -1057,14 +1070,14 @@ public class MesClient extends JFrame {
         param23.setFont(new Font("Microsoft YaHei UI", Font.PLAIN, 18));
         param23.setColumns(10);
         param23.setBounds(638, 401, 70, 40);
-        param23.setVisible(false);
+        param23.setVisible(true);
         indexPanelA.add(param23);
 
         JLabel lblNewLabel_1_1_2 = new JLabel("错误代码");
         lblNewLabel_1_1_2.setHorizontalAlignment(SwingConstants.RIGHT);
         lblNewLabel_1_1_2.setFont(new Font("Microsoft YaHei UI", Font.PLAIN, 18));
         lblNewLabel_1_1_2.setBounds(718, 401, 122, 40);
-        lblNewLabel_1_1_2.setVisible(false);
+        lblNewLabel_1_1_2.setVisible(true);
         indexPanelA.add(lblNewLabel_1_1_2);
 
         param24 = new JTextField();
@@ -1074,15 +1087,14 @@ public class MesClient extends JFrame {
         param24.setFont(new Font("Microsoft YaHei UI", Font.PLAIN, 18));
         param24.setColumns(10);
         param24.setBounds(852, 401, 70, 40);
-        param24.setVisible(false);
+        param24.setVisible(true);
         indexPanelA.add(param24);
 
         JLabel lblNewLabel_1_1_1_1 = new JLabel("JOB号");
         lblNewLabel_1_1_1_1.setHorizontalAlignment(SwingConstants.RIGHT);
         lblNewLabel_1_1_1_1.setFont(new Font("Microsoft YaHei UI", Font.PLAIN, 18));
         lblNewLabel_1_1_1_1.setBounds(609, 470, 122, 40);
-        lblNewLabel_1_1_1_1.setVisible(false);
-        lblNewLabel_1_1_1_1.setVisible(false);
+        lblNewLabel_1_1_1_1.setVisible(true);
         indexPanelA.add(lblNewLabel_1_1_1_1);
 
         param25 = new JTextField();
@@ -1092,7 +1104,7 @@ public class MesClient extends JFrame {
         param25.setFont(new Font("Microsoft YaHei UI", Font.PLAIN, 18));
         param25.setColumns(10);
         param25.setBounds(742, 470, 70, 40);
-        param25.setVisible(false);
+        param25.setVisible(true);
         indexPanelA.add(param25);
 
         pxstatus1 = new JLabel("A");
@@ -1117,15 +1129,15 @@ public class MesClient extends JFrame {
         lblNewLabel_4.setHorizontalAlignment(SwingConstants.CENTER);
         lblNewLabel_4.setFont(new Font("微软雅黑", Font.PLAIN, 24));
         lblNewLabel_4.setBounds(170, 290, 156, 40);
-        lblNewLabel_4.setVisible(false);
-//        indexPanelA.add(lblNewLabel_4);
+        lblNewLabel_4.setVisible(true);
+        indexPanelA.add(lblNewLabel_4);
 
         JLabel lblNewLabel_4_1 = new JLabel("\u710A\u673A2");
         lblNewLabel_4_1.setHorizontalAlignment(SwingConstants.CENTER);
         lblNewLabel_4_1.setFont(new Font("微软雅黑", Font.PLAIN, 24));
         lblNewLabel_4_1.setBounds(670, 287, 156, 40);
-        lblNewLabel_4_1.setVisible(false);
-//        indexPanelA.add(lblNewLabel_4_1);
+        lblNewLabel_4_1.setVisible(true);
+        indexPanelA.add(lblNewLabel_4_1);
 
         JSeparator separator_1_1 = new JSeparator();
         separator_1_1.setOrientation(SwingConstants.VERTICAL);
@@ -1258,9 +1270,16 @@ public class MesClient extends JFrame {
         scan_type_text.setForeground(new Color(255, 128, 64));
         scan_type_text.setHorizontalAlignment(SwingConstants.LEFT);
         scan_type_text.setFont(new Font("微软雅黑", Font.PLAIN, 20));
-        scan_type_text.setBounds(752, 10, 132, 60);
+        scan_type_text.setBounds(900, 10, 90, 60);
         indexPanelA.add(scan_type_text);
 
+        model_type_text = new JLabel("");
+        model_type_text.setForeground(new Color(0, 128, 255));
+        model_type_text.setHorizontalAlignment(SwingConstants.LEFT);
+        model_type_text.setFont(new Font("微软雅黑", Font.BOLD, 20));
+        model_type_text.setBounds(752, 10, 140, 60);
+        indexPanelA.add(model_type_text);
+
         tabbedPane.addTab("工作面板", new ImageIcon(MesClient.class.getResource("/bg/a_side.png")), indexScrollPaneA, null);
         tabbedPane.setEnabledAt(0, true);
 
@@ -1271,11 +1290,11 @@ public class MesClient extends JFrame {
         indexPanelGz.setLayout(null);
 
 
-        indexPanelC = new JPanel();
-        searchScrollPaneDj = new JScrollPane(indexPanelC);
-        indexPanelC.setLayout(null);
-
-        tabbedPane.addTab("开班点检", new ImageIcon(MesClient.class.getResource("/bg/menu_data_preprocess.png")), searchScrollPaneDj, null);
+//        indexPanelC = new JPanel();
+//        searchScrollPaneDj = new JScrollPane(indexPanelC);
+//        indexPanelC.setLayout(null);
+//
+//        tabbedPane.addTab("开班点检", new ImageIcon(MesClient.class.getResource("/bg/menu_data_preprocess.png")), searchScrollPaneDj, null);
 
 
         indexPanelB = new JPanel();
@@ -1311,6 +1330,36 @@ public class MesClient extends JFrame {
         }
     }
 
+    public static void updateModelTypeText(){
+        if(model_type_text == null){
+            return;
+        }
+        try{
+            final String modelText = PlcUtil.getModelTypeText(s7PLC);
+            SwingUtilities.invokeLater(new Runnable() {
+                public void run() {
+                    applyModelTypeText(modelText);
+                }
+            });
+        }catch (Exception e){
+            e.printStackTrace();
+        }
+    }
+
+    private static void applyModelTypeText(String modelText){
+        if(model_type_text == null){
+            return;
+        }
+        model_type_text.setText(modelText);
+        if("47车型".equals(modelText)){
+            model_type_text.setForeground(new Color(0, 128, 255));
+        }else if("27车型".equals(modelText)){
+            model_type_text.setForeground(new Color(255, 128, 0));
+        }else{
+            model_type_text.setForeground(Color.GRAY);
+        }
+    }
+
     public static void scanBarcode() {
         String scanBarcodeSn = txtfa.getText().trim();
         txtfa.setText("");

+ 4 - 76
src/com/mes/ui/MesRevice.java

@@ -1,12 +1,8 @@
 package com.mes.ui;
 
 import com.mes.netty.ProtocolParam;
-import com.mes.component.MyDialog;
 import com.mes.util.ErrorMsg;
 
-import javax.swing.*;
-import java.awt.*;
-
 public class MesRevice {
 
     // 质量查询
@@ -15,26 +11,10 @@ public class MesRevice {
             if(processMsgRet.equalsIgnoreCase("UD")) {
                 MesClient.setMenuStatus("该工件可以加工",0);
 
-                String oprno = ProtocolParam.getOprno(mes_msg).trim();
                 String sn = ProtocolParam.getSn(mes_msg).trim();
-                System.out.println(":"+oprno);
-                if(oprno.equals("OP110A")){
-                    String barcode36 = MesClient.getBarcode(sn);//处理36为码
-                    MesClient.getUser();
-                    DataUtil.startWork(MesClient.nettyClient,barcode36,MesClient.user20,"A");
-                }else if(oprno.equals("OP110B")){
-                    String barcode36 = MesClient.getBarcode(sn);//处理36为码
-                    MesClient.getUser();
-                    DataUtil.startWork(MesClient.nettyClient,barcode36,MesClient.user20,"B");
-                }else if(oprno.equals("OP110C")){
-                    String barcode36 = MesClient.getBarcode(sn);//处理36为码
-                    MesClient.getUser();
-                    DataUtil.startWork(MesClient.nettyClient,barcode36,MesClient.user20,"A");
-                }else if(oprno.equals("OP110D")){
-                    String barcode36 = MesClient.getBarcode(sn);//处理36为码
-                    MesClient.getUser();
-                    DataUtil.startWork(MesClient.nettyClient,barcode36,MesClient.user20,"B");
-                }
+                String barcode36 = MesClient.getBarcode(sn);
+                MesClient.getUser();
+                DataUtil.startWork(MesClient.nettyClient,barcode36,MesClient.user20,MesClient.curPage);
 
             }else {
                 if(MesClient.curPage.equals("A")){
@@ -42,7 +22,6 @@ public class MesRevice {
                 }else{
                     MesClient.check_quality_result2 = false;
                 }
-
                 String lmsg = ErrorMsg.getErrorMsg(processMsgRet, mes_msg);
                 MesClient.setMenuStatus(lmsg,-1);
                 PlcUtil.changeEnable(MesClient.s7PLC,false);
@@ -57,10 +36,7 @@ public class MesRevice {
         try{
             if(processMsgRet.equalsIgnoreCase("OK")) {
 
-                String oprno = ProtocolParam.getOprno(mes_msg).trim();
-                String sn = ProtocolParam.getSn(mes_msg).trim();
-
-                if(oprno.equals(MesClient.mes_gw+"A") || oprno.equals(MesClient.mes_gw+"C")){
+                if(MesClient.curPage.equals("A")){
                     MesClient.mesQualityFlagA = true;
                     MesClient.pxstatus1.setText("A:可以加工,等待设备启动");
                     MesClient.curSna = MesClient.product_sn.getText();
@@ -71,9 +47,6 @@ public class MesRevice {
                     MesClient.curSnb = MesClient.product_sn2.getText();
                     MesClient.tjFlagb = 1;
                 }
-//                System.out.println("scan_type1:"+MesClient.scan_type);
-//                MesClient.formatScanType(2);// 1=镭雕码 2=后梁码
-//                System.out.println("scan_type2:"+MesClient.scan_type);
                 PlcUtil.changeEnable(MesClient.s7PLC,true);
 
             }
@@ -87,28 +60,7 @@ public class MesRevice {
         try{
             String craft = ProtocolParam.getCraft(mes_msg);
             if(processMsgRet.equalsIgnoreCase("OK")) {
-//                if(craft.equals("400007")){
-//                    if(MesClient.scan_type == 1){
-//                        MesClient.batch_status = 1;
-//                        MesClient.batch_scan_1.setIcon(new ImageIcon(MesClient.class.getResource("/bg/delete.png")));
-//                        MesClient.batch_scan_1.setText("解绑");
-//                        MesClient.batch_scan_1.setEnabled(true);
-//                    }else{
-//                        MesClient.batch_status2 = 1;
-//                        MesClient.batch_scan_2.setIcon(new ImageIcon(MesClient.class.getResource("/bg/delete.png")));
-//                        MesClient.batch_scan_2.setText("解绑");
-//                        MesClient.batch_scan_2.setEnabled(true);
-//                    }
-//
-//                    PlcUtil.changeEnable(MesClient.s7PLC,true);
-//
-////                    MesClient.formatBatchSn();
-//                }
             }else{
-//                if(craft.equals("400007")){
-//                    JOptionPane.showMessageDialog(MesClient.mesClientFrame,"绑定失败,请重试","提醒", JOptionPane.INFORMATION_MESSAGE);
-//                    return;
-//                }
             }
         }catch (Exception e){
             e.printStackTrace();
@@ -119,28 +71,6 @@ public class MesRevice {
     public static void unbindRevice(String processMsgRet,String mes_msg){
         try{
             String craft = ProtocolParam.getCraft(mes_msg);
-//            if(processMsgRet.equalsIgnoreCase("OK")) {
-//                if(craft.equals("400007")){
-//                    if(MesClient.scan_type == 1){
-//                        MesClient.batch_status = 0;
-//                        MesClient.batch_scan_1.setIcon(new ImageIcon(MesClient.class.getResource("/bg/scan_barcode.png")));
-//                        MesClient.batch_scan_1.setText("扫码");
-//                        MesClient.batch_scan_1.setEnabled(true);
-//                    }else {
-//                        MesClient.batch_status2 = 0;
-//                        MesClient.batch_scan_2.setIcon(new ImageIcon(MesClient.class.getResource("/bg/scan_barcode.png")));
-//                        MesClient.batch_scan_2.setText("扫码");
-//                        MesClient.batch_scan_2.setEnabled(true);
-//                    }
-//                    PlcUtil.changeEnable(MesClient.s7PLC,false);
-////                    MesClient.formatBatchSn();
-//                }
-//            }else{
-//                if(craft.equals("400007")){
-//                    JOptionPane.showMessageDialog(MesClient.mesClientFrame,"解绑失败,请重试","提醒", JOptionPane.INFORMATION_MESSAGE);
-//                    return;
-//                }
-//            }
         }catch (Exception e){
             e.printStackTrace();
         }
@@ -166,12 +96,10 @@ public class MesRevice {
                 if(sn.equals(MesClient.product_sn.getText())){
                     MesClient.status_menu.setText("A件提交失败");
                     MesClient.pxstatus1.setText("A:提交失败");
-//                    MesClient.finish_ok_bt.setEnabled(true);
                     MesClient.tjStatusa = 1;
                 }else{
                     MesClient.status_menu.setText("B件提交失败");
                     MesClient.pxstatus2.setText("B:提交失败");
-//                    MesClient.finish_ng_bt.setEnabled(true);
                     MesClient.tjStatusb = 1;
                 }
             }

+ 2 - 18
src/com/mes/ui/OprnoUtil.java

@@ -6,27 +6,11 @@ import java.util.Map;
 
 public class OprnoUtil {
     public static String[] xtoprnos = new String[]{
-            "OP040", "OP050", "OP060", "OP070", "OP080",
-            "OP090", "OP100", "OP110", "OP120", "OP130",
-            "OP140", "OP150", "OP160", "OP170", "OP180",
-            "OP190", "OP200", "OP210", "OP220", "OP230",
-            "OP240", "OP250", "OP260", "OP270", "OP280",
-            "OP290", "OP300", "OP310", "OP320", "OP330",
-            "OP340", "OP350", "OP360", "OP370", "OP380",
-            "OP390", "OP400", "OP410", "OP420", "OP430",
-            "OP440", "OP450"
+             "OP080"
     };
 
     public static String[] xtoprnodes = new String[]{
-            "镭雕二维码", "前边梁小总成(焊接)", "前边梁小总成(拉铆)+右边梁小总成(拉铆)", "前边梁小总成气密", "前边梁小总成/左边梁小总成压铆",
-            "前边梁小总成/左边梁小总成涂胶", "框架CMT焊接", "框架CMT焊接", "焊道铣削", "焊道缺陷检验",
-            "框架气密", "总成正面CNC", "总成反面CNC", "框架清洁", "框架涂胶+液冷板安装",
-            "反面铆接", "激光点焊", "水冷板FSW", "清除FSW飞边", "TIG焊接水嘴",
-            "TIG补焊尾孔+封堵片焊接", "总成清洁+涂封堵胶", "涂胶+压套筒", "胶水固化", "正面装配",
-            "反面装配", "半成品气密", "箱体补强件位置涂胶", "安装补强件", "胶水固化",
-            "FSW焊道位置涂胶", "胶水固化", "底护板装配", "复拧螺栓", "成品气密",
-            "液冷板气检", "总成检具", "CCD", "总成清洁", "终检",
-            "GP12", "包装"
+            "CMT总成焊接"
     };
     public static String[] lboprnos = new String[]{
 

+ 76 - 49
src/com/mes/ui/PlcUtil.java

@@ -15,33 +15,18 @@ import java.util.Arrays;
 public class PlcUtil {
 
     public static void getParamDyDl(S7PLC s7PLC){
-        Boolean starta = s7PLC.readBoolean("DB1.2.2"); //A启动中
-        Boolean startb = s7PLC.readBoolean("DB1.2.3"); //B启动中
-
-        String oprno = MesClient.mes_gw+"A";
-        if(startb){
-            oprno = MesClient.mes_gw+"B";
-        }
-        if(MesClient.mes_gwflag.equals("B")){
-            if(oprno.equals(MesClient.mes_gw+"A")){
-                oprno = MesClient.mes_gw+"C";
-            }else{
-                oprno = MesClient.mes_gw+"D";
-            }
-        }
-
-        if(MesClient.tjFlaga == 2 || MesClient.tjFlagb == 2){ //运行中
+        try{
             Float dya = s7PLC.readFloat32("DB1010.2");
             Float dla = s7PLC.readFloat32("DB1010.8");
             Float ssa = s7PLC.readFloat32("DB1010.14");
             Short cwa = s7PLC.readInt16("DB1010.18");
             Short joba = s7PLC.readInt16("DB1010.20");
 
-//            MesClient.param1.setText(dya+"");
-//            MesClient.param2.setText(dla+"");
-//            MesClient.param3.setText(ssa+"");
-//            MesClient.param4.setText(cwa+"");
-//            MesClient.param5.setText(joba+"");
+            MesClient.param1.setText(dya+"");
+            MesClient.param2.setText(dla+"");
+            MesClient.param3.setText(ssa+"");
+            MesClient.param4.setText(cwa+"");
+            MesClient.param5.setText(joba+"");
 
             Float dyb = s7PLC.readFloat32("DB1010.26");
             Float dlb = s7PLC.readFloat32("DB1010.34");
@@ -49,28 +34,44 @@ public class PlcUtil {
             Short cwb = s7PLC.readInt16("DB1010.46");
             Short jobb = s7PLC.readInt16("DB1010.48");
 
-//            MesClient.param21.setText(dyb+"");
-//            MesClient.param22.setText(dlb+"");
-//            MesClient.param23.setText(ssb+"");
-//            MesClient.param24.setText(cwb+"");
-//            MesClient.param25.setText(jobb+"");
+            MesClient.param21.setText(dyb+"");
+            MesClient.param22.setText(dlb+"");
+            MesClient.param23.setText(ssb+"");
+            MesClient.param24.setText(cwb+"");
+            MesClient.param25.setText(jobb+"");
+
+            if(MesClient.tjFlaga != 2 && MesClient.tjFlagb != 2){
+                return;
+            }
+
+            Boolean startb = s7PLC.readBoolean("DB16.0.1"); //B面启动中
+            String oprno = MesClient.mes_gw+"A";
+            if(startb){
+                oprno = MesClient.mes_gw+"B";
+            }
+            // 080A机:AB;080B机:CD
+            if(MesClient.mes_gwflag != null && MesClient.mes_gwflag.equals("B")){
+                if(oprno.equals(MesClient.mes_gw+"A")){
+                    oprno = MesClient.mes_gw+"C";
+                }else{
+                    oprno = MesClient.mes_gw+"D";
+                }
+            }
 
             String record_time = DateLocalUtils.getCurrentTime();
             MesClient.hjparams.add(dya+"|"+dla+"|"+ssa+"|"+cwa+"|"+joba+"|"+dyb+"|"+dlb+"|"+ssb+"|"+cwb+"|"+jobb+"|"+record_time);
 
             if(MesClient.hjparams.size() == 60){
-                try{
-                    if(MesClient.curFlag.equals("A")){
-                        JdbcUtils.insertCmtData(oprno,MesClient.mes_line_sn,MesClient.product_sn.getText(), JSON.toJSONString(MesClient.hjparams));
-                    }else{
-                        JdbcUtils.insertCmtData(oprno,MesClient.mes_line_sn,MesClient.product_sn2.getText(), JSON.toJSONString(MesClient.hjparams));
-                    }
-                    System.out.println("cmt:"+MesClient.curFlag);
-                    MesClient.hjparams = new ArrayList<>();
-                }catch (Exception e){
-                    e.printStackTrace();
+                if(MesClient.curFlag.equals("A")){
+                    JdbcUtils.insertCmtData(oprno,MesClient.mes_line_sn,MesClient.product_sn.getText(), JSON.toJSONString(MesClient.hjparams));
+                }else{
+                    JdbcUtils.insertCmtData(oprno,MesClient.mes_line_sn,MesClient.product_sn2.getText(), JSON.toJSONString(MesClient.hjparams));
                 }
+                System.out.println("cmt:"+MesClient.curFlag);
+                MesClient.hjparams = new ArrayList<>();
             }
+        }catch (Exception e){
+            e.printStackTrace();
         }
     }
 
@@ -227,7 +228,7 @@ public class PlcUtil {
     // 获取A启动状态
     public static Boolean getAStart(S7PLC s7PLC){
         try{
-            return s7PLC.readBoolean("DB1.2.2");
+            return s7PLC.readBoolean("DB16.0.0"); //A面启动中
         }catch (Exception e){
             e.printStackTrace();
             return false;
@@ -237,8 +238,8 @@ public class PlcUtil {
     // 获取A的结束状态
     public static Boolean getAFinish(S7PLC s7PLC){
         try{
-            boolean a = s7PLC.readBoolean("DB1.2.5");
-            boolean b = s7PLC.readBoolean("DB1.2.6");
+            boolean a = s7PLC.readBoolean("DB16.0.3"); //A焊接完成
+            boolean b = s7PLC.readBoolean("DB16.0.1"); //B面启动中,A当做完成
             return a || b;
         }catch (Exception e){
             e.printStackTrace();
@@ -249,7 +250,7 @@ public class PlcUtil {
     // 获取B启动状态
     public static Boolean getBStart(S7PLC s7PLC){
         try{
-            return s7PLC.readBoolean("DB1.2.6");
+            return s7PLC.readBoolean("DB16.0.1"); //B面启动中
         }catch (Exception e){
             e.printStackTrace();
             return false;
@@ -259,8 +260,8 @@ public class PlcUtil {
     // 获取B的结束状态
     public static Boolean getBFinish(S7PLC s7PLC){
         try{
-            boolean a = s7PLC.readBoolean("DB1.2.7");
-            boolean b = s7PLC.readBoolean("DB1.2.4");
+            boolean a = s7PLC.readBoolean("DB16.0.5"); //B焊接完成
+            boolean b = s7PLC.readBoolean("DB16.0.0"); //A面启动中,B当做完成
             return a || b;
         }catch (Exception e){
             e.printStackTrace();
@@ -269,12 +270,11 @@ public class PlcUtil {
     }
 
     // 修改设备的禁用开关
-//    DB9.26.4  MES允许启动信号
+//    DB13.0.0  MES允许启动信号
     public static Boolean changeEnable(S7PLC s7PLC,Boolean result){
         try{
-            //DB9.21.7 A//DB9.26.4 B
-            s7PLC.writeBoolean("DB9.23.7",result);
-//            s7PLC.writeBoolean("DB9.21.7",result);
+            s7PLC.writeBoolean("DB13.0.0",result);
+//            s7PLC.writeBoolean("DB9.23.7",result);
             return true;
         }catch (Exception e){
             e.printStackTrace();
@@ -286,17 +286,44 @@ public class PlcUtil {
     public static String getCurAside(S7PLC s7PLC){
         String str = "A";
         try{
-            Boolean ret = s7PLC.readBoolean("DB1.2.0"); // 当前A面
-            if(!ret){
+            Boolean aSide = s7PLC.readBoolean("DB16.0.6"); //A面
+            Boolean bSide = s7PLC.readBoolean("DB16.0.7"); //B面
+            if(bSide && !aSide){
                 str = "B";
             }
-
         }catch (Exception e){
             e.printStackTrace();
         }
         return str;
     }
 
+    // 国内车型 DB16.DBX47.0 / 国外车型 DB16.DBX27.0(文档记法 DB16.1.47 / DB16.1.27)
+    public static Boolean isDomesticModel(S7PLC s7PLC){
+        try{
+            return s7PLC.readBoolean("DB16.47");
+        }catch (Exception e){
+            e.printStackTrace();
+            return false;
+        }
+    }
+
+    public static Boolean isExportModel(S7PLC s7PLC){
+        try{
+            return s7PLC.readBoolean("DB16.27");
+        }catch (Exception e){
+            e.printStackTrace();
+            return false;
+        }
+    }
 
+    public static String getModelTypeText(S7PLC s7PLC){
+        if(isDomesticModel(s7PLC)){
+            return "47车型";
+        }
+        if(isExportModel(s7PLC)){
+            return "27车型";
+        }
+        return "";
+    }
 
 }

+ 3 - 3
src/resources/config/config.properties

@@ -1,7 +1,7 @@
-mes.gw=OP110
+mes.gw=OP080
 #mes.server_ip=127.0.0.1
-mes.server_ip=192.168.22.99
+mes.server_ip=192.168.24.99
 mes.tcp_port=3000
 mes.heart_beat_cycle=60
 mes.line_sn=XT
-mes.gwflag=B
+mes.gwflag=A