wangxichen 2 дней назад
Родитель
Сommit
ce35b47dc5
4 измененных файлов с 106 добавлено и 252 удалено
  1. 12 40
      src/com/mes/ui/DataUtil.java
  2. 65 56
      src/com/mes/ui/MesClient.java
  3. 9 58
      src/com/mes/ui/MesRevice.java
  4. 20 98
      src/com/mes/ui/PlcUtil.java

+ 12 - 40
src/com/mes/ui/DataUtil.java

@@ -60,6 +60,7 @@ public class DataUtil {
         try{
             String msgType = "AQDW";
             String gy = "100000";
+            // op 参数现在传的是完整 oprno(OP060A)
             Boolean aqdw_str = sendMessage(nettyClient,msgType,gy,"",sn,"",user,"00","",op);
             return aqdw_str;
         }catch (Exception e){
@@ -112,50 +113,34 @@ public class DataUtil {
         }
     }
 
-    public static Boolean sendQuality(NettyClient nettyClient,String sn,String ret,String user,String op){
+    public static Boolean sendQuality(NettyClient nettyClient,String sn,String ret,String user,String oprno){
         try{
             String msgType = "MQDW";
             String gy = "100000";
             String paramNums = "01";
-            String params = "";
-            if(op.equals("A")){
-                params = rightPad("Y"+MesClient.programNoA, 12);
-            }else{
-                params = rightPad("Y"+MesClient.programNoB, 12);
-            }
-            Boolean aqdw_str = sendMessage(nettyClient,msgType,gy,"",sn,ret,user,paramNums,params,op);
+            String params = rightPad("Y"+MesClient.programNoB, 12);
+            // oprno 参数现在直接传完整工序号(OP060A),不再拼接
+            Boolean aqdw_str = sendMessage(nettyClient,msgType,gy,"",sn,ret,user,paramNums,params,oprno);
             return aqdw_str;
         }catch (Exception e){
             return false;
         }
     }
 
-    public static Boolean sendQuality2(String sn,String result,String user,String op){
+    public static Boolean sendQuality2(String sn,String result,String user,String oprno){
         try{
             String msgType = "MQDW";
             String craft = "100000";
             String lx = "";
             String paramNums = "01";
-            String params = "";
-            if(op.equals("A")){
-                params = rightPad("Y"+MesClient.programNoA, 12);
-            }else{
-                params = rightPad("Y"+MesClient.programNoB, 12);
-            }
-
-            if(MesClient.mes_gwflag.equals("B")){
-                if(op.equals("A")){
-                    op = "C";
-                }else{
-                    op = "D";
-                }
-            }
+            String params = rightPad("Y"+MesClient.programNoB, 12);
 
             InputStream is = ClassLoader.getSystemResourceAsStream("config/config.properties");
             Properties pro = new Properties();
             BufferedReader br = new BufferedReader(new InputStreamReader(is, "UTF-8"));
             pro.load(br);
-            String gw = "GW"+rightPad(pro.getProperty("mes.gw")+op, 8);
+            // oprno 直接使用传入值,不再拼接和重映射
+            String gw = "GW"+rightPad(oprno, 8);
             String start = "aaaabbbbbABW";
             String gy = "GY" + rightPad(craft, 6);
             String reslx = "LX" + rightPad(lx, 2);
@@ -173,7 +158,7 @@ public class DataUtil {
         }
     }
 
-    public static Boolean sendMessage(NettyClient nettyClient,String msgType,String craft,String lx,String sn,String result,String user,String paramNums,String params,String op){
+    public static Boolean sendMessage(NettyClient nettyClient,String msgType,String craft,String lx,String sn,String result,String user,String paramNums,String params,String oprno){
         try{
             String enconding = "UTF-8";
             InputStream is = ClassLoader.getSystemResourceAsStream("config/config.properties");
@@ -181,21 +166,8 @@ public class DataUtil {
             BufferedReader br = new BufferedReader(new InputStreamReader(is, enconding));
             pro.load(br);
 
-            if(MesClient.mes_gwflag.equals("B")){
-                if(op.equals("A")){
-                    op = "C";
-                }else{
-                    op = "D";
-                }
-            }else if(MesClient.mes_gwflag.equals("C")){
-                if(op.equals("A")){
-                    op = "E";
-                }else{
-                    op = "F";
-                }
-            }
-
-            String gw = "GW"+rightPad(pro.getProperty("mes.gw")+op, 8);
+            // oprno 直接使用传入值,不再进行字母重映射
+            String gw = "GW"+rightPad(oprno, 8);
             String start = "aaaabbbbbABW";
             String gy = "GY" + rightPad(craft, 6);
             String reslx = "LX" + rightPad(lx, 2);

+ 65 - 56
src/com/mes/ui/MesClient.java

@@ -240,13 +240,7 @@ public class MesClient extends JFrame {
         cjTimer.schedule(new TimerTask() {
             public void run() {
                 try{
-                    if(!MesClient.sessionid.isEmpty()){
-                        PlcUtil.getStatusA(s7PLC);
-                    }
-                }catch (Exception e){
-                    e.printStackTrace();
-                }
-                try{
+                    // 只监控 B 面
                     if(!MesClient.sessionid.isEmpty()){
                         PlcUtil.getStatusB(s7PLC);
                     }
@@ -258,7 +252,6 @@ public class MesClient extends JFrame {
     }
 
     public static Timer cjTimerText;
-    public static String lastDetectedPage = ""; // 记录上次检测到的面
     public static void textFocus() {
         if(cjTimerText!=null) {
             cjTimerText.cancel();
@@ -269,17 +262,24 @@ public class MesClient extends JFrame {
                 textField.requestFocusInWindow();
 
                 String page = PlcUtil.getCurAside(s7PLC);
-                if(page.equals("A")){
-                    lblNewLabel_5.setText("当前:A面");
+                if(page != null && page.equals("B")){
+                    // B 面可扫码:绿色背景
+                    lblNewLabel_5.setText("当前:B面(可扫码)");
+                    lblNewLabel_5.setForeground(new Color(0, 128, 0));
+                    if(product_sn2.getText().isEmpty() || product_sn2.getText().contains("请等待")){
+                        product_sn2.setText("OP060 - 请扫码");
+                        product_sn2.setBackground(new Color(144, 238, 144));  // 浅绿色
+                        product_sn2.setForeground(Color.BLACK);
+                    }
                 }else{
-                    lblNewLabel_5.setText("当前:B面");
-                }
-                
-                // 识别完当前面后,给禁用信号(仅在面切换时执行)
-                if(!page.equals(lastDetectedPage)){
-                    lastDetectedPage = page;
-                    // Keep reserved start permission; side change only updates display state.
-                    System.out.println("turntable side changed: " + page + ", keep reserved enable signal");
+                    // A 面等待转台:灰色背景
+                    lblNewLabel_5.setText("当前:A面(等待转台)");
+                    lblNewLabel_5.setForeground(Color.GRAY);
+                    if(product_sn2.getText().isEmpty() || product_sn2.getText().contains("请扫码") || product_sn2.getText().contains("请等待")){
+                        product_sn2.setText("请等待转到B面扫码");
+                        product_sn2.setBackground(Color.LIGHT_GRAY);
+                        product_sn2.setForeground(Color.DARK_GRAY);
+                    }
                 }
             }
         }, 1000,1000);
@@ -474,7 +474,18 @@ public class MesClient extends JFrame {
         check_quality_result2 = false;
         MesClient.finish_ng_bt.setEnabled(true);
         MesClient.mesQualityFlagB = false;
-        product_sn2.setText("");
+
+        // 清空后根据转台位置恢复提示
+        String page = PlcUtil.getCurAside(s7PLC);
+        if(page != null && page.equals("B")){
+            product_sn2.setText("OP060 - 请扫码");
+            product_sn2.setBackground(new Color(144, 238, 144));  // 浅绿色
+            product_sn2.setForeground(Color.BLACK);
+        }else{
+            product_sn2.setText("请等待转到B面扫码");
+            product_sn2.setBackground(Color.LIGHT_GRAY);
+            product_sn2.setForeground(Color.DARK_GRAY);
+        }
 
         MesClient.pxstatus2.setText("B");
 
@@ -647,7 +658,8 @@ public class MesClient extends JFrame {
 
                     if(!sn.isEmpty()){
                         String qret = "OK";
-                        Boolean sendret = DataUtil.sendQuality(nettyClient,sn,qret,user20,"B");
+                        String oprno = mes_gw + mes_gwflag;  // OP060A
+                        Boolean sendret = DataUtil.sendQuality(nettyClient,sn,qret,user20,oprno);
                         if(!sendret){
                             MesClient.setMenuStatus("上传MES失败,请重试",-1);
                         }
@@ -775,21 +787,13 @@ public class MesClient extends JFrame {
         indexPanelA.setLayout(null);
 
         product_sn = new JTextField();
-        product_sn.setText("");
+        product_sn.setText("OP050工位(不监控)");
         product_sn.setHorizontalAlignment(SwingConstants.CENTER);
         product_sn.setEditable(false);
-        product_sn.setFont(new Font("Microsoft YaHei UI", Font.PLAIN, 22));
+        product_sn.setEnabled(false);  // 禁用
+        product_sn.setBackground(Color.LIGHT_GRAY);  // 灰色背景
+        product_sn.setFont(new Font("Microsoft YaHei UI", Font.PLAIN, 20));
         product_sn.setBounds(26, 144, 446, 70);
-        // 添加鼠标点击事件,点击显示二维码
-        product_sn.addMouseListener(new MouseAdapter() {
-            @Override
-            public void mouseClicked(MouseEvent e) {
-                String sn = product_sn.getText();
-                if(sn != null && !sn.trim().isEmpty()){
-                    new com.mes.component.QRCodeDialog(mesClientFrame, "A面工件码二维码", sn);
-                }
-            }
-        });
         indexPanelA.add(product_sn);
         product_sn.setColumns(10);
 
@@ -923,18 +927,19 @@ public class MesClient extends JFrame {
         indexPanelA.add(lblNewLabel_1_1_1);
         
         product_sn2 = new JTextField();
-        product_sn2.setText("");
+        product_sn2.setText("请等待转到B面扫码");
         product_sn2.setHorizontalAlignment(SwingConstants.CENTER);
-        product_sn2.setFont(new Font("Microsoft YaHei UI", Font.PLAIN, 22));
+        product_sn2.setFont(new Font("Microsoft YaHei UI", Font.BOLD, 22));
         product_sn2.setEditable(false);
         product_sn2.setColumns(10);
         product_sn2.setBounds(517, 144, 446, 70);
+        product_sn2.setBackground(Color.LIGHT_GRAY);  // 默认灰色,等待转台
         // 添加鼠标点击事件,点击显示二维码
         product_sn2.addMouseListener(new MouseAdapter() {
             @Override
             public void mouseClicked(MouseEvent e) {
                 String sn = product_sn2.getText();
-                if(sn != null && !sn.trim().isEmpty()){
+                if(sn != null && !sn.trim().isEmpty() && !sn.contains("请等待")){
                     new com.mes.component.QRCodeDialog(mesClientFrame, "B面工件码二维码", sn);
                 }
             }
@@ -1060,18 +1065,18 @@ public class MesClient extends JFrame {
         textField.setHorizontalAlignment(SwingConstants.LEFT);
         textField.setFont(new Font("Microsoft YaHei UI", Font.PLAIN, 22));
         textField.setColumns(10);
-        textField.setBounds(264, 10, 510, 50);
+        textField.setBounds(400, 10, 510, 50);  // 向右移动,给状态标签留空间
         textField.addActionListener(new ActionListener() {
             public void actionPerformed(ActionEvent e) {
                 scanBarcode();
             }
         });
         indexPanelA.add(textField);
-        
-        lblNewLabel_5 = new JLabel("当前:A面");
-        lblNewLabel_5.setForeground(new Color(0, 128, 64));
-        lblNewLabel_5.setFont(new Font("微软雅黑", Font.PLAIN, 20));
-        lblNewLabel_5.setBounds(136, 10, 113, 50);
+
+        lblNewLabel_5 = new JLabel("等待检测转台位置...");
+        lblNewLabel_5.setForeground(Color.GRAY);
+        lblNewLabel_5.setFont(new Font("微软雅黑", Font.BOLD, 20));
+        lblNewLabel_5.setBounds(126, 10, 360, 50);
         indexPanelA.add(lblNewLabel_5);
 
         tabbedPane.addTab("工作面板", new ImageIcon(MesClient.class.getResource("/bg/a_side.png")), indexScrollPaneA, null);
@@ -1351,28 +1356,32 @@ public class MesClient extends JFrame {
             return;
         }
 
-        String page = PlcUtil.getReserveSide(s7PLC);
-        if(page.equals("A")){
-            if(!product_sn.getText().isEmpty() && mesQualityFlagA){
-                MesClient.setMenuStatus("A面已存在工件码,勿重复扫码",1);
-                return;
-            }
-            product_sn.setText(sn);
-        }else{
-            if(!product_sn2.getText().isEmpty() && mesQualityFlagB){
-                MesClient.setMenuStatus("B面已存在工件码,勿重复扫码",1);
-                return;
-            }
-            product_sn2.setText(sn);
+        // 检查转台位置,只有在 B 面才允许扫码
+        String page = PlcUtil.getCurAside(s7PLC);
+        if(page == null || !page.equals("B")){
+            MesClient.setMenuStatus("请等待转到 B 面",1);
+            return;
         }
 
+        // 固定走 B 面逻辑
+        if(!product_sn2.getText().isEmpty() && !product_sn2.getText().contains("请扫码") && !product_sn2.getText().contains("请等待") && mesQualityFlagB){
+            MesClient.setMenuStatus("B面已存在工件码,勿重复扫码",1);
+            return;
+        }
+
+        // 显示工件码,恢复白色背景
+        product_sn2.setText(sn);
+        product_sn2.setBackground(Color.WHITE);
+        product_sn2.setForeground(Color.BLACK);
+
         MesClient.setMenuStatus("扫码成功",0);
 
         //刷新界面
         mesClientFrame.repaint();
         getUser();
-        // 查询工件质量
-        Boolean sendret = DataUtil.checkQuality(nettyClient,sn,user20,page);
+        // 查询工件质量,传入完整工序号
+        String oprno = mes_gw + mes_gwflag;  // OP060A
+        Boolean sendret = DataUtil.checkQuality(nettyClient,sn,user20,oprno);
         if(!sendret){
             MesClient.setMenuStatus("消息发送失败,请重试",1);
         }

+ 9 - 58
src/com/mes/ui/MesRevice.java

@@ -14,49 +14,17 @@ public class MesRevice {
     public static void checkQualityRevice(String processMsgRet,String mes_msg){
         try{
             if(processMsgRet.equalsIgnoreCase("UD")) {
-//                MesClient.status_menu.setForeground(Color.GREEN);
-//                MesClient.status_menu.setText("该工件可以加工");
-
                 String oprno = ProtocolParam.getOprno(mes_msg).trim();
                 String sn = ProtocolParam.getSn(mes_msg).trim();
 
                 MesClient.lastpage = 0;
-                if(oprno.equals(MesClient.mes_gw+"A") || oprno.equals(MesClient.mes_gw+"C") || oprno.equals(MesClient.mes_gw+"E")){
-                    MesClient.finish_ok_bt.setEnabled(false);
-                    MesClient.mesQualityFlagA = true;
-                    MesClient.pxstatus1.setText("A:可以加工,等待设备启动");
-                    MesClient.curSna = MesClient.product_sn.getText();
-                    MesClient.tjFlaga = 1;
-                    PlcUtil.changeEnable(MesClient.s7PLC, true, "A");
-
-
-                    // 程序号防错功能已注释
-                    // MesClient.programNoA = PlcUtil.getProgranNoA(MesClient.s7PLC)+"";
-                    // System.err.println(MesClient.programNoA);
-                    // System.err.println(CommonUtils.checkProgramNoSn(sn,MesClient.programNoA));
-                    // if(!CommonUtils.checkProgramNoSn(sn,MesClient.programNoA)){
-                    //     MesClient.pxstatus1.setText("A:当前工件与设备程序不匹配");
-                    //     MesClient.setMenuStatus("A:当前工件与设备程序不匹配",-1);
-                    // }
-
-
-
-                }else{
-                    MesClient.finish_ng_bt.setEnabled(false);
-                    MesClient.mesQualityFlagB = true;
-                    MesClient.pxstatus2.setText("B:可以加工,等待设备启动");
-                    MesClient.curSnb = MesClient.product_sn2.getText();
-                    MesClient.tjFlagb = 1;
-                    PlcUtil.changeEnable(MesClient.s7PLC, true, "B");
-
-                    // 程序号防错功能已注释
-                    // MesClient.programNoB = PlcUtil.getProgranNoB(MesClient.s7PLC)+"";
-//                    PlcUtil.changeEnable(MesClient.s7PLC,true);
-                    // if(!CommonUtils.checkProgramNoSn(sn,MesClient.programNoB)){
-                    //     MesClient.pxstatus2.setText("B:当前工件与设备程序不匹配");
-                    //     MesClient.setMenuStatus("B:当前工件与设备程序不匹配",-1);
-                    // }
-                }
+                // 只有 B 面逻辑
+                MesClient.finish_ng_bt.setEnabled(false);
+                MesClient.mesQualityFlagB = true;
+                MesClient.pxstatus2.setText("B:可以加工,等待设备启动");
+                MesClient.curSnb = MesClient.product_sn2.getText();
+                MesClient.tjFlagb = 1;
+                PlcUtil.changeEnable(MesClient.s7PLC, true, "B");
 
             }else {
                 if(MesClient.scan_type == 1){
@@ -118,6 +86,7 @@ public class MesRevice {
         try{
             String sn = ProtocolParam.getSn(mes_msg).trim();
             if(processMsgRet.equalsIgnoreCase("OK")) {
+                // 只有 B 面逻辑
                 if(sn.equals(MesClient.product_sn2.getText())){
                     MesClient.pxstatus2.setText("B:提交成功");
 
@@ -133,29 +102,11 @@ public class MesRevice {
                     }, "print-B").start();
 
                     MesClient.resetScanB();
-                }else{
-                    MesClient.pxstatus1.setText("A:提交成功");
-
-                    // 自动打印(后台异步)
-                    new Thread(() -> {
-                        try {
-                            // 查询钢印码
-                            String steelSn = DataUtil.getSteelSn(sn);
-                            com.mes.print.PrintHelper.autoPrint(sn, steelSn);
-                        } catch (Exception e) {
-                            System.err.println("[A面] 打印失败: " + e.getMessage());
-                        }
-                    }, "print-A").start();
-
-                    MesClient.resetScanA();
                 }
             }else{
+                // 只有 B 面逻辑
                 if(sn.equals(MesClient.product_sn2.getText())){
                     MesClient.pxstatus2.setText("B:提交失败");
-//                    MesClient.resetScanB();
-                }else{
-                    MesClient.pxstatus1.setText("A:提交失败");
-//                    MesClient.resetScanA();
                 }
             }
         }catch (Exception e){

+ 20 - 98
src/com/mes/ui/PlcUtil.java

@@ -11,11 +11,8 @@ import java.util.List;
 public class PlcUtil {
 
     private static final String DB = "DB200";
-    private static final String A_ENABLE = DB + ".0.1";
     private static final String B_ENABLE = DB + ".38.0";
-    private static final String A_STATUS = DB + ".34";
     private static final String B_STATUS = DB + ".72";
-    private static final String A_POSITION = DB + ".156.3";
     private static final String B_POSITION = DB + ".156.4";
 
     private static final WeldPoint[] WELD_POINTS = new WeldPoint[]{
@@ -29,7 +26,7 @@ public class PlcUtil {
     private static String lastParamValues = null;
 
     public static void getParamDyDl(S7PLC s7PLC) {
-        if (MesClient.tjFlaga == 2 || MesClient.tjFlagb == 2) {
+        if (MesClient.tjFlagb == 2) {
             List<String> values = readWeldParams(s7PLC);
             String recordTime = DateLocalUtils.getCurrentTime();
             values.add("time=" + recordTime);
@@ -78,19 +75,12 @@ public class PlcUtil {
         float r1WeldSpeed = valueOf(values, "R1:weldSpeed=");
         int r1Seq = (int) valueOf(values, "R1:seq=");
 
-        if ("B".equals(MesClient.curFlag)) {
-            MesClient.param21.setText(String.valueOf(r1Voltage));
-            MesClient.param22.setText(String.valueOf(r1Current));
-            MesClient.param23.setText(String.valueOf(r1WireSpeed));
-            MesClient.param24.setText(String.valueOf(r1Seq));
-            MesClient.param25.setText(String.valueOf(r1WeldSpeed));
-        } else {
-            MesClient.param1.setText(String.valueOf(r1Voltage));
-            MesClient.param2.setText(String.valueOf(r1Current));
-            MesClient.param3.setText(String.valueOf(r1WireSpeed));
-            MesClient.param4.setText(String.valueOf(r1Seq));
-            MesClient.param5.setText(String.valueOf(r1WeldSpeed));
-        }
+        // 只刷新 B 面控件
+        MesClient.param21.setText(String.valueOf(r1Voltage));
+        MesClient.param22.setText(String.valueOf(r1Current));
+        MesClient.param23.setText(String.valueOf(r1WireSpeed));
+        MesClient.param24.setText(String.valueOf(r1Seq));
+        MesClient.param25.setText(String.valueOf(r1WeldSpeed));
     }
 
     private static float valueOf(List<String> values, String prefix) {
@@ -108,18 +98,14 @@ public class PlcUtil {
 
     private static void saveCurrentParams() {
         try {
-            String oprno = MesClient.mes_gw + "A";
-            String sn = MesClient.curSna;
-            if ("B".equals(MesClient.curFlag)) {
-                oprno = MesClient.mes_gw + "B";
-                sn = MesClient.curSnb;
-            }
+            String oprno = MesClient.mes_gw + MesClient.mes_gwflag;  // OP060A
+            String sn = MesClient.curSnb;
 
             // 检查工件码和参数列表都不为空
             if (sn != null && !sn.trim().isEmpty()) {
                 if (MesClient.hjparams != null && !MesClient.hjparams.isEmpty()) {
                     JdbcUtils.insertCmtData(oprno, MesClient.mes_line_sn, sn, JSON.toJSONString(MesClient.hjparams));
-                    System.out.println("cmt:" + MesClient.curFlag + " sn:" + sn + " params_count:" + MesClient.hjparams.size());
+                    System.out.println("cmt:B sn:" + sn + " params_count:" + MesClient.hjparams.size());
                 } else {
                     System.out.println("weld params is empty, skip save (sn:" + sn + ")");
                 }
@@ -133,48 +119,6 @@ public class PlcUtil {
         }
     }
 
-    public static Boolean getAStart(S7PLC s7PLC) {
-        return getWeldStatus(s7PLC, "A") == 1;
-    }
-
-    public static Boolean getAFinish(S7PLC s7PLC) {
-        return getWeldStatus(s7PLC, "A") == 2;
-    }
-
-    public static void getStatusA(S7PLC s7PLC) {
-        int status = getWeldStatus(s7PLC, "A");
-        if (MesClient.tjFlaga == 1) {
-            if (status == 1) {
-                MesClient.curFlag = "A";
-                MesClient.tjFlaga = 2;
-                MesClient.pxstatus1.setText("A:\u8bbe\u5907\u8fd0\u884c\u4e2d");
-                if (MesClient.curSna == null || MesClient.curSna.isEmpty()) {
-                    MesClient.curSna = MesClient.product_sn.getText();
-                }
-                changeEnable(s7PLC, false, "A");
-            } else if (!getEnable(s7PLC, "A")) {
-                changeEnable(s7PLC, true, "A");
-            }
-        } else if (MesClient.tjFlaga == 2 && status == 2) {
-            finishA(s7PLC);
-        }
-    }
-
-    private static void finishA(S7PLC s7PLC) {
-        MesClient.tjFlaga = 3;
-        MesClient.pxstatus1.setText("A:\u8bbe\u5907\u8fd0\u884c\u7ed3\u675f,\u63d0\u4ea4\u7ed3\u679c\u4e2d");
-        MesClient.finish_ok_bt.setEnabled(true);
-        changeEnable(s7PLC, false, "A");
-        ackWeldStatus(s7PLC, "A");
-        saveCurrentParams();
-
-        Boolean sendret = DataUtil.sendQuality(MesClient.nettyClient, MesClient.product_sn.getText(), "OK", MesClient.user20, "A");
-        if (!sendret) {
-            MesClient.pxstatus1.setText("A:\u7ed3\u679c\u4e0a\u4f20MES\u5931\u8d25");
-            MesClient.tjStatusa = 1;
-        }
-    }
-
     public static Boolean getBStart(S7PLC s7PLC) {
         return getWeldStatus(s7PLC, "B") == 1;
     }
@@ -189,7 +133,7 @@ public class PlcUtil {
             if (status == 1) {
                 MesClient.curFlag = "B";
                 MesClient.tjFlagb = 2;
-                MesClient.pxstatus2.setText("B:\u8bbe\u5907\u8fd0\u884c\u4e2d");
+                MesClient.pxstatus2.setText("B:设备运行中");
                 if (MesClient.curSnb == null || MesClient.curSnb.isEmpty()) {
                     MesClient.curSnb = MesClient.product_sn2.getText();
                 }
@@ -204,21 +148,22 @@ public class PlcUtil {
 
     private static void finishB(S7PLC s7PLC) {
         MesClient.tjFlagb = 3;
-        MesClient.pxstatus2.setText("B:\u8bbe\u5907\u8fd0\u884c\u7ed3\u675f,\u63d0\u4ea4\u7ed3\u679c\u4e2d");
+        MesClient.pxstatus2.setText("B:设备运行结束,提交结果中");
         MesClient.finish_ng_bt.setEnabled(true);
         changeEnable(s7PLC, false, "B");
         ackWeldStatus(s7PLC, "B");
         saveCurrentParams();
 
-        Boolean sendret = DataUtil.sendQuality(MesClient.nettyClient, MesClient.product_sn2.getText(), "OK", MesClient.user20, "B");
+        String oprno = MesClient.mes_gw + MesClient.mes_gwflag;  // OP060A
+        Boolean sendret = DataUtil.sendQuality(MesClient.nettyClient, MesClient.product_sn2.getText(), "OK", MesClient.user20, oprno);
         if (!sendret) {
-            MesClient.pxstatus2.setText("B:\u7ed3\u679c\u4e0a\u4f20MES\u5931\u8d25");
+            MesClient.pxstatus2.setText("B:结果上传MES失败");
             MesClient.tjStatusb = 1;
         }
     }
 
     public static Boolean changeEnable(S7PLC s7PLC, Boolean result) {
-        return changeEnable(s7PLC, result, getCurAside(s7PLC));
+        return changeEnable(s7PLC, result, "B");
     }
 
     public static Boolean changeEnable(S7PLC s7PLC, Boolean result, String side) {
@@ -232,46 +177,23 @@ public class PlcUtil {
     }
 
     public static Boolean getEnable(S7PLC s7PLC) {
-        return getEnable(s7PLC, getCurAside(s7PLC));
+        return getEnable(s7PLC, "B");
     }
 
     public static Boolean getEnable(S7PLC s7PLC, String side) {
         return readBoolean(s7PLC, enableAddress(side));
     }
 
-    public static String getReserveSide(S7PLC s7PLC) {
-        int aStatus = getWeldStatus(s7PLC, "A");
-        int bStatus = getWeldStatus(s7PLC, "B");
-        if (aStatus == 1 || MesClient.tjFlaga == 2) {
-            return "B";
-        }
-        if (bStatus == 1 || MesClient.tjFlagb == 2) {
-            return "A";
-        }
-        return getCurAside(s7PLC);
-    }
-
     public static String getCurAside(S7PLC s7PLC) {
         try {
-            boolean aPosition = s7PLC.readBoolean(A_POSITION);
             boolean bPosition = s7PLC.readBoolean(B_POSITION);
-            if (aPosition) {
-                return "A";
-            }
             if (bPosition) {
                 return "B";
             }
         } catch (Exception e) {
             e.printStackTrace();
         }
-        if (MesClient.lastDetectedPage != null && !MesClient.lastDetectedPage.isEmpty()) {
-            return MesClient.lastDetectedPage;
-        }
-        return "A";
-    }
-
-    public static int getProgranNoA(S7PLC s7PLC) {
-        return 0;
+        return null;
     }
 
     public static int getProgranNoB(S7PLC s7PLC) {
@@ -291,11 +213,11 @@ public class PlcUtil {
     }
 
     private static String enableAddress(String side) {
-        return "B".equals(side) ? B_ENABLE : A_ENABLE;
+        return B_ENABLE;  // 只有 B 面
     }
 
     private static String statusAddress(String side) {
-        return "B".equals(side) ? B_STATUS : A_STATUS;
+        return B_STATUS;  // 只有 B 面
     }
 
     private static boolean readBoolean(S7PLC s7PLC, String address) {