| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369 | using MECF.Framework.Common.DataCenter;using MECF.Framework.UI.Client.CenterViews.Editors.Recipe;using MECF.Framework.UI.Client.CenterViews.Editors.Sequence;using OpenSEMI.ClientBase;using System;using System.Collections.Generic;using System.Collections.ObjectModel;using System.Linq;using System.Text;using System.Threading.Tasks;using System.Windows;using FurnaceUI.Models;using FurnaceUI.Views.Recipes;using ProcessTypeFileItem = MECF.Framework.UI.Client.CenterViews.Editors.Recipe.ProcessTypeFileItem;namespace FurnaceUI.Views.Editors{    public class RecipeAlarmActionSubViewModel : FurnaceUIViewModelBase    {        public ObservableCollection<FileNode> FileListByProcessType { get; set; }        public ObservableCollection<string> ChamberType { get; set; }        public int ChamberTypeIndexSelection { get; set; }        private RecipeProvider _recipeProvider = new RecipeProvider();        private ObservableCollection<Step> _stepList = new ObservableCollection<Step>();                public ObservableCollection<Step> StepList            {            get => _stepList;            set            {                _stepList = value;                NotifyOfPropertyChange("StepList");            }        }        private int _alarmTableNo;        public int AlarmTableNo        {            get => _alarmTableNo;            set            {                _alarmTableNo = value;                NotifyOfPropertyChange("AlarmTableNo");            }        }        private int _alarmGroupNo;        public int AlarmGroupNo        {            get => _alarmGroupNo;            set            {                _alarmGroupNo = value;                NotifyOfPropertyChange("AlarmGroupNo");            }        }        private string _alarmType;        public string AlarmType        {            get => _alarmType;            set            {                _alarmType = value;                NotifyOfPropertyChange("AlarmType");            }        }        private string _alarmDetails;        public string AlarmDetails        {            get => _alarmDetails;            set            {                _alarmDetails = value;                NotifyOfPropertyChange("AlarmDetails");            }        }        private Visibility _abortRecipeVisibility;        public Visibility AbortRecipeVisibility        {            get => _abortRecipeVisibility;            set            {                _abortRecipeVisibility = value;                NotifyOfPropertyChange("AbortRecipeVisibility");            }        }        private Visibility _jumpStepVisibility;        public Visibility JumpStepVisibility        {            get => _jumpStepVisibility;            set            {                _jumpStepVisibility = value;                NotifyOfPropertyChange("JumpStepVisibility");            }        }        public string CurrentStepName { get; set; }        public string SelectedStepName { get; set; }        public string AbortRecipeName { get; set; }        private bool _isCheckJumpAbortRecipe;        public bool IsCheckJumpAbortRecipe        {            get => _isCheckJumpAbortRecipe;            set            {                _isCheckJumpAbortRecipe = value;                NotifyOfPropertyChange(nameof(IsCheckJumpAbortRecipe));            }        }        private bool _isCheckJumpStep;        public bool IsCheckJumpStep        {            get => _isCheckJumpStep;            set            {                _isCheckJumpStep = value;                NotifyOfPropertyChange(nameof(IsCheckJumpStep));            }        }        private bool _isCheckJumpStepCancelLoop;        public bool IsCheckJumpStepCancelLoop        {            get => _isCheckJumpStepCancelLoop;            set            {                _isCheckJumpStepCancelLoop = value;                NotifyOfPropertyChange(nameof(IsCheckJumpStepCancelLoop));            }        }        private bool _isCheckAbort;        public bool IsCheckAbort        {            get => _isCheckAbort;            set            {                _isCheckAbort = value;                NotifyOfPropertyChange(nameof(IsCheckAbort));            }        }        private bool _isCheckHold;        public bool IsCheckHold        {            get => _isCheckHold;            set            {                _isCheckHold = value;                NotifyOfPropertyChange(nameof(IsCheckHold));            }        }        private bool _isCheckIgnoreAlarm;        public bool IsCheckIgnoreAlarm        {            get => _isCheckIgnoreAlarm;            set            {                _isCheckIgnoreAlarm = value;                NotifyOfPropertyChange(nameof(IsCheckIgnoreAlarm));            }        }        protected override void OnInitialize()        {            base.OnInitialize();                    }        private void ShowControl(string alarmType)        {            AbortRecipeVisibility = Visibility.Hidden;            JumpStepVisibility = Visibility.Hidden;            switch (alarmType)            {                case "Jump Abort Recipe":                    AbortRecipeVisibility = Visibility.Visible;                    break;                case "Jump Step":                    JumpStepVisibility = Visibility.Visible;                    break;                case "Jump Step(Cancel Call Loop)":                    JumpStepVisibility = Visibility.Visible;                    break;                case "Abort":                    break;                case "Hold":                    break;                case "Ignore Alarm":                    break;                default:                    break;            }        }        public void SelectStep(object step)        {            if (step is Step)            {                if (AlarmType == "Jump Step")                {                    AlarmDetails = $"Jump Step/{((Step)step).Name}";                    SelectedStepName = ((Step)step).Name;                }                else if (AlarmType == "Jump Step(Cancel Call Loop)")                {                    AlarmDetails = $"Jump Step(Cancel Call Loop)/{((Step)step).Name}";                    SelectedStepName = ((Step)step).Name;                }            }                    }        public void TreeSelectChanged(object abortRecipeName)        {            if (abortRecipeName is FileNode)            {                AlarmDetails = $"Abort Recipe/{((FileNode)abortRecipeName).Name}";                AbortRecipeName = ((FileNode)abortRecipeName).Name;            }                    }        public void SelectAlarmGroupCommand(string alarmType)        {            AlarmType = alarmType;            switch (alarmType)            {                case "Jump Abort Recipe":                    AlarmDetails = @"Abort Recipe/";                    break;                case "Jump Step":                    AlarmDetails = @"Jump Step/";                    break;                case "Jump Step(Cancel Call Loop)":                    AlarmDetails = @"Jump Step(Cancel Call Loop)/";                    break;                case "Abort":                    AlarmDetails = "";                    break;                case "Hold":                    AlarmDetails = "";                    break;                case "Ignore Alarm":                    AlarmDetails = "";                    break;                default:                    break;            }            SelectedStepName = "";            AbortRecipeName = "";            ShowControl(alarmType);        }        protected override void OnViewLoaded(object view)        {            base.OnViewLoaded(view);            GetAbortRecipeFileList();            switch (AlarmType)            {                case "Jump Abort Recipe":                    IsCheckJumpAbortRecipe = true;                    break;                case "Jump Step":                    IsCheckJumpStep = true;                    break;                case "Jump Step(Cancel Call Loop)":                    IsCheckJumpStepCancelLoop = true;                    break;                case "Abort":                    IsCheckAbort = true;                    break;                case "Hold":                    IsCheckHold = true;                    break;                case "Ignore Alarm":                    IsCheckIgnoreAlarm = true;                    break;                default:                    IsCheckIgnoreAlarm = true;                    break;            }            ShowControl(AlarmType);        }        private void GetAbortRecipeFileList()        {            var processType = "Abort";            var chamberType = QueryDataClient.Instance.Service.GetConfig("System.Recipe.SupportedChamberType");            if (chamberType == null)            {                ChamberType = new ObservableCollection<string>() { "Default" };            }            else            {                ChamberType = new ObservableCollection<string>(((string)(chamberType)).Split(','));            }            ChamberTypeIndexSelection = 0;            ObservableCollection<ProcessTypeFileItem> typeFileList = new ObservableCollection<ProcessTypeFileItem>();            string[] recipeProcessType = ((string)processType).Split(',');            for (int i = 0; i < recipeProcessType.Length; i++)            {                var prefix = $"{ChamberType[ChamberTypeIndexSelection]}\\{recipeProcessType[i]}";                var recipes = _recipeProvider.GetXmlRecipeList(prefix);                FileListByProcessType = RecipeSequenceTreeBuilder.BuildFileNode(prefix, "", false, recipes)[0].Files;            }        }        public void SaveCmd()        {            if (AlarmType == "Jump Step" || AlarmType == "Jump Step(Cancel Call Loop)")            {                if (string.IsNullOrEmpty(SelectedStepName))                {                    DialogBox.ShowWarning("Jump Step is empty!");                    return;                }                if (SelectedStepName == CurrentStepName)                {                    DialogBox.ShowWarning($"Jump Step cannot be the same as {CurrentStepName}!");                    return;                }            }            if (AlarmType == "Jump Abort Recipe")            {                if (string.IsNullOrEmpty(AbortRecipeName))                {                    DialogBox.ShowWarning("Abort Recipe Name is empty!");                    return;                }            }            ((Window)GetView()).DialogResult = true;        }        public void CloseCmd()        {            ((Window)GetView()).DialogResult = false;        }    }}
 |