@@ -113,8 +113,9 @@ namespace BPASmartClient.JXJFoodBigStation.ViewModel | |||||
} | } | ||||
Json<LocalRecipe>.Data.Recipes.Clear(); | Json<LocalRecipe>.Data.Recipes.Clear(); | ||||
Json<LocalRecipe>.Save(); | |||||
Json<LocalRecipe>.Data.SelectedRecipes.Clear(); | Json<LocalRecipe>.Data.SelectedRecipes.Clear(); | ||||
Json<LocalRecipe>.Save(); | |||||
NoticeDemoViewModel.OpenMsg(EnumPromptType.Success, App.MainWindow, "成功", $"本地配方已全部删除!"); | NoticeDemoViewModel.OpenMsg(EnumPromptType.Success, App.MainWindow, "成功", $"本地配方已全部删除!"); | ||||
MessageNotify.GetInstance.ShowUserLog($"手动清除所有配方。"); | MessageNotify.GetInstance.ShowUserLog($"手动清除所有配方。"); | ||||
}); | }); | ||||
@@ -36,7 +36,7 @@ namespace BPASmartClient.JXJFoodBigStation.ViewModel | |||||
/// <summary> | /// <summary> | ||||
/// 筛选后的配方列表。 | /// 筛选后的配方列表。 | ||||
/// </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() | 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) => | StartCommand = new RelayCommand<string>((recipeName) => | ||||
{ | { | ||||
@@ -87,7 +103,7 @@ namespace BPASmartClient.JXJFoodBigStation.ViewModel | |||||
{ | { | ||||
var selectView = new SelectRecipesView(); | var selectView = new SelectRecipesView(); | ||||
selectView.ShowDialog(); | selectView.ShowDialog(); | ||||
SelectedRecipes.Clear(); | |||||
Json<LocalRecipe>.Data.SelectedRecipes.Clear(); | Json<LocalRecipe>.Data.SelectedRecipes.Clear(); | ||||
foreach ( var recipe in SelectRecipesViewModel.SelectRecipes ) | foreach ( var recipe in SelectRecipesViewModel.SelectRecipes ) | ||||
{ | { | ||||
@@ -17,6 +17,7 @@ namespace BPASmartClient.JXJFoodBigStation.ViewModel | |||||
public SelectRecipesViewModel() | public SelectRecipesViewModel() | ||||
{ | { | ||||
AllRecipes = new(); | AllRecipes = new(); | ||||
SelectRecipes.Clear(); | |||||
foreach (var item in Json<LocalRecipe>.Data.SelectedRecipes) | foreach (var item in Json<LocalRecipe>.Data.SelectedRecipes) | ||||
{ | { | ||||
SelectRecipes.Add(item); | SelectRecipes.Add(item); | ||||
@@ -242,6 +242,7 @@ namespace BPASmartClient.JXJFoodSmallStation.ViewModel | |||||
Json<LocalRecipeDataColl>.Data.Recipes.Add(newRemoteRecipeData); | Json<LocalRecipeDataColl>.Data.Recipes.Add(newRemoteRecipeData); | ||||
//新增一条配方应该默认显示出来。 | //新增一条配方应该默认显示出来。 | ||||
Json<LocalRecipeDataColl>.Data.SelectedRecipes.Add(newRemoteRecipeData); | Json<LocalRecipeDataColl>.Data.SelectedRecipes.Add(newRemoteRecipeData); | ||||
Json<LocalRecipeDataColl>.Save(); | |||||
NoticeDemoViewModel.OpenMsg(EnumPromptType.Success, App.MainWindow, "提示", $"自定义配方添加完成!"); | NoticeDemoViewModel.OpenMsg(EnumPromptType.Success, App.MainWindow, "提示", $"自定义配方添加完成!"); | ||||
MessageNotify.GetInstance.ShowUserLog($"添加一个自定义配方,配方名称:【{RecipeName}】,配方编号:【{RecipeCode}】。"); | MessageNotify.GetInstance.ShowUserLog($"添加一个自定义配方,配方名称:【{RecipeName}】,配方编号:【{RecipeCode}】。"); | ||||
} | } | ||||
@@ -31,6 +31,22 @@ namespace BPASmartClient.JXJFoodSmallStation.ViewModel | |||||
NotUseSmallDosing = GVL_SmallStation.GetInstance.NotUseSmallStation; | NotUseSmallDosing = GVL_SmallStation.GetInstance.NotUseSmallStation; | ||||
IsUseLocalRecipe = GVL_SmallStation.GetInstance.IsUseLocalRecipe; | IsUseLocalRecipe = GVL_SmallStation.GetInstance.IsUseLocalRecipe; | ||||
IsUseWindSendDosing = GVL_SmallStation.GetInstance.IsUseWindSend; | 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; | Recipes = Json<LocalRecipeDataColl>.Data.Recipes; | ||||
NewRecipe = new RelayCommand(() => | NewRecipe = new RelayCommand(() => | ||||
@@ -48,6 +64,7 @@ namespace BPASmartClient.JXJFoodSmallStation.ViewModel | |||||
if (res != null) | if (res != null) | ||||
{ | { | ||||
Json<LocalRecipeDataColl>.Data.Recipes.Remove(res); | Json<LocalRecipeDataColl>.Data.Recipes.Remove(res); | ||||
Json<LocalRecipeDataColl>.Save(); | |||||
MessageNotify.GetInstance.ShowUserLog($"删除配方——{res.RecipeName}"); | MessageNotify.GetInstance.ShowUserLog($"删除配方——{res.RecipeName}"); | ||||
} | } | ||||
} | } | ||||
@@ -156,6 +173,7 @@ namespace BPASmartClient.JXJFoodSmallStation.ViewModel | |||||
//新增了配方之后应该默认显示出来。 | //新增了配方之后应该默认显示出来。 | ||||
Json<LocalRecipeDataColl>.Data.SelectedRecipes.Add(newRemoteRecipedata); | Json<LocalRecipeDataColl>.Data.SelectedRecipes.Add(newRemoteRecipedata); | ||||
Json<LocalRecipeDataColl>.Save(); | |||||
MessageNotify.GetInstance.ShowUserLog("新增一条本地模拟配方。"); | MessageNotify.GetInstance.ShowUserLog("新增一条本地模拟配方。"); | ||||
} | } | ||||
@@ -166,6 +184,7 @@ namespace BPASmartClient.JXJFoodSmallStation.ViewModel | |||||
{ | { | ||||
Json<LocalRecipeDataColl>.Data.Recipes.Clear(); | Json<LocalRecipeDataColl>.Data.Recipes.Clear(); | ||||
Json<LocalRecipeDataColl>.Data.SelectedRecipes.Clear(); | Json<LocalRecipeDataColl>.Data.SelectedRecipes.Clear(); | ||||
Json<LocalRecipeDataColl>.Save(); | |||||
NoticeDemoViewModel.OpenMsg(EnumPromptType.Success, App.MainWindow, "提示", $"本地配方清空成功。"); | NoticeDemoViewModel.OpenMsg(EnumPromptType.Success, App.MainWindow, "提示", $"本地配方清空成功。"); | ||||
MessageNotify.GetInstance.ShowUserLog("手动清除所有本地配方"); | MessageNotify.GetInstance.ShowUserLog("手动清除所有本地配方"); | ||||
} | } | ||||
@@ -18,6 +18,7 @@ namespace BPASmartClient.JXJFoodSmallStation.ViewModel | |||||
public SelectRecipesViewModel() | public SelectRecipesViewModel() | ||||
{ | { | ||||
AllRecipes = new(); | AllRecipes = new(); | ||||
SelectRecipes.Clear(); | |||||
foreach (var item in Json<LocalRecipeDataColl>.Data.SelectedRecipes) | foreach (var item in Json<LocalRecipeDataColl>.Data.SelectedRecipes) | ||||
{ | { | ||||
SelectRecipes.Add(item); | SelectRecipes.Add(item); | ||||