using SKMC.Api.Recipe.Config;
using SKMC.Api.Recipe.Model;
using System.Collections.Generic;
using System.Collections.ObjectModel;
namespace SKMC.Api.Recipe
{
///
/// 配方数据缓存器
///
public abstract class RecipeCacher
{
///
/// 当前使用的配方
///
public RecipeProfile RecipeProfile { get; set; }
///
/// 获取流程参数配置集
///
/// 是否高级类型
/// 是否开关类型
///
public ObservableCollection GetRecipeParams(short isAdv, short isMod)
{
if (isAdv == 0 && isMod == 0)
{
return GetRecipeBaseValueParams();
}
if (isAdv == 0 && isMod == 1)
{
return GetRecipeBaseModParams();
}
if (isAdv == 1 && isMod == 0)
{
return GetRecipeAdvValueParams();
}
if (isAdv == 1 && isMod == 1)
{
return GetRecipeAdvModParams();
}
return null;
}
///
/// 流程参数配置集(基础开关型)
///
public ObservableCollection GetRecipeBaseModParams() => RecipeProfile.RecipeBaseModParams;
///
/// 流程参数配置集(基础数值型)
///
public ObservableCollection GetRecipeBaseValueParams() => RecipeProfile.RecipeBaseValueParams;
///
/// 流程参数配置集(内部开关型)
///
public ObservableCollection GetRecipeAdvModParams() => RecipeProfile.RecipeAdvModParams;
///
/// 流程参数配置集(内部数值型)
///
public ObservableCollection GetRecipeAdvValueParams() => RecipeProfile.RecipeAdvValueParams;
///
/// 速度配置集
///
public ObservableCollection GetRecipeSpeeds() => RecipeProfile.RecipeSpeeds;
///
/// 点位配置集
///
public ObservableCollection GetRecipePointGroups() => RecipeProfile.RecipePointGroups;
///
/// 获取流程参数对象
///
///
///
public abstract RecipeParam GetRecipeParam(string paramCode);
///
/// 获取流程参数配置(根据数据库配置加载)
///
///
///
public abstract T GetRecipeParamValue(string paramCode);
///
/// 获取流程点位
///
///
///
public abstract RecipePoint GetRecipePoint(string code);
///
/// 获取流程点位的轴位置数值
///
/// 点位码
/// 点位中多个轴位置的序号, 默认为第一个
///
public abstract double GetRecipePointVal(string code, int index = 0);
///
/// 获取流程点位的轴位置数值
///
/// 点位对象
/// 点位中多个轴位置的序号, 默认为第一个
///
public abstract double GetRecipePointVal(RecipePoint recipePoint, int index = 0);
///
/// 获取速度配置对象
///
/// 速度码
///
public abstract RecipeSpeed GetRecipeSpeed(string speedCode);
}
}