瀏覽代碼

垂直深度计算是需要查找的井斜数据及动液面采集保存

chenwen 1 年之前
父節點
當前提交
ed13d7c9ee
共有 1 個文件被更改,包括 31 次插入40 次删除
  1. 31 40
      src/main/java/com/hb/proj/gather/rep/GatherDataRepService.java

+ 31 - 40
src/main/java/com/hb/proj/gather/rep/GatherDataRepService.java

@@ -10,11 +10,11 @@ import org.springframework.stereotype.Service;
 
 
 import com.hb.proj.gather.model.AlarmLogVO;
 import com.hb.proj.gather.model.AlarmLogVO;
 import com.hb.proj.gather.model.DiagramPO;
 import com.hb.proj.gather.model.DiagramPO;
+import com.hb.proj.gather.model.LiquidExtraVO;
 import com.hb.proj.gather.model.LiquidPO;
 import com.hb.proj.gather.model.LiquidPO;
-import com.hb.proj.gather.model.LiquidVO;
 import com.hb.proj.gather.model.SingleInsertPO;
 import com.hb.proj.gather.model.SingleInsertPO;
+import com.hb.proj.gather.model.WellDeviationPO;
 import com.hb.proj.gather.model.WellMeasurePO;
 import com.hb.proj.gather.model.WellMeasurePO;
-import com.hb.proj.gather.process.LiquidCalculator;
 import com.hb.xframework.dao.core.SpringJdbcDAO;
 import com.hb.xframework.dao.core.SpringJdbcDAO;
 
 
 /**
 /**
@@ -124,10 +124,10 @@ public class GatherDataRepService {
 	
 	
 	/**
 	/**
 	 * 动液面采集数据入库
 	 * 动液面采集数据入库
-	 * 入库前绑定扩展字段默认值(静液面深度、折算静深度、折算液面深度、校正深度、校正音速)2023.10.18
-	 * @param liquid
+	 * @param liquid 动液面采集数据
+	 * @param extra  动液面衍生数据
 	 */
 	 */
-	public void save(LiquidPO  liquidPO) {
+	public void save(LiquidPO  liquidPO,LiquidExtraVO extra) {
 		String sql="""
 		String sql="""
 				insert into tzl_gather_data_liquid(well_id,test_time,liquid_datas,hoop_datas,sound_speed_dev,liquid_depth_dev,casing_press_dev,create_time,del_if,battery_voltage,
 				insert into tzl_gather_data_liquid(well_id,test_time,liquid_datas,hoop_datas,sound_speed_dev,liquid_depth_dev,casing_press_dev,create_time,del_if,battery_voltage,
 				sound_speed_calc,liquid_depth,liquid_depth_convert,depth_diff,flow_press_diff,liquid_depth_static,liquid_depth_static_convert) 
 				sound_speed_calc,liquid_depth,liquid_depth_convert,depth_diff,flow_press_diff,liquid_depth_static,liquid_depth_static_convert) 
@@ -139,41 +139,13 @@ public class GatherDataRepService {
 		List<Object> args0=Arrays.asList(liquidPO.getWellId(),liquidPO.getTestTime(),listNum2Str(liquidPO.getLiquidDatas()),listNum2Str(liquidPO.getHoopDatas()),
 		List<Object> args0=Arrays.asList(liquidPO.getWellId(),liquidPO.getTestTime(),listNum2Str(liquidPO.getLiquidDatas()),listNum2Str(liquidPO.getHoopDatas()),
 				liquidPO.getSoundSpeedDev(),liquidPO.getLiquidDepthDev(),liquidPO.getCasingPressDev(),liquidPO.getBatteryVoltage());
 				liquidPO.getSoundSpeedDev(),liquidPO.getLiquidDepthDev(),liquidPO.getCasingPressDev(),liquidPO.getBatteryVoltage());
 		
 		
+		List<Object> args1=Arrays.asList(extra.getSoundSpeedCalc(),extra.getLiquidDepth(),extra.getLiquidDepthConvert(),extra.getDepthDiff(),extra.getFlowPressDiff(),extra.getLiquidDepthStatic(),extra.getLiquidDepthStaticConvert());
+		
 		List<Object> args=new ArrayList<>(13);
 		List<Object> args=new ArrayList<>(13);
 		
 		
 		args.addAll(args0);
 		args.addAll(args0);
+		args.addAll(args1);
 		
 		
-		LiquidVO lastSSLiquid=getLastLiquidCalcViaSoundSpeed(liquidPO.getWellId());
-		LiquidVO lastStaticLiquid=getLastLiquidStaticCalc(liquidPO.getWellId());
-		
-		//校正音速=最新一次手动音速法计算时设置的音速
-		Double	val=lastSSLiquid!=null && lastSSLiquid.getSoundSpeed()!=null?lastSSLiquid.getSoundSpeed():null;
-		args.add(val);
-				
-		//校正液面深度=设备采集深度*最新手动音速法计算时设置的k系数
-		val=liquidPO.getLiquidDepthDev()*(lastSSLiquid!=null && lastSSLiquid.getSoundSpeedFactor()!=null?lastSSLiquid.getSoundSpeedFactor():1);
-		args.add(val);
-		
-		
-		WellMeasurePO lastMeasure=getLastMeasure(liquidPO.getWellId());
-		
-		//折算动液面深度
-		val=LiquidCalculator.calcConvertLiquidDepth(val, liquidPO.getCasingPressDev(), lastMeasure);
-		args.add(val);
-		
-		//深度压差=折算动液面深度-折算静液面深度=折算动液面深度-最近一次静液测算折算静液面深度=折算动液面深度-最近一次静液测算时折算动液面深度
-		val=LiquidCalculator.calcDepthDiff(val, lastStaticLiquid!=null?lastStaticLiquid.getLiquidDepthStaticConvert():null);
-		args.add(val);
-		
-		//流动压差
-		val=LiquidCalculator.calcFlowPreeDiff(val, lastMeasure);
-		args.add(val);
-		
-		//静液面深度=最近一次静液测算时的静液面深度=测算时的校正液面深度;
-		args.add(lastStaticLiquid!=null?lastStaticLiquid.getLiquidDepthStatic():null);
-		
-		//折算静深度=最近一次静液测算的值=测算时的折算液面深度
-		args.add(lastStaticLiquid!=null?lastStaticLiquid.getLiquidDepthStaticConvert():null);
 		
 		
 		dao.exeUpdate(sql, args.toArray());
 		dao.exeUpdate(sql, args.toArray());
 	}
 	}
@@ -192,7 +164,7 @@ public class GatherDataRepService {
 	 * @param wellId
 	 * @param wellId
 	 * @return
 	 * @return
 	 */
 	 */
-	private LiquidVO getLastLiquidCalcViaSoundSpeed(String wellId) {
+	public LiquidExtraVO getLastLiquidCalcViaSoundSpeed(String wellId) {
 		
 		
 		String sql="""
 		String sql="""
 				select sound_speed_factor,sound_speed 
 				select sound_speed_factor,sound_speed 
@@ -201,7 +173,7 @@ public class GatherDataRepService {
 				order by test_time desc limit 1
 				order by test_time desc limit 1
 				""";
 				""";
 		
 		
-		return dao.queryForPojo(sql, LiquidVO.class,wellId,MODE_SOUND_SPEED);
+		return dao.queryForPojo(sql, LiquidExtraVO.class,wellId,MODE_SOUND_SPEED);
 		
 		
 	}
 	}
 	
 	
@@ -210,7 +182,7 @@ public class GatherDataRepService {
 	 * @param wellId
 	 * @param wellId
 	 * @return
 	 * @return
 	 */
 	 */
-	private LiquidVO getLastLiquidStaticCalc(String wellId) {
+	public LiquidExtraVO getLastLiquidStaticCalc(String wellId) {
 		String sql="""
 		String sql="""
 				select liquid_depth,liquid_depth_convert,liquid_depth_static,liquid_depth_static_convert 
 				select liquid_depth,liquid_depth_convert,liquid_depth_static,liquid_depth_static_convert 
 				from tzl_gather_data_liquid 
 				from tzl_gather_data_liquid 
@@ -218,7 +190,7 @@ public class GatherDataRepService {
 				order by test_time desc limit 1
 				order by test_time desc limit 1
 				""";
 				""";
 		
 		
-		return dao.queryForPojo(sql, LiquidVO.class,wellId);
+		return dao.queryForPojo(sql, LiquidExtraVO.class,wellId);
 	}
 	}
 	
 	
 	
 	
@@ -236,4 +208,23 @@ public class GatherDataRepService {
 		return dao.queryForPojo(sql, WellMeasurePO.class, wellId);
 		return dao.queryForPojo(sql, WellMeasurePO.class, wellId);
 	}
 	}
 	
 	
+	/**
+	 * 查找指定深度的两个邻近斜深记录(用于插值计算垂深)
+	 * @param wellId
+	 * @param depth
+	 * @return 
+	 * 无值:1未找到邻近值;2:非斜井,无数据
+	 * 双值:找到邻值
+	 * 单值:只找到低相邻(指定值等于或超出了最大井斜数)
+	 */
+	public List<WellDeviationPO> loadNearDeviation(String wellId,Double depth){
+		String sql="""
+				select measure_depth,deviate_angle,vertical_depth from tzl_well_deviation d
+				where  d.well_id=? 
+				and d.measure_depth >=(select measure_depth from tzl_well_deviation d2 where d2.well_id=? and  d2.measure_depth<=? order by  d2.measure_depth desc limit 1)
+				order by d.measure_depth asc limit 2
+				""";
+		
+		return dao.queryForList(sql, WellDeviationPO.class, wellId,wellId,depth);
+	}
 }
 }