四川双晟对接完成
This commit is contained in:
parent
440b9f840b
commit
65b8678210
|
@ -1,5 +1,18 @@
|
|||
package com.isu.gaswellwatch.modbus.data;
|
||||
|
||||
import cn.hutool.core.map.MapUtil;
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.springframework.util.ResourceUtils;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.SQLException;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* 数据持久化处理器
|
||||
*
|
||||
|
@ -10,6 +23,8 @@ public interface PersistenceHandler {
|
|||
String KNPCV1_MODBUS_TYPE = "knpc";
|
||||
String ETC_MODBUS_TYPE = "etc";
|
||||
String SCSS_MODBUS_TYPE = "scss";
|
||||
|
||||
|
||||
String DEVICE_INFO_CACHE = "info:device:";
|
||||
String DEVICE_DATA_CACHE = "data:device:";
|
||||
|
||||
|
@ -17,4 +32,23 @@ public interface PersistenceHandler {
|
|||
|
||||
void insert(String tableName, String cacheKey);
|
||||
|
||||
default void setValue(PreparedStatement ps, Map<String, Object> row, int index, String key, int sqlType) throws SQLException {
|
||||
String value = MapUtil.getStr(row, key);
|
||||
if (Objects.isNull(value)) {
|
||||
ps.setNull(index, sqlType);
|
||||
} else {
|
||||
ps.setObject(index, value);
|
||||
}
|
||||
}
|
||||
|
||||
static String getResource(String classPath) {
|
||||
try {
|
||||
File file = ResourceUtils.getFile("classpath:" + classPath);
|
||||
return IOUtils.toString(new FileInputStream(file), StandardCharsets.UTF_8);
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -33,9 +33,10 @@ import java.util.stream.Collectors;
|
|||
@SuppressWarnings("all")
|
||||
public class Redis2DBPersistenceService {
|
||||
|
||||
public static final String DEFAULT_DATA_TABLE = "t_device_data_";
|
||||
private static final String DEVICE_INFO_SQL = "SELECT * from device where id = ";
|
||||
private static final String EXISTS_TABLE_SQL = "SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA"
|
||||
+ " IN ('gaswellwatch', 'gas_well_watch') AND TABLE_NAME='$TableName$'";
|
||||
private static final String DEVICE_INFO_SQL = "SELECT * from device where id = ";
|
||||
@Resource
|
||||
private JdbcTemplate jdbcTemplate;
|
||||
@Resource(name = "stringRedisTemplate")
|
||||
|
@ -68,17 +69,17 @@ public class Redis2DBPersistenceService {
|
|||
operations.put(PersistenceHandler.DEVICE_DATA_CACHE + deviceId, "online",
|
||||
String.valueOf(idGatewayMappingMap.containsKey(deviceId)));
|
||||
}
|
||||
String modbusDeviceType = (String) operations.get(PersistenceHandler.DEVICE_INFO_CACHE + deviceId, "product");
|
||||
if (StringUtils.isEmpty(modbusDeviceType)) {
|
||||
String modbusDeviceTypeId = (String) operations.get(PersistenceHandler.DEVICE_INFO_CACHE + deviceId, "product");
|
||||
if (StringUtils.isEmpty(modbusDeviceTypeId)) {
|
||||
Map<String, Object> deviceInfo = this.jdbcTemplate.queryForMap(DEVICE_INFO_SQL + deviceId);
|
||||
Map<String, Object> cacheDeviceInfo = new HashMap<>(deviceInfo.size());
|
||||
deviceInfo.forEach((key, value) -> cacheDeviceInfo.put(key, Objects.isNull(value) ? null : String.valueOf(value)));
|
||||
modbusDeviceType = (String) cacheDeviceInfo.get("product");
|
||||
modbusDeviceTypeId = (String) cacheDeviceInfo.get("product");
|
||||
operations.putAll(PersistenceHandler.DEVICE_INFO_CACHE + deviceId, cacheDeviceInfo);
|
||||
}
|
||||
|
||||
persistenceHandler = persistenceHandlerMap.get(PersistenceHandler.KNPCV1_MODBUS_TYPE);
|
||||
tableName = "t_device_data_" + deviceId;
|
||||
persistenceHandler = persistenceHandlerMap.get(ModbusDeviceTypeEnum.getCodeById(modbusDeviceTypeId));
|
||||
tableName = DEFAULT_DATA_TABLE + deviceId;
|
||||
existsTableList = this.jdbcTemplate.queryForList(StringUtils.replace(EXISTS_TABLE_SQL, "$TableName$", tableName));
|
||||
if (ObjectUtils.isEmpty(existsTableList)
|
||||
|| ObjectUtils.isEmpty(existsTableList.get(0))
|
||||
|
|
|
@ -2,8 +2,6 @@ package com.isu.gaswellwatch.modbus.data.decode.impl;
|
|||
|
||||
import com.isu.gaswellwatch.modbus.data.ModbusMessage;
|
||||
import com.isu.gaswellwatch.modbus.data.decode.DecodeHandler;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.commons.lang3.math.NumberUtils;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.Map;
|
||||
|
@ -21,12 +19,12 @@ public class HighLowBinDecodeHandler implements DecodeHandler {
|
|||
|
||||
@Override
|
||||
public String decode(Map<String, Object> commandPointMap, String value) {
|
||||
return StringUtils.isBlank(value) ? value : NumberUtils.createLong(value).toString();
|
||||
return String.valueOf(Integer.parseInt(value, 16));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void decode(Map<String, Object> commandPointMap, ModbusMessage.MessagePoint point) {
|
||||
point.setValue(this.decode(commandPointMap, point.getValue()));
|
||||
throw new RuntimeException("not supported");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -16,7 +16,7 @@ import java.util.Map;
|
|||
*/
|
||||
@Component(LocalDateTimeDecodeHandler.NAME + DecodeHandler.DECODE_NAME)
|
||||
public class LocalDateTimeDecodeHandler implements DecodeHandler {
|
||||
public static final String NAME = "localDateTime";
|
||||
public static final String NAME = "fullYearLocalDateTime";
|
||||
|
||||
public static final DateTimeFormatter IN_FORMATTER = DateTimeFormatter.ofPattern("yyyy-M-d H:m:s");
|
||||
public static final DateTimeFormatter OUT_FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
||||
|
|
|
@ -1,26 +1,18 @@
|
|||
package com.isu.gaswellwatch.modbus.data.impl;
|
||||
|
||||
import cn.hutool.core.map.MapUtil;
|
||||
import com.isu.gaswellwatch.config.SnowflakeConfig;
|
||||
import com.isu.gaswellwatch.modbus.data.PersistenceHandler;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.data.redis.core.RedisTemplate;
|
||||
import org.springframework.jdbc.core.JdbcTemplate;
|
||||
import org.springframework.jdbc.core.PreparedStatementCallback;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.util.ResourceUtils;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.SQLException;
|
||||
import java.sql.Types;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* @author <a href="mailto:shilong.wang@alpha-ess.com">王仕龙</a>
|
||||
|
@ -38,7 +30,7 @@ public class Knpcv1PersistenceHandler implements PersistenceHandler {
|
|||
|
||||
@Override
|
||||
public void createTable(String tableName, Long deviceId) {
|
||||
String createTableSQL = getResource("sql/CREATE_KNPCV1.sql");
|
||||
String createTableSQL = PersistenceHandler.getResource("sql/CREATE_KNPCV1.sql");
|
||||
createTableSQL = StringUtils.replace(createTableSQL, "$TableName$", tableName);
|
||||
createTableSQL = StringUtils.replace(createTableSQL, "$DeviceId$", String.valueOf(deviceId));
|
||||
this.jdbcTemplate.execute(createTableSQL);
|
||||
|
@ -46,7 +38,7 @@ public class Knpcv1PersistenceHandler implements PersistenceHandler {
|
|||
|
||||
@Override
|
||||
public void insert(String tableName, String cacheKey) {
|
||||
String insertTableSQL = getResource("sql/INSERT_KNPCV1.sql");
|
||||
String insertTableSQL = PersistenceHandler.getResource("sql/INSERT_KNPCV1.sql");
|
||||
insertTableSQL = StringUtils.replace(insertTableSQL, "$TableName$", tableName);
|
||||
|
||||
Map<String, Object> row = this.redisTemplate.opsForHash().entries(cacheKey);
|
||||
|
@ -62,8 +54,8 @@ public class Knpcv1PersistenceHandler implements PersistenceHandler {
|
|||
Knpcv1PersistenceHandler.this.setValue(ps, row, 6, "runMode", Types.INTEGER);
|
||||
Knpcv1PersistenceHandler.this.setValue(ps, row, 7, "wellStatus", Types.INTEGER);
|
||||
Knpcv1PersistenceHandler.this.setValue(ps, row, 8, "plugStatus", Types.INTEGER);
|
||||
Knpcv1PersistenceHandler.this.setValue(ps, row, 9, "statusOpenTime", Types.TIME);
|
||||
Knpcv1PersistenceHandler.this.setValue(ps, row, 10, "statusCloseTime", Types.TIME);
|
||||
Knpcv1PersistenceHandler.this.setValue(ps, row, 9, "statusOpenTime", Types.VARCHAR);
|
||||
Knpcv1PersistenceHandler.this.setValue(ps, row, 10, "statusCloseTime", Types.VARCHAR);
|
||||
Knpcv1PersistenceHandler.this.setValue(ps, row, 11, "oilPressure", Types.DECIMAL);
|
||||
Knpcv1PersistenceHandler.this.setValue(ps, row, 12, "casPressure", Types.DECIMAL);
|
||||
Knpcv1PersistenceHandler.this.setValue(ps, row, 13, "prePressure", Types.DECIMAL);
|
||||
|
@ -74,10 +66,10 @@ public class Knpcv1PersistenceHandler implements PersistenceHandler {
|
|||
Knpcv1PersistenceHandler.this.setValue(ps, row, 18, "opmode", Types.INTEGER);
|
||||
Knpcv1PersistenceHandler.this.setValue(ps, row, 19, "timer1", Types.INTEGER);
|
||||
Knpcv1PersistenceHandler.this.setValue(ps, row, 20, "timer2", Types.INTEGER);
|
||||
Knpcv1PersistenceHandler.this.setValue(ps, row, 21, "timer1Open", Types.TIME);
|
||||
Knpcv1PersistenceHandler.this.setValue(ps, row, 22, "timer1Close", Types.TIME);
|
||||
Knpcv1PersistenceHandler.this.setValue(ps, row, 23, "timer2Open", Types.TIME);
|
||||
Knpcv1PersistenceHandler.this.setValue(ps, row, 24, "timer2Close", Types.TIME);
|
||||
Knpcv1PersistenceHandler.this.setValue(ps, row, 21, "timer1Open", Types.VARCHAR);
|
||||
Knpcv1PersistenceHandler.this.setValue(ps, row, 22, "timer1Close", Types.VARCHAR);
|
||||
Knpcv1PersistenceHandler.this.setValue(ps, row, 23, "timer2Open", Types.VARCHAR);
|
||||
Knpcv1PersistenceHandler.this.setValue(ps, row, 24, "timer2Close", Types.VARCHAR);
|
||||
Knpcv1PersistenceHandler.this.setValue(ps, row, 25, "timingOpen", Types.VARCHAR);
|
||||
Knpcv1PersistenceHandler.this.setValue(ps, row, 26, "timingClose", Types.VARCHAR);
|
||||
Knpcv1PersistenceHandler.this.setValue(ps, row, 27, "timingCelay", Types.VARCHAR);
|
||||
|
@ -110,25 +102,5 @@ public class Knpcv1PersistenceHandler implements PersistenceHandler {
|
|||
return ps.executeUpdate();
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
public void setValue(PreparedStatement ps, Map<String, Object> row, int index, String key, int sqlType) throws SQLException {
|
||||
String value = MapUtil.getStr(row, key);
|
||||
if (Objects.isNull(value)) {
|
||||
ps.setNull(index, sqlType);
|
||||
} else {
|
||||
ps.setObject(index, value);
|
||||
}
|
||||
}
|
||||
|
||||
public static String getResource(String classPath) {
|
||||
try {
|
||||
File file = ResourceUtils.getFile("classpath:" + classPath);
|
||||
return IOUtils.toString(new FileInputStream(file), StandardCharsets.UTF_8);
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -36,7 +36,8 @@ public class DynamicRabbitListener implements ApplicationRunner {
|
|||
this.composeListener.addBatchMessageListener(new ModbusMessageBackupListener());
|
||||
this.composeListener.addBatchMessageListener(new ModbusMessagePersistListener());
|
||||
// TODO 根据设备自动绑定队列
|
||||
this.addListenerQueue("/modbus/device/4B454E454E4731343030303030333538/collect");
|
||||
this.addListenerQueue("/modbus/device/3030303030/collect");
|
||||
// this.addListenerQueue("/modbus/device/4B454E454E4731343030303030333538/collect");
|
||||
}
|
||||
|
||||
// @RabbitListener(queues = "/modbus/device/4B454E454E4731343030303030333538/collect")
|
||||
|
|
|
@ -91,7 +91,7 @@ public class ModbusMessagePersistListener implements BatchMessageListener {
|
|||
}
|
||||
try {
|
||||
String address;
|
||||
int index = MapUtil.getInt(commandMap, "start_address"), stepSize = 0;
|
||||
int startAddress = MapUtil.getInt(commandMap, "start_address"), index = 0, stepSize = 0;
|
||||
ByteQueue byteQueue = new ByteQueue(collectionMessage);
|
||||
RtuMessageParser masterParser = new RtuMessageParser(true);
|
||||
RtuMessageResponse response = (RtuMessageResponse) masterParser.parseMessage(byteQueue);
|
||||
|
@ -120,12 +120,13 @@ public class ModbusMessagePersistListener implements BatchMessageListener {
|
|||
}
|
||||
for (short value : values) {
|
||||
stepSize = index * 4;
|
||||
messagePointMap.put(StringUtils.leftPad(String.valueOf(index), 4, '0'),
|
||||
messagePointMap.put(StringUtils.leftPad(String.valueOf(startAddress), 4, '0'),
|
||||
ModbusMessage.MessagePoint.builder()
|
||||
.parseValue(String.valueOf(value))
|
||||
.originalValue(StringUtils.substring(collectionMessage, 6 + stepSize, 10 + stepSize))
|
||||
.build());
|
||||
index++;
|
||||
startAddress++;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("初始数据解析异常: {}", messageString, e);
|
||||
|
@ -181,10 +182,10 @@ public class ModbusMessagePersistListener implements BatchMessageListener {
|
|||
decodeName = MapUtil.getStr(point, "decode_name");
|
||||
startAddress = MapUtil.getInt(point, "start_address");
|
||||
String value;
|
||||
if (StringUtils.startsWith(decodeName, HighLowBinDecodeHandler.NAME)) {
|
||||
if (StringUtils.equals(decodeName, HighLowBinDecodeHandler.NAME)) {
|
||||
value = decodeHighLowCommandPoint(modbusMessage.getMessagePointMap(), decodeName, point, startAddress);
|
||||
} else if (StringUtils.startsWith(decodeName, HighLowBinDecodeHandler.NAME)) {
|
||||
value = decodeHighLowStepCommandPoint(modbusMessage.getMessagePointMap(), decodeName, point, startAddress, stepSize);
|
||||
} else if (StringUtils.contains(decodeName, ",") && StringUtils.startsWith(decodeName, HighLowBinDecodeHandler.NAME)) {
|
||||
value = decodeHighLowStepCommandPoint(modbusMessage.getMessagePointMap(), decodeName, point, startAddress, stepSize / 2);
|
||||
} else if (stepSize <= 1) {
|
||||
messagePoint = modbusMessage.getMessagePointMap()
|
||||
.get(StringUtils.leftPad(String.valueOf(startAddress), 4, '0'));
|
||||
|
@ -255,10 +256,9 @@ public class ModbusMessagePersistListener implements BatchMessageListener {
|
|||
ModbusMessage.MessagePoint messagePoint;
|
||||
for (int i = 0; i < 2; i++) {
|
||||
messagePoint = pointMap.get(StringUtils.leftPad(String.valueOf(startAddress + i), 4, '0'));
|
||||
values[i] = messagePoint.getValue();
|
||||
values[i] = messagePoint.getOriginalValue();
|
||||
}
|
||||
String result = highLowBinDecodeHandler.decode(commandPointMap, StringUtils.join(values));
|
||||
return decodeMessage(decodeName, commandPointMap, result);
|
||||
return highLowBinDecodeHandler.decode(commandPointMap, StringUtils.join(values));
|
||||
}
|
||||
|
||||
private String decodeHighLowStepCommandPoint(Map<String, ModbusMessage.MessagePoint> pointMap, String decodeName,
|
||||
|
@ -266,10 +266,10 @@ public class ModbusMessagePersistListener implements BatchMessageListener {
|
|||
String[] values = new String[stepSize];
|
||||
ModbusMessage.MessagePoint highPoint;
|
||||
ModbusMessage.MessagePoint lowPoint;
|
||||
for (int i = 0; i < stepSize; i = i + 2) {
|
||||
highPoint = pointMap.get(StringUtils.leftPad(String.valueOf(startAddress + i), 4, '0'));
|
||||
lowPoint = pointMap.get(StringUtils.leftPad(String.valueOf(startAddress + i + 1), 4, '0'));
|
||||
values[i] = highLowBinDecodeHandler.decode(commandPointMap, highPoint.getValue() + lowPoint.getValue());
|
||||
for (int i = 0; i < stepSize; i++) {
|
||||
highPoint = pointMap.get(StringUtils.leftPad(String.valueOf(startAddress + i * 2), 4, '0'));
|
||||
lowPoint = pointMap.get(StringUtils.leftPad(String.valueOf(startAddress + i * 2 + 1), 4, '0'));
|
||||
values[i] = highLowBinDecodeHandler.decode(commandPointMap, highPoint.getOriginalValue() + lowPoint.getOriginalValue());
|
||||
}
|
||||
|
||||
String format = MapUtil.getStr(commandPointMap, "format");
|
||||
|
|
|
@ -9,8 +9,8 @@ CREATE TABLE `$TableName$`
|
|||
`run_mode` smallint NULL DEFAULT NULL COMMENT '运行模式:\r\n0:手动模式 \r\n1:定时器模式 \r\n2:计时器模式 \r\n3:压力模式\r\n4:柱塞模式\r\n5:时压模式',
|
||||
`gas_status` smallint NULL DEFAULT NULL COMMENT '气井状态:\r\n0:关闭 \r\n1:打开',
|
||||
`plug_status` smallint NULL DEFAULT NULL COMMENT '柱塞状态:\r\n0:离开\r\n1:上升中\r\n2:到达',
|
||||
`status_start_time` time NULL DEFAULT NULL COMMENT '当前状态开始时间',
|
||||
`status_end_time` time NULL DEFAULT NULL COMMENT '当前状态结束时间',
|
||||
`status_start_time` varchar(10) NULL DEFAULT NULL COMMENT '当前状态开始时间',
|
||||
`status_end_time` varchar(10) NULL DEFAULT NULL COMMENT '当前状态结束时间',
|
||||
`oil_pressure` decimal(10, 2) NULL DEFAULT NULL COMMENT '油压:单位Mpa',
|
||||
`cas_pressure` decimal(10, 2) NULL DEFAULT NULL COMMENT '套压:单位Mpa',
|
||||
`pre_pressure` decimal(10, 2) NULL DEFAULT NULL COMMENT '输压:单位Mpa',
|
||||
|
@ -21,10 +21,10 @@ CREATE TABLE `$TableName$`
|
|||
`op_mode` smallint NULL DEFAULT NULL COMMENT '运行模式:\r\n0: 手动模式 hand_mode\r\n1:定时器模式 timer_mode\r\n2:计时器模式 t2mode\r\n3:压力模式 pressure_mode\r\n4:柱塞模式 piston_mode\r\n5:时压模式 tp_mode',
|
||||
`timer_able1` smallint NULL DEFAULT NULL COMMENT '定时模式定时器1使能:\r\n0:禁止 disable\r\n1:使能 enable',
|
||||
`timer_able2` smallint NULL DEFAULT NULL COMMENT '定时模式定时器2使能:\r\n0:禁止 disable\r\n1:使能 ',
|
||||
`timer_open1` time NULL DEFAULT NULL COMMENT '时0~23:分0~59:秒0~59',
|
||||
`timer_close1` time NULL DEFAULT NULL COMMENT '时0~23:分0~59:秒0~59',
|
||||
`timer_open2` time NULL DEFAULT NULL COMMENT '时0~23:分0~59:秒0~59',
|
||||
`timer_close2` time NULL DEFAULT NULL COMMENT '时0~23:分0~59:秒0~59',
|
||||
`timer_open1` varchar(10) NULL DEFAULT NULL COMMENT '时0~23:分0~59:秒0~59',
|
||||
`timer_close1` varchar(10) NULL DEFAULT NULL COMMENT '时0~23:分0~59:秒0~59',
|
||||
`timer_open2` varchar(10) NULL DEFAULT NULL COMMENT '时0~23:分0~59:秒0~59',
|
||||
`timer_close2` varchar(10) NULL DEFAULT NULL COMMENT '时0~23:分0~59:秒0~59',
|
||||
`timing_open` varchar(10) NULL DEFAULT NULL COMMENT '时0~23:分0~59:秒0~59',
|
||||
`timing_close` varchar(10) NULL DEFAULT NULL COMMENT '时0~23:分0~59:秒0~59',
|
||||
`timing_delay` varchar(10) NULL DEFAULT NULL COMMENT '时0~23:分0~59:秒0~59',
|
||||
|
|
|
@ -0,0 +1,91 @@
|
|||
CREATE TABLE `$TableName$`
|
||||
(
|
||||
`id` bigint NOT NULL COMMENT '主键',
|
||||
`device_id` int NOT NULL COMMENT '设备标识',
|
||||
`created_time` datetime NOT NULL COMMENT '数据落库时间',
|
||||
`collection_time` datetime NOT NULL COMMENT '采集指令下发时间',
|
||||
`receive_time` datetime NOT NULL COMMENT '接收到数据时间',
|
||||
`cas_pressure` decimal(10, 2) NULL DEFAULT NULL COMMENT '套压',
|
||||
`oil_pressure` decimal(10, 2) NULL DEFAULT NULL COMMENT '油压',
|
||||
`first_solenoid_status` int NULL DEFAULT NULL COMMENT '当前第一个电磁阀状态',
|
||||
`battery_voltage` decimal(10, 1) NULL DEFAULT NULL COMMENT '电池电压',
|
||||
`solar_voltage` decimal(10, 1) NULL DEFAULT NULL COMMENT '太阳能电压',
|
||||
`remaining_time_action` int NULL DEFAULT NULL COMMENT '动作剩余时间',
|
||||
`second_solenoid_status` int NULL DEFAULT NULL COMMENT '第二个电磁阀状态',
|
||||
`pre_transmission` int NULL DEFAULT NULL COMMENT '输压',
|
||||
`internet_traffic` int NULL DEFAULT NULL COMMENT '流量',
|
||||
`load_factor` int NULL DEFAULT NULL COMMENT '载荷因子',
|
||||
`data_time` datetime NULL DEFAULT NULL COMMENT '日期时间',
|
||||
`show_delay` int NULL DEFAULT NULL COMMENT '显示延时',
|
||||
`open_well_sampling_interval` int NULL DEFAULT NULL COMMENT '开井采样间隔',
|
||||
`close_well_sampling_interval` int NULL DEFAULT NULL COMMENT '关井采样间隔',
|
||||
`ctl_model` int NULL DEFAULT NULL COMMENT '控制模式',
|
||||
`min_pressure` int NULL DEFAULT NULL COMMENT '套压最小值',
|
||||
`max_pressure` int NULL DEFAULT NULL COMMENT '套压最大值',
|
||||
`pressure_min_voltage` int NULL DEFAULT NULL COMMENT '套压最小电压',
|
||||
`pressure_max_voltage` int NULL DEFAULT NULL COMMENT '套压最大电压',
|
||||
`oil_min` int NULL DEFAULT NULL COMMENT '油压最小值',
|
||||
`oil_max` int NULL DEFAULT NULL COMMENT '油压最大值',
|
||||
`oil_min_voltage` int NULL DEFAULT NULL COMMENT '油压最小电压',
|
||||
`oil_max_voltage` int NULL DEFAULT NULL COMMENT '油压最大电压',
|
||||
`input_pressure_min_value` int NULL DEFAULT NULL COMMENT '输压最小值',
|
||||
`input_pressure_max_value` int NULL DEFAULT NULL COMMENT '输压最大值',
|
||||
`input_voltage_min_value` int NULL DEFAULT NULL COMMENT '输压最小电压',
|
||||
`input_voltage_max_value` int NULL DEFAULT NULL COMMENT '输压最大电压',
|
||||
`flow_rate_min_value` int NULL DEFAULT NULL COMMENT '流量最小值',
|
||||
`flow_rate_max_value` int NULL DEFAULT NULL COMMENT '流量最大值',
|
||||
`flow_voltage_min_value` int NULL DEFAULT NULL COMMENT '流量最小电压',
|
||||
`flow_voltage_max_value` int NULL DEFAULT NULL COMMENT '流量最大电压',
|
||||
`continuous_sampling_interval_duration` int NULL DEFAULT NULL COMMENT '连续采样间隔',
|
||||
`sensor_signal_effective_level` int NULL DEFAULT NULL COMMENT '到达传感器有效电平',
|
||||
`pressure_compensation_polarity_flag` int NULL DEFAULT NULL COMMENT '套压补偿极性',
|
||||
`pressure_compensation_value_setting` int NULL DEFAULT NULL COMMENT '套压补偿值',
|
||||
`oil_pressure_compensation_polarity_flag` int NULL DEFAULT NULL COMMENT '油压补偿极性',
|
||||
`oil_pressure_compensation_value_setting` int NULL DEFAULT NULL COMMENT '油压补偿值',
|
||||
`input_pressure_compensation_polarity_flag` int NULL DEFAULT NULL COMMENT '输压补偿极性',
|
||||
`input_pressure_compensation_value_setting` int NULL DEFAULT NULL COMMENT '输压补偿值',
|
||||
`flow_compensation_polarity_flag` int NULL DEFAULT NULL COMMENT '流量补偿极性',
|
||||
`flow_compensation_value_setting` int NULL DEFAULT NULL COMMENT '流量补偿值',
|
||||
`well_open_time_timestamp` int NULL DEFAULT NULL COMMENT '开井时间',
|
||||
`well_open_pressure_value` decimal(10, 2) NULL DEFAULT NULL COMMENT '开井套压',
|
||||
`well_open_oil_pressure_value` decimal(10, 2) NULL DEFAULT NULL COMMENT '开井油压',
|
||||
`well_open_load_factor_presets` decimal(10, 2) NULL DEFAULT NULL COMMENT '开井载荷因子预设值',
|
||||
`well_close_time_timestamp` int NULL DEFAULT NULL COMMENT '关井时间时间戳',
|
||||
`well_close_pressure_value` int NULL DEFAULT NULL COMMENT '关井压力值',
|
||||
`well_close_oil_pressure_value` int NULL DEFAULT NULL COMMENT '关井油压值',
|
||||
`well_close_flow_value` int NULL DEFAULT NULL COMMENT '关井流量值',
|
||||
`min_well_open_time_duration` int NULL DEFAULT NULL COMMENT '最小开井时间持续时长',
|
||||
`max_well_open_time_duration` int NULL DEFAULT NULL COMMENT '最大开井时间持续时长',
|
||||
`min_well_close_time_duration` int NULL DEFAULT NULL COMMENT '最小关井时间持续时长',
|
||||
`max_well_close_time_duration` int NULL DEFAULT NULL COMMENT '最大关井时间持续时长',
|
||||
`pressure_stabilization_duration` int NULL DEFAULT NULL COMMENT '压力稳定持续时长',
|
||||
`flow_stabilization_duration` int NULL DEFAULT NULL COMMENT '流量稳定持续时长',
|
||||
`load_factor_stabilization_duration` int NULL DEFAULT NULL COMMENT '载荷因子稳定持续时长',
|
||||
`plunger_delay_duration` int NULL DEFAULT NULL COMMENT '柱塞延迟时长',
|
||||
`plunger_rise_duration` int NULL DEFAULT NULL COMMENT '柱塞上升时长',
|
||||
`continuos_flow_duration` int NULL DEFAULT NULL COMMENT '连续流量持续时长',
|
||||
`well_close_time_duration` int NULL DEFAULT NULL COMMENT '关井时间持续时长',
|
||||
`well_close_time_not_reached_duration` int NULL DEFAULT NULL COMMENT '关井时间未达到持续时长',
|
||||
`well_close_not_reached_count_value` int NULL DEFAULT NULL COMMENT '关井未达到次数值',
|
||||
`plunger_delay_duration_repeat` int NULL DEFAULT NULL COMMENT '柱塞延迟时长重复次数',
|
||||
`target_time_timestamp` int NULL DEFAULT NULL COMMENT '目标时间时间戳',
|
||||
`target_time_range_value` int NULL DEFAULT NULL COMMENT '目标时间范围值',
|
||||
`continuos_flow_increase_duration` int NULL DEFAULT NULL COMMENT '连续流量增加持续时长',
|
||||
`continuos_flow_decrease_duration` int NULL DEFAULT NULL COMMENT '连续流量减少持续时长',
|
||||
`well_close_increase_duration` int NULL DEFAULT NULL COMMENT '关井增加持续时长',
|
||||
`well_close_decrease_duration` int NULL DEFAULT NULL COMMENT '关井减少持续时长',
|
||||
`min_well_close_time_duration2` int NULL DEFAULT NULL COMMENT '最小关井时间持续时长',
|
||||
`max_well_close_time_duration2` int NULL DEFAULT NULL COMMENT '最大关井时间持续时长',
|
||||
`min_continous_flow_time_duration` int NULL DEFAULT NULL COMMENT '最小连续流量时间持续时长',
|
||||
`max_continous_flow_time_duration` int NULL DEFAULT NULL COMMENT '最大连续流量时间持续时长',
|
||||
`min_well_open_time_duration2` int NULL DEFAULT NULL COMMENT '最小开井时间持续时长',
|
||||
`max_well_open_time_duration2` int NULL DEFAULT NULL COMMENT '最大开井时间持续时长',
|
||||
`well_open_pressure_value_at_open` int NULL DEFAULT NULL COMMENT '开井时压力值(开井瞬间)',
|
||||
`well_open_oil_pressure_value_at_open` int NULL DEFAULT NULL COMMENT '开井时油压值(开井瞬间)',
|
||||
`well_open_load_factor_presets_at_open` int NULL DEFAULT NULL COMMENT '开井时载荷因子预设值(开井瞬间)',
|
||||
`well_close_pressure_value_at_close` int NULL DEFAULT NULL COMMENT '关井时压力值(关井瞬间)',
|
||||
`well_close_oil_ppressure_value_at_close` int NULL DEFAULT NULL COMMENT '关井时油压值(关井瞬间)',
|
||||
`well_close_flow_value_at_close` int NULL DEFAULT NULL COMMENT '关井时流量值(关井瞬间)',
|
||||
PRIMARY KEY (`id`) USING BTREE,
|
||||
UNIQUE INDEX `udx_device_create_time` (`device_id` ASC, `collection_time` ASC) USING BTREE COMMENT '设备采集数据唯一键'
|
||||
) ENGINE = InnoDB COMMENT = '设备ID:$DeviceId$的采集数据'
|
Loading…
Reference in New Issue