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
CancellationTokencancellationToken
notCheck
bool下发是否进行校验
Returns
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
CancellationTokencancellationToken
Returns
ApplyFormulaAsync(Guid, CancellationToken)
应用配方
Task ApplyFormulaAsync(Guid productId, CancellationToken cancellationToken = default)
Parameters
productId
Guid产品Id
cancellationToken
CancellationToken
Returns
ClearCacheAsync()
清空缓存.
Task ClearCacheAsync()
Returns
CreateAsync(FormulaModel)
创建配方.
Task<FormulaModel> CreateAsync(FormulaModel formula)
Parameters
formula
FormulaModel
Returns
CreateFormulaVersionAsync(FormulaVersionModel, bool)
创建配方版本.
Task<FormulaVersionModel> CreateFormulaVersionAsync(FormulaVersionModel formulaVersion, bool validate = true)
Parameters
formulaVersion
FormulaVersionModelvalidate
bool是否做编辑的校验(默认应用中的配方不允许修改)
Returns
GetByAsync(Guid, CancellationToken)
获取配方信息(从缓存获取).
Task<FormulaModel?> GetByAsync(Guid formulaId, CancellationToken cancellationToken = default)
Parameters
formulaId
Guid配方Id.
cancellationToken
CancellationTokenCancellationToken
Returns
- Task<FormulaModel>
.
GetFormulaApplysAsync(GeFormulaApplysRequest, CancellationToken)
获取配方应用信息(从缓存获取).
Task<List<FormulaApplyModel>> GetFormulaApplysAsync(GeFormulaApplysRequest request, CancellationToken cancellationToken = default)
Parameters
request
GeFormulaApplysRequest请求参数.
cancellationToken
CancellationTokenCancellationToken
Returns
GetFormulaAsync(Guid, CancellationToken)
获取配方信息(从缓存获取).
Task<FormulaModel?> GetFormulaAsync(Guid productId, CancellationToken cancellationToken = default)
Parameters
productId
Guid产品Id.
cancellationToken
CancellationTokenCancellationToken
Returns
- Task<FormulaModel>
.
GetFormulaByCode(string, CancellationToken)
获取配方(从缓存获取).
Task<FormulaModel?> GetFormulaByCode(string formulaCode, CancellationToken cancellationToken = default)
Parameters
formulaCode
string配方编号
cancellationToken
CancellationToken
Returns
GetFormulaByNameAsync(string, CancellationToken)
获取配方(从缓存获取).
Task<FormulaModel?> GetFormulaByNameAsync(string formulaName, CancellationToken cancellationToken = default)
Parameters
formulaName
string配方名称
cancellationToken
CancellationToken
Returns
GetFormulaCurrentVersionAsync(Guid, bool, CancellationToken)
获取当前配方版本(从缓存获取).
Task<FormulaVersionModel?> GetFormulaCurrentVersionAsync(Guid formulaId, bool includeDetails = false, CancellationToken cancellationToken = default)
Parameters
formulaId
Guid配方Id
includeDetails
bool是否包含关联的配方参数与过程参数.
cancellationToken
CancellationTokenCancellationToken
Returns
GetFormulaCurrentVersionByProductIdAsync(Guid, bool, CancellationToken)
获取当前配方版本(从缓存获取).
Task<FormulaVersionModel?> GetFormulaCurrentVersionByProductIdAsync(Guid productId, bool includeDetails = false, CancellationToken cancellationToken = default)
Parameters
productId
Guid产品Id
includeDetails
bool是否包含关联的配方参数与过程参数.
cancellationToken
CancellationTokenCancellationToken
Returns
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
CancellationTokenCancellationToken
Returns
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
CancellationTokenCancellationToken
Returns
GetFormulasAsync(GetFormulasRequest, bool, CancellationToken)
获取配方信息(从缓存获取).
Task<List<FormulaModel>> GetFormulasAsync(GetFormulasRequest request, bool includeDetails = false, CancellationToken cancellationToken = default)
Parameters
request
GetFormulasRequest请求参数.
includeDetails
bool是否包含关联的产品,关联的工序.
cancellationToken
CancellationTokenCancellationToken
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
CancellationTokenCancellationToken
Returns
GetProcessRouteAsync(Guid?, bool, CancellationToken)
获取工艺路线(从缓存获取).
Task<List<WorkSectionWeakModel>> GetProcessRouteAsync(Guid? productId, bool includeFormulaDetails, CancellationToken cancellationToken = default)
Parameters
productId
Guid?产品Id.
includeFormulaDetails
bool是否获取配方相关的信息(信息来源与当前工位应用的配方).
cancellationToken
CancellationTokenCancellationToken
Returns
GetProcessRouteAsync(Guid?, CancellationToken)
获取工艺路线(从缓存获取).
Task<List<WorkSectionWeakModel>> GetProcessRouteAsync(Guid? productId, CancellationToken cancellationToken = default)
Parameters
productId
Guid?产品Id.
cancellationToken
CancellationTokenCancellationToken
Returns
IsUsing(IEnumerable<Guid>)
获取配方是否在使用.
Task<(bool IsUsed, string UsedObject, string Error)> IsUsing(IEnumerable<Guid> formulaIds)
Parameters
formulaIds
IEnumerable<Guid>
Returns
SwitchFormulaVersion(Guid, string)
切换配方当前版本.(只切换,不下发配方).(使用中的配方也可以切换,不校验).
Task<bool> SwitchFormulaVersion(Guid productId, string formulaVersionName)
Parameters
Returns
UpdateAsync(FormulaModel)
更新配方.
Task<FormulaModel> UpdateAsync(FormulaModel formula)
Parameters
formula
FormulaModel
Returns
UpdateFormula2WorkSectionAsync(Formula2WorkSectionModel)
更新工艺路线.
Task UpdateFormula2WorkSectionAsync(Formula2WorkSectionModel model)
Parameters
model
Formula2WorkSectionModel
Returns
UpdateFormulaVersionAsync(FormulaVersionModel, bool)
更新配方版本.
Task<FormulaVersionModel> UpdateFormulaVersionAsync(FormulaVersionModel formulaVersion, bool validate = true)
Parameters
formulaVersion
FormulaVersionModelvalidate
bool是否做编辑的校验(默认应用中的配方不允许修改)