|
- using BPASmartClient.CustomResource.Pages.Model;
- using BPASmartClient.CustomResource.UserControls;
- using BPASmartClient.CustomResource.UserControls.MessageShow;
- using BPASmartClient.Helper;
- using BPASmartClient.JXJFoodBigStation.Model;
- using BPASmartClient.JXJFoodBigStation.Model.Siemens;
- using Microsoft.Toolkit.Mvvm.ComponentModel;
- using Microsoft.Toolkit.Mvvm.Input;
- using System;
- using System.Collections.Generic;
- using System.Collections.ObjectModel;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
-
- namespace BPASmartClient.JXJFoodBigStation.ViewModel
- {
- internal class RecipeSendDownViewModel:ObservableObject
- {
- public ObservableCollection<RecipeData> Recipes { get; set; } = Json<LocalRecipe>.Data.Recipes;
- /// <summary>
- /// 当前正在制作的配方
- /// </summary>
- public static ObservableCollection<RawMaterial> recipeProcesses { get; set; } = new ObservableCollection<RawMaterial>();
- /// <summary>
- /// 等待制作的配方
- /// </summary>
- public static ObservableCollection<RecipeData> UserTreeWait { get; set; } = new ObservableCollection<RecipeData>();
- /// <summary>
- /// 已完成的配方
- /// </summary>
- public static ObservableCollection<RecipeData> UserTreeCompelete { get; set; } = new ObservableCollection<RecipeData>();
-
- public RelayCommand<string> StartCommand { get; set; }
-
- public RecipeSendDownViewModel()
- {
- StartCommand = new RelayCommand<string>((recipeName) =>
- {
- if (recipeName != null)
- {
- if (GVL_BigStation.IsUseLocalRecipe)
- {
- //配方下发逻辑
- var res = Recipes.FirstOrDefault(p => p.RecipeName == recipeName);
- if (res != null)
- {
- if (!Json<RemoteRecipe>.Data.Recipes.Contains(res))
- {
- res.RecipesSource = RecipeSource.本地;
- Json<RemoteRecipe>.Data.Recipes.Add(res);
- MessageNotify.GetInstance.ShowRunLog($"手动下发配方:{recipeName}完成");
- NoticeDemoViewModel.OpenMsg(EnumPromptType.Success, App.MainWindow, "成功", $"配方下发完成");
- }
- }
- }
- else
- {
- NoticeDemoViewModel.OpenMsg(EnumPromptType.Warn, App.MainWindow, "警告", $"未处于本地配方模式,无法下发配方");
- }
- }
- });
- }
- }
- }
|