public void addProcess(PExpToshiba process, int index)
        {
            if (UpperWP != null)
            {
                process.Workpieces.Add(UpperWP.clone());
                process.UpperWorkpiece = UpperWP.ID;
            }
            if (LowerWP != null)
            {
                process.Workpieces.Add(LowerWP.clone());
                process.LowerWorkpiece = LowerWP.ID;
            }

            if (Glass != null)
            {
                process.GlassID = Glass.ID;
            }

            process.GlassName = LensName + "_" + index;

            process.UserID    = User.ID;
            process.ProjectID = m_project.ID;
            process.IssueID   = m_issue.ID;

            m_ProcessVms.Add(new PToshibaVM(process));
            NotifyPropertyChanged("Processes");
        }
Exemple #2
0
        private void bt_imoport_Click(object sender, RoutedEventArgs e)
        {
            System.Windows.Forms.OpenFileDialog _ofd = new System.Windows.Forms.OpenFileDialog();

            _ofd.Filter           = "mon files (*.mon)|*.mon|Alle Deteien (*.*)|*.*";
            _ofd.FilterIndex      = 1;
            _ofd.RestoreDirectory = true;
            _ofd.Multiselect      = true;


            System.Windows.Forms.DialogResult result = _ofd.ShowDialog();
            this.UpdateLayout();
            if (result == System.Windows.Forms.DialogResult.OK)
            {
                Cursor = Cursors.Wait;
                int id = m_vm.LensStartNumber;
                foreach (var path in _ofd.FileNames)
                {
                    var         file    = PDCore.ToshibaImport.IO.getMonFileData(path);
                    PExpToshiba process = PDCore.ToshibaImport.Analytics.AnalyseProcess(file);
                    process.File = file;

                    m_vm.addProcess(process, id);

                    id++;
                }

                Cursor = Cursors.Arrow;

                new MainWindows.ToshibaProcessImport(m_vm).Show();
                this.Close();
            }
        }
        //Nur zu initialen Gebrauch!!! Keine Produktiv-Funktion
        public void ImportToshibaMData()
        {
            List <string> _queries = new List <string>();
            int           PID      = 0;

            foreach (string path in System.IO.Directory.GetFiles(@"Data\Toshiba\"))
            {
                int    idx = path.LastIndexOf('\\');
                string PII = path.Remove(0, idx + 1);
                PID = Convert.ToInt32(PII.Replace(".mon", ""));
                //System.Windows.MessageBox.Show(PID.ToString());
                var         file    = PDCore.ToshibaImport.IO.getMonFileData(path);
                PExpToshiba Process = PDCore.ToshibaImport.Analytics.AnalyseProcess(file);



                _queries.Add("INSERT INTO " + DBExpToshibaMachineData.Table + " (" + DBExpToshibaMachineData.PID + "," +
                             DBExpToshibaMachineData.G1_lower + "," +
                             DBExpToshibaMachineData.G1_lower_quali + "," +
                             DBExpToshibaMachineData.G1_upper + "," +
                             DBExpToshibaMachineData.G1_upper_quali + "," +
                             DBExpToshibaMachineData.G3_lower + "," +
                             DBExpToshibaMachineData.G3_lower_quali + "," +
                             DBExpToshibaMachineData.G3_upper + "," +
                             DBExpToshibaMachineData.G3_upper_quali + "," +
                             DBExpToshibaMachineData.G4_lower + "," +
                             DBExpToshibaMachineData.G4_lower_quali + "," +
                             DBExpToshibaMachineData.G4_upper + "," +
                             DBExpToshibaMachineData.G4_upper_quali + "," +
                             DBExpToshibaMachineData.Gv_lower + "," +
                             DBExpToshibaMachineData.Gv_lower_quali + "," +
                             DBExpToshibaMachineData.Gv_upper + "," +
                             DBExpToshibaMachineData.Gv_upper_quali + "," +
                             DBExpToshibaMachineData.P1 + "," +
                             DBExpToshibaMachineData.P2 + "," +
                             DBExpToshibaMachineData.P3 + "," +
                             DBExpToshibaMachineData.PT1 + "," +
                             DBExpToshibaMachineData.ST1 + "," +
                             DBExpToshibaMachineData.ST2 + "," +
                             DBExpToshibaMachineData.T_press_av + "," +
                             DBExpToshibaMachineData.T_press_G + "," +
                             DBExpToshibaMachineData.T_press_G_quali + "," +
                             DBExpToshibaMachineData.T_start_lower + "," +
                             DBExpToshibaMachineData.T_start_upper + "," +
                             DBExpToshibaMachineData.T1_lower + "," +
                             DBExpToshibaMachineData.T1_upper + "," +
                             DBExpToshibaMachineData.T1u_lower + "," +
                             DBExpToshibaMachineData.T1u_upper + "," +
                             DBExpToshibaMachineData.T2_lower + "," +
                             DBExpToshibaMachineData.T2_upper + "," +
                             DBExpToshibaMachineData.T3_lower + "," +
                             DBExpToshibaMachineData.T3_upper + "," +
                             DBExpToshibaMachineData.T4_lower + "," +
                             DBExpToshibaMachineData.T4_upper + "," +
                             DBExpToshibaMachineData.T5_lower + "," +
                             DBExpToshibaMachineData.T5_upper + "," +
                             DBExpToshibaMachineData.Tv_lower + "," +
                             DBExpToshibaMachineData.Tv_upper + "," +
                             DBExpToshibaMachineData.Tvu_lower + "," +
                             DBExpToshibaMachineData.Tvu_upper + ") Values (" +

                             PID + "," +
                             Process.MachinaData.G1_lower.ToDBObject() + "," +
                             Process.MachinaData.G1_lower_quali.ToDBObject() + "," +
                             Process.MachinaData.G1_upper.ToDBObject() + "," +
                             Process.MachinaData.G1_upper_quali.ToDBObject() + "," +
                             Process.MachinaData.G3_lower.ToDBObject() + "," +
                             Process.MachinaData.G3_lower_quali.ToDBObject() + "," +
                             Process.MachinaData.G3_upper.ToDBObject() + "," +
                             Process.MachinaData.G3_upper_quali.ToDBObject() + "," +
                             Process.MachinaData.G4_lower.ToDBObject() + "," +
                             Process.MachinaData.G4_lower_quali.ToDBObject() + "," +
                             Process.MachinaData.G4_upper.ToDBObject() + "," +
                             Process.MachinaData.G4_upper_quali.ToDBObject() + "," +
                             Process.MachinaData.Gv_lower.ToDBObject() + "," +
                             Process.MachinaData.Gv_lower_quali.ToDBObject() + "," +
                             Process.MachinaData.Gv_upper.ToDBObject() + "," +
                             Process.MachinaData.Gv_upper_quali.ToDBObject() + "," +
                             Process.MachinaData.P1.ToDBObject() + "," +
                             Process.MachinaData.P2.ToDBObject() + "," +
                             Process.MachinaData.P3.ToDBObject() + "," +
                             Process.MachinaData.PT1.ToDBObject() + "," +
                             Process.MachinaData.ST1.ToDBObject() + "," +
                             Process.MachinaData.ST2.ToDBObject() + "," +
                             Process.MachinaData.T_press_av.ToDBObject() + "," +
                             Process.MachinaData.T_press_G.ToDBObject() + "," +
                             Process.MachinaData.T_press_G_quali.ToDBObject() + "," +
                             Process.MachinaData.T_start_lower.ToDBObject() + "," +
                             Process.MachinaData.T_start_upper.ToDBObject() + "," +
                             Process.MachinaData.T1_lower.ToDBObject() + "," +
                             Process.MachinaData.T1_upper.ToDBObject() + "," +
                             Process.MachinaData.T1u_lower.ToDBObject() + "," +
                             Process.MachinaData.T1u_upper.ToDBObject() + "," +
                             Process.MachinaData.T2_lower.ToDBObject() + "," +
                             Process.MachinaData.T2_upper.ToDBObject() + "," +
                             Process.MachinaData.T3_lower.ToDBObject() + "," +
                             Process.MachinaData.T3_upper.ToDBObject() + "," +
                             Process.MachinaData.T4_lower.ToDBObject() + "," +
                             Process.MachinaData.T4_upper.ToDBObject() + "," +
                             Process.MachinaData.T5_lower.ToDBObject() + "," +
                             Process.MachinaData.T5_upper.ToDBObject() + "," +
                             Process.MachinaData.Tv_lower.ToDBObject() + "," +
                             Process.MachinaData.Tv_upper.ToDBObject() + "," +
                             Process.MachinaData.Tvu_lower.ToDBObject() + "," +
                             Process.MachinaData.Tvu_upper.ToDBObject() + ")");

                _queries.Add("update " + DBExpToshiba.Table + " set " + DBExpToshiba.T4 + "=" + Process.MachinaData.T4_lower.ToDBObject() + " where " + DBExpToshiba.ID + "=" + PID);
            }



            bool success = _myCommunicator.executeTransactedQueries(_queries);
        }
Exemple #4
0
        public static PExpToshiba AnalyseProcess(MonFile File)
        {
            AnalyseResults result;
            PExpToshiba    process = new PExpToshiba();

            process.Date = File.StartTime;

            foreach (var step in File.Steps)
            {
                switch (step.stepnumber)
                {
                case 1:
                    //result = analyse_123(step);
                    process.InputData.V1 = null;
                    break;

                case 2:
                    result = analyse_123(step);

                    process.MachinaData.T_start_lower = result.TminLower;
                    process.MachinaData.T_start_upper = result.TminUpper;

                    process.MachinaData.Tv_lower = result.TmaxLower;
                    process.MachinaData.Tv_upper = result.TmaxUpper;

                    process.MachinaData.Gv_lower = result.TRateLower;
                    process.MachinaData.Gv_upper = result.TRateUpper;

                    process.MachinaData.Gv_lower_quali = result.TRateLowerQuality;
                    process.MachinaData.Gv_upper_quali = result.TRateUpperQuality;

                    process.InputData.Gv = Math.Round((((result.TUpper_Last + result.TLower_Last) / 2) - ((result.TUpper_First + result.TLower_First) / 2)) / result.Duration, 2);
                    process.InputData.Tv = ((result.TUpper_Last + result.TLower_Last) / 2);
                    process.InputData.Z1 = result.Posmax;

                    break;

                case 3:
                    result = analyse_123(step);
                    process.MachinaData.Tvu_lower = result.TminLower;
                    process.MachinaData.Tvu_upper = result.TminUpper;

                    process.MachinaData.T1u_lower = result.TmaxLower;
                    process.MachinaData.T1u_upper = result.TmaxUpper;

                    process.MachinaData.G1_lower = result.TRateLower;
                    process.MachinaData.G1_upper = result.TRateUpper;

                    process.MachinaData.G1_lower_quali = result.TRateLowerQuality;
                    process.MachinaData.G1_upper_quali = result.TRateUpperQuality;

                    process.InputData.G1  = Math.Round((((result.TUpper_Last + result.TLower_Last) / 2) - ((result.TUpper_First + result.TLower_First) / 2)) / result.Duration, 2);
                    process.InputData.Tvu = ((result.TUpper_First + result.TLower_First) / 2);
                    process.InputData.T1u = ((result.TUpper_Last + result.TLower_Last) / 2);

                    break;

                case 4:
                    result = analyse_4567(step);

                    process.MachinaData.T1_lower = result.TmaxLower;
                    process.MachinaData.T1_upper = result.TmaxUpper;
                    process.MachinaData.ST1      = result.Duration;

                    process.InputData.T1  = ((result.TUpper_Last + result.TLower_Last) / 2);
                    process.InputData.ST1 = result.Duration;

                    break;

                case 5:
                    result = analyse_4567(step);

                    process.MachinaData.T_press_av      = (result.TAverageUpper + result.TAverageLower) / 2;
                    process.MachinaData.T_press_G       = (result.TRateUpper + result.TRateLower) / 2;
                    process.MachinaData.T_press_G_quali = (result.TRateUpperQuality + result.TRateLowerQuality) / 2;

                    process.MachinaData.P1  = result.PAverage;
                    process.MachinaData.PT1 = result.PressTime;
                    process.MachinaData.ST2 = result.Duration;

                    process.InputData.P1  = Math.Round(result.PAverage, PressRound);
                    process.InputData.PT1 = result.PressTime;
                    process.InputData.ST2 = result.Duration;
                    process.InputData.V2  = null;
                    process.InputData.Z2  = result.Posmax;
                    break;

                case 6:
                    result = analyse_4567(step);

                    process.MachinaData.P2  = result.PAverage;
                    process.MachinaData.PT1 = result.PressTime;

                    process.MachinaData.G3_lower = result.TRateLower;
                    process.MachinaData.G3_upper = result.TRateUpper;

                    process.MachinaData.G3_lower_quali = result.TRateLowerQuality;
                    process.MachinaData.G3_upper_quali = result.TRateUpperQuality;

                    process.MachinaData.T2_lower = result.TChangeLower;
                    process.MachinaData.T2_upper = result.TChangeUpper;

                    process.InputData.G2 = Math.Round((((result.TUpper_Last + result.TLower_Last) / 2) - ((result.TUpper_First + result.TLower_First) / 2)) / result.Duration, 2);
                    process.InputData.T2 = (result.TChangeLower + result.TChangeUpper) / 2;
                    process.InputData.P2 = Math.Round(result.PAverage, PressRound);

                    break;

                case 7:
                    result = analyse_7(step);
                    process.MachinaData.T5_lower = result.TminLower;
                    process.MachinaData.T5_upper = result.TminUpper;

                    process.MachinaData.T3_lower = result.TmaxLower;
                    process.MachinaData.T3_upper = result.TmaxLower;

                    process.MachinaData.T4_lower = result.TChangeLower;
                    process.MachinaData.T4_upper = result.TChangeUpper;

                    process.MachinaData.G4_lower = result.TRateLower;
                    process.MachinaData.G4_upper = result.TRateUpper;

                    process.MachinaData.G4_lower_quali = result.TRateLowerQuality;
                    process.MachinaData.G4_upper_quali = result.TRateUpperQuality;

                    process.MachinaData.P3 = result.PAverage;

                    process.InputData.T3 = (result.TLower_First + result.TUpper_First) / 2;
                    process.InputData.T4 = (result.TChangeUpper + result.TChangeLower) / 2;
                    process.InputData.T5 = (result.TLower_Last + result.TUpper_Last) / 2;

                    process.InputData.P3 = Math.Round(result.PAverage, 2);

                    break;
                }

                if (process.InputData.Tvu == null)
                {
                    process.InputData.Tvu = process.InputData.Tv;
                }
            }



            return(process);
        }
        public PToshibaVM(PExpToshiba process)
        {
            m_process  = process;
            plotModelT = new OxyPlot.PlotModel();
            plotModelP = new OxyPlot.PlotModel();

            //Inint QualityControls
            if (m_process.UpperWorkpiece != null)
            {
                WP_UpperControl = new Controls.CQuality(process.Workpieces.Find(item => item.ID == m_process.UpperWorkpiece));
            }

            if (m_process.LowerWorkpiece != null)
            {
                WP_LowerControl = new Controls.CQuality(process.Workpieces.Find(item => item.ID == m_process.LowerWorkpiece));
            }
            PV_Control            = new Controls.CPVControl(m_process);
            ProcessQualityControl = new Controls.CProcessQuality(m_process);

            #region Temp
            LineSeries ls = new LineSeries();

            foreach (var step in process.File.Steps)
            {
                ls.StrokeThickness = 0.8;
                ls.Smooth          = true;
                ls.Color           = OxyColors.Red;


                for (int i = 0; i < step.MeasuringPoints.Count; i++)
                {
                    ls.Points.Add(new DataPoint(step.MeasuringPoints[i].TimePass, step.MeasuringPoints[i].LTemp1));
                }
            }

            Temperature.Series.Add(ls);

            plotModelT.PlotMargins      = new OxyThickness(3, 3, 3, 3);
            plotModelT.Padding          = new OxyThickness(3, 3, 3, 3);
            plotModelT.TitleFontSize    = 0;
            plotModelT.SubtitleFontSize = 0;
            plotModelT.TitlePadding     = 0;
            plotModelT.Axes.Clear();

            plotModelT.Axes.Add(new InvisibleAxis {
                Position = AxisPosition.Bottom
            });
            plotModelT.Axes.Add(new InvisibleAxis {
                Position = AxisPosition.Left
            });

            #endregion

            #region force
            ls = new LineSeries();
            foreach (var step in process.File.Steps)
            {
                ls.StrokeThickness = 0.8;
                ls.Smooth          = true;
                ls.Color           = OxyColors.Blue;

                for (int i = 0; i < step.MeasuringPoints.Count; i += 1)
                {
                    ls.Points.Add(new DataPoint(step.MeasuringPoints[i].TimePass, step.MeasuringPoints[i].PressZ));
                }
            }

            Force.Series.Add(ls);

            plotModelP.PlotMargins      = new OxyThickness(3, 3, 3, 3);
            plotModelP.Padding          = new OxyThickness(3, 3, 3, 3);
            plotModelP.TitleFontSize    = 0;
            plotModelP.SubtitleFontSize = 0;
            plotModelP.TitlePadding     = 0;
            plotModelP.Axes.Clear();

            plotModelP.Axes.Add(new InvisibleAxis {
                Position = AxisPosition.Bottom
            });
            plotModelP.Axes.Add(new InvisibleAxis {
                Position = AxisPosition.Left
            });

            #endregion

            m_vm = new MonFileVM(process.File);
        }
        public PToshibaVM(int PID)
        {
            ObjectManager.Instance.update(PDCore.Database.DBGlasses.Table);

            SaveProcess = new RelayCommand(Save, CanSave);

            m_process = ProcessManager.Instance.getProcess(PID, 34) as PExpToshiba;

            //try getting mon-file from local directory
            try
            {
                m_process.File = PDCore.ToshibaImport.IO.getMonFileData(@"Data\Toshiba\" + PID + ".mon");
            }
            catch
            {
                m_process.File = new PDCore.ToshibaImport.MonFile();
            }

            plotModelT = new OxyPlot.PlotModel();
            plotModelP = new OxyPlot.PlotModel();

            //Inint QualityControls
            if (m_process.UpperWorkpiece != null)
            {
                UpperWorkpiece = m_process.Workpieces.Find(item => item.ID == m_process.UpperWorkpiece);
            }
            if (m_process.LowerWorkpiece != null)
            {
                LowerWorkpiece = m_process.Workpieces.Find(item => item.ID == m_process.LowerWorkpiece);
            }

            PV_Control            = new Controls.CPVControl(m_process);
            ProcessQualityControl = new Controls.CProcessQuality(m_process);

            #region Temp
            LineSeries ls = new LineSeries();

            foreach (var step in m_process.File.Steps)
            {
                ls.StrokeThickness = 0.8;
                ls.Smooth          = true;
                ls.Color           = OxyColors.Red;


                for (int i = 0; i < step.MeasuringPoints.Count; i++)
                {
                    ls.Points.Add(new DataPoint(step.MeasuringPoints[i].TimePass, step.MeasuringPoints[i].LTemp1));
                }
            }

            Temperature.Series.Add(ls);

            plotModelT.PlotMargins      = new OxyThickness(3, 3, 3, 3);
            plotModelT.Padding          = new OxyThickness(3, 3, 3, 3);
            plotModelT.TitleFontSize    = 0;
            plotModelT.SubtitleFontSize = 0;
            plotModelT.TitlePadding     = 0;
            plotModelT.Axes.Clear();

            plotModelT.Axes.Add(new InvisibleAxis {
                Position = AxisPosition.Bottom
            });
            plotModelT.Axes.Add(new InvisibleAxis {
                Position = AxisPosition.Left
            });

            #endregion

            #region force
            ls = new LineSeries();
            foreach (var step in m_process.File.Steps)
            {
                ls.StrokeThickness = 0.8;
                ls.Smooth          = true;
                ls.Color           = OxyColors.Blue;

                for (int i = 0; i < step.MeasuringPoints.Count; i += 1)
                {
                    ls.Points.Add(new DataPoint(step.MeasuringPoints[i].TimePass, step.MeasuringPoints[i].PressZ));
                }
            }

            Force.Series.Add(ls);

            plotModelP.PlotMargins      = new OxyThickness(3, 3, 3, 3);
            plotModelP.Padding          = new OxyThickness(3, 3, 3, 3);
            plotModelP.TitleFontSize    = 0;
            plotModelP.SubtitleFontSize = 0;
            plotModelP.TitlePadding     = 0;
            plotModelP.Axes.Clear();

            plotModelP.Axes.Add(new InvisibleAxis {
                Position = AxisPosition.Bottom
            });
            plotModelP.Axes.Add(new InvisibleAxis {
                Position = AxisPosition.Left
            });

            #endregion

            m_vm = new MonFileVM(m_process.File);
        }