Sfoglia il codice sorgente

付跨查询逻辑完善

qiangxuan 2 giorni fa
parent
commit
887dd49f28

+ 1 - 1
zgztBus/jeecg-module-sbm/src/main/java/org/jeecg/modules/billet/storageBill/controller/StorageBillController.java

@@ -2112,7 +2112,7 @@ public class StorageBillController extends JeecgController<StorageBill, IStorage
 			}
 
 			// 定义需要筛选的belongTable列表
-			List<String> targetTables = Arrays.asList("roll_club_two", "roll_club_three", "roll_out_shipp", "billet_auto_tmp");
+			List<String> targetTables = Arrays.asList("roll_club_two", "roll_club_three", "roll_out_shipp", "billet_auto_tmp", "roll_deputy_cross");
 
 			// 热装过滤并计算
 			List<BilletBasicInfo> filterHotChargeList = billetBasicInfoList.stream()

+ 8 - 2
zgztBus/jeecg-module-sbm/src/main/java/org/jeecg/modules/billet/storageBill/entity/StorageBillStatistics.java

@@ -26,14 +26,18 @@ public class StorageBillStatistics {
     private Integer rollClubThreeSum;
     // 上若装运总数
     private Integer rollOutShippSum;
+    // 付跨装运总数
+    private Integer rollDeputyCrossSum;
 
 
     // 棒二装运总重
     private Double rollClubTwoTotalWeight;
-    // 棒装运总重
+    // 棒装运总重
     private Double rollClubThreeTotalWeight;
-    // 棒二装运总重
+    // 上若装运总重
     private Double rollOutShippTotalWeight;
+    // 付跨装运总重
+    private Double rollDeputyCrossTotalWeight;
 
 
     // 棒二明细
@@ -42,5 +46,7 @@ public class StorageBillStatistics {
     private List<DestinationStatisticsDetails> rollClubThreeStatisticsList;
     // 上若明细
     private List<DestinationStatisticsDetails> rollOutShippStatisticsList;
+    // 付跨明细
+    private List<DestinationStatisticsDetails> rollDeputyCrossStatisticsList;
 
 }

+ 212 - 319
zgztBus/jeecg-module-sbm/src/main/java/org/jeecg/modules/billet/storageBill/service/impl/StorageBillServiceImpl.java

@@ -468,53 +468,6 @@ public class StorageBillServiceImpl extends ServiceImpl<StorageBillMapper, Stora
     @Override
     public Map<String, Object> queryRunSummaryByCcmNoHandle(String ccmNo) {
         Map<String, Object> paramMap = Maps.newHashMapWithExpectedSize(16);
-
-        String keyShiftGroup = String.format("class:shift:group:%s", ccmNo);
-        String keyShift = String.format("class:shift:%s", ccmNo);
-        String shiftGroup = oConvertUtils.getString(redisTemplate.opsForValue().get(keyShiftGroup));
-        String shift = oConvertUtils.getString(redisTemplate.opsForValue().get(keyShift));
-
-        LambdaQueryWrapper<StorageBill> queryWrapper = new LambdaQueryWrapper<>();
-        queryWrapper.eq(StorageBill::getCcmNo, ccmNo)
-                .eq(StorageBill::getShift, shift)
-                .eq(StorageBill::getShiftGroup, shiftGroup)
-                .between(StorageBill::getCreateTime, DateUtils.getStartOfDay(), DateUtils.getEndOfDay());
-        List<StorageBill> storageBillList = baseMapper.selectList(queryWrapper);
-
-        Integer amountTotal = storageBillList.stream().map(StorageBill::getAmountTotal)
-                .reduce(0, Integer::sum);
-        Integer timesTotal = storageBillList.size();
-        Integer hotsendAmount = storageBillList.stream().filter(bill -> "辊道".equals(bill.getLicensePlate())).map(StorageBill::getAmountTotal)
-                .reduce(0, Integer::sum);
-
-        // 总车次、总支数、班组、班别
-        paramMap.put("timesTotal", timesTotal);
-        paramMap.put("amountTotal", amountTotal);
-        paramMap.put("shiftGroup", shiftGroup);
-        paramMap.put("shift", shift);
-
-        // 轧钢接收、入垛支数、起垛支数、热送支数、热送接收
-        paramMap.put("rollingReceive", 4);// 轧钢接收
-        paramMap.put("inStackAmount", 8);// 入垛支数
-        paramMap.put("outStackAmount", 12);// 起垛支数
-        paramMap.put("hotsendAmount", hotsendAmount);// 热送支数  去高线 或棒1
-        paramMap.put("hotsendReceive", 16);// 热送接收
-
-        // 棒二热装接收、热装车次、棒三热装接收、热装支数、上若热装接收、热装接收
-        paramMap.put("hotTwo", 20);// 棒二热装接收
-        paramMap.put("hotTimes", 24);// 热装车次
-        paramMap.put("hotThree", 28);// 棒三接收
-        paramMap.put("hotAmount", 32);// 热装支数
-        paramMap.put("hotSr", 36);// 上若热装接收
-        paramMap.put("hotReceive", 40);// 热装接收
-
-        // 棒二冷装接收、冷装车次、棒三冷装接收、冷装支数、上若冷装接收、冷装接收
-        paramMap.put("coldTwo", 4);// 棒二冷装接收
-        paramMap.put("coldTimes", 8);// 冷装车次
-        paramMap.put("coldThree", 12);// 棒三冷装接收
-        paramMap.put("coldAmount", 16);// 冷装支数
-        paramMap.put("coldSr", 20);// 上若冷装接收
-        paramMap.put("coldReceive", 24);// 冷装接收
         return paramMap;
     }
 
@@ -1467,7 +1420,7 @@ public class StorageBillServiceImpl extends ServiceImpl<StorageBillMapper, Stora
             shift = billetHotsendChangeShift.getShift();
         }
 
-        onDutyInfo.setBilletHotsendChangeShift(billetHotsendChangeShift);
+
         // 根据铸机号、炉号、班组、班别、交班的创建时间,查询钢坯基础信息
         LambdaQueryWrapper<BilletBasicInfo> queryWrapper2 = new LambdaQueryWrapper<>();
         queryWrapper2.eq(BilletBasicInfo::getCcmNo, ccmNo)
@@ -1493,6 +1446,28 @@ public class StorageBillServiceImpl extends ServiceImpl<StorageBillMapper, Stora
             // 当班浇铸炉总重量
             onDutyInfo.setCurrentCastingFurnace(currentCastingFurnaceWeight);
         }
+        // 重新核算总数和总重
+        LambdaQueryWrapper<BilletBasicInfo> queryWrapper3 = new LambdaQueryWrapper<>();
+        queryWrapper3.eq(BilletBasicInfo::getCcmNo, ccmNo)
+                .eq(BilletBasicInfo::getShift, shift)
+                .eq(BilletBasicInfo::getShiftGroup, shiftGroup);
+        if(oConvertUtils.isEmpty(changeShiftId)){
+            queryWrapper3.between(BilletBasicInfo::getCreateTime, billetHotsendChangeShift.getCreateTime(), new Date());
+        }else {
+            queryWrapper3.between(BilletBasicInfo::getCreateTime, billetHotsendChangeShift.getCreateTime(), billetHotsendChangeShift.getChangeShiftTime());
+        }
+        List<BilletBasicInfo> billetBasicInfoListSum = billetBasicInfoService.list(queryWrapper3);
+        if (oConvertUtils.listIsNotEmpty(billetBasicInfoListSum)){
+            // 计算 billetWeight 的总和
+            double currentTotalWeight = billetBasicInfoListSum.stream()
+                    .mapToDouble(BilletBasicInfo::getBilletWeight)
+                    .sum();
+            // 保留 4 位小数
+            BigDecimal currentShiftProduct = new BigDecimal(currentTotalWeight).setScale(4, RoundingMode.HALF_UP);
+            billetHotsendChangeShift.setShiftProduct(currentShiftProduct.doubleValue());
+            billetHotsendChangeShift.setShiftSum(billetBasicInfoListSum.size());
+            onDutyInfo.setBilletHotsendChangeShift(billetHotsendChangeShift);
+        }
         return onDutyInfo;
     }
 
@@ -1724,6 +1699,23 @@ public class StorageBillServiceImpl extends ServiceImpl<StorageBillMapper, Stora
                     onDutyStorageBillInfo.setBlankOutput(blankOutputSum);
                 }
             }
+            if ("付跨".equals(storageBill.getDestination())){
+                // 根据装运单ID查询付跨明细表,并计算出坯量
+                LambdaQueryWrapper<RollDeputyCrossDetails> queryWrapper4 = new LambdaQueryWrapper<>();
+                queryWrapper4.eq(RollDeputyCrossDetails::getCcmNo, ccmNo).eq(RollDeputyCrossDetails::getStorageBillId, storageBill.getId());
+                List<RollDeputyCrossDetails> rollDeputyCrossDetailsList = rollDeputyCrossDetailsService.list(queryWrapper4);
+                if (oConvertUtils.listIsNotEmpty(rollDeputyCrossDetailsList)) {
+                    // 统计 blankOutput 总和并保留 4 位小数
+                    double totalBlankOutput = rollDeputyCrossDetailsList.stream()
+                            .mapToDouble(RollDeputyCrossDetails::getBlankOutput)
+                            .sum();
+
+                    BigDecimal bd = new BigDecimal(totalBlankOutput);
+                    bd = bd.setScale(4, BigDecimal.ROUND_HALF_UP);
+                    double blankOutputSum = bd.doubleValue();
+                    onDutyStorageBillInfo.setBlankOutput(blankOutputSum);
+                }
+            }
             onDutyStorageBillInfos.add(onDutyStorageBillInfo);
         }
         onDutyStorageBill.setOnDutyStorageBillInfos(onDutyStorageBillInfos);
@@ -1786,6 +1778,7 @@ public class StorageBillServiceImpl extends ServiceImpl<StorageBillMapper, Stora
         List<DestinationStatisticsDetails> statisticsDetailsList1 = new ArrayList<>();
         List<DestinationStatisticsDetails> statisticsDetailsList2 = new ArrayList<>();
         List<DestinationStatisticsDetails> statisticsDetailsList3 = new ArrayList<>();
+        List<DestinationStatisticsDetails> statisticsDetailsList4 = new ArrayList<>();
 
         for (StorageBill storageBill : storageBillList) {
             if ("棒二".equals(storageBill.getDestination())) {
@@ -1871,13 +1864,45 @@ public class StorageBillServiceImpl extends ServiceImpl<StorageBillMapper, Stora
                     statisticsDetailsList3.addAll(currentList3);
                 }
             }
-        }
 
-        // 合并三个列表并根据 size 分组统计
-        List<DestinationStatisticsDetails> mergedList = Stream.concat(
-                Stream.concat(statisticsDetailsList1.stream(), statisticsDetailsList2.stream()),
-                        statisticsDetailsList3.stream()
-                ).collect(Collectors.groupingBy(DestinationStatisticsDetails::getSize))
+            if ("付跨".equals(storageBill.getDestination())) {
+                LambdaQueryWrapper<RollDeputyCrossDetails> queryWrapper4 = new LambdaQueryWrapper<>();
+                queryWrapper4.eq(RollDeputyCrossDetails::getCcmNo, ccmNo).eq(RollDeputyCrossDetails::getStorageBillId, storageBill.getId());
+                List<RollDeputyCrossDetails> rollDeputyCrossDetailsList = rollDeputyCrossDetailsService.list(queryWrapper4);
+                if (oConvertUtils.listIsNotEmpty(rollDeputyCrossDetailsList)) {
+                    List<DestinationStatisticsDetails> currentList4 = rollDeputyCrossDetailsList.stream()
+                            .collect(Collectors.groupingBy(RollDeputyCrossDetails::getSize))
+                            .entrySet().stream()
+                            .map(entry -> {
+                                String size = entry.getKey();
+                                List<RollDeputyCrossDetails> group = entry.getValue();
+                                // 统计 blankOutput 总和
+                                Double totalBlankOutput = group.stream()
+                                        .mapToDouble(RollDeputyCrossDetails::getBlankOutput)
+                                        .sum();
+                                BigDecimal bd = BigDecimal.valueOf(totalBlankOutput).setScale(4, BigDecimal.ROUND_HALF_UP);
+                                totalBlankOutput = bd.doubleValue();
+                                // 统计数量
+                                Integer totalNums = group.stream()
+                                        .mapToInt(detail -> detail.getStackAddr() != null ? 4 : 1).sum();
+                                // 取第一个元素的 ccmNo 作为该分组的 ccmNo
+                                String ccmNos = group.isEmpty() ? null : group.get(0).getCcmNo();
+                                return new DestinationStatisticsDetails(size, totalNums, totalBlankOutput, ccmNos);
+                            }).collect(Collectors.toList());
+                    statisticsDetailsList4.addAll(currentList4);
+                }
+            }
+        }
+        // 合并四个列表并根据 size 分组统计
+        List<DestinationStatisticsDetails> mergedList = Stream.of(
+                        statisticsDetailsList1,
+                        statisticsDetailsList2,
+                        statisticsDetailsList3,
+                        statisticsDetailsList4 // 新增列表
+                )
+                .filter(Objects::nonNull) // 过滤可能的 null 列表
+                .flatMap(List::stream)    // 将多个列表合并为一个流
+                .collect(Collectors.groupingBy(DestinationStatisticsDetails::getSize))
                 .entrySet().stream()
                 .map(entry -> {
                     String size = entry.getKey();
@@ -2177,6 +2202,42 @@ public class StorageBillServiceImpl extends ServiceImpl<StorageBillMapper, Stora
                 }
             });
         }
+        // 付跨统计
+        // 根据铸机号、班组、班别、时间范围。查询上若明细表
+        LambdaQueryWrapper<RollDeputyCrossDetails> queryWrapper6 = new LambdaQueryWrapper<>();
+        queryWrapper6.eq(RollDeputyCrossDetails::getCcmNo, ccmNo)
+                .eq(RollDeputyCrossDetails::getShift, shift)
+                .eq(RollDeputyCrossDetails::getShiftGroup, shiftGroup);
+        // 检查 billetHotsendChangeShift 是否为空
+        if (oConvertUtils.isEmpty(changeShiftId)) {
+            // 当 changeShiftId 为空时,时间范围从 createTime 到当前时间
+            queryWrapper6.between(RollDeputyCrossDetails::getCreateTime, billetHotsendChangeShift.getCreateTime(), new Date());
+        } else {
+            // 当 changeShiftId 不为空时,时间范围从 createTime 到 updateTime
+            queryWrapper6.between(RollDeputyCrossDetails::getCreateTime, billetHotsendChangeShift.getCreateTime(), billetHotsendChangeShift.getChangeShiftTime());
+        }
+        List<RollDeputyCrossDetails> rollDeputyCrossDetailsList = rollDeputyCrossDetailsService.list(queryWrapper6);
+        if (oConvertUtils.listIsNotEmpty(rollDeputyCrossDetailsList)){
+            // 付跨 热装总支数
+            int count = (int) rollDeputyCrossDetailsList.stream().filter(details -> details.getStackAddr() == null).count();
+            hotChargeSum = hotChargeSum + count;
+            // 付跨 热装出坯量
+            double hotChargeDeputyCrossTotalWeight = rollDeputyCrossDetailsList.stream()
+                    .filter(details -> details.getStackAddr() == null)
+                    .mapToDouble(RollDeputyCrossDetails::getBlankOutput).sum();
+            hotChargeTotalWeight = hotChargeTotalWeight + hotChargeDeputyCrossTotalWeight;
+
+            rollDeputyCrossDetailsList.forEach(x ->{
+                DetailStatistics detailStatistics = new DetailStatistics();
+                if(oConvertUtils.isEmpty(x.getStackAddr())){
+                    detailStatistics.setAmountTotal(1);
+                    detailStatistics.setBlankOutput(x.getBlankOutput());
+                    detailStatistics.setSize(x.getSize());
+                    hotChargeDetailStatisticsList.add(detailStatistics);
+                }
+            });
+        }
+
         BigDecimal finalHotChargeTotalWeight = BigDecimal.valueOf(hotChargeTotalWeight).setScale(4, BigDecimal.ROUND_HALF_UP);
         BigDecimal finalHotSendTotalWeight = BigDecimal.valueOf(hotSendTotalWeight).setScale(4, BigDecimal.ROUND_HALF_UP);
         BigDecimal finalStackingTotalWeight = BigDecimal.valueOf(stackingTotalWeight).setScale(4, BigDecimal.ROUND_HALF_UP);
@@ -2227,270 +2288,8 @@ public class StorageBillServiceImpl extends ServiceImpl<StorageBillMapper, Stora
     @Override
     public List<OnDutySizeVo> queryOnDutySize(String ccmNo, String changeShiftId) {
         List<OnDutySizeVo> list = new ArrayList<>();
-        List<SizeSummary> summaryList = new ArrayList<>();
-
-        String shiftGroup = "";
-        String shift = "";
-
-        BilletHotsendChangeShift billetHotsendChangeShift;
-        if(oConvertUtils.isEmpty(changeShiftId)){
-            // 从 Redis 获取班次信息
-            shiftGroup = getShiftInfo(ccmNo, "class:shift:group:%s");
-            shift = getShiftInfo(ccmNo, "class:shift:%s");
-            // 根据铸机号、缓存中的当前班次,倒序最新一条,获取交班记录中的创建时间
-            LambdaQueryWrapper<BilletHotsendChangeShift> queryWrapper = new LambdaQueryWrapper<>();
-            queryWrapper.eq(BilletHotsendChangeShift::getCcmNo, ccmNo)
-                    .eq(BilletHotsendChangeShift::getShift, shift)
-                    .eq(BilletHotsendChangeShift::getShiftGroup, shiftGroup)
-                    .orderByDesc(BilletHotsendChangeShift::getCreateTime)
-                    .last("limit 1");
-            billetHotsendChangeShift = billetHotsendChangeShiftService.getOne(queryWrapper);
-            if (billetHotsendChangeShift == null){
-                return list;
-            }
-        }else {
-            // 根据铸机号、交班记录ID,获取交班记录中的班别、班次、创建时间
-            LambdaQueryWrapper<BilletHotsendChangeShift> queryWrapper = new LambdaQueryWrapper<>();
-            queryWrapper.eq(BilletHotsendChangeShift::getId, changeShiftId).eq(BilletHotsendChangeShift::getCcmNo, ccmNo);
-            billetHotsendChangeShift = billetHotsendChangeShiftService.getOne(queryWrapper);
-            if (billetHotsendChangeShift == null){
-                return list;
-            }
-            shiftGroup = billetHotsendChangeShift.getShiftGroup();
-            shift = billetHotsendChangeShift.getShift();
-        }
-
-        // 根据铸机号、班组、班别、交班的创建时间,查询棒一符合条件的信息
-        LambdaQueryWrapper<RollClubOneDetails> queryWrapper1 = new LambdaQueryWrapper<>();
-        queryWrapper1.eq(RollClubOneDetails::getCcmNo, ccmNo)
-                .eq(RollClubOneDetails::getShift, shift)
-                .eq(RollClubOneDetails::getShiftGroup, shiftGroup);
-        if (oConvertUtils.isEmpty(changeShiftId)) {
-            // 当 changeShiftId 为空时,时间范围从 createTime 到当前时间
-            queryWrapper1.between(RollClubOneDetails::getCreateTime, billetHotsendChangeShift.getCreateTime(), new Date());
-        } else {
-            // 当 changeShiftId 不为空时,时间范围从 createTime 到 updateTime
-            queryWrapper1.between(RollClubOneDetails::getCreateTime, billetHotsendChangeShift.getCreateTime(), billetHotsendChangeShift.getChangeShiftTime());
-        }
-        List<RollClubOneDetails> list1 = rollClubOneDetailsService.list(queryWrapper1);
-
-        // 根据 size 分组,并统计总支数和总 BlankOutput
-        List<SizeSummary> result1 = list1.stream()
-                .collect(Collectors.groupingBy(RollClubOneDetails::getSize))
-                .entrySet().stream()
-                .map(entry -> {
-                    String size = entry.getKey();
-                    List<RollClubOneDetails> group = entry.getValue();
-
-                    // 统计总支数
-                    int totalNums = group.size();
-
-                    // 累加 BlankOutput (转换为 BigDecimal)
-                    BigDecimal totalBlankOutput = group.stream()
-                            .map(RollClubOneDetails::getBlankOutput)
-                            .filter(Objects::nonNull) // 过滤 null 值
-                            .map(BigDecimal::valueOf) // Double 转 BigDecimal
-                            .reduce(BigDecimal.ZERO, BigDecimal::add);
-
-                    // 返回处理后的分组结果
-                    return new SizeSummary(size, totalNums, totalBlankOutput);
-                }).collect(Collectors.toList());
-
-        summaryList.addAll(result1);
-
-
-        // 根据铸机号、班组、班别、交班的创建时间,查询棒二符合条件的信息
-        LambdaQueryWrapper<RollClubTwoDetails> queryWrapper2 = new LambdaQueryWrapper<>();
-        queryWrapper2.eq(RollClubTwoDetails::getCcmNo, ccmNo)
-                .eq(RollClubTwoDetails::getShift, shift)
-                .eq(RollClubTwoDetails::getShiftGroup, shiftGroup);
-        if (oConvertUtils.isEmpty(changeShiftId)) {
-            // 当 changeShiftId 为空时,时间范围从 createTime 到当前时间
-            queryWrapper2.between(RollClubTwoDetails::getCreateTime, billetHotsendChangeShift.getCreateTime(), new Date());
-        } else {
-            // 当 changeShiftId 不为空时,时间范围从 createTime 到 updateTime
-            queryWrapper2.between(RollClubTwoDetails::getCreateTime, billetHotsendChangeShift.getCreateTime(), billetHotsendChangeShift.getChangeShiftTime());
-        }
-        List<RollClubTwoDetails> list2 = rollClubTwoDetailsService.list(queryWrapper2);
-
-        // 根据 size 分组,并统计总支数和总 BlankOutput
-        List<SizeSummary> result2 = list2.stream()
-                .collect(Collectors.groupingBy(RollClubTwoDetails::getSize))
-                .entrySet().stream()
-                .map(entry -> {
-                    String size = entry.getKey();
-                    List<RollClubTwoDetails> group = entry.getValue();
-
-                    // 统计总支数,如果 stackAddr 不为空,则乘以 4
-                    int totalNums = group.stream()
-                            .mapToInt(detail -> (detail.getStackAddr() != null && !detail.getStackAddr().isEmpty()) ? 4 : 1)
-                            .sum();
-
-                    // 累加 BlankOutput (转换为 BigDecimal)
-                    BigDecimal totalBlankOutput = group.stream()
-                            .map(RollClubTwoDetails::getBlankOutput)
-                            .filter(Objects::nonNull) // 过滤 null 值
-                            .map(BigDecimal::valueOf) // Double 转 BigDecimal
-                            .reduce(BigDecimal.ZERO, BigDecimal::add);
-
-                    // 返回处理后的分组结果
-                    return new SizeSummary(size, totalNums, totalBlankOutput);
-                }).collect(Collectors.toList());
-
-        summaryList.addAll(result2);
-
 
-        // 根据铸机号、班组、班别、交班的创建时间,查询棒三符合条件的信息
-        LambdaQueryWrapper<RollClubThreeDetails> queryWrapper3 = new LambdaQueryWrapper<>();
-        queryWrapper3.eq(RollClubThreeDetails::getCcmNo, ccmNo)
-                .eq(RollClubThreeDetails::getShift, shift)
-                .eq(RollClubThreeDetails::getShiftGroup, shiftGroup);
-        if (oConvertUtils.isEmpty(changeShiftId)) {
-            // 当 changeShiftId 为空时,时间范围从 createTime 到当前时间
-            queryWrapper3.between(RollClubThreeDetails::getCreateTime, billetHotsendChangeShift.getCreateTime(), new Date());
-        } else {
-            // 当 changeShiftId 不为空时,时间范围从 createTime 到 updateTime
-            queryWrapper3.between(RollClubThreeDetails::getCreateTime, billetHotsendChangeShift.getCreateTime(), billetHotsendChangeShift.getChangeShiftTime());
-        }
-        List<RollClubThreeDetails> list3 = rollClubThreeDetailsService.list(queryWrapper3);
-
-        // 根据 size 分组,并统计总支数和总 BlankOutput
-        List<SizeSummary> result3 = list3.stream()
-                .collect(Collectors.groupingBy(RollClubThreeDetails::getSize))
-                .entrySet().stream()
-                .map(entry -> {
-                    String size = entry.getKey();
-                    List<RollClubThreeDetails> group = entry.getValue();
-
-                    // 统计总支数,如果 stackAddr 不为空,则乘以 4
-                    int totalNums = group.stream()
-                            .mapToInt(detail -> (detail.getStackAddr() != null && !detail.getStackAddr().isEmpty()) ? 4 : 1)
-                            .sum();
-
-                    // 累加 BlankOutput (转换为 BigDecimal)
-                    BigDecimal totalBlankOutput = group.stream()
-                            .map(RollClubThreeDetails::getBlankOutput)
-                            .filter(Objects::nonNull) // 过滤 null 值
-                            .map(BigDecimal::valueOf) // Double 转 BigDecimal
-                            .reduce(BigDecimal.ZERO, BigDecimal::add);
-
-                    // 返回处理后的分组结果
-                    return new SizeSummary(size, totalNums, totalBlankOutput);
-                }).collect(Collectors.toList());
-
-        summaryList.addAll(result3);
-
-
-        // 根据铸机号、班组、班别、交班的创建时间,查询高线符合条件的信息
-        LambdaQueryWrapper<RollHeightDetails> queryWrapper4 = new LambdaQueryWrapper<>();
-        queryWrapper4.eq(RollHeightDetails::getCcmNo, ccmNo)
-                .eq(RollHeightDetails::getShift, shift)
-                .eq(RollHeightDetails::getShiftGroup, shiftGroup);
-        if (oConvertUtils.isEmpty(changeShiftId)) {
-            // 当 changeShiftId 为空时,时间范围从 createTime 到当前时间
-            queryWrapper4.between(RollHeightDetails::getCreateTime, billetHotsendChangeShift.getCreateTime(), new Date());
-        } else {
-            // 当 changeShiftId 不为空时,时间范围从 createTime 到 updateTime
-            queryWrapper4.between(RollHeightDetails::getCreateTime, billetHotsendChangeShift.getCreateTime(), billetHotsendChangeShift.getChangeShiftTime());
-        }
-        List<RollHeightDetails> list4 = rollHeightDetailsService.list(queryWrapper4);
-
-        // 根据 size 分组,并统计总支数和总 BlankOutput
-        List<SizeSummary> result4 = list4.stream()
-                .collect(Collectors.groupingBy(RollHeightDetails::getSize))
-                .entrySet().stream()
-                .map(entry -> {
-                    String size = entry.getKey();
-                    List<RollHeightDetails> group = entry.getValue();
-
-                    // 统计总支数,如果 stackAddr 不为空,则乘以 4
-                    int totalNums = group.stream()
-                            .mapToInt(detail -> (detail.getStackAddr() != null && !detail.getStackAddr().isEmpty()) ? 4 : 1)
-                            .sum();
-
-                    // 累加 BlankOutput (转换为 BigDecimal)
-                    BigDecimal totalBlankOutput = group.stream()
-                            .map(RollHeightDetails::getBlankOutput)
-                            .filter(Objects::nonNull) // 过滤 null 值
-                            .map(BigDecimal::valueOf) // Double 转 BigDecimal
-                            .reduce(BigDecimal.ZERO, BigDecimal::add);
-
-                    // 返回处理后的分组结果
-                    return new SizeSummary(size, totalNums, totalBlankOutput);
-                }).collect(Collectors.toList());
-
-        summaryList.addAll(result4);
-
-
-        // 根据铸机号、班组、班别、交班的创建时间,查询上若符合条件的信息
-        LambdaQueryWrapper<RollOutShippDetails> queryWrapper5 = new LambdaQueryWrapper<>();
-        queryWrapper5.eq(RollOutShippDetails::getCcmNo, ccmNo)
-                .eq(RollOutShippDetails::getShift, shift)
-                .eq(RollOutShippDetails::getShiftGroup, shiftGroup);
-        if (oConvertUtils.isEmpty(changeShiftId)) {
-            // 当 changeShiftId 为空时,时间范围从 createTime 到当前时间
-            queryWrapper5.between(RollOutShippDetails::getCreateTime, billetHotsendChangeShift.getCreateTime(), new Date());
-        } else {
-            // 当 changeShiftId 不为空时,时间范围从 createTime 到 updateTime
-            queryWrapper5.between(RollOutShippDetails::getCreateTime, billetHotsendChangeShift.getCreateTime(), billetHotsendChangeShift.getChangeShiftTime());
-        }
-        List<RollOutShippDetails> list5 = rollOutShippDetailsService.list(queryWrapper5);
-
-        // 根据 size 分组,并统计总支数和总 BlankOutput
-        List<SizeSummary> result5 = list5.stream()
-                .collect(Collectors.groupingBy(RollOutShippDetails::getSize))
-                .entrySet().stream()
-                .map(entry -> {
-                    String size = entry.getKey();
-                    List<RollOutShippDetails> group = entry.getValue();
-
-                    // 统计总支数,如果 stackAddr 不为空,则乘以 4
-                    int totalNums = group.stream()
-                            .mapToInt(detail -> (detail.getStackAddr() != null && !detail.getStackAddr().isEmpty()) ? 4 : 1)
-                            .sum();
-
-                    // 累加 BlankOutput (转换为 BigDecimal)
-                    BigDecimal totalBlankOutput = group.stream()
-                            .map(RollOutShippDetails::getBlankOutput)
-                            .filter(Objects::nonNull) // 过滤 null 值
-                            .map(BigDecimal::valueOf) // Double 转 BigDecimal
-                            .reduce(BigDecimal.ZERO, BigDecimal::add);
-
-                    // 返回处理后的分组结果
-                    return new SizeSummary(size, totalNums, totalBlankOutput);
-                }).collect(Collectors.toList());
-
-        summaryList.addAll(result5);
-
-        // 对 summaryList 进行二次分组,聚合数据
-        List<OnDutySizeVo> onDutySizeVoList = summaryList.stream()
-                .collect(Collectors.groupingBy(SizeSummary::getSize))
-                .entrySet().stream()
-                .map(entry -> {
-                    String size = entry.getKey();
-                    List<SizeSummary> group = entry.getValue();
-
-                    // 累加 amountTotal(总支数)
-                    int totalAmount = group.stream()
-                            .mapToInt(SizeSummary::getAmountTotal)
-                            .sum();
-
-                    // 累加 totalBlankOutput(出坯量)
-                    BigDecimal totalBlankOutput = group.stream()
-                            .map(SizeSummary::getTotalBlankOutput)
-                            .filter(Objects::nonNull) // 过滤 null 值
-                            .reduce(BigDecimal.ZERO, BigDecimal::add);
-
-                    // 组装 OnDutySizeVo 结果对象
-                    OnDutySizeVo onDutySizeVo = new OnDutySizeVo();
-                    onDutySizeVo.setSize(size);
-                    onDutySizeVo.setAmountTotal(totalAmount);
-                    onDutySizeVo.setTotalBlankOutput(totalBlankOutput);
-
-                    return onDutySizeVo;
-                }).collect(Collectors.toList());
-
-        return onDutySizeVoList;
+        return list;
     }
 
     @Override
@@ -2564,9 +2363,12 @@ public class StorageBillServiceImpl extends ServiceImpl<StorageBillMapper, Stora
 
         List<DestinationStatisticsDetails> rollOutShippStatisticsList = new ArrayList<>();
 
+        List<DestinationStatisticsDetails> rollDeputyCrossStatisticsList = new ArrayList<>();
+
         List<RollClubTwoDetails> rollClubTwoDetailsListAll = new ArrayList<>();
         List<RollClubThreeDetails> rollClubThreeDetailsListAll = new ArrayList<>();
         List<RollOutShippDetails> rollOutShippDetailsListAll = new ArrayList<>();
+        List<RollDeputyCrossDetails> rollDeputyCrossDetailsListAll = new ArrayList<>();
 
         for (StorageBill storageBill : storageBillList) {
             if ("棒二".equals(storageBill.getDestination())) {
@@ -2595,6 +2397,15 @@ public class StorageBillServiceImpl extends ServiceImpl<StorageBillMapper, Stora
                     rollOutShippDetailsListAll.addAll(rollOutShippDetailsList);
                 }
             }
+
+            if ("付跨".equals(storageBill.getDestination())) {
+                LambdaQueryWrapper<RollDeputyCrossDetails> queryWrapper4 = new LambdaQueryWrapper<>();
+                queryWrapper4.eq(RollDeputyCrossDetails::getCcmNo, ccmNo).eq(RollDeputyCrossDetails::getStorageBillId, storageBill.getId());
+                List<RollDeputyCrossDetails> rollDeputyCrossDetailsList = rollDeputyCrossDetailsService.list(queryWrapper4);
+                if (oConvertUtils.listIsNotEmpty(rollDeputyCrossDetailsList)) {
+                    rollDeputyCrossDetailsListAll.addAll(rollDeputyCrossDetailsList);
+                }
+            }
         }
         if (oConvertUtils.listIsNotEmpty(rollClubTwoDetailsListAll)){
             // 分组统计
@@ -2666,19 +2477,45 @@ public class StorageBillServiceImpl extends ServiceImpl<StorageBillMapper, Stora
             rollOutShippStatisticsList.addAll(currentList3);
         }
 
+        // 付跨
+        if (oConvertUtils.listIsNotEmpty(rollDeputyCrossDetailsListAll)){
+            List<DestinationStatisticsDetails> currentList4 = rollDeputyCrossDetailsListAll.stream()
+                    .collect(Collectors.groupingBy(RollDeputyCrossDetails::getSize))
+                    .entrySet().stream()
+                    .map(entry -> {
+                        String size = entry.getKey();
+                        List<RollDeputyCrossDetails> group = entry.getValue();
+                        // 统计 blankOutput 总和
+                        Double totalBlankOutput = group.stream()
+                                .mapToDouble(RollDeputyCrossDetails::getBlankOutput)
+                                .sum();
+                        BigDecimal bd = BigDecimal.valueOf(totalBlankOutput).setScale(4, BigDecimal.ROUND_HALF_UP);
+                        totalBlankOutput = bd.doubleValue();
+                        // 统计数量
+                        Integer totalNums = group.stream()
+                                .mapToInt(detail -> detail.getStackAddr() != null ? 4 : 1).sum();
+                        // 取第一个元素的 ccmNo 作为该分组的 ccmNo
+                        String ccmNos = group.isEmpty() ? null : group.get(0).getCcmNo();
+                        return new DestinationStatisticsDetails(size, totalNums, totalBlankOutput, ccmNos);
+                    }).collect(Collectors.toList());
+            rollDeputyCrossStatisticsList.addAll(currentList4);
+        }
+
         // 计算各个列表的数量总和
         int rollClubTwoSum = calculateIntSum(rollClubTwoStatisticsList);
         int rollClubThreeSum = calculateIntSum(rollClubThreeStatisticsList);
         int rollOutShippSum = calculateIntSum(rollOutShippStatisticsList);
+        int rollDeputyCrossSum = calculateIntSum(rollDeputyCrossStatisticsList);
 
         // 计算各个列表的重量总和
         double rollClubTwoTotalWeight = calculateDoubleSum(rollClubTwoStatisticsList);
         double rollClubThreeTotalWeight = calculateDoubleSum(rollClubThreeStatisticsList);
         double rollOutShippTotalWeight = calculateDoubleSum(rollOutShippStatisticsList);
+        double rollDeputyCrossTotalWeight = calculateDoubleSum(rollDeputyCrossStatisticsList);
 
         // 计算装运总数和总重
-        int storageSum = rollClubTwoSum + rollClubThreeSum + rollOutShippSum;
-        double storageTotalWeight = rollClubTwoTotalWeight + rollClubThreeTotalWeight + rollOutShippTotalWeight;
+        int storageSum = rollClubTwoSum + rollClubThreeSum + rollOutShippSum + rollDeputyCrossSum;
+        double storageTotalWeight = rollClubTwoTotalWeight + rollClubThreeTotalWeight + rollOutShippTotalWeight +  rollDeputyCrossTotalWeight;
         // 使用 String.format 方法保留 4 位小数
         String formattedWeight = String.format("%.4f", storageTotalWeight);
 
@@ -2691,15 +2528,18 @@ public class StorageBillServiceImpl extends ServiceImpl<StorageBillMapper, Stora
         storageBillStatistics.setRollClubTwoSum(rollClubTwoSum);
         storageBillStatistics.setRollClubThreeSum(rollClubThreeSum);
         storageBillStatistics.setRollOutShippSum(rollOutShippSum);
+        storageBillStatistics.setRollDeputyCrossSum(rollDeputyCrossSum);
 
         storageBillStatistics.setRollClubTwoTotalWeight(rollClubTwoTotalWeight);
         storageBillStatistics.setRollClubThreeTotalWeight(rollClubThreeTotalWeight);
         storageBillStatistics.setRollOutShippTotalWeight(rollOutShippTotalWeight);
+        storageBillStatistics.setRollDeputyCrossTotalWeight(rollDeputyCrossTotalWeight);
 
 
         storageBillStatistics.setRollClubTwoStatisticsList(rollClubTwoStatisticsList);
         storageBillStatistics.setRollClubThreeStatisticsList(rollClubThreeStatisticsList);
         storageBillStatistics.setRollOutShippStatisticsList(rollOutShippStatisticsList);
+        storageBillStatistics.setRollDeputyCrossStatisticsList(rollDeputyCrossStatisticsList);
 
         return storageBillStatistics;
     }
@@ -2980,6 +2820,8 @@ public class StorageBillServiceImpl extends ServiceImpl<StorageBillMapper, Stora
                         x.setBelongTable("roll_club_three");
                     }else if ("roll_out_shipp".equals(billetHotsendTypeConfig.getBelongTable())){
                         x.setBelongTable("roll_out_shipp");
+                    }else if ("roll_deputy_cross".equals(billetHotsendTypeConfig.getBelongTable())){
+                        x.setBelongTable("roll_deputy_cross");
                     }
                     x.setBhtcId(billetHotsendTypeConfig.getId());
                     x.setUpdateTime(new Date());
@@ -3170,6 +3012,8 @@ public class StorageBillServiceImpl extends ServiceImpl<StorageBillMapper, Stora
                         x.setBelongTable("roll_club_three");
                     }else if ("roll_out_shipp".equals(billetHotsendTypeConfig.getBelongTable())){
                         x.setBelongTable("roll_out_shipp");
+                    }else if ("roll_deputy_cross".equals(billetHotsendTypeConfig.getBelongTable())){
+                        x.setBelongTable("roll_deputy_cross");
                     }
                     x.setBhtcId(billetHotsendTypeConfig.getId());
                     x.setUpdateTime(new Date());
@@ -3238,6 +3082,8 @@ public class StorageBillServiceImpl extends ServiceImpl<StorageBillMapper, Stora
                         billetHotsend.setRollclubthreeNum(oConvertUtils.isNotEmpty(idExistBh.getRollclubthreeNum()) ? idExistBh.getRollclubthreeNum() + groupRollClubCommonList.size() * 4  : groupRollClubCommonList.size() * 4 );
                     }else if ("roll_out_shipp".equals(billetHotsendTypeConfig.getBelongTable())){
                         billetHotsend.setRolloutshippNum(oConvertUtils.isNotEmpty(idExistBh.getRolloutshippNum()) ? idExistBh.getRolloutshippNum() + groupRollClubCommonList.size() * 4  : groupRollClubCommonList.size() * 4 );
+                    }else if ("roll_deputy_cross".equals(billetHotsendTypeConfig.getBelongTable())){
+                        billetHotsend.setRollDeputyCrossNum(oConvertUtils.isNotEmpty(idExistBh.getRollDeputyCrossNum()) ? idExistBh.getRollDeputyCrossNum() + groupRollClubCommonList.size() * 4  : groupRollClubCommonList.size() * 4 );
                     }
                     billetHotsendBaseMapper.updateById(billetHotsend);
                 }
@@ -3271,6 +3117,8 @@ public class StorageBillServiceImpl extends ServiceImpl<StorageBillMapper, Stora
                         x.setBelongTable("roll_club_three");
                     }else if ("roll_out_shipp".equals(billetHotsendTypeConfig.getBelongTable())){
                         x.setBelongTable("roll_out_shipp");
+                    }else if ("roll_deputy_cross".equals(billetHotsendTypeConfig.getBelongTable())){
+                        x.setBelongTable("roll_deputy_cross");
                     }
                     x.setBhtcId(billetHotsendTypeConfig.getId());
                     x.setUpdateTime(new Date());
@@ -3510,6 +3358,22 @@ public class StorageBillServiceImpl extends ServiceImpl<StorageBillMapper, Stora
             steelDetailsVo.setRollOutShippDetailsList(rollOutShippDetailsList);
         }
 
+        // 根据铸机号、装运单id集合或时间范围。查询付跨明细表
+        LambdaQueryWrapper<RollDeputyCrossDetails> queryWrapper6 = new LambdaQueryWrapper<>();
+        if (idList != null && !idList.isEmpty()) {
+            queryWrapper6.eq(RollDeputyCrossDetails::getCcmNo, ccmNo)
+                    .in(RollDeputyCrossDetails::getStorageBillId, idList);
+        } else {
+            queryWrapper6.eq(RollDeputyCrossDetails::getCcmNo, ccmNo)
+                    .between(RollDeputyCrossDetails::getCreateTime, billetHotsendChangeShift.getCreateTime(), new Date());
+        }
+
+        List<RollDeputyCrossDetails> rollDeputyCrossDetailsList = rollDeputyCrossDetailsService.list(queryWrapper6);
+        if (oConvertUtils.listIsNotEmpty(rollDeputyCrossDetailsList)) {
+
+            steelDetailsVo.setRollDeputyCrossDetailsList(rollDeputyCrossDetailsList);
+        }
+
         return steelDetailsVo;
     }
 
@@ -7313,6 +7177,7 @@ public class StorageBillServiceImpl extends ServiceImpl<StorageBillMapper, Stora
         List<SizeSummary> rollClubThreeList = new ArrayList<>();
         List<SizeSummary> rollHeightList = new ArrayList<>();
         List<SizeSummary> rollOutShippList = new ArrayList<>();
+        List<SizeSummary> rollDeputyCrossList = new ArrayList<>();
 
         if(oConvertUtils.listIsNotEmpty(storageBillList)) {
             for (StorageBill storageBill : storageBillList) {
@@ -7394,6 +7259,33 @@ public class StorageBillServiceImpl extends ServiceImpl<StorageBillMapper, Stora
                         rollOutShippList.addAll(currentList3);
                     }
                 }
+
+                if ("付跨".equals(storageBill.getDestination())) {
+                    LambdaQueryWrapper<RollDeputyCrossDetails> queryWrapper4 = new LambdaQueryWrapper<>();
+                    queryWrapper4.eq(RollDeputyCrossDetails::getCcmNo, ccmNo).eq(RollDeputyCrossDetails::getStorageBillId, storageBill.getId());
+                    List<RollDeputyCrossDetails> rollDeputyCrossDetailsList = rollDeputyCrossDetailsService.list(queryWrapper4);
+                    if (oConvertUtils.listIsNotEmpty(rollDeputyCrossDetailsList)) {
+                        List<SizeSummary> currentList4 = rollDeputyCrossDetailsList.stream()
+                                .collect(Collectors.groupingBy(RollDeputyCrossDetails::getSize))
+                                .entrySet().stream()
+                                .map(entry -> {
+                                    String size = entry.getKey();
+                                    List<RollDeputyCrossDetails> group = entry.getValue();
+
+                                    // 累加 BlankOutput (转换为 BigDecimal)
+                                    BigDecimal totalBlankOutput = group.stream()
+                                            .map(RollDeputyCrossDetails::getBlankOutput)
+                                            .filter(Objects::nonNull) // 过滤 null 值
+                                            .map(BigDecimal::valueOf) // Double 转 BigDecimal
+                                            .reduce(BigDecimal.ZERO, BigDecimal::add);
+                                    // 统计数量
+                                    Integer totalNums = group.stream()
+                                            .mapToInt(detail -> detail.getStackAddr() != null ? 4 : 1).sum();
+                                    return new SizeSummary(size, totalNums, totalBlankOutput);
+                                }).collect(Collectors.toList());
+                        rollDeputyCrossList.addAll(currentList4);
+                    }
+                }
             }
         }
 
@@ -7482,6 +7374,7 @@ public class StorageBillServiceImpl extends ServiceImpl<StorageBillMapper, Stora
         onDutySteelVo.setRollClubThreeList(mergeSizeSummaryList(rollClubThreeList));
         onDutySteelVo.setRollHeightList(mergeSizeSummaryList(rollHeightList));
         onDutySteelVo.setRollOutShippList(mergeSizeSummaryList(rollOutShippList));
+        onDutySteelVo.setRollDeputyCrossList(mergeSizeSummaryList(rollDeputyCrossList));
 
         return onDutySteelVo;
     }

+ 2 - 0
zgztBus/jeecg-module-sbm/src/main/java/org/jeecg/modules/billet/storageBill/vo/OnDutySteelVo.java

@@ -17,6 +17,8 @@ public class OnDutySteelVo {
 
     private List<SizeSummary> rollOutShippList;
 
+    private List<SizeSummary> rollDeputyCrossList;
+
     private String shiftGroup;
 
     private String shift;

+ 3 - 0
zgztBus/jeecg-module-sbm/src/main/java/org/jeecg/modules/billet/storageBill/vo/SteelDetailsVo.java

@@ -4,6 +4,7 @@ import lombok.Data;
 import org.jeecg.modules.billet.rollClubOne.entity.RollClubOneDetails;
 import org.jeecg.modules.billet.rollClubThree.entity.RollClubThreeDetails;
 import org.jeecg.modules.billet.rollClubTwo.entity.RollClubTwoDetails;
+import org.jeecg.modules.billet.rollDeputyCross.entity.RollDeputyCrossDetails;
 import org.jeecg.modules.billet.rollHeight.entity.RollHeightDetails;
 import org.jeecg.modules.billet.rollOutShipp.entity.RollOutShippDetails;
 import org.jeecg.modules.billet.stackingAndLoadingVehicles.entity.StackingUpLog;
@@ -24,4 +25,6 @@ public class SteelDetailsVo {
     private List<RollHeightDetails> rollHeightDetails;
 
     private List<StackingUpLog> stackingUpLogList;
+
+    private List<RollDeputyCrossDetails> rollDeputyCrossDetailsList;
 }