From 7b661f27e401a9e19c518d2eb05994c802c80476 Mon Sep 17 00:00:00 2001
From: ZengTao <2773468879@qq.com>
Date: 星期三, 13 八月 2025 16:06:41 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'

---
 hangzhoumesParent/moduleService/hollowGlassModule/src/main/java/com/mes/job/OpcPlcStorageCageHollowTask.java |   72 ++++++++++++++++++++---------------
 1 files changed, 41 insertions(+), 31 deletions(-)

diff --git a/hangzhoumesParent/moduleService/hollowGlassModule/src/main/java/com/mes/job/OpcPlcStorageCageHollowTask.java b/hangzhoumesParent/moduleService/hollowGlassModule/src/main/java/com/mes/job/OpcPlcStorageCageHollowTask.java
index 97cf082..d80c2e9 100644
--- a/hangzhoumesParent/moduleService/hollowGlassModule/src/main/java/com/mes/job/OpcPlcStorageCageHollowTask.java
+++ b/hangzhoumesParent/moduleService/hollowGlassModule/src/main/java/com/mes/job/OpcPlcStorageCageHollowTask.java
@@ -106,6 +106,7 @@
 
     private static final List<Integer> ONE_LINE_FIRST = Arrays.asList(930, 931, 932);
     private static final List<Integer> TWO_LINE_FIRST = Arrays.asList(931, 930, 932);
+    private Integer lastTimeLine = -1;
     /**
      * 鐩撮�氭牸瀛�
      */
@@ -373,14 +374,14 @@
 
         //鑾峰彇绌洪棽涓旈鍙栦换鍔$殑鏁版嵁淇℃伅锛屾病鏈変换鍔$洿鎺ヨ蛋鐜荤拑璋冨害
         HashMap<Integer, Boolean> map = new HashMap<>();
+        Boolean oneState = Boolean.FALSE;
+        Boolean twoState = Boolean.FALSE;
+        Boolean threeState = Boolean.FALSE;
         try {
             if (CMJ1ModbusTcp.checkConnected()) {
-                Boolean oneEntity = CMJ1ModbusTcp.readUInt16(42027 - 40001) != 0;
-                map.put(930, oneEntity);
-            } else {
-                map.put(930, Boolean.FALSE);
+                oneState = CMJ1ModbusTcp.readUInt16(42027 - 40001) != 0;
+                map.put(930, oneState);
             }
-
         } catch (Exception e) {
             //nothing
             log.info("涓�绾跨┖闂茬姸鎬佽幏鍙栧紓甯�");
@@ -388,45 +389,53 @@
         try {
             S7DataZKExtra s7DataZKExtra = s7SerializerZKQ2.read(S7DataZKExtra.class);
             log.info("涓┖棰濆璇诲彇{}", s7DataZKExtra);
-            map.put(931, s7DataZKExtra.getIsFree());
-            map.put(932, s7DataZKExtra.getIsFree03());
+            twoState = s7DataZKExtra.getIsFree();
+            threeState = s7DataZKExtra.getIsFree03();
+            map.put(931, twoState);
+            map.put(932, threeState);
         } catch (Exception e) {
             //nothing
             log.info("浜�/涓夌嚎绾跨┖闂茬姸鎬佽幏鍙栧紓甯�");
         }
-        List<Integer> resultList = new ArrayList<>();
-        if (redisUtil.getCacheObject("priorityHollowSwitch")) {
-            resultList = TWO_LINE_FIRST;
-        } else {
-            resultList = ONE_LINE_FIRST;
-        }
         HollowGlassOutRelationInfo hollowGlassOutRelationInfo = null;
         int cell = -1;
-        for (Integer i : resultList) {
-            if (null == hollowGlassOutRelationInfo) {
-                Boolean entity = map.get(i);
-                cell = i;
-                if (null != entity && entity) {
+        if (oneState && twoState || !(oneState || twoState)) {
+            //鑾峰彇涓婁竴娆$殑浠诲姟淇℃伅绾胯矾
+            List<Integer> resultList = lastTimeLine == 930 ? TWO_LINE_FIRST : ONE_LINE_FIRST;
+            for (int i : resultList) {
+                if (null == hollowGlassOutRelationInfo) {
+                    cell = i;
                     hollowGlassOutRelationInfo = hollowGlassOutRelationInfoService
                             .getOne(new LambdaQueryWrapper<HollowGlassOutRelationInfo>()
                                     .eq(HollowGlassOutRelationInfo::getCell, cell)
                                     .eq(HollowGlassOutRelationInfo::getState, Const.HOLLOW_FLOW_CARD_START)
                             );
                 }
-            } else {
-                break;
             }
-        }
-        for (Integer i : resultList) {
-            if (null == hollowGlassOutRelationInfo) {
-                cell = i;
-                hollowGlassOutRelationInfo = hollowGlassOutRelationInfoService
-                        .getOne(new LambdaQueryWrapper<HollowGlassOutRelationInfo>()
-                                .eq(HollowGlassOutRelationInfo::getCell, cell)
-                                .eq(HollowGlassOutRelationInfo::getState, Const.HOLLOW_FLOW_CARD_START)
-                        );
-            } else {
-                break;
+        } else {
+            for (int i : ONE_LINE_FIRST) {
+                if (null == hollowGlassOutRelationInfo) {
+                    Boolean freeFlag = map.get(i);
+                    cell = i;
+                    if (freeFlag) {
+                        hollowGlassOutRelationInfo = hollowGlassOutRelationInfoService
+                                .getOne(new LambdaQueryWrapper<HollowGlassOutRelationInfo>()
+                                        .eq(HollowGlassOutRelationInfo::getCell, cell)
+                                        .eq(HollowGlassOutRelationInfo::getState, Const.HOLLOW_FLOW_CARD_START)
+                                );
+                    }
+                }
+            }
+            for (int i : ONE_LINE_FIRST) {
+                if (null == hollowGlassOutRelationInfo) {
+                    cell = i;
+                    hollowGlassOutRelationInfo = hollowGlassOutRelationInfoService
+                            .getOne(new LambdaQueryWrapper<HollowGlassOutRelationInfo>()
+                                    .eq(HollowGlassOutRelationInfo::getCell, cell)
+                                    .eq(HollowGlassOutRelationInfo::getState, Const.HOLLOW_FLOW_CARD_START)
+                            );
+
+                }
             }
         }
 
@@ -1064,6 +1073,7 @@
             s7DataZKDLPTwo = new S7DataZKDLPTwo();
             s7DataZKDLPTwo.setMesReply(1);
             s7SerializerZKDLPTwo.write(s7DataZKDLPTwo);
+            lastTimeLine = targetSlot;
         } catch (Exception e) {
             e.printStackTrace();
         }

--
Gitblit v1.8.0