Browse Source

Fix some bugs about PM process data

Intern01 1 year ago
parent
commit
4d950d1f31

+ 6 - 1
Venus/Venus_MainPages/ViewModels/DataHistoryViewModel.cs

@@ -218,7 +218,7 @@ namespace Venus_MainPages.ViewModels
             timer.Stop();
         }
       
-        private void OnStart()
+        public void OnStart()
         {
            
             if (Keys.Count > 10)
@@ -244,6 +244,11 @@ namespace Venus_MainPages.ViewModels
                 });
                 cls.Add(points);
             }
+            for (int i = 0; i < KeyDataObservableCollection.Count(); i++)
+            {
+                var _color = KeyDataObservableCollection[i].Color.Color;
+                this.DataHistoryView.MyDrawGraphicsControl.m_PenCollencteions[i] = new System.Drawing.Pen(System.Drawing.Color.FromArgb(_color.A, _color.R, _color.G, _color.B), 2);
+            }
             this.DataHistoryView.MyDrawGraphicsControl.PointCollections = cls;
             this.DataHistoryView.MyDrawGraphicsControl.FitControl();
         }

+ 61 - 61
Venus/Venus_MainPages/ViewModels/ProcessHistoryViewModel.cs

@@ -29,6 +29,10 @@ using System.Xml;
 using System.Security.Cryptography.X509Certificates;
 using System.Reflection;
 using Newtonsoft.Json;
+using Venus_Themes.UserControls;
+using Aitex.Core.UI.Control;
+using System.Windows.Annotations;
+using System.Runtime.Serialization;
 
 namespace Venus_MainPages.ViewModels
 {
@@ -168,7 +172,7 @@ namespace Venus_MainPages.ViewModels
                 string sql1 = string.Format($"SELECT * FROM \"lot_wafer_data\" where  guid ='{id}'; ");
                 DataTable dbData1 = QueryDataClient.Instance.Service.QueryData(sql1);
                 string lot_data_guid = dbData1.Rows[0]["wafer_data_guid"].ToString();
-                string sql = string.Format($"SELECT * FROM \"process_data\" where  guid ='{lot_data_guid}'");
+                string sql = string.Format($"SELECT * FROM \"process_data\" where  wafer_data_guid ='{lot_data_guid}'");
                 if (!string.IsNullOrEmpty(SelectedValuePM))
                 {
                     string[] pms = SelectedValuePM.Split(',');
@@ -498,65 +502,38 @@ namespace Venus_MainPages.ViewModels
         }
         public void UpdateData(RecipeItem dataLog)
         {
-            if (dataLog == null)
-            {
-                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;
-            }
-            //Application.Current.Dispatcher.Invoke(new Action(() =>
-            //{
-            //    string type = "A";
-            //    string s = dataLog.Chamber;
-
-            //    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" };
-            //        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" };
-            //        if ((bool)QueryDataClient.Instance.Service.GetConfig($"PMB.BiasRf.EnableBiasRF"))
-            //            type = "B";
-            //    }
-            //}));          
-            this.view.MyDrawGraphicsControl.ClearPlotPoints();
-            //DateTime dtFrom = dataLog.StartTime;
-            DateTime dtFrom = Convert.ToDateTime(dataLog.StartTime);
-            //DateTime dtTo = dtFrom.AddMinutes(10);
-            DateTime dtTo = Convert.ToDateTime(dataLog.EndTime);
-            //if (!string.IsNullOrEmpty(dataLog.EndTime))
-            //{
-            //    dtTo = Convert.ToDateTime(dataLog.EndTime);
-            //}
-            var result = GetData(keys.Distinct().ToList(), dtFrom, dtTo);
-            List<PointCollection> cls = new List<PointCollection>();
-            for (int i = 0; i < keys.Count; i++)
+           OnClearData();
+           //CheckRecipe(dataLog.Guid);
+        }
+        public void CheckRecipe(string RecipeGuid)
+        {
+            string sql = $"SELECT * FROM \"recipe_step_data\" where \"process_data_guid\" = '{RecipeGuid}' order by step_number ASC;";
+            var dbData = QueryDataClient.Instance.Service.QueryData(sql);
+            List<StepData> steps = new List<StepData>();
+            if (dbData != null && dbData.Rows.Count > 0)
             {
-                PointCollection points = new PointCollection();
-                int k = 1;
-                result[keys[i]].ForEach(point =>
+                for (int i = 0; i < dbData.Rows.Count; i++)
                 {
-                    points.Add(new Point() { X = point.dateTime.ToOADate(), Y = point.value });
-                    k += 1;
-                });
-                cls.Add(points);
+                    StepData item = new StepData();
+
+                    item.No = int.Parse(dbData.Rows[i]["step_number"].ToString());
+                    item.Name = dbData.Rows[i]["step_name"].ToString();
+
+                    if (!dbData.Rows[i]["step_begin_time"].Equals(DBNull.Value))
+                        item.StartTime = (DateTime)dbData.Rows[i]["step_begin_time"];
+
+                    if (!dbData.Rows[i]["step_end_time"].Equals(DBNull.Value))
+                        item.EndTime = (DateTime)dbData.Rows[i]["step_end_time"];
+
+                    item.ActualTime = item.EndTime.CompareTo(item.StartTime) <= 0 ? "" : item.EndTime.Subtract(item.StartTime).TotalSeconds.ToString();
+
+                    item.SettingTime = dbData.Rows[i]["step_time"].ToString();
+
+                    //annotation.Add(VerLine(Brushes.Blue, item.StartTime, Brushes.Blue, $"{item.No}:{item.Name}"));
+
+                }
             }
-            this.view.MyDrawGraphicsControl.PointCollections = cls;
-            this.view.MyDrawGraphicsControl.FitControl();
         }
-
         public void OnDataGridSelectionChanged(object obj)
         {
             selectedRecipeItem = obj as RecipeItem;
@@ -591,18 +568,26 @@ namespace Venus_MainPages.ViewModels
                 });
                 cls.Add(points);
             }
+            for (int i = 0; i <PdKeyDataCollection.Count(); i++)
+            {
+                var _color = PdKeyDataCollection[i].Color.Color;
+                view.MyDrawGraphicsControl.m_PenCollencteions[i] = new System.Drawing.Pen(System.Drawing.Color.FromArgb(_color.A, _color.R, _color.G, _color.B), 2);
+            }
             this.view.MyDrawGraphicsControl.PointCollections = cls;
 
             this.view.MyDrawGraphicsControl.FitControl();
         }
         private void CloseAll(ObservableCollection<ParameterNode> parameterNodes)
         {
-            foreach (var item in parameterNodes)
+            if (parameterNodes != null)
             {
-                item.Selected = false;
-                if (item.ChildNodes.Count > 0)
+                foreach (var item in parameterNodes)
                 {
-                    CloseAll(item.ChildNodes);
+                    item.Selected = false;
+                    if (item.ChildNodes.Count > 0)
+                    {
+                        CloseAll(item.ChildNodes);
+                    }
                 }
             }
         }
@@ -629,7 +614,22 @@ namespace Venus_MainPages.ViewModels
             public string LotID { get; set; }
             public string SlotID { get; set; }
         }
-        public class PdKeyData : BindableBase, ICloneable
+    public class StepData
+    {
+        [DataMember]
+        public int No { get; set; }
+        [DataMember]
+        public string Name { get; set; }
+        [DataMember]
+        public DateTime StartTime { get; set; }
+        [DataMember]
+        public DateTime EndTime { get; set; }
+        [DataMember]
+        public string ActualTime { get; set; }
+        [DataMember]
+        public string SettingTime { get; set; }
+    }
+    public class PdKeyData : BindableBase, ICloneable
         {
             public string Key { get; set; }
             public SolidColorBrush _Color;

+ 6 - 5
Venus/Venus_MainPages/Views/DataHistoryView.xaml.cs

@@ -41,11 +41,12 @@ namespace Venus_MainPages.Views
                     _viewModel = (DataHistoryViewModel)DataContext;
                     var item = _viewModel.KeyDataObservableCollection.ToList().Find(t => t.UniqueId == dataId);
                     item.Color = new SolidColorBrush(newColor);
-                    for (int i = 0; i < _viewModel.KeyDataObservableCollection.Count(); i++)
-                    {
-                        var _color = _viewModel.KeyDataObservableCollection[i].Color.Color;
-                        MyDrawGraphicsControl.m_PenCollencteions[i] = new System.Drawing.Pen(System.Drawing.Color.FromArgb(_color.A, _color.R, _color.G, _color.B), 3);
-                    }
+                    //for (int i = 0; i < _viewModel.KeyDataObservableCollection.Count(); i++)
+                    //{
+                    //    var _color = _viewModel.KeyDataObservableCollection[i].Color.Color;
+                    //    MyDrawGraphicsControl.m_PenCollencteions[i] = new System.Drawing.Pen(System.Drawing.Color.FromArgb(_color.A, _color.R, _color.G, _color.B), 3);
+                    //}
+                    _viewModel.OnStart();
                 }
             }
         }

File diff suppressed because it is too large
+ 3 - 3
Venus/Venus_MainPages/Views/ProcessHistoryView.xaml


+ 0 - 5
Venus/Venus_MainPages/Views/ProcessHistoryView.xaml.cs

@@ -118,11 +118,6 @@ namespace Venus_MainPages.Views
                     _viewModel = (ProcessHistoryViewModel)DataContext;
                     var item = _viewModel.PdKeyDataCollection.ToList().Find(t => t.UniqueId == dataId);
                     item.Color = new SolidColorBrush(newColor); 
-                    for (int i = 0;i< _viewModel.PdKeyDataCollection.Count(); i++)
-                    {
-                        var _color= _viewModel.PdKeyDataCollection[i].Color.Color;
-                        MyDrawGraphicsControl.m_PenCollencteions[i] = new System.Drawing.Pen(System.Drawing.Color.FromArgb(_color.A, _color.R, _color.G,_color.B),3);    
-                    }
                     _viewModel.OnSearchData();
                 }
             }

+ 33 - 15
Venus/Venus_RT/Modules/PMs/PMProcessRoutine.cs

@@ -32,7 +32,10 @@ namespace Venus_RT.Modules.PMs
         public string CleanRecipeName { get; set; }
         public RecipeHead ProcessRecipeHead { get; set; }
         public DateTime RecipeStartTime { get; private set; }
-
+        public string WaferId { get; set; }
+        public string SlotID { get; set; }
+        public string LotID { get; set; }
+        public string FullRecipeName { get; set; }
         private readonly PumpDownRoutine _pumpDownRoutine;
         private readonly ProcessHelper _processHelper;
         private bool _withWafer = true;
@@ -358,7 +361,16 @@ namespace Venus_RT.Modules.PMs
             var result = step.Run();
             if(result == RState.Failed)
             {
-                ProcessDataRecorder.RecordPrecess(Guid.NewGuid().ToString(), RecipeStartTime, DateTime.Now, CurrentRunningRecipe, "Fail", "", _chamber.Name, "", "");
+                WaferManager.Instance.UpdateWaferProcessStatus(Module, 0, EnumWaferProcessStatus.Completed);
+                WaferInfo waferInfo = WaferManager.Instance.GetWafer(ModuleHelper.Converter(Module.ToString()), 0);
+                if (!waferInfo.IsEmpty)
+                {
+                    WaferId = waferInfo.InnerId.ToString();
+                    SlotID = waferInfo.OriginSlot.ToString();
+                    LotID = waferInfo.ProcessJob == null || string.IsNullOrEmpty(waferInfo.ProcessJob.ControlJobName) ? "" : waferInfo.ProcessJob.ControlJobName;
+                    FullRecipeName = string.Format(@"{0}/{1}/{2}", ChuckRecipeName, ProcessRecipeName, DechuckRecipeName);
+                }
+                ProcessDataRecorder.RecordPrecess(Guid.NewGuid().ToString(), RecipeStartTime, DateTime.Now, FullRecipeName, "Fail", WaferId, _chamber.Name, LotID, SlotID);
                 UpdateWaferStatus(false);
                 Runner.Stop($"Recipe:{CurrentRunningRecipe}, Step:{_currentStep + 1} Failed");
                 FaEvent.FaPostAlarm(Module.ToString(), $"Recipe:{CurrentRunningRecipe}, Step:{_currentStep + 1} Failed");
@@ -424,16 +436,15 @@ namespace Venus_RT.Modules.PMs
             _chamber.OpenValve(ValveType.Guage, true);
             _chamber.SetPVPostion(1000);
             WaferManager.Instance.UpdateWaferProcessStatus(Module, 0, EnumWaferProcessStatus.Completed);
-            string waferId = "", slotID = "", lotID = "", recipename = "";
             WaferInfo waferInfo = WaferManager.Instance.GetWafer(ModuleHelper.Converter(Module.ToString()), 0);
             if (!waferInfo.IsEmpty)
             {
-                waferId = waferInfo.InnerId.ToString();
-                slotID = waferInfo.OriginSlot.ToString();
-                lotID = waferInfo.ProcessJob == null || string.IsNullOrEmpty(waferInfo.ProcessJob.ControlJobName) ? "" : waferInfo.ProcessJob.ControlJobName;
-                recipename = string.Format(@"{0}/{1}/{2}", ChuckRecipeName, ProcessRecipeName, DechuckRecipeName);
+                WaferId = waferInfo.InnerId.ToString();
+                SlotID = waferInfo.OriginSlot.ToString();
+                LotID = waferInfo.ProcessJob == null || string.IsNullOrEmpty(waferInfo.ProcessJob.ControlJobName) ? "" : waferInfo.ProcessJob.ControlJobName;
+                FullRecipeName = string.Format(@"{0}/{1}/{2}", ChuckRecipeName, ProcessRecipeName, DechuckRecipeName);
             }
-            ProcessDataRecorder.RecordPrecess(Guid.NewGuid().ToString(), RecipeStartTime, DateTime.Now, recipename,"", waferId, _chamber.Name, lotID, slotID);
+            ProcessDataRecorder.RecordPrecess(Guid.NewGuid().ToString(), RecipeStartTime, DateTime.Now, FullRecipeName,"Success", WaferId, _chamber.Name, LotID, SlotID);
             return true;
         }
 
@@ -441,11 +452,11 @@ namespace Venus_RT.Modules.PMs
         {
             if(bDone == false)
             {
-                WaferManager.Instance.UpdateWaferProcessStatus(ModuleName.PMA, 0, EnumWaferProcessStatus.Failed);
+                WaferManager.Instance.UpdateWaferProcessStatus(Module, 0, EnumWaferProcessStatus.Failed);
                 if(_currentRecipe.Header.Type == RecipeType.Chuck)
                 {
                     // set wafer chucked flag even if the chuck recipe failed.
-                    WaferManager.Instance.UpdateWaferChuckStatus(ModuleName.PMA, 0, EnumWaferChuckStatus.Chucked);
+                    WaferManager.Instance.UpdateWaferChuckStatus(Module, 0, EnumWaferChuckStatus.Chucked);
                 }
             }
             switch(_currentRecipe.Header.Type)
@@ -453,19 +464,26 @@ namespace Venus_RT.Modules.PMs
                 case RecipeType.Process:
                     break;
                 case RecipeType.Chuck:
-                    WaferManager.Instance.UpdateWaferChuckStatus(ModuleName.PMA, 0, EnumWaferChuckStatus.Chucked);
+                    WaferManager.Instance.UpdateWaferChuckStatus(Module, 0, EnumWaferChuckStatus.Chucked);
                     break;
                 case RecipeType.DeChuck:
-                    WaferManager.Instance.UpdateWaferProcessStatus(ModuleName.PMA, 0, EnumWaferProcessStatus.Completed);
-                    WaferManager.Instance.UpdateWaferChuckStatus(ModuleName.PMA, 0, EnumWaferChuckStatus.Dechucked);
+                    WaferManager.Instance.UpdateWaferProcessStatus(Module, 0, EnumWaferProcessStatus.Completed);
+                    WaferManager.Instance.UpdateWaferChuckStatus(Module, 0, EnumWaferChuckStatus.Dechucked);
                     break;
             }
         }
 
         public void Abort()
         {
-            ProcessDataRecorder.RecordPrecess(Guid.NewGuid().ToString(), RecipeStartTime, DateTime.Now, CurrentRunningRecipe, "Fail", "", _chamber.Name, "", "");
-
+            WaferInfo waferInfo = WaferManager.Instance.GetWafer(ModuleHelper.Converter(Module.ToString()), 0);
+            if (!waferInfo.IsEmpty)
+            {
+                WaferId = waferInfo.InnerId.ToString();
+                SlotID = waferInfo.OriginSlot.ToString();
+                LotID = waferInfo.ProcessJob == null || string.IsNullOrEmpty(waferInfo.ProcessJob.ControlJobName) ? "" : waferInfo.ProcessJob.ControlJobName;
+                FullRecipeName = string.Format(@"{0}/{1}/{2}", ChuckRecipeName, ProcessRecipeName, DechuckRecipeName);
+            }
+            ProcessDataRecorder.RecordPrecess(Guid.NewGuid().ToString(), RecipeStartTime, DateTime.Now, FullRecipeName, "Fail", WaferId, _chamber.Name, LotID, SlotID);
             _chamber.GeneratorBiasPowerOn(false);
             _chamber.GeneratorPowerOn(false);
             _chamber.TurnPendulumValve(false);