新增威尔普斯脚本

This commit is contained in:
wangshilong 2025-02-19 14:56:14 +08:00
parent 9c41e15957
commit 97299bee61
2 changed files with 175 additions and 39 deletions

View File

@ -0,0 +1,110 @@
INSERT INTO `dictionary` (`id`, `type`, `code`, `name`, `value`, `sort`, `create_time`, `update_time`)
VALUES (28, 'deviceProduct', 'weps_plug', '维尔普斯', '4', 4, now(), now());
INSERT INTO `commands` (`id`, `ref_type`, `ref_id`, `name`, `code`, `type`, `collection_frequency`, `command`,
`start_address`, `message_length`, `details`)
VALUES (10300, 'DEVICE_PRODUCT_CODE', 28, '采集柱塞模式数据', 'READ_DATA', 'COLLECTION', 30, '010300320020', 32, 138,
'(新版)维尔普斯控制器柱塞模式数据全量采集');
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);

View File

@ -10,9 +10,11 @@
<result column="details" property="details"/>
<result column="create_time" property="createTime"/>
<result column="update_time" property="updateTime"/>
<association property="deviceType" javaType="com.isu.gaswellwatch.entity.Dictionary" select="getDic" column="device_type">
<association property="deviceType" javaType="com.isu.gaswellwatch.entity.Dictionary" select="getDic"
column="device_type">
</association>
<association property="product" javaType="com.isu.gaswellwatch.entity.Dictionary" select="getDic" column="product">
<association property="product" javaType="com.isu.gaswellwatch.entity.Dictionary" select="getDic"
column="product">
</association>
<association property="gasWell" javaType="com.isu.gaswellwatch.entity.GasWell">
<id column="gasWellId" property="id"/>
@ -60,23 +62,41 @@
<select id="getDic" parameterType="java.lang.Long" resultType="com.isu.gaswellwatch.entity.Dictionary">
SELECT d.id, d.type, d.code, d.name, d.value, d.sort
FROM Dictionary d
FROM dictionary d
where d.id = #{dicId}
</select>
<select id="getDeviceById" resultMap="DeviceVOMap">
select u.id, u.device_type, u.code, u.gas_station, u.product, u.gateway_sn,
u.gas_well, u.details, u.create_time, u.update_time,g.name as gasWellName,g.id as gasWellId,g.block_id as gasWellBlock
from device u left join gas_well g on u.gas_well = g.id
select u.id,
u.device_type,
u.code,
u.gas_station,
u.product,
u.gateway_sn,
u.gas_well,
u.details,
u.create_time,
u.update_time,
g.name as gasWellName,
g.id as gasWellId,
g.block_id as gasWellBlock
from device u
left join gas_well g on u.gas_well = g.id
where u.id = #{id}
</select>
<select id="historyPage" resultType="com.isu.gaswellwatch.vo.DeviceHistoryVO">
select t.collection_time,t.oil_pressure,t.cas_pressure,t.pre_pressure
<if test="deviceProduct!=null and deviceProduct=='knpc'">,t.run_mode,t.status_end_time,t.temperature,t.humidity,t.well_status,t.plug_status</if>
<if test="deviceProduct!=null and deviceProduct=='etc'">,t.current_status_remaining_time as statusEndTime,t.controller_current_status as runMode,t.solenoid_valve_status as wellStatus</if>
<if test="deviceProduct!=null and deviceProduct=='scss'">,t.ctl_model as runMode,t.remaining_time_action as statusEndTime,t.solar_voltage,t.first_solenoid_status as wellStatus</if>
<if test="deviceProduct!=null and deviceProduct=='knpc'">
,t.run_mode,t.status_end_time,t.temperature,t.humidity,t.well_status,t.plug_status
</if>
<if test="deviceProduct!=null and deviceProduct=='etc'">,t.current_status_remaining_time as
statusEndTime,t.controller_current_status as runMode,t.solenoid_valve_status as wellStatus
</if>
<if test="deviceProduct!=null and deviceProduct=='scss'">,t.ctl_model as runMode,t.remaining_time_action as
statusEndTime,t.solar_voltage,t.first_solenoid_status as wellStatus
</if>
from ${tableName} t
<where>
t.device_id = #{deviceId}
@ -151,9 +171,15 @@
<select id="getDeviceHistoryData" resultType="com.isu.gaswellwatch.vo.DeviceHistoryVO">
select t.collection_time,t.oil_pressure,t.cas_pressure,t.pre_pressure
<if test="deviceProduct!=null and deviceProduct=='knpc'">,t.run_mode,t.status_end_time,t.temperature,t.humidity,t.well_status,t.plug_status</if>
<if test="deviceProduct!=null and deviceProduct=='etc'">,t.current_status_remaining_time as statusEndTime,t.controller_current_status as runMode,t.solenoid_valve_status as wellStatus</if>
<if test="deviceProduct!=null and deviceProduct=='scss'">,t.ctl_model as runMode,t.remaining_time_action as statusEndTime,t.solar_voltage,t.first_solenoid_status as wellStatus</if>
<if test="deviceProduct!=null and deviceProduct=='knpc'">
,t.run_mode,t.status_end_time,t.temperature,t.humidity,t.well_status,t.plug_status
</if>
<if test="deviceProduct!=null and deviceProduct=='etc'">,t.current_status_remaining_time as
statusEndTime,t.controller_current_status as runMode,t.solenoid_valve_status as wellStatus
</if>
<if test="deviceProduct!=null and deviceProduct=='scss'">,t.ctl_model as runMode,t.remaining_time_action as
statusEndTime,t.solar_voltage,t.first_solenoid_status as wellStatus
</if>
from ${tableName} t
<where>
t.device_id = #{deviceId}