Sfoglia il codice sorgente

增加大经编机米长系数

wukai 1 settimana fa
parent
commit
80b5678b01
1 ha cambiato i file con 7 aggiunte e 4 eliminazioni
  1. 7 4
      jjt-biz/src/main/java/com/jjt/utils/AsyncService.java

+ 7 - 4
jjt-biz/src/main/java/com/jjt/utils/AsyncService.java

@@ -202,8 +202,11 @@ public class AsyncService {
         //为true表示小经编,false表示大经编
         boolean flag = twinDevice.getDeviceCode().startsWith("C_");
         String table = twinDevice.getDevicePath();
+        //20250718 根据设备类型设置不同的系数,小经编系数为1.0,大经编系数为1.1
+        float coefficient = 1.0f;
         String[] fields = xFields;
         if (!flag) {
+            coefficient = 1.1f;
             fields = dFields;
         }
         String sql = "select %s from %s where time>%s and time <=%s";
@@ -269,7 +272,7 @@ public class AsyncService {
             //这里只计算米长
             if (curr[0] < last[0] && last[0] != 0f) {
 //                calcTotal(0, last, first, total, lastMkz, lastFk);
-                calcTotal(0, last, first, total, lastMkz);
+                calcTotal(0, last, first, total, lastMkz, coefficient);
                 first[0] = curr[0];
             }
             if (flag) {
@@ -290,7 +293,7 @@ public class AsyncService {
             last48 = curr48;
         }
         //还是只计算米长
-        calcTotal(0, last, first, total, lastMkz);
+        calcTotal(0, last, first, total, lastMkz, coefficient);
         calcSpec(total[0], lastSpecLength, last[2], lastMkz, lastHeight, specList);
         total[3] = 3600 - total[4];
         total[5] = lastHeight;
@@ -523,9 +526,9 @@ public class AsyncService {
     /**
      * 重量计算 提取公共方法
      */
-    private void calcTotal(int j, float[] last, float[] first, float[] total, int lastMkz) {
+    private void calcTotal(int j, float[] last, float[] first, float[] total, int lastMkz, float coefficient) {
         float v = last[j] - first[j];
-        total[j] += v;
+        total[j] += v * coefficient;
         if (j == 0) {
             //如果是米长,则计算重量,米长*米克重*2 2024-11-15
             float weight = BigDecimal.valueOf(v * lastMkz * 2 / 1000 / 1000).setScale(2, RoundingMode.HALF_UP).floatValue();