Table of Contents

Interface IFormulaProvider

Namespace
CMS.Plugin.FormulaManagement.Abstractions
Assembly
CMS.Plugin.FormulaManagement.Abstractions.dll

配方的通用接口.

public interface IFormulaProvider

Methods

ApplyFormulaAsync(Guid, List<Guid>?, CancellationToken, bool)

应用配方

Task ApplyFormulaAsync(Guid productId, List<Guid>? segmentIds = null, CancellationToken cancellationToken = default, bool notCheck = false)

Parameters

productId Guid

产品Id

segmentIds List<Guid>

工序段Id

cancellationToken CancellationToken

cancellationToken

notCheck bool

下发是否进行校验

Returns

Task

ApplyFormulaAsync(Guid, Guid, bool, CancellationToken)

应用配方,应用成功后,会初始化追溯服务缓存数据

Task ApplyFormulaAsync(Guid productId, Guid workSectionId, bool notCheck = false, CancellationToken cancellationToken = default)

Parameters

productId Guid

产品Id

workSectionId Guid

工序Id

notCheck bool

下发是否进行校验

cancellationToken CancellationToken

cancellationToken

Returns

Task

ApplyFormulaAsync(Guid, CancellationToken)

应用配方

Task ApplyFormulaAsync(Guid productId, CancellationToken cancellationToken = default)

Parameters

productId Guid

产品Id

cancellationToken CancellationToken

Returns

Task

ClearCacheAsync()

清空缓存.

Task ClearCacheAsync()

Returns

Task

CreateAsync(FormulaModel)

创建配方.

Task<FormulaModel> CreateAsync(FormulaModel formula)

Parameters

formula FormulaModel

Returns

Task<FormulaModel>

CreateFormulaVersionAsync(FormulaVersionModel, bool)

创建配方版本.

Task<FormulaVersionModel> CreateFormulaVersionAsync(FormulaVersionModel formulaVersion, bool validate = true)

Parameters

formulaVersion FormulaVersionModel
validate bool

是否做编辑的校验(默认应用中的配方不允许修改)

Returns

Task<FormulaVersionModel>

GetByAsync(Guid, CancellationToken)

获取配方信息(从缓存获取).

Task<FormulaModel?> GetByAsync(Guid formulaId, CancellationToken cancellationToken = default)

Parameters

formulaId Guid

配方Id.

cancellationToken CancellationToken

CancellationToken

Returns

Task<FormulaModel>

.

GetFormulaApplysAsync(GeFormulaApplysRequest, CancellationToken)

获取配方应用信息(从缓存获取).

Task<List<FormulaApplyModel>> GetFormulaApplysAsync(GeFormulaApplysRequest request, CancellationToken cancellationToken = default)

Parameters

request GeFormulaApplysRequest

请求参数.

cancellationToken CancellationToken

CancellationToken

Returns

Task<List<FormulaApplyModel>>

.

GetFormulaAsync(Guid, CancellationToken)

获取配方信息(从缓存获取).

Task<FormulaModel?> GetFormulaAsync(Guid productId, CancellationToken cancellationToken = default)

Parameters

productId Guid

产品Id.

cancellationToken CancellationToken

CancellationToken

Returns

Task<FormulaModel>

.

GetFormulaByCode(string, CancellationToken)

获取配方(从缓存获取).

Task<FormulaModel?> GetFormulaByCode(string formulaCode, CancellationToken cancellationToken = default)

Parameters

formulaCode string

配方编号

cancellationToken CancellationToken

Returns

Task<FormulaModel>

GetFormulaByNameAsync(string, CancellationToken)

获取配方(从缓存获取).

Task<FormulaModel?> GetFormulaByNameAsync(string formulaName, CancellationToken cancellationToken = default)

Parameters

formulaName string

配方名称

cancellationToken CancellationToken

Returns

Task<FormulaModel>

GetFormulaCurrentVersionAsync(Guid, bool, CancellationToken)

获取当前配方版本(从缓存获取).

Task<FormulaVersionModel?> GetFormulaCurrentVersionAsync(Guid formulaId, bool includeDetails = false, CancellationToken cancellationToken = default)

Parameters

formulaId Guid

配方Id

includeDetails bool

是否包含关联的配方参数与过程参数.

cancellationToken CancellationToken

CancellationToken

Returns

Task<FormulaVersionModel>

GetFormulaCurrentVersionByProductIdAsync(Guid, bool, CancellationToken)

获取当前配方版本(从缓存获取).

Task<FormulaVersionModel?> GetFormulaCurrentVersionByProductIdAsync(Guid productId, bool includeDetails = false, CancellationToken cancellationToken = default)

Parameters

productId Guid

产品Id

includeDetails bool

是否包含关联的配方参数与过程参数.

cancellationToken CancellationToken

CancellationToken

Returns

Task<FormulaVersionModel>

GetFormulaVersionAsync(Guid, Guid, bool, CancellationToken)

获取配方版本(从缓存获取).

Task<FormulaVersionModel?> GetFormulaVersionAsync(Guid productId, Guid formulaVersionId, bool includeDetails = false, CancellationToken cancellationToken = default)

Parameters

productId Guid

产品Id

formulaVersionId Guid

配方版本Id

includeDetails bool

是否包含关联的配方参数与过程参数.

cancellationToken CancellationToken

CancellationToken

Returns

Task<FormulaVersionModel>

GetFormulaVersionAsync(Guid, string, bool, CancellationToken)

获取配方版本(从缓存获取).

Task<FormulaVersionModel?> GetFormulaVersionAsync(Guid productId, string formulaVersionName, bool includeDetails = false, CancellationToken cancellationToken = default)

Parameters

productId Guid

产品Id

formulaVersionName string

配方版本名称

includeDetails bool

是否包含关联的配方参数与过程参数.

cancellationToken CancellationToken

CancellationToken

Returns

Task<FormulaVersionModel>

GetFormulasAsync(GetFormulasRequest, bool, CancellationToken)

获取配方信息(从缓存获取).

Task<List<FormulaModel>> GetFormulasAsync(GetFormulasRequest request, bool includeDetails = false, CancellationToken cancellationToken = default)

Parameters

request GetFormulasRequest

请求参数.

includeDetails bool

是否包含关联的产品,关联的工序.

cancellationToken CancellationToken

CancellationToken

Returns

Task<List<FormulaModel>>

.

GetProcessRouteAsync(Guid, string, CancellationToken)

获取工艺路线[包括对应的配方的上下限](从缓存获取)(近似获取,根据产品Id,版本名获取;失败则根据产品Id,获取当前配方版本).

Task<List<WorkSectionWeakModel>> GetProcessRouteAsync(Guid productId, string formulaVersionName, CancellationToken cancellationToken = default)

Parameters

productId Guid

产品Id.

formulaVersionName string

配方版本名称.

cancellationToken CancellationToken

CancellationToken

Returns

Task<List<WorkSectionWeakModel>>

.

GetProcessRouteAsync(Guid?, bool, CancellationToken)

获取工艺路线(从缓存获取).

Task<List<WorkSectionWeakModel>> GetProcessRouteAsync(Guid? productId, bool includeFormulaDetails, CancellationToken cancellationToken = default)

Parameters

productId Guid?

产品Id.

includeFormulaDetails bool

是否获取配方相关的信息(信息来源与当前工位应用的配方).

cancellationToken CancellationToken

CancellationToken

Returns

Task<List<WorkSectionWeakModel>>

.

GetProcessRouteAsync(Guid?, CancellationToken)

获取工艺路线(从缓存获取).

Task<List<WorkSectionWeakModel>> GetProcessRouteAsync(Guid? productId, CancellationToken cancellationToken = default)

Parameters

productId Guid?

产品Id.

cancellationToken CancellationToken

CancellationToken

Returns

Task<List<WorkSectionWeakModel>>

IsUsing(IEnumerable<Guid>)

获取配方是否在使用.

Task<(bool IsUsed, string UsedObject, string Error)> IsUsing(IEnumerable<Guid> formulaIds)

Parameters

formulaIds IEnumerable<Guid>

Returns

Task<(bool IsUsed, string UsedObject, string Error)>

SwitchFormulaVersion(Guid, string)

切换配方当前版本.(只切换,不下发配方).(使用中的配方也可以切换,不校验).

Task<bool> SwitchFormulaVersion(Guid productId, string formulaVersionName)

Parameters

productId Guid
formulaVersionName string

Returns

Task<bool>

UpdateAsync(FormulaModel)

更新配方.

Task<FormulaModel> UpdateAsync(FormulaModel formula)

Parameters

formula FormulaModel

Returns

Task<FormulaModel>

UpdateFormula2WorkSectionAsync(Formula2WorkSectionModel)

更新工艺路线.

Task UpdateFormula2WorkSectionAsync(Formula2WorkSectionModel model)

Parameters

model Formula2WorkSectionModel

Returns

Task

UpdateFormulaVersionAsync(FormulaVersionModel, bool)

更新配方版本.

Task<FormulaVersionModel> UpdateFormulaVersionAsync(FormulaVersionModel formulaVersion, bool validate = true)

Parameters

formulaVersion FormulaVersionModel
validate bool

是否做编辑的校验(默认应用中的配方不允许修改)

Returns

Task<FormulaVersionModel>