|
@@ -1130,32 +1130,40 @@ public class BilletOriginalProductRecordController extends JeecgController<Bille
|
|
.filter(info -> "stacking_and_loading_vehicles".equals(info.getBelongTable()))
|
|
.filter(info -> "stacking_and_loading_vehicles".equals(info.getBelongTable()))
|
|
.collect(Collectors.toList());
|
|
.collect(Collectors.toList());
|
|
if (oConvertUtils.listIsNotEmpty(filterStackList)){
|
|
if (oConvertUtils.listIsNotEmpty(filterStackList)){
|
|
- // 按定尺长度分组
|
|
|
|
- Map<Integer, List<BilletBasicInfo>> lengthGroupMap = filterStackList.stream()
|
|
|
|
- .filter(info -> info.getLength() != null)
|
|
|
|
- .collect(Collectors.groupingBy(BilletBasicInfo::getLength));
|
|
|
|
|
|
+ // 按定尺长度和所属对应ID分组
|
|
|
|
+ Map<String, List<BilletBasicInfo>> lengthAndBhtcGroupMap = filterStackList.stream()
|
|
|
|
+ .filter(info -> info.getLength() != null && info.getBhtcId() != null)
|
|
|
|
+ .collect(Collectors.groupingBy(info ->
|
|
|
|
+ info.getLength() + "_" + info.getBhtcId()
|
|
|
|
+ ));
|
|
|
|
|
|
// 构建分组统计结果列表
|
|
// 构建分组统计结果列表
|
|
List<Map<String, Object>> lengthGroupList = new ArrayList<>();
|
|
List<Map<String, Object>> lengthGroupList = new ArrayList<>();
|
|
|
|
|
|
- for (Map.Entry<Integer, List<BilletBasicInfo>> entry : lengthGroupMap.entrySet()) {
|
|
|
|
- Integer length = entry.getKey();
|
|
|
|
|
|
+ for (Map.Entry<String, List<BilletBasicInfo>> entry : lengthAndBhtcGroupMap.entrySet()) {
|
|
|
|
+ String key = entry.getKey();
|
|
List<BilletBasicInfo> billets = entry.getValue();
|
|
List<BilletBasicInfo> billets = entry.getValue();
|
|
|
|
|
|
- // 计算该定尺长度的总重(保留4位小数)
|
|
|
|
- double lengthWeight = billets.stream()
|
|
|
|
- .mapToDouble(BilletBasicInfo::getBilletWeight)
|
|
|
|
- .sum();
|
|
|
|
|
|
+ // 解析分组键获取定尺长度和BhtcId
|
|
|
|
+ String[] parts = key.split("_");
|
|
|
|
+ Integer length = Integer.parseInt(parts[0]);
|
|
|
|
+ String bhtcId = parts[1];
|
|
|
|
+
|
|
|
|
+ // 计算该分组的总重(保留4位小数)
|
|
|
|
+ double lengthWeight = billets.stream().mapToDouble(BilletBasicInfo::getBilletWeight).sum();
|
|
|
|
+
|
|
lengthWeight = Math.round(lengthWeight * 10000) / 10000.0;
|
|
lengthWeight = Math.round(lengthWeight * 10000) / 10000.0;
|
|
|
|
|
|
- // 统计该定尺长度的数量
|
|
|
|
|
|
+ // 统计该分组的数量
|
|
int lengthCount = billets.size();
|
|
int lengthCount = billets.size();
|
|
|
|
|
|
- // 构建该定尺长度的统计结果
|
|
|
|
|
|
+ // 构建该分组的统计结果
|
|
Map<String, Object> lengthStat = new HashMap<>();
|
|
Map<String, Object> lengthStat = new HashMap<>();
|
|
lengthStat.put("stackingWeight", lengthWeight);
|
|
lengthStat.put("stackingWeight", lengthWeight);
|
|
lengthStat.put("stackingCount", lengthCount);
|
|
lengthStat.put("stackingCount", lengthCount);
|
|
lengthStat.put("stackingLength", length);
|
|
lengthStat.put("stackingLength", length);
|
|
|
|
+ lengthStat.put("stackingBhtcId", bhtcId);
|
|
|
|
+
|
|
// 添加到结果列表
|
|
// 添加到结果列表
|
|
lengthGroupList.add(lengthStat);
|
|
lengthGroupList.add(lengthStat);
|
|
}
|
|
}
|