|
@@ -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);
|
|
|
}
|
|
|
|