|
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using Microsoft.Toolkit.Mvvm.Input;
- using BPA.Helper;
- using System.Collections.ObjectModel;
- using BPASmartClient.CustomResource.Pages.Model;
-
- namespace BPASmartClient.SmallBatchingSystem.ViewModels
- {
- public class GrindArenaceousViewModel : BaseModel
- {
- public GrindArenaceousViewModel()
- {
- ActionManage.GetInstance.Register(new Action<object>((o) =>
- {
- if (o != null && o is RecipeStatus recipe)
- {
- int index = Array.FindIndex(Recipes.ToArray(), p => p.RawMaterialName == recipe.RawMaterialName);
- if (index >= 0 && index < Recipes.Count)
- {
- Recipes.ElementAt(index).Status = recipe.Status;
- Recipes.ElementAt(index).IsChecked = true;
- }
- }
- }), "StatusNotify", true);
- ActionManage.GetInstance.Register(new Action<object>((o) =>
- {
- if (o != null && o is RecipeInfo recipe)
- {
- RecipeName = recipe.RecipeName;
- recipe.SiloInfoModels.ToList()?.ForEach(x =>
- {
- Recipes.Add(new RecipeStatus() { RawMaterialName = x.SiloName, Status = "等待配料" });
- });
- }
- }), "OpenRecipeStatusMotion", true);
- CancelCommand = new RelayCommand(() =>
- {
- if (MessageNotify.GetInstance.ShowDialog($"是否取消配方制作,取消后设备将终止配料过程!", DialogType.Warning))
- {
- Control.GetInstance.IsCancel = true; ActionManage.GetInstance.Send("GrindArenaceousCancel");
- }
- });
- }
-
- public string RecipeName { get { return _mRecipeName; } set { _mRecipeName = value; OnPropertyChanged(); } }
- private string _mRecipeName;
-
- public ObservableCollection<RecipeStatus> Recipes { get; set; } = new ObservableCollection<RecipeStatus>();
- }
- }
|