hzd 3 giorni fa
parent
commit
973f4e4b0e

+ 2 - 0
src/com/mes/ui/MesClient.java

@@ -38,8 +38,10 @@ public class MesClient extends JFrame {
     public static NettyClient nettyClient;
     public static Boolean check_quality_result1 = false;
     public static Integer work_status1 = 0;
+    public static Integer canReadResult1 = 0; // 1=可以读取结果
     public static Boolean check_quality_result2 = false;
     public static Integer work_status2 = 0;
+    public static Integer canReadResult2 = 0;  // 1=可以读取结果
 
     // 记录扫码工件码的时间,用于限制提交必须在扫码后满30秒
     public static long scan_time1 = 0L;

+ 3 - 1
src/com/mes/util/ATEQ.java

@@ -103,6 +103,7 @@ public class ATEQ {
         public final Integer programNumber;
         public final Integer FIFO_Number;
         public final String testType;
+        public final Integer stepCode;
         public final String step;
         public final Double pressureValue;
         public final Double leakValue;
@@ -119,7 +120,8 @@ public class ATEQ {
             this.isCycleEnd = DataUtils.getBit(state, 5) == 1;
             this.isPass = DataUtils.getBit(state, 0) == 1;
             this.isKeyExist = DataUtils.getBit(state, 15) == 1;
-            this.step = getStepStr(DataUtils.bytesToInt(Arrays.copyOfRange(data, 11, 13)));
+            this.stepCode = DataUtils.bytesToInt(Arrays.copyOfRange(data, 11, 13));
+            this.step = getStepStr(this.stepCode);
             this.pressureValue = DataUtils.bytesToInt(Arrays.copyOfRange(data, 13, 17)) / 1000.0;
             this.pressureUnit = getUnit(DataUtils.bytesToInt(Arrays.copyOfRange(data, 17, 21)));
             this.leakValue = DataUtils.bytesToInt(Arrays.copyOfRange(data, 21, 25)) / 1000.0;

+ 27 - 18
src/com/mes/util/WorkTimer.java

@@ -95,7 +95,11 @@ public class WorkTimer {
                     MesClient.leakText_1.setText(isEnd ? "" : realtimeResult.leakValue + " " + realtimeResult.leakUnit);
                     MesClient.setMenuState_1(isEnd ? "该工件可以加工" : "正在加工", 0);
 
-                    if (realtimeResult.isCycleEnd && realtimeResult.FIFO_Number > 0) {  // 如果查询到测试结束并且待处理结果数大于0
+                    if(MesClient.canReadResult1 == 0 && realtimeResult.stepCode < 65533){
+                        MesClient.canReadResult1 = 1;
+                    }
+
+                    if (realtimeResult.isCycleEnd && realtimeResult.FIFO_Number > 0 && MesClient.canReadResult1 > 0) {  // 如果查询到测试结束并且待处理结果数大于0
                         ATEQ.LastResult lastResult = ateq1.readLastResult();
                         log.info("{}: {}", Config.gw_1, lastResult.toString());
 
@@ -117,24 +121,29 @@ public class WorkTimer {
                         MesClient.leakText_1.setText(leakString);
 
                         String sn = MesClient.getBarcode33(MesClient.product_sn_1.getText());
-                        Boolean result = false;
-                        if(lastResult.leakValue < 1e-10 && lastResult.leakValue > -1e-10 && lastResult.isPass == true) {
-                            MesClient.setMenuState_1("泄露值为0,请重测", 0);
+                        if(!sn.trim().isEmpty()){
+                            Boolean result = false;
+                            if(lastResult.leakValue < 1e-10 && lastResult.leakValue > -1e-10 && lastResult.isPass == true) {
+                                MesClient.setMenuState_1("泄露值为0,请重测", 0);
+                                MesClient.resetScanA();
+                            } else {
+                                // 获取当前运行的程序的填充时间、稳定时间、测试时间
+                                ATEQ.Parameters params = ateq1.getParams(lastResult.programNumber);
+                                log.info("{}: {}", Config.gw_1, params.toString());
+                                // 将气密参数放入本地SQLite数据库
+                                QMParamsDAO.insert(Config.gw_1, sn.trim(), lastResult.programNumber, ret, pressureValue, leakValue, lastResult.pressureUnit, lastResult.leakUnit, params.fillTime, params.stabilizeTime, params.testTime, MesClient.user20 );//添加作业人员
+
+
+                                result = DataUtil.sendQuality(sn, ret, MesClient.user20, Config.gw_1);
+                            }
+
+                            if (result) {
+                                MesClient.setMenuState_1("加工完成,结果:" + ret, 0);
+                                DataUtil.bindLeakValue(sn, leakString, Config.gw_1);
+                            }
+                            // 刷新工作面板
                             MesClient.resetScanA();
-                        } else {
-                            result = DataUtil.sendQuality(sn, ret, MesClient.user20, Config.gw_1);
-                        }
-                        // 获取当前运行的程序的填充时间、稳定时间、测试时间
-                        ATEQ.Parameters params = ateq1.getParams(lastResult.programNumber);
-                        log.info("{}: {}", Config.gw_1, params.toString());
-
-                        if (result) {
-                            MesClient.setMenuState_1("加工完成,结果:" + ret, 0);
-                            DataUtil.bindLeakValue(sn, leakString, Config.gw_1);
-
-                            // 将气密参数放入本地SQLite数据库
-                            QMParamsDAO.insert(Config.gw_1, sn.trim(), lastResult.programNumber, ret, pressureValue, leakValue, lastResult.pressureUnit, lastResult.leakUnit, params.fillTime, params.stabilizeTime, params.testTime, MesClient.user20 );//添加作业人员
-
+                        }else{
                             // 刷新工作面板
                             MesClient.resetScanA();
                         }