|
|
@@ -1,7 +1,10 @@
|
|
|
using SKMC.Api.Recipe.Config;
|
|
|
using SKMC.Api.Recipe.Model;
|
|
|
+using System;
|
|
|
using System.Collections.Generic;
|
|
|
using System.Collections.ObjectModel;
|
|
|
+using System.Diagnostics;
|
|
|
+using System.Linq;
|
|
|
|
|
|
namespace SKMC.Api.Recipe
|
|
|
{
|
|
|
@@ -10,7 +13,6 @@ namespace SKMC.Api.Recipe
|
|
|
/// </summary>
|
|
|
public abstract class RecipeCacher
|
|
|
{
|
|
|
-
|
|
|
/// <summary>
|
|
|
/// 当前使用的配方
|
|
|
/// </summary>
|
|
|
@@ -66,13 +68,36 @@ namespace SKMC.Api.Recipe
|
|
|
/// <summary>
|
|
|
/// 速度配置集
|
|
|
/// </summary>
|
|
|
- public ObservableCollection<RecipeSpeed> GetRecipeSpeeds() => RecipeProfile.RecipeSpeeds;
|
|
|
+ // public ObservableCollection<RecipeSpeed> GetRecipeSpeeds() => RecipeProfile.RecipeSpeeds;
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 速度配置集
|
|
|
+ /// 考虑到速度切换需要先进入“速度设置”页面才能获取到速度挡位。暂时先默认选择第一个速度组。
|
|
|
+ /// </summary>
|
|
|
+ public ObservableCollection<RecipeSpeed> GetRecipeSpeeds()
|
|
|
+ {
|
|
|
+ ObservableCollection<RecipeSpeed> recipeSpeeds = new ObservableCollection<RecipeSpeed>();
|
|
|
+ var usedGroup = GetRecipeSpeedGroups().FirstOrDefault(t => t.CurrentUsed == 1);
|
|
|
+ if (usedGroup == null) throw new ArgumentException($"Cannot Get Speed Group[{usedGroup.Name}]");
|
|
|
+ recipeSpeeds = GetRecipeSpeeds(usedGroup);
|
|
|
+ return recipeSpeeds;
|
|
|
+ }
|
|
|
|
|
|
/// <summary>
|
|
|
/// 点位配置集
|
|
|
/// </summary>
|
|
|
public ObservableCollection<RecipePointGroup> GetRecipePointGroups() => RecipeProfile.RecipePointGroups;
|
|
|
|
|
|
+ /// <summary>
|
|
|
+ /// 速度分组配置集
|
|
|
+ /// </summary>
|
|
|
+ public ObservableCollection<RecipeSpeedGroup> GetRecipeSpeedGroups() => RecipeProfile.RecipeSpeedGroups;
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 点位配置集
|
|
|
+ /// </summary>
|
|
|
+ public ObservableCollection<RecipePoint> GetRecipePoints() => RecipeProfile.RecipePoints;
|
|
|
+
|
|
|
/// <summary>
|
|
|
/// 获取流程参数对象
|
|
|
/// </summary>
|
|
|
@@ -116,5 +141,20 @@ namespace SKMC.Api.Recipe
|
|
|
/// <param name="speedCode">速度码</param>
|
|
|
/// <returns></returns>
|
|
|
public abstract RecipeSpeed GetRecipeSpeed(string speedCode);
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 获取速度分组下的速度集合
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="group"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ public ObservableCollection<RecipeSpeed> GetRecipeSpeeds(RecipeSpeedGroup group)
|
|
|
+ {
|
|
|
+ ObservableCollection<RecipeSpeed> speedModels = new ObservableCollection<RecipeSpeed>
|
|
|
+ (
|
|
|
+ RecipeProfile.RecipeSpeeds.Where(model => model.GroupId == group.Id)
|
|
|
+ );
|
|
|
+ if (speedModels == null) throw new ArgumentException($"Cannot Get Speed Group[{group.Name}]");
|
|
|
+ return speedModels;
|
|
|
+ }
|
|
|
}
|
|
|
}
|