diff --git a/DosingSystem/ExcuteControl .cs b/DosingSystem/ExcuteControl .cs index e67cb158..11afba07 100644 --- a/DosingSystem/ExcuteControl .cs +++ b/DosingSystem/ExcuteControl .cs @@ -631,14 +631,15 @@ namespace BPASmartClient.DosingSystem { App.Current.Dispatcher.Invoke(() => { - RecipeModel recipe = recipeProcesses?.ToList().Find(a => a.RecipeName == RecipeNames.ElementAt(recipeNameNum)); - if (recipe.RecipStatus != "制作完成") + + RecipeModel recipe = recipeProcesses?.ToList().Find(a => a.RecipeName == RecipeNames.ElementAt(recipeNameNum-1)); + if (recipe!=null&& recipe.RecipStatus != "制作完成") { /*Json.Data.Recipes.RemoveAt(recipeProcesses.ToList().FindIndex(a => a.RecipeName == RecipeNames.ElementAt(recipeNameNum))); Json.Save();*/ recipe.RecipStatus = "制作完成"; UserTreeCompelete.Insert(0, recipe); - recipeProcesses.RemoveAt(recipeProcesses.ToList().FindIndex(a => a.RecipeName == RecipeNames.ElementAt(recipeNameNum))); + recipeProcesses.RemoveAt(recipeProcesses.ToList().FindIndex(a => a.RecipeName == RecipeNames.ElementAt(recipeNameNum-1))); } }); } @@ -675,11 +676,15 @@ namespace BPASmartClient.DosingSystem App.Current.Dispatcher.Invoke(() => { RecipeModel recipe = UserTreeWait?.ToList().Find(a => a.RecipeName == RecipeNames.ElementAt(recipeNameNum-1)); - recipe.RecipStatus = "正在配料"; - recipeProcesses.Insert(0, recipe); - /* Json.Data.Recipes.Insert(0, recipe); - Json.Save();*/ - UserTreeWait.RemoveAt(UserTreeWait.ToList().FindIndex(a => a.RecipeName == RecipeNames.ElementAt(recipeNameNum-1))); + if (recipe!=null) + { + recipe.RecipStatus = "正在配料"; + recipeProcesses.Insert(0, recipe); + /* Json.Data.Recipes.Insert(0, recipe); + Json.Save();*/ + UserTreeWait.RemoveAt(UserTreeWait.ToList().FindIndex(a => a.RecipeName == RecipeNames.ElementAt(recipeNameNum - 1))); + } + }); } }