From 2195aed2693de983ce11666b1ef4f51cade2e465 Mon Sep 17 00:00:00 2001 From: wangshilong Date: Sun, 15 Dec 2024 12:27:17 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9EETC=E8=AE=BE=E5=A4=87?= =?UTF-8?q?=E6=8C=87=E4=BB=A4=EF=BC=9A=E4=BF=AE=E6=94=B9=E6=97=B6=E9=97=B4?= =?UTF-8?q?=E6=A0=BC=E5=BC=8F=E5=8C=96=E6=96=B9=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../modbus/data/CacheService.java | 2 +- .../isu/gaswellwatch/vo/command/Command.java | 11 +++---- .../vo/command/etc/TimeFormat.java | 30 +++++++++++++++++++ 3 files changed, 37 insertions(+), 6 deletions(-) create mode 100644 src/main/java/com/isu/gaswellwatch/vo/command/etc/TimeFormat.java diff --git a/src/main/java/com/isu/gaswellwatch/modbus/data/CacheService.java b/src/main/java/com/isu/gaswellwatch/modbus/data/CacheService.java index 2450931..e0f8902 100644 --- a/src/main/java/com/isu/gaswellwatch/modbus/data/CacheService.java +++ b/src/main/java/com/isu/gaswellwatch/modbus/data/CacheService.java @@ -12,7 +12,7 @@ import java.util.HashSet; import java.util.Set; /** - * @author 王仕龙 + * @author 王仕龙 * 2024/12/9 12:34 */ @Service diff --git a/src/main/java/com/isu/gaswellwatch/vo/command/Command.java b/src/main/java/com/isu/gaswellwatch/vo/command/Command.java index b90c72b..7328a63 100644 --- a/src/main/java/com/isu/gaswellwatch/vo/command/Command.java +++ b/src/main/java/com/isu/gaswellwatch/vo/command/Command.java @@ -3,10 +3,8 @@ package com.isu.gaswellwatch.vo.command; import com.fasterxml.jackson.annotation.JsonSubTypes; import com.fasterxml.jackson.annotation.JsonTypeInfo; import com.isu.gaswellwatch.dto.modbus.ModbusCommandDto; -import com.isu.gaswellwatch.vo.command.etc.CasPressureOptimization; -import com.isu.gaswellwatch.vo.command.etc.PlungerTimer; -import com.isu.gaswellwatch.vo.command.etc.SensorDelay; -import com.isu.gaswellwatch.vo.command.etc.TubPressureOptimization; +import com.isu.gaswellwatch.vo.command.etc.*; +import com.isu.gaswellwatch.vo.command.knpcv1.mode.TimingMode; import com.isu.gaswellwatch.vo.command.knpcv1.mode.*; import com.isu.gaswellwatch.vo.command.scss.*; import jakarta.validation.constraints.NotBlank; @@ -39,9 +37,10 @@ import java.util.Objects; @JsonSubTypes.Type(value = TimePressureMode.class, name = Command.KNPCV1_RUN_TIME_PRESSURE), @JsonSubTypes.Type(value = SensorDelay.class, name = Command.ETC_SENSOR_DELAY), @JsonSubTypes.Type(value = PlungerTimer.class, name = Command.ETC_PLUNGER_TIMER), - @JsonSubTypes.Type(value = com.isu.gaswellwatch.vo.command.etc.TimingMode.class, name = Command.ETC_TIMING_MODE), + @JsonSubTypes.Type(value = TimeFormat.class, name = Command.ETC_TIME_FORMAT), @JsonSubTypes.Type(value = TubPressureOptimization.class, name = Command.ETC_TUB_PRESSURE_OPTIMIZATION), @JsonSubTypes.Type(value = CasPressureOptimization.class, name = Command.ETC_CAS_PRESSURE_OPTIMIZATION), + @JsonSubTypes.Type(value = com.isu.gaswellwatch.vo.command.etc.TimingMode.class, name = Command.ETC_TIMING_MODE), @JsonSubTypes.Type(value = SystemInfo.class, name = Command.SCSS_SYSTEM_INFO), @JsonSubTypes.Type(value = ControlMode.class, name = Command.SCSS_CONTROL_MODE), @JsonSubTypes.Type(value = SimpleLogicMode.class, name = Command.SCSS_SIMPLE_LOGIC_MODE), @@ -99,6 +98,8 @@ public abstract class Command implements Serializable { /* 点表类型:SCSS end */ /* 点表类型:ETC start */ + /* 设置ETC设备时间格式 */ + public static final String ETC_TIME_FORMAT = "ETC.TIME_FORMAT"; /* 开关井 */ public static final String ETC_TURN_ON_THE_WELL = "ETC.TURN_ON_THE_WELL"; public static final String ETC_TURN_OFF_THE_WELL = "ETC.TURN_OFF_THE_WELL"; diff --git a/src/main/java/com/isu/gaswellwatch/vo/command/etc/TimeFormat.java b/src/main/java/com/isu/gaswellwatch/vo/command/etc/TimeFormat.java new file mode 100644 index 0000000..7fd5dab --- /dev/null +++ b/src/main/java/com/isu/gaswellwatch/vo/command/etc/TimeFormat.java @@ -0,0 +1,30 @@ +package com.isu.gaswellwatch.vo.command.etc; + +import com.isu.gaswellwatch.dto.modbus.ModbusCommandDto; +import com.isu.gaswellwatch.vo.command.Command; + +import java.io.Serial; +import java.util.Collection; +import java.util.List; + +/** + * @author 王仕龙 + * 2024/12/15 12:18 + */ +public class TimeFormat extends Command { + + @Serial + private static final long serialVersionUID = -6432532154699093296L; + + public TimeFormat() { + this.setCode("ETC.TIME_FORMAT"); + } + + @Override + protected Collection builderModbusCommand() { + // 0:0007 Current Time Format 0-Seconds; 1-H:M:S + // 01 05 00 06 FF 00 6C 3B + return List.of(ModbusCommandDto.builder().command("01050006FF00").length(16).build()); + } + +}