using BPASmartClient.CustomResource.Pages.Model; using BPASmartClient.CustomResource.UserControls; using BPASmartClient.CustomResource.UserControls.MessageShow; using BPASmartClient.Helper; using BPASmartClient.JXJFoodBigStation.Model; 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 Recipes { get; set; } = Json.Data.Recipes; /// /// 当前正在制作的配方 /// public static ObservableCollection recipeProcesses { get; set; } = new ObservableCollection(); /// /// 等待制作的配方 /// public static ObservableCollection UserTreeWait { get; set; } = new ObservableCollection(); /// /// 已完成的配方 /// public static ObservableCollection UserTreeCompelete { get; set; } = new ObservableCollection(); public RelayCommand StartCommand { get; set; } public RecipeSendDownViewModel() { StartCommand = new RelayCommand((recipeName) => { if (recipeName != null) { if (GVL_BigStation.IsUseLocalRecipe) { //配方下发逻辑 var res = Recipes.FirstOrDefault(p => p.RecipeName == recipeName); if (res != null) { //Json.Data.Recipes.Add(res); //for (int i = 0; i < Json.Data.Recipes.Count; i++) //{ // foreach (var item in Json.Data.Recipes.ElementAt(i).RawMaterial) // { // item.RawMaterialLocation = Convert.ToInt32(item.RawMaterialName); // } //} if (!ProcessControl.GetInstance.LocalRecipes.Contains(res)) { ProcessControl.GetInstance.LocalRecipes.Add(res); MessageNotify.GetInstance.ShowAlarmLog($"手动下发配方:{recipeName}完成"); } } } else { NoticeDemoViewModel.OpenMsg(EnumPromptType.Warn, App.MainWindow, "警告", $"未处于本地配方模式,无法下发配方"); } } }); } } }