Bläddra i källkod

修改配方下发判断逻辑。

master
ZhaoGang 1 år sedan
förälder
incheckning
5f588b2339
1 ändrade filer med 8 tillägg och 4 borttagningar
  1. +8
    -4
      BPASmartClient.JXJFoodBigStation/ViewModel/RecipeSendDownViewModel.cs

+ 8
- 4
BPASmartClient.JXJFoodBigStation/ViewModel/RecipeSendDownViewModel.cs Visa fil

@@ -36,7 +36,7 @@ namespace BPASmartClient.JXJFoodBigStation.ViewModel
/// <summary>
/// 筛选后的配方列表。
/// </summary>
public static ObservableCollection<RecipeData> SelectedRecipes { get; set; } = Json<LocalRecipe>.Data.SelectedRecipes;
public static ObservableCollection<RecipeData> SelectedRecipes { get; set; }


@@ -45,6 +45,9 @@ namespace BPASmartClient.JXJFoodBigStation.ViewModel

public RecipeSendDownViewModel()
{

SelectedRecipes= Json<LocalRecipe>.Data.SelectedRecipes;

StartCommand = new RelayCommand<string>((recipeName) =>
{
if (recipeName != null)
@@ -59,7 +62,7 @@ namespace BPASmartClient.JXJFoodBigStation.ViewModel
var res = Recipes.FirstOrDefault(p => p.RecipeName == recipeName);
if (res != null)
{
if (!Json<RemoteRecipe>.Data.Recipes.Contains(res))
if (!Json<RemoteRecipe>.Data.Recipes.Any(p=>p.RecipeCode==res.RecipeCode))
{
res.RecipesSource = RecipeSource.本地;
Json<RemoteRecipe>.Data.Recipes.Add(res);
@@ -87,12 +90,13 @@ namespace BPASmartClient.JXJFoodBigStation.ViewModel
Json<LocalRecipe>.Data.SelectedRecipes.Clear();
foreach ( var recipe in SelectRecipesViewModel.SelectRecipes )
{
if ( recipe != null && !Json<LocalRecipe>.Data.SelectedRecipes.Contains(recipe))
if ( recipe != null && !Json<LocalRecipe>.Data.SelectedRecipes.Any(p=>p.RecipeCode==recipe.RecipeCode))
{
Json<LocalRecipe>.Data.SelectedRecipes.Add(recipe);
}
}
//不保存会导致下次打开本地配方下发页面,会重新读取之前存储的文件。
Json<LocalRecipe>.Save();
});
}
}


Laddar…
Avbryt
Spara