12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697 |
- using Aitex.Core.Util;
- using Caliburn.Micro;
- using MECF.Framework.Common.DataCenter;
- using MECF.Framework.Common.OperationCenter;
- using MECF.Framework.UI.Client.CenterViews.Editors.Recipe;
- using MECF.Framework.UI.Client.CenterViews.Editors.Sequence;
- using MECF.Framework.UI.Client.ClientBase;
- using OpenSEMI.ClientBase;
- using System.Collections.ObjectModel;
- using System.Windows;
- namespace FurnaceUI.Views.Jobs
- {
- public class MaintenanceJobViewModel : ModuleUiViewModelBase
- {
- [Subscription("Boat.Status")]
- public string BoatStatus { get; set; }
- public bool IsBoatEnabled => BoatStatus == "Idle";
- public bool IsPermission { get => this.Permission == 3; }
- public Visibility ExecButtonVisibility { get; set; } = Visibility.Visible;
- public Visibility CloseButtonVisibility { get; set; } = Visibility.Hidden;
- public string SelectButtonContent { get; set; } = "Process Recipe Select";
- private string selectedProcessRecipe;
- public string SelectedProcessRecipe
- {
- set
- {
- selectedProcessRecipe = value;
- NotifyOfPropertyChange("SelectedProcessRecipe");
- }
- get
- {
- return selectedProcessRecipe;
- }
- }
- public string SelectedSupportedProcessType { get; set; } = "SupportedProcessType";
- public string SelectedProcessType { get; set; } = "Process";
- public void ClosedCmd(string cmdPar)
- {
- (GetView() as Window).Close();
- }
- public void SelectProcessRecipe()
- {
- RecipeSelectDialogViewModel dialog = new RecipeSelectDialogViewModel();
- dialog.DisplayName = "Select Recipe";
- var recipeProvider = new RecipeProvider();
- var processType = QueryDataClient.Instance.Service.GetConfig($"System.Recipe.{SelectedSupportedProcessType}");
- if (processType == null)
- {
- processType = SelectedProcessType;
- }
- var ProcessTypeFileList = new ObservableCollection<ProcessTypeFileItem>();
- string[] recipeProcessType = ((string)processType).Split(',');
- var type = new ProcessTypeFileItem();
- type.ProcessType = recipeProcessType[0];
- var prefix = $"Furnace\\{recipeProcessType[0]}";
- var recipes = recipeProvider.GetXmlRecipeList(prefix);
- type.FileListByProcessType = RecipeSequenceTreeBuilder.BuildFileNode(prefix, "", false, recipes)[0].Files;
- ProcessTypeFileList.Add(type);
- dialog.ProcessTypeFileList = ProcessTypeFileList;
- WindowManager wm = new WindowManager();
- bool? bret = wm.ShowDialog(dialog);
- if ((bool)bret)
- {
- //var array = dialog.DialogResult.Split(new char[] { '\\' });
- //SelectedProcessRecipe = array[array.Length - 1];
- SelectedProcessRecipe = dialog.DialogResult;
- }
- }
- public void ExecCommand()
- {
- if (string.IsNullOrWhiteSpace(SelectedProcessRecipe))
- {
- DialogBox.ShowWarning("{0} cannot be empty.", "Process Recipe");
- return;
- }
- int length = SelectedProcessRecipe.Split('\\').Length;
- InvokeClient.Instance.Service.DoOperation("PM1.RunRecipe", SelectedProcessRecipe);
- }
- }
- }
|