张田野 1 неделя назад
Родитель
Сommit
a547908d88

+ 66 - 67
src/com/mes/ui/MesClient.java

@@ -87,7 +87,7 @@ public class MesClient extends JFrame {
     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 plcB = new ModbusTcp(1, "192.168.1.8"); // 单枪,B枪已停用
 //    public static ModbusTcp plcA = new ModbusTcp(1, "192.168.1.27");
 //    public static ModbusTcp plcB = new ModbusTcp(1, "192.168.1.28");
 
@@ -97,17 +97,17 @@ public class MesClient extends JFrame {
 
     public static Timer cjTimer3;
 
-    public static Short aSetNum = 40;
+    public static Short aSetNum = 13;
 //    public static Short aSetNum = 49;
     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 = 22;
+//    public static Short bSetNum = 22; // 单枪,B枪预设已停用
 //    public static Short bSetNum = 27;
-    public static Short sortB = 0;
-    public static Short bMax = 0;
-    public static List<Map> blist = new ArrayList<>();
+//    public static Short sortB = 0;
+//    public static Short bMax = 0;
+//    public static List<Map> blist = new ArrayList<>();
     public static Short deviceControl = 0; // 0=本地 1=远程
     public static Integer tjStatus = 0; // 1=提交失败
 
@@ -170,24 +170,24 @@ public class MesClient extends JFrame {
                             }
                         }
 
-                        List<Boolean> yxstatusb = plcB.readCoil(3128,1);
-                        if(yxstatusb.size() >= 1 && !yxstatusb.get(0)){
-                            if(!MesClient.curSn.isEmpty() && MesClient.bMax > 0 && MesClient.bMax == MesClient.sortB){
-                                ModbusUtil.setPowerOff(plcB);
-                            }else{
-                                ModbusUtil.setPowerOn(plcB);
-                            }
-                        }
+//                        List<Boolean> yxstatusb = plcB.readCoil(3128,1);
+//                        if(yxstatusb.size() >= 1 && !yxstatusb.get(0)){
+//                            if(!MesClient.curSn.isEmpty() && MesClient.bMax > 0 && MesClient.bMax == MesClient.sortB){
+//                                ModbusUtil.setPowerOff(plcB);
+//                            }else{
+//                                ModbusUtil.setPowerOn(plcB);
+//                            }
+//                        }
                     }else{
                         List<Boolean> yxstatus = plcA.readCoil(3128,1);
                         if(yxstatus.size() >= 1 && yxstatus.get(0)){
                             ModbusUtil.setPowerOff(plcA);
                         }
 
-                        List<Boolean> yxstatusb = plcB.readCoil(3128,1);
-                        if(yxstatusb.size() >= 1 && yxstatusb.get(0)){
-                            ModbusUtil.setPowerOff(plcB);
-                        }
+//                        List<Boolean> yxstatusb = plcB.readCoil(3128,1);
+//                        if(yxstatusb.size() >= 1 && yxstatusb.get(0)){
+//                            ModbusUtil.setPowerOff(plcB);
+//                        }
                     }
                 }catch (Exception e){
                     e.printStackTrace();
@@ -232,14 +232,13 @@ public class MesClient extends JFrame {
                     e.printStackTrace();
                 }
 
-                try{
-                    if(work_status == 1){
-                        ModbusUtil.getDataB(plcB);
-                    }
-
-                }catch (Exception e){
-                    e.printStackTrace();
-                }
+//                try{
+//                    if(work_status == 1){
+//                        ModbusUtil.getDataB(plcB);
+//                    }
+//                }catch (Exception e){
+//                    e.printStackTrace();
+//                }
             }
         }, 1000,500);
     }
@@ -410,29 +409,27 @@ public class MesClient extends JFrame {
         MesClient.setMenuStatus("请扫工件码",0);
 
         MesClient.aMax = 0;
-        MesClient.bMax = 0;
+//        MesClient.bMax = 0;
         MesClient.aFinish = 0;
         MesClient.alist = new ArrayList<>();
-        MesClient.blist = new ArrayList<>();
-        MesClient.sortB = 0;
+//        MesClient.blist = new ArrayList<>();
+//        MesClient.sortB = 0;
         MesClient.sortA = 0;
         MesClient.param1.setText("");
         MesClient.param2.setText("");
-        MesClient.param3.setText("");
-        MesClient.param4.setText("");
+//        MesClient.param3.setText("");
+//        MesClient.param4.setText("");
 
         deviceControl = ModbusUtil.getControlModel(plcA);
         if(deviceControl == 1){
 
         }
 
-//        plcA.writeCoil(3128,false);
-//        plcB.writeCoil(3128,false);
         ModbusUtil.setPowerOff(MesClient.plcA); // 远程关机
-        ModbusUtil.setPowerOff(MesClient.plcB); // 远程关机
+//        ModbusUtil.setPowerOff(MesClient.plcB); // 远程关机
 
         ModbusUtil.setTask(MesClient.plcA,MesClient.aSetNum);
-        ModbusUtil.setTask(MesClient.plcB,MesClient.bSetNum);
+//        ModbusUtil.setTask(MesClient.plcB,MesClient.bSetNum);
 
         updateMaterailData();
     }
@@ -749,7 +746,7 @@ public class MesClient extends JFrame {
         finish_ng_bt.setEnabled(false);
         indexPanelA.add(finish_ng_bt);
 
-        JLabel lblNewLabel = new JLabel("A\u67AA");
+        JLabel lblNewLabel = new JLabel("\u94C5\u67AA");
         lblNewLabel.setHorizontalAlignment(SwingConstants.CENTER);
         lblNewLabel.setFont(new Font("微软雅黑", Font.PLAIN, 20));
         lblNewLabel.setBounds(204, 186, 166, 28);
@@ -783,39 +780,41 @@ public class MesClient extends JFrame {
         param2.setBounds(288, 285, 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);
-        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);
-        indexPanelA.add(lblNewLabel_1_2);
-
+//        JLabel lblB = new JLabel("B\u67AA");
+//        lblB.setHorizontalAlignment(SwingConstants.CENTER);
+//        lblB.setFont(new Font("微软雅黑", Font.PLAIN, 20));
+//        lblB.setBounds(525, 186, 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);
+//        indexPanelA.add(lblNewLabel_1_2);
+//
+//        param3 = new JTextField();
+//        param3.setText("0");
+//        param3.setHorizontalAlignment(SwingConstants.CENTER);
+//        param3.setFont(new Font("微软雅黑", Font.PLAIN, 18));
+//        param3.setEditable(false);
+//        param3.setColumns(10);
+//        param3.setBounds(608, 241, 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);
+//        indexPanelA.add(lblNewLabel_1_1_1);
+//
+//        param4 = new JTextField();
+//        param4.setText("0");
+//        param4.setHorizontalAlignment(SwingConstants.CENTER);
+//        param4.setFont(new Font("微软雅黑", Font.PLAIN, 18));
+//        param4.setEditable(false);
+//        param4.setColumns(10);
+//        param4.setBounds(608, 285, 83, 34);
+//        indexPanelA.add(param4);
         param3 = new JTextField();
-        param3.setText("0");
-        param3.setHorizontalAlignment(SwingConstants.CENTER);
-        param3.setFont(new Font("微软雅黑", Font.PLAIN, 18));
-        param3.setEditable(false);
-        param3.setColumns(10);
-        param3.setBounds(608, 241, 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);
-        indexPanelA.add(lblNewLabel_1_1_1);
-
         param4 = new JTextField();
-        param4.setText("0");
-        param4.setHorizontalAlignment(SwingConstants.CENTER);
-        param4.setFont(new Font("微软雅黑", Font.PLAIN, 18));
-        param4.setEditable(false);
-        param4.setColumns(10);
-        param4.setBounds(608, 285, 83, 34);
-        indexPanelA.add(param4);
 
         tabbedPane.addTab("工作面板", new ImageIcon(MesClient.class.getResource("/bg/a_side.png")), indexScrollPaneA, null);
         tabbedPane.setEnabledAt(0, true);

+ 3 - 3
src/com/mes/ui/MesRevice.java

@@ -29,7 +29,7 @@ public class MesRevice {
 //
 //                }
                 ModbusUtil.setPowerOff(MesClient.plcA); // 远程关机
-                ModbusUtil.setPowerOff(MesClient.plcB); // 远程关机
+//                ModbusUtil.setPowerOff(MesClient.plcB); // 远程关机
 
             }
         }catch (Exception e){
@@ -54,10 +54,10 @@ public class MesRevice {
 //                MesClient.plcB.writeCoil(3128,false);
 
                 ModbusUtil.setPowerOn(MesClient.plcA); // 远程开机
-                ModbusUtil.setPowerOn(MesClient.plcB); // 远程开机
+//                ModbusUtil.setPowerOn(MesClient.plcB); // 远程开机
 
                 ModbusUtil.setTask(MesClient.plcA,MesClient.aSetNum);
-                ModbusUtil.setTask(MesClient.plcB,MesClient.bSetNum);
+//                ModbusUtil.setTask(MesClient.plcB,MesClient.bSetNum);
             }
         }catch (Exception e){
             e.printStackTrace();

+ 43 - 65
src/com/mes/ui/ModbusUtil.java

@@ -45,10 +45,10 @@ public class ModbusUtil {
             MesClient.param2.setText(cur+"");
             System.out.println("cur:"+cur);
 
-            if(MesClient.sortA == 4){
-                    plc.writeInt16(1070,(short) 2000);
-                    plc.writeInt16(1071,(short) 5000);
-            }
+//            if(MesClient.sortA == 4){
+//                    plc.writeInt16(1070,(short) 2000);
+//                    plc.writeInt16(1071,(short) 5000);
+//            }
 
 
             if(!MesClient.product_sn.getText().isEmpty()){
@@ -59,62 +59,40 @@ public class ModbusUtil {
         upResult();
     }
 
-    public static void getDataB(ModbusTcp plc){
-
-        // 41065=F-out  41066=S-out
-        // 41069=F-min  41071=S-min 41070=F-max  41072=S-max
-        // 预设数量=41129  完成数=41137
-
-        Short cur = plc.readInt16(1136);
-//        System.out.println("F-out:"+plc.readInt16(1064));
-//        System.out.println("S-out:"+plc.readInt16(1065));
-//        System.out.println("F-min:"+plc.readInt16(1068));
-//        System.out.println("S-min:"+plc.readInt16(1070));
-//        System.out.println("F-max:"+plc.readInt16(1069));
-//        System.out.println("S-max:"+plc.readInt16(1071));
-//        System.out.println("set:"+plc.readInt16(1128));
-//        System.out.println("cur:"+cur);
-//        System.out.println("cur2:"+MesClient.sortB);
-
-        if(MesClient.bMax <= 0){
-            MesClient.bMax = plc.readInt16(1128);
-            MesClient.param3.setText(String.valueOf(MesClient.bMax));
-        }
-
-        if(MesClient.sortB == cur - 1){
-            MesClient.sortB = cur;
-            String fout = plc.readInt16(1064)+"";
-            String sout = (float)plc.readInt16(1065)/1000+"";
-
-            String fmin = plc.readInt16(1068)+"";
-            String smin = (float)plc.readInt16(1070)/1000+"";
-
-            String fmax = plc.readInt16(1069)+"";
-            String smax = (float)plc.readInt16(1071)/1000+"";
-
-            if(MesClient.sortB == 18){
-//                if(MesClient.bMax == 36){
-//                    plc.writeInt16(1070,(short) 4000);
-//                    plc.writeInt16(1071,(short) 5500);
-//                }
-            }
-
-
-            MesClient.param4.setText(cur+"");
-
-            System.out.println("cur:"+cur);
-            if(!MesClient.product_sn.getText().isEmpty()){
-               JdbcUtils.insertProdData(MesClient.mes_gw, MesClient.mes_line_sn, MesClient.product_sn.getText(),"B",fout,sout,fmin,smin,fmax,smax,"1",cur+"", MesClient.user_menu.getText());
-            }
-        }
-
-        upResult();
-
-    }
-
-    // 上传总结果
+//    // 单枪模式,B枪采集已停用
+//    public static void getDataB(ModbusTcp plc){
+//
+//        Short cur = plc.readInt16(1136);
+//
+//        if(MesClient.bMax <= 0){
+//            MesClient.bMax = plc.readInt16(1128);
+//            MesClient.param3.setText(String.valueOf(MesClient.bMax));
+//        }
+//
+//        if(MesClient.sortB == cur - 1){
+//            MesClient.sortB = cur;
+//            String fout = plc.readInt16(1064)+"";
+//            String sout = (float)plc.readInt16(1065)/1000+"";
+//
+//            String fmin = plc.readInt16(1068)+"";
+//            String smin = (float)plc.readInt16(1070)/1000+"";
+//
+//            String fmax = plc.readInt16(1069)+"";
+//            String smax = (float)plc.readInt16(1071)/1000+"";
+//
+//            MesClient.param4.setText(cur+"");
+//
+//            if(!MesClient.product_sn.getText().isEmpty()){
+//               JdbcUtils.insertProdData(MesClient.mes_gw, MesClient.mes_line_sn, MesClient.product_sn.getText(),"B",fout,sout,fmin,smin,fmax,smax,"1",cur+"", MesClient.user_menu.getText());
+//            }
+//        }
+//
+//        upResult();
+//    }
+
+    // 上传总结果(单枪:仅A枪完成即提交)
     public static void upResult(){
-        if(!MesClient.curSn.isEmpty() && MesClient.aMax > 0 && MesClient.aMax == MesClient.sortA && MesClient.bMax > 0 && MesClient.bMax == MesClient.sortB){
+        if(!MesClient.curSn.isEmpty() && MesClient.aMax > 0 && MesClient.aMax == MesClient.sortA){
             MesClient.finish_ok_bt.setEnabled(true);
             MesClient.finish_ng_bt.setEnabled(true);
 
@@ -222,15 +200,15 @@ public class ModbusUtil {
             plc.writeInt16(1136,(short) 0);
             plc.writeInt16(1138,(short) 0);
 
-            if(setNum == 22){
+            if(setNum == 13){
                 plc.writeInt16(1070,(short) 2500);
-                plc.writeInt16(1071,(short) 4500);
+                plc.writeInt16(1071,(short) 3500);
             }
 
-            if (setNum == 40){
-                plc.writeInt16(1070,(short) 2000);
-                plc.writeInt16(1071,(short) 4000);
-            }
+//            if (setNum == 40){
+//                plc.writeInt16(1070,(short) 2000);
+//                plc.writeInt16(1071,(short) 4000);
+//            }
 
         }catch (Exception e){
             e.printStackTrace();

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

@@ -6,28 +6,10 @@ import java.util.Map;
 
 public class OprnoUtil {
     public static String[] xtoprnos = new String[]{
-            "OP070","OP080", "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", "OP490", "OP500",
-            "OP510", "OP520", "OP550"
+            "OP220"
     };
     public static String[] xtoprnodes = new String[]{
-            "右边梁镭雕二维码","左右边梁防爆阀拉铆","CMT框架一序焊接",
-            "人工补焊", "框架CMT二序焊接", "人工补焊", "焊道检查", "总成正面CNC",
-            "总成反面CNC", "框架去毛刺+清洁", "封堵片焊接+打磨", "边框气密", "焊道补焊",
-            "框架反面涂胶", "液冷板安装", "正面溢胶清理,补胶", "液冷板激光点固", "液冷板水嘴处焊接",
-            "焊道打磨", "液冷板FSW", "匙孔补焊打磨", "总成反面拉铆", "总成正面拉铆1",
-            "总成正面拉铆2", "边梁套筒涂胶+压合", "箱体封堵", "胶水固化", "半成品气密",
-            "补强板安装", "胶水固化", "拆卸补强板压紧工装", "FSW焊道涂胶+双层拉铆螺母涂胶", "人工抹胶",
-            "胶水固化", "反面部件装配", "底护板装配+底部套筒螺母安装", "底护板螺栓复拧", "总成气密",
-            "液冷板气密", "总成正面装配", "总成清洁", "总成检具检验", "模拟客户安装界面(装)",
-            "CCD", "GP12", "称重"
+            "总成反面装配2"
     };
     public static String[] lboprnos = new String[]{
             "OP040","OP050","OP060","OP070","OP080","OP090","OP100","OP110",

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

@@ -1,6 +1,6 @@
-mes.gw=OP290A
-mes.server_ip=127.0.0.1
-#mes.server_ip=192.168.21.99
+mes.gw=OP220A
+#mes.server_ip=127.0.0.1
+mes.server_ip=192.168.24.99
 mes.tcp_port=3000
 mes.heart_beat_cycle=60
 mes.line_sn=XT