Przeglądaj źródła

筛选配方bug修复

master
ZhaoGang 11 miesięcy temu
rodzic
commit
228cc8c597
6 zmienionych plików z 43 dodań i 4 usunięć
  1. +2
    -1
      BPASmartClient.JXJFoodBigStation/ViewModel/RecipeReceiveViewModel.cs
  2. +19
    -3
      BPASmartClient.JXJFoodBigStation/ViewModel/RecipeSendDownViewModel.cs
  3. +1
    -0
      BPASmartClient.JXJFoodBigStation/ViewModel/SelectRecipesViewModel.cs
  4. +1
    -0
      BPASmartClient.JXJFoodSmallStation/ViewModel/NewLocalRecipeViewModel.cs
  5. +19
    -0
      BPASmartClient.JXJFoodSmallStation/ViewModel/RecipeReceiveViewModel.cs
  6. +1
    -0
      BPASmartClient.JXJFoodSmallStation/ViewModel/SelectRecipesViewModel.cs

+ 2
- 1
BPASmartClient.JXJFoodBigStation/ViewModel/RecipeReceiveViewModel.cs Wyświetl plik

@@ -113,8 +113,9 @@ namespace BPASmartClient.JXJFoodBigStation.ViewModel
}

Json<LocalRecipe>.Data.Recipes.Clear();
Json<LocalRecipe>.Save();
Json<LocalRecipe>.Data.SelectedRecipes.Clear();
Json<LocalRecipe>.Save();

NoticeDemoViewModel.OpenMsg(EnumPromptType.Success, App.MainWindow, "成功", $"本地配方已全部删除!");
MessageNotify.GetInstance.ShowUserLog($"手动清除所有配方。");
});


+ 19
- 3
BPASmartClient.JXJFoodBigStation/ViewModel/RecipeSendDownViewModel.cs Wyświetl plik

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


@@ -45,8 +45,24 @@ namespace BPASmartClient.JXJFoodBigStation.ViewModel

public RecipeSendDownViewModel()
{
var tempcoll = new ObservableCollection<RecipeData>();
foreach (var item in Json<LocalRecipe>.Data.SelectedRecipes)
{
if (!Json<LocalRecipe>.Data.Recipes.Any(p => p.RecipeCode.Equals(item.RecipeCode)
&& p.RecipeName.Equals(item.RecipeName) && p.IsWashingBarrel == item.IsWashingBarrel
&& p.TrayCode == item.TrayCode))
{
tempcoll.Add(item);
}
}
foreach (var item in tempcoll)
{
Json<LocalRecipe>.Data.SelectedRecipes.Remove(item);
}
Json<LocalRecipe>.Save();
tempcoll.Clear();

SelectedRecipes= Json<LocalRecipe>.Data.SelectedRecipes;
SelectedRecipes = Json<LocalRecipe>.Data.SelectedRecipes;

StartCommand = new RelayCommand<string>((recipeName) =>
{
@@ -87,7 +103,7 @@ namespace BPASmartClient.JXJFoodBigStation.ViewModel
{
var selectView = new SelectRecipesView();
selectView.ShowDialog();
SelectedRecipes.Clear();
Json<LocalRecipe>.Data.SelectedRecipes.Clear();
foreach ( var recipe in SelectRecipesViewModel.SelectRecipes )
{


+ 1
- 0
BPASmartClient.JXJFoodBigStation/ViewModel/SelectRecipesViewModel.cs Wyświetl plik

@@ -17,6 +17,7 @@ namespace BPASmartClient.JXJFoodBigStation.ViewModel
public SelectRecipesViewModel()
{
AllRecipes = new();
SelectRecipes.Clear();
foreach (var item in Json<LocalRecipe>.Data.SelectedRecipes)
{
SelectRecipes.Add(item);


+ 1
- 0
BPASmartClient.JXJFoodSmallStation/ViewModel/NewLocalRecipeViewModel.cs Wyświetl plik

@@ -242,6 +242,7 @@ namespace BPASmartClient.JXJFoodSmallStation.ViewModel
Json<LocalRecipeDataColl>.Data.Recipes.Add(newRemoteRecipeData);
//新增一条配方应该默认显示出来。
Json<LocalRecipeDataColl>.Data.SelectedRecipes.Add(newRemoteRecipeData);
Json<LocalRecipeDataColl>.Save();
NoticeDemoViewModel.OpenMsg(EnumPromptType.Success, App.MainWindow, "提示", $"自定义配方添加完成!");
MessageNotify.GetInstance.ShowUserLog($"添加一个自定义配方,配方名称:【{RecipeName}】,配方编号:【{RecipeCode}】。");
}


+ 19
- 0
BPASmartClient.JXJFoodSmallStation/ViewModel/RecipeReceiveViewModel.cs Wyświetl plik

@@ -31,6 +31,22 @@ namespace BPASmartClient.JXJFoodSmallStation.ViewModel
NotUseSmallDosing = GVL_SmallStation.GetInstance.NotUseSmallStation;
IsUseLocalRecipe = GVL_SmallStation.GetInstance.IsUseLocalRecipe;
IsUseWindSendDosing = GVL_SmallStation.GetInstance.IsUseWindSend;

var tempcoll = new ObservableCollection<RemoteRecipeData>();
foreach (var item in Json<LocalRecipeDataColl>.Data.SelectedRecipes)
{
if (!Json<LocalRecipeDataColl>.Data.Recipes.Any(p=>p.RecipeCode.Equals(item.RecipeCode)&&p.RecipeName.Equals(item.RecipeName)&&p.TrayCode==item.TrayCode))
{
tempcoll.Add(item);
}
}
foreach (var item in tempcoll)
{
Json<LocalRecipeDataColl>.Data.SelectedRecipes.Remove(item);
}
Json<LocalRecipeDataColl>.Save();
tempcoll.Clear();

Recipes = Json<LocalRecipeDataColl>.Data.Recipes;

NewRecipe = new RelayCommand(() =>
@@ -48,6 +64,7 @@ namespace BPASmartClient.JXJFoodSmallStation.ViewModel
if (res != null)
{
Json<LocalRecipeDataColl>.Data.Recipes.Remove(res);
Json<LocalRecipeDataColl>.Save();
MessageNotify.GetInstance.ShowUserLog($"删除配方——{res.RecipeName}");
}
}
@@ -156,6 +173,7 @@ namespace BPASmartClient.JXJFoodSmallStation.ViewModel

//新增了配方之后应该默认显示出来。
Json<LocalRecipeDataColl>.Data.SelectedRecipes.Add(newRemoteRecipedata);
Json<LocalRecipeDataColl>.Save();
MessageNotify.GetInstance.ShowUserLog("新增一条本地模拟配方。");
}

@@ -166,6 +184,7 @@ namespace BPASmartClient.JXJFoodSmallStation.ViewModel
{
Json<LocalRecipeDataColl>.Data.Recipes.Clear();
Json<LocalRecipeDataColl>.Data.SelectedRecipes.Clear();
Json<LocalRecipeDataColl>.Save();
NoticeDemoViewModel.OpenMsg(EnumPromptType.Success, App.MainWindow, "提示", $"本地配方清空成功。");
MessageNotify.GetInstance.ShowUserLog("手动清除所有本地配方");
}


+ 1
- 0
BPASmartClient.JXJFoodSmallStation/ViewModel/SelectRecipesViewModel.cs Wyświetl plik

@@ -18,6 +18,7 @@ namespace BPASmartClient.JXJFoodSmallStation.ViewModel
public SelectRecipesViewModel()
{
AllRecipes = new();
SelectRecipes.Clear();
foreach (var item in Json<LocalRecipeDataColl>.Data.SelectedRecipes)
{
SelectRecipes.Add(item);


Ładowanie…
Anuluj
Zapisz