Browse Source

棒一统计用明细累加总支数

qiangxuan 2 weeks ago
parent
commit
e3e5338c44

+ 5 - 3
zgztBus/jeecg-module-sbm/src/main/java/org/jeecg/modules/billet/billetOriginalProductRecord/controller/BilletOriginalProductRecordController.java

@@ -1805,7 +1805,6 @@ public class BilletOriginalProductRecordController extends JeecgController<Bille
 		 }
 		 Map<String, BilletStatisticsDetail> statisticsMap = new HashMap<>();
 
-		 int grandTotalCount = 0;
 		 double grandTotalWeight = 0.0d;
 
 		 for (BilletOriginalProductRecord record : billetOriginalProductRecordList) {
@@ -1813,8 +1812,6 @@ public class BilletOriginalProductRecordController extends JeecgController<Bille
 			 if (rollClubOneDetails != null && !rollClubOneDetails.isEmpty()) {
 				 try {
 					 JSONObject detailsJson = JSON.parseObject(rollClubOneDetails);
-					 int totalCount = detailsJson.getIntValue("directRollingTotalCount");
-					 grandTotalCount += totalCount;
 					 JSONObject lengthGroupCount = detailsJson.getJSONObject("lengthGroupCount");
 					 if (lengthGroupCount != null) {
 						 for (Map.Entry<String, Object> entry : lengthGroupCount.entrySet()) {
@@ -1830,6 +1827,11 @@ public class BilletOriginalProductRecordController extends JeecgController<Bille
 				 }
 			 }
 		 }
+
+		 // 计算总数量和总重量
+		 int grandTotalCount = statisticsMap.values().stream()
+				 .mapToInt(BilletStatisticsDetail::getAmountTotal) // 修改为 getAmountTotal()
+				 .sum();
 		 grandTotalWeight = statisticsMap.values().stream()
 				 .mapToDouble(BilletStatisticsDetail::getBlankOutput)
 				 .sum();