From 583b80a582f9280a262ee72506d31d1bfa46f734 Mon Sep 17 00:00:00 2001
From: 廖井涛 <2265517004@qq.com>
Date: 星期三, 10 十二月 2025 11:29:57 +0800
Subject: [PATCH] 补交
---
north-glass-erp/src/main/java/com/example/erp/service/pp/ReportService.java | 73 +++++++++++++++++++++++++++++++-----
1 files changed, 63 insertions(+), 10 deletions(-)
diff --git a/north-glass-erp/src/main/java/com/example/erp/service/pp/ReportService.java b/north-glass-erp/src/main/java/com/example/erp/service/pp/ReportService.java
index 6b1f586..b68291d 100644
--- a/north-glass-erp/src/main/java/com/example/erp/service/pp/ReportService.java
+++ b/north-glass-erp/src/main/java/com/example/erp/service/pp/ReportService.java
@@ -15,9 +15,11 @@
import com.example.erp.entity.pp.Report;
import com.example.erp.mapper.pp.*;
import com.example.erp.mapper.sd.*;
+import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;
+import org.springframework.web.bind.annotation.RequestBody;
import javax.annotation.PreDestroy;
import javax.annotation.Resource;
@@ -32,6 +34,8 @@
import java.util.*;
import java.util.concurrent.*;
import java.util.function.Function;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
import java.util.stream.Collectors;
import static cn.hutool.core.convert.Convert.toDouble;
@@ -58,6 +62,33 @@
@Resource
private AsyncQueryExecutor asyncExecutor;
+
+ //鏍规嵁鍦ㄥ埗鍝佸悕绉拌幏鍙栧帤搴�
+ private List<BigDecimal> parseGlassThicknessList(String glassName) {
+ List<BigDecimal> list = new ArrayList<>();
+ if (glassName == null || glassName.isEmpty()) {
+ return list;
+ }
+
+ // 鍖归厤鎵�鏈� "鏁板瓧 + mm"锛屾敮鎸佸皬鏁帮紝渚嬪 3.2mm銆�5mm銆�8mm
+ Pattern pattern = Pattern.compile("(\\d+(?:\\.\\d+)?)mm");
+ Matcher matcher = pattern.matcher(glassName);
+
+ while (matcher.find()) {
+ String numStr = matcher.group(1); // 鎹曡幏 5銆�8銆�3.2
+ try {
+ list.add(new BigDecimal(numStr));
+ } catch (Exception ignore) {
+ }
+ }
+ return list;
+ }
+
+ //鐜荤拑鍘氬害姹傚拰
+ private BigDecimal calcGlassThicknessSum(String glassName) {
+ return parseGlassThicknessList(glassName).stream()
+ .reduce(BigDecimal.ZERO, BigDecimal::add);
+ }
//涓婂伐搴忔姤宸ョ彮缁�
private void mergeTeamsGroupsName( List<WorkInProgressDTO> dataList1,List<WorkInProgressDTO> dataList2) {
@@ -86,9 +117,11 @@
if(productDetail!=null){
dto1.setGlassName(productDetail.getDetail());
}
+ BigDecimal thicknessSum = calcGlassThicknessSum(productDetail.getDetail());
+ dto1.setThickness(thicknessSum);
//basicData.getNickname().equals("stepC")
- }else if(basicData.getNickname().equals("stepC")){
+ }else if(basicData.getNickname().equals("stepC")){//澶瑰眰
OrderGlassDetail orderGlassDetailGroup = orderGlassDetailMapper
.selectOne(new QueryWrapper<OrderGlassDetail>()
.eq("order_id", dto1.getOrderId())
@@ -102,9 +135,13 @@
orderGlassDetailMapper.getMaxTechnologyNumberByGroup(dto1.getOrderId(),dto1.getOrderNumber(), String.valueOf(orderGlassDetailGroup.getGroup()))
);
dto1.setGlassName(glassName);
-
- }else{
- dto1.setGlassName(dto1.getProductName());
+ BigDecimal thicknessSum = calcGlassThicknessSum(glassName);
+ dto1.setThickness(thicknessSum);
+ }else{//涓┖
+ String glassName = productDetailMapper.getGlassName(orderDetail.getProductId());
+ dto1.setGlassName(glassName);
+ BigDecimal thicknessSum = calcGlassThicknessSum(glassName);
+ dto1.setThickness(thicknessSum);
}
}
@@ -973,12 +1010,22 @@
return map;
}
- public List exportCrossProcessBreakingSv(List<LocalDate> dates) {
+ public List exportCrossProcessBreakingSv(List<String> dates) {
+ DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
+
+ List<LocalDateTime> dateTimeList = dates.stream()
+ .map(s -> LocalDateTime.parse(s, formatter))
+ .collect(Collectors.toList());
return reportMapper.exportCrossProcessBreakingMp(dates);
}
- public List exportNotCrossProcessBreakingSv(List<LocalDate> dates) {
- return reportMapper.exportNotCrossProcessBreakingMp(dates);
+ public List exportNotCrossProcessBreakingSv(List<String> dates) {
+ DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
+
+ List<LocalDateTime> dateTimeList = dates.stream()
+ .map(s -> LocalDateTime.parse(s, formatter))
+ .collect(Collectors.toList());
+ return reportMapper.exportNotCrossProcessBreakingMp(dateTimeList);
}
// public List exportTeamOutputSv(Map<String, Object> dates) {
@@ -990,9 +1037,15 @@
// String laminating = reportMapper.getLaminating(process);
// return reportMapper.exportTeamOutputMp(date,process,laminating);
// }
- public List exportDamageReportSv(Map<String, Object> dates) {
- List<LocalDate> date= (List<LocalDate>) dates.get("date");
- return reportMapper.exportDamageReportMp(date);
+ public List exportDamageReportSv(List<String> dates) {
+ DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
+
+ List<LocalDateTime> dateTimeList = dates.stream()
+ .map(s -> LocalDateTime.parse(s, formatter))
+ .collect(Collectors.toList());
+
+ // 杩欓噷鐢� LocalDateTime 鍘昏皟鐢� mapper
+ return reportMapper.exportDamageReportMp(dateTimeList);
}
public List exportOrderPlanDecompositionSv(List<LocalDate> dates) {
--
Gitblit v1.8.0