| 
					
				 | 
			
			
				@@ -13,6 +13,10 @@ using System.Text; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 using System.Threading.Tasks;
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 using System.Windows.Controls;
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 using OpenSEMI.ClientBase;
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+using MECF.Framework.UI.Client.CenterViews.Editors.Recipe;
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+using System.Collections.ObjectModel;
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+using System.Windows;
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+using MECF.Framework.Common.CommonData;
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 namespace FurnaceUI.Views.Maintenances
 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -61,6 +65,19 @@ namespace FurnaceUI.Views.Maintenances 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 NotifyOfPropertyChange(nameof(SelectedTargetPosition));
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             }
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         }
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        public ObservableCollection<PurgeParameter> PurgeParameters { get; set; }
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        private Visibility _purgeVisibilty;
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        public Visibility PurgeVisibilty
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            get { return _purgeVisibilty; }
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            set 
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            { 
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                _purgeVisibilty = value;
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                NotifyOfPropertyChange(nameof(PurgeVisibilty));
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            }
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        }
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         private BufferRobotView _view;
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         protected override void OnViewLoaded(object view)
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         {
 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -68,7 +85,40 @@ namespace FurnaceUI.Views.Maintenances 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             _view = view as BufferRobotView;
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             BufferAxisLimitSpeed = (double)QueryDataClient.Instance.Service.GetConfig($"BufferServo.BufferAxisLimitSpeed");
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+           
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        }
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        protected override void OnActivate()
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            #region BufferPurge
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            var isEnable = (bool)QueryDataClient.Instance.Service.GetConfig("BufferPurge.IsEnable");
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            PurgeVisibilty = isEnable ? Visibility.Visible : Visibility.Collapsed;
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (isEnable)
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                List<string> keys = new List<string> { "BufferPurge.NameList", "BufferPurge.Operation", "BufferPurge.FinishCondition", "BufferPurge.OperationOrder" };
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                var dic = QueryDataClient.Instance.Service.PollConfig(keys);
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                string[] names = $"{dic["BufferPurge.NameList"]}".Split(';');
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                string[] operation = $"{dic["BufferPurge.Operation"]}".Split(';');
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                string[] sequence = $"{dic["BufferPurge.OperationOrder"]}".Split(';');
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                PurgeParameters = new ObservableCollection<PurgeParameter>();
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                foreach (string p in sequence)
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    if (string.IsNullOrWhiteSpace(p)) continue;//Purge1,0,Time(10),Open;
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    var step = p.Trim().Split(',');
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    if (step.Length == 4)
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        if (string.IsNullOrEmpty(step[0])) continue;//name
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        if (names.Contains(step[0]))
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            var index = step[2].IndexOf('(') + 1;
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            int.TryParse(step[2].Substring(index, step[2].Length - index - 1), out int time);//仅考虑时间
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            PurgeParameters.Add(
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            new PurgeParameter() { Name = step[0], TimeString = $"{time / 3600:00}:{time % 3600 / 60:00}:{time % 60:00}", IsClose = step[3].ToLower() == "close", IsOpen = step[3].ToLower() == "open" });
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        }
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    }
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                }
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            }
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            #endregion
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            base.OnActivate();
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         }
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         private void InitData()
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         {
 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -161,5 +211,31 @@ namespace FurnaceUI.Views.Maintenances 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             InvokeClient.Instance.Service.DoOperation($"{target}.ServoResetAlarm");
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         }
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        public void TimeEdit(PurgeParameter purge)
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            RecipeStepTimeViewModel recipeStepTimeViewModel = new RecipeStepTimeViewModel("ControlTime");
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            recipeStepTimeViewModel.SelectTime =purge.TimeString;
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            recipeStepTimeViewModel.SelectValueTime = purge.TimeString;
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            (IoC.Get<IWindowManager>() as WindowManager)?.ShowDialogWithTitle(recipeStepTimeViewModel, null, "Control Time Set");
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (recipeStepTimeViewModel.IsSave)
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                purge.TimeString = recipeStepTimeViewModel.SelectValueTime;
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            }
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        }
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        public void SetBufferPurge()
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (PurgeParameters?.Count > 0&&PurgeParameters.Any(r=>r.IsClose||r.IsOpen))
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                if(DialogBox.Confirm("Do you want to operating BufferPurge?"))
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    InvokeClient.Instance.Service.DoOperation("PM1.SetBufferPurge", PurgeParameters.ToList());      
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                }
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            }
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            else
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                DialogBox.ShowWarning("No Parameter to Set!");
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            }
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        }
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     }
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 }
 
			 |