From d184c245bfbe1847c56c5b88d67ee7bb51634860 Mon Sep 17 00:00:00 2001
From: wangfei <3597712270@qq.com>
Date: 星期二, 21 十月 2025 11:14:13 +0800
Subject: [PATCH] Merge branch 'master' of http://10.153.19.25:10105/r/YiWuProject

---
 hangzhoumesParent/moduleService/hollowGlassModule/src/main/java/com/mes/hollowqueue/service/impl/HollowGlassQueueInfoServiceImpl.java |   10 +
 hangzhoumesParent/moduleService/hollowGlassModule/src/main/java/com/mes/job/OpcPlcStorageCageHollowTask.java                          |  197 ++++++++++++++++++++++++--------
 hangzhoumesParent/moduleService/hollowGlassModule/src/main/resources/mapper/HollowGlassQueueInfoMapper.xml                            |   23 +++
 hangzhoumesParent/common/servicebase/src/main/java/com/mes/temperingglass/service/impl/TemperingGlassInfoServiceImpl.java             |    4 
 hangzhoumesParent/moduleService/hollowGlassModule/src/main/java/com/mes/hollow/service/impl/HollowGlassRelationInfoServiceImpl.java   |   19 ++
 hangzhoumesParent/moduleService/hollowGlassModule/src/main/java/com/mes/hollowqueue/service/HollowGlassQueueInfoService.java          |    2 
 hangzhoumesParent/moduleService/hollowGlassModule/src/main/java/com/mes/job/PushMessageToIndex.java                                   |   10 
 hangzhoumesParent/moduleService/hollowGlassModule/src/main/resources/application-yw.yml                                               |    5 
 hangzhoumesParent/moduleService/hollowGlassModule/src/main/resources/mapper/HollowBigStorageCageDetailsMapper.xml                     |    2 
 hangzhoumesParent/moduleService/hollowGlassModule/src/main/java/com/mes/s7/entity/S7DataZKDLPOne.java                                 |    6 +
 hangzhoumesParent/moduleService/CacheGlassModule/src/main/resources/mapper/EdgStorageCageDetailsMapper.xml                            |   49 ++++----
 hangzhoumesParent/moduleService/hollowGlassModule/src/main/java/com/mes/hollowqueue/mapper/HollowGlassQueueInfoMapper.java            |    8 +
 12 files changed, 244 insertions(+), 91 deletions(-)

diff --git a/hangzhoumesParent/common/servicebase/src/main/java/com/mes/temperingglass/service/impl/TemperingGlassInfoServiceImpl.java b/hangzhoumesParent/common/servicebase/src/main/java/com/mes/temperingglass/service/impl/TemperingGlassInfoServiceImpl.java
index 58adcca..369f4de 100644
--- a/hangzhoumesParent/common/servicebase/src/main/java/com/mes/temperingglass/service/impl/TemperingGlassInfoServiceImpl.java
+++ b/hangzhoumesParent/common/servicebase/src/main/java/com/mes/temperingglass/service/impl/TemperingGlassInfoServiceImpl.java
@@ -191,8 +191,8 @@
         List<LoadGlassInfo> glassInfos = null;
         glassInfos = glassInfoMapper.selectJoinList(LoadGlassInfo.class, new MPJQueryWrapper<GlassInfo>()
                 .select("IFNULL(b.state, 0) AS state,engineer_id,tempering_layout_id,width,height,tempering_feed_sequence,x_coordinate,y_coordinate,angle,t.glass_id,t.flow_card_id")
-                .leftJoin("(SELECT glass_id, MAX(type) AS state FROM damage GROUP BY glass_id) b\n" +
-                        "ON t.glass_id = b.glass_id")
+                .leftJoin("(SELECT glass_id, type as state FROM damage where type in (8, 9) and status = 1) b\n" +
+                        "ON t.glass_id = b.glass_id ")
                 .eq("engineer_id", glassInfo.getEngineerId())
                 .eq("tempering_layout_id", glassInfo.getTemperingLayoutId()));
         return glassInfos;
diff --git a/hangzhoumesParent/moduleService/CacheGlassModule/src/main/resources/mapper/EdgStorageCageDetailsMapper.xml b/hangzhoumesParent/moduleService/CacheGlassModule/src/main/resources/mapper/EdgStorageCageDetailsMapper.xml
index af01a6f..5522b79 100644
--- a/hangzhoumesParent/moduleService/CacheGlassModule/src/main/resources/mapper/EdgStorageCageDetailsMapper.xml
+++ b/hangzhoumesParent/moduleService/CacheGlassModule/src/main/resources/mapper/EdgStorageCageDetailsMapper.xml
@@ -69,7 +69,7 @@
         else 0 end as state
         from glass_temp t
         left join edg_storage_cage_details t1 on t.glass_id = t1.glass_id
-        left join damage t2 on t.glass_id = t2.glass_id and t2.type in (8,9)
+        left join damage t2 on t.glass_id = t2.glass_id and t2.type in (8,9) AND t2.STATUS = 1
         )select * from cut_drawing_temp where 1=1
         <if test="isAll == 1">
             and state = 0
@@ -78,10 +78,10 @@
     </select>
     <select id="querySlotRemainWidth" resultType="com.mes.edgstoragecage.entity.vo.EdgSlotRemainVO">
         select device_id,
-               slot,
-               if(#{cellLength} - sum(GREATEST(width, height) + #{glassGap}) &lt; 0, 0, #{cellLength} -
-                                                                                        sum(GREATEST(width, height) + #{glassGap})) as
-                   remain_width
+        slot,
+        if(#{cellLength} - sum(GREATEST(width, height) + #{glassGap}) &lt; 0, 0, #{cellLength} -
+        sum(GREATEST(width, height) + #{glassGap})) as
+        remain_width
         from edg_storage_cage_details
         where state = 100
         group by device_id, slot
@@ -115,26 +115,27 @@
         limit 1
     </select>
     <select id="queryPieChart" resultType="com.mes.largenscreen.entity.PieChartVO">
-        SELECT round(sum(CASE WHEN e.station_cell = 5 THEN 1 ELSE 0 END), 2)                                                   as oneCompletedQuantity,
-               round(sum(CASE WHEN e.station_cell = 5 THEN escd.width * escd.height / 1000000 ELSE 0 END),
-                     2)                                                                                                        as oneCompletedArea,
-               round(sum(CASE WHEN e.station_cell = 6 THEN 1 ELSE 0 END), 2)                                                   as twoCompletedQuantity,
-               round(sum(CASE WHEN e.station_cell = 6 THEN escd.width * escd.height / 1000000 ELSE 0 END),
-                     2)                                                                                                        as twoCompletedArea,
-               round(sum(CASE WHEN e.station_cell = 5 and escd.device_id is null THEN 1 ELSE 0 END),
-                     2)                                                                                                        as oneUncompletedQuantity,
-               round(sum(CASE
-                             WHEN e.station_cell = 5 and escd.device_id is null THEN gi.width * gi.height / 1000000
-                             ELSE 0 END),
-                     2)                                                                                                        as oneUncompletedArea,
-               round(sum(CASE WHEN e.station_cell = 6 and escd.device_id is null THEN 1 ELSE 0 END),
-                     2)                                                                                                        as twoUncompletedQuantity,
-            round(sum( CASE WHEN e.station_cell = 6 and escd.device_id is null THEN gi.width*gi.height/1000000 ELSE 0 END ),2) as twoUncompletedArea
+        SELECT round(sum(CASE WHEN e.station_cell = 5 THEN 1 ELSE 0 END), 2) as oneCompletedQuantity,
+        round(sum(CASE WHEN e.station_cell = 5 THEN escd.width * escd.height / 1000000 ELSE 0 END),
+        2) as oneCompletedArea,
+        round(sum(CASE WHEN e.station_cell = 6 THEN 1 ELSE 0 END), 2) as twoCompletedQuantity,
+        round(sum(CASE WHEN e.station_cell = 6 THEN escd.width * escd.height / 1000000 ELSE 0 END),
+        2) as twoCompletedArea,
+        round(sum(CASE WHEN e.station_cell = 5 and escd.device_id is null THEN 1 ELSE 0 END),
+        2) as oneUncompletedQuantity,
+        round(sum(CASE
+        WHEN e.station_cell = 5 and escd.device_id is null THEN gi.width * gi.height / 1000000
+        ELSE 0 END),
+        2) as oneUncompletedArea,
+        round(sum(CASE WHEN e.station_cell = 6 and escd.device_id is null THEN 1 ELSE 0 END),
+        2) as twoUncompletedQuantity,
+        round(sum( CASE WHEN e.station_cell = 6 and escd.device_id is null THEN gi.width*gi.height/1000000 ELSE 0 END
+        ),2) as twoUncompletedArea
         FROM
-            glass_info gi
-                left join edg_storage_cage_details escd ON gi.glass_id = escd.glass_id
-                left join engineering e on gi.engineer_id=e.engineer_id
+        glass_info gi
+        left join edg_storage_cage_details escd ON gi.glass_id = escd.glass_id
+        left join engineering e on gi.engineer_id=e.engineer_id
         WHERE
-            date(e.create_time) = date(now())
+        date(e.create_time) = date(now())
     </select>
 </mapper>
\ No newline at end of file
diff --git a/hangzhoumesParent/moduleService/hollowGlassModule/src/main/java/com/mes/hollow/service/impl/HollowGlassRelationInfoServiceImpl.java b/hangzhoumesParent/moduleService/hollowGlassModule/src/main/java/com/mes/hollow/service/impl/HollowGlassRelationInfoServiceImpl.java
index 2299c73..3d508b1 100644
--- a/hangzhoumesParent/moduleService/hollowGlassModule/src/main/java/com/mes/hollow/service/impl/HollowGlassRelationInfoServiceImpl.java
+++ b/hangzhoumesParent/moduleService/hollowGlassModule/src/main/java/com/mes/hollow/service/impl/HollowGlassRelationInfoServiceImpl.java
@@ -15,7 +15,9 @@
 import com.mes.hollow.entity.HollowBigStorageCageDetails;
 import com.mes.hollow.entity.HollowGlassOutRelationInfo;
 import com.mes.hollow.entity.HollowGlassRelationInfo;
-import com.mes.hollow.entity.dto.*;
+import com.mes.hollow.entity.dto.FlowCardGlassInfoDTO;
+import com.mes.hollow.entity.dto.HollowBigStorageDTO;
+import com.mes.hollow.entity.dto.LackDetailsDTO;
 import com.mes.hollow.entity.vo.HollowAllFlowCardVO;
 import com.mes.hollow.entity.vo.HollowBigStorageDetailsQueryVO;
 import com.mes.hollow.mapper.HollowGlassRelationInfoMapper;
@@ -112,11 +114,24 @@
         if (null == relationInfoOne) {
             throw new RuntimeException("鐩稿叧娴佺▼鍗℃湭鎵惧埌瀵瑰簲鐨勭粍鍙蜂俊鎭紝鐜荤拑娴佺▼鍗★細" + flowCardId + "锛屽簭鍙凤細" + glassType + "锛屾�诲眰鏁帮細" + totalLayer + "锛屽眰鏁帮細" + layer);
         }
+        Integer slotMaxHeight = sysConfigService.queryConfigValue(ConstSysConfig.HOLLOW_SLOT_MAX_HEIGHT);
         Integer slotWidth = sysConfigService.queryConfigValue(ConstSysConfig.HOLLOW_SLOT_WIDTH);
+        HollowBigStorageCage storageCage = null;
+        if (Math.min(width, height) > slotMaxHeight) {
+            storageCage = hollowBigStorageCageService.getOne(new LambdaQueryWrapper<HollowBigStorageCage>()
+                    .eq(HollowBigStorageCage::getEnableState, Const.SLOT_ON).eq(HollowBigStorageCage::getRemainWidth, slotWidth)
+                    .eq(HollowBigStorageCage::getDeviceId, 6)
+                    .orderByAsc(HollowBigStorageCage::getMaxThickness).last("limit 1"));
+            HollowBigStorageDTO storageDTO = new HollowBigStorageDTO();
+            BeanUtils.copyProperties(storageCage, storageDTO);
+            BeanUtils.copyProperties(relationInfoOne, storageDTO);
+            return storageDTO;
+        }
+
         //璇︽儏琛ㄥ唴鑾峰彇鏈粍鏄惁宸茬粡鏈夌幓鐠冨湪绗煎瓙鍐咃紙0琛ㄧず鎻愬墠鍗犵敤锛�
         int taskCount = hollowGlassOutRelationInfoService.count(new LambdaQueryWrapper<HollowGlassOutRelationInfo>()
                 .eq(HollowGlassOutRelationInfo::getFlowCardId, flowCardId));
-        HollowBigStorageCage storageCage = null;
+
         //濡傛灉涓嶅瓨鍦ㄥ垯閫夋嫨绗煎唴鏈敤鐨勬柊鏍煎瓙
         if (taskCount > 0) {
             storageCage = hollowBigStorageCageService.getOne(new LambdaQueryWrapper<HollowBigStorageCage>()
diff --git a/hangzhoumesParent/moduleService/hollowGlassModule/src/main/java/com/mes/hollowqueue/mapper/HollowGlassQueueInfoMapper.java b/hangzhoumesParent/moduleService/hollowGlassModule/src/main/java/com/mes/hollowqueue/mapper/HollowGlassQueueInfoMapper.java
index e32c481..87fdda9 100644
--- a/hangzhoumesParent/moduleService/hollowGlassModule/src/main/java/com/mes/hollowqueue/mapper/HollowGlassQueueInfoMapper.java
+++ b/hangzhoumesParent/moduleService/hollowGlassModule/src/main/java/com/mes/hollowqueue/mapper/HollowGlassQueueInfoMapper.java
@@ -3,6 +3,8 @@
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.mes.hollowqueue.entity.HollowGlassQueueInfo;
 
+import java.util.List;
+
 /**
  * (HollowGlassQueueInfo)琛ㄦ暟鎹簱璁块棶灞�
  *
@@ -11,5 +13,11 @@
  */
 public interface HollowGlassQueueInfoMapper extends BaseMapper<HollowGlassQueueInfo> {
 
+    /**
+     * 鏌ヨ闇�瑕佷粎鍗ц浆绔嬬殑鐜荤拑灏忕墖
+     *
+     * @return
+     */
+    List<String> queryNeedInCarGlass();
 }
 
diff --git a/hangzhoumesParent/moduleService/hollowGlassModule/src/main/java/com/mes/hollowqueue/service/HollowGlassQueueInfoService.java b/hangzhoumesParent/moduleService/hollowGlassModule/src/main/java/com/mes/hollowqueue/service/HollowGlassQueueInfoService.java
index 1b48de2..232ba28 100644
--- a/hangzhoumesParent/moduleService/hollowGlassModule/src/main/java/com/mes/hollowqueue/service/HollowGlassQueueInfoService.java
+++ b/hangzhoumesParent/moduleService/hollowGlassModule/src/main/java/com/mes/hollowqueue/service/HollowGlassQueueInfoService.java
@@ -18,5 +18,7 @@
     List<HollowGlassQueueInfo> queryHollowGlassQueueInfoByLine(int cell);
 
     void confirmBorder(HollowGlassQueueInfo hollowGlassQueueInfo);
+
+    List<String> queryNeedInCarGlass();
 }
 
diff --git a/hangzhoumesParent/moduleService/hollowGlassModule/src/main/java/com/mes/hollowqueue/service/impl/HollowGlassQueueInfoServiceImpl.java b/hangzhoumesParent/moduleService/hollowGlassModule/src/main/java/com/mes/hollowqueue/service/impl/HollowGlassQueueInfoServiceImpl.java
index 0f5efb9..0ebc1f3 100644
--- a/hangzhoumesParent/moduleService/hollowGlassModule/src/main/java/com/mes/hollowqueue/service/impl/HollowGlassQueueInfoServiceImpl.java
+++ b/hangzhoumesParent/moduleService/hollowGlassModule/src/main/java/com/mes/hollowqueue/service/impl/HollowGlassQueueInfoServiceImpl.java
@@ -4,10 +4,8 @@
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import com.mes.common.config.Const;
 import com.mes.damage.entity.Damage;
 import com.mes.damage.service.DamageService;
-import com.mes.hollow.entity.HollowGlassOutRelationInfo;
 import com.mes.hollow.service.HollowGlassOutRelationInfoService;
 import com.mes.hollowqueue.entity.HollowGlassQueueInfo;
 import com.mes.hollowqueue.mapper.HollowGlassQueueInfoMapper;
@@ -19,7 +17,6 @@
 import java.time.LocalDate;
 import java.time.LocalDateTime;
 import java.util.List;
-import java.util.Optional;
 
 /**
  * (HollowGlassQueueInfo)琛ㄦ湇鍔″疄鐜扮被
@@ -63,7 +60,7 @@
                         .eq("cell", cell)
                         .eq("is_pair", 1)
                         .ge("create_time", twoDaysAgo)
-                        .select("width","height","flow_card_id","relation_id", "hollow_sequence", "cell", "MAX(state) as state", "MAX(layer) as layer")
+                        .select("width", "height", "flow_card_id", "relation_id", "hollow_sequence", "cell", "MAX(state) as state", "MAX(layer) as layer")
                         .groupBy("relation_id", "hollow_sequence")
                         .orderByAsc("relation_id", "hollow_sequence")
         );
@@ -108,5 +105,10 @@
 
         }
     }
+
+    @Override
+    public List<String> queryNeedInCarGlass() {
+        return baseMapper.queryNeedInCarGlass();
+    }
 }
 
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 67c49d1..dd9c839 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
@@ -157,14 +157,17 @@
 
         List<BigStorageCageTask> inTaskList = new ArrayList();
         Integer from = s7DataZKDLPOne.getFrom1();
+        List<Integer> states = s7DataZKDLPOne.getStates();
         List<String> glassIdList = new ArrayList<>();
         List<String> requestWords = s7DataZKDLPOne.getIds();
         for (int i = 1; i <= 6; i++) {
             String requestWord = requestWords.get(i - 1);
+            Integer state = states.get(i - 1);
             if (null != requestWord && !requestWord.isEmpty()) {
                 BigStorageCageTask task = new BigStorageCageTask();
                 task.setGlassId(requestWord);
                 task.setStartSlot(from);
+                task.setTaskState(state);
                 inTaskList.add(task);
                 glassIdList.add(requestWord);
                 continue;
@@ -172,6 +175,12 @@
         }
         if (CollectionUtil.isEmpty(inTaskList)) {
             log.info("褰撳墠澶ц溅鏃犺繘鐗囩幓鐠冿紝缁撴潫杩涚墖浠诲姟");
+            return;
+        }
+        //鐜荤拑鐘舵�佸瓨鍦ㄥ崸杞珛涓婄粨鏉�
+        List<BigStorageCageTask> unTaskList = inTaskList.stream().filter(e -> e.getTaskState() < 1).collect(Collectors.toList());
+        if (CollectionUtil.isNotEmpty(unTaskList)) {
+            log.info("瀛樺湪鏈笂杞︾殑鐜荤拑淇℃伅,鐜荤拑锛歿}", unTaskList);
             return;
         }
         log.info("鑾峰彇浠诲姟鐨勭幓鐠僫d锛歿}", glassIdList);
@@ -228,38 +237,38 @@
         Integer slotMaxThickness = sysConfigService.queryConfigValue(ConstSysConfig.HOLLOW_SLOT_MAX_THICKNESS);
         //鎸夌収鐜荤拑鍘氬害鍒嗙粍锛屽垽鏂墿浣欐牸瀛愭槸鍚﹀彲浠ュ瓨鏀�
         Map<Double, Long> thickCountMap = glassInfoList.stream().collect(Collectors.groupingBy(GlassInfo::getThickness, Collectors.counting()));
-        if (glassInfoList.get(0).getThickness() < slotMaxThickness) {
-            for (Map.Entry<Double, Long> entry : thickCountMap.entrySet()) {
-                int count = hollowBigStorageCageService.count(new LambdaQueryWrapper<HollowBigStorageCage>()
-                        .eq(HollowBigStorageCage::getEnableState, Const.SLOT_ON).eq(HollowBigStorageCage::getRemainWidth, slotWidth)
-                        .le(HollowBigStorageCage::getMinThickness, entry.getKey())
-                        .ge(HollowBigStorageCage::getMaxThickness, entry.getKey()));
-                if (count < entry.getValue()) {
-                    log.info("绗煎唴鏍煎瓙鍓╀綑鏁伴噺涓嶈冻锛岀粨鏉熸湰娆¤繘鐗�");
-                    //鍚憄lc鍙戦�佹姤璀�:绗煎唴鏍煎瓙鍓╀綑鏁伴噺涓嶈冻
-                    s7DataZKDLPOne = new S7DataZKDLPOne();
-                    s7DataZKDLPOne.setAlramSignal(16);
-                    s7SerializerZKDLPOne.write(s7DataZKDLPOne);
-                    return;
-                }
-            }
-        }
-        //瓒呭ぇ灏哄
-        Integer slotMaxHeight = sysConfigService.queryConfigValue(ConstSysConfig.HOLLOW_SLOT_MAX_HEIGHT);
-        Integer slotMaxthickness = sysConfigService.queryConfigValue(ConstSysConfig.HOLLOW_SLOT_MAX_THICKNESS);
-        if (slotMaxHeight < Math.min(glassInfoList.get(0).getWidth(), glassInfoList.get(0).getHeight()) || glassInfoList.get(0).getThickness() >= slotMaxthickness) {
-            int count = hollowBigStorageCageDetailsService.count(new LambdaQueryWrapper<HollowBigStorageCageDetails>()
-                    .eq(HollowBigStorageCageDetails::getSlot, THROUGH_SLOT)
-                    .in(HollowBigStorageCageDetails::getState, Const.GLASS_STATE_IN_ALL));
-            if (count > 0) {
-                log.info("鐩撮�氱墖鍙板瓨鍦ㄧ幓鐠冿紝缁撴潫鏈杩涚墖");
-                //鍚憄lc鍙戦�佹姤璀�:鐩撮�氱墖鍙板瓨鍦ㄧ幓鐠冿紝鏃犳硶缁х画鐩撮��
+//        if (glassInfoList.get(0).getThickness() < slotMaxThickness) {
+        for (Map.Entry<Double, Long> entry : thickCountMap.entrySet()) {
+            int count = hollowBigStorageCageService.count(new LambdaQueryWrapper<HollowBigStorageCage>()
+                    .eq(HollowBigStorageCage::getEnableState, Const.SLOT_ON).eq(HollowBigStorageCage::getRemainWidth, slotWidth)
+                    .le(HollowBigStorageCage::getMinThickness, entry.getKey())
+                    .ge(HollowBigStorageCage::getMaxThickness, entry.getKey()));
+            if (count < entry.getValue()) {
+                log.info("绗煎唴鏍煎瓙鍓╀綑鏁伴噺涓嶈冻锛岀粨鏉熸湰娆¤繘鐗�");
+                //鍚憄lc鍙戦�佹姤璀�:绗煎唴鏍煎瓙鍓╀綑鏁伴噺涓嶈冻
                 s7DataZKDLPOne = new S7DataZKDLPOne();
-                s7DataZKDLPOne.setAlramSignal(64);
+                s7DataZKDLPOne.setAlramSignal(16);
                 s7SerializerZKDLPOne.write(s7DataZKDLPOne);
                 return;
             }
         }
+//        }
+        //瓒呭ぇ灏哄
+//        Integer slotMaxHeight = sysConfigService.queryConfigValue(ConstSysConfig.HOLLOW_SLOT_MAX_HEIGHT);
+//        Integer slotMaxthickness = sysConfigService.queryConfigValue(ConstSysConfig.HOLLOW_SLOT_MAX_THICKNESS);
+//        if (slotMaxHeight < Math.min(glassInfoList.get(0).getWidth(), glassInfoList.get(0).getHeight()) || glassInfoList.get(0).getThickness() >= slotMaxthickness) {
+//            int count = hollowBigStorageCageDetailsService.count(new LambdaQueryWrapper<HollowBigStorageCageDetails>()
+//                    .eq(HollowBigStorageCageDetails::getSlot, THROUGH_SLOT)
+//                    .in(HollowBigStorageCageDetails::getState, Const.GLASS_STATE_IN_ALL));
+//            if (count > 0) {
+//                log.info("鐩撮�氱墖鍙板瓨鍦ㄧ幓鐠冿紝缁撴潫鏈杩涚墖");
+//                //鍚憄lc鍙戦�佹姤璀�:鐩撮�氱墖鍙板瓨鍦ㄧ幓鐠冿紝鏃犳硶缁х画鐩撮��
+//                s7DataZKDLPOne = new S7DataZKDLPOne();
+//                s7DataZKDLPOne.setAlramSignal(64);
+//                s7SerializerZKDLPOne.write(s7DataZKDLPOne);
+//                return;
+//            }
+//        }
 
         log.info("灏嗛挗鍖栧皬鐗囪〃鍐呯殑鐘舵�佹敼涓洪挗鍖栫粨鏉燂紝鐜荤拑id鏈夛細{}", glassIdList);
         //淇敼閽㈠寲浠诲姟琛ㄤ腑鐨勭姸鎬�
@@ -278,8 +287,9 @@
         Integer glassGap = sysConfigService.queryConfigValue(ConstSysConfig.HOLLOW_GLASS_GAP);
 
         log.info("寮�濮嬭绠楃洰鏍囨牸瀛�,鐜荤拑id鏈夛細{}", inTaskList);
-        if (slotMaxHeight > Math.min(glassInfoList.get(0).getWidth(), glassInfoList.get(0).getHeight()) && glassInfoList.get(0).getThickness() < slotMaxthickness) {
-            for (BigStorageCageTask task : inTaskList) {
+//        if (slotMaxHeight > Math.min(glassInfoList.get(0).getWidth(), glassInfoList.get(0).getHeight()) && glassInfoList.get(0).getThickness() < slotMaxthickness) {
+        for (BigStorageCageTask task : inTaskList) {
+            if (from == 910) {
                 GlassInfo info = glassListMap.get(task.getGlassId()).get(0);
                 HollowBigStorageDTO bigStorageDTO = null;
                 try {
@@ -347,29 +357,29 @@
                         .eq(HollowGlassRelationInfo::getSlotSequence, bigStorageDTO.getSlotSequence())
                         .eq(HollowGlassRelationInfo::getHollowSequence, bigStorageDTO.getHollowSequence())
                 );
+
+            } else {
+                task.setTargetSlot(THROUGH_SLOT);
+                //瀛樻斁鍘嗗彶浠诲姟
+                HollowBigStorageCageHistoryTask historyTask = new HollowBigStorageCageHistoryTask();
+                BeanUtils.copyProperties(task, historyTask);
+                historyTask.setTaskType(Const.BIG_STORAGE_AFTER_IN);
+                historyTask.setGlassCount(glassInfoList.size());
+                historyTask.setTaskState(Const.ENGINEERING_NEW);
+                historyTasks.add(historyTask);
+                GlassInfo info = glassInfoList.get(0);
+                HollowBigStorageCageDetails cageDetails = new HollowBigStorageCageDetails();
+                BeanUtils.copyProperties(info, cageDetails);
+                cageDetails.setSlot(THROUGH_SLOT);
+                cageDetails.setState(Const.GLASS_STATE_NEW);
+                cageDetails.setDeviceId(0);
+                cageDetails.setSequence(0);
+                cageDetails.setHollowSequence(0);
+                cageDetails.setGap(glassGap);
+                cageDetails.setFilmsId(info.getFilmsid());
+                cageDetails.setId(null);
+                hollowBigStorageCageDetailsService.save(cageDetails);
             }
-        } else {
-            BigStorageCageTask task = inTaskList.get(0);
-            task.setTargetSlot(THROUGH_SLOT);
-            //瀛樻斁鍘嗗彶浠诲姟
-            HollowBigStorageCageHistoryTask historyTask = new HollowBigStorageCageHistoryTask();
-            BeanUtils.copyProperties(task, historyTask);
-            historyTask.setTaskType(Const.BIG_STORAGE_AFTER_IN);
-            historyTask.setGlassCount(glassInfoList.size());
-            historyTask.setTaskState(Const.ENGINEERING_NEW);
-            historyTasks.add(historyTask);
-            GlassInfo info = glassInfoList.get(0);
-            HollowBigStorageCageDetails cageDetails = new HollowBigStorageCageDetails();
-            BeanUtils.copyProperties(info, cageDetails);
-            cageDetails.setSlot(THROUGH_SLOT);
-            cageDetails.setState(Const.GLASS_STATE_NEW);
-            cageDetails.setDeviceId(0);
-            cageDetails.setSequence(0);
-            cageDetails.setHollowSequence(0);
-            cageDetails.setGap(glassGap);
-            cageDetails.setFilmsId(info.getFilmsid());
-            cageDetails.setId(null);
-            hollowBigStorageCageDetailsService.save(cageDetails);
         }
 
         //鍘嗗彶鏁版嵁鍏ュ簱
@@ -449,6 +459,7 @@
             //nothing
             log.info("浜�/涓夌嚎绾跨┖闂茬姸鎬佽幏鍙栧紓甯�");
         }
+
         List<Integer> resultList = new ArrayList<>();
         if (redisUtil.getCacheObject("priorityHollowSwitch")) {
             resultList = TWO_LINE_FIRST;
@@ -495,11 +506,19 @@
             //鏄惁鏈夋鍦ㄤ腑绌虹殑鐜荤拑:涓┖灏忕墖琛ㄧ瓫閫夋湭鍑虹鐨勭幓鐠冧俊鎭�
 //            鑾峰彇褰撳墠涓┖浠诲姟鏈畬鎴愬嚭鐗囩殑鐜荤拑淇℃伅
             List<HollowGlassQueueInfo> unFinishHollowQueueList = hollowGlassQueueInfoService.list(new LambdaQueryWrapper<HollowGlassQueueInfo>()
-                    .eq(HollowGlassQueueInfo::getFlowCardId, hollowGlassOutRelationInfo.getFlowCardId())
-                    .eq(HollowGlassQueueInfo::getCell, hollowGlassOutRelationInfo.getCell())
                     .eq(HollowGlassQueueInfo::getState, Const.TEMPERING_NEW)
+                    .eq(HollowGlassQueueInfo::getRelationId, hollowGlassOutRelationInfo.getId())
                     .orderByAsc(HollowGlassQueueInfo::getHollowSequence));
             if (CollectionUtil.isNotEmpty(unFinishHollowQueueList)) {
+                //鐩撮�氬彴鏈夌幓鐠冩椂灏嗕腑绌哄嚭鐗囬槦鍒椾腑瀵瑰簲鐜荤拑id鐨勬牸瀛愬彿鏇挎崲鏈洿閫氬彴
+                HollowBigStorageCageDetails details = hollowBigStorageCageDetailsService.getOne(new LambdaQueryWrapper<HollowBigStorageCageDetails>()
+                        .eq(HollowBigStorageCageDetails::getSlot, THROUGH_SLOT)
+                        .in(HollowBigStorageCageDetails::getState, Const.GLASS_STATE_IN_ALL).last("limit 1"));
+                log.info("涓┖澶х悊鐗囩洿閫氬彴鐜荤拑淇℃伅{}", details);
+                if (details != null && details.getGlassId().equals(unFinishHollowQueueList.get(0).getGlassId())) {
+                    unFinishHollowQueueList.get(0).setSlot(THROUGH_SLOT);
+                    log.info("灏嗕腑绌洪槦鍒椾腑鐨勬牸瀛愬彿鏇挎崲涓虹洿閫氬彴{}", unFinishHollowQueueList);
+                }
                 log.info("鏈夋鍦ㄥ嚭鐗囩殑涓┖浠诲姟");
                 Integer isPair = unFinishHollowQueueList.get(0).getIsPair();
                 hollowOutGlassByIsPair(unFinishHollowQueueList, hollowGlassOutRelationInfo.getCell(), isPair, hollowGlassOutRelationInfo.getTotalLayer(), hollowGlassOutRelationInfo.getIsForce());
@@ -852,6 +871,68 @@
 
     }
 
+    @Scheduled(fixedDelay = 1000)
+    public void inCarTask() {
+        //璇诲彇鍗忚鏁版嵁
+        S7DataZKDLPOne s7DataZKDLPOne = s7SerializerZKDLPOne.read(S7DataZKDLPOne.class);
+        log.info("杩涚墖浠诲姟璇诲彇s7DataZKDLPOne:{}", s7DataZKDLPOne);
+        Boolean inkageEntity = s7DataZKDLPOne.getMesControl();
+        if (!inkageEntity) {
+            log.info("褰撳墠涓洪潪鑱旀満鐘舵�侊紝缁撴潫杩涚墖浠诲姟");
+            return;
+        }
+        Integer requestEntity = s7DataZKDLPOne.getRequestMes();
+        if (StringUtils.isNotBlank(s7DataZKDLPOne.getId7()) && requestEntity == 0) {
+            //姹囨姤瀛椾负1 鍚姩瀛椾负1鏄�  娓呴櫎鎵�鏈変换鍔′俊鎭�
+            if (s7DataZKDLPOne.getId7().equals(s7DataZKDLPOne.getId1())) {
+                //todo:娓呯┖浠诲姟
+                S7DataZKDLPOne sendTask = new S7DataZKDLPOne();
+                sendTask.setFrom7(0);
+                sendTask.setId7("");
+                s7SerializerZKDLPOne.write(sendTask);
+                log.info("娓呴櫎鎵�鏈変换鍔′俊鎭瘂}", sendTask);
+                s7DataZKDLPOne = s7SerializerZKDLPOne.read(S7DataZKDLPOne.class);
+                log.info("娓呯┖浠诲姟鍚庡啀璇诲彇{}", s7DataZKDLPOne);
+            }
+            log.info("瀛樺湪浠诲姟锛岀粨鏉�");
+            return;
+        }
+        if (1 != requestEntity) {
+            log.info("褰撳墠鏈敹鍒拌繘鐗囪姹傦紝缁撴潫杩涚墖浠诲姟");
+            return;
+        }
+        //鏈夎姹備俊鍙�
+        List<String> glassIdList = hollowGlassQueueInfoService.queryNeedInCarGlass();
+        if (CollectionUtil.isEmpty(glassIdList)) {
+            return;
+        }
+        int count = hollowBigStorageCageDetailsService.count(new LambdaQueryWrapper<HollowBigStorageCageDetails>()
+                .eq(HollowBigStorageCageDetails::getState, Const.GLASS_STATE_IN)
+                .eq(HollowBigStorageCageDetails::getSlot, THROUGH_SLOT));
+        if (count > 0) {
+            return;
+        }
+        List<HollowBigStorageCageDetails> list = hollowBigStorageCageDetailsService.list(new LambdaQueryWrapper<HollowBigStorageCageDetails>()
+                .eq(HollowBigStorageCageDetails::getState, Const.GLASS_STATE_IN)
+                .in(HollowBigStorageCageDetails::getDeviceId, 6)
+                .in(HollowBigStorageCageDetails::getGlassId, glassIdList));
+        if (CollectionUtil.isEmpty(list)) {
+            return;
+        }
+        HollowBigStorageCageDetails details = list.get(0);
+        //todo:鐢熸垚杩涜繘鐗囧ぇ杞︿换鍔�
+        hollowBigStorageCageDetailsService.update(new LambdaUpdateWrapper<HollowBigStorageCageDetails>()
+                .set(HollowBigStorageCageDetails::getState, Const.RAW_GLASS_STATE_OUT)
+                .eq(HollowBigStorageCageDetails::getGlassId, details.getGlassId()));
+        S7DataZKDLPOne sendTask = new S7DataZKDLPOne();
+        sendTask.setFrom7(details.getSlot());
+        sendTask.setId7(details.getGlassId());
+        s7SerializerZKDLPOne.write(sendTask);
+        log.info("鏂扮瀛愬啓鍏d涓巉rom{}", sendTask);
+        updateSlotRemainBySlots(Arrays.asList(details.getSlot()));
+    }
+
+
     private void dealDamageInTask(List<BigStorageCageTask> damageTaskList) {
 //        鑾峰彇杩涚墖浠诲姟琛ㄤ腑鐘舵�佷负鐮存崯鐨勬暟鎹�
         log.info("鐮存崯鐨勭幓鐠冧俊鎭湁锛歿}", damageTaskList);
@@ -1022,7 +1103,17 @@
         Integer outCarMaxSize = sysConfigService.queryConfigValue(ConstSysConfig.HOLLOW_OUT_CAR_SIZE);
 //        Integer glassGap = sysConfigService.queryConfigValue(ConstSysConfig.HOLLOW_GLASS_GAP);
         Integer glassGap = hollowGlassRelationInfoService.getGlassGapByThickness(list.get(0).getThickness());
+        log.info("涓┖鐢熸垚涓�杞︿换鍔★細{}", list);
         for (T e : list) {
+            //鏍煎瓙涓虹浜斾釜绗煎瓙鏃朵笉娣诲姞鍑虹墖浠诲姟
+            HollowBigStorageCage hollowBigStorageCage = hollowBigStorageCageService.getOne(
+                    new LambdaQueryWrapper<HollowBigStorageCage>()
+                            .eq(HollowBigStorageCage::getSlot, e.getSlot())
+            );
+
+            if (hollowBigStorageCage != null && hollowBigStorageCage.getDeviceId() == 6) {
+                break;
+            }
             if (templist.size() >= outCarMaxSize || Math.max((int) e.getWidth(), (int) e.getHeight()) > remainWidth) {
                 break;
             }
diff --git a/hangzhoumesParent/moduleService/hollowGlassModule/src/main/java/com/mes/job/PushMessageToIndex.java b/hangzhoumesParent/moduleService/hollowGlassModule/src/main/java/com/mes/job/PushMessageToIndex.java
index 87bb726..513676b 100644
--- a/hangzhoumesParent/moduleService/hollowGlassModule/src/main/java/com/mes/job/PushMessageToIndex.java
+++ b/hangzhoumesParent/moduleService/hollowGlassModule/src/main/java/com/mes/job/PushMessageToIndex.java
@@ -230,17 +230,17 @@
             Boolean inkageEntity = s7DataZKDLPOne.getMesControl();
             jsonObject.append("inkageEntity", inkageEntity);
             //杩涚墖璇锋眰
-            String requestEntity = s7DataZKDLPOne.getRequestMes().toString();
+            Integer requestEntity = s7DataZKDLPOne.getRequestMes();
             jsonObject.append("requestEntity", requestEntity);
             //鍚姩鍛戒护
-            String mesReplyEntity = s7DataZKDLPOne.getMesReply().toString();
+            Integer mesReplyEntity = s7DataZKDLPOne.getMesReply();
             jsonObject.append("mesReplyEntity", mesReplyEntity);
             //鍑虹墖鑱旀満
-            String outInkageEntity = s7DataZKDLPTwo.getMesControl().toString();
+            Boolean outInkageEntity = s7DataZKDLPTwo.getMesControl();
             jsonObject.append("outInkageEntity", outInkageEntity);
             //鍑虹墖璇锋眰
-            String outRequestEntity = s7DataZKDLPTwo.getRequestMes().toString();
-            jsonObject.append("outInkageEntity", outInkageEntity);
+            Integer outRequestEntity = s7DataZKDLPTwo.getRequestMes();
+            jsonObject.append("outRequestEntity", outRequestEntity);
             //930绌洪棽淇″彿
             jsonObject.append("freeOneRequestEntity", CMJ1ModbusTcp.readUInt16(42027 - offset));
             //931绌洪棽淇″彿
diff --git a/hangzhoumesParent/moduleService/hollowGlassModule/src/main/java/com/mes/s7/entity/S7DataZKDLPOne.java b/hangzhoumesParent/moduleService/hollowGlassModule/src/main/java/com/mes/s7/entity/S7DataZKDLPOne.java
index acea6fd..db818ee 100644
--- a/hangzhoumesParent/moduleService/hollowGlassModule/src/main/java/com/mes/s7/entity/S7DataZKDLPOne.java
+++ b/hangzhoumesParent/moduleService/hollowGlassModule/src/main/java/com/mes/s7/entity/S7DataZKDLPOne.java
@@ -97,6 +97,12 @@
     @S7Variable(address = "DB7.118", type = EDataType.STRING, count = 14)
     private String id6;
 
+    @S7Variable(address = "DB7.1248", type = EDataType.STRING, count = 14)
+    private String id7;
+
+    @S7Variable(address = "DB7.1380", type = EDataType.UINT16)
+    private Integer from7;
+
     @S7Variable(address = "MW1002", type = EDataType.UINT16)
     private Integer alramSignal;
 
diff --git a/hangzhoumesParent/moduleService/hollowGlassModule/src/main/resources/application-yw.yml b/hangzhoumesParent/moduleService/hollowGlassModule/src/main/resources/application-yw.yml
index 3cda680..5702dbd 100644
--- a/hangzhoumesParent/moduleService/hollowGlassModule/src/main/resources/application-yw.yml
+++ b/hangzhoumesParent/moduleService/hollowGlassModule/src/main/resources/application-yw.yml
@@ -19,6 +19,11 @@
           username: sa
           password: beibo.123/
           driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver
+        sd:
+          url: jdbc:mysql://192.168.2.100:3309/sd?serverTimezone=GMT%2b8
+          username: root
+          password: beibo.123/
+          driver-class-name: com.mysql.cj.jdbc.Driver
   cloud:
     nacos:
       discovery:
diff --git a/hangzhoumesParent/moduleService/hollowGlassModule/src/main/resources/mapper/HollowBigStorageCageDetailsMapper.xml b/hangzhoumesParent/moduleService/hollowGlassModule/src/main/resources/mapper/HollowBigStorageCageDetailsMapper.xml
index cb5fb88..d6b7a5d 100644
--- a/hangzhoumesParent/moduleService/hollowGlassModule/src/main/resources/mapper/HollowBigStorageCageDetailsMapper.xml
+++ b/hangzhoumesParent/moduleService/hollowGlassModule/src/main/resources/mapper/HollowBigStorageCageDetailsMapper.xml
@@ -340,7 +340,7 @@
         ),
         glass_engineer_temp AS (
         SELECT
-        flow_card_id,
+        distinct flow_card_id,
         engineer_id
         FROM
         (
diff --git a/hangzhoumesParent/moduleService/hollowGlassModule/src/main/resources/mapper/HollowGlassQueueInfoMapper.xml b/hangzhoumesParent/moduleService/hollowGlassModule/src/main/resources/mapper/HollowGlassQueueInfoMapper.xml
new file mode 100644
index 0000000..221f097
--- /dev/null
+++ b/hangzhoumesParent/moduleService/hollowGlassModule/src/main/resources/mapper/HollowGlassQueueInfoMapper.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
+<mapper namespace="com.mes.hollowqueue.mapper.HollowGlassQueueInfoMapper">
+
+    <select id="queryNeedInCarGlass" resultType="java.lang.String">
+        WITH queue_temp AS (
+            SELECT slot,
+                   glass_id,
+                   LEAST(width, height)                                             AS height,
+                   relation_id,
+                   ROW_NUMBER() OVER ( PARTITION BY cell ORDER BY hollow_sequence ) AS rn
+            FROM hollow_glass_queue_info
+            WHERE state = - 1
+        ),
+             glass_id_temp AS (SELECT * FROM queue_temp WHERE rn = 1),
+             task_temp AS (SELECT *
+                           FROM glass_id_temp t
+                                    INNER JOIN hollow_glass_out_relation_info t1 ON t.relation_id = t1.id
+                           WHERE t1.state = 1)
+        SELECT glass_id
+        FROM task_temp
+    </select>
+</mapper>
\ No newline at end of file

--
Gitblit v1.8.0