Table of Contents

Class AnalysisProcessor<TRule>

Namespace
CMS.Plugin.BarcodeManagement.Abstractions.Processors
Assembly
CMS.Plugin.BarcodeManagement.Abstractions.dll

抽象类,用于定义条码分析处理器的基本行为。

public abstract class AnalysisProcessor<TRule> : Processor<(bool IsSucceeded, string? ErrorMsg, List<(string Name, string Content, int Digit)> Segments)>

Type Parameters

TRule

条码分析规则的类型。

Inheritance
AnalysisProcessor<TRule>
Inherited Members

Constructors

AnalysisProcessor(TRule, string?, bool, IEnumerable<BarcodeAnalysisDetailModel>?)

构造函数,初始化条码分析处理器。

protected AnalysisProcessor(TRule rule, string? barcode, bool refer, IEnumerable<BarcodeAnalysisDetailModel>? references)

Parameters

rule TRule

条码分析规则。

barcode string

要分析的条码。

refer bool

是否启用参考数据。

references IEnumerable<BarcodeAnalysisDetailModel>

参考数据集合。

Methods

AbortAsync((bool IsSucceeded, string? ErrorMsg, List<(string Name, string Content, int Digit)> Segments))

判断是否需要中止处理。

protected override Task<bool> AbortAsync((bool IsSucceeded, string? ErrorMsg, List<(string Name, string Content, int Digit)> Segments) result)

Parameters

result (bool IsSucceeded, string ErrorMsg, List<(string Name, string Content, int Digit)> Segments)

当前处理结果。

Returns

Task<bool>

如果处理失败,返回 true;否则返回 false

ExecuteProcessAsync()

执行当前处理器的核心逻辑。

protected override Task<(bool IsSucceeded, string? ErrorMsg, List<(string Name, string Content, int Digit)> Segments)> ExecuteProcessAsync()

Returns

Task<(bool IsSucceeded, string ErrorMsg, List<(string Name, string Content, int Digit)>)>

返回一个元组,包含以下信息:

  • IsSucceeded: 是否成功。
  • ErrorMsg: 错误信息(如果有)。
  • Segments: 分析结果的段集合。

ProcessAsync(TRule, string?, bool, IEnumerable<BarcodeAnalysisDetailModel>?)

抽象方法,用于实现具体的条码分析逻辑。

protected abstract Task<(bool IsSucceeded, string? ErrorMsg, List<(string Name, string Content, int Digit)> Segments)> ProcessAsync(TRule rule, string? barcode, bool refer, IEnumerable<BarcodeAnalysisDetailModel>? references)

Parameters

rule TRule

条码分析规则。

barcode string

要分析的条码。

refer bool

是否启用参考数据。

references IEnumerable<BarcodeAnalysisDetailModel>

参考数据集合。

Returns

Task<(bool IsSucceeded, string ErrorMsg, List<(string Name, string Content, int Digit)>)>

返回一个元组,包含以下信息:

  • IsSucceeded: 是否成功。
  • ErrorMsg: 错误信息(如果有)。
  • Segments: 分析结果的段集合。