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

---
 hangzhoumesParent/moduleService/howllowGlassModule/src/main/java/com/mes/hollow/service/impl/HollowGlassRelationInfoServiceImpl.java |   61 ++++++++++++++++++++++--------
 1 files changed, 44 insertions(+), 17 deletions(-)

diff --git a/hangzhoumesParent/moduleService/howllowGlassModule/src/main/java/com/mes/hollow/service/impl/HollowGlassRelationInfoServiceImpl.java b/hangzhoumesParent/moduleService/howllowGlassModule/src/main/java/com/mes/hollow/service/impl/HollowGlassRelationInfoServiceImpl.java
index 39f344b..4aa8a57 100644
--- a/hangzhoumesParent/moduleService/howllowGlassModule/src/main/java/com/mes/hollow/service/impl/HollowGlassRelationInfoServiceImpl.java
+++ b/hangzhoumesParent/moduleService/howllowGlassModule/src/main/java/com/mes/hollow/service/impl/HollowGlassRelationInfoServiceImpl.java
@@ -3,6 +3,7 @@
 import cn.hutool.core.collection.CollectionUtil;
 import cn.hutool.core.lang.Assert;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.toolkit.StringUtils;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.mes.common.config.Const;
 import com.mes.glassinfo.entity.GlassInfo;
@@ -14,6 +15,7 @@
 import com.mes.hollow.entity.dto.HollowBigStorageDTO;
 import com.mes.hollow.entity.dto.HollowGlassDetailsDTO;
 import com.mes.hollow.entity.dto.LackDetailsDTO;
+import com.mes.hollow.entity.vo.HollowBigStorageDetailsQueryVO;
 import com.mes.hollow.mapper.HollowGlassRelationInfoMapper;
 import com.mes.hollow.service.HollowBigStorageCageDetailsService;
 import com.mes.hollow.service.HollowBigStorageCageService;
@@ -63,6 +65,7 @@
                 .eq(HollowGlassRelationInfo::getFlowCardId, flowCardId)
                 .eq(HollowGlassRelationInfo::getWidth, width)
                 .eq(HollowGlassRelationInfo::getHeight, height)
+                .eq(HollowGlassRelationInfo::getTotalLayer, totalLayer)
                 .eq(HollowGlassRelationInfo::getLayer, layer)
                 .eq(HollowGlassRelationInfo::getState, Const.HOLLOW_RELATION_NEW)
                 .orderByAsc(HollowGlassRelationInfo::getHollowSequence)
@@ -76,20 +79,23 @@
                     .eq(HollowGlassRelationInfo::getFlowCardId, flowCardId)
                     .eq(HollowGlassRelationInfo::getWidth, width)
                     .eq(HollowGlassRelationInfo::getHeight, height)
+                    .eq(HollowGlassRelationInfo::getTotalLayer, totalLayer)
                     .eq(HollowGlassRelationInfo::getLayer, layer)
                     .eq(HollowGlassRelationInfo::getState, Const.HOLLOW_RELATION_NEW)
                     .orderByAsc(HollowGlassRelationInfo::getHollowSequence)
                     .last("limit 1")
             );
         }
-        HollowBigStorageCageDetails hollowDetails = hollowBigStorageCageDetailsService.getOne(new LambdaQueryWrapper<HollowBigStorageCageDetails>()
+        //璇︽儏琛ㄥ唴鑾峰彇鏈粍鏄惁宸茬粡鏈夌幓鐠冨湪绗煎瓙鍐咃紙0琛ㄧず鎻愬墠鍗犵敤锛�
+        List<HollowBigStorageCageDetails> hollowDetailsList = hollowBigStorageCageDetailsService.list(new LambdaQueryWrapper<HollowBigStorageCageDetails>()
                 .eq(HollowBigStorageCageDetails::getFlowCardId, relationInfoOne.getFlowCardId())
+                .eq(HollowBigStorageCageDetails::getTotalLayer, totalLayer)
                 .eq(HollowBigStorageCageDetails::getLayer, layer)
                 .eq(HollowBigStorageCageDetails::getVirtualSlot, relationInfoOne.getVirtualSlot())
-                .in(HollowBigStorageCageDetails::getState, Const.GLASS_STATE_IN_ALL_ZERO)
-                .orderByDesc(HollowBigStorageCageDetails::getSequence).last("limit 1"));
+                .in(HollowBigStorageCageDetails::getState, Const.GLASS_STATE_IN_ALL_ZERO));
         HollowBigStorageCage storageCage = null;
-        if (null == hollowDetails) {
+        //濡傛灉涓嶅瓨鍦ㄥ垯閫夋嫨绗煎唴鏈敤鐨勬柊鏍煎瓙
+        if (CollectionUtil.isEmpty(hollowDetailsList)) {
             storageCage = hollowBigStorageCageService.getOne(new LambdaQueryWrapper<HollowBigStorageCage>()
                     .eq(HollowBigStorageCage::getEnableState, Const.SLOT_ON).eq(HollowBigStorageCage::getRemainWidth, slotWidth)
                     .le(HollowBigStorageCage::getMinThickness, relationInfoOne.getThickness())
@@ -100,25 +106,28 @@
             BeanUtils.copyProperties(relationInfoOne, storageDTO);
             return storageDTO;
         }
+        //鑾峰彇褰撳墠缁勫湪绗煎瓙鍐呯殑鏍煎瓙鍙凤紙鎸夌収缁勫唴搴忓彿-1璁$畻 濡傛灉娌℃湁鍒欐柊寮�涓�鏍硷級
         HollowGlassRelationInfo relationInfoBefore = hollowGlassRelationInfoService.getOne(new LambdaQueryWrapper<HollowGlassRelationInfo>()
                 .eq(HollowGlassRelationInfo::getFlowCardId, relationInfoOne.getFlowCardId())
+                .eq(HollowGlassRelationInfo::getTotalLayer, relationInfoOne.getTotalLayer())
                 .eq(HollowGlassRelationInfo::getLayer, relationInfoOne.getLayer())
                 .eq(HollowGlassRelationInfo::getVirtualSlot, relationInfoOne.getVirtualSlot())
                 .eq(HollowGlassRelationInfo::getSlotSequence, relationInfoOne.getSlotSequence() - 1));
         if (null == relationInfoBefore) {
-            //琛ㄧず搴忓彿娌℃湁鎴栬��  搴忓彿涓�1鍙堜笉鏄涓�鍧楁潵鐨� 鏂板紑涓�鏍�
             storageCage = hollowBigStorageCageService.getOne(new LambdaQueryWrapper<HollowBigStorageCage>()
                     .eq(HollowBigStorageCage::getEnableState, Const.SLOT_ON).eq(HollowBigStorageCage::getRemainWidth, slotWidth)
                     .le(HollowBigStorageCage::getMinThickness, relationInfoOne.getThickness())
                     .ge(HollowBigStorageCage::getMaxThickness, relationInfoOne.getThickness())
                     .orderByAsc(HollowBigStorageCage::getMaxThickness).last("limit 1"));
         } else {
+            //鑾峰彇璇︽儏琛ㄧ粍鍐呭墠涓�鐗囩幓鐠冪殑绗煎唴璇︽儏鏁版嵁
             HollowBigStorageCageDetails beforeGlass = hollowBigStorageCageDetailsService.getOne(new LambdaQueryWrapper<HollowBigStorageCageDetails>()
                     .in(HollowBigStorageCageDetails::getState, Const.GLASS_STATE_IN_ALL_ZERO)
                     .eq(HollowBigStorageCageDetails::getEngineerId, relationInfoBefore.getEngineerId())
                     .eq(HollowBigStorageCageDetails::getTemperingLayoutId, relationInfoBefore.getTemperingLayoutId())
                     .eq(HollowBigStorageCageDetails::getTemperingFeedSequence, relationInfoBefore.getTemperingFeedSequence())
             );
+            //鏀圭粍鍦ㄧ鍐呮湁鐜荤拑浣嗘槸鍓嶄竴鍧楃幓鐠冩病鏈夛細鍘熷洜 鐜荤拑鐮存崯澶勭悊
             if (null == beforeGlass) {
                 storageCage = hollowBigStorageCageService.getOne(new LambdaQueryWrapper<HollowBigStorageCage>()
                         .eq(HollowBigStorageCage::getEnableState, Const.SLOT_ON).eq(HollowBigStorageCage::getRemainWidth, slotWidth)
@@ -126,8 +135,23 @@
                         .ge(HollowBigStorageCage::getMaxThickness, relationInfoOne.getThickness())
                         .orderByAsc(HollowBigStorageCage::getMaxThickness).last("limit 1"));
             } else {
-                storageCage = hollowBigStorageCageService.getOne(new LambdaQueryWrapper<HollowBigStorageCage>()
-                        .eq(HollowBigStorageCage::getEnableState, Const.SLOT_ON).eq(HollowBigStorageCage::getSlot, beforeGlass.getSlot()));
+                //鍙栧嚭姣忕粍鐜荤拑鍗犵敤绗煎瓙鐨勬牸瀛愬苟璁$畻鏍煎瓙鍐呯殑鏈�澶х粍搴忓彿,閬垮厤鐜荤拑椤哄簭閿欎贡
+                List<HollowBigStorageCageDetails> hollowSequenceList = hollowBigStorageCageDetailsService
+                        .querySlotMaxSequence(beforeGlass.getFlowCardId(), beforeGlass.getTotalLayer(), beforeGlass.getLayer(), beforeGlass.getVirtualSlot());
+                for (HollowBigStorageCageDetails hollowBigStorageCageDetail : hollowSequenceList) {
+                    if (relationInfoOne.getSlotSequence() - 1 == hollowBigStorageCageDetail.getSequence()) {
+                        storageCage = hollowBigStorageCageService.getOne(new LambdaQueryWrapper<HollowBigStorageCage>()
+                                .eq(HollowBigStorageCage::getEnableState, Const.SLOT_ON).eq(HollowBigStorageCage::getSlot, beforeGlass.getSlot()));
+                        break;
+                    }
+                }
+                if (storageCage == null) {
+                    storageCage = hollowBigStorageCageService.getOne(new LambdaQueryWrapper<HollowBigStorageCage>()
+                            .eq(HollowBigStorageCage::getEnableState, Const.SLOT_ON).eq(HollowBigStorageCage::getRemainWidth, slotWidth)
+                            .le(HollowBigStorageCage::getMinThickness, relationInfoOne.getThickness())
+                            .ge(HollowBigStorageCage::getMaxThickness, relationInfoOne.getThickness())
+                            .orderByAsc(HollowBigStorageCage::getMaxThickness).last("limit 1"));
+                }
             }
         }
         Assert.isTrue(null != storageCage, "娌℃湁绌轰綑鐨勭瀛愬瓨鏀剧幓鐠�");
@@ -238,9 +262,12 @@
     }
 
     @Override
-    public Map<String, List<FlowCardGlassInfoDTO>> queryHollowAllFlowCard() {
+    public Map<String, List<FlowCardGlassInfoDTO>> queryHollowAllFlowCard(HollowBigStorageDetailsQueryVO query) {
         List<HollowBigStorageCageDetails> detailsList = hollowBigStorageCageDetailsService.list(new LambdaQueryWrapper<HollowBigStorageCageDetails>()
-                .eq(HollowBigStorageCageDetails::getState, Const.GLASS_STATE_IN));
+                .eq(HollowBigStorageCageDetails::getState, Const.GLASS_STATE_IN)
+                .like(StringUtils.isNotBlank(query.getFilmsId()), HollowBigStorageCageDetails::getFilmsId, query.getFilmsId())
+                .like(StringUtils.isNotBlank(query.getFlowCardId()), HollowBigStorageCageDetails::getFlowCardId, query.getFlowCardId())
+        );
         if (CollectionUtil.isEmpty(detailsList)) {
             log.info("绗煎唴鏃犵幓鐠�");
             return new HashMap<>();
@@ -254,17 +281,17 @@
         return dtos.stream().collect(Collectors.groupingBy(FlowCardGlassInfoDTO::getFlowCardId));
     }
 
-    //    @Override
-//    public Map<Integer, List<LackDetailsDTO>>  queryLackByFlowCard(String flowCardId) {
-//        List<LackDetailsDTO> lackDetailsList = this.baseMapper.queryLackByFlowCard(flowCardId);
-//        Map<Integer, List<LackDetailsDTO>> listMap = lackDetailsList.stream().collect(Collectors.groupingBy(LackDetailsDTO::getLayer));
-//        return listMap;
-//    }
     @Override
-    public List<LackDetailsDTO> queryLackByFlowCard(String flowCardId) {
+    public Map<Integer, List<LackDetailsDTO>> queryLackByFlowCard(String flowCardId) {
         List<LackDetailsDTO> lackDetailsList = this.baseMapper.queryLackByFlowCard(flowCardId);
-        return lackDetailsList;
+        Map<Integer, List<LackDetailsDTO>> listMap = lackDetailsList.stream().collect(Collectors.groupingBy(LackDetailsDTO::getLayer));
+        return listMap;
     }
+//    @Override
+//    public List<LackDetailsDTO> queryLackByFlowCard(String flowCardId) {
+//        List<LackDetailsDTO> lackDetailsList = this.baseMapper.queryLackByFlowCard(flowCardId);
+//        return lackDetailsList;
+//    }
 
 }
 

--
Gitblit v1.8.0