修改代码

This commit is contained in:
zenghongyao 2025-04-24 19:40:51 +08:00
parent 0ce146e7be
commit 264eec540a
2 changed files with 3 additions and 35 deletions

View File

@ -25,12 +25,12 @@ namespace JiShe.CollectBus.Protocol.AnalysisData.AFN_00H
_logger = logger;
}
public Task<AFN0_F1_AnalysisDto> ExecuteAsync(TB3761 tB3761)
public Task<UnitDataAnalysis<bool>> ExecuteAsync(TB3761 tB3761)
{
try
{
ArgumentNullException.ThrowIfNull(nameof(tB3761));
AFN0_F1_AnalysisDto dto = new AFN0_F1_AnalysisDto
UnitDataAnalysis<bool> dto = new UnitDataAnalysis<bool>
{
Code = tB3761.A?.Code,
AFN = tB3761.AFN_FC?.AFN ?? 0,
@ -47,36 +47,4 @@ namespace JiShe.CollectBus.Protocol.AnalysisData.AFN_00H
}
}
public class AFN0_F2_Analysis : IAnalysisStrategy<TB3761, AFN0_F1_AnalysisDto>
{
private readonly ILogger<AFN0_F1_Analysis> _logger;
public AFN0_F2_Analysis(ILogger<AFN0_F1_Analysis> logger)
{
_logger = logger;
}
public Task<UnitDataAnalysis<bool>> ExecuteAsync(TB3761 input)
{
try
{
ArgumentNullException.ThrowIfNull(input);
UnitDataAnalysis<bool> dto = new UnitDataAnalysis<bool>
{
Code = input.A.Code,
AFN = input.AFN_FC.AFN,
Fn = input.DT.Fn,
Pn = input.DA.Pn ,
Data = true,
};
return Task.FromResult(dto);
}
catch (Exception ex)
{
_logger.LogError(ex, $"00_1解析失败:{input.A?.Code}-{input.DT?.Fn ?? 0}-{input?.BaseHexMessage?.HexMessageString},{ex.Message}");
return null;
}
}
}
}

View File

@ -39,7 +39,7 @@ namespace JiShe.CollectBus.Protocol.AnalysisData.AFN_00H
}
catch (Exception ex)
{
_logger.LogError(ex, $"00_2解析失败:{input.A?.Code}-{input.DT?.Fn ?? 0}-{input?.BaseHexMessage?.HexMessageString},{ex.Message}");
_logger.LogError(ex, $"00_2解析失败:{input.A.Code}-{input.DT.Fn}-{input.BaseHexMessage.HexMessageString},{ex.Message}");
return null;
}
}