guoqiang 1 ay önce
ebeveyn
işleme
e687f9ec74

+ 94 - 564
zgztBus/jeecg-module-sbm/src/main/java/org/jeecg/modules/billet/billetOriginalProductRecord/controller/BilletOriginalProductRecordController.java

@@ -849,141 +849,74 @@ public class BilletOriginalProductRecordController extends JeecgController<Bille
 	 @ApiOperation(value="钢坯棒一棒二棒三上若统计明细查询", notes="钢坯棒一棒二棒三上若统计明细查询")
 	 @GetMapping(value = "/queryBilletStatisticsDetailByCcmNo")
 	 public Result<List<BilletDetailsInfo>> queryBilletStatisticsDetailByCcmNo(@RequestParam(name="ccmNo") String ccmNo,
-																	 		   @RequestParam(name="changeShiftId", required = false) String changeShiftId,
-																			   @RequestParam(name="queryDate", required = false) String queryDate,
-																	           @RequestParam(name="queryType") String queryType) {
+																	 		   @RequestParam(name="changeShiftId", required = false, defaultValue = "") String changeShiftId,
+																			   @RequestParam(name="queryDate", required = false, defaultValue = "") String queryDate,
+																			   @RequestParam(name="startTime", required = false, defaultValue = "") String startTime,
+																			   @RequestParam(name="endTime", required = false, defaultValue = "") String endTime,
+																	           @RequestParam(name="queryType") String queryType,
+																			   @RequestParam(name="heatNo", required = false, defaultValue = "") String heatNo,
+																			   @RequestParam(name="licensePlate", required = false, defaultValue = "") String licensePlate) {
 		 List<BilletDetailsInfo> billetDetailsInfoList = new ArrayList<>();
 		 if (queryType.equals("1") && oConvertUtils.isNotEmpty(queryDate)){
 			 // 查询棒一,指定日期的统计明细
-			 billetDetailsInfoList = queryRollClubOneStatisticsByDate(ccmNo, queryDate);
-		 }else if(queryType.equals("1") && oConvertUtils.isNotEmpty(changeShiftId)){
-			 // 查询棒一,指定班次的统计明细
-			 billetDetailsInfoList = queryRollClubOneStatisticsByShiftId(ccmNo, changeShiftId);
-		 }else if(queryType.equals("2") && oConvertUtils.isNotEmpty(queryDate)){
-			 // 查询棒二,指定班次的统计明细
-			 billetDetailsInfoList = queryRollClubTwoStatisticsByDate(ccmNo, queryDate);
-		 }else if(queryType.equals("2") && oConvertUtils.isNotEmpty(changeShiftId)){
-			 // 查询棒二,指定班次的统计明细
-			 billetDetailsInfoList = queryRollClubTwoStatisticsByShiftId(ccmNo, changeShiftId);
-		 }else if(queryType.equals("3") && oConvertUtils.isNotEmpty(queryDate)){
-			 // 查询棒三,指定班次的统计明细
-			 billetDetailsInfoList = queryRollClubThreeStatisticsByDate(ccmNo, queryDate);
-		 }else if(queryType.equals("3") && oConvertUtils.isNotEmpty(changeShiftId)){
-			 // 查询棒三,指定班次的统计明细
-			 billetDetailsInfoList = queryRollClubThreeStatisticsByShiftId(ccmNo, changeShiftId);
-		 }else if(queryType.equals("4") && oConvertUtils.isNotEmpty(queryDate)){
-			 // 查询上若,指定班次的统计明细
-			 billetDetailsInfoList = queryRollOutShippStatisticsByDate(ccmNo, queryDate);
-		 }else if(queryType.equals("4") && oConvertUtils.isNotEmpty(changeShiftId)){
-			 // 查询上若,指定班次的统计明细
-			 billetDetailsInfoList = queryRollOutShippStatisticsByShiftId(ccmNo, changeShiftId);
+			 billetDetailsInfoList = queryRollClubOneStatistics(ccmNo,  changeShiftId, queryDate, heatNo, startTime, endTime);
+		 }else if(queryType.equals("2")){ // 查询棒二,指定班次的统计明细
+			 billetDetailsInfoList = querSstorageBillPrintStatistics(ccmNo, "棒二", changeShiftId, queryDate, heatNo, licensePlate, startTime, endTime);
+		 }else if(queryType.equals("3")){  // 查询棒三,指定班次的统计明细
+			 billetDetailsInfoList = querSstorageBillPrintStatistics(ccmNo, "棒三", changeShiftId, queryDate, heatNo, licensePlate, startTime, endTime);
+		 }else if(queryType.equals("4")){ // 查询上若,指定班次的统计明细
+			 billetDetailsInfoList = querSstorageBillPrintStatistics(ccmNo, "上若", changeShiftId, queryDate, heatNo, licensePlate, startTime, endTime);
 		 }
 		 return Result.OK(billetDetailsInfoList);
 	 }
-
 	 /**
 	  * 棒一统计明细查询
 	  * @param ccmNo
-	  * @param queryDate
+	  * @param changeShiftId
 	  * @return
 	  */
-	 private List<BilletDetailsInfo> queryRollClubOneStatisticsByDate(String ccmNo, String queryDate) {
+	 private List<BilletDetailsInfo> queryRollClubOneStatistics(String ccmNo, String changeShiftId, String queryDate, String heatNo, String startTimes, String endTimes) {
 		 List<BilletDetailsInfo> billetDetailsInfoList = new ArrayList<>();
-		 String queryDateTime = queryDate + " 00:00:00";
-		 Date date = DateUtils.parseDatetime(queryDateTime);
-		 Date startTime = DateUtils.getStartOfDayByDate(date);
-		 Date endTime = DateUtils.getEndOfDayByDate(date);
-
-		 // 通过铸机号、开始时间、结束时间查询
-		 QueryWrapper<BilletOriginalProductRecord> queryWrapper = new QueryWrapper<>();
-		 queryWrapper.eq("ccm_no", ccmNo);
-		 queryWrapper.between("create_time", startTime, endTime);
-		 List<BilletOriginalProductRecord> billetOriginalProductRecordList = billetOriginalProductRecordService.list(queryWrapper);
-		 if (oConvertUtils.listIsEmpty(billetOriginalProductRecordList)){
-			 return billetDetailsInfoList;
-		 }
-
-		 Map<String, BilletStatisticsDetail> statisticsMap = new HashMap<>();
-
-		 int grandTotalCount = 0;
-		 double grandTotalWeight = 0.0d;
-
-		 for (BilletOriginalProductRecord record : billetOriginalProductRecordList) {
-			 String rollClubOneDetails = record.getRollClubOneDetails();
-			 if (rollClubOneDetails != null && !rollClubOneDetails.isEmpty()) {
-				 try {
-					 JSONObject detailsJson = JSON.parseObject(rollClubOneDetails);
-					 // 此处totalCount未被使用,可以考虑移除
-					 int totalCount = detailsJson.getIntValue("directRollingTotalCount");
-					 grandTotalCount += totalCount;
-
-					 JSONObject lengthGroupCount = detailsJson.getJSONObject("lengthGroupCount");
-					 if (lengthGroupCount != null) {
-						 for (Map.Entry<String, Object> entry : lengthGroupCount.entrySet()) {
-							 String size = entry.getKey();
-							 // 增加类型检查,避免潜在的空指针异常
-							 int count = Integer.parseInt(entry.getValue().toString());
-							 double sizeValue = Double.parseDouble(size);
-							 updateStatistics(statisticsMap, size, count, sizeValue);
-						 }
-					 }
-				 } catch (Exception e) {
-					 log.error("解析rollClubOneDetails失败: {}", rollClubOneDetails, e);
-				 }
+		 LambdaQueryWrapper<BilletOriginalProductRecord> queryWrapper = new LambdaQueryWrapper<>();
+		 queryWrapper.eq(BilletOriginalProductRecord::getCcmNo, ccmNo);
+		 if(oConvertUtils.isNotEmpty(changeShiftId)) { // 班组为空取班组时间
+			 // 根据铸机号、交班记录ID,获取交班记录中的班别、班次、创建时间
+			 LambdaQueryWrapper<BilletHotsendChangeShift> changeQueryWrapper = new LambdaQueryWrapper<>();
+			 changeQueryWrapper.eq(BilletHotsendChangeShift::getId, changeShiftId).eq(BilletHotsendChangeShift::getCcmNo, ccmNo);
+			 BilletHotsendChangeShift billetHotsendChangeShift = billetHotsendChangeShiftService.getOne(changeQueryWrapper);
+			 if (billetHotsendChangeShift == null){
+				 log.info("{}{}", "查询指定班次,交班记录为空!", ccmNo + "交班ID:" + changeShiftId);
+				 return billetDetailsInfoList;
 			 }
+			 String shift = billetHotsendChangeShift.getShift();
+			 String shiftGroup = billetHotsendChangeShift.getShiftGroup();
+			 Date startTime = billetHotsendChangeShift.getCreateTime();
+			 Date endTime;
+			 if (oConvertUtils.isEmpty(billetHotsendChangeShift.getChangeShiftTime())) {
+				 endTime = new Date();
+			 } else {
+				 endTime = billetHotsendChangeShift.getChangeShiftTime();
+			 }
+			 queryWrapper.eq(BilletOriginalProductRecord::getShift, shift);
+			 queryWrapper.eq(BilletOriginalProductRecord::getShiftGroup, shiftGroup);
+			 queryWrapper.between(BilletOriginalProductRecord::getCreateTime, startTime, endTime);
+		 } else if(oConvertUtils.isNotEmpty(startTimes) && oConvertUtils.isNotEmpty(endTimes)){ // 时间范围
+			 queryWrapper.between(BilletOriginalProductRecord::getCreateTime, startTimes, endTimes);
+		 } else if (oConvertUtils.isNotEmpty(queryDate)) { // 独立时间处理
+			 String queryDateTime = queryDate + " 00:00:00";
+			 Date date = DateUtils.parseDatetime(queryDateTime);
+			 Date startTime = DateUtils.getStartOfDayByDate(date);
+			 Date endTime = DateUtils.getEndOfDayByDate(date);
+			 queryWrapper.between(BilletOriginalProductRecord::getCreateTime, startTime, endTime);
 		 }
-		 grandTotalWeight = statisticsMap.values().stream()
-				 .mapToDouble(BilletStatisticsDetail::getBlankOutput)
-				 .sum();
-
-		 if (!statisticsMap.isEmpty()) {
-			 BilletDetailsInfo info = new BilletDetailsInfo();
-			 info.setCcmNo(ccmNo);
-			 info.setCounts(grandTotalCount);
-			 info.setTotalWeight(grandTotalWeight);
-
-			 List<BilletStatisticsDetail> detailsList = new ArrayList<>(statisticsMap.values());
-			 info.setRollClubOneStatisticsList(detailsList);
-
-			 billetDetailsInfoList.add(info);
+		 // 炉号查询
+		 if (oConvertUtils.isNotEmpty(heatNo)) {
+			 queryWrapper.like(BilletOriginalProductRecord::getHeatNo, heatNo);
 		 }
 
-		 return billetDetailsInfoList;
-	 }
-	 /**
-	  * 棒一统计明细查询
-	  * @param ccmNo
-	  * @param changeShiftId
-	  * @return
-	  */
-	 private List<BilletDetailsInfo> queryRollClubOneStatisticsByShiftId(String ccmNo, String changeShiftId) {
-		 List<BilletDetailsInfo> billetDetailsInfoList = new ArrayList<>();
-		 // 根据铸机号、交班记录ID,获取交班记录中的班别、班次、创建时间
-		 LambdaQueryWrapper<BilletHotsendChangeShift> queryWrapper = new LambdaQueryWrapper<>();
-		 queryWrapper.eq(BilletHotsendChangeShift::getId, changeShiftId).eq(BilletHotsendChangeShift::getCcmNo, ccmNo);
-		 BilletHotsendChangeShift billetHotsendChangeShift = billetHotsendChangeShiftService.getOne(queryWrapper);
-		 if (billetHotsendChangeShift == null){
-			 log.info("{}{}", "查询棒一统计明细失败,交班记录为空!", ccmNo + "交班ID:" + changeShiftId);
-			 return billetDetailsInfoList;
-		 }
-		 String shift = billetHotsendChangeShift.getShift();
-		 String shiftGroup = billetHotsendChangeShift.getShiftGroup();
-
-		 Date startTime = billetHotsendChangeShift.getCreateTime();
-		 Date endTime;
-		 if (oConvertUtils.isEmpty(billetHotsendChangeShift.getChangeShiftTime())) {
-			 endTime = new Date();
-		 } else {
-			 endTime = billetHotsendChangeShift.getChangeShiftTime();
-		 }
-		 // 通过铸机号、开始时间、结束时间查询 钢坯原始生产记录
-		 QueryWrapper<BilletOriginalProductRecord> queryWrapper1 = new QueryWrapper<>();
-		 queryWrapper1.eq("ccm_no", ccmNo);
-		 queryWrapper1.eq("shift", shift);
-		 queryWrapper1.eq("shift_group", shiftGroup);
-		 queryWrapper1.between("create_time", startTime, endTime);
-		 List<BilletOriginalProductRecord> billetOriginalProductRecordList = billetOriginalProductRecordService.list(queryWrapper1);
+		 List<BilletOriginalProductRecord> billetOriginalProductRecordList = billetOriginalProductRecordService.list(queryWrapper);
 		 if (oConvertUtils.listIsEmpty(billetOriginalProductRecordList)){
+			 log.info("{}{}", "查询数据为空!");
 			 return billetDetailsInfoList;
 		 }
 		 Map<String, BilletStatisticsDetail> statisticsMap = new HashMap<>();
@@ -1028,374 +961,63 @@ public class BilletOriginalProductRecordController extends JeecgController<Bille
 		 }
 		 return billetDetailsInfoList;
 	 }
-	 /**
-	 * 棒二统计明细查询
-	 * @param ccmNo
-	 * @param queryDate
-	 * @return
-	 */
-	 private List<BilletDetailsInfo> queryRollClubTwoStatisticsByDate(String ccmNo, String queryDate) {
-		 List<BilletDetailsInfo> billetDetailsInfoList = new ArrayList<>();
-		 String queryDateTime = queryDate + " 00:00:00";
-		 Date date = DateUtils.parseDatetime(queryDateTime);
-		 Date startTime = DateUtils.getStartOfDayByDate(date);
-		 Date endTime = DateUtils.getEndOfDayByDate(date);
-
-		 // 根据铸机号、开始时间、结束时间查询查询装运单打印表
-		 LambdaQueryWrapper<StorageBillPrint> queryWrapper = new LambdaQueryWrapper<>();
-		 queryWrapper.eq(StorageBillPrint::getCcmNo, ccmNo)
-				 .eq(StorageBillPrint::getDestination, "棒二")
-				 .between(StorageBillPrint::getArrivalTime, startTime, endTime)
-				 .orderByDesc(StorageBillPrint::getArrivalTime);
-		 List<StorageBillPrint> storageBillPrintList = storageBillPrintService.list(queryWrapper);
-
-		 if (oConvertUtils.listIsEmpty(storageBillPrintList)) {
-			 log.info("{}{}", "指定日期棒二统计信息查询装运单打印表为空!", queryDate);
-			 return billetDetailsInfoList;
-		 }
-
-		 // 创建并初始化BilletDetailsInfo对象
-		 BilletDetailsInfo billetDetailsInfo = new BilletDetailsInfo();
-		 billetDetailsInfo.setCcmNo(ccmNo); // 设置铸机号
-
-		 // 按定尺(size)分组统计
-		 Map<String, List<StorageBillPrint>> sizeGroupMap = storageBillPrintList.stream()
-				 .filter(item -> item.getSize() != null && item.getAmountTotal() != null)
-				 .collect(Collectors.groupingBy(StorageBillPrint::getSize));
-
-		 // 计算每个分组的统计结果
-		 List<BilletStatisticsDetail> statisticsDetails = new ArrayList<>();
-		 for (Map.Entry<String, List<StorageBillPrint>> entry : sizeGroupMap.entrySet()) {
-			 String size = entry.getKey();
-			 List<StorageBillPrint> groupItems = entry.getValue();
-
-			 // 计算总支数
-			 Integer totalAmount = groupItems.stream()
-					 .mapToInt(StorageBillPrint::getAmountTotal)
-					 .sum();
-
-			 // 计算总重量: (size/1000) * amountTotal * 0.2265,保留4位小数
-			 double totalWeight = groupItems.stream()
-					 .filter(item -> item.getAmountTotal() != null)
-					 .mapToDouble(item -> {
-						 try {
-							 double sizeValue = Double.parseDouble(size);
-							 return (sizeValue / 1000) * item.getAmountTotal() * 0.2265;
-						 } catch (NumberFormatException e) {
-							 return 0.0;
-						 }
-					 }).sum();
-
-			 // 保留4位小数
-			 totalWeight = Math.round(totalWeight * 10000.0) / 10000.0;
-
-			 // 创建统计明细对象并添加到结果列表
-			 BilletStatisticsDetail detail = new BilletStatisticsDetail(totalAmount, totalWeight, size);
-			 statisticsDetails.add(detail);
-		 }
-
-		 // 设置统计结果到BilletDetailsInfo对象
-		 billetDetailsInfo.setRollClubTwoStatisticsList(statisticsDetails);
-
-		 // 计算并设置总车次、总支数和总重量
-		 billetDetailsInfo.setAllCarNum(storageBillPrintList.size()); // 总车次为记录数
-		 billetDetailsInfo.setCounts(statisticsDetails.stream().mapToInt(BilletStatisticsDetail::getAmountTotal).sum());
-		 billetDetailsInfo.setTotalWeight(statisticsDetails.stream().mapToDouble(BilletStatisticsDetail::getBlankOutput).sum());
-
-		 // 添加到结果列表
-		 billetDetailsInfoList.add(billetDetailsInfo);
-
-		 return billetDetailsInfoList;
-	 }
-	 /**
-	 * 棒二统计明细查询
-	 * @param ccmNo
-	 * @param changeShiftId
-	 * @return
-	 */
-	 private List<BilletDetailsInfo> queryRollClubTwoStatisticsByShiftId(String ccmNo, String changeShiftId) {
-		 List<BilletDetailsInfo> billetDetailsInfoList = new ArrayList<>();
-		 // 根据铸机号、交班记录ID,获取交班记录中的班别、班次、创建时间
-		 LambdaQueryWrapper<BilletHotsendChangeShift> queryWrapper = new LambdaQueryWrapper<>();
-		 queryWrapper.eq(BilletHotsendChangeShift::getId, changeShiftId).eq(BilletHotsendChangeShift::getCcmNo, ccmNo);
-		 BilletHotsendChangeShift billetHotsendChangeShift = billetHotsendChangeShiftService.getOne(queryWrapper);
-		 if (billetHotsendChangeShift == null){
-			 log.info("{}{}", "查询指定班次,棒二统计明细失败,交班记录为空!", ccmNo + "交班ID:" + changeShiftId);
-			 return billetDetailsInfoList;
-		 }
-		 String shift = billetHotsendChangeShift.getShift();
-		 String shiftGroup = billetHotsendChangeShift.getShiftGroup();
-
-		 Date startTime = billetHotsendChangeShift.getCreateTime();
-		 Date endTime;
-		 if (oConvertUtils.isEmpty(billetHotsendChangeShift.getChangeShiftTime())) {
-			 endTime = new Date();
-		 } else {
-			 endTime = billetHotsendChangeShift.getChangeShiftTime();
-		 }
-		 String shiftAndShiftGroup = shift + "/" + shiftGroup;
-		 // 根据铸机号、开始时间、结束时间查询查询装运单打印表
-		 LambdaQueryWrapper<StorageBillPrint> queryWrapper1 = new LambdaQueryWrapper<>();
-		 queryWrapper1.eq(StorageBillPrint::getCcmNo, ccmNo)
-				 .eq(StorageBillPrint::getDestination, "棒二")
-				 .eq(StorageBillPrint::getClasses, shiftAndShiftGroup)
-				 .between(StorageBillPrint::getArrivalTime, startTime, endTime)
-				 .orderByDesc(StorageBillPrint::getArrivalTime);
-		 List<StorageBillPrint> storageBillPrintList = storageBillPrintService.list(queryWrapper1);
-		 if (oConvertUtils.listIsEmpty(storageBillPrintList)) {
-			 log.info("{}{}", "指定班次棒二统计信息查询装运单打印表为空!", changeShiftId);
-			 return billetDetailsInfoList;
-		 }
-		 // 创建并初始化BilletDetailsInfo对象
-		 BilletDetailsInfo billetDetailsInfo = new BilletDetailsInfo();
-		 billetDetailsInfo.setCcmNo(ccmNo); // 设置铸机号
-
-		 // 按定尺(size)分组统计
-		 Map<String, List<StorageBillPrint>> sizeGroupMap = storageBillPrintList.stream()
-				 .filter(item -> item.getSize() != null && item.getAmountTotal() != null)
-				 .collect(Collectors.groupingBy(StorageBillPrint::getSize));
-
-		 // 计算每个分组的统计结果
-		 List<BilletStatisticsDetail> statisticsDetails = new ArrayList<>();
-		 for (Map.Entry<String, List<StorageBillPrint>> entry : sizeGroupMap.entrySet()) {
-			 String size = entry.getKey();
-			 List<StorageBillPrint> groupItems = entry.getValue();
-
-			 // 计算总支数
-			 Integer totalAmount = groupItems.stream()
-					 .mapToInt(StorageBillPrint::getAmountTotal)
-					 .sum();
-
-			 // 计算总重量: (size/1000) * amountTotal * 0.2265,保留4位小数
-			 double totalWeight = groupItems.stream()
-					 .filter(item -> item.getAmountTotal() != null)
-					 .mapToDouble(item -> {
-						 try {
-							 double sizeValue = Double.parseDouble(size);
-							 return (sizeValue / 1000) * item.getAmountTotal() * 0.2265;
-						 } catch (NumberFormatException e) {
-							 return 0.0;
-						 }
-					 }).sum();
-
-			 // 保留4位小数
-			 totalWeight = Math.round(totalWeight * 10000.0) / 10000.0;
-
-			 // 创建统计明细对象并添加到结果列表
-			 BilletStatisticsDetail detail = new BilletStatisticsDetail(totalAmount, totalWeight, size);
-			 statisticsDetails.add(detail);
-		 }
 
-		 // 设置统计结果到BilletDetailsInfo对象
-		 billetDetailsInfo.setRollClubTwoStatisticsList(statisticsDetails);
-
-		 // 计算并设置总车次、总支数和总重量
-		 billetDetailsInfo.setAllCarNum(storageBillPrintList.size()); // 总车次为记录数
-		 billetDetailsInfo.setCounts(statisticsDetails.stream().mapToInt(BilletStatisticsDetail::getAmountTotal).sum());
-		 billetDetailsInfo.setTotalWeight(statisticsDetails.stream().mapToDouble(BilletStatisticsDetail::getBlankOutput).sum());
-
-		 // 添加到结果列表
-		 billetDetailsInfoList.add(billetDetailsInfo);
-
-		 return billetDetailsInfoList;
-	 }
 	 /**
-	 * 棒三统计明细查询
-	 * @param ccmNo
-	 * @param queryDate
-	 * @return
-	 */
-	 private List<BilletDetailsInfo> queryRollClubThreeStatisticsByDate(String ccmNo, String queryDate) {
+	  * 装运单统计明细查询
+	  * @param ccmNo
+	  * @param queryDate
+	  * @return
+	  */
+	 private List<BilletDetailsInfo> querSstorageBillPrintStatistics(String ccmNo, String destination, String queryDate, String changeShiftId, String heatNo, String licensePlate, String startTimes, String endTimes) {
 		 List<BilletDetailsInfo> billetDetailsInfoList = new ArrayList<>();
-		 String queryDateTime = queryDate + " 00:00:00";
-		 Date date = DateUtils.parseDatetime(queryDateTime);
-		 Date startTime = DateUtils.getStartOfDayByDate(date);
-		 Date endTime = DateUtils.getEndOfDayByDate(date);
-
 		 // 根据铸机号、开始时间、结束时间查询查询装运单打印表
 		 LambdaQueryWrapper<StorageBillPrint> queryWrapper = new LambdaQueryWrapper<>();
 		 queryWrapper.eq(StorageBillPrint::getCcmNo, ccmNo)
-				 .eq(StorageBillPrint::getDestination, "棒三")
-				 .between(StorageBillPrint::getArrivalTime, startTime, endTime)
+				 .eq(StorageBillPrint::getDestination, destination)
 				 .orderByDesc(StorageBillPrint::getArrivalTime);
-		 List<StorageBillPrint> storageBillPrintList = storageBillPrintService.list(queryWrapper);
-
-		 if (oConvertUtils.listIsEmpty(storageBillPrintList)) {
-			 log.info("{}{}", "指定日期棒三统计信息查询装运单打印表为空!", queryDate);
-			 return billetDetailsInfoList;
-		 }
-
-		 // 创建并初始化BilletDetailsInfo对象
-		 BilletDetailsInfo billetDetailsInfo = new BilletDetailsInfo();
-		 billetDetailsInfo.setCcmNo(ccmNo); // 设置铸机号
-
-		 // 按定尺(size)分组统计
-		 Map<String, List<StorageBillPrint>> sizeGroupMap = storageBillPrintList.stream()
-				 .filter(item -> item.getSize() != null && item.getAmountTotal() != null)
-				 .collect(Collectors.groupingBy(StorageBillPrint::getSize));
-
-		 // 计算每个分组的统计结果
-		 List<BilletStatisticsDetail> statisticsDetails = new ArrayList<>();
-		 for (Map.Entry<String, List<StorageBillPrint>> entry : sizeGroupMap.entrySet()) {
-			 String size = entry.getKey();
-			 List<StorageBillPrint> groupItems = entry.getValue();
-
-			 // 计算总支数
-			 Integer totalAmount = groupItems.stream()
-					 .mapToInt(StorageBillPrint::getAmountTotal)
-					 .sum();
-
-			 // 计算总重量: (size/1000) * amountTotal * 0.2265,保留4位小数
-			 double totalWeight = groupItems.stream()
-					 .filter(item -> item.getAmountTotal() != null)
-					 .mapToDouble(item -> {
-						 try {
-							 double sizeValue = Double.parseDouble(size);
-							 return (sizeValue / 1000) * item.getAmountTotal() * 0.2265;
-						 } catch (NumberFormatException e) {
-							 return 0.0;
-						 }
-					 }).sum();
-
-			 // 保留4位小数
-			 totalWeight = Math.round(totalWeight * 10000.0) / 10000.0;
-
-			 // 创建统计明细对象并添加到结果列表
-			 BilletStatisticsDetail detail = new BilletStatisticsDetail(totalAmount, totalWeight, size);
-			 statisticsDetails.add(detail);
-		 }
-
-		 // 设置统计结果到BilletDetailsInfo对象
-		 billetDetailsInfo.setRollClubThreeStatisticsList(statisticsDetails);
-
-		 // 计算并设置总车次、总支数和总重量
-		 billetDetailsInfo.setAllCarNum(storageBillPrintList.size()); // 总车次为记录数
-		 billetDetailsInfo.setCounts(statisticsDetails.stream().mapToInt(BilletStatisticsDetail::getAmountTotal).sum());
-		 billetDetailsInfo.setTotalWeight(statisticsDetails.stream().mapToDouble(BilletStatisticsDetail::getBlankOutput).sum());
-
-		 // 添加到结果列表
-		 billetDetailsInfoList.add(billetDetailsInfo);
-
-		 return billetDetailsInfoList;
-	 }
-	 /**
-	 * 棒三统计明细查询
-	 * @param ccmNo
-	 * @param changeShiftId
-	 * @return
-	 */
-	 private List<BilletDetailsInfo> queryRollClubThreeStatisticsByShiftId(String ccmNo, String changeShiftId) {
-		 List<BilletDetailsInfo> billetDetailsInfoList = new ArrayList<>();
-		 // 根据铸机号、交班记录ID,获取交班记录中的班别、班次、创建时间
-		 LambdaQueryWrapper<BilletHotsendChangeShift> queryWrapper = new LambdaQueryWrapper<>();
-		 queryWrapper.eq(BilletHotsendChangeShift::getId, changeShiftId).eq(BilletHotsendChangeShift::getCcmNo, ccmNo);
-		 BilletHotsendChangeShift billetHotsendChangeShift = billetHotsendChangeShiftService.getOne(queryWrapper);
-		 if (billetHotsendChangeShift == null){
-			 log.info("{}{}", "查询指定班次,棒三统计明细失败,交班记录为空!", ccmNo + "交班ID:" + changeShiftId);
-			 return billetDetailsInfoList;
+		 if(oConvertUtils.isNotEmpty(changeShiftId)) { // 班组为空取班组时间
+			 // 根据铸机号、交班记录ID,获取交班记录中的班别、班次、创建时间
+			 LambdaQueryWrapper<BilletHotsendChangeShift> changeQueryWrapper = new LambdaQueryWrapper<>();
+			 changeQueryWrapper.eq(BilletHotsendChangeShift::getId, changeShiftId).eq(BilletHotsendChangeShift::getCcmNo, ccmNo);
+			 BilletHotsendChangeShift billetHotsendChangeShift = billetHotsendChangeShiftService.getOne(changeQueryWrapper);
+			 if (billetHotsendChangeShift == null){
+				 log.info("{}{}", "查询指定班次,交班记录为空!", ccmNo + "交班ID:" + changeShiftId);
+				 return billetDetailsInfoList;
+			 }
+			 String shift = billetHotsendChangeShift.getShift();
+			 String shiftGroup = billetHotsendChangeShift.getShiftGroup();
+			 Date startTime = billetHotsendChangeShift.getCreateTime();
+			 Date endTime;
+			 if (oConvertUtils.isEmpty(billetHotsendChangeShift.getChangeShiftTime())) {
+				 endTime = new Date();
+			 } else {
+				 endTime = billetHotsendChangeShift.getChangeShiftTime();
+			 }
+			 String shiftAndShiftGroup = shift + "/" + shiftGroup;
+			 queryWrapper.between(StorageBillPrint::getArrivalTime, startTime, endTime).eq(StorageBillPrint::getClasses, shiftAndShiftGroup);
+		 } else if(oConvertUtils.isNotEmpty(startTimes) && oConvertUtils.isNotEmpty(endTimes)){ // 时间范围
+			 queryWrapper.between(StorageBillPrint::getArrivalTime, startTimes, endTimes);
+		 } else if (oConvertUtils.isNotEmpty(queryDate)) { // 独立时间处理
+			 String queryDateTime = queryDate + " 00:00:00";
+			 Date date = DateUtils.parseDatetime(queryDateTime);
+			 Date startTime = DateUtils.getStartOfDayByDate(date);
+			 Date endTime = DateUtils.getEndOfDayByDate(date);
+			 queryWrapper.between(StorageBillPrint::getArrivalTime, startTime, endTime);
 		 }
-		 String shift = billetHotsendChangeShift.getShift();
-		 String shiftGroup = billetHotsendChangeShift.getShiftGroup();
-
-		 Date startTime = billetHotsendChangeShift.getCreateTime();
-		 Date endTime;
-		 if (oConvertUtils.isEmpty(billetHotsendChangeShift.getChangeShiftTime())) {
-			 endTime = new Date();
-		 } else {
-			 endTime = billetHotsendChangeShift.getChangeShiftTime();
+		 // 炉号查询
+		 if (oConvertUtils.isNotEmpty(heatNo)) {
+			 queryWrapper.like(StorageBillPrint::getHeatNo, heatNo);
 		 }
-		 String shiftAndShiftGroup = shift + "/" + shiftGroup;
-		 // 根据铸机号、开始时间、结束时间查询查询装运单打印表
-		 LambdaQueryWrapper<StorageBillPrint> queryWrapper1 = new LambdaQueryWrapper<>();
-		 queryWrapper1.eq(StorageBillPrint::getCcmNo, ccmNo)
-				 .eq(StorageBillPrint::getDestination, "棒三")
-				 .eq(StorageBillPrint::getClasses, shiftAndShiftGroup)
-				 .between(StorageBillPrint::getArrivalTime, startTime, endTime)
-				 .orderByDesc(StorageBillPrint::getArrivalTime);
-		 List<StorageBillPrint> storageBillPrintList = storageBillPrintService.list(queryWrapper1);
-		 if (oConvertUtils.listIsEmpty(storageBillPrintList)) {
-			 log.info("{}{}", "指定班次,棒三统计信息查询,装运单打印表为空!", changeShiftId);
-			 return billetDetailsInfoList;
+		 // 车牌号查询
+		 if (oConvertUtils.isNotEmpty(licensePlate)) {
+			 queryWrapper.eq(StorageBillPrint::getLicensePlate, licensePlate);
 		 }
-		 // 创建并初始化BilletDetailsInfo对象
-		 BilletDetailsInfo billetDetailsInfo = new BilletDetailsInfo();
-		 billetDetailsInfo.setCcmNo(ccmNo); // 设置铸机号
 
-		 // 按定尺(size)分组统计
-		 Map<String, List<StorageBillPrint>> sizeGroupMap = storageBillPrintList.stream()
-				 .filter(item -> item.getSize() != null && item.getAmountTotal() != null)
-				 .collect(Collectors.groupingBy(StorageBillPrint::getSize));
-
-		 // 计算每个分组的统计结果
-		 List<BilletStatisticsDetail> statisticsDetails = new ArrayList<>();
-		 for (Map.Entry<String, List<StorageBillPrint>> entry : sizeGroupMap.entrySet()) {
-			 String size = entry.getKey();
-			 List<StorageBillPrint> groupItems = entry.getValue();
-
-			 // 计算总支数
-			 Integer totalAmount = groupItems.stream()
-					 .mapToInt(StorageBillPrint::getAmountTotal)
-					 .sum();
-
-			 // 计算总重量: (size/1000) * amountTotal * 0.2265,保留4位小数
-			 double totalWeight = groupItems.stream()
-					 .filter(item -> item.getAmountTotal() != null)
-					 .mapToDouble(item -> {
-						 try {
-							 double sizeValue = Double.parseDouble(size);
-							 return (sizeValue / 1000) * item.getAmountTotal() * 0.2265;
-						 } catch (NumberFormatException e) {
-							 return 0.0;
-						 }
-					 }).sum();
-
-			 // 保留4位小数
-			 totalWeight = Math.round(totalWeight * 10000.0) / 10000.0;
-
-			 // 创建统计明细对象并添加到结果列表
-			 BilletStatisticsDetail detail = new BilletStatisticsDetail(totalAmount, totalWeight, size);
-			 statisticsDetails.add(detail);
-		 }
-
-		 // 设置统计结果到BilletDetailsInfo对象
-		 billetDetailsInfo.setRollClubThreeStatisticsList(statisticsDetails);
-
-		 // 计算并设置总车次、总支数和总重量
-		 billetDetailsInfo.setAllCarNum(storageBillPrintList.size()); // 总车次为记录数
-		 billetDetailsInfo.setCounts(statisticsDetails.stream().mapToInt(BilletStatisticsDetail::getAmountTotal).sum());
-		 billetDetailsInfo.setTotalWeight(statisticsDetails.stream().mapToDouble(BilletStatisticsDetail::getBlankOutput).sum());
-
-		 // 添加到结果列表
-		 billetDetailsInfoList.add(billetDetailsInfo);
-
-		 return billetDetailsInfoList;
-	 }
-	 /**
-	 * 上若统计明细查询
-	 * @param ccmNo
-	 * @param queryDate
-	 * @return
-	 */
-	 private List<BilletDetailsInfo> queryRollOutShippStatisticsByDate(String ccmNo, String queryDate) {
-		 List<BilletDetailsInfo> billetDetailsInfoList = new ArrayList<>();
-		 String queryDateTime = queryDate + " 00:00:00";
-		 Date date = DateUtils.parseDatetime(queryDateTime);
-		 Date startTime = DateUtils.getStartOfDayByDate(date);
-		 Date endTime = DateUtils.getEndOfDayByDate(date);
-
-		 // 根据铸机号、开始时间、结束时间查询查询装运单打印表
-		 LambdaQueryWrapper<StorageBillPrint> queryWrapper = new LambdaQueryWrapper<>();
-		 queryWrapper.eq(StorageBillPrint::getCcmNo, ccmNo)
-				 .eq(StorageBillPrint::getDestination, "上若")
-				 .between(StorageBillPrint::getArrivalTime, startTime, endTime)
-				 .orderByDesc(StorageBillPrint::getArrivalTime);
 		 List<StorageBillPrint> storageBillPrintList = storageBillPrintService.list(queryWrapper);
-
 		 if (oConvertUtils.listIsEmpty(storageBillPrintList)) {
-			 log.info("{}{}", "指定日期上若统计信息查询装运单打印表为空!", queryDate);
+			 log.info("{}{}", "查询数据为空!");
 			 return billetDetailsInfoList;
 		 }
-
 		 // 创建并初始化BilletDetailsInfo对象
 		 BilletDetailsInfo billetDetailsInfo = new BilletDetailsInfo();
 		 billetDetailsInfo.setCcmNo(ccmNo); // 设置铸机号
@@ -1437,99 +1059,7 @@ public class BilletOriginalProductRecordController extends JeecgController<Bille
 		 }
 
 		 // 设置统计结果到BilletDetailsInfo对象
-		 billetDetailsInfo.setRollOutShippStatisticsList(statisticsDetails);
-
-		 // 计算并设置总车次、总支数和总重量
-		 billetDetailsInfo.setAllCarNum(storageBillPrintList.size()); // 总车次为记录数
-		 billetDetailsInfo.setCounts(statisticsDetails.stream().mapToInt(BilletStatisticsDetail::getAmountTotal).sum());
-		 billetDetailsInfo.setTotalWeight(statisticsDetails.stream().mapToDouble(BilletStatisticsDetail::getBlankOutput).sum());
-
-		 // 添加到结果列表
-		 billetDetailsInfoList.add(billetDetailsInfo);
-
-		 return billetDetailsInfoList;
-	 }
-	 /**
-	 * 上若统计明细查询
-	 * @param ccmNo
-	 * @param changeShiftId
-	 * @return
-	 */
-	 private List<BilletDetailsInfo> queryRollOutShippStatisticsByShiftId(String ccmNo, String changeShiftId) {
-		 List<BilletDetailsInfo> billetDetailsInfoList = new ArrayList<>();
-		 // 根据铸机号、交班记录ID,获取交班记录中的班别、班次、创建时间
-		 LambdaQueryWrapper<BilletHotsendChangeShift> queryWrapper = new LambdaQueryWrapper<>();
-		 queryWrapper.eq(BilletHotsendChangeShift::getId, changeShiftId).eq(BilletHotsendChangeShift::getCcmNo, ccmNo);
-		 BilletHotsendChangeShift billetHotsendChangeShift = billetHotsendChangeShiftService.getOne(queryWrapper);
-		 if (billetHotsendChangeShift == null){
-			 log.info("{}{}", "查询指定班次,上若统计明细失败,交班记录为空!", ccmNo + "交班ID:" + changeShiftId);
-			 return billetDetailsInfoList;
-		 }
-		 String shift = billetHotsendChangeShift.getShift();
-		 String shiftGroup = billetHotsendChangeShift.getShiftGroup();
-
-		 Date startTime = billetHotsendChangeShift.getCreateTime();
-		 Date endTime;
-		 if (oConvertUtils.isEmpty(billetHotsendChangeShift.getChangeShiftTime())) {
-			 endTime = new Date();
-		 } else {
-			 endTime = billetHotsendChangeShift.getChangeShiftTime();
-		 }
-		 String shiftAndShiftGroup = shift + "/" + shiftGroup;
-		 // 根据铸机号、开始时间、结束时间查询查询装运单打印表
-		 LambdaQueryWrapper<StorageBillPrint> queryWrapper1 = new LambdaQueryWrapper<>();
-		 queryWrapper1.eq(StorageBillPrint::getCcmNo, ccmNo)
-				 .eq(StorageBillPrint::getDestination, "上若")
-				 .eq(StorageBillPrint::getClasses, shiftAndShiftGroup)
-				 .between(StorageBillPrint::getArrivalTime, startTime, endTime)
-				 .orderByDesc(StorageBillPrint::getArrivalTime);
-		 List<StorageBillPrint> storageBillPrintList = storageBillPrintService.list(queryWrapper1);
-		 if (oConvertUtils.listIsEmpty(storageBillPrintList)) {
-			 log.info("{}{}", "指定班次,上若统计信息查询,装运单打印表为空!", changeShiftId);
-			 return billetDetailsInfoList;
-		 }
-		 // 创建并初始化BilletDetailsInfo对象
-		 BilletDetailsInfo billetDetailsInfo = new BilletDetailsInfo();
-		 billetDetailsInfo.setCcmNo(ccmNo); // 设置铸机号
-
-		 // 按定尺(size)分组统计
-		 Map<String, List<StorageBillPrint>> sizeGroupMap = storageBillPrintList.stream()
-				 .filter(item -> item.getSize() != null && item.getAmountTotal() != null)
-				 .collect(Collectors.groupingBy(StorageBillPrint::getSize));
-
-		 // 计算每个分组的统计结果
-		 List<BilletStatisticsDetail> statisticsDetails = new ArrayList<>();
-		 for (Map.Entry<String, List<StorageBillPrint>> entry : sizeGroupMap.entrySet()) {
-			 String size = entry.getKey();
-			 List<StorageBillPrint> groupItems = entry.getValue();
-
-			 // 计算总支数
-			 Integer totalAmount = groupItems.stream()
-					 .mapToInt(StorageBillPrint::getAmountTotal)
-					 .sum();
-
-			 // 计算总重量: (size/1000) * amountTotal * 0.2265,保留4位小数
-			 double totalWeight = groupItems.stream()
-					 .filter(item -> item.getAmountTotal() != null)
-					 .mapToDouble(item -> {
-						 try {
-							 double sizeValue = Double.parseDouble(size);
-							 return (sizeValue / 1000) * item.getAmountTotal() * 0.2265;
-						 } catch (NumberFormatException e) {
-							 return 0.0;
-						 }
-					 }).sum();
-
-			 // 保留4位小数
-			 totalWeight = Math.round(totalWeight * 10000.0) / 10000.0;
-
-			 // 创建统计明细对象并添加到结果列表
-			 BilletStatisticsDetail detail = new BilletStatisticsDetail(totalAmount, totalWeight, size);
-			 statisticsDetails.add(detail);
-		 }
-
-		 // 设置统计结果到BilletDetailsInfo对象
-		 billetDetailsInfo.setRollOutShippStatisticsList(statisticsDetails);
+		 billetDetailsInfo.setRollClubTwoStatisticsList(statisticsDetails);
 
 		 // 计算并设置总车次、总支数和总重量
 		 billetDetailsInfo.setAllCarNum(storageBillPrintList.size()); // 总车次为记录数