feat(qfod): 添加FieldF字段支持第6个数字解析
This commit is contained in:
@@ -8,7 +8,7 @@
|
||||
|
||||
**表名**:`qfod_record`
|
||||
|
||||
**描述**:存储 Qfod 格式解析数据,对应日志格式 `X#:Q A->B C D E`
|
||||
**描述**:存储 Qfod 格式解析数据,对应日志格式 `X#:Q A->B C D E F`
|
||||
|
||||
---
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
| current_q | FLOAT | NOT NULL | 当前实时 Q值 |
|
||||
| raw_q | FLOAT | NOT NULL | 原始 Q值 |
|
||||
| fod_type | TINYINT | NOT NULL | 异物类型编码 |
|
||||
| field_f | TINYINT | NOT NULL, DEFAULT 0 | 第6个数字(预留字段,当前取值0,业务含义待确认) |
|
||||
| is_deleted | BOOLEAN | NOT NULL, DEFAULT FALSE | 软删除标记 |
|
||||
| created_at | TIMESTAMP | NOT NULL, DEFAULT NOW() | 创建时间 |
|
||||
|
||||
@@ -77,6 +78,7 @@ public class QfodRecord
|
||||
public float CurrentQ { get; set; }
|
||||
public float RawQ { get; set; }
|
||||
public byte FodType { get; set; }
|
||||
public byte FieldF { get; set; }
|
||||
public bool IsDeleted { get; set; } = false;
|
||||
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
|
||||
|
||||
@@ -132,6 +134,11 @@ public class QfodRecordConfiguration : IEntityTypeConfiguration<QfodRecord>
|
||||
.IsRequired()
|
||||
.HasColumnName("fod_type");
|
||||
|
||||
builder.Property(e => e.FieldF)
|
||||
.IsRequired()
|
||||
.HasDefaultValue((byte)0)
|
||||
.HasColumnName("field_f");
|
||||
|
||||
builder.Property(e => e.IsDeleted)
|
||||
.IsRequired()
|
||||
.HasDefaultValue(false)
|
||||
|
||||
@@ -45,6 +45,11 @@ public class QfodRecordConfiguration : IEntityTypeConfiguration<QfodRecord>
|
||||
.IsRequired()
|
||||
.HasColumnName("fod_type");
|
||||
|
||||
builder.Property(e => e.FieldF)
|
||||
.IsRequired()
|
||||
.HasDefaultValue((byte)0)
|
||||
.HasColumnName("field_f");
|
||||
|
||||
builder.Property(e => e.IsDeleted)
|
||||
.IsRequired()
|
||||
.HasDefaultValue(false)
|
||||
|
||||
@@ -13,6 +13,7 @@ public class QfodRecord
|
||||
public float CurrentQ { get; set; }
|
||||
public float RawQ { get; set; }
|
||||
public byte FodType { get; set; }
|
||||
public byte FieldF { get; set; }
|
||||
public bool IsDeleted { get; set; } = false;
|
||||
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
|
||||
|
||||
|
||||
@@ -5,13 +5,14 @@ namespace WCTDataMiner.Core.Parsers;
|
||||
|
||||
/// <summary>
|
||||
/// Qfod日志解析器
|
||||
/// 格式: X#:Q A->B C D E
|
||||
/// 示例: 0#:Q 1->25 45.5 20.5 2
|
||||
/// 格式: X#:Q A->B C D E F
|
||||
/// 字段映射: X=ChargerIndex, A=CoilIndex, B=DeltaQ, C=CurrentQ, D=RawQ, E=FodType, F=FieldF
|
||||
/// 示例: 0#:Q 1->25 45.5 20.5 2 0
|
||||
/// </summary>
|
||||
public class QfodParser : IParser<QfodRecord>
|
||||
{
|
||||
private static readonly Regex QfodPattern = new(
|
||||
@"^(\d)#:Q\s+(\d+)->(-?\d+)\s+([-\d.]+)\s+([-\d.]+)\s+(\d+)$",
|
||||
@"^(\d)#:Q\s+(\d+)->(-?\d+)\s+([-\d.]+)\s+([-\d.]+)\s+(\d+)\s+(\d+)$",
|
||||
RegexOptions.Compiled
|
||||
);
|
||||
|
||||
@@ -38,7 +39,8 @@ public class QfodParser : IParser<QfodRecord>
|
||||
DeltaQ = int.Parse(match.Groups[3].Value),
|
||||
CurrentQ = float.Parse(match.Groups[4].Value),
|
||||
RawQ = float.Parse(match.Groups[5].Value),
|
||||
FodType = byte.Parse(match.Groups[6].Value)
|
||||
FodType = byte.Parse(match.Groups[6].Value),
|
||||
FieldF = byte.Parse(match.Groups[7].Value)
|
||||
};
|
||||
|
||||
return ParseResult<QfodRecord>.Success(record);
|
||||
|
||||
Reference in New Issue
Block a user