瀏覽代碼

update001

qiangxuan 3 天之前
父節點
當前提交
e9c7c6c60d

+ 104 - 16
zgztBus/jeecg-module-sbm/src/main/java/org/jeecg/modules/billet/billetHotsendChangeShift/controller/BilletHotsendChangeShiftController.java

@@ -18,7 +18,6 @@ import org.jeecg.common.util.DateUtils;
 import org.jeecg.common.util.oConvertUtils;
 import org.jeecg.modules.actualControl.billetActual.billetActual.entity.BilletBasicInfo;
 import org.jeecg.modules.actualControl.billetActual.billetActual.service.IBilletBasicInfoService;
-import org.jeecg.modules.actualControl.heatsActuals.service.IHeatsActualsService;
 import org.jeecg.modules.billet.billetHotsendChangeShift.entity.BilletHotsendChangeShift;
 import org.jeecg.modules.billet.billetHotsendChangeShift.entity.BilletShiftPerformance;
 import org.jeecg.modules.billet.billetHotsendChangeShift.service.IBilletHotsendChangeShiftService;
@@ -26,7 +25,6 @@ import org.jeecg.modules.billet.billetHotsendChangeShift.util.ScheduleUtils;
 import org.jeecg.modules.billet.billetHotsendChangeShift.util.ShiftInfo;
 import org.jeecg.modules.billet.billetLiftingBill.entity.BilletLiftingBill;
 import org.jeecg.modules.billet.billetLiftingBill.service.IBilletLiftingBillService;
-import org.jeecg.modules.billet.operateLog.service.IOperateLogService;
 import org.jeecg.modules.billet.rollClubOne.entity.RollClubOneDetails;
 import org.jeecg.modules.billet.rollClubOne.service.IRollClubOneDetailsService;
 import org.jeecg.modules.billet.rollClubThree.entity.RollClubThreeDetails;
@@ -35,7 +33,6 @@ import org.jeecg.modules.billet.rollClubTwo.entity.RollClubTwoDetails;
 import org.jeecg.modules.billet.rollClubTwo.service.IRollClubTwoDetailsService;
 import org.jeecg.modules.billet.rollDeputyCross.entity.RollDeputyCrossDetails;
 import org.jeecg.modules.billet.rollDeputyCross.service.IRollDeputyCrossDetailsService;
-import org.jeecg.modules.billet.rollDeputyCross.service.IRollDeputyCrossService;
 import org.jeecg.modules.billet.rollHeight.entity.DestinationStatisticsDetails;
 import org.jeecg.modules.billet.rollHeight.entity.RollHeightDetails;
 import org.jeecg.modules.billet.rollHeight.service.IRollHeightDetailsService;
@@ -61,7 +58,6 @@ import java.math.BigDecimal;
 import java.math.RoundingMode;
 import java.text.DecimalFormat;
 import java.time.LocalDateTime;
-import java.time.LocalTime;
 import java.time.YearMonth;
 import java.time.format.DateTimeFormatter;
 import java.util.*;
@@ -647,7 +643,7 @@ public class BilletHotsendChangeShiftController extends JeecgController<BilletHo
 					}
 				}
 				// 热装统计  支数、重量
-				if ("roll_club_two".equals(billetBasicInfo.getBelongTable()) || "roll_club_three".equals(billetBasicInfo.getBelongTable()) || "roll_out_shipp".equals(billetBasicInfo.getBelongTable())) {
+				if ("roll_club_two".equals(billetBasicInfo.getBelongTable()) || "roll_club_three".equals(billetBasicInfo.getBelongTable()) || "roll_out_shipp".equals(billetBasicInfo.getBelongTable()) || "roll_deputy_cross".equals(billetBasicInfo.getBelongTable())) {
 					totalCountHotfeign ++;
 					if (billetBasicInfo.getBilletWeight() != null) {
 						totalWeightHotfeign += billetBasicInfo.getBilletWeight();
@@ -686,6 +682,10 @@ public class BilletHotsendChangeShiftController extends JeecgController<BilletHo
 				lengthGroupList.add(details);
 			}
 
+			double totalBlankOutputs = billetBasicInfoList.stream().mapToDouble(BilletBasicInfo::getBilletWeight).sum();
+			BigDecimal bd = BigDecimal.valueOf(totalBlankOutputs).setScale(4, BigDecimal.ROUND_HALF_UP);
+			billetHotsendChangeShift.setShiftProduct(bd.doubleValue());
+			billetHotsendChangeShift.setShiftSum(billetBasicInfoList.size());
 
 			// 班次热送统计  支数、重量
 			billetHotsendChangeShift.setShiftHotsendWeight(totalWeightHotsend);
@@ -833,7 +833,7 @@ public class BilletHotsendChangeShiftController extends JeecgController<BilletHo
 	 * 维护到交班信息
 	 *
 	 */
-	@ApiOperation(value="5号机统计班次吊运明细、轧钢棒二、轧钢棒三、轧钢上若维护到交班信息", notes="5号机统计班次吊运明细、轧钢棒二、轧钢棒三、轧钢上若维护到交班信息")
+	@ApiOperation(value="5号机统计班次吊运明细、轧钢棒二、轧钢棒三、轧钢上若、轧钢付跨维护到交班信息", notes="5号机统计班次吊运明细、轧钢棒二、轧钢棒三、轧钢上若维护到交班信息")
 	@GetMapping(value = "/executeShiftTask555")
 	public void executeShiftTask55() {
 		log.info("5号机统计班次吊运明细、轧钢棒二、轧钢棒三、轧钢上若维护到交班信息!");
@@ -883,6 +883,7 @@ public class BilletHotsendChangeShiftController extends JeecgController<BilletHo
 		List<DestinationStatisticsDetails> statisticsDetailsList1 = new ArrayList<>();
 		List<DestinationStatisticsDetails> statisticsDetailsList2 = new ArrayList<>();
 		List<DestinationStatisticsDetails> statisticsDetailsList3 = new ArrayList<>();
+		List<DestinationStatisticsDetails> statisticsDetailsList4 = new ArrayList<>();
 		// 根据铸机号、班组、班别、交班的创建时间,交班时间,查询所有目的地是棒二的钢坯基础信息
 		LambdaQueryWrapper<BilletBasicInfo> queryWrapper1 = new LambdaQueryWrapper<>();
 		queryWrapper1.eq(BilletBasicInfo::getCcmNo, billetHotsendChangeShift.getCcmNo())
@@ -906,6 +907,11 @@ public class BilletHotsendChangeShiftController extends JeecgController<BilletHo
 		List<BilletBasicInfo> rollOutShippList = billetBasicInfoList.stream()
 				.filter(info -> "roll_out_shipp".equals(info.getBelongTable()))
 				.collect(Collectors.toList());
+
+		List<BilletBasicInfo> rollDeputyCrossList = billetBasicInfoList.stream()
+				.filter(info -> "roll_deputy_cross".equals(info.getBelongTable()))
+				.collect(Collectors.toList());
+
 		if (oConvertUtils.listIsNotEmpty(rollClubTwoList)){
 			List<DestinationStatisticsDetails> currentList1 = rollClubTwoList.stream()
 					.collect(Collectors.groupingBy(BilletBasicInfo::getLength))
@@ -964,11 +970,36 @@ public class BilletHotsendChangeShiftController extends JeecgController<BilletHo
 					}).collect(Collectors.toList());
 			statisticsDetailsList3.addAll(currentList3);
 		}
+
+		if (oConvertUtils.listIsNotEmpty(rollDeputyCrossList)){
+			List<DestinationStatisticsDetails> currentList4 = rollDeputyCrossList.stream()
+					.collect(Collectors.groupingBy(BilletBasicInfo::getLength))
+					.entrySet().stream()
+					.map(entry -> {
+						String size = String.valueOf(entry.getKey());
+						List<BilletBasicInfo> group = entry.getValue();
+						// 统计 blankOutput 总和
+						Double totalBlankOutput = group.stream()
+								.mapToDouble(BilletBasicInfo::getBilletWeight)
+								.sum();
+						BigDecimal bd = BigDecimal.valueOf(totalBlankOutput).setScale(4, BigDecimal.ROUND_HALF_UP);
+						totalBlankOutput = bd.doubleValue();
+						int totalNums = group.size();
+						String ccmNos = group.isEmpty() ? null : String.valueOf(group.get(0).getCcmNo());
+						return new DestinationStatisticsDetails(size, totalNums, totalBlankOutput, ccmNos);
+					}).collect(Collectors.toList());
+			statisticsDetailsList4.addAll(currentList4);
+		}
+
 		// 合并三个列表并根据 size 分组统计
-		List<DestinationStatisticsDetails> mergedList = Stream.concat(
-						Stream.concat(statisticsDetailsList1.stream(), statisticsDetailsList2.stream()),
-						statisticsDetailsList3.stream()
-				).collect(Collectors.groupingBy(DestinationStatisticsDetails::getSize))
+		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();
@@ -1068,6 +1099,28 @@ public class BilletHotsendChangeShiftController extends JeecgController<BilletHo
 				));
 		List<DestinationStatisticsDetails> statisticsDetailsGroup3List = new ArrayList<>(result3.values());
 		billetHotsendChangeShift.setRollClubShipDetails(JSON.toJSONString(statisticsDetailsGroup3List));
+
+
+		// 轧钢付跨明细
+		// 按照 size 分组,计算 nums 和 blankOutput 的总和,取每组第一条记录的 ccmNo
+		Map<String, DestinationStatisticsDetails> result4 = statisticsDetailsList4.stream()
+				.collect(Collectors.groupingBy(
+						DestinationStatisticsDetails::getSize,
+						Collectors.collectingAndThen(
+								Collectors.reducing((first, second) -> {
+									DestinationStatisticsDetails combined = new DestinationStatisticsDetails();
+									combined.setSize(first.getSize());
+									combined.setNums(first.getNums() + second.getNums());
+									combined.setBlankOutput(roundToFourDecimals(first.getBlankOutput() + second.getBlankOutput()));
+									combined.setCcmNo(first.getCcmNo());
+									return combined;
+								}),
+								Optional::get
+						)
+				));
+		List<DestinationStatisticsDetails> statisticsDetailsGroup4List = new ArrayList<>(result4.values());
+		billetHotsendChangeShift.setRollDeputyCrossDetails(JSON.toJSONString(statisticsDetailsGroup4List));
+
 		billetHotsendChangeShiftService.updateById(billetHotsendChangeShift);
 	}
 
@@ -1262,7 +1315,7 @@ public class BilletHotsendChangeShiftController extends JeecgController<BilletHo
 						}
 					}
 					// 热装统计  支数、重量
-					if ("roll_club_two".equals(billetBasicInfo.getBelongTable()) || "roll_club_three".equals(billetBasicInfo.getBelongTable()) || "roll_out_shipp".equals(billetBasicInfo.getBelongTable())) {
+					if ("roll_club_two".equals(billetBasicInfo.getBelongTable()) || "roll_club_three".equals(billetBasicInfo.getBelongTable()) || "roll_out_shipp".equals(billetBasicInfo.getBelongTable()) || "roll_deputy_cross".equals(billetBasicInfo.getBelongTable())) {
 						totalCountHotfeign ++;
 						if (billetBasicInfo.getBilletWeight() != null) {
 							totalWeightHotfeign += billetBasicInfo.getBilletWeight();
@@ -1384,6 +1437,7 @@ public class BilletHotsendChangeShiftController extends JeecgController<BilletHo
 				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())) {
@@ -1472,13 +1526,46 @@ public class BilletHotsendChangeShiftController extends JeecgController<BilletHo
 							statisticsDetailsList3.addAll(currentList3);
 						}
 					}
+
+					if ("付跨".equals(storageBill.getDestination())) {
+						LambdaQueryWrapper<RollDeputyCrossDetails> queryWrapper5 = new LambdaQueryWrapper<>();
+						queryWrapper5.eq(RollDeputyCrossDetails::getCcmNo, billetHotsendChangeShift1.getCcmNo())
+								.eq(RollDeputyCrossDetails::getStorageBillId, storageBill.getId());
+						List<RollDeputyCrossDetails> rollDeputyCrossDetailsList = rollDeputyCrossDetailsService.list(queryWrapper5);
+						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.concat(
-								Stream.concat(statisticsDetailsList1.stream(), statisticsDetailsList2.stream()),
-								statisticsDetailsList3.stream() // 直接使用第三个列表的流,移除第四个列表
-						).collect(Collectors.groupingBy(DestinationStatisticsDetails::getSize))
+				// 合并四个列表并根据 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();
@@ -1503,6 +1590,7 @@ public class BilletHotsendChangeShiftController extends JeecgController<BilletHo
 				billetShiftPerformance.setRollClubTwoDetailsList(statisticsDetailsList1);
 				billetShiftPerformance.setRollClubThreeDetailsList(statisticsDetailsList2);
 				billetShiftPerformance.setRollOutShippDetailsList(statisticsDetailsList3);
+				billetShiftPerformance.setRollDeputyCrossDetailsList(statisticsDetailsList4);
 			}
 
 			// 班次实绩, 统计轧钢棒一

+ 3 - 3
zgztBus/jeecg-module-sbm/src/main/java/org/jeecg/modules/billet/billetHotsendChangeShift/entity/BilletShiftPerformance.java

@@ -128,7 +128,7 @@ public class BilletShiftPerformance {
 
     @ApiModelProperty(value = "轧钢高线明细")
     private List<DestinationStatisticsDetails> rollHeightDetailsList;
-//
-//    @ApiModelProperty(value = "轧钢付跨明细")
-//    private List<DestinationStatisticsDetails> rollDeputyCrossDetailsList;
+
+    @ApiModelProperty(value = "轧钢付跨明细")
+    private List<DestinationStatisticsDetails> rollDeputyCrossDetailsList;
 }

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

@@ -685,6 +685,28 @@ public class StorageBillController extends JeecgController<StorageBill, IStorage
 					rollOutShipp.setBlankOutput(Math.max(0, rollOutShipp.getBlankOutput() - sumBlankOutput));
 					rollOutShippService.updateById(rollOutShipp);
 				}
+			}else if ("付跨".equals(storageBillVo.getDestination())) {
+				List<RollDeputyCrossDetails> rollDeputyCrossDetailsList = rollDeputyCrossDetailsService.list(new LambdaQueryWrapper<RollDeputyCrossDetails>()
+						.eq(RollDeputyCrossDetails::getStorageBillId, storageBillVo.getId())
+						.eq(RollDeputyCrossDetails::getCcmNo, storageBillVo.getCcmNo())
+						.eq(RollDeputyCrossDetails::getAssemblyNumber, storageBillVo.getAssemblyNumber()));
+				sumBlankOutput = rollDeputyCrossDetailsList.stream().mapToDouble(RollDeputyCrossDetails::getBlankOutput).sum();
+				if (oConvertUtils.listIsNotEmpty(rollDeputyCrossDetailsList)){
+					rollDeputyCrossDetailsService.removeByIds(rollDeputyCrossDetailsList.stream().map(RollDeputyCrossDetails::getId).collect(Collectors.toList()));
+				}
+				LambdaQueryWrapper<RollDeputyCross> queryWrapper = new LambdaQueryWrapper<RollDeputyCross>()
+						.eq(RollDeputyCross::getCcmNo, storageBillVo.getCcmNo())
+						.eq(RollDeputyCross::getHeatNo, finalHeatNo)
+						.eq(RollDeputyCross::getShiftGroup, shiftGroup)
+						.eq(RollDeputyCross::getShift, shift)
+						.eq(RollDeputyCross::getStorageBillId, storageBillVo.getId())
+						.last("limit 1");
+				RollDeputyCross rollDeputyCross = rollDeputyCrossService.getOne(queryWrapper);
+				if (oConvertUtils.isNotEmpty(rollDeputyCross)){
+					rollDeputyCross.setAmountTotal(Math.max(0, rollDeputyCross.getAmountTotal() - sumAmountTotal));
+					rollDeputyCross.setBlankOutput(Math.max(0, rollDeputyCross.getBlankOutput() - sumBlankOutput));
+					rollDeputyCrossService.updateById(rollDeputyCross);
+				}
 			}
 			BilletHotsendTypeConfig billetHotsendTypeConfig = new BilletHotsendTypeConfig();
 			if (oConvertUtils.isNotEmpty(storageBillVo.getStackAddr())){
@@ -813,6 +835,9 @@ public class StorageBillController extends JeecgController<StorageBill, IStorage
 			case "上若":
 				billetHotsend.setRolloutshippNum(Math.max(0, billetHotsend.getRolloutshippNum() - sumAmountTotal));
 				break;
+			case "付跨":
+				billetHotsend.setRollDeputyCrossNum(Math.max(0, billetHotsend.getRollDeputyCrossNum() - sumAmountTotal));
+				break;
 		}
 	}
 
@@ -953,19 +978,19 @@ public class StorageBillController extends JeecgController<StorageBill, IStorage
 		return Result.OK("发车成功");
 	}
 
-	@ApiOperation(value="钢坯车辆运行记录看板", notes="钢坯车辆运行记录看板")
-	@GetMapping(value = "/carRunRecordByCcmNo")
-	public Result<List<Map<String, Object>>> carRunRecordHandle(){
-		List<Map<String, Object>> result = storageBillService.carRunRecordHandle();
-		return Result.OK(result);
-	}
-
-	@ApiOperation(value="钢坯运行数据汇总-通过铸机查询", notes="钢坯运行数据汇总-通过铸机查询")
-	@GetMapping(value = "/queryRunSummaryByCcmNo")
-	public Result<Map<String, Object>> queryRunSummaryByCcmNoHandle(@RequestParam(name="ccmNo") String ccmNo) {
-		Map<String, Object> result = storageBillService.queryRunSummaryByCcmNoHandle(ccmNo);
-		return Result.OK(result);
-	}
+//	@ApiOperation(value="钢坯车辆运行记录看板", notes="钢坯车辆运行记录看板")
+//	@GetMapping(value = "/carRunRecordByCcmNo")
+//	public Result<List<Map<String, Object>>> carRunRecordHandle(){
+//		List<Map<String, Object>> result = storageBillService.carRunRecordHandle();
+//		return Result.OK(result);
+//	}
+//
+//	@ApiOperation(value="钢坯运行数据汇总-通过铸机查询", notes="钢坯运行数据汇总-通过铸机查询")
+//	@GetMapping(value = "/queryRunSummaryByCcmNo")
+//	public Result<Map<String, Object>> queryRunSummaryByCcmNoHandle(@RequestParam(name="ccmNo") String ccmNo) {
+//		Map<String, Object> result = storageBillService.queryRunSummaryByCcmNoHandle(ccmNo);
+//		return Result.OK(result);
+//	}
 
 	@AutoLog(value = "钢坯装运单未知目的地,车位1发车")
 	@ApiOperation(value="钢坯装运单未知目的地,车位1发车", notes="钢坯装运单未知目的地,车位1发车")
@@ -1066,7 +1091,9 @@ public class StorageBillController extends JeecgController<StorageBill, IStorage
 				.or()
 				.gt("rollclubthree_num", 0)
 				.or()
-				.gt("rolloutshipp_num", 0);
+				.gt("rolloutshipp_num", 0)
+				.or()
+				.gt("roll_deputy_cross_num", 0);
 
 		if (billetHotsendChangeShift != null && billetHotsendChangeShift.getCreateTime() != null) {
 			if (oConvertUtils.isNotEmpty(queryDTO.getChangeShiftId())) {
@@ -1194,6 +1221,40 @@ public class StorageBillController extends JeecgController<StorageBill, IStorage
 
 		List<RollOutShippDetails> list3 = rollOutShippDetailsService.list(rollOutShippDetailsQueryWrapper);
 
+
+		QueryWrapper<RollDeputyCrossDetails> rollDeputyCrossDetailsQueryWrapper = new QueryWrapper<>();
+		if (!hostNoList.isEmpty()) {
+			rollDeputyCrossDetailsQueryWrapper.in("heat_no", hostNoList)
+					.groupBy("heat_no");
+		}
+		if (billetHotsendChangeShift != null && billetHotsendChangeShift.getCreateTime() != null) {
+			if (oConvertUtils.isNotEmpty(queryDTO.getChangeShiftId())) {
+				// 当 changeShiftId 不为空时,时间范围从 createTime 到 updateTime
+				rollDeputyCrossDetailsQueryWrapper.between("create_time", billetHotsendChangeShift.getCreateTime(), billetHotsendChangeShift.getChangeShiftTime());
+			}
+		}
+		if (queryDTO.getCcmNo() != null) {
+			rollDeputyCrossDetailsQueryWrapper.eq("ccm_no", queryDTO.getCcmNo());
+		}
+		if (queryDTO.getShift() != null) {
+			rollDeputyCrossDetailsQueryWrapper.eq("shift", queryDTO.getShift());
+		}
+		if (queryDTO.getHeatNo() != null) {
+			String heatNo = queryDTO.getHeatNo().replace("*", "");
+			rollDeputyCrossDetailsQueryWrapper.like("heat_no", heatNo);
+		}
+		if (queryDTO.getShiftGroup() != null) {
+			rollDeputyCrossDetailsQueryWrapper.eq("shift_group", queryDTO.getShiftGroup());
+		}
+
+		rollDeputyCrossDetailsQueryWrapper
+				.isNull("stack_addr")  // stackAddr 为 NULL
+				.or()
+				.eq("stack_addr", ""); // stackAddr 为空字符串
+
+		List<RollDeputyCrossDetails> list4 = rollDeputyCrossDetailsService.list(rollDeputyCrossDetailsQueryWrapper);
+
+
 		// 使用 Set 存储唯一的 heat_no
 		Set<String> uniqueHeatNos = new HashSet<>();
 
@@ -1212,6 +1273,11 @@ public class StorageBillController extends JeecgController<StorageBill, IStorage
 			uniqueHeatNos.add(item.getHeatNo());
 		}
 
+		// 遍历 list4,提取 heat_no
+		for (RollDeputyCrossDetails item : list4) {
+			uniqueHeatNos.add(item.getHeatNo());
+		}
+
 		// 计算最终去重后的 heat_no 总数
 		int totalSize = uniqueHeatNos.size();
 
@@ -1472,6 +1538,83 @@ public class StorageBillController extends JeecgController<StorageBill, IStorage
 							.filter(StringUtils::isNotEmpty)
 							.collect(Collectors.toSet())
 			);
+
+
+			LambdaQueryWrapper<RollDeputyCrossDetails> queryWrapper4 = new LambdaQueryWrapper<>();
+			if (StringUtils.isNotEmpty(heatsActuals.getHeatsCode())) {
+				queryWrapper4.eq(RollDeputyCrossDetails::getHeatNo, heatsActuals.getHeatsCode());
+			}
+
+			if (billetHotsendChangeShift != null && billetHotsendChangeShift.getCreateTime() != null) {
+				if (oConvertUtils.isNotEmpty(queryDTO.getChangeShiftId())) {
+					// 当 changeShiftId 不为空时,时间范围从 createTime 到 updateTime
+					queryWrapper4.between(RollDeputyCrossDetails::getCreateTime, billetHotsendChangeShift.getCreateTime(), billetHotsendChangeShift.getChangeShiftTime());
+				}
+			}
+
+			queryWrapper4.isNull(RollDeputyCrossDetails::getStackAddr)  // stackAddr 为 NULL
+					.or()
+					.eq(RollDeputyCrossDetails::getStackAddr, ""); // stackAddr 为空字符串
+
+			List<RollDeputyCrossDetails> rollDeputyCrossDetailsList = rollDeputyCrossDetailsService.list(queryWrapper4);
+			// 使用 Stream API 统计 blankOutput 字段的总和
+			OptionalDouble totalBlankOutputOptional4 = rollDeputyCrossDetailsList != null ?
+					OptionalDouble.of(rollDeputyCrossDetailsList.stream()
+							.mapToDouble(details -> details.getBlankOutput() != null ? details.getBlankOutput() : 0)
+							.sum()) : OptionalDouble.empty();
+			// 将总和转换为字符串,保留两位小时,四舍五入原则
+			if (totalBlankOutputOptional4.isPresent()) {
+				// 使用 BigDecimal 进行精确计算和格式化
+				BigDecimal total = BigDecimal.valueOf(totalBlankOutputOptional4.getAsDouble());
+				// 保留两位小数
+				total = total.setScale(3, BigDecimal.ROUND_HALF_UP);
+				totalBlankOutputStr = total.toString();
+			} else {
+				totalBlankOutputStr = "0";
+			}
+
+			int totalNums4 = rollDeputyCrossDetailsList.stream()
+					.mapToInt(detail -> (detail.getStackAddr() != null && !detail.getStackAddr().isEmpty()) ? 4 : 1)
+					.sum();
+
+			totalNumsAll += totalNums4;
+
+			//如果查询出来的数据不为空,需要设置目的地为上若
+			if(!rollDeputyCrossDetailsList.isEmpty()){
+				destinations.add("付跨");
+			}
+
+			steels.addAll(
+					rollDeputyCrossDetailsList.stream()
+							.map(RollDeputyCrossDetails::getSteel)
+							.filter(StringUtils::isNotEmpty)
+							.collect(Collectors.toSet())
+			);
+			specs.addAll(
+					rollDeputyCrossDetailsList.stream()
+							.map(RollDeputyCrossDetails::getSpec)
+							.filter(StringUtils::isNotEmpty)
+							.collect(Collectors.toSet())
+			);
+			sizes.addAll(
+					rollDeputyCrossDetailsList.stream()
+							.map(RollDeputyCrossDetails::getSize)
+							.filter(StringUtils::isNotEmpty)
+							.collect(Collectors.toSet())
+			);
+			licensePlates.addAll(
+					rollDeputyCrossDetailsList.stream()
+							.map(RollDeputyCrossDetails::getLicensePlate)
+							.filter(StringUtils::isNotEmpty)
+							.collect(Collectors.toSet())
+			);
+			assemblyNumbers.addAll(
+					rollDeputyCrossDetailsList.stream()
+							.map(RollDeputyCrossDetails::getAssemblyNumber)
+							.filter(StringUtils::isNotEmpty)
+							.collect(Collectors.toSet())
+			);
+
 			//将分组去重的内容使用逗号去分割
 			String steelStr = String.join(",", steels);
 			String specStr = String.join(",", specs);
@@ -1481,24 +1624,32 @@ public class StorageBillController extends JeecgController<StorageBill, IStorage
 			String destinationStr = String.join(",", destinations);
 
 			// 获取所有 createTime 字段的最小值
-			Optional<Date> earliestCreateTime = Stream.of(
-							rollClubTwoDetailsList.stream().map(RollClubTwoDetails::getCreateTime),
-							rollClubThreeDetailsList.stream().map(RollClubThreeDetails::getCreateTime),
-							rollOutShippDetailsList.stream().map(RollOutShippDetails::getCreateTime)
-					).flatMap(Function.identity())  // 合并所有流
-					.filter(Objects::nonNull)      // 过滤掉 null
-					.min(Date::compareTo);         // 找出最早的时间
+			Optional<Date> earliestCreateTime = Stream.concat(
+							Stream.concat(
+									rollClubTwoDetailsList.stream().map(RollClubTwoDetails::getCreateTime),
+									rollClubThreeDetailsList.stream().map(RollClubThreeDetails::getCreateTime)
+							),
+							Stream.concat(
+									rollOutShippDetailsList.stream().map(RollOutShippDetails::getCreateTime),
+									rollDeputyCrossDetailsList.stream().map(RollDeputyCrossDetails::getCreateTime)
+							)
+					).filter(Objects::nonNull)
+					.min(Date::compareTo);
 
 			// 设置最早的 createTime
 			bill.setCreateTime(earliestCreateTime.orElse(null)); // 如果为空,保持 null
 
 			// 获取所有 createTime 字段的最小值
-			Optional<Date> earliestUpdateTime = Stream.of(
-							rollClubTwoDetailsList.stream().map(RollClubTwoDetails::getUpdateTime),
-							rollClubThreeDetailsList.stream().map(RollClubThreeDetails::getUpdateTime),
-							rollOutShippDetailsList.stream().map(RollOutShippDetails::getUpdateTime)
-					).flatMap(Function.identity())  // 合并所有流
-					.filter(Objects::nonNull)      // 过滤掉 null
+			Optional<Date> earliestUpdateTime = Stream.concat(
+							Stream.concat(
+									rollClubTwoDetailsList.stream().map(RollClubTwoDetails::getUpdateTime),
+									rollClubThreeDetailsList.stream().map(RollClubThreeDetails::getUpdateTime)
+							),
+							Stream.concat(
+									rollOutShippDetailsList.stream().map(RollOutShippDetails::getUpdateTime),
+									rollDeputyCrossDetailsList.stream().map(RollDeputyCrossDetails::getUpdateTime)
+							)
+					).filter(Objects::nonNull)      // 过滤掉 null
 					.min(Date::compareTo);         // 找出最早的时间
 
 			// 设置最早的 createTime
@@ -1515,6 +1666,9 @@ public class StorageBillController extends JeecgController<StorageBill, IStorage
 			}else if (!rollOutShippDetailsList.isEmpty()) {
 				shiftGroup = rollOutShippDetailsList.get(0).getShiftGroup();
 				shift = rollOutShippDetailsList.get(0).getShift();
+			}else if (!rollDeputyCrossDetailsList.isEmpty()) {
+				shiftGroup = rollDeputyCrossDetailsList.get(0).getShiftGroup();
+				shift = rollDeputyCrossDetailsList.get(0).getShift();
 			}
 
 
@@ -1540,7 +1694,7 @@ public class StorageBillController extends JeecgController<StorageBill, IStorage
 		list.sort(Comparator.comparing(StorageBill::getCreateTime, Comparator.nullsLast(Comparator.reverseOrder())));
 		//设置最后返回的分页内容
 		billPageList.setRecords(list);
-		billPageList.setTotal(totalSize);
+		billPageList.setTotal(list.size());
 		return Result.OK(billPageList);
 	}
 

+ 0 - 4
zgztBus/jeecg-module-sbm/src/main/java/org/jeecg/modules/billet/storageBill/service/IStorageBillService.java

@@ -30,10 +30,6 @@ public interface IStorageBillService extends IService<StorageBill> {
 
     JSONObject storageBillSave(StorageBill storageBill);
 
-    List<Map<String, Object>> carRunRecordHandle();
-
-    Map<String, Object> queryRunSummaryByCcmNoHandle(String ccmNo);
-
     List<StorageBill> queryStorageBillByPositionNum();
 
     JSONObject addParkingSpaceDepart(StorageBill storageBill);

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

@@ -7,9 +7,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
 import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
 import com.baomidou.mybatisplus.core.toolkit.IdWorker;
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import com.google.common.collect.Maps;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.collections.CollectionUtils;
 import org.apache.commons.lang.StringUtils;
@@ -54,7 +52,6 @@ import org.jeecg.modules.billet.rollDeputyCross.service.IRollDeputyCrossDetailsS
 import org.jeecg.modules.billet.rollDeputyCross.service.IRollDeputyCrossService;
 import org.jeecg.modules.billet.rollHeight.entity.DestinationStatisticsDetails;
 import org.jeecg.modules.billet.rollHeight.entity.RollHeightDetails;
-import org.jeecg.modules.billet.rollHeight.mapper.RollHeightDetailsMapper;
 import org.jeecg.modules.billet.rollHeight.service.IRollHeightDetailsService;
 import org.jeecg.modules.billet.rollOutShipp.entity.RollOutShipp;
 import org.jeecg.modules.billet.rollOutShipp.entity.RollOutShippDetails;
@@ -91,7 +88,6 @@ import java.time.format.DateTimeFormatter;
 import java.util.*;
 import java.util.concurrent.atomic.AtomicLong;
 import java.util.function.Function;
-import java.util.function.Predicate;
 import java.util.stream.Collectors;
 import java.util.stream.Stream;
 
@@ -414,64 +410,6 @@ public class StorageBillServiceImpl extends ServiceImpl<StorageBillMapper, Stora
         billetHotsendChangeShiftService.updateById(billetHotsendChangeShift);
     }
 
-    @Override
-    public List<Map<String, Object>> carRunRecordHandle() {
-        List<Map<String, Object>> result = new ArrayList<>();
-        String keyShiftGroupsix = String.format("class:shift:group:%s", "6");
-        String keyShiftsix = String.format("class:shift:%s", "6");
-
-        String sixShiftGroup = oConvertUtils.getString(redisTemplate.opsForValue().get(keyShiftGroupsix));
-        String sixShift = oConvertUtils.getString(redisTemplate.opsForValue().get(keyShiftsix));
-
-        String keyShiftGroupfive = String.format("class:shift:group:%s", "5");
-        String keyShiftfive = String.format("class:shift:%s", "5");
-
-        String fiveShiftGroup = oConvertUtils.getString(redisTemplate.opsForValue().get(keyShiftGroupfive));
-        String fiveShift = oConvertUtils.getString(redisTemplate.opsForValue().get(keyShiftfive));
-
-        LambdaQueryWrapper<StorageBill> queryWrapper = new LambdaQueryWrapper<>();
-        queryWrapper.eq(StorageBill::getCcmNo, "6")
-                .eq(StorageBill::getShift, sixShift)
-                .eq(StorageBill::getShiftGroup, sixShiftGroup)
-                .between(StorageBill::getCreateTime, DateUtils.getStartOfDay(), DateUtils.getEndOfDay())
-                .isNull(StorageBill::getOutTime)
-                .orderByDesc(StorageBill::getCreateTime);
-        // 使用or来拼接以5为条件的部分
-        if (oConvertUtils.isNotEmpty(fiveShiftGroup) && oConvertUtils.isNotEmpty(fiveShift)) {
-            queryWrapper.or(wrapper -> wrapper
-                    .eq(StorageBill::getCcmNo, "5")
-                    .eq(StorageBill::getShift, fiveShift)
-                    .eq(StorageBill::getShiftGroup, fiveShiftGroup)
-                    .between(StorageBill::getCreateTime, DateUtils.getStartOfDay(), DateUtils.getEndOfDay())
-                    .isNull(StorageBill::getOutTime)
-            );
-        }
-        List<StorageBill> storageBillList = baseMapper.selectList(queryWrapper);
-
-        storageBillList.forEach(x ->{
-            Map<String, Object> paramMap = Maps.newHashMapWithExpectedSize(16);
-            paramMap.put("licensePlate", x.getLicensePlate());// 车号
-            String finalCurrentAddr = "";
-            if (oConvertUtils.isNotEmpty(x.getDestination())){
-                finalCurrentAddr = x.getCcmNo() + "#机——" + x.getDestination();
-            }else {
-                finalCurrentAddr = x.getCcmNo() + "#机";
-            }
-            paramMap.put("currentAddr", finalCurrentAddr);// 当前位置
-            paramMap.put("spec", x.getSpec());// 规格
-            paramMap.put("size", x.getSize());// 定尺
-            paramMap.put("amountTotal", x.getAmountTotal());// 钢坯总数
-            result.add(paramMap);
-        });
-        return result;
-    }
-
-    @Override
-    public Map<String, Object> queryRunSummaryByCcmNoHandle(String ccmNo) {
-        Map<String, Object> paramMap = Maps.newHashMapWithExpectedSize(16);
-        return paramMap;
-    }
-
     @Override
     public List<StorageBill> queryStorageBillByPositionNum() {
         List<StorageBill> storageBillList = baseMapper.selectList(new LambdaQueryWrapper<StorageBill>()
@@ -7803,6 +7741,7 @@ public class StorageBillServiceImpl extends ServiceImpl<StorageBillMapper, Stora
         List<RollClubTwoDetails> addRollClubTwoDetailsList = new ArrayList<>();
         List<RollClubThreeDetails> addRollClubThreeDetailsList = new ArrayList<>();
         List<RollOutShippDetails> addRollOutShippDetailsList = new ArrayList<>();
+        List<RollDeputyCrossDetails> addRollDeputyCrossDetailsList = new ArrayList<>();
 
         stackingAndLoadingVehiclesList.forEach(x ->{
             // 根据坯号查询 对应的钢坯基础信息,获取到炉号
@@ -8001,6 +7940,8 @@ public class StorageBillServiceImpl extends ServiceImpl<StorageBillMapper, Stora
             rollClubThreeDetailsService.saveBatch(addRollClubThreeDetailsList);
         }else if ("roll_out_shipp".equals(billetHotsendTypeConfig.getBelongTable())){
             rollOutShippDetailsService.saveBatch(addRollOutShippDetailsList);
+        }else if ("roll_deputy_cross".equals(billetHotsendTypeConfig.getBelongTable())){
+            rollDeputyCrossDetailsService.saveBatch(addRollDeputyCrossDetailsList);
         }
 
     }