hangzhoumesParent/common/servicebase/src/main/java/com/mes/sysconfig/service/SysConfigService.java
@@ -25,5 +25,7 @@ Boolean deleteConfig(Serializable id); String queryConfigValue(Serializable id); } hangzhoumesParent/common/servicebase/src/main/java/com/mes/sysconfig/service/impl/SysConfigServiceImpl.java
@@ -8,6 +8,7 @@ import com.mes.sysconfig.entity.request.SysConfigRequest; import com.mes.sysconfig.mapper.SysConfigMapper; import com.mes.sysconfig.service.SysConfigService; import lombok.extern.slf4j.Slf4j; import org.springframework.cache.annotation.CacheEvict; import org.springframework.cache.annotation.CachePut; import org.springframework.cache.annotation.Cacheable; @@ -22,6 +23,7 @@ * @since 2025-04-01 15:01:27 */ @Service @Slf4j public class SysConfigServiceImpl extends ServiceImpl<SysConfigMapper, SysConfig> implements SysConfigService { @Override @@ -61,5 +63,15 @@ public Boolean deleteConfig(Serializable id) { return this.removeById(id); } @Override public String queryConfigValue(Serializable id) { SysConfig sysConfig = this.queryConfigById(id); if (sysConfig == null) { log.info("系统配置查询为空,请检查该配置是否存在:{}", id); return null; } return sysConfig.getConfigValue(); } } hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/bigstorage/controller/BigStorageCageDetailsController.java
@@ -119,9 +119,9 @@ public Result<Boolean> cancelTemperingTask() { boolean result = bigStorageCageDetailsService.cancelTemperingTask(); if (result == true) { return Result.build(200, "指定钢化成功", result); return Result.build(200, "取消当前钢化成功", result); } else { return Result.build(200, "已存在钢化任务,请等待钢化完成再指定钢化", result); return Result.build(200, "取消当前钢化失败", result); } } hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/bigstorage/service/impl/BigStorageCageDetailsServiceImpl.java
@@ -15,6 +15,8 @@ import com.mes.bigstorage.mapper.BigStorageCageDetailsMapper; import com.mes.bigstorage.service.BigStorageCageDetailsService; import com.mes.bigstorage.service.BigStorageCageService; import com.mes.bigstoragecagetask.entity.BigStorageCageHistoryTask; import com.mes.bigstoragecagetask.service.BigStorageCageHistoryTaskService; import com.mes.bigstoragetask.entity.BigStorageCageFeedTask; import com.mes.bigstoragetask.entity.BigStorageCageOutTask; import com.mes.bigstoragetask.entity.UpdateBigStorageCageDTO; @@ -79,6 +81,9 @@ private DamageService damageService; @Resource private RedisUtil redisUtil; @Resource BigStorageCageHistoryTaskService bigStorageCageHistoryTaskService; @Value("${mes.minCount}") private int minCount; @@ -458,7 +463,26 @@ @Override public boolean cancelTemperingTask() { return false; //当前正在执行的出片任务 List<BigStorageCageHistoryTask> historyTaskList = bigStorageCageHistoryTaskService.list(new LambdaQueryWrapper<BigStorageCageHistoryTask>() .eq(BigStorageCageHistoryTask::getTaskState, Const.GLASS_STATE_NEW) .eq(BigStorageCageHistoryTask::getTargetSlot, Const.TEMPERING_OUT_TARGET_POSITION)); //不存在出片任务,直接删除钢化小片表未出片的任务 if (CollectionUtils.isEmpty(historyTaskList)) { temperingGlassInfoMapper.delete(new LambdaQueryWrapper<TemperingGlassInfo>().eq(TemperingGlassInfo::getState, Const.TEMPERING_NEW)); return Boolean.TRUE; } //存在出片任务,删除钢化小片表 List<String> glassIdList = historyTaskList.stream().map(BigStorageCageHistoryTask::getGlassId).collect(Collectors.toList()); GlassInfo glassInfo = glassInfoService.getOne(new LambdaQueryWrapper<GlassInfo>().in(GlassInfo::getGlassId, glassIdList) .orderByDesc(GlassInfo::getTemperingFeedSequence).last("limit 1")); temperingGlassInfoMapper.delete(new LambdaQueryWrapper<TemperingGlassInfo>() .eq(TemperingGlassInfo::getEngineerId, glassInfo.getEngineerId()) .eq(TemperingGlassInfo::getState, Const.TEMPERING_NEW) .ge(TemperingGlassInfo::getTemperingLayoutId, glassInfo.getTemperingLayoutId()) .gt(TemperingGlassInfo::getTemperingFeedSequence, glassInfo.getTemperingFeedSequence()) ); return Boolean.TRUE; } @Override hangzhoumesParent/moduleService/hollowGlassModule/src/main/java/com/mes/hollow/controller/HollowGlassRelationInfoController.java
@@ -1,8 +1,8 @@ package com.mes.hollow.controller; import com.mes.hollow.entity.dto.FlowCardGlassInfoDTO; import com.mes.hollow.entity.dto.LackDetailsDTO; import com.mes.hollow.entity.vo.HollowAllFlowCardVO; import com.mes.hollow.entity.vo.HollowBigStorageDetailsQueryVO; import com.mes.hollow.service.HollowGlassRelationInfoService; import com.mes.utils.Result; @@ -33,9 +33,9 @@ @ApiOperation("界面点击创建任务:查询中空所有流程卡对应的玻璃信息") @PostMapping("/queryHollowAllFlowCard") public Result<Map<String, List<FlowCardGlassInfoDTO>>> queryHollowAllFlowCard(@RequestBody HollowBigStorageDetailsQueryVO query) { Map<String, List<FlowCardGlassInfoDTO>> bigStorageCageDetails = hollowGlassRelationInfoService.queryHollowAllFlowCard(query); return Result.success(bigStorageCageDetails); public Result<List<HollowAllFlowCardVO>> queryHollowAllFlowCard(@RequestBody HollowBigStorageDetailsQueryVO query) { List<HollowAllFlowCardVO> hollowAllFlowCardVOList = hollowGlassRelationInfoService.queryHollowAllFlowCard(query); return Result.success(hollowAllFlowCardVOList); } @ApiOperation("查询指定流程卡及层数的缺片详情") hangzhoumesParent/moduleService/hollowGlassModule/src/main/java/com/mes/hollow/entity/vo/HollowAllFlowCardVO.java
New file @@ -0,0 +1,32 @@ package com.mes.hollow.entity.vo; import com.mes.hollow.entity.dto.FlowCardGlassInfoDTO; import lombok.Data; import java.util.List; /** * @Author : zhoush * @Date: 2025/4/9 16:26 * @Description: */ @Data public class HollowAllFlowCardVO { /** * 流程卡号 */ private String FlowCardId; /** * 产品名称 */ private String ProductName; /** * 是否直通 */ private Boolean isThroughSlot; /** * 流程卡数据 */ private List<FlowCardGlassInfoDTO> flowCardGlassInfoDTOList; } hangzhoumesParent/moduleService/hollowGlassModule/src/main/java/com/mes/hollow/service/HollowGlassRelationInfoService.java
@@ -5,6 +5,7 @@ import com.mes.hollow.entity.dto.FlowCardGlassInfoDTO; import com.mes.hollow.entity.dto.HollowBigStorageDTO; import com.mes.hollow.entity.dto.LackDetailsDTO; import com.mes.hollow.entity.vo.HollowAllFlowCardVO; import com.mes.hollow.entity.vo.HollowBigStorageDetailsQueryVO; import java.util.List; @@ -29,7 +30,7 @@ */ void generateHollowGlassInfo(String flowCardId, int totalLayer, int layer); Map<String, List<FlowCardGlassInfoDTO>> queryHollowAllFlowCard(HollowBigStorageDetailsQueryVO query); List<HollowAllFlowCardVO> queryHollowAllFlowCard(HollowBigStorageDetailsQueryVO query); List<FlowCardGlassInfoDTO> queryHollowAllFlowCardSummary(HollowBigStorageDetailsQueryVO query); hangzhoumesParent/moduleService/hollowGlassModule/src/main/java/com/mes/hollow/service/impl/HollowGlassRelationInfoServiceImpl.java
@@ -16,6 +16,7 @@ import com.mes.hollow.entity.dto.HollowBigStorageDTO; import com.mes.hollow.entity.dto.HollowGlassDetailsDTO; import com.mes.hollow.entity.dto.LackDetailsDTO; import com.mes.hollow.entity.vo.HollowAllFlowCardVO; import com.mes.hollow.entity.vo.HollowBigStorageDetailsQueryVO; import com.mes.hollow.mapper.HollowGlassRelationInfoMapper; import com.mes.hollow.service.HollowBigStorageCageDetailsService; @@ -28,7 +29,10 @@ import org.springframework.stereotype.Service; import javax.annotation.Resource; import java.util.*; import java.util.ArrayList; import java.util.Comparator; import java.util.List; import java.util.Map; import java.util.stream.Collectors; /** @@ -286,7 +290,7 @@ } @Override public Map<String, List<FlowCardGlassInfoDTO>> queryHollowAllFlowCard(HollowBigStorageDetailsQueryVO query) { public List<HollowAllFlowCardVO> queryHollowAllFlowCard(HollowBigStorageDetailsQueryVO query) { List<HollowBigStorageCageDetails> detailsList = hollowBigStorageCageDetailsService.list(new LambdaQueryWrapper<HollowBigStorageCageDetails>() .eq(HollowBigStorageCageDetails::getState, Const.GLASS_STATE_IN) .like(StringUtils.isNotBlank(query.getFilmsId()), HollowBigStorageCageDetails::getFilmsId, query.getFilmsId()) @@ -296,39 +300,29 @@ ); if (CollectionUtil.isEmpty(detailsList)) { log.info("笼内无玻璃"); return new HashMap<>(); return new ArrayList<>(); } Map<String, List<HollowBigStorageCageDetails>> listMap = detailsList.stream().collect(Collectors.groupingBy(HollowBigStorageCageDetails::getFlowCardId)); List<FlowCardGlassInfoDTO> dtos = new ArrayList<>(); List<HollowAllFlowCardVO> resultList = new ArrayList<>(); listMap.forEach((e, v) -> { HollowAllFlowCardVO hollowAllFlowCardVO = new HollowAllFlowCardVO(); HollowBigStorageCageDetails cageDetails = v.get(0); hollowAllFlowCardVO.setFlowCardId(e); if (cageDetails.getHollowSequence() == 0) { hollowAllFlowCardVO.setIsThroughSlot(Boolean.TRUE); } else { hollowAllFlowCardVO.setIsThroughSlot(Boolean.FALSE); } //按照流程卡获取对应的产品名称 String productName = baseMapper.queryProductNameByFlowCardId(cageDetails.getFlowCardId()); hollowAllFlowCardVO.setProductName(productName); List<FlowCardGlassInfoDTO> flowCardInfoList = hollowBigStorageCageDetailsService.hollowIsAll(e, cageDetails.getTotalLayer(), Boolean.FALSE); for (FlowCardGlassInfoDTO item : flowCardInfoList) { item.setProductName(productName); dtos.add(item); } hollowAllFlowCardVO.setFlowCardGlassInfoDTOList(flowCardInfoList); resultList.add(hollowAllFlowCardVO); }); Map<String, FlowCardGlassInfoDTO> result = dtos.stream() .collect(Collectors.toMap( FlowCardGlassInfoDTO::getFlowCardId, dto -> { FlowCardGlassInfoDTO newDto = new FlowCardGlassInfoDTO(); newDto.setFlowCardId(dto.getFlowCardId()); newDto.setSumCount(dto.getSumCount()); newDto.setPairCount(dto.getPairCount()); newDto.setRealCount(dto.getRealCount()); newDto.setLayer(dto.getLayer()); return newDto; }, (dto1, dto2) -> { dto1.setRealCount(dto1.getRealCount() + dto2.getRealCount()); // 累加 realCount dto1.setLayer(Math.max(dto1.getLayer(), dto2.getLayer())); // 累加 最大层数 return dto1; // 返回合并后的对象 } )); return dtos.stream().collect(Collectors.groupingBy(e -> e.getFlowCardId() + ":" + e.getProductName())); return resultList; // return dtos.stream().collect(Collectors.groupingBy(e -> e.getFlowCardId() + ":" + e.getProductName())); } @Override hangzhoumesParent/moduleService/hollowGlassModule/src/main/java/com/mes/job/OpcPlcStorageCageHollowTask.java
@@ -181,7 +181,7 @@ } } //超大尺寸 if (slotMaxHeight < Math.min(glassInfoList.get(0).getWidth(), glassInfoList.get(0).getHeight()) || glassInfoList.get(0).getThickness() > slotMaxthickness) { if (slotMaxHeight < Math.min(glassInfoList.get(0).getWidth(), glassInfoList.get(0).getHeight()) || glassInfoList.get(0).getThickness() >= slotMaxthickness) { int count = hollowBigStorageCageDetailsService.count(new LambdaQueryWrapper<HollowBigStorageCageDetails>() .eq(HollowBigStorageCageDetails::getSlot, THROUGH_SLOT) .in(HollowBigStorageCageDetails::getState, Const.GLASS_STATE_IN_ALL)); @@ -207,17 +207,51 @@ //计算目标格子 List<HollowBigStorageCageHistoryTask> historyTasks = new ArrayList<>(); try { for (BigStorageCageTask task : inTaskList) { GlassInfo info = glassListMap.get(task.getGlassId()).get(0); HollowBigStorageDTO bigStorageDTO = hollowGlassRelationInfoService.queryHollowTargetSlot(info.getFlowCardId(), info.getWidth(), info.getHeight(), info.getTotalLayer(), info.getLayer()); if (slotMaxHeight > Math.min(glassInfoList.get(0).getWidth(), glassInfoList.get(0).getHeight()) && glassInfoList.get(0).getThickness() < slotMaxthickness) { for (BigStorageCageTask task : inTaskList) { GlassInfo info = glassListMap.get(task.getGlassId()).get(0); HollowBigStorageDTO bigStorageDTO = hollowGlassRelationInfoService.queryHollowTargetSlot(info.getFlowCardId(), info.getWidth(), info.getHeight(), info.getTotalLayer(), info.getLayer()); // 临时更新格子的剩余尺寸:防止相邻玻璃进同一格子造成剩余尺寸不足,玻璃越界的情况,任务完成后再次更新大理片笼表剩余宽度(按照笼内玻璃数量更新大理片笼剩余尺寸) hollowBigStorageCageService.update(new LambdaUpdateWrapper<HollowBigStorageCage>() .set(HollowBigStorageCage::getRemainWidth, bigStorageDTO.getRemainWidth() - Math.max(info.getWidth(), info.getHeight()) - glassGap) .eq(HollowBigStorageCage::getSlot, bigStorageDTO.getSlot())); task.setTargetSlot(bigStorageDTO.getSlot()); task.setGlassId(info.getGlassId()); bigStorageCageTaskService.updateTaskMessage(BIG_STORAGE_CAGE_IN_TWO_TASK, task); hollowBigStorageCageService.update(new LambdaUpdateWrapper<HollowBigStorageCage>() .set(HollowBigStorageCage::getRemainWidth, bigStorageDTO.getRemainWidth() - Math.max(info.getWidth(), info.getHeight()) - glassGap) .eq(HollowBigStorageCage::getSlot, bigStorageDTO.getSlot())); task.setTargetSlot(bigStorageDTO.getSlot()); task.setGlassId(info.getGlassId()); bigStorageCageTaskService.updateTaskMessage(BIG_STORAGE_CAGE_IN_TWO_TASK, task); //存放历史任务 HollowBigStorageCageHistoryTask historyTask = new HollowBigStorageCageHistoryTask(); BeanUtils.copyProperties(task, historyTask); historyTask.setTaskType(Const.BIG_STORAGE_AFTER_IN); historyTask.setGlassCount(glassInfoList.size()); historyTask.setTaskState(Const.ENGINEERING_NEW); historyTasks.add(historyTask); //存放详情数据 HollowBigStorageCageDetails cageDetails = new HollowBigStorageCageDetails(); BeanUtils.copyProperties(bigStorageDTO, cageDetails); BeanUtils.copyProperties(info, cageDetails); cageDetails.setState(Const.GLASS_STATE_NEW); cageDetails.setSequence(bigStorageDTO.getSlotSequence()); cageDetails.setGap(glassGap); cageDetails.setId(null); hollowBigStorageCageDetailsService.save(cageDetails); hollowGlassRelationInfoService.update(new LambdaUpdateWrapper<HollowGlassRelationInfo>() .set(HollowGlassRelationInfo::getGlassId, cageDetails.getGlassId()) .set(HollowGlassRelationInfo::getTemperingLayoutId, cageDetails.getTemperingLayoutId()) .set(HollowGlassRelationInfo::getTemperingFeedSequence, cageDetails.getTemperingFeedSequence()) .set(HollowGlassRelationInfo::getEngineerId, cageDetails.getEngineerId()) .set(HollowGlassRelationInfo::getState, Const.HOLLOW_RELATION_OCCUPY) .eq(HollowGlassRelationInfo::getFlowCardId, bigStorageDTO.getFlowCardId()) .eq(HollowGlassRelationInfo::getLayer, bigStorageDTO.getLayer()) .eq(HollowGlassRelationInfo::getVirtualSlot, bigStorageDTO.getVirtualSlot()) .eq(HollowGlassRelationInfo::getSlotSequence, bigStorageDTO.getSlotSequence()) .eq(HollowGlassRelationInfo::getHollowSequence, bigStorageDTO.getHollowSequence()) ); } } else { BigStorageCageTask task = inTaskList.get(0); task.setTargetSlot(THROUGH_SLOT); bigStorageCageTaskService.updateTaskMessage("big_storage_cage_in_two_task", task); //存放历史任务 HollowBigStorageCageHistoryTask historyTask = new HollowBigStorageCageHistoryTask(); BeanUtils.copyProperties(task, historyTask); @@ -225,27 +259,18 @@ historyTask.setGlassCount(glassInfoList.size()); historyTask.setTaskState(Const.ENGINEERING_NEW); historyTasks.add(historyTask); //存放详情数据 GlassInfo info = glassInfoList.get(0); HollowBigStorageCageDetails cageDetails = new HollowBigStorageCageDetails(); BeanUtils.copyProperties(bigStorageDTO, cageDetails); BeanUtils.copyProperties(info, cageDetails); cageDetails.setSlot(THROUGH_SLOT); cageDetails.setState(Const.GLASS_STATE_NEW); cageDetails.setSequence(bigStorageDTO.getSlotSequence()); cageDetails.setDeviceId(0); cageDetails.setSequence(0); cageDetails.setHollowSequence(0); cageDetails.setGap(glassGap); cageDetails.setFilmsId(info.getFilmsid()); cageDetails.setId(null); hollowBigStorageCageDetailsService.save(cageDetails); hollowGlassRelationInfoService.update(new LambdaUpdateWrapper<HollowGlassRelationInfo>() .set(HollowGlassRelationInfo::getGlassId, cageDetails.getGlassId()) .set(HollowGlassRelationInfo::getTemperingLayoutId, cageDetails.getTemperingLayoutId()) .set(HollowGlassRelationInfo::getTemperingFeedSequence, cageDetails.getTemperingFeedSequence()) .set(HollowGlassRelationInfo::getEngineerId, cageDetails.getEngineerId()) .set(HollowGlassRelationInfo::getState, Const.HOLLOW_RELATION_OCCUPY) .eq(HollowGlassRelationInfo::getFlowCardId, bigStorageDTO.getFlowCardId()) .eq(HollowGlassRelationInfo::getLayer, bigStorageDTO.getLayer()) .eq(HollowGlassRelationInfo::getVirtualSlot, bigStorageDTO.getVirtualSlot()) .eq(HollowGlassRelationInfo::getSlotSequence, bigStorageDTO.getSlotSequence()) .eq(HollowGlassRelationInfo::getHollowSequence, bigStorageDTO.getHollowSequence()) ); } } catch (Exception exception) { log.info("进片任务执行中发生异常:{}", exception); hangzhoumesParent/moduleService/hollowGlassModule/src/main/resources/mapper/HollowBigStorageCageDetailsMapper.xml
@@ -120,6 +120,7 @@ <if test="flag == true"> and sum_count = pair_count </if> order by layer </select> <select id="queryIsAllNeedDispatchVirtualSlot" resultMap="virtualSlotSequenceDTO">