ZengTao
2025-03-07 df13b23a2fa3519e6f796ed946d87412a6a5f7ca
hangzhoumesParent/moduleService/hollowGlassModule/src/main/java/com/mes/hollow/service/impl/HollowGlassRelationInfoServiceImpl.java
@@ -10,6 +10,7 @@
import com.mes.glassinfo.service.GlassInfoService;
import com.mes.hollow.entity.HollowBigStorageCage;
import com.mes.hollow.entity.HollowBigStorageCageDetails;
import com.mes.hollow.entity.HollowGlassOutRelationInfo;
import com.mes.hollow.entity.HollowGlassRelationInfo;
import com.mes.hollow.entity.dto.FlowCardGlassInfoDTO;
import com.mes.hollow.entity.dto.HollowBigStorageDTO;
@@ -19,6 +20,7 @@
import com.mes.hollow.mapper.HollowGlassRelationInfoMapper;
import com.mes.hollow.service.HollowBigStorageCageDetailsService;
import com.mes.hollow.service.HollowBigStorageCageService;
import com.mes.hollow.service.HollowGlassOutRelationInfoService;
import com.mes.hollow.service.HollowGlassRelationInfoService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
@@ -49,6 +51,8 @@
    @Resource
    HollowGlassRelationInfoService hollowGlassRelationInfoService;
    @Resource
    HollowGlassOutRelationInfoService hollowGlassOutRelationInfoService;
    @Resource
    HollowBigStorageCageDetailsService hollowBigStorageCageDetailsService;
    @Value("${mes.slotWidth}")
    private Integer slotWidth;
@@ -72,9 +76,18 @@
                .last("limit 1")
        );
        if (relationInfoOne == null) {
            //查看mes是否有对应的流程卡信息
            int count = hollowGlassRelationInfoService.count(new LambdaQueryWrapper<HollowGlassRelationInfo>()
                    .eq(HollowGlassRelationInfo::getFlowCardId, flowCardId)
                    .eq(HollowGlassRelationInfo::getLayer, layer));
            if (count == 0) {
                generateHollowGlassInfo(flowCardId, totalLayer, layer);
            } else {
                //比较关系表及中空理片笼详情表的流程卡数据,处理脏数据:将不在笼内的流程卡匹配数据职位空
                this.baseMapper.clearDirtyFlowCardData(flowCardId, layer);
            }
            //理片笼关系表中没有对应的数据,查看理片笼虚拟位置表是否有本工程下的所有玻璃虚拟信息
            //虚拟位置表没有本工程下的所有玻璃虚拟信息,按照玻璃id生成本工程下所有玻璃的虚拟信息
            generateHollowGlassInfo(flowCardId, totalLayer, layer);
            relationInfoOne = this.getOne(new LambdaQueryWrapper<HollowGlassRelationInfo>()
                    .eq(HollowGlassRelationInfo::getFlowCardId, flowCardId)
                    .eq(HollowGlassRelationInfo::getWidth, width)
@@ -87,13 +100,27 @@
            );
        }
        //详情表内获取本组是否已经有玻璃在笼子内(0表示提前占用)
        int taskCount = hollowGlassOutRelationInfoService.count(new LambdaQueryWrapper<HollowGlassOutRelationInfo>()
                .eq(HollowGlassOutRelationInfo::getFlowCardId, flowCardId));
        HollowBigStorageCage storageCage = null;
        //如果不存在则选择笼内未用的新格子
        if (taskCount > 0) {
            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"));
            HollowBigStorageDTO storageDTO = new HollowBigStorageDTO();
            BeanUtils.copyProperties(storageCage, storageDTO);
            BeanUtils.copyProperties(relationInfoOne, storageDTO);
            return storageDTO;
        }       //详情表内获取本组是否已经有玻璃在笼子内(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));
        HollowBigStorageCage storageCage = null;
        //如果不存在则选择笼内未用的新格子
        if (CollectionUtil.isEmpty(hollowDetailsList)) {
            storageCage = hollowBigStorageCageService.getOne(new LambdaQueryWrapper<HollowBigStorageCage>()