hzd 1 settimana fa
parent
commit
61ef5b46f0

BIN
lib/core-3.5.1.jar


BIN
lib/javase-3.5.1.jar


+ 7 - 0
src/com/mes/ui/LoginFarme.java

@@ -197,6 +197,13 @@ public class LoginFarme extends JFrame {
                         MesClient.indexPanelC.add(MesClient.jfxPanel2);
                     }
 
+                    if(MesClient.jfxPanel3 == null){
+                        String url = "http://"+ MesClient.mes_server_ip+":8980/js/a/mes/mesGlueRecord/olist?ucode="+MesClient.user_menu.getText()+"&oprno="+MesClient.mes_gw+"&lineSn="+MesClient.mes_line_sn;
+                        MesClient.jfxPanel3 = new MesWebView(url);
+                        MesClient.jfxPanel3.setSize(990, 550);
+                        MesClient.indexPanelE.add(MesClient.jfxPanel3);
+                    }
+
                     MesClient.initWarehouseData();
                 }
 

+ 247 - 94
src/com/mes/ui/MesClient.java

@@ -67,6 +67,8 @@ public class MesClient extends JFrame {
     public static JScrollPane indexScrollPaneA;
     public static JScrollPane searchScrollPane;
     public static JScrollPane searchScrollPaneDj;
+    public static JScrollPane searchScrollPaneC;
+    public static JScrollPane searchScrollPaneD;
 
 
     public static Boolean check_quality_result = false;
@@ -94,6 +96,10 @@ public class MesClient extends JFrame {
     public static JPanel indexPanelC;
     public static MesWebView jfxPanel2 = null;
     public static MesRadio mesRadioHj;
+    public static JPanel indexPanelD;
+    public static JPanel indexPanelE;
+    public static MesWebView jfxPanel3 = null;
+    public static MesWebView jfxPanel4 = null;
 
     public static JTable table;
     public static Object[] columnNames = { "物料名称", "绑定批次", "剩余次数", "操作" };
@@ -111,17 +117,20 @@ public class MesClient extends JFrame {
 
 
     public static void main(String[] args) {
-
+        try{
+            //读文件配置
+            readProperty();
+        }catch (Exception e){
+            e.printStackTrace();
+        }
         if (LockUtil.getInstance().isAppActive() == true){
-//            JOptionPane.showMessageDialog(null, "已有一个程序在运行,程序退出");
+            JOptionPane.showMessageDialog(null, "已有一个程序在运行,程序退出");
             return;
         }else{
             EventQueue.invokeLater(new Runnable() {
                 @Override
                 public void run() {
                     try{
-                        //读文件配置
-                        readProperty();
 
                         s7PLC.setConnectTimeout(800);
                         s7PLC.setReceiveTimeout(800);
@@ -264,22 +273,21 @@ public class MesClient extends JFrame {
     }
 
     public static void resetScanA() {
-        work_status = 0;
-        check_quality_result = false;
-//        MesClient.finish_ok_bt.setEnabled(false);
-//        MesClient.finish_ng_bt.setEnabled(false);
-        product_sn.setText("");
-        product_sn_LB.setText("");
         MesClient.fxlabel.setVisible(false);
-        MesClient.index = 0;
         // 信号重置
-        MesClient.s7PLC.writeBoolean("DB503.0.2", false);
-        MesClient.s7PLC.writeBoolean("DB503.0.5", false);
-//        MesClient.f_scan_data_bt_1.setEnabled(true);
+        RobotUtil.setAllowFeeding(s7PLC,false);
+        RobotUtil.setAllowBlanking(s7PLC,false);
         MesClient.status_menu.setText("请扫工件码");
 
+        MesClient.product_sn.setText("");
+        MesClient.product_sn_LB.setText("");
+        MesClient.bind_lb_result = false;
+        MesClient.work_status = 0;
+        MesClient.check_quality_result = false;
+        MesClient.index = 0;
+
         updateMaterailData();
-        shiftUserCheck();
+//        shiftUserCheck();
 
     }
 
@@ -387,6 +395,7 @@ public class MesClient extends JFrame {
     public static void scanBarcode2() {
         // 判断工件码是不是空的
         if(work_status != 1) {
+            setMenuStatus("未扫工件码!", 1);
             return;
         }
         // 绑定冷板
@@ -398,6 +407,12 @@ public class MesClient extends JFrame {
                 bind_lb_result = true;
                 product_sn_LB.setText(scanBarcode);
                 log.info("bind_lb_result2:"+bind_lb_result);
+
+                Boolean reg = DataUtil.sendQuality(MesClient.nettyClient, MesClient.product_sn.getText(), "OK",MesClient.user20);
+                if (!reg){
+                    setMenuStatus("报文发送异常", -1);
+                    return;
+                }
             }else{
                 setMenuStatus("绑定失败!", 1);
                 return;
@@ -421,6 +436,16 @@ public class MesClient extends JFrame {
         connect_request_flag = false;
     }
 
+    public static ImageIcon imageGreen;
+    public static ImageIcon imageGray;
+
+    public static JLabel feedinglabel;
+    public static JLabel feedinglabel2;
+    public static JLabel feedingmeslabel;
+    public static JLabel runlabel; //运行反馈,
+    public static JLabel blankinglabel; // 下料反馈
+    public static JLabel blankingmeslabel; // 下料MES反馈
+
     public MesClient() {
         setIconImage(Toolkit.getDefaultToolkit().getImage(MesClient.class.getResource("/bg/logo.png")));
         setTitle("MES系统客户端:"+mes_gw + "- " + mes_gw_des);
@@ -467,6 +492,18 @@ public class MesClient extends JFrame {
         });
         settingMenu.add(resetTcpMenu);
 
+        JMenuItem resetTcpMenu2 = new JMenuItem("刷新工件");
+        resetTcpMenu2.setIcon(new ImageIcon(MesClient.class.getResource("/bg/reset_logo.png")));
+        resetTcpMenu2.setFont(new Font("微软雅黑", Font.PLAIN, 20));
+        resetTcpMenu2.addMouseListener(new MouseAdapter() {
+            @Override
+            public void mousePressed(MouseEvent e) {
+                super.mouseClicked(e);
+                resetScanA();
+            }
+        });
+        settingMenu.add(resetTcpMenu2);
+
         JMenuItem resetTcpMenu_1 = new JMenuItem("重新读码");
         resetTcpMenu_1.setIcon(new ImageIcon(MesClient.class.getResource("/bg/reset_logo.png")));
         resetTcpMenu_1.setFont(new Font("微软雅黑", Font.PLAIN, 20));
@@ -475,26 +512,41 @@ public class MesClient extends JFrame {
             public void mousePressed(MouseEvent e) {
                 super.mouseClicked(e);
 
-                String sn = "";
-                boolean hgA = MesClient.s7PLC.readBoolean("DB503.0.0");
-                boolean hgB = MesClient.s7PLC.readBoolean("DB503.0.1");
-                if (hgA) {
-                    sn = MesClient.s7PLC.readString("DB503.270.0");
-                }else if (hgB) {
-                    sn = MesClient.s7PLC.readString("DB503.336.0");
-                }else {
-                    sn = MesClient.s7PLC.readString("DB503.2.0");
-                }
+                try {
+                    String sn = "";
+                    boolean hgA = RobotUtil.getFeedingA(s7PLC);
+                    boolean hgB = RobotUtil.getFeedingB(s7PLC);
+                    if (!hgA && !hgB) {
+                        sn = "";
+                    }
 
-                if (sn == null || sn.trim().isEmpty() || "".equals(sn)) {
-                    setMenuStatus("扫码结果为空", -1);
-                    return;
-                }
-                sn = sn.trim();
+                    if (hgA) {
+                        sn = RobotUtil.getProductSnA(s7PLC);
+                    }else if (hgB) {
+                        sn = RobotUtil.getProductSnB(s7PLC);
+                    }else {
+                        sn = RobotUtil.getProductSn(s7PLC);
+                    }
 
-                product_sn.setText(sn);
+                    log.info("工件码:"+sn);
 
-                DataUtil.checkQuality(MesClient.nettyClient, sn, MesClient.user20);
+                    if (sn == null || sn.trim().isEmpty() || "".equals(sn)) {
+                        setMenuStatus("扫码结果为空", -1);
+                        return;
+                    }else{
+                        sn = sn.trim();
+                        product_sn.setText(sn);
+                        String barcode36 = getBarcode(sn);
+                        Boolean checkQualityResult = DataUtil.checkQuality(MesClient.nettyClient, barcode36,MesClient.user20);
+                        if (!checkQualityResult){
+                            setMenuStatus("消息发送失败,请重试",-1);
+                        }
+                    }
+
+                } catch (Exception e2) {
+                    log.error("读取 PLC 工件码失败", e2);
+                    setMenuStatus("读取 PLC 失败", -1);
+                }
 
             }
         });
@@ -518,7 +570,7 @@ public class MesClient extends JFrame {
                 MesClient.s7PLC.writeBoolean("DB503.0.2", true);
             }
         });
-        settingMenu.add(allow_up_material);
+//        settingMenu.add(allow_up_material);
         // 允许下料
         JMenuItem allow_down_material = new JMenuItem("允许下料");
         allow_down_material.setIcon(new ImageIcon(MesClient.class.getResource("/bg/reset_logo.png")));
@@ -536,7 +588,7 @@ public class MesClient extends JFrame {
                 MesClient.s7PLC.writeBoolean("DB503.0.5", true);
             }
         });
-        settingMenu.add(allow_down_material);
+//        settingMenu.add(allow_down_material);
         // 重置信号
         JMenuItem reset_signal = new JMenuItem("重置信号");
         reset_signal.setIcon(new ImageIcon(MesClient.class.getResource("/bg/reset_logo.png")));
@@ -555,7 +607,7 @@ public class MesClient extends JFrame {
                 MesClient.s7PLC.writeBoolean("DB503.0.5", false);
             }
         });
-        settingMenu.add(reset_signal);
+//        settingMenu.add(reset_signal);
 
 
 
@@ -782,6 +834,88 @@ public class MesClient extends JFrame {
         finish_ng_bt.setEnabled(false);
 //        indexPanelA.add(finish_ng_bt);
 
+
+        imageGreen = new ImageIcon(MesClient.class.getResource("/bg/green_dot.png"));
+        imageGreen.setImage(imageGreen.getImage().getScaledInstance(20, 20, Image.SCALE_SMOOTH));
+
+        imageGray = new ImageIcon(MesClient.class.getResource("/bg/grey_dot.png"));
+        imageGray.setImage(imageGray.getImage().getScaledInstance(20, 20, Image.SCALE_SMOOTH));
+
+        feedingmeslabel = new JLabel("MES允许上料");
+        feedingmeslabel.setHorizontalAlignment(SwingConstants.LEFT);
+        feedingmeslabel.setIcon(imageGreen);
+        feedingmeslabel.setForeground(Color.BLACK);
+        feedingmeslabel.setBounds(30, 440, 200, 30);
+        feedingmeslabel.addMouseListener(new MouseAdapter() {
+            public void mouseClicked(MouseEvent e) {
+                // 弹框输入密码,如果输入的为”503833“即可允许上料
+                String input = JOptionPane.showInputDialog(null, "请输入密码");
+                if (!input.equalsIgnoreCase("503833")) {
+                    JOptionPane.showMessageDialog(mesClientFrame, "密码错误", "提示窗口", JOptionPane.INFORMATION_MESSAGE);
+                    return;
+                }
+
+                boolean ret = RobotUtil.getAllowFeeding(s7PLC);
+                int choice = JOptionPane.showConfirmDialog(null, "确定修改MES允许上料结果为"+(ret?"false":"true")+"吗?", "操作确认", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE);
+                if (choice == JOptionPane.YES_OPTION) {
+                    RobotUtil.setAllowFeeding(s7PLC,!ret);
+                }
+            }
+        });
+        indexPanelA.add(feedingmeslabel);
+
+        blankingmeslabel = new JLabel("MES下料反馈");
+        blankingmeslabel.setHorizontalAlignment(SwingConstants.LEFT);
+        blankingmeslabel.setIcon(imageGreen);
+        blankingmeslabel.setForeground(Color.BLACK);
+        blankingmeslabel.setBounds(240, 440, 200, 30);
+        indexPanelA.add(blankingmeslabel);
+        blankingmeslabel.addMouseListener(new MouseAdapter() {
+            public void mouseClicked(MouseEvent e) {
+                // 弹框输入密码,如果输入的为”503833“即可允许上料
+                String input = JOptionPane.showInputDialog(null, "请输入密码");
+                if (!input.equalsIgnoreCase("503833")) {
+                    JOptionPane.showMessageDialog(mesClientFrame, "密码错误", "提示窗口", JOptionPane.INFORMATION_MESSAGE);
+                    return;
+                }
+
+                boolean ret = RobotUtil.getAllowBlanking(s7PLC);
+                int choice = JOptionPane.showConfirmDialog(null, "确定修改MES下料反馈结果为"+(ret?"false":"true")+"吗?", "操作确认", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE);
+                if (choice == JOptionPane.YES_OPTION) {
+                    RobotUtil.setAllowBlanking(s7PLC,!ret);
+                }
+            }
+        });
+
+        feedinglabel = new JLabel("抓手A上料");
+        feedinglabel.setHorizontalAlignment(SwingConstants.LEFT);
+        feedinglabel.setIcon(imageGreen);
+        feedinglabel.setForeground(Color.BLACK);
+        feedinglabel.setBounds(30, 480, 200, 30);
+        indexPanelA.add(feedinglabel);
+
+        feedinglabel2 = new JLabel("抓手B上料");
+        feedinglabel2.setHorizontalAlignment(SwingConstants.LEFT);
+        feedinglabel2.setIcon(imageGreen);
+        feedinglabel2.setForeground(Color.BLACK);
+        feedinglabel2.setBounds(240, 480, 200, 30);
+        indexPanelA.add(feedinglabel2);
+
+        runlabel = new JLabel("上料完成");
+        runlabel.setHorizontalAlignment(SwingConstants.LEFT);
+        runlabel.setIcon(imageGreen);
+        runlabel.setForeground(Color.BLACK);
+        runlabel.setBounds(450, 480, 200, 30);
+        indexPanelA.add(runlabel);
+
+        blankinglabel = new JLabel("加工完成");
+        blankinglabel.setHorizontalAlignment(SwingConstants.LEFT);
+        blankinglabel.setIcon(imageGreen);
+        blankinglabel.setForeground(Color.BLACK);
+        blankinglabel.setBounds(660, 480, 200, 30);
+        indexPanelA.add(blankinglabel);
+
+
         tabbedPane.addTab("工作面板", new ImageIcon(MesClient.class.getResource("/bg/a_side.png")), indexScrollPaneA, null);
         tabbedPane.setEnabledAt(0, true);
 
@@ -801,7 +935,13 @@ public class MesClient extends JFrame {
 		tabbedPane.addTab("工作记录", new ImageIcon(MesClient.class.getResource("/bg/menu_data_preprocess.png")), searchScrollPane, null);
 
 
-		tabbedPane.addChangeListener(new ChangeListener() {
+        indexPanelE = new JPanel();
+        searchScrollPaneC = new JScrollPane(indexPanelE);
+        indexPanelE.setLayout(null);
+
+        tabbedPane.addTab("胶水寿命", new ImageIcon(MesClient.class.getResource("/bg/menu_data_preprocess.png")), searchScrollPaneC, null);
+
+        tabbedPane.addChangeListener(new ChangeListener() {
             @Override
             public void stateChanged(ChangeEvent e) {
                 JTabbedPane tabbedPane = (JTabbedPane) e.getSource();
@@ -999,72 +1139,85 @@ public class MesClient extends JFrame {
         plcTimer.schedule(new TimerTask() {
             @Override
             public void run() {
-                if (index == 0){
-                    String sn ="";
-                    if (MesClient.s7PLC.readBoolean("DB503.0.0") || MesClient.s7PLC.readBoolean("DB503.0.1")){
-                        if (MesClient.s7PLC.readBoolean("DB503.0.0")){
-                            sn = MesClient.s7PLC.readString("DB503.270.0");
-                            // 赋值给输入框
-                            product_sn.setText(sn);
-                        }else if (MesClient.s7PLC.readBoolean("DB503.0.1")){
-                             sn = MesClient.s7PLC.readString("DB503.336.0");
-                            // 赋值给输入框
-                            product_sn.setText(sn);
+                if(!MesClient.sessionid.isEmpty()) { // 必须先登录
+                    Boolean feedingRetA = RobotUtil.getFeedingA(s7PLC);
+                    Boolean feedingRetB = RobotUtil.getFeedingB(s7PLC);
+                    Boolean feedingFinish = RobotUtil.getFeedingFinish(s7PLC);
+                    Boolean workFinish = RobotUtil.getWorkFinish(s7PLC);
+                    Boolean allowFeeding = RobotUtil.getAllowFeeding(s7PLC);
+                    Boolean allowBlanking = RobotUtil.getAllowBlanking(s7PLC);
+
+                    feedinglabel.setIcon(feedingRetA ? imageGreen : imageGray);
+                    feedinglabel2.setIcon(feedingRetB ? imageGreen : imageGray);
+                    runlabel.setIcon(feedingFinish ? imageGreen : imageGray);
+                    blankinglabel.setIcon(workFinish ? imageGreen : imageGray);
+                    feedingmeslabel.setIcon(allowFeeding ? imageGreen : imageGray);
+                    blankingmeslabel.setIcon(allowBlanking ? imageGreen : imageGray);
+
+                    log.info("index:"+index);
+                    log.info("feedingRetA:"+feedingRetA);
+                    log.info("feedingRetB:"+feedingRetB);
+                    log.info("feedingFinish:"+feedingFinish);
+                    log.info("workFinish:"+workFinish);
+                    log.info("allowFeeding:"+allowFeeding);
+                    log.info("allowBlanking:"+allowBlanking);
+
+                    if (index == 0){
+                        if(workFinish){
+                            RobotUtil.setAllowBlanking(s7PLC,true);
+                        }else{
+                            RobotUtil.setAllowBlanking(s7PLC,false);
                         }
-                        if (sn == null || sn.trim().isEmpty() || "".equals(sn)){
-                            setMenuStatus("机器臂抓手读码为空", -1);
-                            return;
+                        if(feedingRetA || feedingRetB){
+                            String sn = "";
+                            if(feedingRetA){
+                                sn = RobotUtil.getProductSnA(s7PLC);
+                            }
+                            if(feedingRetB){
+                                sn = RobotUtil.getProductSnB(s7PLC);
+                            }
+
+                            if (sn == null || sn.trim().isEmpty() || "".equals(sn)) {
+                                setMenuStatus("读码结果为空", -1);
+                                return;
+                            }else{
+                                product_sn.setText(sn);
+                                String barcode36 = getBarcode(sn);
+                                Boolean checkQualityResult = DataUtil.checkQuality(MesClient.nettyClient, barcode36,MesClient.user20);
+                                if (!checkQualityResult){
+                                    setMenuStatus("消息发送失败,请重试",-1);
+                                }
+                            }
+                        }else{
+                            setMenuStatus("等待上料信号",0);
                         }
-                        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.0.3") || MesClient.s7PLC.readBoolean("DB503.0.4")){
-                        // 将允许上料清空·
-                        MesClient.s7PLC.writeBoolean("DB503.0.2", false);
-                        index = 3;
-                    }
-                }else if (index == 3){
-                    log.info("bind_lb_result:"+bind_lb_result);
-
-                    // 等待完成信号
-                    if (MesClient.s7PLC.readBoolean("DB503.0.4") || (MesClient.s7PLC.readBoolean("DB503.0.0") || MesClient.s7PLC.readBoolean("DB503.0.1"))){
-                        // 冷板为空不允许提交
-                        if (!bind_lb_result){
-                            setMenuStatus("请先绑定冷板", -1);
-                            return;
+                    }else if(index == 1){
+                        if(feedingFinish || workFinish || feedingRetA || feedingRetB){
+                            setMenuStatus("上料完成,开始加工",0);
+                            index = 2;
+                            RobotUtil.setAllowFeeding(s7PLC, false);
+                        }else{
+                            RobotUtil.setAllowFeeding(s7PLC, true);
                         }
-                        Boolean reg = DataUtil.sendQuality(MesClient.nettyClient, MesClient.product_sn.getText(), "OK",MesClient.user20);
-                        if (!reg){
-                            setMenuStatus("报文发送异常", -1);
-                            return;
+                    }else if(index == 2){
+                        if(workFinish || feedingRetA || feedingRetB){ // 提交结果
+                            // 冷板为空不允许提交
+                            if (!bind_lb_result){
+                                setMenuStatus("请先绑定冷板", -1);
+                                return;
+                            }
+
+                            Boolean reg = DataUtil.sendQuality(MesClient.nettyClient, MesClient.product_sn.getText(), "OK",MesClient.user20);
+                            if (!reg){
+                                setMenuStatus("报文发送异常", -1);
+                                return;
+                            }
                         }
                     }
-                } else if (index == 4) {
-//                    将允许上料信号及允许下料信号制空
-                    MesClient.s7PLC.writeBoolean("DB503.0.2", false);
-                    MesClient.s7PLC.writeBoolean("DB503.0.5", false);
-                    // 两个输入框制空
-                    product_sn.setText("");
-                    product_sn_LB.setText("");
-                    bind_lb_result = false;
-                    work_status = 0;
-                    check_quality_result = false;
-                    updateMaterailData();
-//                    shiftUserCheck();
-                    index = 0;
                 }
 
             }
-        }, 0, 2000);
+        }, 0, 2500);
     }
 
 

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

@@ -20,11 +20,13 @@ public class MesRevice {
                 MesClient.work_status = 1;
 
                 // 允许做件
-                MesClient.s7PLC.writeBoolean("DB503.0.2", true);
-                // 发送开始做件报文
-                MesClient.index = 2;
-
+                RobotUtil.setAllowFeeding(MesClient.s7PLC, true);
+                MesClient.index = 1;
 
+                // 绑定底护板按钮开启
+                MesClient.bind_lb_result = false;
+                MesClient.product_sn_LB.setEnabled(true);
+//                MesClient.index = 3;
 
             }else {
                 MesClient.check_quality_result = false;
@@ -40,9 +42,7 @@ public class MesRevice {
     public static void startRevice(String processMsgRet,String mes_msg){
         try{
             if(processMsgRet.equalsIgnoreCase("OK")) {
-                // 绑定底护板按钮开启
-                MesClient.product_sn_LB.setEnabled(true);
-                MesClient.index = 3;
+
             }
         }catch (Exception e){
             e.printStackTrace();
@@ -85,10 +85,17 @@ public class MesRevice {
 //                MesClient.scan_type = 1;
 //                MesClient.scanBarcode();
                 // 下料允许
-                MesClient.s7PLC.writeBoolean("DB503.0.5", true);
+                RobotUtil.setAllowBlanking(MesClient.s7PLC, true);
                 //菜单提示信息
                 MesClient.setMenuStatus("结果提交成功,请扫下一件",0);
-                MesClient.index = 4;
+                // 两个输入框制空
+                MesClient.product_sn.setText("");
+                MesClient.product_sn_LB.setText("");
+                MesClient.bind_lb_result = false;
+                MesClient.work_status = 0;
+                MesClient.check_quality_result = false;
+                MesClient.updateMaterailData();
+                MesClient.index = 0;
 
 
 

+ 154 - 0
src/com/mes/ui/RobotUtil.java

@@ -0,0 +1,154 @@
+package com.mes.ui;
+
+import com.github.xingshuangs.iot.protocol.s7.service.S7PLC;
+
+public class RobotUtil {
+
+    // 获取上料信号A
+    public static Boolean getFeedingA(S7PLC plc){
+        Boolean ret = false;
+        try{
+            // 抓手A上料信号
+            boolean hgA = plc.readBoolean("DB503.0.0");
+            ret = hgA;
+        }catch (Exception e){
+            e.printStackTrace();
+            ret = false;
+        }
+
+        return ret;
+    }
+
+    // 获取上料信号
+    public static Boolean getFeedingB(S7PLC plc){
+        Boolean ret = false;
+        try{
+            // 抓手B上料信号
+            boolean hgB = plc.readBoolean("DB503.0.1");
+            ret = hgB;
+        }catch (Exception e){
+            e.printStackTrace();
+            ret = false;
+        }
+
+        return ret;
+    }
+
+    // 获取工件码
+    public static String getProductSnA(S7PLC plc){
+        String ret = "";
+        try{
+            ret = plc.readString("DB503.270.0");
+        }catch (Exception e){
+            e.printStackTrace();
+        }
+
+        return ret;
+    }
+
+    // 获取工件码
+    public static String getProductSnB(S7PLC plc){
+        String ret = "";
+        try{
+            ret = plc.readString("DB503.336.0");
+        }catch (Exception e){
+            e.printStackTrace();
+        }
+
+        return ret;
+    }
+
+    // 获取工件码
+    public static String getProductSn(S7PLC plc){
+        String ret = "";
+        try{
+            ret = plc.readString("DB503.2.0");
+        }catch (Exception e){
+            e.printStackTrace();
+        }
+
+        return ret;
+    }
+
+    // 是否允许上料
+    public static Boolean getAllowFeeding(S7PLC plc){
+        Boolean ret = false;
+        try{
+            ret = plc.readBoolean("DB503.0.2");
+        }catch (Exception e){
+            e.printStackTrace();
+            ret = false;
+        }
+
+        return ret;
+    }
+
+    // 设置是否允许上料
+    public static Boolean setAllowFeeding(S7PLC plc, Boolean allowFeeding){
+        Boolean ret = false;
+        try{
+            plc.writeBoolean("DB503.0.2",allowFeeding);
+            ret = true;
+        }catch (Exception e){
+            e.printStackTrace();
+            ret = false;
+        }
+
+        return ret;
+    }
+
+    // 上料完成
+    public static Boolean getFeedingFinish(S7PLC plc){
+        Boolean ret = false;
+        try{
+            ret = plc.readBoolean("DB503.0.3");
+        }catch (Exception e){
+            e.printStackTrace();
+            ret = false;
+        }
+
+        return ret;
+    }
+
+    // 加工完成
+    public static Boolean getWorkFinish(S7PLC plc){
+        Boolean ret = false;
+        try{
+            ret = plc.readBoolean("DB503.0.4");
+        }catch (Exception e){
+            e.printStackTrace();
+            ret = false;
+        }
+
+        return ret;
+    }
+
+    // 是否允许下料
+    public static Boolean getAllowBlanking(S7PLC plc){
+        Boolean ret = false;
+        try{
+            ret = plc.readBoolean("DB503.0.5");
+        }catch (Exception e){
+            e.printStackTrace();
+            ret = false;
+        }
+
+        return ret;
+    }
+
+    // 设置是否允许下料
+    public static Boolean setAllowBlanking(S7PLC plc, Boolean allowFeeding){
+        Boolean ret = false;
+        try{
+            plc.writeBoolean("DB503.0.5",allowFeeding);
+            ret = true;
+        }catch (Exception e){
+            e.printStackTrace();
+            ret = false;
+        }
+
+        return ret;
+    }
+
+
+}