|
@@ -1,5 +1,6 @@
|
|
|
package org.jeecg.modules.billet.billetHotsendChangeShift.controller;
|
|
|
|
|
|
+import com.alibaba.fastjson.JSON;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
@@ -54,6 +55,7 @@ import org.springframework.web.servlet.ModelAndView;
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
import java.math.BigDecimal;
|
|
|
+import java.math.RoundingMode;
|
|
|
import java.text.DecimalFormat;
|
|
|
import java.time.LocalDateTime;
|
|
|
import java.time.LocalTime;
|
|
@@ -498,8 +500,8 @@ public class BilletHotsendChangeShiftController extends JeecgController<BilletHo
|
|
|
// 根据铸机号、交班结束时间倒序并不为空,查询交班记录,
|
|
|
LambdaQueryWrapper<BilletHotsendChangeShift> queryWrapper = new LambdaQueryWrapper<>();
|
|
|
queryWrapper.eq(BilletHotsendChangeShift::getCcmNo, "5")
|
|
|
+ .isNotNull(BilletHotsendChangeShift::getChangeShiftTime)
|
|
|
.orderByDesc(BilletHotsendChangeShift::getChangeShiftTime)
|
|
|
- .ne(BilletHotsendChangeShift::getChangeShiftTime, null)
|
|
|
.last("limit 1");
|
|
|
BilletHotsendChangeShift billetHotsendChangeShift = billetHotsendChangeShiftService.getOne(queryWrapper);
|
|
|
if (billetHotsendChangeShift == null) {
|
|
@@ -519,8 +521,8 @@ public class BilletHotsendChangeShiftController extends JeecgController<BilletHo
|
|
|
// 根据铸机号、交班结束时间倒序并不为空,查询交班记录,
|
|
|
LambdaQueryWrapper<BilletHotsendChangeShift> queryWrapper = new LambdaQueryWrapper<>();
|
|
|
queryWrapper.eq(BilletHotsendChangeShift::getCcmNo, "6")
|
|
|
+ .isNotNull(BilletHotsendChangeShift::getChangeShiftTime)
|
|
|
.orderByDesc(BilletHotsendChangeShift::getChangeShiftTime)
|
|
|
- .ne(BilletHotsendChangeShift::getChangeShiftTime, null)
|
|
|
.last("limit 1");
|
|
|
BilletHotsendChangeShift billetHotsendChangeShift = billetHotsendChangeShiftService.getOne(queryWrapper);
|
|
|
if (billetHotsendChangeShift == null) {
|
|
@@ -606,7 +608,7 @@ public class BilletHotsendChangeShiftController extends JeecgController<BilletHo
|
|
|
billetHotsendChangeShift.setShiftHotfeignWeight(totalWeightHotfeign);
|
|
|
|
|
|
// 班次定尺明细
|
|
|
- billetHotsendChangeShift.setSizeDetailsList(lengthGroupList);
|
|
|
+ billetHotsendChangeShift.setSizeDetailsList(JSON.toJSONString(lengthGroupList));
|
|
|
}
|
|
|
|
|
|
|
|
@@ -658,8 +660,8 @@ public class BilletHotsendChangeShiftController extends JeecgController<BilletHo
|
|
|
// 根据铸机号、交班结束时间倒序并不为空,查询交班记录,
|
|
|
LambdaQueryWrapper<BilletHotsendChangeShift> queryWrapper = new LambdaQueryWrapper<>();
|
|
|
queryWrapper.eq(BilletHotsendChangeShift::getCcmNo, "5")
|
|
|
+ .isNotNull(BilletHotsendChangeShift::getChangeShiftTime)
|
|
|
.orderByDesc(BilletHotsendChangeShift::getChangeShiftTime)
|
|
|
- .ne(BilletHotsendChangeShift::getChangeShiftTime, null)
|
|
|
.last("limit 1");
|
|
|
BilletHotsendChangeShift billetHotsendChangeShift = billetHotsendChangeShiftService.getOne(queryWrapper);
|
|
|
if (billetHotsendChangeShift == null) {
|
|
@@ -679,8 +681,8 @@ public class BilletHotsendChangeShiftController extends JeecgController<BilletHo
|
|
|
// 根据铸机号、交班结束时间倒序并不为空,查询交班记录,
|
|
|
LambdaQueryWrapper<BilletHotsendChangeShift> queryWrapper = new LambdaQueryWrapper<>();
|
|
|
queryWrapper.eq(BilletHotsendChangeShift::getCcmNo, "6")
|
|
|
+ .isNotNull(BilletHotsendChangeShift::getChangeShiftTime)
|
|
|
.orderByDesc(BilletHotsendChangeShift::getChangeShiftTime)
|
|
|
- .ne(BilletHotsendChangeShift::getChangeShiftTime, null)
|
|
|
.last("limit 1");
|
|
|
BilletHotsendChangeShift billetHotsendChangeShift = billetHotsendChangeShiftService.getOne(queryWrapper);
|
|
|
if (billetHotsendChangeShift == null) {
|
|
@@ -733,7 +735,7 @@ public class BilletHotsendChangeShiftController extends JeecgController<BilletHo
|
|
|
countAndSet(details, billetHotsendChangeShift, vehicleNumber, "2","stackingAmont");
|
|
|
allDetailsList.add(details);
|
|
|
}
|
|
|
- billetHotsendChangeShift.setLiftingBillDetailsList(allDetailsList);
|
|
|
+ billetHotsendChangeShift.setLiftingBillDetailsList(JSON.toJSONString(allDetailsList));
|
|
|
billetHotsendChangeShiftService.updateById(billetHotsendChangeShift);
|
|
|
}
|
|
|
|
|
@@ -752,8 +754,8 @@ public class BilletHotsendChangeShiftController extends JeecgController<BilletHo
|
|
|
// 根据铸机号、交班结束时间倒序并不为空,查询交班记录,
|
|
|
LambdaQueryWrapper<BilletHotsendChangeShift> queryWrapper = new LambdaQueryWrapper<>();
|
|
|
queryWrapper.eq(BilletHotsendChangeShift::getCcmNo, "5")
|
|
|
+ .isNotNull(BilletHotsendChangeShift::getChangeShiftTime)
|
|
|
.orderByDesc(BilletHotsendChangeShift::getChangeShiftTime)
|
|
|
- .ne(BilletHotsendChangeShift::getChangeShiftTime, null)
|
|
|
.last("limit 1");
|
|
|
BilletHotsendChangeShift billetHotsendChangeShift = billetHotsendChangeShiftService.getOne(queryWrapper);
|
|
|
if (billetHotsendChangeShift == null) {
|
|
@@ -778,8 +780,8 @@ public class BilletHotsendChangeShiftController extends JeecgController<BilletHo
|
|
|
// 根据铸机号、交班结束时间倒序并不为空,查询交班记录,
|
|
|
LambdaQueryWrapper<BilletHotsendChangeShift> queryWrapper = new LambdaQueryWrapper<>();
|
|
|
queryWrapper.eq(BilletHotsendChangeShift::getCcmNo, "6")
|
|
|
+ .isNotNull(BilletHotsendChangeShift::getChangeShiftTime)
|
|
|
.orderByDesc(BilletHotsendChangeShift::getChangeShiftTime)
|
|
|
- .ne(BilletHotsendChangeShift::getChangeShiftTime, null)
|
|
|
.last("limit 1");
|
|
|
BilletHotsendChangeShift billetHotsendChangeShift = billetHotsendChangeShiftService.getOne(queryWrapper);
|
|
|
if (billetHotsendChangeShift == null) {
|
|
@@ -933,16 +935,72 @@ public class BilletHotsendChangeShiftController extends JeecgController<BilletHo
|
|
|
billetHotsendChangeShift.setBlankOutputs(bd.doubleValue());
|
|
|
|
|
|
// 轧钢棒二明细
|
|
|
- billetHotsendChangeShift.setRollClubTwoDetails(statisticsDetailsList1);
|
|
|
+ // 按照 size 分组,计算 nums 和 blankOutput 的总和,取每组第一条记录的 ccmNo
|
|
|
+ Map<String, DestinationStatisticsDetails> result1 = statisticsDetailsList1.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> statisticsDetailsGroup1List = new ArrayList<>(result1.values());
|
|
|
+ billetHotsendChangeShift.setRollClubTwoDetails(JSON.toJSONString(statisticsDetailsGroup1List));
|
|
|
|
|
|
// 轧钢棒三明细
|
|
|
- billetHotsendChangeShift.setRollClubThreeDetails(statisticsDetailsList2);
|
|
|
+ // 按照 size 分组,计算 nums 和 blankOutput 的总和,取每组第一条记录的 ccmNo
|
|
|
+ Map<String, DestinationStatisticsDetails> result2 = statisticsDetailsList2.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> statisticsDetailsGroup2List = new ArrayList<>(result2.values());
|
|
|
+ billetHotsendChangeShift.setRollClubThreeDetails(JSON.toJSONString(statisticsDetailsGroup2List));
|
|
|
|
|
|
// 轧钢上若明细
|
|
|
- billetHotsendChangeShift.setRollClubShipDetails(statisticsDetailsList3);
|
|
|
+ // 按照 size 分组,计算 nums 和 blankOutput 的总和,取每组第一条记录的 ccmNo
|
|
|
+ Map<String, DestinationStatisticsDetails> result3 = statisticsDetailsList3.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> statisticsDetailsGroup3List = new ArrayList<>(result3.values());
|
|
|
+ billetHotsendChangeShift.setRollClubShipDetails(JSON.toJSONString(statisticsDetailsGroup3List));
|
|
|
billetHotsendChangeShiftService.updateById(billetHotsendChangeShift);
|
|
|
}
|
|
|
|
|
|
+ private static double roundToFourDecimals(double value) {
|
|
|
+ BigDecimal bd = new BigDecimal(Double.toString(value));
|
|
|
+ bd = bd.setScale(4, RoundingMode.HALF_UP);
|
|
|
+ return bd.doubleValue();
|
|
|
+ }
|
|
|
|
|
|
/**
|
|
|
* 5号机
|
|
@@ -957,6 +1015,7 @@ public class BilletHotsendChangeShiftController extends JeecgController<BilletHo
|
|
|
// 根据铸机号、交班结束时间倒序并不为空,查询交班记录,
|
|
|
LambdaQueryWrapper<BilletHotsendChangeShift> queryWrapper = new LambdaQueryWrapper<>();
|
|
|
queryWrapper.eq(BilletHotsendChangeShift::getCcmNo, "5")
|
|
|
+ .isNotNull(BilletHotsendChangeShift::getChangeShiftTime)
|
|
|
.orderByDesc(BilletHotsendChangeShift::getCreateTime)
|
|
|
.last("limit 1");
|
|
|
BilletHotsendChangeShift billetHotsendChangeShift = billetHotsendChangeShiftService.getOne(queryWrapper);
|
|
@@ -1004,7 +1063,7 @@ public class BilletHotsendChangeShiftController extends JeecgController<BilletHo
|
|
|
rollClubOneDetailsStatisticsList.add(new DestinationStatisticsDetails(sizeStr, (int) count, totalWeight, ccmNoStr));
|
|
|
});
|
|
|
|
|
|
- billetHotsendChangeShift.setRollClubOneDetails(rollClubOneDetailsStatisticsList);
|
|
|
+ billetHotsendChangeShift.setRollClubOneDetails(JSON.toJSONString(rollClubOneDetailsStatisticsList));
|
|
|
|
|
|
billetHotsendChangeShiftService.updateById(billetHotsendChangeShift);
|
|
|
|
|
@@ -1024,8 +1083,8 @@ public class BilletHotsendChangeShiftController extends JeecgController<BilletHo
|
|
|
// 根据铸机号、交班结束时间倒序并不为空,查询交班记录,
|
|
|
LambdaQueryWrapper<BilletHotsendChangeShift> queryWrapper = new LambdaQueryWrapper<>();
|
|
|
queryWrapper.eq(BilletHotsendChangeShift::getCcmNo, "6")
|
|
|
+ .isNotNull(BilletHotsendChangeShift::getChangeShiftTime)
|
|
|
.orderByDesc(BilletHotsendChangeShift::getChangeShiftTime)
|
|
|
- .ne(BilletHotsendChangeShift::getChangeShiftTime, null)
|
|
|
.last("limit 1");
|
|
|
BilletHotsendChangeShift billetHotsendChangeShift = billetHotsendChangeShiftService.getOne(queryWrapper);
|
|
|
if (billetHotsendChangeShift == null) {
|
|
@@ -1074,7 +1133,7 @@ public class BilletHotsendChangeShiftController extends JeecgController<BilletHo
|
|
|
rollHeightStatisticsDetailsList.add(new DestinationStatisticsDetails(sizeStr, (int) count, totalWeight, ccmNoStr));
|
|
|
});
|
|
|
|
|
|
- billetHotsendChangeShift.setRollClubHeightDetails(rollHeightStatisticsDetailsList);
|
|
|
+ billetHotsendChangeShift.setRollClubHeightDetails(JSON.toJSONString(rollHeightStatisticsDetailsList));
|
|
|
billetHotsendChangeShiftService.updateById(billetHotsendChangeShift);
|
|
|
|
|
|
}
|