hou 5 月之前
父節點
當前提交
b82f34d730
共有 1 個文件被更改,包括 23 次插入3 次删除
  1. 23 3
      src/com/mes/component/MesClientComponent.java

+ 23 - 3
src/com/mes/component/MesClientComponent.java

@@ -153,9 +153,21 @@ public class MesClientComponent extends JPanel {
             return;
         }
         try {
-            String sn = S7PLCUtils.getSnInOprno(oprnoClass, MesClient.s7PLC);
+            String sn = "";
+            boolean hgA = MesClient.s7PLC.readBoolean(oprnoClass.getHgA_out());
+            boolean hgB = MesClient.s7PLC.readBoolean(oprnoClass.getHgB_out());
+            if (!hgA && !hgB) {
+                sn = "";
+            }
+
+            if (hgA) {
+                sn = MesClient.s7PLC.readString(oprnoClass.getHgA_sn());
+            }
+            if (hgB) {
+                sn = MesClient.s7PLC.readString(oprnoClass.getHgB_sn());
+            }
 
-            if (sn == null || sn.trim().isEmpty()) {
+            if (sn == null || sn.trim().isEmpty() || "".equals(sn)) {
                 setMenuStatus("扫码结果为空", -1);
                 return;
             }
@@ -201,12 +213,20 @@ public class MesClientComponent extends JPanel {
                 }else if (work_status == 1){
                     // 已扫码,等待允许加工信号
                     String sn = productSn.getText();
+                    if (sn == null || sn.trim().isEmpty() || "".equals(sn)) {
+                        setMenuStatus("读码结果为空", -1);
+                        return;
+                    }
                     Boolean checkQualityResult = DataUtil.checkQualityByGw(MesClient.nettyClient, sn,MesClient.user20,oprnoClass.getOprno());
                     if (!checkQualityResult){
                         setMenuStatus("消息发送失败,请重试",-1);
                     }
                 }else if (work_status == 2){
+                    if (MesClient.s7PLC.readBoolean(oprnoClass.getOut_ok())){
+                        MesClient.s7PLC.writeBoolean(oprnoClass.getMes_in(),false);
+                    }
                     if (MesClient.s7PLC.readBoolean(oprnoClass.getProcess_ok())){
+                        MesClient.s7PLC.writeBoolean(oprnoClass.getMes_out(),true);
                         String sn = productSn.getText();
                         String ret = "OK";
                         if (MesClient.s7PLC.readBoolean(oprnoClass.getProcess_result_ng())){
@@ -222,7 +242,7 @@ public class MesClientComponent extends JPanel {
                     work_status = 0;
                 }
             }
-        },100,3000);
+        },100,1000);
     }
 
     // 刷新