feat(qfod): 添加FieldF字段支持第6个数字解析

This commit is contained in:
ssss
2026-07-06 13:36:52 +08:00
parent 52435ab8cd
commit eaac759a3f
4 changed files with 20 additions and 5 deletions

View File

@@ -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)

View File

@@ -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;

View File

@@ -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);