From 1577c2e2874c1fad9ac684356bf0e568c3015045 Mon Sep 17 00:00:00 2001 From: zhoushihao <zsh19950802@163.com> Date: 星期三, 27 十一月 2024 09:46:15 +0800 Subject: [PATCH] 1、大理片笼新增进笼规则,计算本工程下所有玻璃的虚拟格子信息,按照虚拟格子,匹配笼内的实际格子,进笼之后查看格子是否有到齐的,执行调度任务 2、卧理修改任务执行顺序,移除捕获异常操作 3、不覆盖原有逻辑,新增opc任务,避免任务重复执行报错 --- hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/job/OpcPlcStorageCageHollowTask.java | 81 ++++++++++++++-------------------------- 1 files changed, 29 insertions(+), 52 deletions(-) diff --git a/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/job/OpcPlcStorageCageHollowTask.java b/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/job/OpcPlcStorageCageHollowTask.java index dcb12b5..2ef87db 100644 --- a/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/job/OpcPlcStorageCageHollowTask.java +++ b/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/job/OpcPlcStorageCageHollowTask.java @@ -4,18 +4,17 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; -import com.github.yulichang.toolkit.JoinWrappers; -import com.github.yulichang.wrapper.MPJLambdaWrapper; import com.kangaroohy.milo.model.ReadWriteEntity; import com.kangaroohy.milo.service.MiloService; import com.mes.base.entity.BigStorageCageBaseInfo; import com.mes.bigstorage.entity.BigStorageCage; import com.mes.bigstorage.entity.BigStorageCageDetails; -import com.mes.bigstorage.entity.BigStorageDTO; +import com.mes.bigstorage.entity.dto.BigStorageDTO; import com.mes.bigstorage.entity.dto.SlotSequenceDTO; import com.mes.bigstorage.entity.dto.TemperingLayoutDTO; import com.mes.bigstorage.service.BigStorageCageDetailsService; import com.mes.bigstorage.service.BigStorageCageService; +import com.mes.bigstorage.service.BigStorageGlassInfoService; import com.mes.bigstoragecagetask.entity.BigStorageCageHistoryTask; import com.mes.bigstoragecagetask.entity.BigStorageCageTask; import com.mes.bigstoragecagetask.service.BigStorageCageHistoryTaskService; @@ -26,10 +25,9 @@ import com.mes.damage.service.DamageService; import com.mes.glassinfo.entity.GlassInfo; import com.mes.glassinfo.service.GlassInfoService; +import com.mes.hollow.service.BigStorageCageHollowDetailsService; import com.mes.hollow.service.BigStorageCageHollowService; -import com.mes.temperingglass.entity.TemperingGlass; -import com.mes.temperingglass.entity.TemperingGlassInfo; -import com.mes.temperingglass.service.TemperingGlassService; +import com.mes.hollow.service.HollowGlassInfoService; import com.mes.utils.RedisUtil; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang.StringUtils; @@ -53,8 +51,8 @@ @Resource private BigStorageCageHollowDetailsService bigStorageCageHollowDetailsService; - @Resource - private TemperingGlassService temperingGlassService; + // @Resource +// private TemperingGlassService temperingGlassService; @Resource private DamageService damageService; @Resource @@ -65,6 +63,8 @@ private BigStorageCageHollowService bigStorageCageHollowService; @Resource private BigStorageCageHistoryTaskService bigStorageCageHistoryTaskService; + @Resource + private BigStorageGlassInfoService bigStorageGlassInfoService; @Resource private BigStorageCageTaskService bigStorageCageTaskService; @Autowired(required = false) @@ -87,6 +87,18 @@ @Value("${mes.sequence.order}") private boolean sequenceOrder; + @Resource + HollowGlassInfoService hollowGlassInfoService; + + // @Scheduled(fixedDelay = 1000) + public void test() { + hollowGlassInfoService.queryHollowTargetSlot("P24111201|2|20"); + } + + // @Scheduled(fixedDelay = 1000) + public void test1() { + bigStorageGlassInfoService.queryBigStorageTargetSlot("P24111201|2|20"); + } public void inBigStorageTask() throws Exception { ReadWriteEntity inkageEntity = miloService.readFromOpcUa("DLP2A.DLP2A.mesControl"); @@ -109,6 +121,9 @@ if (CollectionUtils.isEmpty(inTaskList)) { log.info("褰撳墠澶ц溅鏃犺繘鐗囩幓鐠冿紝缁撴潫杩涚墖浠诲姟"); } + //todo:鍘讳腑绌洪槦鍒楄〃涓煡璇㈢幓鐠冧俊鎭槸鍚﹀瓨鍦� + GlassInfo glassInfo = glassInfoService.getOne(new LambdaQueryWrapper<GlassInfo>().eq(GlassInfo::getGlassId, inTaskList.get(0).getGlassId())); + //todo: List<String> glassIdList = inTaskList.stream().map(BigStorageCageTask::getGlassId).collect(Collectors.toList()); log.info("鑾峰彇浠诲姟鐨勭幓鐠僫d锛歿}", glassIdList); List<GlassInfo> glassInfoList = glassInfoService.list(new LambdaQueryWrapper<GlassInfo>().in(GlassInfo::getGlassId, glassIdList)); @@ -151,7 +166,7 @@ miloService.writeToOpcWord(generateReadWriteEntity("DLP2A.DLP2A.MesReply", 1)); } - //@Scheduled(fixedDelay = 1000) + // @Scheduled(fixedDelay = 1000) public void outBigStorageTask() throws Exception { Date startDate = new Date(); ReadWriteEntity inkageEntity = miloService.readFromOpcUa("DLP2B.DLP2B.mesControl"); @@ -172,49 +187,9 @@ } //todo:鏄惁鍏佽閽㈠寲 if (redisUtil.getCacheObject("temperingSwitch")) { - //鏄惁鏈夋鍦ㄩ挗鍖栫殑鐜荤拑:閽㈠寲灏忕墖琛ㄥ叧鑱斿巻鍙蹭换鍔¤〃锛岀瓫閫夋湭鍑虹鐨勭幓鐠冧俊鎭� - List<TemperingGlass> temperingGlassList = temperingGlassService.selectJoinList(TemperingGlass.class, new MPJLambdaWrapper<TemperingGlass>() - .selectAll(TemperingGlass.class) - .leftJoin(BigStorageCageHistoryTask.class, BigStorageCageHistoryTask::getGlassId, TemperingGlass::getGlassId) - .eq(TemperingGlass::getState, Const.TEMPERING_NEW) - .eq(BigStorageCageHistoryTask::getTaskType, Const.BIG_STORAGE_BEFORE_OUT) - .isNull(BigStorageCageHistoryTask::getGlassId) - .orderBy(Boolean.TRUE, sequenceOrder, TemperingGlass::getTemperingFeedSequence)); - //todo:鍘嗗彶浠诲姟琛� - if (CollectionUtils.isNotEmpty(temperingGlassList)) { - log.info("鏈夋鍦ㄥ嚭鐗囩殑閽㈠寲浠诲姟"); - computeOutGlassInfo(temperingGlassList, "big_storage_cage_out_two_task", Const.TEMPERING_OUT_TARGET_POSITION, Const.GLASS_STATE_OUT_ING, Const.BIG_STORAGE_BEFORE_OUT); - Date endDate = new Date(); - log.info("澶х悊鐗囩鍑虹墖浠诲姟缁撴潫鏃堕棿锛歿}锛屽叡鑰楁椂锛歿}ms,缁撴潫鎵爜浠诲姟", endDate, endDate.getTime() - startDate.getTime()); - return; - } - //閽㈠寲浼樺厛锛氳幏鍙栫悊鐗囩 鐜荤拑灏忕墖 鐮存崯琛� 鏁伴噺 鍒ゆ柇绗煎唴鐗堝浘鏄惁鍒伴綈 - List<TemperingLayoutDTO> temperingLayoutDTOList = bigStorageCageDetailsService.temperingIsAll(); - if (CollectionUtils.isNotEmpty(temperingLayoutDTOList)) { - //鐜荤拑鍒伴綈鍖呮嫭宸插嚭鐗囩殑 - //鍒伴綈锛屽皢鐜荤拑灏忕墖鏁版嵁瀛樺叆閽㈠寲灏忕墖琛紝閫昏緫鐢熸垚鍑虹墖浠诲姟 缁撴潫 - for (TemperingLayoutDTO item : temperingLayoutDTOList) { -// if (item.getEngineerId().equals(redisUtil.getCacheObject("temperingengineerId"))) { - List<TemperingGlass> temperingGlassInfos = glassInfoService.selectJoinList(TemperingGlass.class, JoinWrappers.lambda(GlassInfo.class) - .selectAll(GlassInfo.class) - .select("-1 as state") - .selectAs(BigStorageCageDetails::getSlot, TemperingGlassInfo::getSlot) - .innerJoin(BigStorageCageDetails.class, BigStorageCageDetails::getGlassId, GlassInfo::getGlassId) - .eq(BigStorageCageDetails::getState, Const.GLASS_STATE_IN) - .eq(GlassInfo::getTemperingLayoutId, item.getTemperingLayoutId()) - .eq(GlassInfo::getEngineerId, item.getEngineerId()) - .orderBy(Boolean.TRUE, sequenceOrder, GlassInfo::getTemperingFeedSequence)); - if (CollectionUtils.isNotEmpty(temperingGlassInfos)) { - temperingGlassService.saveBatch(temperingGlassInfos); - computeOutGlassInfo(temperingGlassInfos, "big_storage_cage_out_two_task", Const.TEMPERING_OUT_TARGET_POSITION, Const.GLASS_STATE_OUT_ING, Const.BIG_STORAGE_BEFORE_OUT); - Date endDate = new Date(); - log.info("澶х悊鐗囩鍑虹墖浠诲姟缁撴潫鏃堕棿锛歿}锛屽叡鑰楁椂锛歿}ms,缁撴潫鎵爜浠诲姟", endDate, endDate.getTime() - startDate.getTime()); - return; - } -// } - } - } + } + //鏄惁鏈変汉宸ヤ笅鐗囦换鍔� 鏈夌洿鎺ュ嚭 List<BigStorageCageDetails> artificialList = bigStorageCageDetailsService.list(new LambdaQueryWrapper<BigStorageCageDetails>() .eq(BigStorageCageDetails::getState, Const.GLASS_STATE_ARTIFICIAL) @@ -226,6 +201,7 @@ log.info("澶х悊鐗囩鍑虹墖浠诲姟缁撴潫鏃堕棿锛歿}锛屽叡鑰楁椂锛歿}ms,缁撴潫鎵爜浠诲姟", endDate, endDate.getTime() - startDate.getTime()); return; } + //鏄惁瀛樺湪闇�瑕佸唴閮ㄨ皟搴︾殑鏍煎瓙:鎵ц鍐呴儴璋冨害浠诲姟 List<TemperingLayoutDTO> temperingOccupySlotList = bigStorageCageDetailsService.queryTemperingOccupySlot(); if (CollectionUtils.isNotEmpty(temperingOccupySlotList)) { @@ -252,6 +228,7 @@ } } } + Date endDate = new Date(); log.info("澶х悊鐗囩鍑虹墖浠诲姟缁撴潫鏃堕棿锛歿}锛屽叡鑰楁椂锛歿}ms,缁撴潫鎵爜浠诲姟", endDate, endDate.getTime() - startDate.getTime()); return; @@ -315,7 +292,7 @@ miloService.writeToOpcWord(generateReadWriteEntity("DLP2A.DLP2A.MesReply", 0)); } - //@Scheduled(fixedDelay = 1000) + // @Scheduled(fixedDelay = 1000) public void finishOutBigStorageTask() throws Exception { ReadWriteEntity inkageEntity = miloService.readFromOpcUa("DLP2B.DLP2B.mesControl"); if (true != Boolean.parseBoolean(inkageEntity.getValue() + "")) { -- Gitblit v1.8.0