wangfei
2025-04-21 09402133807b1e774e658a13ad365b2e6efca25b
hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/job/OpcPlcStorageCageNewTask.java
@@ -24,12 +24,14 @@
import com.mes.bigstoragecagetask.service.BigStorageCageTaskService;
import com.mes.bigstoragetask.entity.UpdateBigStorageCageDTO;
import com.mes.common.config.Const;
import com.mes.common.config.ConstSysConfig;
import com.mes.damage.entity.Damage;
import com.mes.damage.service.DamageService;
import com.mes.edgglasstask.entity.EdgGlassTaskInfo;
import com.mes.edgglasstask.service.EdgGlassTaskInfoService;
import com.mes.glassinfo.entity.GlassInfo;
import com.mes.glassinfo.service.GlassInfoService;
import com.mes.sysconfig.service.SysConfigService;
import com.mes.temperingglass.entity.TemperingGlassInfo;
import com.mes.temperingglass.service.TemperingGlassInfoService;
import com.mes.utils.RedisUtil;
@@ -37,7 +39,6 @@
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
@@ -75,6 +76,9 @@
    @Autowired(required = false)
    MiloService miloService;
    @Resource
    SysConfigService sysConfigService;
    /**
     * 直通格子
     */
@@ -82,27 +86,6 @@
    @Resource
    private RedisUtil redisUtil;
    @Value("${mes.slotWidth}")
    private Integer slotWidth;
    @Value("${mes.glassGap}")
    private Integer glassGap;
    @Value("${mes.carWidth}")
    private Integer carWidth;
    @Value("${mes.outCarMaxSize}")
    private Integer outCarMaxSize;
    @Value("${mes.temperingOutTargetPosition}")
    private Integer temperingOutTargetPosition;
    @Value("${mes.artificialOutTargetPosition}")
    private Integer artificialOutTargetPosition;
    @Value("${mes.slotMaxHeight}")
    private Integer slotMaxHeight;
    @Value("${mes.slotMaxthickness}")
    private Integer slotMaxthickness;
    @Scheduled(fixedDelay = 1000)
    public void inBigStorageTask() throws Exception {
@@ -173,6 +156,10 @@
            miloService.writeToOpcWord(generateReadWriteEntity("DLP1A.DLP1A.alarmSignal", 8));
            return;
        }
        Integer glassGap = sysConfigService.queryConfigValue(ConstSysConfig.VERTICAL_GLASS_GAP);
        Integer slotMaxthickness = sysConfigService.queryConfigValue(ConstSysConfig.VERTICAL_SLOT_MAX_THICKNESS);
        Integer slotWidth = sysConfigService.queryConfigValue(ConstSysConfig.VERTICAL_SLOT_WIDTH);
        Integer slotMaxHeight = sysConfigService.queryConfigValue(ConstSysConfig.VERTICAL_SLOT_MAX_HEIGHT);
        //按照玻璃厚度分组,判断剩余格子是否可以存放
        Map<Double, Long> thickCountMap = glassInfoList.stream().collect(Collectors.groupingBy(GlassInfo::getThickness, Collectors.counting()));
        if (glassInfoList.get(0).getThickness() < slotMaxthickness) {
@@ -303,6 +290,8 @@
        //是否允许钢化
        //是否有正在钢化的玻璃:钢化小片表关联历史任务表,筛选未出笼的玻璃信息
//            获取当前钢化任务未完成出片的玻璃信息
        Integer temperingOutTargetPosition = sysConfigService.queryConfigValue(ConstSysConfig.VERTICAL_TEMPERING_OUT_TARGET_POSITION);
        List<TemperingGlassInfo> unFinishTemperingGlassInfoList = temperingGlassInfoService.list(new LambdaQueryWrapper<TemperingGlassInfo>()
                .eq(TemperingGlassInfo::getState, Const.TEMPERING_NEW).orderByAsc(TemperingGlassInfo::getTemperingLayoutId).orderByAsc(TemperingGlassInfo::getTemperingFeedSequence));
        if (CollectionUtil.isNotEmpty(unFinishTemperingGlassInfoList)) {
@@ -354,6 +343,8 @@
            }
        }
        //是否有人工下片任务   有直接出
        Integer artificialOutTargetPosition = sysConfigService.queryConfigValue(ConstSysConfig.VERTICAL_ARTIFICIAL_OUT_TARGET_POSITION);
        Integer outCarMaxSize = sysConfigService.queryConfigValue(ConstSysConfig.VERTICAL_OUT_CAR_SIZE);
        List<BigStorageCageDetails> artificialList = bigStorageCageDetailsService.list(new LambdaQueryWrapper<BigStorageCageDetails>()
                .eq(BigStorageCageDetails::getState, Const.GLASS_STATE_ARTIFICIAL)
                .orderByAsc(BigStorageCageDetails::getSlot)
@@ -761,7 +752,9 @@
        //任务数据:获取车子存放玻璃最大数量,玻璃间隔
        List<BigStorageCageTask> bigStorageCageTaskList = new ArrayList<>();
        //打车剩余尺寸
        Integer remainWidth = carWidth;
        Integer outCarMaxSize = sysConfigService.queryConfigValue(ConstSysConfig.VERTICAL_OUT_CAR_SIZE);
        Integer glassGap = sysConfigService.queryConfigValue(ConstSysConfig.VERTICAL_GLASS_GAP);
        Integer remainWidth = sysConfigService.queryConfigValue(ConstSysConfig.VERTICAL_CAR_WIDTH);
        for (T e : list) {
            if (bigStorageCageTaskList.size() >= outCarMaxSize || Math.max((int) e.getWidth(), (int) e.getHeight()) > remainWidth) {
                break;
@@ -811,6 +804,8 @@
        List<BigStorageCageDetails> inSlotGlassList = bigStorageCageDetailsService.list(new LambdaQueryWrapper<BigStorageCageDetails>()
                .in(BigStorageCageDetails::getSlot, slotList).in(BigStorageCageDetails::getState, Const.GLASS_STATE_IN_ALL));
        Map<Integer, Double> slotRemainMap = new HashMap<>();
        Integer glassGap = sysConfigService.queryConfigValue(ConstSysConfig.VERTICAL_GLASS_GAP);
        Integer slotWidth = sysConfigService.queryConfigValue(ConstSysConfig.VERTICAL_SLOT_WIDTH);
        //是否存在有格子非空的玻璃
        if (CollectionUtil.isNotEmpty(inSlotGlassList)) {
            //存在  将格子内的玻璃分别进行更新