优化匹配
This commit is contained in:
parent
35febf6a99
commit
b374692c02
@ -0,0 +1,69 @@
|
|||||||
|
using GatherService.WattMeter.AnalysisData.AFN_10H;
|
||||||
|
using JiShe.CollectBus.Common.Extensions;
|
||||||
|
using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto;
|
||||||
|
using JiShe.CollectBus.Protocol.Dto;
|
||||||
|
using JiShe.CollectBus.Protocol.Interfaces;
|
||||||
|
using JiShe.CollectBus.Protocol3761;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using TouchSocket.Core;
|
||||||
|
|
||||||
|
namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_10H
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 5.16 数据转发(AFN=10H)
|
||||||
|
/// </summary>
|
||||||
|
public class AFN16_F1_Analysis : IAnalysisStrategy<TB3761, UnitDataAnalysis<string>>
|
||||||
|
{
|
||||||
|
private readonly ILogger<AFN16_F1_Analysis> _logger;
|
||||||
|
|
||||||
|
public AFN16_F1_Analysis(ILogger<AFN16_F1_Analysis> logger)
|
||||||
|
{
|
||||||
|
_logger = logger;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Task<UnitDataAnalysis<string>> ExecuteAsync(TB3761 input)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
ArgumentNullException.ThrowIfNull(input);
|
||||||
|
ArgumentNullException.ThrowIfNull(input.UnitData.HexMessageList);
|
||||||
|
UnitDataAnalysis<string> dto = new UnitDataAnalysis<string>
|
||||||
|
{
|
||||||
|
Code = input.A.Code!,
|
||||||
|
AFN = input.AFN_FC.AFN,
|
||||||
|
Fn = input.DT.Fn,
|
||||||
|
Pn = input.DA.Pn,
|
||||||
|
Data = AnalysisDataUnit(input.UnitData.HexMessageList)
|
||||||
|
};
|
||||||
|
return Task.FromResult(dto);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_logger.LogError(ex, $"10_101解析失败:{input.A?.Code}-{input.DT?.Fn ?? 0}-{input?.BaseHexMessage?.HexMessageString},{ex.Message}");
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private string AnalysisDataUnit(List<string> hexMessageList)
|
||||||
|
{
|
||||||
|
// TODO: 待定,等确认如何匹配规则
|
||||||
|
string value = string.Join(" ", hexMessageList);
|
||||||
|
if (value.Contains(F10TranspondMatch.ReadNormal))
|
||||||
|
{
|
||||||
|
if (value.Contains(F10TranspondMatch.PowerHz))//电网频率
|
||||||
|
return "AFN16_F97_Analysis";
|
||||||
|
//else if (value.Contains(F10TranspondMatch.ReadData))//读取电表地址
|
||||||
|
// result = "AFN16_F105_Analysis";
|
||||||
|
|
||||||
|
}
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,66 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData
|
||||||
|
{
|
||||||
|
public class F10TranspondMatch
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 188协议良禾水表透传解析
|
||||||
|
/// </summary>
|
||||||
|
public const string WaterLiangHe188 = "1F 90 00";
|
||||||
|
/// <summary>
|
||||||
|
/// 188协议良禾水表透传解析
|
||||||
|
/// </summary>
|
||||||
|
public const string WaterLiangHe188_1 = "90 1F 00";
|
||||||
|
/// <summary>
|
||||||
|
/// 电网频率
|
||||||
|
/// </summary>
|
||||||
|
public const string PowerHz = "35 33 B3 35";
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 读取数据
|
||||||
|
/// </summary>
|
||||||
|
public const string ReadData = "34 37 33 37";
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 跳合闸 正常应答帧
|
||||||
|
/// </summary>
|
||||||
|
public const string JumpClosingNormal = "68 9C";
|
||||||
|
/// <summary>
|
||||||
|
/// 跳合闸 异常应答帧
|
||||||
|
/// </summary>
|
||||||
|
public const string JumpClosingError = "68 DC";
|
||||||
|
/// <summary>
|
||||||
|
/// 写数据正常应答帧
|
||||||
|
/// </summary>
|
||||||
|
public const string WriteNormal = "68 94 00";
|
||||||
|
/// <summary>
|
||||||
|
/// 写数据异常应答帧
|
||||||
|
/// </summary>
|
||||||
|
public const string WriteError = "68 D4 01";
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 读数据异常应答帧
|
||||||
|
/// </summary>
|
||||||
|
public const string ReadError = "68 D1";
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 读数据正常应答帧
|
||||||
|
/// </summary>
|
||||||
|
public const string ReadNormal = "68 91";
|
||||||
|
/// <summary>
|
||||||
|
/// 捷先电动阀门(DN50)
|
||||||
|
/// </summary>
|
||||||
|
public const string CJT_188_2018 = "84 05 A0 17 00";
|
||||||
|
|
||||||
|
public const string DLT_645_1997 = "68 84 00";
|
||||||
|
/// <summary>
|
||||||
|
/// ES190_DC 4G水表
|
||||||
|
/// </summary>
|
||||||
|
public const string ES190_DC = "FF D5";
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user