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.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;
|
|
/**
|
* (HollowBigStorageCageDetails)表服务实现类
|
*
|
* @author makejava
|
* @since 2024-11-21 09:23:12
|
*/
|
@Service
|
@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) {
|
baseMapper.updateBySlot(storageCageDTOList, state);
|
}
|
|
@Override
|
public List<FlowCardGlassInfoDTO> hollowIsAll(String flow_card_id, Integer totalLayer, Boolean flag) {
|
return baseMapper.hollowIsAll(flow_card_id, totalLayer, flag);
|
}
|
|
@Override
|
public List<FlowCardVirtualSlotDTO> queryIsAllNeedDispatchVirtualSlot() {
|
return baseMapper.queryIsAllNeedDispatchVirtualSlot();
|
}
|
|
@Override
|
public List<BigStorageSequenceDTO> queryNeedDispatchSlot(FlowCardVirtualSlotDTO flowCardVirtualSlotDTO) {
|
return baseMapper.queryNeedDispatchSlot(flowCardVirtualSlotDTO);
|
}
|
|
@Override
|
public List<HollowBigStorageCageDetails> queryOutGlassList(String flowCardId, int cell) {
|
return baseMapper.queryOutGlassList(flowCardId, cell);
|
}
|
|
@Override
|
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);
|
}
|
|
@Override
|
public void updateDeviceIdBySlot(List<Integer> slotList) {
|
baseMapper.updateDeviceIdBySlot(slotList);
|
}
|
|
@Override
|
public List<HollowBigStorageCageDetails> queryPairGlassList(String flowCardId, Integer totalLayer, Integer totalPairQuantity, Integer isOut) {
|
return baseMapper.queryPairGlassList(flowCardId, totalLayer, totalPairQuantity, isOut);
|
}
|
|
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);
|
}
|
}
|