| | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.mes.common.config.Const; |
| | | import com.mes.common.config.ConstSysConfig; |
| | | import com.mes.damage.entity.request.DamageRequest; |
| | | import com.mes.damage.service.DamageService; |
| | | import com.mes.glassinfo.entity.GlassInfo; |
| | | import com.mes.glassinfo.service.GlassInfoService; |
| | | import com.mes.hollow.entity.HollowBigStorageCage; |
| | |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.math.BigInteger; |
| | | import java.util.ArrayList; |
| | | import java.util.Comparator; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.*; |
| | | import java.util.concurrent.atomic.AtomicInteger; |
| | | import java.util.regex.Matcher; |
| | | import java.util.regex.Pattern; |
| | |
| | | HollowBigStorageCageDetailsService hollowBigStorageCageDetailsService; |
| | | @Resource |
| | | SysConfigService sysConfigService; |
| | | @Resource |
| | | DamageService damageService; |
| | | // @Value("${mes.slotWidth}") |
| | | // private Integer slotWidth; |
| | | // @Value("${mes.glassGap}") |
| | |
| | | // private Integer outCarMaxSize; |
| | | |
| | | @Override |
| | | public HollowBigStorageDTO queryHollowTargetSlot(String flowCardId, double width, double height, int totalLayer, int layer) { |
| | | public HollowBigStorageDTO queryHollowTargetSlot(String flowCardId, Integer glassType, double width, double height, int totalLayer, int layer) { |
| | | log.info("玻璃流程卡:{},序号:{},总层数:{},层数:{}", flowCardId, glassType, totalLayer, layer); |
| | | //按照玻璃信息获取关系表中对应的大理片笼格子号 |
| | | HollowGlassRelationInfo relationInfoOne = hollowGlassRelationInfoService.getOne(new LambdaQueryWrapper<HollowGlassRelationInfo>() |
| | | .eq(HollowGlassRelationInfo::getFlowCardId, flowCardId) |
| | | .eq(HollowGlassRelationInfo::getWidth, width) |
| | | .eq(HollowGlassRelationInfo::getHeight, height) |
| | | .eq(HollowGlassRelationInfo::getOrderSort, glassType) |
| | | .eq(HollowGlassRelationInfo::getTotalLayer, totalLayer) |
| | | .eq(HollowGlassRelationInfo::getLayer, layer) |
| | | .eq(HollowGlassRelationInfo::getState, Const.HOLLOW_RELATION_NEW) |
| | |
| | | //虚拟位置表没有本工程下的所有玻璃虚拟信息,按照玻璃id生成本工程下所有玻璃的虚拟信息 |
| | | relationInfoOne = this.getOne(new LambdaQueryWrapper<HollowGlassRelationInfo>() |
| | | .eq(HollowGlassRelationInfo::getFlowCardId, flowCardId) |
| | | .eq(HollowGlassRelationInfo::getWidth, width) |
| | | .eq(HollowGlassRelationInfo::getHeight, height) |
| | | .eq(HollowGlassRelationInfo::getOrderSort, glassType) |
| | | .eq(HollowGlassRelationInfo::getTotalLayer, totalLayer) |
| | | .eq(HollowGlassRelationInfo::getLayer, layer) |
| | | .eq(HollowGlassRelationInfo::getState, Const.HOLLOW_RELATION_NEW) |
| | | .orderByAsc(HollowGlassRelationInfo::getHollowSequence) |
| | | .last("limit 1") |
| | | ); |
| | | } |
| | | if (null == relationInfoOne) { |
| | | throw new RuntimeException("相关流程卡未找到对应的组号信息,玻璃流程卡:" + flowCardId + ",序号:" + glassType + ",总层数:" + totalLayer + ",层数:" + layer); |
| | | } |
| | | Integer slotWidth = sysConfigService.queryConfigValue(ConstSysConfig.HOLLOW_SLOT_WIDTH); |
| | | //详情表内获取本组是否已经有玻璃在笼子内(0表示提前占用) |
| | |
| | | |
| | | Integer slotWidth = sysConfigService.queryConfigValue(ConstSysConfig.HOLLOW_SLOT_WIDTH); |
| | | // Integer glassGap = sysConfigService.queryConfigValue(ConstSysConfig.HOLLOW_GLASS_GAP); |
| | | Integer glassGap = getGlassGapByThickness(tempGlassList.get(0).getThickness()); |
| | | Integer glassGap = getGlassGapByThickness(glassInfo.getThickness()); |
| | | Integer outCarMaxSize = sysConfigService.queryConfigValue(ConstSysConfig.HOLLOW_OUT_CAR_SIZE); |
| | | List<HollowGlassRelationInfo> relationInfoList = new ArrayList(); |
| | | List<List<HollowGlassRelationInfo>> tempHollowList = new ArrayList<>(); |
| | |
| | | |
| | | @Override |
| | | public List<HollowAllFlowCardVO> queryHollowAllFlowCard(HollowBigStorageDetailsQueryVO query) { |
| | | List<HollowBigStorageCageDetails> detailsList = hollowBigStorageCageDetailsService.list(new LambdaQueryWrapper<HollowBigStorageCageDetails>() |
| | | .eq(HollowBigStorageCageDetails::getState, Const.GLASS_STATE_IN) |
| | | .like(StringUtils.isNotBlank(query.getFilmsId()), HollowBigStorageCageDetails::getFilmsId, query.getFilmsId()) |
| | | .like(StringUtils.isNotBlank(query.getFlowCardId()), HollowBigStorageCageDetails::getFlowCardId, query.getFlowCardId()) |
| | | .eq(query.getThickness() != 0, HollowBigStorageCageDetails::getThickness, query.getThickness()) |
| | | .orderByAsc(HollowBigStorageCageDetails::getFlowCardId) |
| | | ); |
| | | Date startDate = new Date(); |
| | | log.info("开始查询中空流程卡任务信息,开始时间{}", startDate); |
| | | List<FlowCardGlassInfoDTO> detailsList = hollowBigStorageCageDetailsService.queryHollowAllFlowCard(query); |
| | | |
| | | if (CollectionUtil.isEmpty(detailsList)) { |
| | | log.info("笼内无玻璃"); |
| | | return new ArrayList<>(); |
| | | } |
| | | Map<String, List<HollowBigStorageCageDetails>> listMap = detailsList.stream().collect(Collectors.groupingBy(HollowBigStorageCageDetails::getFlowCardId)); |
| | | Date middleDate = new Date(); |
| | | log.info("中空理片笼详情数据已查询完毕,耗时:{}ms", middleDate.getTime() - startDate.getTime()); |
| | | Map<String, List<FlowCardGlassInfoDTO>> listMap = detailsList.stream().collect(Collectors.groupingBy(FlowCardGlassInfoDTO::getFlowCardId)); |
| | | List<HollowAllFlowCardVO> resultList = new ArrayList<>(); |
| | | AtomicInteger pairTotalCount = new AtomicInteger(); |
| | | listMap.forEach((e, v) -> { |
| | | HollowAllFlowCardVO hollowAllFlowCardVO = new HollowAllFlowCardVO(); |
| | | HollowBigStorageCageDetails cageDetails = v.get(0); |
| | | FlowCardGlassInfoDTO cageDetails = v.get(0); |
| | | //按照流程卡获取对应的产品名称 |
| | | OrderDetailsDTO orderDetails = baseMapper.queryProductNameByFlowCardId(cageDetails.getFlowCardId(), query.getProductName(), query.getCustomerName()); |
| | | OrderDetailsDTO orderDetails = this.queryProductNameByFlowCardId(cageDetails.getFlowCardId(), query.getProductName(), query.getCustomerName()); |
| | | if (null != orderDetails) { |
| | | BeanUtils.copyProperties(orderDetails, hollowAllFlowCardVO); |
| | | hollowAllFlowCardVO.setFlowCardId(e); |
| | | |
| | | if (cageDetails.getHollowSequence() == 0) { |
| | | hollowAllFlowCardVO.setIsThroughSlot(Boolean.TRUE); |
| | | } else { |
| | | hollowAllFlowCardVO.setIsThroughSlot(Boolean.FALSE); |
| | | } |
| | | List<FlowCardGlassInfoDTO> flowCardInfoList = hollowBigStorageCageDetailsService.hollowIsAll(e, cageDetails.getTotalLayer(), Boolean.FALSE); |
| | | hollowAllFlowCardVO.setFlowCardGlassInfoDTOList(flowCardInfoList); |
| | | pairTotalCount.addAndGet(flowCardInfoList.get(0).getPairCount()); |
| | | |
| | | hollowAllFlowCardVO.setFlowCardGlassInfoDTOList(v); |
| | | pairTotalCount.addAndGet(cageDetails.getPairCount()); |
| | | resultList.add(hollowAllFlowCardVO); |
| | | } |
| | | }); |
| | | Date endDate = new Date(); |
| | | log.info("客户信息数据已查询完毕,耗时:{}ms,总计耗时:{}ms", endDate.getTime() - middleDate.getTime(), endDate.getTime() - startDate.getTime()); |
| | | if (CollectionUtil.isEmpty(resultList)) { |
| | | return new ArrayList<>(); |
| | | } |
| | |
| | | } |
| | | |
| | | @Override |
| | | public Map<Integer, List<LackDetailsDTO>> queryLackByFlowCard(String flowCardId) { |
| | | List<LackDetailsDTO> lackDetailsList = this.baseMapper.queryLackByFlowCard(flowCardId); |
| | | Map<Integer, List<LackDetailsDTO>> listMap = lackDetailsList.stream().collect(Collectors.groupingBy(LackDetailsDTO::getLayer)); |
| | | return listMap; |
| | | public List<LackDetailsDTO> queryAllLackByFlowCard() { |
| | | List<LackDetailsDTO> lackDetailsList = this.baseMapper.queryAllLackByFlowCard(); |
| | | return lackDetailsList; |
| | | } |
| | | |
| | | @Override |
| | | public int queryLayerByFlowCardId(String flowCardId) { |
| | | return baseMapper.queryLayerByFlowCardId(flowCardId); |
| | | } |
| | | |
| | | @Override |
| | | public Map<Integer,List<LackDetailsDTO>> queryLackByFlowCard(String flowCardId) { |
| | | List<LackDetailsDTO> detailsDTOS = baseMapper.queryLackByFlowCard(flowCardId); |
| | | return detailsDTOS.stream().collect(Collectors.groupingBy(item -> item.getLayer())); |
| | | } |
| | | |
| | | @Override |
| | |
| | | } |
| | | return sysConfigService.queryConfigValue(sysKey); |
| | | } |
| | | // @Override |
| | | // public List<LackDetailsDTO> queryLackByFlowCard(String flowCardId) { |
| | | // List<LackDetailsDTO> lackDetailsList = this.baseMapper.queryLackByFlowCard(flowCardId); |
| | | // return lackDetailsList; |
| | | // } |
| | | |
| | | @Override |
| | | public Boolean hollowBigStorageGlassDamage(DamageRequest request) { |
| | | List<GlassInfo> glassInfos = glassInfoService.list(new LambdaQueryWrapper<GlassInfo>() |
| | | .eq(GlassInfo::getFlowCardId, request.getFlowCardId()) |
| | | .eq(GlassInfo::getLayer, request.getLayer()) |
| | | .eq(GlassInfo::getGlassType, request.getGlassType()) |
| | | .eq(request.getGlassId() != null, GlassInfo::getGlassId, request.getGlassId()) |
| | | ); |
| | | for (GlassInfo glassInfo : glassInfos) { |
| | | //掰片报破损 |
| | | damageService.autoSubmitReport(glassInfo.getGlassId(), request.getLine(), request.getWorkingProcedure(), request.getRemark(), request.getState()); |
| | | } |
| | | return Boolean.TRUE; |
| | | } |
| | | |
| | | @Override |
| | | public List<GlassInfo> queryLackGlassByFlowCard(HollowBigStorageDetailsQueryVO query) { |
| | | return baseMapper.queryLackGlassByFlowCard(query.getFlowCardId(), query.getOrderSort(), query.getLayer()); |
| | | } |
| | | |
| | | @Override |
| | | public OrderDetailsDTO queryProductNameByFlowCardId(String flowCardId, String productName, String customerName) { |
| | | OrderDetailsDTO dto = hollowGlassOutRelationInfoService.queryProductNameByFlowCardId(flowCardId); |
| | | if ((StringUtils.isBlank(productName) || dto.getProductName().contains(productName)) && (StringUtils.isBlank(customerName) || dto.getCustomerName().contains(customerName))) { |
| | | return dto; |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | |
| | | private void sortFlowCardIdList(List<HollowAllFlowCardVO> list) { |
| | | Pattern pattern = Pattern.compile("^NG(\\d+)([A-Za-z]+)(\\d+)$"); |