wu
2024-12-23 b9b44b51b201e2f5a9a1f3665c7fb76b5690f9af
hangzhoumesParent/moduleService/howllowGlassModule/src/main/java/com/mes/hollow/service/impl/HollowGlassRelationInfoServiceImpl.java
@@ -63,9 +63,9 @@
                .eq(HollowGlassRelationInfo::getFlowCardId, flowCardId)
                .eq(HollowGlassRelationInfo::getWidth, width)
                .eq(HollowGlassRelationInfo::getHeight, height)
                .eq(HollowGlassRelationInfo::getTotalLayer, totalLayer)
                .eq(HollowGlassRelationInfo::getLayer, layer)
                .isNull(HollowGlassRelationInfo::getTemperingLayoutId)
                .isNull(HollowGlassRelationInfo::getTemperingFeedSequence)
                .eq(HollowGlassRelationInfo::getState, Const.HOLLOW_RELATION_NEW)
                .orderByAsc(HollowGlassRelationInfo::getHollowSequence)
                .last("limit 1")
        );
@@ -77,34 +77,45 @@
                    .eq(HollowGlassRelationInfo::getFlowCardId, flowCardId)
                    .eq(HollowGlassRelationInfo::getWidth, width)
                    .eq(HollowGlassRelationInfo::getHeight, height)
                    .eq(HollowGlassRelationInfo::getTotalLayer, totalLayer)
                    .eq(HollowGlassRelationInfo::getLayer, layer)
                    .isNull(HollowGlassRelationInfo::getTemperingLayoutId)
                    .isNull(HollowGlassRelationInfo::getTemperingFeedSequence)
                    .eq(HollowGlassRelationInfo::getState, Const.HOLLOW_RELATION_NEW)
                    .orderByAsc(HollowGlassRelationInfo::getHollowSequence)
                    .last("limit 1")
            );
        }
        HollowBigStorageCageDetails hollowDetails = hollowBigStorageCageDetailsService.getOne(new LambdaQueryWrapper<HollowBigStorageCageDetails>()
                .eq(HollowBigStorageCageDetails::getSlot, relationInfoOne.getVirtualSlot()).in(HollowBigStorageCageDetails::getState, Const.GLASS_STATE_IN_ALL_ZERO)
                .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"));
        HollowBigStorageCage storageCage = null;
        if (null == hollowDetails) {
            storageCage = hollowBigStorageCageService.getOne(new LambdaQueryWrapper<HollowBigStorageCage>()
                    .eq(HollowBigStorageCage::getEnableState, Const.SLOT_ON).eq(HollowBigStorageCage::getRemainWidth, slotWidth).last("limit 1"));
                    .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"));
            HollowBigStorageDTO storageDTO = new HollowBigStorageDTO();
            BeanUtils.copyProperties(storageCage, storageDTO);
            BeanUtils.copyProperties(relationInfoOne, storageDTO);
            return storageDTO;
        }
        HollowGlassRelationInfo relationInfoBefore = hollowGlassRelationInfoService.getOne(new LambdaQueryWrapper<HollowGlassRelationInfo>()
                .eq(HollowGlassRelationInfo::getEngineerId, relationInfoOne.getEngineerId())
                .eq(HollowGlassRelationInfo::getTemperingLayoutId, relationInfoOne.getTemperingLayoutId())
                .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).last("limit 1"));
                    .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)
@@ -114,7 +125,10 @@
            );
            if (null == beforeGlass) {
                storageCage = hollowBigStorageCageService.getOne(new LambdaQueryWrapper<HollowBigStorageCage>()
                        .eq(HollowBigStorageCage::getEnableState, Const.SLOT_ON).eq(HollowBigStorageCage::getRemainWidth, slotWidth).last("limit 1"));
                        .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 {
                storageCage = hollowBigStorageCageService.getOne(new LambdaQueryWrapper<HollowBigStorageCage>()
                        .eq(HollowBigStorageCage::getEnableState, Const.SLOT_ON).eq(HollowBigStorageCage::getSlot, beforeGlass.getSlot()));
@@ -200,6 +214,7 @@
                    hollow.setVirtualSlot(temp.get(0).getVirtualSlot());
                    hollow.setFilmsId(glassInfo.getFilmsid());
                    hollow.setThickness(glassInfo.getThickness());
                    hollow.setState(Const.HOLLOW_RELATION_NEW);
                    temp.add(hollow);
                    flag = true;
                    break;
@@ -214,6 +229,7 @@
                hollow.setVirtualSlot(slotNumber++);
                hollow.setFilmsId(glassInfo.getFilmsid());
                hollow.setThickness(glassInfo.getThickness());
                hollow.setState(Const.HOLLOW_RELATION_NEW);
                newList.add(hollow);
                tempHollowList.add(newList);
            }
@@ -243,16 +259,16 @@
    }
    @Override
    public List<LackDetailsDTO> queryLackByFlowCard(String flowCardId, int layer) {
        return this.baseMapper.queryLackByFlowCard(flowCardId, layer);
//        return this.list(new LambdaQueryWrapper<HollowGlassRelationInfo>()
//                .eq(HollowGlassRelationInfo::getFlowCardId,flowCardId)
//                .eq(HollowGlassRelationInfo::getLayer,layer)
//                .isNull(HollowGlassRelationInfo::getTemperingLayoutId)
//                .isNull(HollowGlassRelationInfo::getTemperingFeedSequence)
//        );
    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) {
//        List<LackDetailsDTO> lackDetailsList = this.baseMapper.queryLackByFlowCard(flowCardId);
//        return lackDetailsList;
//    }
}