Bläddra i källkod

完善轧钢棒线多个坯号匹配组坯号的情况

lingpeng.li 2 månader sedan
förälder
incheckning
6a0571945d

+ 12 - 5
zgztBus/jeecg-module-sbm/src/main/java/org/jeecg/modules/billet/rollClubThree/controller/RollClubThreeController.java

@@ -87,10 +87,13 @@ public class RollClubThreeController {
 		Map<String, List<RollClubThreeDetails>> detailsMap = allDetails.stream()
 				.collect(Collectors.groupingBy(d -> d.getCcmNo() + "-" + d.getHeatNo() + "-" + d.getStorageBillId()));
 
-		// 3. 提取所有 billetNo去重
+		// 3. 提取所有 billetNo,并进行逗号分割后去重
 		Set<String> allBilletNos = allDetails.stream()
 				.map(RollClubThreeDetails::getBilletNo)
 				.filter(Objects::nonNull)
+				.flatMap(billetNo -> Arrays.stream(billetNo.split(","))) // 按逗号分割
+				.map(String::trim) // 去除可能的空格
+				.filter(bn -> !bn.isEmpty()) // 过滤空字符串
 				.collect(Collectors.toSet());
 
 		// 4. 查询所有 BilletBasicInfo,并用 Map 存储(Key: billetNo)
@@ -119,14 +122,18 @@ public class RollClubThreeController {
 				// 直接从 Map 取数据,避免重复查询数据库
 				List<RollClubThreeDetails> rollClubThreeDetailsLists = detailsMap.getOrDefault(key, Collections.emptyList());
 
+
 				// 7. 通过 Map 获取所有 billetNo 对应的 AssemblyNumber 并去重拼接
 				String distinctAssemblyNumber = rollClubThreeDetailsLists.stream()
 						.map(RollClubThreeDetails::getBilletNo)
 						.filter(Objects::nonNull)
-						.map(finalBilletAssemblyMap::get)
-						.filter(Objects::nonNull)
-						.distinct()
-						.collect(Collectors.joining(","));
+						.flatMap(billetNo -> Arrays.stream(billetNo.split(","))) // 逗号分割
+						.map(String::trim) // 去掉前后空格
+						.filter(bn -> !bn.isEmpty()) // 过滤空字符串
+						.map(finalBilletAssemblyMap::get) // 在 Map 中查找 AssemblyNumber
+						.filter(Objects::nonNull) // 过滤掉 null
+						.distinct() // 去重
+						.collect(Collectors.joining(",")); // 拼接
 
 				clubThree.setAssemblyNumber(distinctAssemblyNumber);
 

+ 11 - 5
zgztBus/jeecg-module-sbm/src/main/java/org/jeecg/modules/billet/rollClubTwo/controller/RollClubTwoController.java

@@ -83,10 +83,13 @@ public class RollClubTwoController {
 		Map<String, List<RollClubTwoDetails>> detailsMap = allDetails.stream()
 				.collect(Collectors.groupingBy(d -> d.getCcmNo() + "-" + d.getHeatNo() + "-" + d.getStorageBillId()));
 
-		// 3. 提取所有 billetNo去重
+		// 3. 提取所有 billetNo,并进行逗号分割后去重
 		Set<String> allBilletNos = allDetails.stream()
 				.map(RollClubTwoDetails::getBilletNo)
 				.filter(Objects::nonNull)
+				.flatMap(billetNo -> Arrays.stream(billetNo.split(","))) // 按逗号分割
+				.map(String::trim) // 去除可能的空格
+				.filter(bn -> !bn.isEmpty()) // 过滤空字符串
 				.collect(Collectors.toSet());
 
 		// 4. 查询所有 BilletBasicInfo,并用 Map 存储(Key: billetNo)
@@ -118,10 +121,13 @@ public class RollClubTwoController {
 				String distinctAssemblyNumber = rollClubTwoDetailsLists.stream()
 						.map(RollClubTwoDetails::getBilletNo)
 						.filter(Objects::nonNull)
-						.map(finalBilletAssemblyMap::get)
-						.filter(Objects::nonNull)
-						.distinct()
-						.collect(Collectors.joining(","));
+						.flatMap(billetNo -> Arrays.stream(billetNo.split(","))) // 逗号分割
+						.map(String::trim) // 去掉前后空格
+						.filter(bn -> !bn.isEmpty()) // 过滤空字符串
+						.map(finalBilletAssemblyMap::get) // 在 Map 中查找 AssemblyNumber
+						.filter(Objects::nonNull) // 过滤掉 null
+						.distinct() // 去重
+						.collect(Collectors.joining(",")); // 拼接
 
 				clubTwo.setAssemblyNumber(distinctAssemblyNumber);
 				newRollClubTwoList.add(clubTwo);

+ 11 - 5
zgztBus/jeecg-module-sbm/src/main/java/org/jeecg/modules/billet/rollOutShipp/controller/RollOutShippController.java

@@ -85,10 +85,13 @@ public class RollOutShippController {
 		Map<String, List<RollOutShippDetails>> detailsMap = allDetails.stream()
 				.collect(Collectors.groupingBy(d -> d.getCcmNo() + "-" + d.getHeatNo() + "-" + d.getStorageBillId()));
 
-		// 3. 提取所有 billetNo去重
+		// 3. 提取所有 billetNo,并进行逗号分割后去重
 		Set<String> allBilletNos = allDetails.stream()
 				.map(RollOutShippDetails::getBilletNo)
 				.filter(Objects::nonNull)
+				.flatMap(billetNo -> Arrays.stream(billetNo.split(","))) // 按逗号分割
+				.map(String::trim) // 去除可能的空格
+				.filter(bn -> !bn.isEmpty()) // 过滤空字符串
 				.collect(Collectors.toSet());
 
 		// 4. 查询所有 BilletBasicInfo,并用 Map 存储(Key: billetNo)
@@ -122,10 +125,13 @@ public class RollOutShippController {
 				String distinctAssemblyNumber = rollClubThreeDetailsLists.stream()
 						.map(RollOutShippDetails::getBilletNo)
 						.filter(Objects::nonNull)
-						.map(finalBilletAssemblyMap::get)
-						.filter(Objects::nonNull)
-						.distinct()
-						.collect(Collectors.joining(","));
+						.flatMap(billetNo -> Arrays.stream(billetNo.split(","))) // 逗号分割
+						.map(String::trim) // 去掉前后空格
+						.filter(bn -> !bn.isEmpty()) // 过滤空字符串
+						.map(finalBilletAssemblyMap::get) // 在 Map 中查找 AssemblyNumber
+						.filter(Objects::nonNull) // 过滤掉 null
+						.distinct() // 去重
+						.collect(Collectors.joining(",")); // 拼接
 
 				rollOutShipp1.setAssemblyNumber(distinctAssemblyNumber);
 

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

@@ -3043,7 +3043,9 @@ public class StorageBillServiceImpl extends ServiceImpl<StorageBillMapper, Stora
 
         // 根据铸机号、班组、班别、创建时间 查询垛位起剁明细表
         LambdaQueryWrapper<StackingUpLog> stackingUpLogQueryWrapper = new LambdaQueryWrapper<>();
-        stackingUpLogQueryWrapper.eq(StackingUpLog::getCcmNo, ccmNo);
+        stackingUpLogQueryWrapper.eq(StackingUpLog::getCcmNo, ccmNo)
+                                 .eq(StackingUpLog::getShift, shift)
+                                 .eq(StackingUpLog::getShiftGroup, shiftGroup);
 
         stackingUpLogQueryWrapper.between(StackingUpLog::getCreateTime, billetHotsendChangeShift.getCreateTime(), new Date());
 
@@ -3070,9 +3072,13 @@ public class StorageBillServiceImpl extends ServiceImpl<StorageBillMapper, Stora
         LambdaQueryWrapper<RollClubTwoDetails> queryWrapper2 = new LambdaQueryWrapper<>();
         if (idList != null && !idList.isEmpty()) {
             queryWrapper2.eq(RollClubTwoDetails::getCcmNo, ccmNo)
+                    .eq(RollClubTwoDetails::getShift, shift)
+                    .eq(RollClubTwoDetails::getShiftGroup, shiftGroup)
                     .in(RollClubTwoDetails::getStorageBillId, idList);
         } else {
-            queryWrapper2.eq(RollClubTwoDetails::getCcmNo, ccmNo);
+            queryWrapper2.eq(RollClubTwoDetails::getCcmNo, ccmNo)
+                    .eq(RollClubTwoDetails::getShift, shift)
+                    .eq(RollClubTwoDetails::getShiftGroup, shiftGroup);
         }
 
         List<RollClubTwoDetails> rollClubTwoDetailsList = rollClubTwoDetailsService.list(queryWrapper2);
@@ -3086,9 +3092,13 @@ public class StorageBillServiceImpl extends ServiceImpl<StorageBillMapper, Stora
         LambdaQueryWrapper<RollClubThreeDetails> queryWrapper3 = new LambdaQueryWrapper<>();
         if (idList != null && !idList.isEmpty()) {
             queryWrapper3.eq(RollClubThreeDetails::getCcmNo, ccmNo)
+                    .eq(RollClubThreeDetails::getShift, shift)
+                    .eq(RollClubThreeDetails::getShiftGroup, shiftGroup)
                     .in(RollClubThreeDetails::getStorageBillId, idList);
         } else {
-            queryWrapper3.eq(RollClubThreeDetails::getCcmNo, ccmNo);
+            queryWrapper3.eq(RollClubThreeDetails::getCcmNo, ccmNo)
+                    .eq(RollClubThreeDetails::getShift, shift)
+                    .eq(RollClubThreeDetails::getShiftGroup, shiftGroup);
         }
 
 
@@ -3115,9 +3125,13 @@ public class StorageBillServiceImpl extends ServiceImpl<StorageBillMapper, Stora
         LambdaQueryWrapper<RollOutShippDetails> queryWrapper5 = new LambdaQueryWrapper<>();
         if (idList != null && !idList.isEmpty()) {
             queryWrapper5.eq(RollOutShippDetails::getCcmNo, ccmNo)
+                    .eq(RollOutShippDetails::getShift, shift)
+                    .eq(RollOutShippDetails::getShiftGroup, shiftGroup)
                     .in(RollOutShippDetails::getStorageBillId, idList);
         } else {
-            queryWrapper5.eq(RollOutShippDetails::getCcmNo, ccmNo);
+            queryWrapper5.eq(RollOutShippDetails::getCcmNo, ccmNo)
+                    .eq(RollOutShippDetails::getShift, shift)
+                    .eq(RollOutShippDetails::getShiftGroup, shiftGroup);
         }
 
         List<RollOutShippDetails> rollOutShippDetailsList = rollOutShippDetailsService.list(queryWrapper5);
@@ -3617,7 +3631,6 @@ public class StorageBillServiceImpl extends ServiceImpl<StorageBillMapper, Stora
 
         if (oConvertUtils.listIsEmpty(storageBillList)){
             log.info("{}{}", "查询当班装运单信息为空!", ccmNo);
-            return onDutyStorageBillStatistics;
         }
         int allCarNum = storageBillList.size();
         List<DestinationStatisticsDetails> statisticsDetailsList1 = new ArrayList<>();
@@ -3629,7 +3642,13 @@ public class StorageBillServiceImpl extends ServiceImpl<StorageBillMapper, Stora
         for (StorageBill storageBill : storageBillList) {
             if ("棒二".equals(storageBill.getDestination())) {
                 LambdaQueryWrapper<RollClubTwoDetails> queryWrapper3 = new LambdaQueryWrapper<>();
-                queryWrapper3.eq(RollClubTwoDetails::getCcmNo, ccmNo).eq(RollClubTwoDetails::getStorageBillId, storageBill.getId());
+                queryWrapper3.eq(RollClubTwoDetails::getCcmNo, ccmNo)
+                        .eq(RollClubTwoDetails::getShift,shift)
+                        .eq(RollClubTwoDetails::getShiftGroup,shiftGroup);
+
+                if (storageBill != null && storageBill.getId() != null) {
+                    queryWrapper3.eq(RollClubTwoDetails::getStorageBillId, storageBill.getId());
+                }
                 List<RollClubTwoDetails> rollClubTwoDetailsList = rollClubTwoDetailsService.list(queryWrapper3);
                 if (oConvertUtils.listIsNotEmpty(rollClubTwoDetailsList)) {
                     List<DestinationStatisticsDetails> currentList1 = rollClubTwoDetailsList.stream()
@@ -3655,7 +3674,13 @@ public class StorageBillServiceImpl extends ServiceImpl<StorageBillMapper, Stora
 
             if ("棒三".equals(storageBill.getDestination())) {
                 LambdaQueryWrapper<RollClubThreeDetails> queryWrapper3 = new LambdaQueryWrapper<>();
-                queryWrapper3.eq(RollClubThreeDetails::getCcmNo, ccmNo).eq(RollClubThreeDetails::getStorageBillId, storageBill.getId());
+                queryWrapper3.eq(RollClubThreeDetails::getCcmNo, ccmNo)
+                        .eq(RollClubThreeDetails::getShift,shift)
+                        .eq(RollClubThreeDetails::getShiftGroup,shiftGroup);
+
+                if (storageBill != null && storageBill.getId() != null) {
+                    queryWrapper3.eq(RollClubThreeDetails::getStorageBillId, storageBill.getId());
+                }
                 List<RollClubThreeDetails> rollClubThreeDetailsList = rollClubThreeDetailsService.list(queryWrapper3);
                 if (oConvertUtils.listIsNotEmpty(rollClubThreeDetailsList)) {
                     List<DestinationStatisticsDetails> currentList2 = rollClubThreeDetailsList.stream()
@@ -3681,7 +3706,13 @@ public class StorageBillServiceImpl extends ServiceImpl<StorageBillMapper, Stora
 
             if ("上若".equals(storageBill.getDestination())) {
                 LambdaQueryWrapper<RollOutShippDetails> queryWrapper3 = new LambdaQueryWrapper<>();
-                queryWrapper3.eq(RollOutShippDetails::getCcmNo, ccmNo).eq(RollOutShippDetails::getStorageBillId, storageBill.getId());
+                queryWrapper3.eq(RollOutShippDetails::getCcmNo, ccmNo)
+                        .eq(RollOutShippDetails::getShift,shift)
+                        .eq(RollOutShippDetails::getShiftGroup,shiftGroup);
+
+                if (storageBill != null && storageBill.getId() != null) {
+                    queryWrapper3.eq(RollOutShippDetails::getStorageBillId, storageBill.getId());
+                }
                 List<RollOutShippDetails> rollOutShippDetailsList = rollOutShippDetailsService.list(queryWrapper3);
                 if (oConvertUtils.listIsNotEmpty(rollOutShippDetailsList)) {
                     List<DestinationStatisticsDetails> currentList3 = rollOutShippDetailsList.stream()
@@ -3732,7 +3763,9 @@ public class StorageBillServiceImpl extends ServiceImpl<StorageBillMapper, Stora
 
         // 根据铸机号、班组、班别、创建时间 查询垛位起剁明细表
         LambdaQueryWrapper<StackingUpLog> stackingUpLogQueryWrapper = new LambdaQueryWrapper<>();
-        stackingUpLogQueryWrapper.eq(StackingUpLog::getCcmNo, ccmNo);
+        stackingUpLogQueryWrapper.eq(StackingUpLog::getCcmNo, ccmNo)
+                                 .eq(StackingUpLog::getShift,shift)
+                                 .eq(StackingUpLog::getShiftGroup,shiftGroup);
 
         stackingUpLogQueryWrapper.between(StackingUpLog::getCreateTime, billetHotsendChangeShift.getCreateTime(), new Date());
 
@@ -3797,8 +3830,16 @@ public class StorageBillServiceImpl extends ServiceImpl<StorageBillMapper, Stora
 
         // 根据铸机号、班组、班别、时间范围。查询棒二明细表
         LambdaQueryWrapper<RollClubTwoDetails> queryWrapper2 = new LambdaQueryWrapper<>();
-        queryWrapper2.eq(RollClubTwoDetails::getCcmNo, ccmNo)
-                .in(RollClubTwoDetails::getStorageBillId, idList);
+        if (idList != null && !idList.isEmpty()) {
+            queryWrapper2.eq(RollClubTwoDetails::getCcmNo, ccmNo)
+                         .eq(RollClubTwoDetails::getShift, shift)
+                         .eq(RollClubTwoDetails::getShiftGroup, shiftGroup)
+                          .in(RollClubTwoDetails::getStorageBillId, idList);
+        } else {
+            queryWrapper2.eq(RollClubTwoDetails::getCcmNo, ccmNo)
+                         .eq(RollClubTwoDetails::getShift, shift)
+                         .eq(RollClubTwoDetails::getShiftGroup, shiftGroup);
+        }
 
         List<RollClubTwoDetails> rollClubTwoDetailsList = rollClubTwoDetailsService.list(queryWrapper2);
         if (oConvertUtils.listIsNotEmpty(rollClubTwoDetailsList)){
@@ -3818,8 +3859,16 @@ public class StorageBillServiceImpl extends ServiceImpl<StorageBillMapper, Stora
 
         // 根据铸机号、班组、班别、时间范围。查询棒三明细表
         LambdaQueryWrapper<RollClubThreeDetails> queryWrapper3 = new LambdaQueryWrapper<>();
-        queryWrapper3.eq(RollClubThreeDetails::getCcmNo, ccmNo)
-                .in(RollClubThreeDetails::getStorageBillId, idList);
+        if (idList != null && !idList.isEmpty()) {
+            queryWrapper3.eq(RollClubThreeDetails::getCcmNo, ccmNo)
+                    .eq(RollClubThreeDetails::getShift, shift)
+                    .eq(RollClubThreeDetails::getShiftGroup, shiftGroup)
+                    .in(RollClubThreeDetails::getStorageBillId, idList);
+        } else {
+            queryWrapper3.eq(RollClubThreeDetails::getCcmNo, ccmNo)
+                    .eq(RollClubThreeDetails::getShift, shift)
+                    .eq(RollClubThreeDetails::getShiftGroup, shiftGroup);
+        }
 
         List<RollClubThreeDetails> rollClubThreeDetailsList = rollClubThreeDetailsService.list(queryWrapper3);
         if (oConvertUtils.listIsNotEmpty(rollClubThreeDetailsList)){
@@ -3845,7 +3894,7 @@ public class StorageBillServiceImpl extends ServiceImpl<StorageBillMapper, Stora
                 .between(RollHeightDetails::getCreateTime, billetHotsendChangeShift.getCreateTime(), new Date());
 
         List<RollHeightDetails> rollHeightDetailsList = rollHeightDetailsService.list(queryWrapper4);
-        if (oConvertUtils.listIsNotEmpty(rollClubTwoDetailsList)){
+        if (oConvertUtils.listIsNotEmpty(rollHeightDetailsList)){
             // 高线总支数    高线属于热送
             int hotSendHeightSum = rollHeightDetailsList.stream()
                     .mapToInt(details -> details.getStackAddr() != null && !details.getStackAddr().isEmpty() ? 4 : 1).sum();
@@ -3865,8 +3914,16 @@ public class StorageBillServiceImpl extends ServiceImpl<StorageBillMapper, Stora
 
         // 根据铸机号、班组、班别、时间范围。查询上若明细表
         LambdaQueryWrapper<RollOutShippDetails> queryWrapper5 = new LambdaQueryWrapper<>();
-        queryWrapper5.eq(RollOutShippDetails::getCcmNo, ccmNo)
-                .in(RollOutShippDetails::getStorageBillId, idList);
+        if (idList != null && !idList.isEmpty()) {
+            queryWrapper5.eq(RollOutShippDetails::getCcmNo, ccmNo)
+                    .eq(RollOutShippDetails::getShift, shift)
+                    .eq(RollOutShippDetails::getShiftGroup, shiftGroup)
+                    .in(RollOutShippDetails::getStorageBillId, idList);
+        } else {
+            queryWrapper5.eq(RollOutShippDetails::getCcmNo, ccmNo)
+                    .eq(RollOutShippDetails::getShift, shift)
+                    .eq(RollOutShippDetails::getShiftGroup, shiftGroup);
+        }
 
         List<RollOutShippDetails> rollOutShippDetailsList = rollOutShippDetailsService.list(queryWrapper5);
         if (oConvertUtils.listIsNotEmpty(rollOutShippDetailsList)){
@@ -4198,6 +4255,8 @@ public class StorageBillServiceImpl extends ServiceImpl<StorageBillMapper, Stora
             shift = billetHotsendChangeShift.getShift();
         }
 
+        onDutySteelVo.setShiftGroup(shiftGroup);
+        onDutySteelVo.setShift(shift);
 
         // 根据铸机号、班组、班别,amountTotal不等于0 ,查询当班装运单信息
         LambdaQueryWrapper<StorageBill> queryWrapper2 = new LambdaQueryWrapper<>();

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

@@ -1,7 +1,6 @@
 package org.jeecg.modules.billet.storageBill.vo;
 
 import lombok.Data;
-import org.jeecg.modules.billet.storageBill.entity.DetailStatistics;
 
 import java.util.List;
 
@@ -17,4 +16,8 @@ public class OnDutySteelVo {
     private List<SizeSummary> rollHeightList;
 
     private List<SizeSummary> rollOutShippList;
+
+    private String shiftGroup;
+
+    private String shift;
 }