| | |
| | | import com.mes.bigstorage.entity.BigStorageCage; |
| | | import com.mes.bigstorage.entity.BigStorageCageDetails; |
| | | import com.mes.bigstorage.entity.dto.*; |
| | | import com.mes.bigstorage.entity.request.BigCageDetailsRequest; |
| | | import com.mes.bigstorage.entity.vo.BigStorageQueryVO; |
| | | import com.mes.bigstorage.entity.vo.BigCageDetailsVO; |
| | | import com.mes.bigstorage.mapper.BigStorageCageDetailsMapper; |
| | | import com.mes.bigstorage.service.BigStorageCageDetailsService; |
| | | import com.mes.bigstorage.service.BigStorageCageService; |
| | |
| | | import com.mes.glassinfo.mapper.GlassInfoMapper; |
| | | import com.mes.glassinfo.service.GlassInfoService; |
| | | import com.mes.pp.entity.OptimizeProject; |
| | | import com.mes.pp.service.OptimizeProjectService; |
| | | import com.mes.sysconfig.entity.SysConfig; |
| | | import com.mes.sysconfig.service.SysConfigService; |
| | | import com.mes.temperingglass.entity.TemperingGlassInfo; |
| | |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.*; |
| | | import java.util.ArrayList; |
| | | import java.util.Iterator; |
| | | import java.util.List; |
| | |
| | | private BigStorageCageService bigStorageCageService; |
| | | @Resource |
| | | private GlassInfoMapper glassInfoMapper; |
| | | @Resource |
| | | private OptimizeProjectService optimizeProjectService; |
| | | |
| | | @Resource |
| | | private GlassInfoService glassInfoService; |
| | |
| | | .eq(BigStorageCage::getEnableState, Const.SLOT_ON) |
| | | .eq(BigStorageCage::getRemainWidth, slotWidth).orderByAsc(BigStorageCage::getSlot) |
| | | .inSql(BigStorageCage::getDeviceId, |
| | | "select distinct device_id from big_storage_cage_details where engineer_id = '" + EngineerId + "'") |
| | | "select distinct device_id from big_storage_cage_details where engineer_id = '" + EngineerId + "' and device_id not in (5,6)") |
| | | .last("limit 1")); |
| | | if (null != bigStorageCage) { |
| | | log.info("根据版图id找到笼子内的目标格子:{},玻璃id:{}", bigStorageCage.getSlot(), glassId); |
| | |
| | | |
| | | if (temperingGlassInfoList.size() == 0) { |
| | | MPJLambdaWrapper<GlassInfo> wrapper = JoinWrappers.lambda(GlassInfo.class) |
| | | .select("-1 as state,t.filmsid as films_id,t.glass_id,t.flow_card_id,t.glass_type,t.width,t.height" + |
| | | .select("-1 as state,t.filmsid as films_id,t.glass_id,t.flow_card_id,t.layer,t.glass_type,t.width,t.height" + |
| | | ",t.thickness,t.ishorizontal,t.tempering_layout_id,t.tempering_feed_sequence,t.x_coordinate,t.y_coordinate," + |
| | | "t.angle,t1.slot,t.engineer_id") |
| | | .innerJoin(BigStorageCageDetails.class, BigStorageCageDetails::getGlassId, GlassInfo::getGlassId) |
| | |
| | | } |
| | | |
| | | @Override |
| | | public Map<Integer, List<BigStorageVO>> querybigStorageCageDetail() { |
| | | public Map<Object, Map<Integer, List<BigStorageVO>>> querybigStorageCageDetail() { |
| | | List<BigStorageVO> bigStorageCages = baseMapper.querybigStorageCageDetail(); |
| | | return bigStorageCages.stream().collect(Collectors.groupingBy(item -> item.getDeviceId())); |
| | | // 嵌套分组:先按slot分组,再按deviceId分组 |
| | | |
| | | return bigStorageCages.stream() |
| | | // 第一层分组:key=slot值,value=该slot下的所有BigStorageVO |
| | | .collect(Collectors.groupingBy( |
| | | BigStorageVO::getDeviceId, // 第一层分组依据:slot |
| | | // 第二层分组:对第一层的value继续按deviceId分组 |
| | | Collectors.groupingBy(BigStorageVO::getSlot) |
| | | )); |
| | | } |
| | | |
| | | @Override |
| | |
| | | } |
| | | |
| | | @Override |
| | | public List<BigStorageRelationDTO> queryIsAllNeedDispatchVirtualSlot() { |
| | | return baseMapper.queryIsAllNeedDispatchVirtualSlot(); |
| | | public List<BigStorageRelationDTO> queryIsAllNeedDispatchVirtualSlot(List<Integer> deviceIdList) { |
| | | return baseMapper.queryIsAllNeedDispatchVirtualSlot(deviceIdList); |
| | | } |
| | | |
| | | @Override |
| | |
| | | .eq("state", 100); |
| | | return this.list(wrapper); |
| | | } |
| | | |
| | | @Override |
| | | public List<BigStorageCageDetails> queryNeedDispatch() { |
| | | return baseMapper.queryNeedDispatch(); |
| | | } |
| | | |
| | | @Override |
| | | public BigStorageSlotDTO queryNeedDispatchSlotBySequence() { |
| | | return baseMapper.queryNeedDispatchSlotBySequence(); |
| | | } |
| | | |
| | | @Override |
| | | public List<OptimizeProject> queryTemperingOrder() { |
| | | String temperingengineerId = redisUtil.getCacheObject("temperingEngineerId"); |
| | | List<TemperingGlassCountDTO> temperingGlassCountDTOS = baseMapper.queryTemperingGlassCountSummary(1); |
| | | List<OptimizeProject> projectList = optimizeProjectService.engineerScheduling(new OptimizeProject() {{ |
| | | setType(3); |
| | | }}); |
| | | Set<String> projectNoSet = projectList.stream() |
| | | .map(OptimizeProject::getProjectNo) |
| | | .collect(Collectors.toSet()); |
| | | List<OptimizeProject> resultList = new ArrayList<>(); |
| | | for (TemperingGlassCountDTO dto : temperingGlassCountDTOS) { |
| | | if (projectNoSet.contains(dto.getEngineerId())) { |
| | | OptimizeProject project = new OptimizeProject(); |
| | | if (Objects.equals(dto.getEngineerId(), temperingengineerId)) { |
| | | project.setState(1); |
| | | } |
| | | project.setProjectNo(dto.getEngineerId()); |
| | | project.setGlassType(dto.getFilmsId()); |
| | | project.setGlassThickness(dto.getThickness().intValue()); |
| | | project.setGlassTotal(dto.getTotalCount()); |
| | | project.setGlassTotalArea(dto.getRealCount()); |
| | | resultList.add(project); |
| | | } |
| | | } |
| | | return resultList; |
| | | } |
| | | |
| | | @Override |
| | | public List<BigCageDetailsVO> queryVerticalSheetCageDetailsList(BigCageDetailsRequest request) { |
| | | List<BigCageDetailsVO> cageDetails = baseMapper.queryVerticalSheetCageDetailsList(request); |
| | | if (!(com.baomidou.mybatisplus.core.toolkit.StringUtils.isBlank(request.getFlowCardId()) && |
| | | com.baomidou.mybatisplus.core.toolkit.StringUtils.isBlank(request.getFilmsId()) && |
| | | com.baomidou.mybatisplus.core.toolkit.StringUtils.isBlank(request.getEngineerId()) && |
| | | com.baomidou.mybatisplus.core.toolkit.StringUtils.isBlank(request.getGlassId()))) { |
| | | cageDetails = cageDetails.stream() |
| | | .filter(detail -> detail.getGlassId() != null) |
| | | .collect(Collectors.toList()); |
| | | } |
| | | return cageDetails; |
| | | } |
| | | } |