zhoushihao
2024-07-03 22f5cee4b4f9a717df573456f3b149be697b17d1
hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/job/PlcStorageCageTask.java
@@ -81,7 +81,7 @@
    @Value("${mes.galssGap}")
    private Integer galssGap;
    //    @Scheduled(fixedDelay = 5000)
    @Scheduled(fixedDelay = 5000)
    public void plcToHomeEdgScan() {
        PlcParameterObject plcParameterObject = S7object.getinstance().PlcMesObject;
        String d01Id = plcParameterObject.getPlcParameter("D01ID").getValue();
@@ -224,14 +224,14 @@
                .orderBy(Boolean.TRUE, sequenceOrder, TemperingGlassInfo::getTemperingFeedSequence));
        if (CollectionUtils.isNotEmpty(temperingGlassInfoList)) {
            log.info("有正在出片的钢化任务");
            computeOutGlassInfo(temperingGlassInfoList);
            computeOutGlassInfo(temperingGlassInfoList, Boolean.TRUE);
            return;
        }
        //是否有人工下片任务   有直接出
        List<BigStorageCageDetails> artificialList = bigStorageCageDetailsService.list(new LambdaQueryWrapper<BigStorageCageDetails>()
                .eq(BigStorageCageDetails::getState, Const.GLASS_STATE_ARTIFICIAL).orderByDesc(BigStorageCageDetails::getWidth));
        if (CollectionUtils.isNotEmpty(artificialList)) {
            computeOutGlassInfo(temperingGlassInfoList);
            computeOutGlassInfo(temperingGlassInfoList, Boolean.FALSE);
            return;
        }
        //钢化优先:获取理片笼  玻璃小片  破损表 数量   判断笼内版图是否到齐
@@ -248,7 +248,7 @@
                    .eq(GlassInfo::getTemperingLayoutId, temperingLayoutDTO.getTemperingLayoutId())
                    .eq(GlassInfo::getEngineerId, temperingLayoutDTO.getEngineerId()));
            temperingGlassInfoService.saveBatch(temperingGlassInfos);
            computeOutGlassInfo(temperingGlassInfoList);
            computeOutGlassInfo(temperingGlassInfoList, Boolean.TRUE);
            return;
        }
        //未到齐 执行内部调度任务
@@ -401,7 +401,7 @@
            //2、获取目标格子信息
            BigStorageDTO bigStorageDTO = bigStorageCageDetailsService.queryTargetSlotByTempering(info);
            //3、更新大理片笼表剩余宽度
            bigStorageCageService.update(new LambdaUpdateWrapper<BigStorageCage>().set(BigStorageCage::getRemainWidth, bigStorageDTO.getWidth())
            bigStorageCageService.update(new LambdaUpdateWrapper<BigStorageCage>().set(BigStorageCage::getRemainWidth, bigStorageDTO.getWidth() - info.getWidth())
                    .eq(BigStorageCage::getSlot, bigStorageDTO.getSlot()));
            //4、更新进片任务表,目标格子及状态(状态改为2 电气扫到自行处理)  遇到问题:无法批量更新,批量更新无法走指定从库
            e.setTargetSlot(bigStorageDTO.getSlot());
@@ -430,7 +430,7 @@
        s7control.writeWord(outLine, (short) 1);
    }
    private <T extends BigStorageCageBaseInfo> Boolean computeOutGlassInfo(List<T> list) {
    private <T extends BigStorageCageBaseInfo> Boolean computeOutGlassInfo(List<T> list, Boolean isTempering) {
        //任务数据  获取车子存放玻璃最大数量  玻璃间隔
        List<BigStorageCageOutTask> bigStorageCageOutTaskList = new ArrayList<>();
        //打车剩余尺寸
@@ -440,8 +440,14 @@
                break;
            }
            remainWidth = remainWidth - (int) e.getWidth() - galssGap;
            bigStorageCageOutTaskList.add(new BigStorageCageOutTask(e.getGlassId(), e.getSlot(), Const.A09_OUT_TARGET_POSITION,
                    (int) e.getWidth(), 0, 0, 1));
            if (isTempering) {
                bigStorageCageOutTaskList.add(new BigStorageCageOutTask(e.getGlassId(), e.getSlot(), Const.TEMPERING_OUT_TARGET_POSITION,
                        (int) e.getWidth() * 10, 0, 0, 1));
            } else {
                bigStorageCageOutTaskList.add(new BigStorageCageOutTask(e.getGlassId(), e.getSlot(), Const.ARTIFICIAL_OUT_TARGET_POSITION,
                        (int) e.getWidth() * 10, 0, 0, 1));
            }
        }
        Assert.isFalse(CollectionUtils.isEmpty(bigStorageCageOutTaskList), "未获取出片数据,结束出片任务");
        log.info("获取出片任务数据{}条,执行保存", bigStorageCageOutTaskList.size());