zhoushihao
2025-11-06 b21caa5499c50384f3a3a5dd795a7a0ad197d36f
hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/bigstorage/service/impl/BigStorageGlassInfoServiceImpl.java
@@ -4,6 +4,8 @@
import cn.hutool.core.lang.Assert;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.mes.alarm.entity.ProductAlarmInfo;
import com.mes.alarm.service.ProductAlarmInfoService;
import com.mes.bigstorage.entity.BigStorageCage;
import com.mes.bigstorage.entity.BigStorageCageDetails;
import com.mes.bigstorage.entity.BigStorageGlassInfo;
@@ -48,6 +50,15 @@
    BigStorageGlassRelationInfoService bigStorageGlassRelationInfoService;
    @Resource
    SysConfigService sysConfigService;
    @Resource
    private ProductAlarmInfoService productAlarmInfoService;
    private static final String ALARM_MODULE = "钢化";
    private static final String ALARM_TYPE = "钢化大理片";
    private static final String ALARM_CODE_SIZE = "sizeSame";
    private static final String ALARM_CODE_ID = "idSame";
    private static final String ALARM_CODE_SLOT = "slotLess";
    private static final String ALARM_CODE_OVER = "overSize";
//    @Value("${mes.slotWidth}")
//    private Integer slotWidth;
//    @Value("${mes.glassGap}")
@@ -118,6 +129,15 @@
            } else {
                BigStorageCage bigStorageCage = bigStorageCageService.getOne(new LambdaQueryWrapper<BigStorageCage>()
                        .eq(BigStorageCage::getEnableState, Const.SLOT_ON).eq(BigStorageCage::getSlot, beforeGlass.getSlot()));
                if (bigStorageCage == null) {
                    ProductAlarmInfo alarmInfo = new ProductAlarmInfo();
                    alarmInfo.setState(Const.LOAD_RAW_GLASS_NEW);
                    alarmInfo.setAlarmModule(ALARM_MODULE);
                    alarmInfo.setAlarmType(ALARM_TYPE);
                    alarmInfo.setAlarmCode(ALARM_CODE_SLOT);
                    alarmInfo.setAlarmMessage("");
                    productAlarmInfoService.save(alarmInfo);
                }
                Assert.isTrue(null != bigStorageCage, "没有空余的笼子存放玻璃");
                storageCageDTO = new BigStorageDTO();
                storageCageDTO.setWidth(bigStorageCage.getRemainWidth());
@@ -136,10 +156,7 @@
            return;
        }
        Integer slotWidth = sysConfigService.queryConfigValue(ConstSysConfig.VERTICAL_SLOT_WIDTH);
//        Integer glassGap = sysConfigService.queryConfigValue(ConstSysConfig.VERTICAL_GLASS_GAP);
        Integer outCarMaxSize = sysConfigService.queryConfigValue(ConstSysConfig.VERTICAL_OUT_CAR_SIZE);
//        Engineering engineering = engineeringMapper.selectOne(new LambdaQueryWrapper<Engineering>()
//                .eq(Engineering::getEngineerId, glassInfo.getEngineerId()));
        //获取玻璃的工程id,按照工程id获取工程下的所有玻璃信息
        List<GlassInfo> glassInfoList = glassInfoService.list(new LambdaQueryWrapper<GlassInfo>()
                .eq(GlassInfo::getEngineerId, engineerId)
@@ -177,14 +194,10 @@
    @Override
    public int bigStorageSlotPair(BigStorageGlassInfo bigStorageGlassInfo) {
        //获取所有空闲可用的格子号
        Integer slotWidth = sysConfigService.queryConfigValue(ConstSysConfig.VERTICAL_SLOT_WIDTH);
        BigStorageCage storageCage = bigStorageCageService.getOne(new LambdaQueryWrapper<BigStorageCage>()
                .eq(BigStorageCage::getEnableState, Const.SLOT_ON).eq(BigStorageCage::getRemainWidth, slotWidth)
                .le(BigStorageCage::getMinThickness, bigStorageGlassInfo.getThickness())
                .ge(BigStorageCage::getMaxThickness, bigStorageGlassInfo.getThickness())
                .orderByAsc(BigStorageCage::getMaxThickness).orderByAsc(BigStorageCage::getSlot).last("limit 1"));
        Assert.isTrue(null != storageCage, "没有空余的笼子存放玻璃");
        Integer slot = storageCage.getSlot();
        BigStorageDTO bigStorageDTO = bigStorageCageDetailsService.queryTargetSlot(bigStorageGlassInfo.getEngineerId(),
                bigStorageGlassInfo.getGlassId(), bigStorageGlassInfo.getThickness().intValue());
        Assert.isTrue(null != bigStorageDTO, "没有空余的笼子存放玻璃");
        Integer slot = bigStorageDTO.getSlot();
        //获取该工程同一流程卡同一车的玻璃信息
        List<BigStorageGlassInfo> bigStorageGlassInfoList = this.list(new LambdaQueryWrapper<BigStorageGlassInfo>()
                .eq(BigStorageGlassInfo::getEngineerId, bigStorageGlassInfo.getEngineerId())
@@ -195,7 +208,7 @@
            BigStorageGlassRelationInfo info = new BigStorageGlassRelationInfo();
            BeanUtils.copyProperties(e, info);
            info.setSlot(slot);
            info.setDeviceId(storageCage.getDeviceId());
            info.setDeviceId(bigStorageDTO.getDeviceId());
            return info;
        }).collect(Collectors.toList());
        //保存关系表