| | |
| | | import java.util.*; |
| | | import java.util.concurrent.*; |
| | | import java.util.function.Function; |
| | | import java.util.regex.Matcher; |
| | | import java.util.regex.Pattern; |
| | | import java.util.stream.Collectors; |
| | | |
| | | import static cn.hutool.core.convert.Convert.toDouble; |
| | |
| | | @Resource |
| | | private AsyncQueryExecutor asyncExecutor; |
| | | |
| | | |
| | | //根据在制品名称获取厚度 |
| | | private List<BigDecimal> parseGlassThicknessList(String glassName) { |
| | | List<BigDecimal> list = new ArrayList<>(); |
| | | if (glassName == null || glassName.isEmpty()) { |
| | | return list; |
| | | } |
| | | |
| | | // 匹配所有 "数字 + mm",支持小数,例如 3.2mm、5mm、8mm |
| | | Pattern pattern = Pattern.compile("(\\d+(?:\\.\\d+)?)mm"); |
| | | Matcher matcher = pattern.matcher(glassName); |
| | | |
| | | while (matcher.find()) { |
| | | String numStr = matcher.group(1); // 捕获 5、8、3.2 |
| | | try { |
| | | list.add(new BigDecimal(numStr)); |
| | | } catch (Exception ignore) { |
| | | } |
| | | } |
| | | return list; |
| | | } |
| | | |
| | | //玻璃厚度求和 |
| | | private BigDecimal calcGlassThicknessSum(String glassName) { |
| | | return parseGlassThicknessList(glassName).stream() |
| | | .reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | } |
| | | |
| | | //上工序报工班组 |
| | | private void mergeTeamsGroupsName( List<WorkInProgressDTO> dataList1,List<WorkInProgressDTO> dataList2) { |
| | |
| | | if(productDetail!=null){ |
| | | dto1.setGlassName(productDetail.getDetail()); |
| | | } |
| | | BigDecimal thicknessSum = calcGlassThicknessSum(productDetail.getDetail()); |
| | | dto1.setThickness(thicknessSum); |
| | | |
| | | //basicData.getNickname().equals("stepC") |
| | | }else if(basicData.getNickname().equals("stepC")){ |
| | | }else if(basicData.getNickname().equals("stepC")){//夹层 |
| | | OrderGlassDetail orderGlassDetailGroup = orderGlassDetailMapper |
| | | .selectOne(new QueryWrapper<OrderGlassDetail>() |
| | | .eq("order_id", dto1.getOrderId()) |
| | |
| | | orderGlassDetailMapper.getMaxTechnologyNumberByGroup(dto1.getOrderId(),dto1.getOrderNumber(), String.valueOf(orderGlassDetailGroup.getGroup())) |
| | | ); |
| | | dto1.setGlassName(glassName); |
| | | |
| | | }else{ |
| | | dto1.setGlassName(dto1.getProductName()); |
| | | BigDecimal thicknessSum = calcGlassThicknessSum(glassName); |
| | | dto1.setThickness(thicknessSum); |
| | | }else{//中空 |
| | | String glassName = productDetailMapper.getGlassName(orderDetail.getProductId()); |
| | | dto1.setGlassName(glassName); |
| | | BigDecimal thicknessSum = calcGlassThicknessSum(glassName); |
| | | dto1.setThickness(thicknessSum); |
| | | } |
| | | |
| | | } |