浏览代码

逻辑优化

hou 5 月之前
父节点
当前提交
9b754326ed
共有 3 个文件被更改,包括 14 次插入7 次删除
  1. 10 4
      src/com/mes/component/MesClientComponent.java
  2. 1 1
      src/com/mes/ui/MesClient.java
  3. 3 2
      src/com/mes/ui/MesRevice.java

+ 10 - 4
src/com/mes/component/MesClientComponent.java

@@ -159,14 +159,13 @@ public class MesClientComponent extends JPanel {
             if (!hgA && !hgB) {
                 sn = "";
             }
-
             if (hgA) {
                 sn = MesClient.s7PLC.readString(oprnoClass.getHgA_sn());
-            }
-            if (hgB) {
+            }else if (hgB) {
                 sn = MesClient.s7PLC.readString(oprnoClass.getHgB_sn());
+            }else {
+                sn = MesClient.s7PLC.readString(oprnoClass.getProduct_sn());
             }
-
             if (sn == null || sn.trim().isEmpty() || "".equals(sn)) {
                 setMenuStatus("扫码结果为空", -1);
                 return;
@@ -197,6 +196,7 @@ public class MesClientComponent extends JPanel {
                     // 未扫码,等待允许扫码信号
                     // 当遍历出有上料点位为true的工位时
                     if (MesClient.s7PLC.readBoolean(oprnoClass.getHgA_out()) || MesClient.s7PLC.readBoolean(oprnoClass.getHgB_out())) {
+                        MesClient.s7PLC.writeBoolean(oprnoClass.getMes_out(),false);
                         String sn = "";
                         boolean hgA = MesClient.s7PLC.readBoolean(oprnoClass.getHgA_out());
                         boolean hgB = MesClient.s7PLC.readBoolean(oprnoClass.getHgB_out());
@@ -207,6 +207,10 @@ public class MesClientComponent extends JPanel {
                         if (hgB) {
                             sn = MesClient.s7PLC.readString(oprnoClass.getHgB_sn());
                         }
+                        if (sn == null || sn.trim().isEmpty() || "".equals(sn)){
+                            setMenuStatus("扫码结果为空", -1);
+                            return;
+                        }
                         productSn.setText(sn);
                         work_status = 1;
                     }
@@ -215,6 +219,8 @@ public class MesClientComponent extends JPanel {
                     String sn = productSn.getText();
                     if (sn == null || sn.trim().isEmpty() || "".equals(sn)) {
                         setMenuStatus("读码结果为空", -1);
+                        productSn.setText("");
+                        work_status = 0;
                         return;
                     }
                     Boolean checkQualityResult = DataUtil.checkQualityByGw(MesClient.nettyClient, sn,MesClient.user20,oprnoClass.getOprno());

+ 1 - 1
src/com/mes/ui/MesClient.java

@@ -578,7 +578,7 @@ public class MesClient extends JFrame {
         JPanel indexPanelA = new JPanel();
         indexScrollPaneA = new JScrollPane(indexPanelA);
         indexPanelA.setLayout(null);
-        indexPanelA.setPreferredSize(new Dimension(5*MesClientComponent.workWidth, 3*MesClientComponent.workHeight)); // 根据实际内容调整高度
+        indexPanelA.setPreferredSize(new Dimension(5*MesClientComponent.workWidth, 4*MesClientComponent.workHeight)); // 根据实际内容调整高度
         indexScrollPaneA.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
         indexScrollPaneA.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
         product_sn = new JTextField();

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

@@ -93,9 +93,9 @@ public class MesRevice {
     // 上传质量
     public static void updateResultRevice(String processMsgRet,String mes_msg){
         try{
+            String oprno = ProtocolParam.getOprno(mes_msg).trim();
+            MesClientComponent component = MesClient.componentMap.get(oprno);
             if(processMsgRet.equalsIgnoreCase("OK")) {
-                String oprno = ProtocolParam.getOprno(mes_msg).trim();
-                MesClientComponent component = MesClient.componentMap.get(oprno);
                 if (component == null) {
                     MesClient.setMenuStatus("未找到工位面板:" + oprno, -1);
                     return;
@@ -107,6 +107,7 @@ public class MesRevice {
             }else{
                 String lmsg = ErrorMsg.getErrorMsg(processMsgRet, ProtocolParam.getLx(mes_msg));
                 setStatusByMsgOprno(mes_msg, lmsg, -1);
+                component.work_status = 0;
             }
         }catch (Exception e){
             e.printStackTrace();