feat(anneal-performance): 添加退火性能查询中的钢卷号筛选功能

- 在 WmsAnnealPerformanceMapper.xml 中添加钢卷号筛选的关联查询逻辑
- 在 WmsAnnealPerformanceServiceImpl 中实现钢卷号筛选的功能
- 添加筛选后统计数据重新计算的逻辑
- 实现过滤不匹配钢卷的跳过机制
- 添加过滤后无数据计划的移除处理
- 更新汇总统计信息以反映筛选后的实际数据
This commit is contained in:
2026-04-27 11:31:22 +08:00
parent 3e0859d4ce
commit fe048ff91f
2 changed files with 39 additions and 1 deletions

View File

@@ -21,6 +21,7 @@ import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.stereotype.Service;
import java.math.BigDecimal;
import java.util.*;
import java.util.stream.Collectors;
@@ -103,6 +104,11 @@ public class WmsAnnealPerformanceServiceImpl implements IWmsAnnealPerformanceSer
}
}
// 用于重新计算统计信息
Long filteredPlanCount = 0L;
Long filteredCoilCount = 0L;
BigDecimal filteredTotalWeight = BigDecimal.ZERO;
// 处理每个计划
for (WmsAnnealPerformanceDetailVo detail : details) {
Long planId = detail.getPlanId();
@@ -134,9 +140,37 @@ public class WmsAnnealPerformanceServiceImpl implements IWmsAnnealPerformanceSer
// 设置炉火层级
coilVo.setFurnaceLevel(planCoil.getFurnaceLevel());
// 如果传入了enterCoilNo筛选条件只保留匹配的钢卷
if (bo.getEnterCoilNo() != null && !bo.getEnterCoilNo().isEmpty()) {
if (coilVo.getEnterCoilNo() == null ||
!coilVo.getEnterCoilNo().contains(bo.getEnterCoilNo())) {
continue; // 跳过不匹配的钢卷
}
}
coilVos.add(coilVo);
}
detail.setCoils(coilVos);
// 如果过滤后没有钢卷,跳过该计划
if (!coilVos.isEmpty()) {
detail.setCoils(coilVos);
filteredPlanCount++;
filteredCoilCount += coilVos.size();
BigDecimal planWeight = coilVos.stream()
.map(c -> c.getNetWeight() != null ? c.getNetWeight() : BigDecimal.ZERO)
.reduce(BigDecimal.ZERO, BigDecimal::add);
filteredTotalWeight = filteredTotalWeight.add(planWeight);
}
}
// 移除没有钢卷的计划
details.removeIf(detail -> detail.getCoils() == null || detail.getCoils().isEmpty());
// 如果传入了enterCoilNo筛选条件重新计算统计信息
if (bo.getEnterCoilNo() != null && !bo.getEnterCoilNo().isEmpty()) {
summary.setPlanCount(filteredPlanCount);
summary.setCoilCount(filteredCoilCount);
summary.setTotalWeight(filteredTotalWeight);
}
}
}