| | |
| | | package com.mes.hollow.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.mes.base.entity.vo.BigStorageVO; |
| | | import com.mes.common.config.Const; |
| | | import com.mes.glassinfo.entity.GlassInfo; |
| | | import com.mes.glassinfo.service.GlassInfoService; |
| | | import com.mes.hollow.entity.HollowBigStorageCageDetails; |
| | | import com.mes.hollow.entity.dto.BigStorageSequenceDTO; |
| | | import com.mes.hollow.entity.dto.FlowCardGlassInfoDTO; |
| | | import com.mes.hollow.entity.dto.FlowCardVirtualSlotDTO; |
| | | import com.mes.hollow.entity.dto.UpdateHollowBigStorageCageDTO; |
| | | import com.mes.hollow.entity.HollowGlassRelationInfo; |
| | | import com.mes.hollow.entity.dto.*; |
| | | import com.mes.hollow.entity.vo.HollowBigStorageDetailsQueryVO; |
| | | import com.mes.hollow.mapper.HollowBigStorageCageDetailsMapper; |
| | | import com.mes.hollow.service.HollowBigStorageCageDetailsService; |
| | | import com.mes.hollow.service.HollowBigStorageCageService; |
| | | import com.mes.hollow.service.HollowGlassRelationInfoService; |
| | | import com.mes.job.OpcPlcStorageCageHollowTask; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | |
| | | /** |
| | |
| | | @Slf4j |
| | | public class HollowBigStorageCageDetailsServiceImpl extends ServiceImpl<HollowBigStorageCageDetailsMapper, HollowBigStorageCageDetails> implements HollowBigStorageCageDetailsService { |
| | | |
| | | @Resource |
| | | HollowBigStorageCageService hollowBigStorageCageService; |
| | | |
| | | @Resource |
| | | HollowGlassRelationInfoService hollowGlassRelationInfoService; |
| | | @Resource |
| | | GlassInfoService glassInfoService; |
| | | @Resource |
| | | OpcPlcStorageCageHollowTask opcPlcStorageCageHollowTask; |
| | | |
| | | @Override |
| | | public void updateBySlot(List<UpdateHollowBigStorageCageDTO> storageCageDTOList, Integer state) { |
| | |
| | | public List<BigStorageVO> queryHollowbigStorageCageDetail() { |
| | | return baseMapper.queryHollowbigStorageCageDetail(); |
| | | } |
| | | |
| | | @Override |
| | | public List<HollowBigStorageCageDetails> querySlotMaxSequence(String flowCardId, Integer totalLayer, Integer layer, Integer virtualSlot) { |
| | | return baseMapper.querySlotMaxSequence(flowCardId, totalLayer, layer, virtualSlot); |
| | | } |
| | | |
| | | @Override |
| | | public List<HollowBigStorageAndDetailsDTO> insertHollowBigStorageCageDetails(HollowBigStorageCageDetails bigStorageCageDetails) { |
| | | GlassInfo info = glassInfoService.getOne(new LambdaQueryWrapper<GlassInfo>().in(GlassInfo::getGlassId, bigStorageCageDetails.getGlassId())); |
| | | HollowBigStorageDTO hollowBigStorageDTO = hollowGlassRelationInfoService.queryHollowTargetSlot(bigStorageCageDetails.getFlowCardId(), bigStorageCageDetails.getWidth(), |
| | | bigStorageCageDetails.getHeight(), bigStorageCageDetails.getTotalLayer(), bigStorageCageDetails.getLayer()); |
| | | HollowBigStorageCageDetails cageDetails = new HollowBigStorageCageDetails(); |
| | | BeanUtils.copyProperties(hollowBigStorageDTO, cageDetails); |
| | | BeanUtils.copyProperties(info, cageDetails); |
| | | cageDetails.setState(Const.GLASS_STATE_NEW); |
| | | cageDetails.setSequence(hollowBigStorageDTO.getSlotSequence()); |
| | | cageDetails.setGap(250); |
| | | cageDetails.setId(null); |
| | | this.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, hollowBigStorageDTO.getFlowCardId()) |
| | | .eq(HollowGlassRelationInfo::getLayer, hollowBigStorageDTO.getLayer()) |
| | | .eq(HollowGlassRelationInfo::getVirtualSlot, hollowBigStorageDTO.getVirtualSlot()) |
| | | .eq(HollowGlassRelationInfo::getSlotSequence, hollowBigStorageDTO.getSlotSequence()) |
| | | .eq(HollowGlassRelationInfo::getHollowSequence, hollowBigStorageDTO.getHollowSequence()) |
| | | ); |
| | | HollowBigStorageDetailsQueryVO query = new HollowBigStorageDetailsQueryVO(); |
| | | query.setDeviceId(bigStorageCageDetails.getDeviceId()); |
| | | return hollowBigStorageCageService.queryHollowBigStorageCageDetail(query); |
| | | } |
| | | |
| | | @Override |
| | | public List<HollowBigStorageAndDetailsDTO> deleteHollowBigStorageCageDetails(String glassId, Integer deviceId, Integer slot) { |
| | | return hollowBigStorageCageDetailsChild(glassId, deviceId, slot, Const.GLASS_STATE_OUT); |
| | | } |
| | | |
| | | @Override |
| | | public List<HollowBigStorageAndDetailsDTO> damageHollowBigStorageCageDetails(String glassId, Integer deviceId, Integer slot, int state) { |
| | | return hollowBigStorageCageDetailsChild(glassId, deviceId, slot, state); |
| | | } |
| | | |
| | | private List<HollowBigStorageAndDetailsDTO> hollowBigStorageCageDetailsChild(String glassId, Integer deviceId, Integer slot, int state) { |
| | | //将对应格子号的玻璃id置为101 |
| | | this.update(new LambdaUpdateWrapper<HollowBigStorageCageDetails>() |
| | | .set(HollowBigStorageCageDetails::getState, state) |
| | | .eq(HollowBigStorageCageDetails::getSlot, slot) |
| | | .eq(HollowBigStorageCageDetails::getGlassId, glassId) |
| | | ); |
| | | //将流程卡广西表内对应的玻璃信息清除 |
| | | hollowGlassRelationInfoService.update(new LambdaUpdateWrapper<HollowGlassRelationInfo>() |
| | | .set(HollowGlassRelationInfo::getGlassId, null) |
| | | .set(HollowGlassRelationInfo::getTemperingLayoutId, null) |
| | | .set(HollowGlassRelationInfo::getTemperingFeedSequence, null) |
| | | .set(HollowGlassRelationInfo::getEngineerId, null) |
| | | .set(HollowGlassRelationInfo::getState, Const.HOLLOW_RELATION_NEW) |
| | | .eq(HollowGlassRelationInfo::getGlassId, glassId) |
| | | ); |
| | | //更新对应格子的剩余尺寸 |
| | | opcPlcStorageCageHollowTask.updateSlotRemainBySlots(Arrays.asList(slot)); |
| | | //返回对应的笼子的列表信息 |
| | | HollowBigStorageDetailsQueryVO query = new HollowBigStorageDetailsQueryVO(); |
| | | query.setDeviceId(deviceId); |
| | | return hollowBigStorageCageService.queryHollowBigStorageCageDetail(query); |
| | | } |
| | | } |
| | | |