dkk 1 天之前
父節點
當前提交
547a8136e8

+ 9 - 216
src/com/mes/ui/MesClient.java

@@ -2,8 +2,6 @@ package com.mes.ui;
 
 import com.alibaba.fastjson2.JSON;
 import com.alibaba.fastjson2.JSONObject;
-import com.github.xingshuangs.iot.protocol.s7.enums.EPlcType;
-import com.github.xingshuangs.iot.protocol.s7.service.S7PLC;
 import com.mes.component.MesRadio;
 import com.mes.component.MesWebView;
 import com.mes.netty.NettyClient;
@@ -85,9 +83,7 @@ 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 String user20 = "";
 
@@ -119,13 +115,11 @@ public class MesClient extends JFrame {
     public static JTextField torsionalMaxValue; //扭力值范围
     public static JTextField torsionalValue;//当前扭力值
     public static Integer cur = 0; // 当前数
-    public static Integer max = 91; //任务数
+    public static Integer max = 3; //任务数
     public static List<String> atids = new ArrayList<>();
     public static ArrayList<String> torsionalValueList = new ArrayList<String>();//扭力值存储数组
     public static Boolean fininsh_flag = false; // false=不合格 true=合格
 
-    public static S7PLC s7PLC = new S7PLC(EPlcType.S1200,"10.88.10.80");
-
     public static void main(String[] args) {
         EventQueue.invokeLater(new Runnable() {
             @Override
@@ -354,8 +348,6 @@ public class MesClient extends JFrame {
         MesClient.finish_ok_bt.setEnabled(false);
         MesClient.finish_ng_bt.setEnabled(false);
         product_sn.setText("");
-        product_sn_lb.setText("");
-        f_scan_data_bt_2.setEnabled(false);
 
         MesClient.f_scan_data_bt_1.setEnabled(true);
         MesClient.setMenuStatus("请扫工件码",0);
@@ -474,32 +466,6 @@ public class MesClient extends JFrame {
         }
     }
 
-    public static void scanBarcodeLb() {
-        product_sn_lb.setText("");
-        String scanBarcodeTitle = "请扫底护板码";
-        String scanBarcode = JOptionPane.showInputDialog(null, scanBarcodeTitle);
-        if(scanBarcode!=null&&!scanBarcode.equalsIgnoreCase("")) {
-            getUser();
-            product_sn_lb.setText(scanBarcode);
-            mesClientFrame.repaint();
-
-            if(work_status == 1){
-                String warehouseSn = getBarcode(product_sn_lb.getText());
-                String sn = getBarcode(product_sn.getText());
-                Boolean ret = DataUtil.bindWarehouse(nettyClient, sn, warehouseSn, user20, "400007");
-                if(ret != null && ret) {
-                    MesClient.setMenuStatus("绑定成功",0);
-                } else {
-                    MesClient.setMenuStatus("请求失败,请重试",-1);
-                }
-            }else{
-                setMenuStatus("请先扫工件码",1);
-            }
-        }else {
-            setMenuStatus("底护板码为空,请重新扫码",1);
-        }
-    }
-
     public static void logoff() {
 //        welcomeWin.setVisible(true);
         mesClientFrame.setVisible(false);
@@ -575,64 +541,6 @@ public class MesClient extends JFrame {
 //        settingMenu.add(resetTcpMenu_1);
 
 
-        //允许上料
-        JMenuItem allow_up_material = new JMenuItem("允许上料");
-        allow_up_material.setIcon(new ImageIcon(MesClient.class.getResource("/bg/reset_logo.png")));
-        allow_up_material.setFont(new Font("微软雅黑", Font.PLAIN, 20));
-        allow_up_material.addMouseListener(new MouseAdapter() {
-            @Override
-            public void mousePressed(MouseEvent e) {
-                super.mouseClicked(e);
-                // 弹框输入密码,如果输入的为”503833“即可允许上料
-                String input = JOptionPane.showInputDialog(null, "请输入密码");
-                if (!input.equalsIgnoreCase("503833")) {
-                    JOptionPane.showMessageDialog(mesClientFrame, "密码错误", "提示窗口", JOptionPane.INFORMATION_MESSAGE);
-                    return;
-                }
-                // 允许上料
-                MesClient.s7PLC.writeBoolean("DB503.216.2", true);
-            }
-        });
-        settingMenu.add(allow_up_material);
-        // 允许下料
-        JMenuItem allow_down_material = new JMenuItem("允许下料");
-        allow_down_material.setIcon(new ImageIcon(MesClient.class.getResource("/bg/reset_logo.png")));
-        allow_down_material.setFont(new Font("微软雅黑", Font.PLAIN, 20));
-        allow_down_material.addMouseListener(new MouseAdapter() {
-            @Override
-            public void mousePressed(MouseEvent e) {
-                super.mouseClicked(e);
-                // 弹框输入密码,如果输入的为”503833“即可允许下料
-                String input = JOptionPane.showInputDialog(null, "请输入密码");
-                if (!input.equalsIgnoreCase("503833")) {
-                    JOptionPane.showMessageDialog(mesClientFrame, "密码错误", "提示窗口", JOptionPane.INFORMATION_MESSAGE);
-                    return;
-                }
-                MesClient.s7PLC.writeBoolean("DB503.216.5", true);
-            }
-        });
-        settingMenu.add(allow_down_material);
-        // 重置信号
-        JMenuItem reset_signal = new JMenuItem("重置信号");
-        reset_signal.setIcon(new ImageIcon(MesClient.class.getResource("/bg/reset_logo.png")));
-        reset_signal.setFont(new Font("微软雅黑", Font.PLAIN, 20));
-        reset_signal.addMouseListener(new MouseAdapter() {
-            @Override
-            public void mousePressed(MouseEvent e) {
-                super.mouseClicked(e);
-                // 弹框输入密码,如果输入的为”503833“即可允许下料
-                String input = JOptionPane.showInputDialog(null, "请输入密码");
-                if (!input.equalsIgnoreCase("503833")) {
-                    JOptionPane.showMessageDialog(mesClientFrame, "密码错误", "提示窗口", JOptionPane.INFORMATION_MESSAGE);
-                    return;
-                }
-                MesClient.s7PLC.writeBoolean("DB503.216.2", false);
-                MesClient.s7PLC.writeBoolean("DB503.216.5", false);
-            }
-        });
-        settingMenu.add(reset_signal);
-
-
 
         contentPane = new JPanel();
         contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
@@ -746,42 +654,9 @@ public class MesClient extends JFrame {
         f_scan_data_bt_1.setIcon(new ImageIcon(MesClient.class.getResource("/bg/scan_barcode.png")));
         f_scan_data_bt_1.setFont(new Font("微软雅黑", Font.PLAIN, 32));
         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(20, 165, 100, 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, 160, 580, 70);
-//        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, 160, 140, 70);
-        f_scan_data_bt_2.setEnabled(false);
-//        indexPanelA.add(f_scan_data_bt_2);
+        indexPanelA.add(f_scan_data_bt_1);
 
-        finish_ok_bt = new JButton("下一件");
+        finish_ok_bt = new JButton("提交");
         finish_ok_bt.setEnabled(false);
         finish_ok_bt.addActionListener(new ActionListener() {
             public void actionPerformed(ActionEvent e) {
@@ -799,6 +674,11 @@ public class MesClient extends JFrame {
                     setMenuStatus("未扫工件码!",-1);
                     return;
                 }
+                // 校验扭力监控:已完成数必须等于任务数才允许提交
+                if(cur == null || max == null || !cur.equals(max)){
+                    setMenuStatus("扭力监控未完成("+cur+"/"+max+")!",-1);
+                    return;
+                }
 
                 if(work_status == 1 && check_quality_result){
 
@@ -825,7 +705,7 @@ public class MesClient extends JFrame {
         finish_ok_bt.setFont(new Font("微软雅黑", Font.PLAIN, 32));
         finish_ok_bt.setBounds(357, 457, 240, 80);
         finish_ok_bt.setEnabled(false);
-//        indexPanelA.add(finish_ok_bt);
+        indexPanelA.add(finish_ok_bt);
 
         finish_ng_bt = new JButton("NG");
         finish_ng_bt.setEnabled(false);
@@ -1097,91 +977,4 @@ public class MesClient extends JFrame {
 
 
 
-    // plc交互定时任务
-    public static java.util.Timer plcTimer;
-
-    // 程序逻辑流程:0:等待扫码信号
-    public static Integer index = 0;
-
-
-    public static void startPlcTimer(){
-        if (plcTimer != null){
-            plcTimer.cancel();
-            plcTimer = null;
-        }
-        plcTimer = new java.util.Timer();
-        plcTimer.schedule(new TimerTask() {
-            @Override
-            public void run() {
-                if (index == 0){
-                    String sn ="";
-                    if (MesClient.s7PLC.readBoolean("DB503.216.0") || MesClient.s7PLC.readBoolean("DB503.216.1")){
-                        if (MesClient.s7PLC.readBoolean("DB503.216.0")){
-                            sn = MesClient.s7PLC.readString("DB503.270.0");
-                            // 赋值给输入框
-                            product_sn.setText(sn);
-                        }else if (MesClient.s7PLC.readBoolean("DB503.216.1")){
-                            sn = MesClient.s7PLC.readString("DB503.336.0");
-                            // 赋值给输入框
-                            product_sn.setText(sn);
-                        }
-                        if (sn == null || sn.trim().isEmpty() || "".equals(sn)){
-                            setMenuStatus("机器臂抓手读码为空", -1);
-                            return;
-                        }
-                        MesClient.product_sn.setText( sn);
-                        index = 1;
-                    }
-                }else if (index == 1){
-                    // 取到二维码后发送质量检查
-                    String sn = MesClient.product_sn.getText();
-                    Boolean reg = DataUtil.checkQuality(MesClient.nettyClient, sn, MesClient.user20);
-                    if (!reg){
-                        setMenuStatus("报文发送异常", -1);
-                    }
-                }else if (index == 2){
-                    // 等待上料完成
-                    if(MesClient.s7PLC.readBoolean("DB503.216.3")){
-                        // 将允许上料清空
-                        MesClient.s7PLC.writeBoolean("DB503.216.2",false);
-                        // 发送开始做件
-                        Boolean reg = DataUtil.startWork(MesClient.nettyClient, MesClient.product_sn.getText(), MesClient.user20);
-                        if (!reg){
-                            setMenuStatus("报文发送异常", -1);
-                            return;
-                        }
-                    }
-                } else if (index == 3) {
-                    // 等待完成信号
-                    if (MesClient.s7PLC.readBoolean("DB503.216.4")){
-                        // 未到数量
-                        if (MesClient.cur < MesClient.max){
-                            //  菜单显示未拧紧完成
-                            setMenuStatus("未拧紧完成", -1);
-                            return;
-                        }
-                        Boolean reg = DataUtil.sendQuality( MesClient.product_sn.getText(), "OK",MesClient.user20);
-                        if (!reg){
-                            setMenuStatus("报文发送异常", -1);
-                            return;
-                        }
-                    }
-                } else if (index == 4) {
-                    //将允许上料信号及允许下料信号制空
-                    MesClient.s7PLC.writeBoolean("DB503.216.2", false);
-                    MesClient.s7PLC.writeBoolean("DB503.216.5", false);
-                    // 两个输入框制空
-                    product_sn.setText("");
-                    work_status = 0;
-                    check_quality_result = false;
-                    updateMaterailData();
-                    shiftUserCheck();
-                    index = 0;
-                }
-            }
-        }, 1000, 1000);
-    }
-
-
-
 }

+ 8 - 35
src/com/mes/ui/MesRevice.java

@@ -1,9 +1,6 @@
 package com.mes.ui;
 
-import com.mes.netty.ProtocolParam;
-import com.mes.component.MyDialog;
 import com.mes.util.ErrorMsg;
-import com.mes.ygsl.YgslUtil;
 
 import javax.swing.*;
 import java.awt.*;
@@ -20,11 +17,14 @@ public class MesRevice {
                 MesClient.status_menu.setForeground(Color.GREEN);
                 MesClient.check_quality_result = true;//质量合格,可以绑定加工
                 MesClient.status_menu.setText("该工件可以加工");
-                MesClient.s7PLC.writeBoolean("DB503.216.2",true);
-                MesClient.index = 2;
+                // 手动模式:质量合格后自动发送开始做件请求(原由PLC触发)
+                // 提交按钮在扭力监控达到最大值时由 YgslClientHandler 启用
+                Boolean startRet = DataUtil.startWork(MesClient.nettyClient, MesClient.product_sn.getText(), MesClient.user20);
+                if(!startRet){
+                    MesClient.setMenuStatus("开始做件请求发送失败,请重试",-1);
+                }
             }else {
                 MesClient.check_quality_result = false;
-                MesClient.f_scan_data_bt_2.setEnabled(false);
 
 //                String lmsg = ErrorMsg.getErrorMsg(processMsgRet, ProtocolParam.getLx(mes_msg));
                 String lmsg = ErrorMsg.getErrorMsg(processMsgRet, mes_msg);
@@ -47,19 +47,7 @@ public class MesRevice {
         try{
             if(processMsgRet.equalsIgnoreCase("OK")) {
                 MesClient.work_status = 1;
-                MesClient.index = 3;
-
-
-
-                /*String qret = "OK";
-                Boolean sendret = DataUtil.sendQuality(MesClient.nettyClient,sn,qret,MesClient.user20);
-                if(!sendret){
-//                    MesClient.finish_ok_bt.setEnabled(true);
-//                    MesClient.finish_ng_bt.setEnabled(true);
-                    MesClient.status_menu.setText("结果提交失败,请重试");
-                    JOptionPane.showMessageDialog(MesClient.mesClientFrame,"结果提交失败,请重试","提示窗口", JOptionPane.INFORMATION_MESSAGE);
-                    return;
-                }*/
+                // 提交按钮仅在扭力监控达到最大值时启用(由 YgslClientHandler 处理)
             }
         }catch (Exception e){
             e.printStackTrace();
@@ -96,25 +84,10 @@ public class MesRevice {
     public static void updateResultRevice(String processMsgRet,String mes_msg){
         try{
             if(processMsgRet.equalsIgnoreCase("OK")) {
-
-//                MesClient.resetScanA();
-////                MesClient.status_menu.setText("结果提交成功,请扫下一件");
-//                MesClient.setMenuStatus("结果提交成功,请扫下一件",0);
-//                MesClient.scan_type = 1;
-//                MesClient.scanBarcode();
-
-
-                // 下料允许
-                MesClient.s7PLC.writeBoolean("DB503.216.5", true);
-                //菜单提示信息
+                // 手动模式:结果提交成功("提交"按钮在发送成功后已重置界面,这里仅更新状态提示)
                 MesClient.setMenuStatus("结果提交成功,请扫下一件",0);
-                MesClient.index = 4;
-
             }else{
                 MesClient.setMenuStatus("结果提交失败,请重试",-1);
-//                MesClient.status_menu.setText("结果提交失败,请重试");
-//                JOptionPane.showMessageDialog(MesClient.mesClientFrame,"结果提交失败,请重试","提示窗口", JOptionPane.INFORMATION_MESSAGE);
-//                return;
             }
         }catch (Exception e){
             e.printStackTrace();

+ 37 - 13
src/com/mes/ui/OprnoUtil.java

@@ -21,23 +21,47 @@ public class OprnoUtil {
 //    };
 
     public static String[] xtoprnos = new String[]{
-            "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","OP460","OP470","OP480"
+            "OP040","OP050","OP060","OP070","OP080","OP090", "OP100","OP110A","OP110B","OP110C",
+            "OP120","OP130","OP140","OP150","OP160", "OP170A","OP170B","OP170C","OP170D",
+            "OP180", "OP190A","OP190B","OP190C", "OP200", "OP210A","OP210B", "OP210C","OP220",
+            "OP230", "OP240A","OP240B", "OP250", "OP260", "OP270", "OP275", "OP280A","OP280B",
+            "OP290", "OP300", "OP305", "OP310", "OP315", "OP320", "OP330","OP340A",
+            "OP340B", "OP350", "OP360", "OP370", "OP380", "OP390", "OP400", "OP410", "OP420",
+            "OP430", "OP440", "OP450", "OP460"
     };
 
     public static String[] xtoprnodes = new String[]{
-            "牙套安装", "后侧梁左小总成焊接", "后侧梁找漏", "边梁压铆", "框架CMT焊接",
-            "人工补焊", "焊道打磨", "焊道检查", "框架找漏", "框架正面CNC", "框架反面CNC", "框架去毛刺+清洁",
-            "封堵片焊接", "封堵片打磨+清洁", "框架涂胶", "液冷板装配", "中吊点安装+正面清理溢胶", "液冷板FSW",
-            "匙孔补焊", "焊道打磨、清洁", "总成反面紧固件安装", "边梁套筒涂胶+压合", "总成正面拉铆", "封堵",
-            "胶水固化", "半成品气密", "贴泡棉", "拉铆螺母涂胶", "FSW焊道涂胶", "刮胶", "底护板安装",
-            "底护板复拧+堵盖安装", "总成气密", "液冷板气密", "RPU加强件涂胶组装", "限位胶条+陶瓷复合带安装",
-            "总成清洁", "总成检具检", "CCD", "终检", "贴PET膜", "GP12", "下线拍照", "包装"
+            "单部件压铆+涂胶", "压铆", "单部件装配", "左边梁镭雕", "CMT框架焊接", "人工补焊",
+            "焊缝打磨", "框架反面CNC(1序)", "框架反面CNC(2序)", "框架反面CNC(3序)", "框架去毛刺+清洁+牙套",
+            "液冷板拉铆", "液冷板点焊+水嘴焊接", "液冷板FSW", "半总成找漏", "总成反面CNC(1序)",
+            "总成反面CNC(2序)", "总成反面CNC(3序)", "总成反面CNC(4序)", "匙孔补焊打磨+搅拌焊道打磨",
+            "总成正面CNC(1序)", "总成正面CNC(2序)", "总成正面CNC(3序)", "中吊点安装", "总成反面装配1(1序)",
+            "总成反面装配1(2序)", "总成反面装配1(3序)", "总成反面装配2", "总成正面装配1",
+            "总成正面装配2(1序)", "总成正面装配2(2序)", "中吊点安装", "边梁套筒涂胶+压合",
+            "箱体封堵", "胶水固化+静置", "半成品气密(1序)", "半成品气密(2序)", "密封件装配+加强板安装",
+            "双层拉铆螺母涂胶", "胶水固化", "焊道涂胶", "胶水固化", "加强板压紧工装拆卸+泡棉粘贴", "底护板装配",
+            "总成气密(1序)", "总成气密(2序)", "底护板螺栓复拧", "液冷板气密", "反面终检",
+            "PC条+陶瓷复合带粘贴+水嘴封堵", "总成清洁+PET粘贴", "CCD", "总成检具检验", "模拟客户安装界面(装拆)",
+            "正面终检", "正面GP12", "反面GP12", "称重"
     };
+//public static String[] xtoprnos = new String[]{
+//        "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","OP460","OP470","OP480"
+//};
+//
+//    public static String[] xtoprnodes = new String[]{
+//            "压铆", "后侧梁左小总成焊接", "后侧梁找漏", "边梁压铆", "框架CMT焊接",
+//            "人工补焊", "焊道打磨", "焊道检查", "框架找漏", "框架正面CNC", "框架反面CNC", "框架去毛刺+清洁",
+//            "封堵片焊接", "封堵片打磨+清洁", "框架涂胶", "液冷板装配", "中吊点安装+正面清理溢胶", "液冷板FSW",
+//            "匙孔补焊", "焊道打磨、清洁", "总成反面紧固件安装", "边梁套筒涂胶+压合", "总成正面拉铆", "封堵",
+//            "胶水固化", "半成品气密", "贴泡棉", "拉铆螺母涂胶", "FSW焊道涂胶", "刮胶", "底护板安装",
+//            "底护板复拧+堵盖安装", "总成气密", "液冷板气密", "RPU加强件涂胶组装", "限位胶条+陶瓷复合带安装",
+//            "总成清洁", "总成检具检", "CCD", "终检", "贴PET膜", "GP12", "下线拍照", "包装"
+//    };
     public static String[] lboprnos = new String[]{
             "OP040","OP050","OP060","OP070","OP080","OP090","OP100","OP110",
             "OP120","OP130","OP140","OP150","OP160","OP170","OP180","OP190",

+ 5 - 5
src/com/mes/ygsl/YgslClientHandler.java

@@ -157,7 +157,7 @@ public class YgslClientHandler extends ChannelInboundHandlerAdapter {
                                     }
 
 
-                                    //达到次数才能点击下一件
+                                    //达到次数才能点击提交按钮
                                     if (MesClient.cur == MesClient.max){
 //                                        MesClient.finish_ok_bt.setEnabled(true);
                                         if(MesClient.fininsh_flag){
@@ -196,10 +196,10 @@ public class YgslClientHandler extends ChannelInboundHandlerAdapter {
 
 
 
-                                        // 扭力到数后不自动提交;由操作员点击“下一件”提交结果
-                                        MesClient.finish_ok_bt.setEnabled(true);
-                                        MesClient.setMenuStatus("扭力到数,请点“下一件”提交", 0);
-                                        MesClient.result_text.setText("合格");
+                                        // 扭力到数后不自动提交;由操作员点击“提交”按钮提交结果
+                                    MesClient.finish_ok_bt.setEnabled(true);
+                                    MesClient.setMenuStatus("扭力到数,请点“提交”按钮提交", 0);
+                                    MesClient.result_text.setText("合格");
                                     }
 
 

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

@@ -1,8 +1,8 @@
 # ???
-mes.gw=OP350
+mes.gw=OP200
 # ???IP
 #mes.server_ip=127.0.0.1
-mes.server_ip=192.168.13.99
+mes.server_ip=192.168.14.99
 # TCP????
 mes.tcp_port=3000
 # TCP????