Esempio n. 1
0
        private void BuildPanel()
        {
            var mat1Code = "";
            var mat2Code = "";

            var viewRowMat1 = (DataRowView) MaterialP1.SelectedItem;
            var row1 = viewRowMat1.Row;
            if (row1 != null)
                mat1Code = row1.Field<string>("CodeMaterial");
            var viewRowMat2 = (DataRowView) MaterialP2.SelectedItem;
            var row2 = viewRowMat2.Row;
            if (row2 != null)
                mat2Code = row2.Field<string>("CodeMaterial");


            var materialP1 = new[] {MaterialP1.SelectedValue.ToString(), ТолщинаВнешней.Text, MaterialP1.Text, mat1Code};
            var materialP2 = new[] {MaterialP2.SelectedValue.ToString(), ТолщинаВннутренней.Text, MaterialP2.Text, mat2Code};           


            var thicknessOfPanel = ((ComboBoxItem) TypeOfPanel.SelectedItem).Content.ToString().Remove(2);

            //MessageBox.Show(thicknessOfPanel);

            #region VentsCadLibrary

            //MessageBox.Show(Ral1.SelectedValue + " " + CoatingType1.Text, CoatingClass1.Text);

            //var vcad = new VentsCadLibrary.VentsCad
            //{
            //    ConnectionToSql = Settings.Default.ConnectionToSQL,
            //    DestVaultName = Settings.Default.TestPdmBaseName,
            //    VaultName = Settings.Default.PdmBaseName
            //};

            //MessageBox.Show(TypeOfPanel50.SelectedValue 
            //    + " \n " + TypeOfPanel50.Text
            //    + " \n " + Ral1.Text
            //    + " \n " + CoatingType1.Text
            //    + " \n " + CoatingClass1.Text
            //    );

            //vcad.Panels50(
            //    typeOfPanel: new[] { TypeOfPanel50.SelectedValue.ToString(), TypeOfPanel50.Text },
            //    width: WidthPanel.Text,
            //    lenght: HeightPanel.Text,
            //    materialP1: materialP1,
            //    materialP2: materialP2,
            //    покрытие: new[]
            //    {
            //        Ral1.Text, CoatingType1.Text, CoatingClass1.Text,
            //        Ral2.Text, CoatingType2.Text, CoatingClass2.Text,
            //        Ral1.SelectedValue?.ToString() ?? "",
            //        Ral2.SelectedValue?.ToString() ?? ""
            //    },
            //    onlyPath: false);

            #endregion

            var sw = new ModelSw();

            switch (thicknessOfPanel)
            {
                case "30":
                    string path;
                    sw.Panels30Build(
                        typeOfPanel:
                            new[] {TypeOfPanel50.SelectedValue.ToString(), TypeOfPanel50.Text, thicknessOfPanel},
                        width: WidthPanel.Text,
                        height: HeightPanel.Text,
                        materialP1: materialP1,
                        materialP2: materialP2,
                        покрытие: null,
                        //покрытие: new[]
                        //{
                        //    Ral1.Text, CoatingType1.Text, CoatingClass1.Text,
                        //    Ral2.Text, CoatingType2.Text, CoatingClass2.Text,
                        //    Ral1.SelectedValue?.ToString() ?? "",
                        //    Ral2.SelectedValue?.ToString() ?? ""
                        //},
                        path: out path);
                    break;
                case "50":
                case "70":
                    sw.Panels50Build(
                        typeOfPanel: new[] {TypeOfPanel50.SelectedValue.ToString(), TypeOfPanel50.Text, thicknessOfPanel},
                        width: WidthPanel.Text,
                        height: HeightPanel.Text,
                        materialP1: materialP1,
                        meterialP2: materialP2,
                        покрытие: null
                        //покрытие: new[]
                        //{
                        //    Ral1.Text, CoatingType1.Text, CoatingClass1.Text,
                        //    Ral2.Text, CoatingType2.Text, CoatingClass2.Text,
                        //    Ral1.SelectedValue?.ToString() ?? "",
                        //    Ral2.SelectedValue?.ToString() ?? ""
                        //}
                        );
                    break;
            }
        }
        void ExportToXml()
        {
            if (IsBusy) return;

            try
            {
                Busy = $"Выгрузка {CurrentModel}";                
                if (!OnlyParts)
                {
                    if (!ПутьКСборке.ToLower().EndsWith("dprt"))                    
                    {
                        List<Exception> excptions;
                        PdmAsmBomToXml.AsmBomToXml.ВыгрузкаСборкиВXml(ПутьКСборке, out excptions);
                    }
                }
            }
            catch (Exception)
            {
              //  MessageBox.Show(exception.StackTrace);
            }            

            GetFiles(ListToRun.Where(newComponent => !newComponent.Xml), out _pdmFilesAfterGet);

           // var list = _pdmFilesAfterGet.Where(x => !x.Equal).ToList();

            //var sf = "";

            //foreach (var item in list)
            //{
            //    sf  = sf + "\nName - " + item.FileName + " Path - " + item.FilePath + " VerBG - " + item.VersionBeforeGet + " VerAG - " + item.VersionBeforeGet;
            //}

            //MessageBox.Show(sf, list?.Count.ToString());


            try
            {
                foreach (var newComponent in ListToRun.Where(newComponent => !newComponent.Xml))
                {
                    using (var modelSw = new ModelSw())
                    {
                        try
                        {
                            Exception exception;
                            ExportXmlSql.Export(modelSw.GetSwWithPart(newComponent.Путь), newComponent.CurrentVersion, (int)newComponent.IdPmd, out exception);
                            if (exception != null)
                            {
                                MessageBox.Show(exception.Message);
                            }
                            //modelSw.ExitSw();
                        }
                        catch (Exception ex )
                        {
                            MessageBox.Show(ex.Message);
                        }                        
                    }
                }
            }
            catch (Exception exception)
            {
                MessageBox.Show(exception.StackTrace);
            }
            MessageBox.Show($"Выгрузка {Path.GetFileNameWithoutExtension(ПутьКСборке)} завершена");
            Busy = null;
        }