Bläddra i källkod

1.增加侧边参数选择与recipe选择下拉框
2.调整其他界面

Intern01 1 år sedan
förälder
incheckning
f61d947399

+ 56 - 23
Venus/Venus_MainPages/ViewModels/ProcessHistoryViewModel.cs

@@ -15,25 +15,30 @@ using System.Collections.ObjectModel;
 using System.Windows.Threading;
 using System.Windows;
 using Aitex.Core.RT.Log;
-
 using Aitex.Core.UI.ControlDataContext;
 using WPF.Themes.UserControls;
+using System.IO;
 using System.Diagnostics;
 using Aitex.Core.RT.Routine;
+using System.Xml.Linq;
 
 namespace Venus_MainPages.ViewModels
 {
-    public class ProcessHistoryViewModel:BindableBase
+    public class ProcessHistoryViewModel : BindableBase
     {
         private ProcessHistoryView view;
         List<string> keys = new List<string>();
         RealtimeProvider _provider = new RealtimeProvider();
         private ObservableCollection<ParameterNode> _ParameterNodes;
         DispatcherTimer timer = new DispatcherTimer();
+        public List<string> RecipesAdd=new List<string>();
         DateTime currentTime;
-        private DelegateCommand<object> _LoadCommand;
-        public DelegateCommand<object> LoadCommand =>
-            _LoadCommand ?? (_LoadCommand = new DelegateCommand<object>(OnLoad));
+        private DelegateCommand<object> _LoadCommandPD;
+        public DelegateCommand<object> LoadCommandPD =>
+            _LoadCommandPD ?? (_LoadCommandPD = new DelegateCommand<object>(OnLoadPd));
+        private DelegateCommand _SearchRecipeCommand;
+        public DelegateCommand SearchRecipeCommand =>
+        _SearchRecipeCommand ?? (_SearchRecipeCommand = new DelegateCommand(SearchRecipe));
 
         //private string _starttime;
         //public string starttime 
@@ -41,28 +46,44 @@ namespace Venus_MainPages.ViewModels
         // public string starttime { get; set; }
 
         public List<HistoryDataItem> ProcessData { get; set; }
+        //public List<Recipeslist> CheboxRecipes = new List<Recipeslist>();
         public ProcessHistoryViewModel()
         {
             ProcessChartData = new ProcessDataChartDataItem(60000);
             ParameterNodes = _provider.GetParameters();
             Recipes = new ObservableCollection<RecipeItem>();
             timer.Interval = TimeSpan.FromSeconds(0.5);
+            CheboxRecipes = new List<Recipeslist>();
+            //CheboxRecipes.Add(new Recipeslist { BoxName = "test" });
+           // CheboxRecipes.Add(new Recipeslist { BoxName = "test2" });
+            //CheboxRecipes.Add(new Recipeslist { BoxName = "test3" });
             //starttime = "1999-10-01";
         }
+        public List<Recipeslist> CheboxRecipes { get; set; }
         public ProcessDataChartDataItem ProcessChartData
         {
             get;
             set;
         }
-        private void OnLoad(Object eventView)
+        private void OnLoadPd(Object eventView)
         {
             this.view = (ProcessHistoryView)eventView;
             this.view.wfTimeFrom.Value = DateTime.Today;
             this.view.wfTimeTo.Value = new DateTime(DateTime.Today.Year, DateTime.Today.Month, DateTime.Today.Day, 23, 59, 59, 999);
-            //this.DataHistoryView.MyDrawGraphicsControl.PointCollections=new PointCollection(new Point[] {})
-
+            this.LoadRecipeCheckBox();
         }
-
+        private void LoadRecipeCheckBox()
+        {
+            string path= Path.Combine(QueryDataClient.Instance.Service.GetData("GetRTPath").ToString(), "Recipes","PMA");
+            if (Directory.Exists(path)) {
+                string[] dir = Directory.GetFiles(path);
+                for (int i = 0; i < dir.Length; i++)
+                {
+                    CheboxRecipes.Add(new Recipeslist { BoxName = Path.GetFileName(dir[i])});
+                }
+            }
+        }
+        //Path.GetFileName(dir[i]).ToString()
         public DateTime StartDateTime { get; set; }
         public DateTime EndDateTime { get; set; }
         public string SelectedValuePM { get; set; }
@@ -80,6 +101,14 @@ namespace Venus_MainPages.ViewModels
             public string LotID { get; set; }
             public string SlotID { get; set; }
         }
+        public class Recipeslist
+        {
+            public string BoxName { get; set; }
+        }
+        public class RecipeAdd
+        {
+            public string Recipesname { get; set; }
+        }
         public ObservableCollection<RecipeItem> Recipes { get; set; }
         public ObservableCollection<ParameterNode> ParameterNodes
         {
@@ -89,9 +118,7 @@ namespace Venus_MainPages.ViewModels
         }
 
 
-        private DelegateCommand _SearchRecipeCommand;
-        public DelegateCommand SearchRecipeCommand =>
-        _SearchRecipeCommand ?? (_SearchRecipeCommand = new DelegateCommand(SearchRecipe));
+
         public void SearchRecipe()
         {
             //if (MenuPermission != 3) return;
@@ -122,10 +149,10 @@ namespace Venus_MainPages.ViewModels
                 {
                     sql += string.Format(" and lower(\"recipe_name\") like '%{0}%'", RecipeName.ToLower());
                 }
-
                 sql += " order by \"process_begin_time\" ASC;";
-
+                
                 DataTable dbData = QueryDataClient.Instance.Service.QueryData(sql);
+                
 
                 Application.Current.Dispatcher.BeginInvoke(new Action(() =>
                 {
@@ -146,8 +173,7 @@ namespace Venus_MainPages.ViewModels
                             item.StartTime = ((DateTime)dbData.Rows[i]["process_begin_time"]).ToString("yyyy-MM-dd HH:mm:ss.fff");
                         if (!dbData.Rows[i]["process_end_time"].Equals(DBNull.Value))
                             item.EndTime = ((DateTime)dbData.Rows[i]["process_end_time"]).ToString("yyyy-MM-dd HH:mm:ss.fff");
-                        Recipes.Add(item);
-                       
+                        Recipes.Add(item);                  
                     }
                 }));
             }
@@ -183,7 +209,7 @@ namespace Venus_MainPages.ViewModels
                 sql += "," + string.Format("\"{0}\"", dataId);
             }
             sql += string.Format(" from \"{0}\" where time > {1} and time <= {2} order by time asc",
-                from.ToString("yyyyMMdd") + "." + "Data", 638205482713339617, 638205532409885237);
+                from.ToString("yyyyMMdd") + "." + "Data", from.Ticks, to.Ticks);
             DataTable dataTable = QueryDataClient.Instance.Service.QueryData(sql);
             Dictionary<string, List<HistoryDataItem>> historyData = new Dictionary<string, List<HistoryDataItem>>();
             if (dataTable == null || dataTable.Rows.Count == 0)
@@ -253,8 +279,17 @@ namespace Venus_MainPages.ViewModels
                 this.view.MyDrawGraphicsControl.ClearPlotPoints();
                 return;
             }
+            keys.Clear();
+            for (int i = 0; i < ParameterNodes.Count; i++)
+            {
+                CalKeys(ParameterNodes[i]);
+            }
+            if (keys.Count > 10)
+            {
+                WPFMessageBox.ShowWarning("最多显示10个数据");
+                return;
+            }
 
-            List<string> keys = new List<string>();
 
             Application.Current.Dispatcher.Invoke(new Action(() =>
             {
@@ -263,19 +298,17 @@ namespace Venus_MainPages.ViewModels
 
                 if (dataLog.Chamber == "PMA")
                 {
-                    keys = new List<string> { "IO.PMA.AI_Chamber_Pressure", "PMA.Rf.PowerSetPoint", "PMA.Rf.ForwardPower", "PMA.Rf.ReflectPower", "PMA.IoMfc.MfcGas1.FeedBack", "PMA.IoMfc.MfcGas1.SetPoint", "PMA.IoMfc.MfcGas2.FeedBack", "PMA.IoMfc.MfcGas2.SetPoint", "PMA.IoMfc.MfcGas3.FeedBack", "PMA.IoMfc.MfcGas3.SetPoint" };
+                    //keys = new List<string> { "IO.PMA.AI_Chamber_Pressure", "PMA.Rf.PowerSetPoint", "PMA.Rf.ForwardPower", "PMA.Rf.ReflectPower", "PMA.IoMfc.MfcGas1.FeedBack", "PMA.IoMfc.MfcGas1.SetPoint", "PMA.IoMfc.MfcGas2.FeedBack", "PMA.IoMfc.MfcGas2.SetPoint", "PMA.IoMfc.MfcGas3.FeedBack", "PMA.IoMfc.MfcGas3.SetPoint" };
                     if ((bool)QueryDataClient.Instance.Service.GetConfig($"PMA.BiasRf.EnableBiasRF"))
                         type = "A";
                 }
                 else if (dataLog.Chamber == "PMB")
                 {
-                    keys = new List<string> { "IO.PMB.AI_Chamber_Pressure", "PMB.Rf.PowerSetPoint", "PMB.Rf.ForwardPower", "PMB.Rf.ReflectPower", "PMB.IoMfc.MfcGas1.FeedBack", "PMB.IoMfc.MfcGas1.SetPoint", "PMB.IoMfc.MfcGas2.FeedBack", "PMB.IoMfc.MfcGas2.SetPoint", "PMB.IoMfc.MfcGas3.FeedBack", "PMB.IoMfc.MfcGas3.SetPoint" };
+                   // keys = new List<string> { "IO.PMB.AI_Chamber_Pressure", "PMB.Rf.PowerSetPoint", "PMB.Rf.ForwardPower", "PMB.Rf.ReflectPower", "PMB.IoMfc.MfcGas1.FeedBack", "PMB.IoMfc.MfcGas1.SetPoint", "PMB.IoMfc.MfcGas2.FeedBack", "PMB.IoMfc.MfcGas2.SetPoint", "PMB.IoMfc.MfcGas3.FeedBack", "PMB.IoMfc.MfcGas3.SetPoint" };
                     if ((bool)QueryDataClient.Instance.Service.GetConfig($"PMB.BiasRf.EnableBiasRF"))
                         type = "B";
                 }
-            }));
-
-            //ProcessData = QueryDataClient.Instance.Service.GetHistoryData(keys, dataLog.Guid, "Data");
+            }));          
             this.view.MyDrawGraphicsControl.ClearPlotPoints();
             DateTime dtFrom = Convert.ToDateTime(dataLog.StartTime);
             DateTime dtTo = dtFrom.AddMinutes(10);

Filskillnaden har hållts tillbaka eftersom den är för stor
+ 154 - 55
Venus/Venus_MainPages/Views/ProcessHistoryView.xaml