From 6c8a2e8d4264d5017c1f8a7e78f608e830cbc2ed Mon Sep 17 00:00:00 2001 From: wangfei <3597712270@qq.com> Date: 星期四, 04 七月 2024 16:55:44 +0800 Subject: [PATCH] Merge branch 'master' of http://10.153.19.25:10101/r/HangZhouMes --- hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/downglassinfo/service/impl/DownGlassInfoServiceImpl.java | 36 +++++++++++++++++++++++++++++++++++- 1 files changed, 35 insertions(+), 1 deletions(-) diff --git a/hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/downglassinfo/service/impl/DownGlassInfoServiceImpl.java b/hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/downglassinfo/service/impl/DownGlassInfoServiceImpl.java index 4cfb8bd..df92487 100644 --- a/hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/downglassinfo/service/impl/DownGlassInfoServiceImpl.java +++ b/hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/downglassinfo/service/impl/DownGlassInfoServiceImpl.java @@ -1,12 +1,20 @@ package com.mes.downglassinfo.service.impl; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.mes.common.config.Const; import com.mes.downglassinfo.entity.DownGlassInfo; import com.mes.downglassinfo.mapper.DownGlassInfoMapper; import com.mes.downglassinfo.service.DownGlassInfoService; +import com.mes.downstorage.entity.DownStorageCageDetails; +import com.mes.downstorage.service.DownStorageCageDetailsService; import com.mes.downworkstation.entity.dto.DownGlassInfoDTO; +import com.mes.glassinfo.entity.GlassInfo; +import com.mes.job.DownLoadCacheGlassTask; +import org.springframework.beans.BeanUtils; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.List; @@ -14,13 +22,20 @@ @Service public class DownGlassInfoServiceImpl extends ServiceImpl<DownGlassInfoMapper, DownGlassInfo> implements DownGlassInfoService { + @Autowired + DownLoadCacheGlassTask downLoadCacheGlassTask; + + @Autowired + DownStorageCageDetailsService downStorageCageDetailsService; + /** * 鏍规嵁娴佺▼鍗″彿鏌ヨ鏈�澶у簭鍙� */ @Override - public Integer getMaxSequenceByFlowCardId(String flowCardId) { + public Integer getMaxSequenceByFlowCardId(String flowCardId, int layer) { LambdaQueryWrapper<DownGlassInfo> lambdaQueryWrapper = Wrappers.lambdaQuery(); lambdaQueryWrapper.eq(DownGlassInfo::getFlowCardId, flowCardId) + .eq(DownGlassInfo::getLayer, layer) .select(DownGlassInfo::getSequence) .orderByDesc(DownGlassInfo::getSequence) .last("LIMIT 1"); @@ -48,4 +63,23 @@ public List<DownGlassInfoDTO> queryWorkStationIsIn(Boolean isDownload) { return baseMapper.queryWorkStationIsIn(isDownload); } + + @Override + public boolean generateOutGlassTask(String glassId) { + //鏇存柊鍗у紡鐞嗙墖绗煎唴鐜荤拑鐘舵�� + downStorageCageDetailsService.update(new LambdaUpdateWrapper<DownStorageCageDetails>() + .set(DownStorageCageDetails::getState, Const.GLASS_STATE_OUT).eq(DownStorageCageDetails::getGlassId, glassId)); + DownStorageCageDetails details = downStorageCageDetailsService.getOne(new LambdaQueryWrapper<DownStorageCageDetails>() + .eq(DownStorageCageDetails::getGlassId, glassId)); + //鐢熸垚涓嬬墖淇℃伅 + DownGlassInfo downGlassInfo = new DownGlassInfo(); + BeanUtils.copyProperties(details, downGlassInfo); + //鑾峰彇褰撳墠娴佺▼鍗℃渶澶х墖搴� + downGlassInfo.setSequence(this.getMaxSequenceByFlowCardId(details.getFlowCardId(), details.getLayer()) + 1); + this.save(downGlassInfo); + //鐢熸垚浠诲姟淇℃伅 骞跺悜plc鍙戦�佸嚭鐗囦换鍔� + GlassInfo glassInfo = new GlassInfo(); + BeanUtils.copyProperties(details, glassInfo); + return downLoadCacheGlassTask.initDownGlassTask(glassInfo, details.getSlot(), 3001, 2); + } } -- Gitblit v1.8.0