소스 검색

计算碳源投加公式调整

王苗苗 6 달 전
부모
커밋
3212138ff8

+ 9 - 4
slibra-quartz/src/main/java/com/slibra/quartz/task/RyTask.java

@@ -916,15 +916,17 @@ public class RyTask
 
         BigDecimal yymd = param.getYymd();
 
+        BigDecimal sxps = param.getSxps();
+
         //计算
         if(!Objects.isNull(type)) {
             if(3 == type){
                 return medicineAmount;
             }
             //计算1号池的值
-            BigDecimal oneResult = this.getResultByDiff(hycXsyType, hycXsyOne, htfksd, qycAdType, qycAdOne, qycYxyType, qycYxyOne, xzxs, jzxs, jsLlType, jsLlOne, slfpxs, kzxs, jsCodType, jsCodOne, zhxs, tydl, "one", yymd);
+            BigDecimal oneResult = this.getResultByDiff(hycXsyType, hycXsyOne, htfksd, qycAdType, qycAdOne, qycYxyType, qycYxyOne, xzxs, jzxs, jsLlType, jsLlOne, slfpxs, kzxs, jsCodType, jsCodOne, zhxs, tydl, "one", yymd, sxps);
             //计算二号池的值
-            BigDecimal twoResult = this.getResultByDiff(hycXsyType, hycXsyTwo, htfksd, qycAdType, qycAdTwo, qycYxyType, qycYxyTwo, xzxs, jzxs, jsLlType, jsLlOne, slfpxs, kzxs, jsCodType, jsCodTwo, zhxs, tydl, "two", yymd);
+            BigDecimal twoResult = this.getResultByDiff(hycXsyType, hycXsyTwo, htfksd, qycAdType, qycAdTwo, qycYxyType, qycYxyTwo, xzxs, jzxs, jsLlType, jsLlOne, slfpxs, kzxs, jsCodType, jsCodTwo, zhxs, tydl, "two", yymd, sxps);
             //判断,返回值
             if(0 == type)
                 return oneResult.compareTo(twoResult) > 0 ? oneResult : twoResult;
@@ -941,7 +943,7 @@ public class RyTask
 
     private BigDecimal getResultByDiff(Integer hycXsyType, BigDecimal hycXsyVal, BigDecimal htfksd, Integer qycAdType, BigDecimal qycAdVal, Integer qycYxyType,
                                        BigDecimal qycYxyVal, BigDecimal xzxs, BigDecimal jzxs, Integer jsLlType, BigDecimal jsLlVal, BigDecimal slfpxs, BigDecimal kzxs, Integer jsCodType,
-                                       BigDecimal jsCodVal, BigDecimal zhxs, BigDecimal tydl, String whichCZ, BigDecimal yymd) {
+                                       BigDecimal jsCodVal, BigDecimal zhxs, BigDecimal tydl, String whichCZ, BigDecimal yymd, BigDecimal sxps) {
         //2024年09月14日10:26:11  不同池子,根据不同类型,获取最新的数据,计算碳源投加量
         //获取最新的实时数据
         SmartAdd smartAdd = this.frontService.smartAddDataInfo();
@@ -1025,13 +1027,16 @@ public class RyTask
             tydl = BigDecimal.ZERO;
         if(Objects.isNull(yymd) || yymd.compareTo(BigDecimal.ZERO) <= 0)
             return null;//除数不能为0
+        if(Objects.isNull(sxps)){
+            sxps = BigDecimal.ZERO;
+        }
         //1)计算挟走量
         BigDecimal xzl = (((BigDecimal_2.multiply(hycXsyVal).subtract(htfksd)).add(((qycAdVal.add(qycYxyVal)).multiply(xzxs).subtract(htfksd)))).multiply((jzxs.subtract(BigDecimal_1)))).multiply((jsLlVal.multiply(slfpxs))).divide(BigDecimal_1000, NUMBER_SCALE_4, RoundingMode.HALF_UP);
         //2)计算碳源投加总量
         BigDecimal total = (xzl.multiply(kzxs).subtract((jsLlVal.multiply(slfpxs).multiply(jsCodVal).multiply(zhxs).divide(BigDecimal_1000, NUMBER_SCALE_4, RoundingMode.HALF_UP)))).divide(tydl, NUMBER_SCALE_4, RoundingMode.HALF_UP);
         //2024年09月14日15:33:37 计算出来的结果太大,是几千,把第三步公式也加上
         //计算加药流量
-        return DecimalUtils.getNLengthHalfUp(total.divide(yymd, NUMBER_SCALE_10, RoundingMode.HALF_UP).divide(BigDecimal_1000, NUMBER_SCALE_10, RoundingMode.HALF_UP), INT_3);
+        return DecimalUtils.getNLengthHalfUp(total.divide(yymd, NUMBER_SCALE_10, RoundingMode.HALF_UP).divide(BigDecimal_1000, NUMBER_SCALE_10, RoundingMode.HALF_UP).multiply(sxps), INT_3);
     }
 
 

+ 9 - 4
slibra-system/src/main/java/com/slibra/business/service/impl/TXinyiMedicineParamServiceImpl.java

@@ -242,15 +242,17 @@ public class TXinyiMedicineParamServiceImpl implements ITXinyiMedicineParamServi
 
         BigDecimal yymd = param.getYymd();
 
+        BigDecimal sxps = param.getSxps();
+
         //计算
         if(!Objects.isNull(type)) {
             if(3 == type){
                 return medicineAmount;
             }
             //计算1号池的值
-            BigDecimal oneResult = this.getResultByDiff(hycXsyType, hycXsyOne, htfksd, qycAdType, qycAdOne, qycYxyType, qycYxyOne, xzxs, jzxs, jsLlType, jsLlOne, slfpxs, kzxs, jsCodType, jsCodOne, zhxs, tydl, "one", yymd);
+            BigDecimal oneResult = this.getResultByDiff(hycXsyType, hycXsyOne, htfksd, qycAdType, qycAdOne, qycYxyType, qycYxyOne, xzxs, jzxs, jsLlType, jsLlOne, slfpxs, kzxs, jsCodType, jsCodOne, zhxs, tydl, "one", yymd, sxps);
             //计算二号池的值
-            BigDecimal twoResult = this.getResultByDiff(hycXsyType, hycXsyTwo, htfksd, qycAdType, qycAdTwo, qycYxyType, qycYxyTwo, xzxs, jzxs, jsLlType, jsLlOne, slfpxs, kzxs, jsCodType, jsCodTwo, zhxs, tydl, "two", yymd);
+            BigDecimal twoResult = this.getResultByDiff(hycXsyType, hycXsyTwo, htfksd, qycAdType, qycAdTwo, qycYxyType, qycYxyTwo, xzxs, jzxs, jsLlType, jsLlOne, slfpxs, kzxs, jsCodType, jsCodTwo, zhxs, tydl, "two", yymd, sxps);
             //判断,返回值
             if(0 == type)
                 return oneResult.compareTo(twoResult) > 0 ? oneResult : twoResult;
@@ -267,7 +269,7 @@ public class TXinyiMedicineParamServiceImpl implements ITXinyiMedicineParamServi
 
     private BigDecimal getResultByDiff(Integer hycXsyType, BigDecimal hycXsyVal, BigDecimal htfksd, Integer qycAdType, BigDecimal qycAdVal, Integer qycYxyType,
                                        BigDecimal qycYxyVal, BigDecimal xzxs, BigDecimal jzxs, Integer jsLlType, BigDecimal jsLlVal, BigDecimal slfpxs, BigDecimal kzxs, Integer jsCodType,
-                                       BigDecimal jsCodVal, BigDecimal zhxs, BigDecimal tydl, String whichCZ, BigDecimal yymd) {
+                                       BigDecimal jsCodVal, BigDecimal zhxs, BigDecimal tydl, String whichCZ, BigDecimal yymd, BigDecimal sxps) {
         //2024年09月14日10:26:11  不同池子,根据不同类型,获取最新的数据,计算碳源投加量
         //获取最新的实时数据
         SmartAdd smartAdd = this.frontService.smartAddDataInfo();
@@ -351,6 +353,9 @@ public class TXinyiMedicineParamServiceImpl implements ITXinyiMedicineParamServi
             tydl = BigDecimal.ZERO;
         if(Objects.isNull(yymd) || yymd.compareTo(BigDecimal.ZERO) <= 0)
             return null;//除数不能为0
+        if(Objects.isNull(sxps)){
+            sxps = BigDecimal.ZERO;
+        }
         //1)计算挟走量
         BigDecimal xzl = (((BigDecimal_2.multiply(hycXsyVal).subtract(htfksd)).add(((qycAdVal.add(qycYxyVal)).multiply(xzxs).subtract(htfksd)))).multiply((jzxs.subtract(BigDecimal_1)))).multiply((jsLlVal.multiply(slfpxs))).divide(BigDecimal_1000, NUMBER_SCALE_4, RoundingMode.HALF_UP);
         log.info("挟走量是{}", xzl);
@@ -359,7 +364,7 @@ public class TXinyiMedicineParamServiceImpl implements ITXinyiMedicineParamServi
         log.info("碳源投加总量是{}", total);
         //2024年09月14日15:33:37 计算出来的结果太大,是几千,把第三步公式也加上
         //计算加药流量
-        BigDecimal result = DecimalUtils.getNLengthHalfUp(total.divide(yymd, NUMBER_SCALE_10, RoundingMode.HALF_UP).divide(BigDecimal_1000, NUMBER_SCALE_10, RoundingMode.HALF_UP), INT_3);
+        BigDecimal result = DecimalUtils.getNLengthHalfUp(total.divide(yymd, NUMBER_SCALE_10, RoundingMode.HALF_UP).divide(BigDecimal_1000, NUMBER_SCALE_10, RoundingMode.HALF_UP).multiply(sxps), INT_3);
         log.info("最终的加药流量是{}", result);
         return result;
     }