huangfuli há 1 ano atrás
pai
commit
93a1c6f95c

+ 35 - 13
winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/service/impl/WarehouseBaseInfoServiceImpl.java

@@ -4187,15 +4187,17 @@ public class WarehouseBaseInfoServiceImpl extends ServiceImpl<WarehouseBaseInfoM
             Double netWeightTmp = 0d;//应收合计
             for (int i = 0; i < dataList.size(); i++) {
                 ExportVView exportVView = dataList.get(i);
-                if (!StringUtils.isEmpty(exportVView.getWaterContent())
-                        && !StringUtils.isEmpty(exportVView.getImpurity())
-                        && !StringUtils.isEmpty(exportVView.getMildewGrain())
+//                if (!StringUtils.isEmpty(exportVView.getWaterContent())
+//                        && !StringUtils.isEmpty(exportVView.getImpurity())
+//                        && !StringUtils.isEmpty(exportVView.getMildewGrain())
 //                        && !StringUtils.isEmpty(exportVView.getImperfectGrain())
-                        && !StringUtils.isEmpty(exportVView.getBulkDensity())
-                        && !StringUtils.isEmpty(exportVView.getJiaorenli())) {
-                    //净重累计和
-                    netWeightTmp = netWeightTmp + (Double.valueOf(String.valueOf(exportVView.getNetWeight() != null ? exportVView.getNetWeight() : "0")));
-                }
+//                        && !StringUtils.isEmpty(exportVView.getBulkDensity())
+//                        && !StringUtils.isEmpty(exportVView.getJiaorenli())) {
+//                    //净重累计和
+//                    netWeightTmp = netWeightTmp + (Double.valueOf(String.valueOf(exportVView.getNetWeight() != null ? exportVView.getNetWeight() : "0")));
+//                }
+                //净重累计和
+                netWeightTmp = netWeightTmp + (Double.valueOf(String.valueOf(exportVView.getNetWeight() != null ? exportVView.getNetWeight() : "0")));
                 //水分累计和
                 waterContentTotal = waterContentTotal + ((Double.parseDouble(!StringUtils.isEmpty(exportVView.getWaterContent()) ? exportVView.getWaterContent() : "0")) * ((Double.parseDouble(!StringUtils.isEmpty(exportVView.getNetWeight()) ? exportVView.getNetWeight() : "0"))));
                 impurityTotal = impurityTotal + ((Double.parseDouble(!StringUtils.isEmpty(exportVView.getImpurity()) ? exportVView.getImpurity() : "0")) * ((Double.parseDouble(!StringUtils.isEmpty(exportVView.getNetWeight()) ? exportVView.getNetWeight() : "0"))));
@@ -4248,12 +4250,24 @@ public class WarehouseBaseInfoServiceImpl extends ServiceImpl<WarehouseBaseInfoM
             //水分平均值
             cell = rowp.createCell(17);
             cell.setCellStyle(contextstyle2);
-            cell.setCellValue(Double.parseDouble(df.format(waterContentTotal / netWeightTmp)));
+            if (waterContentTotal != 0){
+                cell.setCellValue(Double.parseDouble(df.format(waterContentTotal / netWeightTmp)));
+            }else {
+                cell.setCellValue(waterContentTotal / netWeightTmp);
+            }
             cell = rowp.createCell(18);
-            cell.setCellValue(Double.parseDouble(df.format(impurityTotal / netWeightTmp)));
+            if (impurityTotal != 0){
+                cell.setCellValue(Double.parseDouble(df.format(impurityTotal / netWeightTmp)));
+            }else {
+                cell.setCellValue(impurityTotal / netWeightTmp);
+            }
             cell.setCellStyle(contextstyle2);
             cell = rowp.createCell(19);
-            cell.setCellValue(Double.parseDouble(df.format(mildewGrainTotal / netWeightTmp)));
+            if (mildewGrainTotal != 0){
+                cell.setCellValue(Double.parseDouble(df.format(mildewGrainTotal / netWeightTmp)));
+            }else {
+                cell.setCellValue(mildewGrainTotal / netWeightTmp);
+            }
             cell.setCellStyle(contextstyle2);
             cell = rowp.createCell(20);
             if (imperfectGrainTotal != 0){
@@ -4263,10 +4277,18 @@ public class WarehouseBaseInfoServiceImpl extends ServiceImpl<WarehouseBaseInfoM
             }
             cell.setCellStyle(contextstyle2);
             cell = rowp.createCell(21);
-            cell.setCellValue(Double.parseDouble(df.format(bulkDensityTotal / netWeightTmp)));
+            if (bulkDensityTotal != 0){
+                cell.setCellValue(Double.parseDouble(df.format(bulkDensityTotal / netWeightTmp)));
+            }else {
+                cell.setCellValue(bulkDensityTotal / netWeightTmp);
+            }
             cell.setCellStyle(contextstyle2);
             cell = rowp.createCell(22);
-            cell.setCellValue(Double.parseDouble(df.format(jiaorenliTotal / netWeightTmp)));
+            if (jiaorenliTotal != 0){
+                cell.setCellValue(Double.parseDouble(df.format(jiaorenliTotal / netWeightTmp)));
+            }else {
+                cell.setCellValue(jiaorenliTotal / netWeightTmp);
+            }
             cell.setCellStyle(contextstyle2);
             cell = rowp.createCell(23);
             if (protrinTotal != 0){