支持威尔普斯设备

This commit is contained in:
wangshilong 2025-01-13 19:53:58 +08:00
parent c2b2417ac8
commit 505eae560e
12 changed files with 497 additions and 3 deletions

View File

@ -12,6 +12,7 @@ public interface PersistenceHandler {
String KNPCV1_MODBUS_TYPE = "knpc"; String KNPCV1_MODBUS_TYPE = "knpc";
String ETC_MODBUS_TYPE = "etc"; String ETC_MODBUS_TYPE = "etc";
String SCSS_MODBUS_TYPE = "scss"; String SCSS_MODBUS_TYPE = "scss";
String WEPS_PLUG_MODBUS_TYPE = "weps_plug";
String COMMAND_CACHE = "modbus:command:"; String COMMAND_CACHE = "modbus:command:";
String DEVICE_INFO_CACHE = "info:device:"; String DEVICE_INFO_CACHE = "info:device:";

View File

@ -0,0 +1,38 @@
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;
import java.util.concurrent.TimeUnit;
/**
* 本地时间类型解析器
*
* @author <a href="mailto:scwsl@foxmail.com">王仕龙</a>
* 2024/12/09 14:40
*/
@Component(MinuteLocalTimeDecodeHandler.NAME + DecodeHandler.DECODE_NAME)
public class MinuteLocalTimeDecodeHandler implements DecodeHandler {
public static final String NAME = "minuteLocalTime";
@Override
public String decode(Map<String, Object> commandPointMap, String value) {
if (StringUtils.isNotBlank(value) && NumberUtils.isCreatable(value)) {
long totalMinutes = NumberUtils.createLong(value);
long hours = TimeUnit.MINUTES.toHours(totalMinutes);
long minutes = totalMinutes - TimeUnit.HOURS.toSeconds(hours);
return String.format("%02d:%02d:00", hours, minutes);
}
return value;
}
@Override
public void decode(Map<String, Object> commandPointMap, ModbusMessage.MessagePoint point) {
point.setValue(this.decode(commandPointMap, point.getValue()));
}
}

View File

@ -0,0 +1,125 @@
package com.isu.gaswellwatch.modbus.data.impl;
import com.isu.gaswellwatch.modbus.data.PersistenceHandler;
import org.apache.commons.lang3.StringUtils;
import org.springframework.jdbc.core.PreparedStatementCallback;
import org.springframework.stereotype.Component;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.sql.Types;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
/**
* @author <a href="mailto:scwsl@foxmail.com">王仕龙</a>
* 2025/01/09 08:59
*/
@Component(PersistenceHandler.WEPS_PLUG_MODBUS_TYPE)
public class WepsPlugPersistenceHandler extends AbstractPersistenceHandler {
private static final Map<String, String> WEPS_PLUG_COLUMN_MAPPING_MAP = new HashMap<>();
static {
WEPS_PLUG_COLUMN_MAPPING_MAP.put("cas_pressure", "casPressure"); // 套压MPa-3表示现场仪表通信故障
WEPS_PLUG_COLUMN_MAPPING_MAP.put("oil_pressure", "oilPressure"); // 油压MPa-3表示现场仪表通信故障
WEPS_PLUG_COLUMN_MAPPING_MAP.put("alarm", "alarm"); // 报警信息1高压集气压力低2低压集气压力高3是柱塞危险上升4 柱塞快速上升次数超过设定值
WEPS_PLUG_COLUMN_MAPPING_MAP.put("solenoid_valve_status", "solenoidValveStatus"); // 电磁阀状态0-未知1-关状态2-开状态
WEPS_PLUG_COLUMN_MAPPING_MAP.put("open_well_remaining_time", "openWellRemainingTime"); // 定时开井剩余时间分钟
WEPS_PLUG_COLUMN_MAPPING_MAP.put("close_well_remaining_time", "closeWellRemainingTime"); // 定时关井剩余时间分钟
WEPS_PLUG_COLUMN_MAPPING_MAP.put("plug_arrival_status", "plugArrivalStatus"); // 柱塞到达信号0-未到达1-到达
WEPS_PLUG_COLUMN_MAPPING_MAP.put("plug_too_fast_count", "plugTooFastCount"); // 柱塞过快次数
WEPS_PLUG_COLUMN_MAPPING_MAP.put("plug_rising_speed", "plugRisingSpeed"); // 柱塞上升速度/分钟
WEPS_PLUG_COLUMN_MAPPING_MAP.put("downstream_pressure", "downstreamPressure"); // 阀后压力MPa-3表示现场仪表通信故障
WEPS_PLUG_COLUMN_MAPPING_MAP.put("solenoid_valve_opening", "solenoidValveOpening"); // 电控阀阀门开度%保留1位小数开度范围0~100%
WEPS_PLUG_COLUMN_MAPPING_MAP.put("reserve", "reserve"); // 预留字段
WEPS_PLUG_COLUMN_MAPPING_MAP.put("pre_pressure", "prePressure"); // 柱塞外输压力MPa-3表示现场仪表通信故障
WEPS_PLUG_COLUMN_MAPPING_MAP.put("run_mode", "runMode"); // 运行制度0-未知1-定时开关井2-压力优化微升3-自动优化
WEPS_PLUG_COLUMN_MAPPING_MAP.put("well_status", "wellStatus"); // 开关井控制0-初始值1-开井2-关井
WEPS_PLUG_COLUMN_MAPPING_MAP.put("gas_collection_method", "gasCollectionMethod"); // 集气方式1-高压集气2-低压集气
WEPS_PLUG_COLUMN_MAPPING_MAP.put("high_pressure_protection", "highPressureProtection"); // 高压保护压力MPa低压集气方式 高压保护设置
WEPS_PLUG_COLUMN_MAPPING_MAP.put("low_pressure_protection", "lowPressureProtection"); // 低压保护压力MPa高压集气方式 低压保护设置
WEPS_PLUG_COLUMN_MAPPING_MAP.put("too_fast_count", "tooFastCount"); // 过快次数设置
WEPS_PLUG_COLUMN_MAPPING_MAP.put("dangerous_rise_time", "dangerousRiseTime"); // 危险上升时间
WEPS_PLUG_COLUMN_MAPPING_MAP.put("too_fast_rise_time", "tooFastRiseTime"); // 过快上升时间
WEPS_PLUG_COLUMN_MAPPING_MAP.put("open_well_time", "openWellTime"); // 开井时间设置小时
WEPS_PLUG_COLUMN_MAPPING_MAP.put("close_well_time", "closeWellTime"); // 关井时间设置小时
WEPS_PLUG_COLUMN_MAPPING_MAP.put("open_well_cas_pressure", "openWellCasPressure"); // 套压开井压力MPa压力优化微升模式
WEPS_PLUG_COLUMN_MAPPING_MAP.put("little_rise_cas_pressure", "littleRiseCasPressure"); // 套压微升压力MPa压力优化微升模式
WEPS_PLUG_COLUMN_MAPPING_MAP.put("check_stability_time", "checkStabilityTime"); // 检测稳定时间
WEPS_PLUG_COLUMN_MAPPING_MAP.put("min_close_well_time", "minCloseWellTime"); // 最小关井时间分钟
WEPS_PLUG_COLUMN_MAPPING_MAP.put("max_close_well_time", "maxCloseWellTime"); // 最大关井时间分钟
WEPS_PLUG_COLUMN_MAPPING_MAP.put("min_open_well_time", "minOpenWellTime"); // 最小开井时间分钟
WEPS_PLUG_COLUMN_MAPPING_MAP.put("max_open_well_time", "maxOpenWellTime"); // 最大开井时间分钟
WEPS_PLUG_COLUMN_MAPPING_MAP.put("well_depth", "wellDepth"); // 气井深度
WEPS_PLUG_COLUMN_MAPPING_MAP.put("produce_mode", "produceMode"); // 生产制度1-常开2-常关3-柱塞气举
}
@Override
public void createTable(String tableName, Long deviceId) {
this.createTable("sql/CREATE_WEPS_PLUG.sql", tableName, deviceId);
}
@Override
public Map<String, Map<String, Object>> insert(String tableName, String cacheKey) {
String insertTableSQL = this.getResource("sql/INSERT_WEPS_PLUG.sql");
insertTableSQL = StringUtils.replace(insertTableSQL, "$TableName$", tableName);
Map<String, Object> oldRow = this.getLastRow(tableName);
Map<String, Object> newRow = this.redisTemplate.opsForHash().entries(cacheKey);
this.jdbcTemplate.execute(insertTableSQL, new PreparedStatementCallback<Object>() {
@Override
public Object doInPreparedStatement(PreparedStatement ps) throws SQLException {
ps.setLong(1, WepsPlugPersistenceHandler.this.snowflakeConfig.snowflakeId());
WepsPlugPersistenceHandler.this.setValue(ps, newRow, 2, "deviceId", Types.BIGINT);
WepsPlugPersistenceHandler.this.setValue(ps, newRow, 3, "collectionTime", Types.TIMESTAMP);
WepsPlugPersistenceHandler.this.setValue(ps, newRow, 4, "receiveTime", Types.TIMESTAMP);
WepsPlugPersistenceHandler.this.setValue(ps, newRow, 5, "casPressure", Types.DECIMAL);
WepsPlugPersistenceHandler.this.setValue(ps, newRow, 6, "oilPressure", Types.DECIMAL);
WepsPlugPersistenceHandler.this.setValue(ps, newRow, 7, "alarm", Types.INTEGER);
WepsPlugPersistenceHandler.this.setValue(ps, newRow, 8, "solenoidValveStatus", Types.INTEGER);
WepsPlugPersistenceHandler.this.setValue(ps, newRow, 9, "openWellRemainingTime", Types.VARCHAR);
WepsPlugPersistenceHandler.this.setValue(ps, newRow, 10, "closeWellRemainingTime", Types.VARCHAR);
WepsPlugPersistenceHandler.this.setValue(ps, newRow, 11, "plugArrivalStatus", Types.INTEGER);
WepsPlugPersistenceHandler.this.setValue(ps, newRow, 12, "plugTooFastCount", Types.INTEGER);
WepsPlugPersistenceHandler.this.setValue(ps, newRow, 13, "plugRisingSpeed", Types.INTEGER);
WepsPlugPersistenceHandler.this.setValue(ps, newRow, 14, "downstreamPressure", Types.DECIMAL);
WepsPlugPersistenceHandler.this.setValue(ps, newRow, 15, "solenoidValveOpening", Types.DECIMAL);
WepsPlugPersistenceHandler.this.setValue(ps, newRow, 16, "reserve", Types.VARCHAR);
WepsPlugPersistenceHandler.this.setValue(ps, newRow, 17, "prePressure", Types.DECIMAL);
WepsPlugPersistenceHandler.this.setValue(ps, newRow, 18, "runMode", Types.INTEGER);
WepsPlugPersistenceHandler.this.setValue(ps, newRow, 19, "wellStatus", Types.INTEGER);
WepsPlugPersistenceHandler.this.setValue(ps, newRow, 20, "gasCollectionMethod", Types.INTEGER);
WepsPlugPersistenceHandler.this.setValue(ps, newRow, 21, "highPressureProtection", Types.DECIMAL);
WepsPlugPersistenceHandler.this.setValue(ps, newRow, 22, "lowPressureProtection", Types.DECIMAL);
WepsPlugPersistenceHandler.this.setValue(ps, newRow, 23, "tooFastCount", Types.INTEGER);
WepsPlugPersistenceHandler.this.setValue(ps, newRow, 24, "dangerousRiseTime", Types.VARCHAR);
WepsPlugPersistenceHandler.this.setValue(ps, newRow, 25, "tooFastRiseTime", Types.VARCHAR);
WepsPlugPersistenceHandler.this.setValue(ps, newRow, 26, "openWellTime", Types.DECIMAL);
WepsPlugPersistenceHandler.this.setValue(ps, newRow, 27, "closeWellTime", Types.DECIMAL);
WepsPlugPersistenceHandler.this.setValue(ps, newRow, 28, "openWellCasPressure", Types.DECIMAL);
WepsPlugPersistenceHandler.this.setValue(ps, newRow, 29, "littleRiseCasPressure", Types.DECIMAL);
WepsPlugPersistenceHandler.this.setValue(ps, newRow, 30, "checkStabilityTime", Types.VARCHAR);
WepsPlugPersistenceHandler.this.setValue(ps, newRow, 31, "minCloseWellTime", Types.VARCHAR);
WepsPlugPersistenceHandler.this.setValue(ps, newRow, 32, "maxCloseWellTime", Types.VARCHAR);
WepsPlugPersistenceHandler.this.setValue(ps, newRow, 33, "minOpenWellTime", Types.VARCHAR);
WepsPlugPersistenceHandler.this.setValue(ps, newRow, 34, "maxOpenWellTime", Types.VARCHAR);
WepsPlugPersistenceHandler.this.setValue(ps, newRow, 35, "wellDepth", Types.INTEGER);
WepsPlugPersistenceHandler.this.setValue(ps, newRow, 36, "produceMode", Types.INTEGER);
return ps.executeUpdate();
}
});
if (Objects.isNull(oldRow)) {
return Map.of("new", newRow);
}
return Map.of("new", newRow, "old", oldRow);
}
@Override
protected Map<String, String> getColumnMappingMap() {
return WEPS_PLUG_COLUMN_MAPPING_MAP;
}
}

View File

@ -7,6 +7,7 @@ import com.isu.gaswellwatch.vo.command.etc.*;
import com.isu.gaswellwatch.vo.command.knpcv1.mode.TimingMode; import com.isu.gaswellwatch.vo.command.knpcv1.mode.TimingMode;
import com.isu.gaswellwatch.vo.command.knpcv1.mode.*; import com.isu.gaswellwatch.vo.command.knpcv1.mode.*;
import com.isu.gaswellwatch.vo.command.scss.*; import com.isu.gaswellwatch.vo.command.scss.*;
import com.isu.gaswellwatch.vo.command.weps.WepsPlugControl;
import jakarta.validation.constraints.NotBlank; import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull; import jakarta.validation.constraints.NotNull;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
@ -54,6 +55,7 @@ import java.util.Objects;
@JsonSubTypes.Type(value = com.isu.gaswellwatch.vo.command.scss.TurnOff.class, name = Command.SCSS_TURN_OFF_THE_WELL), @JsonSubTypes.Type(value = com.isu.gaswellwatch.vo.command.scss.TurnOff.class, name = Command.SCSS_TURN_OFF_THE_WELL),
@JsonSubTypes.Type(value = com.isu.gaswellwatch.vo.command.knpcv1.TurnOn.class, name = Command.KNPCV1_TURN_ON_THE_WELL), @JsonSubTypes.Type(value = com.isu.gaswellwatch.vo.command.knpcv1.TurnOn.class, name = Command.KNPCV1_TURN_ON_THE_WELL),
@JsonSubTypes.Type(value = com.isu.gaswellwatch.vo.command.knpcv1.TurnOff.class, name = Command.KNPCV1_TURN_OFF_THE_WELL), @JsonSubTypes.Type(value = com.isu.gaswellwatch.vo.command.knpcv1.TurnOff.class, name = Command.KNPCV1_TURN_OFF_THE_WELL),
@JsonSubTypes.Type(value = WepsPlugControl.class, name = Command.WEPS_PLUG_CONTROL),
}) })
@Getter @Getter
@Setter @Setter
@ -115,6 +117,12 @@ public abstract class Command implements Serializable {
/* 点表类型ETC end */ /* 点表类型ETC end */
/* 点表类型:威尔普斯 start */
// 威尔普斯柱塞模式
public static final String WEPS_PLUG_CONTROL = "WEPS.PLUG.CONTROL";
/* 点表类型:威尔普斯 end */
public static final BigDecimal ONE_SIXTY = BigDecimal.valueOf(60);
public static final BigDecimal ONE_HUNDRED = BigDecimal.valueOf(100); public static final BigDecimal ONE_HUNDRED = BigDecimal.valueOf(100);
public static final BigDecimal ONE_THOUSAND = BigDecimal.valueOf(1000); public static final BigDecimal ONE_THOUSAND = BigDecimal.valueOf(1000);

View File

@ -107,4 +107,27 @@ public interface Timing {
} }
return TimeUnit.HOURS.toSeconds(hours) + TimeUnit.MINUTES.toSeconds(minutes) + seconds; return TimeUnit.HOURS.toSeconds(hours) + TimeUnit.MINUTES.toSeconds(minutes) + seconds;
} }
/**
* 支持[0-999]:[0-59]:[0-59]
* 注意秒不管为多少都会被直接忽略
*
* @param stringTime 时间
* @return 返回秒数
*/
default long toMinutes(String stringTime) {
String[] values = StringUtils.split(stringTime, ":");
int hours = 0, minutes = 0;
switch (values.length) {
case 1 -> hours = Integer.parseInt(values[0]);
case 2, 3 -> {
hours = Integer.parseInt(values[0]);
minutes = Integer.parseInt(values[1]);
}
default -> {
throw new RuntimeException("格式不合法");
}
}
return TimeUnit.HOURS.toMinutes(hours) + minutes;
}
} }

View File

@ -0,0 +1,111 @@
package com.isu.gaswellwatch.vo.command.weps;
import com.isu.gaswellwatch.dto.modbus.ModbusCommandDto;
import com.isu.gaswellwatch.vo.command.Command;
import com.isu.gaswellwatch.vo.command.Timing;
import lombok.Getter;
import lombok.Setter;
import lombok.experimental.SuperBuilder;
import org.apache.commons.lang3.StringUtils;
import java.io.Serial;
import java.math.BigDecimal;
import java.util.Collection;
import java.util.List;
/**
* 威尔普斯控制指令
*
* @author <a href="mailto:shilong.wang@alpha-ess.com">王仕龙</a>
* 2025/1/10 11:00
*/
@Getter
@Setter
@SuperBuilder
public class WepsPlugControl extends Command implements Timing {
@Serial
private static final long serialVersionUID = -7540015879950965127L;
private Integer runMode;
private Integer wellStatus;
private Integer gasCollectionMethod;
private BigDecimal highPressureProtection;
private BigDecimal lowPressureProtection;
private Integer tooFastCount;
private String dangerousRiseTime;
private String tooFastRiseTime;
private BigDecimal openWellTime;
private BigDecimal closeWellTime;
private BigDecimal openWellCasPressure;
private BigDecimal littleRiseCasPressure;
private String checkStabilityTime;
private String minCloseWellTime;
private String maxCloseWellTime;
private String minOpenWellTime;
private String maxOpenWellTime;
private Integer wellDepth;
private Integer produceMode;
public WepsPlugControl() {
this.setCode("WEPS.PLUG.CONTROL");
}
public void setDangerousRiseTime(String dangerousRiseTime) {
this.dangerousRiseTime = this.timingValidate(dangerousRiseTime, "dangerousRiseTime");
}
public void setTooFastRiseTime(String tooFastRiseTime) {
this.tooFastRiseTime = this.timingValidate(tooFastRiseTime, "tooFastRiseTime");
}
public void setCheckStabilityTime(String checkStabilityTime) {
this.checkStabilityTime = this.timingValidate(checkStabilityTime, "checkStabilityTime");
}
public void setMinCloseWellTime(String minCloseWellTime) {
this.minCloseWellTime = this.timingValidate(minCloseWellTime, "minCloseWellTime");
}
public void setMaxCloseWellTime(String maxCloseWellTime) {
this.maxCloseWellTime = this.timingValidate(maxCloseWellTime, "maxCloseWellTime");
}
public void setMinOpenWellTime(String minOpenWellTime) {
this.minOpenWellTime = this.timingValidate(minOpenWellTime, "minOpenWellTime");
}
public void setMaxOpenWellTime(String maxOpenWellTime) {
this.maxOpenWellTime = this.timingValidate(maxOpenWellTime, "maxOpenWellTime");
}
@Override
protected Collection<ModbusCommandDto> builderModbusCommand() {
StringBuilder command = new StringBuilder(250);
// 100
// 地址码 功能码 起始地址 连续长度 连续字长
// 01 10 003F 0013 26
command.append("0110003F001326");
command.append(StringUtils.leftPad(Integer.toHexString(this.runMode), 4, "0"));
command.append(StringUtils.leftPad(Integer.toHexString(this.wellStatus), 4, "0"));
command.append(StringUtils.leftPad(Integer.toHexString(this.gasCollectionMethod), 4, "0"));
command.append(StringUtils.leftPad(Long.toHexString(this.highPressureProtection.multiply(ONE_HUNDRED).longValue()), 4, "0"));
command.append(StringUtils.leftPad(Long.toHexString(this.lowPressureProtection.multiply(ONE_HUNDRED).longValue()), 4, "0"));
command.append(StringUtils.leftPad(Integer.toHexString(this.tooFastCount), 4, "0"));
command.append(StringUtils.leftPad(Long.toHexString(this.toSeconds(this.dangerousRiseTime)), 4, "0"));
command.append(StringUtils.leftPad(Long.toHexString(this.toSeconds(this.tooFastRiseTime)), 4, "0"));
command.append(StringUtils.leftPad(Long.toHexString(this.openWellTime.multiply(ONE_SIXTY).longValue()), 4, "0"));
command.append(StringUtils.leftPad(Long.toHexString(this.closeWellTime.multiply(ONE_SIXTY).longValue()), 4, "0"));
command.append(StringUtils.leftPad(Long.toHexString(this.openWellCasPressure.multiply(ONE_HUNDRED).longValue()), 4, "0"));
command.append(StringUtils.leftPad(Long.toHexString(this.littleRiseCasPressure.multiply(ONE_HUNDRED).longValue()), 4, "0"));
command.append(StringUtils.leftPad(Long.toHexString(this.toSeconds(this.checkStabilityTime)), 4, "0"));
command.append(StringUtils.leftPad(Long.toHexString(this.toMinutes(this.minCloseWellTime)), 4, "0"));
command.append(StringUtils.leftPad(Long.toHexString(this.toMinutes(this.maxCloseWellTime)), 4, "0"));
command.append(StringUtils.leftPad(Long.toHexString(this.toMinutes(this.minOpenWellTime)), 4, "0"));
command.append(StringUtils.leftPad(Long.toHexString(this.toMinutes(this.maxOpenWellTime)), 4, "0"));
command.append(StringUtils.leftPad(Integer.toHexString(this.wellDepth), 4, "0"));
command.append(StringUtils.leftPad(Integer.toHexString(this.produceMode), 4, "0"));
return List.of(ModbusCommandDto.builder().command(command.toString()).length(16).build());
}
}

View File

@ -71,6 +71,108 @@ INSERT INTO `command_points` (`id`, `command_id`, `field`, `name`, `details`, `s
`precision`, `format`, `decode_name`) `precision`, `format`, `decode_name`)
VALUES (12013, 10203, 'afterFlowTime', '续流时间', '', 145, 3, NULL, NULL, '%s:%s:%s', 'stringTime'); VALUES (12013, 10203, 'afterFlowTime', '续流时间', '', 145, 3, NULL, NULL, '%s:%s:%s', 'stringTime');
INSERT INTO `command_points` (`id`, `command_id`, `field`, `name`, `details`, `start_address`, `step_size`, `factor`,
`precision`, `format`, `decode_name`)
VALUES (13000, 10300, 'casPressure', '套压', 'MPa-3表示现场仪表通信故障', 50, 1, 100.00, 2, NULL, 'factor');
INSERT INTO `command_points` (`id`, `command_id`, `field`, `name`, `details`, `start_address`, `step_size`, `factor`,
`precision`, `format`, `decode_name`)
VALUES (13001, 10300, 'oilPressure', '油压', 'MPa-3表示现场仪表通信故障', 51, 1, 100.00, 2, NULL, 'factor');
INSERT INTO `command_points` (`id`, `command_id`, `field`, `name`, `details`, `start_address`, `step_size`, `factor`,
`precision`, `format`, `decode_name`)
VALUES (13002, 10300, 'alarm', '报警信息', '1高压集气压力低2低压集气压力高3是柱塞危险上升4 柱塞快速上升次数超过设定值',
52, 1, NULL, NULL, NULL, NULL);
INSERT INTO `command_points` (`id`, `command_id`, `field`, `name`, `details`, `start_address`, `step_size`, `factor`,
`precision`, `format`, `decode_name`)
VALUES (13003, 10300, 'solenoidValveStatus', '电磁阀状态', '0-未知1-关状态2-开状态;', 53, 1, NULL, NULL, NULL, NULL);
INSERT INTO `command_points` (`id`, `command_id`, `field`, `name`, `details`, `start_address`, `step_size`, `factor`,
`precision`, `format`, `decode_name`)
VALUES (13004, 10300, 'openWellRemainingTime', '定时开井剩余时间', '分钟', 54, 1, NULL, NULL, NULL, 'minuteLocalTime');
INSERT INTO `command_points` (`id`, `command_id`, `field`, `name`, `details`, `start_address`, `step_size`, `factor`,
`precision`, `format`, `decode_name`)
VALUES (13005, 10300, 'closeWellRemainingTime', '定时关井剩余时间', '分钟', 55, 1, NULL, NULL, NULL, 'minuteLocalTime');
INSERT INTO `command_points` (`id`, `command_id`, `field`, `name`, `details`, `start_address`, `step_size`, `factor`,
`precision`, `format`, `decode_name`)
VALUES (13006, 10300, 'plugArrivalStatus', '柱塞到达信号', '0-未到达1-到达;', 56, 1, NULL, NULL, NULL, NULL);
INSERT INTO `command_points` (`id`, `command_id`, `field`, `name`, `details`, `start_address`, `step_size`, `factor`,
`precision`, `format`, `decode_name`)
VALUES (13007, 10300, 'plugTooFastCount', '柱塞过快次数', '', 57, 1, NULL, NULL, NULL, NULL);
INSERT INTO `command_points` (`id`, `command_id`, `field`, `name`, `details`, `start_address`, `step_size`, `factor`,
`precision`, `format`, `decode_name`)
VALUES (13008, 10300, 'plugRisingSpeed', '柱塞上升速度', '米/分钟', 58, 1, NULL, NULL, NULL, NULL);
INSERT INTO `command_points` (`id`, `command_id`, `field`, `name`, `details`, `start_address`, `step_size`, `factor`,
`precision`, `format`, `decode_name`)
VALUES (13009, 10300, 'downstreamPressure', '阀后压力', 'MPa-3表示现场仪表通信故障', 59, 1, 100.00, 2, NULL, 'factor');
INSERT INTO `command_points` (`id`, `command_id`, `field`, `name`, `details`, `start_address`, `step_size`, `factor`,
`precision`, `format`, `decode_name`)
VALUES (13010, 10300, 'solenoidValveOpening', '电控阀阀门开度', '%保留1位小数开度范围0~100%', 60, 1, 10.00, 1, NULL,
'factor');
INSERT INTO `command_points` (`id`, `command_id`, `field`, `name`, `details`, `start_address`, `step_size`, `factor`,
`precision`, `format`, `decode_name`)
VALUES (13011, 10300, 'reserve', '预留', NULL, 61, 1, NULL, NULL, NULL, NULL);
INSERT INTO `command_points` (`id`, `command_id`, `field`, `name`, `details`, `start_address`, `step_size`, `factor`,
`precision`, `format`, `decode_name`)
VALUES (13012, 10300, 'prePressure', '柱塞外输压力', 'MPa-3表示现场仪表通信故障', 62, 1, 100.00, 2, NULL, 'factor');
INSERT INTO `command_points` (`id`, `command_id`, `field`, `name`, `details`, `start_address`, `step_size`, `factor`,
`precision`, `format`, `decode_name`)
VALUES (13013, 10300, 'runMode', '运行制度', '0-未知1-定时开关井2-压力优化微升3-自动优化;', 63, 1, NULL, NULL, NULL,
NULL);
INSERT INTO `command_points` (`id`, `command_id`, `field`, `name`, `details`, `start_address`, `step_size`, `factor`,
`precision`, `format`, `decode_name`)
VALUES (13014, 10300, 'wellStatus', '开关井控制', '0-初始值1-开井2-关井;', 64, 1, NULL, NULL, NULL, NULL);
INSERT INTO `command_points` (`id`, `command_id`, `field`, `name`, `details`, `start_address`, `step_size`, `factor`,
`precision`, `format`, `decode_name`)
VALUES (13015, 10300, 'gasCollectionMethod', '集气方式', '1-高压集气2-低压集气;', 65, 1, NULL, NULL, NULL, NULL);
INSERT INTO `command_points` (`id`, `command_id`, `field`, `name`, `details`, `start_address`, `step_size`, `factor`,
`precision`, `format`, `decode_name`)
VALUES (13016, 10300, 'highPressureProtection', '高压保护压力', 'MPa低压集气方式 高压保护设置;', 66, 1, 100.00, 2,
NULL, 'factor');
INSERT INTO `command_points` (`id`, `command_id`, `field`, `name`, `details`, `start_address`, `step_size`, `factor`,
`precision`, `format`, `decode_name`)
VALUES (13017, 10300, 'lowPressureProtection', '低压保护压力', 'MPa高压集气方式 低压保护设置;', 67, 1, 100.00, 2,
NULL, 'factor');
INSERT INTO `command_points` (`id`, `command_id`, `field`, `name`, `details`, `start_address`, `step_size`, `factor`,
`precision`, `format`, `decode_name`)
VALUES (13018, 10300, 'tooFastCount', '过快次数设置', '', 68, 1, NULL, NULL, NULL, NULL);
INSERT INTO `command_points` (`id`, `command_id`, `field`, `name`, `details`, `start_address`, `step_size`, `factor`,
`precision`, `format`, `decode_name`)
VALUES (13019, 10300, 'dangerousRiseTime', '危险上升时间', '', 69, 1, NULL, NULL, NULL, 'secondLocalTime');
INSERT INTO `command_points` (`id`, `command_id`, `field`, `name`, `details`, `start_address`, `step_size`, `factor`,
`precision`, `format`, `decode_name`)
VALUES (13020, 10300, 'tooFastRiseTime', '过快上升时间', '', 70, 1, NULL, NULL, NULL, 'secondLocalTime');
INSERT INTO `command_points` (`id`, `command_id`, `field`, `name`, `details`, `start_address`, `step_size`, `factor`,
`precision`, `format`, `decode_name`)
VALUES (13021, 10300, 'openWellTime', '开井时间设置', '小时', 71, 1, 60.00, 2, NULL, 'factor');
INSERT INTO `command_points` (`id`, `command_id`, `field`, `name`, `details`, `start_address`, `step_size`, `factor`,
`precision`, `format`, `decode_name`)
VALUES (13022, 10300, 'closeWellTime', '关井时间设置', '小时', 72, 1, 60.00, 2, NULL, 'factor');
INSERT INTO `command_points` (`id`, `command_id`, `field`, `name`, `details`, `start_address`, `step_size`, `factor`,
`precision`, `format`, `decode_name`)
VALUES (13023, 10300, 'openWellCasPressure', '套压开井压力', 'MPa压力优化微升模式', 73, 1, 100.00, 2, NULL, 'factor');
INSERT INTO `command_points` (`id`, `command_id`, `field`, `name`, `details`, `start_address`, `step_size`, `factor`,
`precision`, `format`, `decode_name`)
VALUES (13024, 10300, 'littleRiseCasPressure', '套压微升压力', 'MPa压力优化微升模式', 74, 1, 100.00, 2, NULL,
'factor');
INSERT INTO `command_points` (`id`, `command_id`, `field`, `name`, `details`, `start_address`, `step_size`, `factor`,
`precision`, `format`, `decode_name`)
VALUES (13025, 10300, 'checkStabilityTime', '检测稳定时间', '', 75, 1, NULL, NULL, NULL, 'secondLocalTime');
INSERT INTO `command_points` (`id`, `command_id`, `field`, `name`, `details`, `start_address`, `step_size`, `factor`,
`precision`, `format`, `decode_name`)
VALUES (13026, 10300, 'minCloseWellTime', '最小关井时间', '分钟', 76, 1, NULL, NULL, NULL, 'minuteLocalTime');
INSERT INTO `command_points` (`id`, `command_id`, `field`, `name`, `details`, `start_address`, `step_size`, `factor`,
`precision`, `format`, `decode_name`)
VALUES (13027, 10300, 'maxCloseWellTime', '最大关井时间', '分钟', 77, 1, NULL, NULL, NULL, 'minuteLocalTime');
INSERT INTO `command_points` (`id`, `command_id`, `field`, `name`, `details`, `start_address`, `step_size`, `factor`,
`precision`, `format`, `decode_name`)
VALUES (13028, 10300, 'minOpenWellTime', '最小开井时间', '分钟', 78, 1, NULL, NULL, NULL, 'minuteLocalTime');
INSERT INTO `command_points` (`id`, `command_id`, `field`, `name`, `details`, `start_address`, `step_size`, `factor`,
`precision`, `format`, `decode_name`)
VALUES (13029, 10300, 'maxOpenWellTime', '最大开井时间', '分钟', 79, 1, NULL, NULL, NULL, 'minuteLocalTime');
INSERT INTO `command_points` (`id`, `command_id`, `field`, `name`, `details`, `start_address`, `step_size`, `factor`,
`precision`, `format`, `decode_name`)
VALUES (13030, 10300, 'wellDepth', '气井深度', '', 80, 1, NULL, NULL, NULL, NULL);
INSERT INTO `command_points` (`id`, `command_id`, `field`, `name`, `details`, `start_address`, `step_size`, `factor`,
`precision`, `format`, `decode_name`)
VALUES (13031, 10300, 'produceMode', '生产制度', '1-常开2-常关3-柱塞气举;', 81, 1, NULL, NULL, NULL, NULL);
delete delete
from `command_points` from `command_points`

View File

@ -35,4 +35,4 @@ CREATE TABLE `$TableName$`
`open_tub_pressure_stable_time` varchar(10) NULL DEFAULT NULL COMMENT '油压稳定时间', `open_tub_pressure_stable_time` varchar(10) NULL DEFAULT NULL COMMENT '油压稳定时间',
PRIMARY KEY (`id`) USING BTREE, PRIMARY KEY (`id`) USING BTREE,
UNIQUE INDEX `udx_device_create_time` (`device_id` ASC, `collection_time` ASC) USING BTREE COMMENT '设备采集数据唯一键' UNIQUE INDEX `udx_device_create_time` (`device_id` ASC, `collection_time` ASC) USING BTREE COMMENT '设备采集数据唯一键'
) ENGINE = InnoDB COMMENT = '设备ID$DeviceId$的采集数据' ) ENGINE = InnoDB COMMENT = 'ETC设备ID$DeviceId$的采集数据'

View File

@ -56,4 +56,4 @@ CREATE TABLE `$TableName$`
`tp_stability_time` smallint NULL DEFAULT NULL COMMENT '时压模式压力稳定时长:秒', `tp_stability_time` smallint NULL DEFAULT NULL COMMENT '时压模式压力稳定时长:秒',
PRIMARY KEY (`id`) USING BTREE, PRIMARY KEY (`id`) USING BTREE,
UNIQUE INDEX `udx_device_create_time` (`device_id` ASC, `collection_time` ASC) USING BTREE COMMENT '设备采集数据唯一键' UNIQUE INDEX `udx_device_create_time` (`device_id` ASC, `collection_time` ASC) USING BTREE COMMENT '设备采集数据唯一键'
) ENGINE = InnoDB COMMENT = '设备ID$DeviceId$的采集数据' ) ENGINE = InnoDB COMMENT = 'KNPC设备ID$DeviceId$的采集数据'

View File

@ -88,4 +88,4 @@ CREATE TABLE `$TableName$`
`well_close_flow_value_at_close` int NULL DEFAULT NULL COMMENT '关井时流量值(关井瞬间)', `well_close_flow_value_at_close` int NULL DEFAULT NULL COMMENT '关井时流量值(关井瞬间)',
PRIMARY KEY (`id`) USING BTREE, PRIMARY KEY (`id`) USING BTREE,
UNIQUE INDEX `udx_device_create_time` (`device_id` ASC, `collection_time` ASC) USING BTREE COMMENT '设备采集数据唯一键' UNIQUE INDEX `udx_device_create_time` (`device_id` ASC, `collection_time` ASC) USING BTREE COMMENT '设备采集数据唯一键'
) ENGINE = InnoDB COMMENT = '设备ID$DeviceId$的采集数据' ) ENGINE = InnoDB COMMENT = '四川双晟设备ID$DeviceId$的采集数据'

View File

@ -0,0 +1,42 @@
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 '套压MPa-3表示现场仪表通信故障',
`oil_pressure` decimal(10, 2) NULL DEFAULT NULL COMMENT '油压MPa-3表示现场仪表通信故障',
`alarm` int NULL DEFAULT NULL COMMENT '报警信息1高压集气压力低2低压集气压力高3是柱塞危险上升4 柱塞快速上升次数超过设定值',
`solenoid_valve_status` int NULL DEFAULT NULL COMMENT '电磁阀状态0-未知1-关状态2-开状态;',
`open_well_remaining_time` varchar(10) NULL DEFAULT NULL COMMENT '定时开井剩余时间;分钟',
`close_well_remaining_time` varchar(10) NULL DEFAULT NULL COMMENT '定时关井剩余时间;分钟',
`plug_arrival_status` int NULL DEFAULT NULL COMMENT '柱塞到达信号0-未到达1-到达;',
`plug_too_fast_count` int NULL DEFAULT NULL COMMENT '柱塞过快次数;次',
`plug_rising_speed` int NULL DEFAULT NULL COMMENT '柱塞上升速度;米/分钟',
`downstream_pressure` decimal(10, 2) NULL DEFAULT NULL COMMENT '阀后压力MPa-3表示现场仪表通信故障',
`solenoid_valve_opening` decimal(10, 1) NULL DEFAULT NULL COMMENT '电控阀阀门开度;%保留1位小数开度范围0~100%',
`reserve` varchar(10) NULL DEFAULT NULL COMMENT '预留',
`pre_pressure` decimal(10, 2) NULL DEFAULT NULL COMMENT '柱塞外输压力MPa-3表示现场仪表通信故障',
`run_mode` int NULL DEFAULT NULL COMMENT '运行制度0-未知1-定时开关井2-压力优化微升3-自动优化;',
`well_status` int NULL DEFAULT NULL COMMENT '开关井控制0-初始值1-开井2-关井;',
`gas_collection_method` int NULL DEFAULT NULL COMMENT '集气方式1-高压集气2-低压集气;',
`high_pressure_protection` decimal(10, 2) NULL DEFAULT NULL COMMENT '高压保护压力MPa低压集气方式 高压保护设置;',
`low_pressure_protection` decimal(10, 2) NULL DEFAULT NULL COMMENT '低压保护压力MPa高压集气方式 低压保护设置;',
`too_fast_count` int NULL DEFAULT NULL COMMENT '过快次数设置;次',
`dangerous_rise_time` varchar(10) NULL DEFAULT NULL COMMENT '危险上升时间;秒',
`too_fast_rise_time` varchar(10) NULL DEFAULT NULL COMMENT '过快上升时间;秒',
`open_well_time` decimal(10, 2) NULL DEFAULT NULL COMMENT '开井时间设置;小时',
`close_well_time` decimal(10, 2) NULL DEFAULT NULL COMMENT '关井时间设置;小时',
`open_well_cas_pressure` decimal(10, 2) NULL DEFAULT NULL COMMENT '套压开井压力MPa压力优化微升模式',
`little_rise_cas_pressure` decimal(10, 2) NULL DEFAULT NULL COMMENT '套压微升压力MPa压力优化微升模式',
`check_stability_time` varchar(10) NULL DEFAULT NULL COMMENT '检测稳定时间;秒',
`min_close_well_time` varchar(10) NULL DEFAULT NULL COMMENT '最小关井时间;分钟',
`max_close_well_time` varchar(10) NULL DEFAULT NULL COMMENT '最大关井时间;分钟',
`min_open_well_time` varchar(10) NULL DEFAULT NULL COMMENT '最小开井时间;分钟',
`max_open_well_time` varchar(10) NULL DEFAULT NULL COMMENT '最大开井时间;分钟',
`well_depth` int NULL DEFAULT NULL COMMENT '气井深度;米',
`produce_mode` int NULL DEFAULT NULL COMMENT '生产制度1-常开2-常关3-柱塞气举',
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$的采集数据'

View File

@ -0,0 +1,44 @@
INSERT INTO `$TableName$`(`id`, `device_id`, `created_time`, `collection_time`, `receive_time`,
`cas_pressure`, `oil_pressure`, `alarm`, `solenoid_valve_status`,
`open_well_remaining_time`, `close_well_remaining_time`, `plug_arrival_status`,
`plug_too_fast_count`, `plug_rising_speed`, `downstream_pressure`,
`solenoid_valve_opening`, `reserve`, `pre_pressure`, `run_mode`, `well_status`,
`gas_collection_method`, `high_pressure_protection`, `low_pressure_protection`,
`too_fast_count`, `dangerous_rise_time`, `too_fast_rise_time`, `open_well_time`,
`close_well_time`, `open_well_cas_pressure`, `little_rise_cas_pressure`,
`check_stability_time`, `min_close_well_time`, `max_close_well_time`, `min_open_well_time`,
`max_open_well_time`, `well_depth`, `produce_mode`)
VALUES (?, ?, NOW(), ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
ON DUPLICATE KEY UPDATE receive_time=VALUES(receive_time),
cas_pressure=VALUES(cas_pressure),
oil_pressure=VALUES(oil_pressure),
alarm=VALUES(alarm),
solenoid_valve_status=VALUES(solenoid_valve_status),
open_well_remaining_time=VALUES(open_well_remaining_time),
close_well_remaining_time=VALUES(close_well_remaining_time),
plug_arrival_status=VALUES(plug_arrival_status),
plug_too_fast_count=VALUES(plug_too_fast_count),
plug_rising_speed=VALUES(plug_rising_speed),
downstream_pressure=VALUES(downstream_pressure),
solenoid_valve_opening=VALUES(solenoid_valve_opening),
reserve=VALUES(reserve),
pre_pressure=VALUES(pre_pressure),
run_mode=VALUES(run_mode),
well_status=VALUES(well_status),
gas_collection_method=VALUES(gas_collection_method),
high_pressure_protection=VALUES(high_pressure_protection),
low_pressure_protection=VALUES(low_pressure_protection),
too_fast_count=VALUES(too_fast_count),
dangerous_rise_time=VALUES(dangerous_rise_time),
too_fast_rise_time=VALUES(too_fast_rise_time),
open_well_time=VALUES(open_well_time),
close_well_time=VALUES(close_well_time),
open_well_cas_pressure=VALUES(open_well_cas_pressure),
little_rise_cas_pressure=VALUES(little_rise_cas_pressure),
check_stability_time=VALUES(check_stability_time),
min_close_well_time=VALUES(min_close_well_time),
max_close_well_time=VALUES(max_close_well_time),
min_open_well_time=VALUES(min_open_well_time),
max_open_well_time=VALUES(max_open_well_time),
well_depth=VALUES(well_depth),
produce_mode=VALUES(produce_mode)