|
@@ -23,9 +23,26 @@ import org.jeecg.modules.billet.billetHotsendChangeShift.entity.BilletShiftPerfo
|
|
|
import org.jeecg.modules.billet.billetHotsendChangeShift.service.IBilletHotsendChangeShiftService;
|
|
|
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;
|
|
|
+import org.jeecg.modules.billet.rollClubThree.service.IRollClubThreeDetailsService;
|
|
|
+import org.jeecg.modules.billet.rollClubTwo.entity.RollClubTwoDetails;
|
|
|
+import org.jeecg.modules.billet.rollClubTwo.service.IRollClubTwoDetailsService;
|
|
|
+import org.jeecg.modules.billet.rollHeight.entity.DestinationStatisticsDetails;
|
|
|
+import org.jeecg.modules.billet.rollHeight.service.IRollHeightDetailsService;
|
|
|
+import org.jeecg.modules.billet.rollOutShipp.entity.RollOutShippDetails;
|
|
|
+import org.jeecg.modules.billet.rollOutShipp.service.IRollOutShippDetailsService;
|
|
|
+import org.jeecg.modules.billet.stackingAndLoadingVehicles.entity.StackingUpLog;
|
|
|
+import org.jeecg.modules.billet.stackingAndLoadingVehicles.service.IStackingUpLogService;
|
|
|
+import org.jeecg.modules.billet.storageBill.entity.OnDutyLiftingBillDetails;
|
|
|
import org.jeecg.modules.billet.storageBill.entity.ShiftEnum;
|
|
|
import org.jeecg.modules.billet.storageBill.entity.ShiftGroupEnum;
|
|
|
+import org.jeecg.modules.billet.storageBill.entity.StorageBill;
|
|
|
+import org.jeecg.modules.billet.storageBill.service.IStorageBillService;
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.data.redis.core.RedisTemplate;
|
|
@@ -35,14 +52,14 @@ import org.springframework.web.servlet.ModelAndView;
|
|
|
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
+import java.math.BigDecimal;
|
|
|
import java.time.LocalDateTime;
|
|
|
import java.time.LocalTime;
|
|
|
import java.time.YearMonth;
|
|
|
import java.time.format.DateTimeFormatter;
|
|
|
-import java.util.ArrayList;
|
|
|
-import java.util.Arrays;
|
|
|
-import java.util.Date;
|
|
|
-import java.util.List;
|
|
|
+import java.util.*;
|
|
|
+import java.util.stream.Collectors;
|
|
|
+import java.util.stream.Stream;
|
|
|
|
|
|
/**
|
|
|
* @Description: 钢坯交班记录
|
|
@@ -70,6 +87,30 @@ public class BilletHotsendChangeShiftController extends JeecgController<BilletHo
|
|
|
@Autowired
|
|
|
private IBilletBasicInfoService billetBasicInfoService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private IStackingUpLogService stackingUpLogService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private IBilletLiftingBillService billetLiftingBillService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private IStorageBillService storageBillService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private IRollClubOneDetailsService rollClubOneDetailsService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private IRollClubTwoDetailsService rollClubTwoDetailsService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private IRollClubThreeDetailsService rollClubThreeDetailsService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private IRollOutShippDetailsService rollOutShippDetailsService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private IRollHeightDetailsService rollHeightDetailsService;
|
|
|
+
|
|
|
/**
|
|
|
* 分页列表查询
|
|
|
*
|
|
@@ -406,11 +447,25 @@ public class BilletHotsendChangeShiftController extends JeecgController<BilletHo
|
|
|
IPage<BilletHotsendChangeShift> pageList = billetHotsendChangeShiftService.page(page, queryWrapper);
|
|
|
|
|
|
List<BilletHotsendChangeShift> list = pageList.getRecords();
|
|
|
+
|
|
|
List<BilletShiftPerformance> billetShiftPerformanceList = new ArrayList<>();
|
|
|
|
|
|
+ int totalCountHotsend = 0;
|
|
|
+ double totalWeightHotsend = 0d;
|
|
|
+
|
|
|
+ int totalCountHotfeign = 0;
|
|
|
+ double totalWeightHotfeign = 0d;
|
|
|
+
|
|
|
+ int stackCount = 0;
|
|
|
+ double stackWeight = 0d;
|
|
|
+
|
|
|
for (BilletHotsendChangeShift billetHotsendChangeShift1 : list) {
|
|
|
BilletShiftPerformance billetShiftPerformance = new BilletShiftPerformance();
|
|
|
- BeanUtils.copyProperties(billetHotsendChangeShift1, billetShiftPerformance);
|
|
|
+ try {
|
|
|
+ BeanUtils.copyProperties(billetShiftPerformance, billetHotsendChangeShift1);
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
// 根据ccmNo、shift、shiftGroup、交班开始时间到交班结束时间范围 查询对应钢坯基础信息所有数据
|
|
|
LambdaQueryWrapper<BilletBasicInfo> queryWrapper1 = new LambdaQueryWrapper<>();
|
|
|
queryWrapper1.eq(BilletBasicInfo::getCcmNo, billetHotsendChangeShift1.getCcmNo());
|
|
@@ -420,15 +475,304 @@ public class BilletHotsendChangeShiftController extends JeecgController<BilletHo
|
|
|
List<BilletBasicInfo> billetBasicInfoList = billetBasicInfoService.list(queryWrapper1);
|
|
|
if (oConvertUtils.listIsNotEmpty(billetBasicInfoList)){
|
|
|
|
|
|
+ for (BilletBasicInfo billetBasicInfo : billetBasicInfoList) {
|
|
|
+ // 热送统计 支数、重量
|
|
|
+ if ("roll_height".equals(billetBasicInfo.getBelongTable()) || "roll_club_one".equals(billetBasicInfo.getBelongTable())) {
|
|
|
+ totalCountHotsend ++;
|
|
|
+ if (billetBasicInfo.getBilletWeight() != null) {
|
|
|
+ totalWeightHotsend += billetBasicInfo.getBilletWeight();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // 热装统计 支数、重量
|
|
|
+ if ("roll_club_two".equals(billetBasicInfo.getBelongTable()) || "roll_club_three".equals(billetBasicInfo.getBelongTable()) || "roll_out_shipp".equals(billetBasicInfo.getBelongTable())) {
|
|
|
+ totalCountHotfeign ++;
|
|
|
+ if (billetBasicInfo.getBilletWeight() != null) {
|
|
|
+ totalWeightHotfeign += billetBasicInfo.getBilletWeight();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // 保留 4 位小数
|
|
|
+ totalWeightHotsend = new BigDecimal(totalWeightHotsend).setScale(4, BigDecimal.ROUND_HALF_UP).doubleValue();
|
|
|
+ billetShiftPerformance.setShiftHotsendAmount(totalCountHotsend);
|
|
|
+ billetShiftPerformance.setShiftHotsendWeight(totalWeightHotsend);
|
|
|
+
|
|
|
+ // 保留 4 位小数
|
|
|
+ totalWeightHotfeign = new BigDecimal(totalWeightHotfeign).setScale(4, BigDecimal.ROUND_HALF_UP).doubleValue();
|
|
|
+ billetShiftPerformance.setShiftHotfeignAmount(totalCountHotfeign);
|
|
|
+ billetShiftPerformance.setShiftHotfeignWeight(totalWeightHotfeign);
|
|
|
+
|
|
|
+ // 班组定尺
|
|
|
+ List<DestinationStatisticsDetails> lengthGroupList = new ArrayList<>();
|
|
|
+ Map<Integer, GroupInfo> lengthGroupMap = new HashMap<>();
|
|
|
+ String ccmNo = billetHotsendChangeShift1.getCcmNo();
|
|
|
+ for (BilletBasicInfo info : billetBasicInfoList) {
|
|
|
+ int length = info.getLength();
|
|
|
+ double weight = info.getBilletWeight();
|
|
|
+ GroupInfo groupInfo = lengthGroupMap.computeIfAbsent(length, k -> new GroupInfo());
|
|
|
+ groupInfo.sum++;
|
|
|
+ groupInfo.weight += weight;
|
|
|
+ }
|
|
|
+ for (Map.Entry<Integer, GroupInfo> entry : lengthGroupMap.entrySet()) {
|
|
|
+ int length = entry.getKey();
|
|
|
+ GroupInfo groupInfo = entry.getValue();
|
|
|
+ // 保留 4 位小数
|
|
|
+ BigDecimal bd = new BigDecimal(groupInfo.weight).setScale(4, BigDecimal.ROUND_HALF_UP);
|
|
|
+ double roundedWeight = bd.doubleValue();
|
|
|
+ DestinationStatisticsDetails details = new DestinationStatisticsDetails(
|
|
|
+ String.valueOf(length),
|
|
|
+ groupInfo.sum,
|
|
|
+ roundedWeight,
|
|
|
+ ccmNo
|
|
|
+ );
|
|
|
+ lengthGroupList.add(details);
|
|
|
+ }
|
|
|
+ billetShiftPerformance.setDestinationStatisticsDetailsList(lengthGroupList);
|
|
|
+ }
|
|
|
+ // 堆垛统计 支数、重量 根据铸机号、班组、班别、时间范围。查询起跺日志明细表
|
|
|
+ LambdaQueryWrapper<StackingUpLog> stackingUpLogQueryWrapper = new LambdaQueryWrapper<>();
|
|
|
+ stackingUpLogQueryWrapper.eq(StackingUpLog::getCcmNo, billetHotsendChangeShift1.getCcmNo());
|
|
|
+ stackingUpLogQueryWrapper.eq(StackingUpLog::getShift, billetHotsendChangeShift1.getShift());
|
|
|
+ stackingUpLogQueryWrapper.eq(StackingUpLog::getShiftGroup, billetHotsendChangeShift1.getShiftGroup());
|
|
|
+ stackingUpLogQueryWrapper.between(StackingUpLog::getCreateTime, billetHotsendChangeShift1.getCreateTime(), billetHotsendChangeShift1.getChangeShiftTime());
|
|
|
+
|
|
|
+ List<StackingUpLog> stackingUpLogList = stackingUpLogService.list(stackingUpLogQueryWrapper);
|
|
|
+ if (oConvertUtils.listIsNotEmpty(stackingUpLogList)) {
|
|
|
+ // 收集所有的 billetNo
|
|
|
+ Set<String> allBilletNos = new HashSet<>();
|
|
|
+ for (StackingUpLog stackingUpLog : stackingUpLogList) {
|
|
|
+ if (oConvertUtils.isNotEmpty(stackingUpLog.getBilletNo())) {
|
|
|
+ String[] billetNoArray = stackingUpLog.getBilletNo().split(",");
|
|
|
+ allBilletNos.addAll(Arrays.asList(billetNoArray));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // 通过billetNo匹配 billetBasicInfoList中的坯号
|
|
|
+ for (BilletBasicInfo billetBasicInfo : billetBasicInfoList) {
|
|
|
+ if (allBilletNos.contains(billetBasicInfo.getBilletNo())) {
|
|
|
+ stackCount ++;
|
|
|
+ if (billetBasicInfo.getBilletWeight() != null) {
|
|
|
+ stackWeight += billetBasicInfo.getBilletWeight();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // 保留 4 位小数
|
|
|
+ stackWeight = new BigDecimal(stackWeight).setScale(4, BigDecimal.ROUND_HALF_UP).doubleValue();
|
|
|
+ billetShiftPerformance.setShiftStackAmount(stackCount);
|
|
|
+ billetShiftPerformance.setShiftStackWeight(stackWeight);
|
|
|
+ }
|
|
|
|
|
|
|
|
|
+ // 班次吊运信息
|
|
|
+ // 根据铸机号、班组、班别、交班的创建时间,查询当班行车吊运单信息,
|
|
|
+ LambdaQueryWrapper<BilletLiftingBill> queryWrapper2 = new LambdaQueryWrapper<>();
|
|
|
+ queryWrapper2.eq(BilletLiftingBill::getCcmNo, billetHotsendChangeShift1.getCcmNo())
|
|
|
+ .eq(BilletLiftingBill::getShift, billetHotsendChangeShift1.getShift())
|
|
|
+ .eq(BilletLiftingBill::getShiftGroup, billetHotsendChangeShift1.getShiftGroup())
|
|
|
+ .between(BilletLiftingBill::getCreateTime, billetHotsendChangeShift.getCreateTime(), billetHotsendChangeShift.getChangeShiftTime())
|
|
|
+ .groupBy(BilletLiftingBill::getVehicleNumber);
|
|
|
+ List<BilletLiftingBill> billetLiftingBillList = billetLiftingBillService.list(queryWrapper2);
|
|
|
+ if (oConvertUtils.listIsNotEmpty(billetLiftingBillList)){
|
|
|
+ List<String> vehicleNumberList = billetLiftingBillList.stream().map(BilletLiftingBill::getVehicleNumber).collect(Collectors.toList());
|
|
|
+ List<OnDutyLiftingBillDetails> allDetailsList = new ArrayList<>();
|
|
|
+ for (String vehicleNumber : vehicleNumberList) {
|
|
|
+ OnDutyLiftingBillDetails details = new OnDutyLiftingBillDetails();
|
|
|
+ details.setVehicleNumber(vehicleNumber);
|
|
|
+ details.setChangeShiftCreateTime(billetHotsendChangeShift.getCreateTime());
|
|
|
+ // 热送统计
|
|
|
+ countAndSet(details, billetHotsendChangeShift, vehicleNumber, "0","hotSendAmont");
|
|
|
+ // 热装统计
|
|
|
+ countAndSet(details, billetHotsendChangeShift, vehicleNumber, "1","hotChargingAmont");
|
|
|
+ // 堆垛统计
|
|
|
+ countAndSet(details, billetHotsendChangeShift, vehicleNumber, "2","stackingAmont");
|
|
|
+
|
|
|
+ allDetailsList.add(details);
|
|
|
+ }
|
|
|
+ billetShiftPerformance.setOnDutyLiftingBillDetailsList(allDetailsList);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ // 班次装运统计 车次总数、总重、总支数 查询当班装运单信息
|
|
|
+ LambdaQueryWrapper<StorageBill> queryWrapper3 = new LambdaQueryWrapper<>();
|
|
|
+ queryWrapper3.eq(StorageBill::getCcmNo, billetHotsendChangeShift1.getCcmNo())
|
|
|
+ .eq(StorageBill::getShift, billetHotsendChangeShift1.getShift())
|
|
|
+ .eq(StorageBill::getShiftGroup, billetHotsendChangeShift1.getShiftGroup())
|
|
|
+ .isNotNull(StorageBill::getDestination)
|
|
|
+ .ne(StorageBill::getTypeConfigId, "1024")
|
|
|
+ .between(StorageBill::getCreateTime, billetHotsendChangeShift.getCreateTime(), billetHotsendChangeShift.getChangeShiftTime());
|
|
|
+ List<StorageBill> storageBillList = storageBillService.list(queryWrapper3);
|
|
|
+ if (oConvertUtils.listIsNotEmpty(storageBillList)){
|
|
|
+ // 装运总次数
|
|
|
+ int allCarNum = storageBillList.size();
|
|
|
+
|
|
|
+ List<DestinationStatisticsDetails> statisticsDetailsList1 = new ArrayList<>();
|
|
|
+ List<DestinationStatisticsDetails> statisticsDetailsList2 = new ArrayList<>();
|
|
|
+ List<DestinationStatisticsDetails> statisticsDetailsList3 = new ArrayList<>();
|
|
|
+
|
|
|
+ for (StorageBill storageBill : storageBillList) {
|
|
|
+ if ("棒二".equals(storageBill.getDestination())) {
|
|
|
+ LambdaQueryWrapper<RollClubTwoDetails> queryWrapper4 = new LambdaQueryWrapper<>();
|
|
|
+ queryWrapper4.eq(RollClubTwoDetails::getCcmNo, billetHotsendChangeShift1.getCcmNo())
|
|
|
+ .eq(RollClubTwoDetails::getStorageBillId, storageBill.getId());
|
|
|
+ List<RollClubTwoDetails> rollClubTwoDetailsList = rollClubTwoDetailsService.list(queryWrapper4);
|
|
|
+ if (oConvertUtils.listIsNotEmpty(rollClubTwoDetailsList)) {
|
|
|
+ List<DestinationStatisticsDetails> currentList1 = rollClubTwoDetailsList.stream()
|
|
|
+ .collect(Collectors.groupingBy(RollClubTwoDetails::getSize))
|
|
|
+ .entrySet().stream()
|
|
|
+ .map(entry -> {
|
|
|
+ String size = entry.getKey();
|
|
|
+ List<RollClubTwoDetails> group = entry.getValue();
|
|
|
+ // 统计 blankOutput 总和
|
|
|
+ Double totalBlankOutput = group.stream()
|
|
|
+ .mapToDouble(RollClubTwoDetails::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());
|
|
|
+ statisticsDetailsList1.addAll(currentList1);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if ("棒三".equals(storageBill.getDestination())) {
|
|
|
+ LambdaQueryWrapper<RollClubThreeDetails> queryWrapper5 = new LambdaQueryWrapper<>();
|
|
|
+ queryWrapper5.eq(RollClubThreeDetails::getCcmNo, billetHotsendChangeShift1.getCcmNo())
|
|
|
+ .eq(RollClubThreeDetails::getStorageBillId, storageBill.getId());
|
|
|
+ List<RollClubThreeDetails> rollClubThreeDetailsList = rollClubThreeDetailsService.list(queryWrapper5);
|
|
|
+ if (oConvertUtils.listIsNotEmpty(rollClubThreeDetailsList)) {
|
|
|
+ List<DestinationStatisticsDetails> currentList2 = rollClubThreeDetailsList.stream()
|
|
|
+ .collect(Collectors.groupingBy(RollClubThreeDetails::getSize))
|
|
|
+ .entrySet().stream()
|
|
|
+ .map(entry -> {
|
|
|
+ String size = entry.getKey();
|
|
|
+ List<RollClubThreeDetails> group = entry.getValue();
|
|
|
+ // 统计 blankOutput 总和
|
|
|
+ Double totalBlankOutput = group.stream()
|
|
|
+ .mapToDouble(RollClubThreeDetails::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());
|
|
|
+ statisticsDetailsList2.addAll(currentList2);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if ("上若".equals(storageBill.getDestination())) {
|
|
|
+ LambdaQueryWrapper<RollOutShippDetails> queryWrapper6 = new LambdaQueryWrapper<>();
|
|
|
+ queryWrapper6.eq(RollOutShippDetails::getCcmNo, billetHotsendChangeShift1.getCcmNo())
|
|
|
+ .eq(RollOutShippDetails::getStorageBillId, storageBill.getId());
|
|
|
+ List<RollOutShippDetails> rollOutShippDetailsList = rollOutShippDetailsService.list(queryWrapper6);
|
|
|
+ if (oConvertUtils.listIsNotEmpty(rollOutShippDetailsList)) {
|
|
|
+ List<DestinationStatisticsDetails> currentList3 = rollOutShippDetailsList.stream()
|
|
|
+ .collect(Collectors.groupingBy(RollOutShippDetails::getSize))
|
|
|
+ .entrySet().stream()
|
|
|
+ .map(entry -> {
|
|
|
+ String size = entry.getKey();
|
|
|
+ List<RollOutShippDetails> group = entry.getValue();
|
|
|
+ // 统计 blankOutput 总和
|
|
|
+ Double totalBlankOutput = group.stream()
|
|
|
+ .mapToDouble(RollOutShippDetails::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());
|
|
|
+ statisticsDetailsList3.addAll(currentList3);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // 合并三个列表并根据 size 分组统计
|
|
|
+ List<DestinationStatisticsDetails> mergedList = Stream.concat(
|
|
|
+ Stream.concat(statisticsDetailsList1.stream(), statisticsDetailsList2.stream()),
|
|
|
+ statisticsDetailsList3.stream()
|
|
|
+ ).collect(Collectors.groupingBy(DestinationStatisticsDetails::getSize))
|
|
|
+ .entrySet().stream()
|
|
|
+ .map(entry -> {
|
|
|
+ String size = entry.getKey();
|
|
|
+ List<DestinationStatisticsDetails> group = entry.getValue();
|
|
|
+ int totalNums = group.stream().mapToInt(DestinationStatisticsDetails::getNums).sum();
|
|
|
+ double totalBlankOutput = group.stream().mapToDouble(DestinationStatisticsDetails::getBlankOutput).sum();
|
|
|
+ BigDecimal bd = BigDecimal.valueOf(totalBlankOutput).setScale(4, BigDecimal.ROUND_HALF_UP);
|
|
|
+ double finalBlankOutput = bd.doubleValue();
|
|
|
+ String ccmNoForGroup = group.isEmpty() ? null : group.get(0).getCcmNo();
|
|
|
+ return new DestinationStatisticsDetails(size, totalNums, finalBlankOutput, ccmNoForGroup);
|
|
|
+ }).collect(Collectors.toList());
|
|
|
+ // 遍历mergedList获取nums总和
|
|
|
+ int finalAmountTotal = mergedList.stream().mapToInt(DestinationStatisticsDetails::getNums).sum();
|
|
|
+ // 遍历mergedList获取blankOutput总和
|
|
|
+ double finalBlankOutputs = mergedList.stream().mapToDouble(DestinationStatisticsDetails::getBlankOutput).sum();
|
|
|
+ BigDecimal bd = BigDecimal.valueOf(finalBlankOutputs).setScale(4, BigDecimal.ROUND_HALF_UP);
|
|
|
+
|
|
|
+ billetShiftPerformance.setAllCarNum(allCarNum);
|
|
|
+ billetShiftPerformance.setCounts(finalAmountTotal);
|
|
|
+ billetShiftPerformance.setBlankOutputs(bd);
|
|
|
+
|
|
|
+ billetShiftPerformance.setRollClubTwoDetailsList(statisticsDetailsList1);
|
|
|
+ billetShiftPerformance.setRollClubThreeDetailsList(statisticsDetailsList2);
|
|
|
+ billetShiftPerformance.setRollOutShippDetailsList(statisticsDetailsList3);
|
|
|
+ }
|
|
|
+
|
|
|
+ // 班次实绩, 统计轧钢棒一
|
|
|
+ LambdaQueryWrapper<RollClubOneDetails> queryWrapperDetails = new LambdaQueryWrapper<>();
|
|
|
+ queryWrapperDetails.eq(RollClubOneDetails::getCcmNo, billetHotsendChangeShift1.getCcmNo())
|
|
|
+ .eq(RollClubOneDetails::getShift, billetHotsendChangeShift1.getShift())
|
|
|
+ .eq(RollClubOneDetails::getShiftGroup, billetHotsendChangeShift1.getShiftGroup())
|
|
|
+ .between(RollClubOneDetails::getCreateTime, billetHotsendChangeShift.getCreateTime(), billetHotsendChangeShift.getChangeShiftTime());
|
|
|
+ List<RollClubOneDetails> rollClubOneDetailsList = rollClubOneDetailsService.list(queryWrapperDetails);
|
|
|
+ if (oConvertUtils.listIsNotEmpty(rollClubOneDetailsList)){
|
|
|
+ // 根据size属性进行分组,并统计每组的总数和总重 直接在流操作中完成分组、求和并保留 4 位小数
|
|
|
+ Map<String, Double> sumBySizeAndCcmNo = rollClubOneDetailsList.stream()
|
|
|
+ .collect(Collectors.groupingBy(
|
|
|
+ roll -> roll.getSize() + "_" + roll.getCcmNo(),
|
|
|
+ Collectors.collectingAndThen(
|
|
|
+ Collectors.summingDouble(RollClubOneDetails::getBlankOutput),
|
|
|
+ sum -> BigDecimal.valueOf(sum)
|
|
|
+ .setScale(4, BigDecimal.ROUND_HALF_UP)
|
|
|
+ .doubleValue()
|
|
|
+ )
|
|
|
+ ));
|
|
|
+
|
|
|
+ Map<String, Long> countBySizeAndCcmNo = rollClubOneDetailsList.stream()
|
|
|
+ // 通过一个Function将size和ccmNo组合起来作为分组的键
|
|
|
+ .collect(Collectors.groupingBy(roll -> roll.getSize() + "_" + roll.getCcmNo(),
|
|
|
+ // 直接使用Collectors.counting()来统计每个分组内元素的个数
|
|
|
+ Collectors.counting()
|
|
|
+ ));
|
|
|
+
|
|
|
+ List<DestinationStatisticsDetails> rollClubOneDetailsStatisticsList = new ArrayList<>();
|
|
|
+ sumBySizeAndCcmNo.forEach((size, totalWeight) -> {
|
|
|
+ String[] parts = size.split("_");
|
|
|
+ String sizeStr = parts[0];
|
|
|
+ String ccmNoStr = parts[1];
|
|
|
+ long count = countBySizeAndCcmNo.get(size);
|
|
|
+ // 找到第一个匹配size的RollClubOneDetails对象获取其ccmNo值(假设ccmNo在同一size分组内是相同的,如有不同需调整逻辑)
|
|
|
+ rollClubOneDetailsStatisticsList.add(new DestinationStatisticsDetails(sizeStr, (int) count, totalWeight, ccmNoStr));
|
|
|
+ });
|
|
|
+
|
|
|
+ billetShiftPerformance.setRollClubOneDetailsList(rollClubOneDetailsStatisticsList);
|
|
|
}
|
|
|
|
|
|
|
|
|
- billetShiftPerformanceList.add(billetShiftPerformance);
|
|
|
- }
|
|
|
|
|
|
|
|
|
+
|
|
|
+ billetShiftPerformanceList.add(billetShiftPerformance);
|
|
|
+ }
|
|
|
// 创建新的分页对象,并设置相关属性
|
|
|
Page<BilletShiftPerformance> newPage = new Page<>(pageNo, pageSize);
|
|
|
newPage.setRecords(billetShiftPerformanceList);
|
|
@@ -438,4 +782,45 @@ public class BilletHotsendChangeShiftController extends JeecgController<BilletHo
|
|
|
newPage.setSize(pageList.getSize());
|
|
|
return Result.OK(newPage);
|
|
|
}
|
|
|
+
|
|
|
+ static class GroupInfo {
|
|
|
+ int sum = 0;
|
|
|
+ double weight = 0;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ private void countAndSet(OnDutyLiftingBillDetails details, BilletHotsendChangeShift billetHotsendChangeShift, String vehicleNumber, String liftingType, String amountField) {
|
|
|
+ LambdaQueryWrapper<BilletLiftingBill> queryWrapper = new LambdaQueryWrapper<>();
|
|
|
+ queryWrapper.eq(BilletLiftingBill::getCcmNo, billetHotsendChangeShift.getCcmNo())
|
|
|
+ .eq(BilletLiftingBill::getShift, billetHotsendChangeShift.getShift())
|
|
|
+ .eq(BilletLiftingBill::getShiftGroup, billetHotsendChangeShift.getShiftGroup())
|
|
|
+ .eq(BilletLiftingBill::getVehicleNumber, vehicleNumber)
|
|
|
+ .eq(BilletLiftingBill::getLiftingType, liftingType)
|
|
|
+ .between(BilletLiftingBill::getCreateTime, billetHotsendChangeShift.getCreateTime(), billetHotsendChangeShift.getChangeShiftTime());
|
|
|
+
|
|
|
+ List<BilletLiftingBill> billList = billetLiftingBillService.list(queryWrapper);
|
|
|
+ int amount;
|
|
|
+ double weight;
|
|
|
+ if (oConvertUtils.listIsNotEmpty(billList)) {
|
|
|
+ amount = billList.size() * 4;
|
|
|
+ weight = billList.stream().mapToDouble(BilletLiftingBill::getBilletWeight).sum();
|
|
|
+ } else {
|
|
|
+ amount = 0;
|
|
|
+ weight = 0;
|
|
|
+ }
|
|
|
+ switch (amountField) {
|
|
|
+ case "hotSendAmont":
|
|
|
+ details.setHotSendAmont(amount);
|
|
|
+ details.setHotSendWeight(weight);
|
|
|
+ break;
|
|
|
+ case "hotChargingAmont":
|
|
|
+ details.setHotChargingAmont(amount);
|
|
|
+ details.setHotChargingWeight(weight);
|
|
|
+ break;
|
|
|
+ case "stackingAmont":
|
|
|
+ details.setStackingAmont(amount);
|
|
|
+ details.setAmontWeight(weight);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|