hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/bigstorage/mapper/BigStorageCageDetailsMapper.java
@@ -4,6 +4,7 @@ import com.mes.bigstorage.entity.BigStorageCageDetails; import com.mes.bigstorage.entity.dto.SlotSequenceDTO; import com.mes.bigstorage.entity.dto.TemperingLayoutDTO; import com.mes.bigstoragetask.entity.UpdateBigStorageCageDTO; import org.apache.ibatis.annotations.Param; import java.util.List; @@ -35,4 +36,12 @@ List<SlotSequenceDTO> queryGlassMaxAndMin(@Param(value = "engineerId") String engineerId, @Param(value = "temperingLayoutId") Integer temperingLayoutId); /** * 按照玻璃id和目标格子更新笼内玻璃信息 * * @param glassList * @param state */ void updateBySlot(@Param(value = "list") List<UpdateBigStorageCageDTO> glassList, @Param(value = "state") int state); } hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/bigstorage/service/BigStorageCageDetailsService.java
@@ -5,6 +5,7 @@ import com.mes.bigstorage.entity.BigStorageDTO; import com.mes.bigstorage.entity.dto.SlotSequenceDTO; import com.mes.bigstorage.entity.dto.TemperingLayoutDTO; import com.mes.bigstoragetask.entity.UpdateBigStorageCageDTO; import com.mes.glassinfo.entity.GlassInfo; import java.util.List; @@ -12,7 +13,7 @@ /** * <p> * 服务类 * 服务类 * </p> * * @author zhoush @@ -26,7 +27,7 @@ void deleteBigStorageCageDetails(BigStorageCageDetails bigStorageCageDetails); void damageBigStorageCageDetails(String glassId,int status); void damageBigStorageCageDetails(String glassId, int status); List<BigStorageCageDetails> selectBigStorageCageDetails(String glassId); @@ -69,4 +70,6 @@ boolean TemperingGlass(String temperingLayoutId, String engineerId); List<Map<String, Object>> selectTemperingGlass(); void updateBySlot(List<UpdateBigStorageCageDTO> glassList, int state); } hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/bigstorage/service/impl/BigStorageCageDetailsServiceImpl.java
@@ -15,6 +15,7 @@ import com.mes.bigstorage.service.BigStorageCageService; import com.mes.bigstoragetask.entity.BigStorageCageFeedTask; import com.mes.bigstoragetask.entity.BigStorageCageOutTask; import com.mes.bigstoragetask.entity.UpdateBigStorageCageDTO; import com.mes.bigstoragetask.mapper.BigStorageCageFeedTaskMapper; import com.mes.bigstoragetask.mapper.BigStorageCageOutTaskMapper; import com.mes.common.config.Const; @@ -292,6 +293,7 @@ bigStorageCage = bigStorageCageService.getOne(new LambdaQueryWrapper<BigStorageCage>() .eq(BigStorageCage::getEnableState, Const.SLOT_ON) .eq(BigStorageCage::getRemainWidth, slotWidth) .notInSql(BigStorageCage::getSlot, "select distinct slot from big_storage_cage_details where state = 0") .inSql(BigStorageCage::getDeviceId, "select distinct device_id from big_storage_cage_details where tempering_layout_id = " + glassInfo.getTemperingLayoutId()) .last("limit 1")); @@ -307,6 +309,7 @@ bigStorageCage = bigStorageCageService.getOne(new LambdaQueryWrapper<BigStorageCage>() .eq(BigStorageCage::getRemainWidth, slotWidth) .eq(BigStorageCage::getEnableState, Const.SLOT_ON) .notInSql(BigStorageCage::getSlot, "select distinct slot from big_storage_cage_details where state = 0") .notInSql(BigStorageCage::getDeviceId, "select distinct device_id from big_storage_cage_details where state in (100,102,103)") .ge(BigStorageCage::getMaxThickness, glassInfo.getThickness()) @@ -321,6 +324,7 @@ } bigStorageCage = bigStorageCageService.getOne(new LambdaQueryWrapper<BigStorageCage>() .eq(BigStorageCage::getRemainWidth, slotWidth) .notInSql(BigStorageCage::getSlot, "select distinct slot from big_storage_cage_details where state = 0") .eq(BigStorageCage::getEnableState, Const.SLOT_ON) .ge(BigStorageCage::getMaxThickness, glassInfo.getThickness()) .orderByAsc(BigStorageCage::getDeviceId) @@ -353,15 +357,15 @@ public boolean TemperingGlass(String temperingLayoutId, String engineerId) { LambdaQueryWrapper<TemperingGlassInfo> temperingGlassInfoLambdaQueryWrapper = new LambdaQueryWrapper<>(); temperingGlassInfoLambdaQueryWrapper .eq(TemperingGlassInfo::getState,Const.TEMPERING_NEW); List<TemperingGlassInfo> temperingGlassInfoList=temperingGlassInfoMapper.selectList(temperingGlassInfoLambdaQueryWrapper); .eq(TemperingGlassInfo::getState, Const.TEMPERING_NEW); List<TemperingGlassInfo> temperingGlassInfoList = temperingGlassInfoMapper.selectList(temperingGlassInfoLambdaQueryWrapper); if(temperingGlassInfoList.size()==0){ LambdaQueryWrapper<BigStorageCageDetails> wrapper =new LambdaQueryWrapper<>(); wrapper.eq(BigStorageCageDetails::getTemperingLayoutId,temperingLayoutId) .eq(BigStorageCageDetails::getEngineerId,engineerId) .in(BigStorageCageDetails::getState,Const.GLASS_STATE_IN,Const.GLASS_STATE_ARTIFICIAL); List<BigStorageCageDetails> bigStorageCageDetailsList=baseMapper.selectList(wrapper); if (temperingGlassInfoList.size() == 0) { LambdaQueryWrapper<BigStorageCageDetails> wrapper = new LambdaQueryWrapper<>(); wrapper.eq(BigStorageCageDetails::getTemperingLayoutId, temperingLayoutId) .eq(BigStorageCageDetails::getEngineerId, engineerId) .in(BigStorageCageDetails::getState, Const.GLASS_STATE_IN, Const.GLASS_STATE_ARTIFICIAL); List<BigStorageCageDetails> bigStorageCageDetailsList = baseMapper.selectList(wrapper); for (BigStorageCageDetails bigStorageCageDetails : bigStorageCageDetailsList ) { @@ -380,17 +384,20 @@ } else { return false; } } @Override public List<Map<String, Object>> selectTemperingGlass(){ public List<Map<String, Object>> selectTemperingGlass() { QueryWrapper<BigStorageCageDetails> wrapper = new QueryWrapper<>(); wrapper.select("engineer_id,tempering_layout_id,count(*) as count") .in("state",Const.GLASS_STATE_IN,Const.GLASS_STATE_ARTIFICIAL) .in("state", Const.GLASS_STATE_IN, Const.GLASS_STATE_ARTIFICIAL) .groupBy("engineer_id,tempering_layout_id"); List<Map<String, Object>> TemperingGlass = baseMapper.selectMaps(wrapper); return TemperingGlass; } @Override public void updateBySlot(List<UpdateBigStorageCageDTO> glassList, int state) { baseMapper.updateBySlot(glassList, state); } } hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/bigstoragetask/entity/UpdateBigStorageCageDTO.java
New file @@ -0,0 +1,18 @@ package com.mes.bigstoragetask.entity; import lombok.Data; /** * @Author : zhoush * @Date: 2024/7/26 9:05 * @Description: */ @Data public class UpdateBigStorageCageDTO { private String glassId; private int targetSlot; private Integer startSlot; } hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/job/PlcStorageCageTask.java
@@ -16,6 +16,7 @@ import com.mes.bigstorage.service.BigStorageCageService; import com.mes.bigstoragetask.entity.BigStorageCageFeedTask; import com.mes.bigstoragetask.entity.BigStorageCageOutTask; import com.mes.bigstoragetask.entity.UpdateBigStorageCageDTO; import com.mes.bigstoragetask.service.BigStorageCageFeedTaskService; import com.mes.bigstoragetask.service.BigStorageCageOutTaskService; import com.mes.common.S7object; @@ -348,14 +349,18 @@ if (CollectionUtils.isNotEmpty(list)) { log.info("2、获取所有正在进片的玻璃信息id:{}", list); List<String> glassIds = list.stream().map(String::valueOf).collect(Collectors.toList()); List<Object> inSuccessGlassIdsObj = bigStorageCageFeedTaskService.listObjs(new LambdaQueryWrapper<BigStorageCageFeedTask>() .select(BigStorageCageFeedTask::getGlassId).in(BigStorageCageFeedTask::getGlassId, glassIds) List<BigStorageCageFeedTask> inSuccessGlass = bigStorageCageFeedTaskService.list(new LambdaQueryWrapper<BigStorageCageFeedTask>() .in(BigStorageCageFeedTask::getGlassId, glassIds) .in(BigStorageCageFeedTask::getTaskState, Const.BIG_STORAGE_IN_SLOT)); List<String> inSuccessGlassIds = inSuccessGlassIdsObj.stream().map(String::valueOf).collect(Collectors.toList()); if (CollectionUtils.isNotEmpty(inSuccessGlassIds)) { log.info("3、获取进片已完成的玻璃信息id:{}", inSuccessGlassIds); bigStorageCageDetailsService.update(new LambdaUpdateWrapper<BigStorageCageDetails>() .set(BigStorageCageDetails::getState, Const.GLASS_STATE_IN).in(BigStorageCageDetails::getGlassId, inSuccessGlassIds)); if (CollectionUtils.isNotEmpty(inSuccessGlass)) { log.info("3、获取进片已完成的玻璃信息id:{}", inSuccessGlass); List<String> inSuccessGlassIds = inSuccessGlass.stream().map(BigStorageCageFeedTask::getGlassId).collect(Collectors.toList()); List<UpdateBigStorageCageDTO> storageCageDTOList = inSuccessGlass.stream().map(e -> { UpdateBigStorageCageDTO storageCageDTO = new UpdateBigStorageCageDTO(); BeanUtils.copyProperties(inSuccessGlass, storageCageDTO); return storageCageDTO; }).collect(Collectors.toList()); bigStorageCageDetailsService.updateBySlot(storageCageDTOList, Const.GLASS_STATE_IN); log.info("4、大理片笼进片状态已完成已完成的玻璃信息id:{}", inSuccessGlassIds); //更新理片笼玻璃尺寸 updateSlotRemain(inSuccessGlassIds, Boolean.TRUE); @@ -379,14 +384,18 @@ if (CollectionUtils.isNotEmpty(list)) { log.info("2、获取所有正在出片的玻璃信息id:{}", list); List<String> glassIds = list.stream().map(String::valueOf).collect(Collectors.toList()); List<Object> outSuccessGlassIdsObj = bigStorageCageOutTaskService.listObjs(new LambdaQueryWrapper<BigStorageCageOutTask>() List<BigStorageCageOutTask> outSuccessGlass = bigStorageCageOutTaskService.list(new LambdaQueryWrapper<BigStorageCageOutTask>() .select(BigStorageCageOutTask::getGlassId).in(BigStorageCageOutTask::getGlassId, glassIds).in(BigStorageCageOutTask::getTaskState, Const.BIG_STORAGE_OUT_ALL)); List<String> outSuccessGlassIds = outSuccessGlassIdsObj.stream().map(String::valueOf).collect(Collectors.toList()); if (CollectionUtils.isNotEmpty(outSuccessGlassIds)) { log.info("3、获取出片已完成的玻璃信息id:{}", outSuccessGlassIdsObj); bigStorageCageDetailsService.update(new LambdaUpdateWrapper<BigStorageCageDetails>() .set(BigStorageCageDetails::getState, Const.GLASS_STATE_OUT).in(BigStorageCageDetails::getGlassId, outSuccessGlassIds)); log.info("4、大理片笼出片状态已完成已完成的玻璃信息id:{}", outSuccessGlassIdsObj); if (CollectionUtils.isNotEmpty(outSuccessGlass)) { log.info("3、获取出片已完成的玻璃信息id:{}", outSuccessGlass); List<UpdateBigStorageCageDTO> storageCageDTOList = outSuccessGlass.stream().map(e -> { UpdateBigStorageCageDTO storageCageDTO = new UpdateBigStorageCageDTO(); BeanUtils.copyProperties(outSuccessGlass, storageCageDTO); return storageCageDTO; }).collect(Collectors.toList()); bigStorageCageDetailsService.updateBySlot(storageCageDTOList, Const.GLASS_STATE_OUT); List<String> outSuccessGlassIds = outSuccessGlass.stream().map(BigStorageCageOutTask::getGlassId).collect(Collectors.toList()); log.info("4、大理片笼出片状态已完成已完成的玻璃信息id:{}", outSuccessGlassIds); //更新理片笼玻璃尺寸 updateSlotRemain(outSuccessGlassIds, Boolean.FALSE); log.info("5、大理片笼进片目标格子尺寸更新完成"); hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/resources/mapper/BigStorageCageDetailsMapper.xml
@@ -71,4 +71,18 @@ INNER JOIN BIG_STORAGE_CAGE T1 ON T.SLOT = T1.SLOT ORDER BY T.MAX_SEQUENCE DESC </select> <update id="updateBySlot"> update big_storage_cage_details <set> state = #{state} </set> <where> (glass_id,slot) in ( <foreach collection="list" item="item" separator=","> (#{item.glassId}, #{item.targetSlot}) </foreach> ) </where> </update> </mapper>