15928045575 пре 2 година
родитељ
комит
24cc8acd7f

+ 1 - 1
slope-modules/slope-detection/src/main/java/com/sckw/slope/detection/service/CommonService.java

@@ -181,7 +181,7 @@ public class CommonService {
                 angleInRadians = deviceReference.getCurrentValue().doubleValue();
             }
             double cosValue = Math.cos(Math.toRadians(angleInRadians));;
-            double doubleValue = subtract.divide(new BigDecimal("360"), 9, BigDecimal.ROUND_HALF_UP).doubleValue();
+            double doubleValue = subtract.divide(new BigDecimal("360"), 11, BigDecimal.ROUND_HALF_UP).doubleValue();
             offsetValue = new BigDecimal(equatorial_circumference).multiply(new BigDecimal(cosValue)).multiply(new BigDecimal(doubleValue));
         }
         return offsetValue;

+ 13 - 8
slope-modules/slope-detection/src/main/java/com/sckw/slope/detection/service/DeviceService.java

@@ -314,20 +314,24 @@ public class DeviceService {
                         part.setUnitNe(value.getRemark());
                     }
                 }
+                if(insTables != null){
+                    SlopeData slopeData = slopeDataMapper.selectListByLine(snCode, part.getPartName());//获取到当前测量值
+                    if (!Objects.isNull(slopeData)) {
+                        part.setCurrentData(slopeData.getVal());
+                        //BigDecimal currentValue = commonService.getValueByOffset(value.toString(), obj.get("item").toString(), reference);
+                        //part.setOffset(slopeData.getVal());
+                    }
+                }
                 references.forEach(re -> {
                     if (part.getPartName().equals(re.getItem())) {
                         part.setPartBaseData(re.getOriginalValue().toString());
                         part.setPartCurrentBaseData(re.getCurrentValue().toString());
 
-                        part.setOffset(re.getOffset().toString());
+                        BigDecimal currentValue = commonService.computeOffset(part.getCurrentData(), re.getItem(), re);
+                        part.setOffset(String.valueOf(currentValue.doubleValue()));
                     }
                 });
-                if(insTables != null){
-                    SlopeData slopeData = slopeDataMapper.selectListByLine(snCode, part.getPartName());//获取到当前测量值
-                    if (!Objects.isNull(slopeData)) {
-                        part.setCurrentData(slopeData.getVal());
-                    }
-                }
+
             }
             //获取字典
             Map<String, SystemDict> deviceType = commonService.getDictList(null, new HashMap<>() {{
@@ -375,6 +379,7 @@ public class DeviceService {
                 if (!Objects.isNull(slopeData) && slopeData.size()>0) {
                     double data = commonService.returnIntegrationData(snCode,slopeData,inter);
                     inter.setCurrentData(String.valueOf(data));
+                    inter.setOffset(String.valueOf(data));
                 }
                 for (SystemDict value : deviceType.values()) {
                     if (inter.getUnit().toString().equals(value.getValue())) {
@@ -388,7 +393,7 @@ public class DeviceService {
                         inter.setIntegrationBaseData(re.getOriginalValue().toString());
 
                         inter.setIntegrationCurrentBaseData(re.getCurrentValue().toString());
-                        inter.setOffset(re.getOffset().toString());
+                        //inter.setOffset(re.getOffset().toString());
                     }
 
                 });