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

+ 85 - 12
src/com/mes/ui/MesClient.java

@@ -85,11 +85,15 @@ public class MesClient extends JFrame {
     public static JTextField param2;
     public static JTextField param3;
     public static JTextField param4;
+    public static JTextField param5;
+    public static JTextField param6;
 
     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 plcC = new ModbusTcp(1, "192.168.1.9");
 //    public static ModbusTcp plcA = new ModbusTcp(1, "192.168.1.27");
 //    public static ModbusTcp plcB = new ModbusTcp(1, "192.168.1.28");
+//    public static ModbusTcp plcC = new ModbusTcp(1, "192.168.1.29");
 
     public static Timer cjTimer;
 
@@ -97,17 +101,21 @@ public class MesClient extends JFrame {
 
     public static Timer cjTimer3;
 
-    public static Short aSetNum = 40;
+    public static Short aSetNum = 81;
 //    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 = 1;
 //    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 cSetNum = 1;
+    public static Short sortC = 0;
+    public static Short cMax = 0;
+    public static List<Map> clist = new ArrayList<>();
     public static Short deviceControl = 0; // 0=本地 1=远程
     public static Integer tjStatus = 0; // 1=提交失败
 
@@ -178,6 +186,15 @@ public class MesClient extends JFrame {
                                 ModbusUtil.setPowerOn(plcB);
                             }
                         }
+
+                        List<Boolean> yxstatusc = plcC.readCoil(3128,1);
+                        if(yxstatusc.size() >= 1 && !yxstatusc.get(0)){
+                            if(!MesClient.curSn.isEmpty() && MesClient.cMax > 0 && MesClient.cMax == MesClient.sortC){
+                                ModbusUtil.setPowerOff(plcC);
+                            }else{
+                                ModbusUtil.setPowerOn(plcC);
+                            }
+                        }
                     }else{
                         List<Boolean> yxstatus = plcA.readCoil(3128,1);
                         if(yxstatus.size() >= 1 && yxstatus.get(0)){
@@ -188,6 +205,11 @@ public class MesClient extends JFrame {
                         if(yxstatusb.size() >= 1 && yxstatusb.get(0)){
                             ModbusUtil.setPowerOff(plcB);
                         }
+
+                        List<Boolean> yxstatusc = plcC.readCoil(3128,1);
+                        if(yxstatusc.size() >= 1 && yxstatusc.get(0)){
+                            ModbusUtil.setPowerOff(plcC);
+                        }
                     }
                 }catch (Exception e){
                     e.printStackTrace();
@@ -240,6 +262,15 @@ public class MesClient extends JFrame {
                 }catch (Exception e){
                     e.printStackTrace();
                 }
+
+                try{
+                    if(work_status == 1){
+                        ModbusUtil.getDataC(plcC);
+                    }
+
+                }catch (Exception e){
+                    e.printStackTrace();
+                }
             }
         }, 1000,500);
     }
@@ -411,15 +442,20 @@ public class MesClient extends JFrame {
 
         MesClient.aMax = 0;
         MesClient.bMax = 0;
+        MesClient.cMax = 0;
         MesClient.aFinish = 0;
         MesClient.alist = new ArrayList<>();
         MesClient.blist = new ArrayList<>();
+        MesClient.clist = new ArrayList<>();
         MesClient.sortB = 0;
         MesClient.sortA = 0;
+        MesClient.sortC = 0;
         MesClient.param1.setText("");
         MesClient.param2.setText("");
         MesClient.param3.setText("");
         MesClient.param4.setText("");
+        MesClient.param5.setText("");
+        MesClient.param6.setText("");
 
         deviceControl = ModbusUtil.getControlModel(plcA);
         if(deviceControl == 1){
@@ -428,11 +464,14 @@ public class MesClient extends JFrame {
 
 //        plcA.writeCoil(3128,false);
 //        plcB.writeCoil(3128,false);
+//        plcC.writeCoil(3128,false);
         ModbusUtil.setPowerOff(MesClient.plcA); // 远程关机
         ModbusUtil.setPowerOff(MesClient.plcB); // 远程关机
+        ModbusUtil.setPowerOff(MesClient.plcC); // 远程关机
 
         ModbusUtil.setTask(MesClient.plcA,MesClient.aSetNum);
         ModbusUtil.setTask(MesClient.plcB,MesClient.bSetNum);
+        ModbusUtil.setTask(MesClient.plcC,MesClient.cSetNum);
 
         updateMaterailData();
     }
@@ -752,12 +791,12 @@ public class MesClient extends JFrame {
         JLabel lblNewLabel = new JLabel("A\u67AA");
         lblNewLabel.setHorizontalAlignment(SwingConstants.CENTER);
         lblNewLabel.setFont(new Font("微软雅黑", Font.PLAIN, 20));
-        lblNewLabel.setBounds(204, 186, 166, 28);
+        lblNewLabel.setBounds(100, 186, 166, 28);
         indexPanelA.add(lblNewLabel);
 
         JLabel lblNewLabel_1 = new JLabel("\u9884\u8BBE\u6570\u91CF");
         lblNewLabel_1.setFont(new Font("微软雅黑", Font.PLAIN, 18));
-        lblNewLabel_1.setBounds(204, 241, 83, 34);
+        lblNewLabel_1.setBounds(100, 241, 83, 34);
         indexPanelA.add(lblNewLabel_1);
 
         param1 = new JTextField();
@@ -765,13 +804,13 @@ public class MesClient extends JFrame {
         param1.setFont(new Font("微软雅黑", Font.PLAIN, 18));
         param1.setText("0");
         param1.setEditable(false);
-        param1.setBounds(288, 241, 83, 34);
+        param1.setBounds(184, 241, 83, 34);
         indexPanelA.add(param1);
         param1.setColumns(10);
 
         JLabel lblNewLabel_1_1 = new JLabel("\u5B8C\u6210\u6570\u91CF");
         lblNewLabel_1_1.setFont(new Font("微软雅黑", Font.PLAIN, 18));
-        lblNewLabel_1_1.setBounds(204, 285, 83, 34);
+        lblNewLabel_1_1.setBounds(100, 285, 83, 34);
         indexPanelA.add(lblNewLabel_1_1);
 
         param2 = new JTextField();
@@ -780,18 +819,18 @@ public class MesClient extends JFrame {
         param2.setText("0");
         param2.setEditable(false);
         param2.setColumns(10);
-        param2.setBounds(288, 285, 83, 34);
+        param2.setBounds(184, 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);
+        lblB.setBounds(380, 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);
+        lblNewLabel_1_2.setBounds(380, 241, 83, 34);
         indexPanelA.add(lblNewLabel_1_2);
 
         param3 = new JTextField();
@@ -800,12 +839,12 @@ public class MesClient extends JFrame {
         param3.setFont(new Font("微软雅黑", Font.PLAIN, 18));
         param3.setEditable(false);
         param3.setColumns(10);
-        param3.setBounds(608, 241, 83, 34);
+        param3.setBounds(463, 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);
+        lblNewLabel_1_1_1.setBounds(380, 285, 83, 34);
         indexPanelA.add(lblNewLabel_1_1_1);
 
         param4 = new JTextField();
@@ -814,9 +853,43 @@ public class MesClient extends JFrame {
         param4.setFont(new Font("微软雅黑", Font.PLAIN, 18));
         param4.setEditable(false);
         param4.setColumns(10);
-        param4.setBounds(608, 285, 83, 34);
+        param4.setBounds(463, 285, 83, 34);
         indexPanelA.add(param4);
 
+        JLabel lblC = new JLabel("C\u67AA");
+        lblC.setHorizontalAlignment(SwingConstants.CENTER);
+        lblC.setFont(new Font("微软雅黑", Font.PLAIN, 20));
+        lblC.setBounds(660, 186, 166, 28);
+        indexPanelA.add(lblC);
+
+        JLabel lblNewLabel_1_3 = new JLabel("\u9884\u8BBE\u6570\u91CF");
+        lblNewLabel_1_3.setFont(new Font("微软雅黑", Font.PLAIN, 18));
+        lblNewLabel_1_3.setBounds(660, 241, 83, 34);
+        indexPanelA.add(lblNewLabel_1_3);
+
+        param5 = new JTextField();
+        param5.setText("0");
+        param5.setHorizontalAlignment(SwingConstants.CENTER);
+        param5.setFont(new Font("微软雅黑", Font.PLAIN, 18));
+        param5.setEditable(false);
+        param5.setColumns(10);
+        param5.setBounds(743, 241, 83, 34);
+        indexPanelA.add(param5);
+
+        JLabel lblNewLabel_1_1_2 = new JLabel("\u5B8C\u6210\u6570\u91CF");
+        lblNewLabel_1_1_2.setFont(new Font("微软雅黑", Font.PLAIN, 18));
+        lblNewLabel_1_1_2.setBounds(660, 285, 83, 34);
+        indexPanelA.add(lblNewLabel_1_1_2);
+
+        param6 = new JTextField();
+        param6.setText("0");
+        param6.setHorizontalAlignment(SwingConstants.CENTER);
+        param6.setFont(new Font("微软雅黑", Font.PLAIN, 18));
+        param6.setEditable(false);
+        param6.setColumns(10);
+        param6.setBounds(743, 285, 83, 34);
+        indexPanelA.add(param6);
+
         tabbedPane.addTab("工作面板", new ImageIcon(MesClient.class.getResource("/bg/a_side.png")), indexScrollPaneA, null);
         tabbedPane.setEnabledAt(0, true);
 

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

@@ -30,6 +30,7 @@ public class MesRevice {
 //                }
                 ModbusUtil.setPowerOff(MesClient.plcA); // 远程关机
                 ModbusUtil.setPowerOff(MesClient.plcB); // 远程关机
+                ModbusUtil.setPowerOff(MesClient.plcC); // 远程关机
 
             }
         }catch (Exception e){
@@ -52,12 +53,15 @@ public class MesRevice {
 
 //                MesClient.plcA.writeCoil(3128,false);
 //                MesClient.plcB.writeCoil(3128,false);
+//                MesClient.plcC.writeCoil(3128,false);
 
                 ModbusUtil.setPowerOn(MesClient.plcA); // 远程开机
                 ModbusUtil.setPowerOn(MesClient.plcB); // 远程开机
+                ModbusUtil.setPowerOn(MesClient.plcC); // 远程开机
 
                 ModbusUtil.setTask(MesClient.plcA,MesClient.aSetNum);
                 ModbusUtil.setTask(MesClient.plcB,MesClient.bSetNum);
+                ModbusUtil.setTask(MesClient.plcC,MesClient.cSetNum);
             }
         }catch (Exception e){
             e.printStackTrace();

+ 46 - 12
src/com/mes/ui/ModbusUtil.java

@@ -45,12 +45,12 @@ 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);
+            //210
+            if(MesClient.sortA == 75){
+                plc.writeInt16(1070,(short) 2500);
+                plc.writeInt16(1071,(short) 3500);
             }
 
-
             if(!MesClient.product_sn.getText().isEmpty()){
                 JdbcUtils.insertProdData(MesClient.mes_gw, MesClient.mes_line_sn, MesClient.product_sn.getText(),"A",fout,sout,fmin,smin,fmax,smax,"1",cur+"", MesClient.user_menu.getText());
             }
@@ -112,9 +112,47 @@ public class ModbusUtil {
 
     }
 
+    public static void getDataC(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);
+
+        if(MesClient.cMax <= 0){
+            MesClient.cMax = plc.readInt16(1128);
+            MesClient.param5.setText(String.valueOf(MesClient.cMax));
+        }
+
+        if(MesClient.sortC == cur - 1){
+            MesClient.sortC = 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.param6.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(),"C",fout,sout,fmin,smin,fmax,smax,"1",cur+"", MesClient.user_menu.getText());
+            }
+        }
+
+        upResult();
+
+    }
+
     // 上传总结果
     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.bMax > 0 && MesClient.bMax == MesClient.sortB
+                && MesClient.cMax > 0 && MesClient.cMax == MesClient.sortC){
             MesClient.finish_ok_bt.setEnabled(true);
             MesClient.finish_ng_bt.setEnabled(true);
 
@@ -222,16 +260,12 @@ public class ModbusUtil {
             plc.writeInt16(1136,(short) 0);
             plc.writeInt16(1138,(short) 0);
 
-            if(setNum == 22){
-                plc.writeInt16(1070,(short) 2500);
-                plc.writeInt16(1071,(short) 4500);
-            }
-
-            if (setNum == 40){
-                plc.writeInt16(1070,(short) 2000);
+            if(setNum == 81){
+                plc.writeInt16(1070,(short) 3000);
                 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"
+            "OP210"
     };
     public static String[] xtoprnodes = new String[]{
-            "右边梁镭雕二维码","左右边梁防爆阀拉铆","CMT框架一序焊接",
-            "人工补焊", "框架CMT二序焊接", "人工补焊", "焊道检查", "总成正面CNC",
-            "总成反面CNC", "框架去毛刺+清洁", "封堵片焊接+打磨", "边框气密", "焊道补焊",
-            "框架反面涂胶", "液冷板安装", "正面溢胶清理,补胶", "液冷板激光点固", "液冷板水嘴处焊接",
-            "焊道打磨", "液冷板FSW", "匙孔补焊打磨", "总成反面拉铆", "总成正面拉铆1",
-            "总成正面拉铆2", "边梁套筒涂胶+压合", "箱体封堵", "胶水固化", "半成品气密",
-            "补强板安装", "胶水固化", "拆卸补强板压紧工装", "FSW焊道涂胶+双层拉铆螺母涂胶", "人工抹胶",
-            "胶水固化", "反面部件装配", "底护板装配+底部套筒螺母安装", "底护板螺栓复拧", "总成气密",
-            "液冷板气密", "总成正面装配", "总成清洁", "总成检具检验", "模拟客户安装界面(装)",
-            "CCD", "GP12", "称重"
+            "总成反面装配1",
     };
     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=OP210B
+#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