From 889ff0512bc68be0f5d231a524bf97c9488ec37f Mon Sep 17 00:00:00 2001 From: wuyouming666 <2265557248@qq.com> Date: 星期四, 16 五月 2024 16:13:20 +0800 Subject: [PATCH] Merge branch 'master' of http://10.153.19.25:10101/r/HangZhouMes --- hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/downstorage/service/impl/DownStorageCageServiceImpl.java | 142 +++++++++++++++++++++++++++++++++++++++++++++-- 1 files changed, 135 insertions(+), 7 deletions(-) diff --git a/hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/downstorage/service/impl/DownStorageCageServiceImpl.java b/hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/downstorage/service/impl/DownStorageCageServiceImpl.java index 618c2b1..e580072 100644 --- a/hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/downstorage/service/impl/DownStorageCageServiceImpl.java +++ b/hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/downstorage/service/impl/DownStorageCageServiceImpl.java @@ -1,9 +1,25 @@ package com.mes.downstorage.service.impl; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.github.yulichang.toolkit.JoinWrappers; +import com.github.yulichang.wrapper.MPJLambdaWrapper; + +import com.mes.device.PlcParameterObject; +import com.mes.downglassinfo.entity.DownGlassTask; +import com.mes.downglassinfo.service.DownGlassTaskService; import com.mes.downstorage.entity.DownStorageCage; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.mes.downstorage.entity.DownStorageCageDetails; +import com.mes.downstorage.mapper.DownStorageCageDetailsMapper; import com.mes.downstorage.mapper.DownStorageCageMapper; +import com.mes.downstorage.service.DownStorageCageDetailsService; import com.mes.downstorage.service.DownStorageCageService; +import com.mes.glassinfo.entity.GlassInfo; +import com.mes.glassinfo.service.GlassInfoService; +import com.mes.pp.entity.OptimizeDetail; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -12,20 +28,132 @@ /** * <p> - * 鏈嶅姟瀹炵幇绫� + * 鏈嶅姟瀹炵幇绫� * </p> * * @author zhoush * @since 2024-03-27 */ +@Slf4j @Service public class DownStorageCageServiceImpl extends ServiceImpl<DownStorageCageMapper, DownStorageCage> implements DownStorageCageService { - @Autowired + @Autowired(required = false) private DownStorageCageMapper downStorageCageMapper; + + @Autowired + private GlassInfoService glassInfoService; + + @Autowired + private DownGlassTaskService downGlassTaskService; + @Autowired + private DownStorageCageDetailsService downStorageCageDetailsService; + @Autowired + private DownStorageCageDetailsMapper downStorageCageDetailsMapper; + @Override - public List<Map> gettask(){ - downStorageCageMapper.selectList(null); -// downStorageCageMapper.selectJoin(); - return null; - }; + public DownGlassTask createDownGlassTask(GlassInfo glassInfo, String startCell, String endCell, String taskType) { + DownGlassTask downGlassTask = new DownGlassTask(); + + BeanUtils.copyProperties(glassInfo, downGlassTask); + + downGlassTask.setStartCell(startCell); + downGlassTask.setTaskType(taskType); + downGlassTask.setEndCell(endCell); + return downGlassTask; + } + + @Override + public DownGlassTask createDownGlassTask(DownStorageCageDetails glassInfo, String startCell, String endCell, String taskType) { + DownGlassTask downGlassTask = new DownGlassTask(); + + BeanUtils.copyProperties(glassInfo, downGlassTask); + downGlassTask.setStartCell(startCell); + downGlassTask.setTaskType(taskType); + downGlassTask.setEndCell(endCell); + return downGlassTask; + } + + + + + //鎵惧埌绌烘牸瀛� + @Override + public List<DownStorageCageDetails> selectCacheEmpty() { + return baseMapper.selectJoinList(DownStorageCageDetails.class, + JoinWrappers.lambda(DownStorageCage.class) + .selectAll(DownStorageCage.class) + .select(DownStorageCageDetails::getWidth, DownStorageCageDetails::getHeight, DownStorageCageDetails::getGlassId) + .leftJoin(DownStorageCageDetails.class, on -> on + .eq(DownStorageCageDetails::getDeviceId, DownStorageCage::getDeviceId) + .eq(DownStorageCageDetails::getSlot, DownStorageCage::getSlot)) + .isNull(DownStorageCageDetails::getSlot) + ); + } + + + + + + + @Override + public List<Map<String, Object>> selectDownStorageCages() { + return baseMapper.selectJoinMaps(JoinWrappers.lambda(DownStorageCage.class) + .selectAll(DownStorageCage.class) + .selectAs(DownStorageCageDetails::getId, "esdId") + .select(DownStorageCageDetails::getGlassId, DownStorageCageDetails::getWidth, DownStorageCageDetails::getHeight, DownStorageCageDetails::getId) + .leftJoin(DownStorageCageDetails.class, on -> on + .eq(DownStorageCageDetails::getDeviceId, DownStorageCage::getDeviceId) + .eq(DownStorageCageDetails::getSlot, DownStorageCage::getSlot)) + ); + + } + + /** + * 淇敼鐞嗙墖绗间俊鎭� 鍔熻兘锛氬绗煎唴鏍呮牸鐜荤拑 銆愬惎鐢�/绂佺敤銆� + * + * @param downStorageCage + * @return + */ + @Override + public boolean updateDownStorageCage(DownStorageCage downStorageCage) { + DownStorageCage downItem = baseMapper.selectById(downStorageCage.getId()); + downItem.setEnableState(downStorageCage.getEnableState()); + baseMapper.updateById(downItem); + return true; + } + + /** + * 淇敼鐞嗙墖绗间俊鎭� 鍔熻兘锛氬绗煎唴鏍呮牸鐜荤拑 銆愭坊鍔�/鍒犻櫎/鏇存崲銆� + * + * @param downStorageCageId + * @param downStorageCageDetails + * @return + */ + @Override + public boolean updateDownStorageCageDetails(int downStorageCageId, DownStorageCageDetails downStorageCageDetails) { + DownStorageCage downItem = baseMapper.selectById(downStorageCageId); + log.info("姝e父" + downItem); + if (downStorageCageDetails != null) { + DownStorageCageDetails edgDItem = downStorageCageDetailsMapper.selectById(downStorageCageDetails.getId()); + //娣诲姞 + if (edgDItem != null) { + //鍙紶鏍煎瓙 锛氱Щ闄ょ幓鐠� + DownStorageCageDetails newresult = downStorageCageDetailsMapper.selectById(downStorageCageDetails.getId()); + newresult.setSlot(downItem.getSlot()); + downStorageCageDetailsMapper.updateById(newresult); + } + } + + if (downItem != null) { + //绉婚櫎 + DownStorageCageDetails result = downStorageCageDetailsMapper.selectOne(new MPJLambdaWrapper<DownStorageCageDetails>().eq(DownStorageCageDetails::getSlot, downStorageCageId)); + if (result != null) { + result.setSlot(0); + downStorageCageDetailsMapper.updateById(result); + } + + } + return true; + } + } -- Gitblit v1.8.0