private static void insertOperationsOnReachBox(FormResult form, int index)
        {
            int  typeOfPart = Part.getSurfaceOnIndex(index).getParametersOfSurface().getTypeOfPart().getIndex();
            char type;

            if (typeOfPart == 0)
            {
                type = '-';
            }
            else
            {
                type = '+';
            }

            ClassesToCalculate.ResultsOfCalculation resultWorkpiece = Part.getWorkpiece().getResultsOfCalculation();


            form.richTextBoxResult.Text = "Исходные данные: " + Part.getWorkpiece().getNameOfWorkpiece() + "\nСоставляющая припуска P= " + resultWorkpiece.getSpatialDeviation().ToString() + "\nРазмер= " + resultWorkpiece.getSizeOfWorkprieceAfterOperation().ToString() + "(" + type + Part.getWorkpiece().getResultsOfCalculation().getAccuracies() + ")";

            for (int i = 0; i < Part.getSurfaceOnIndex(index).getCountLongListOperation(); i++)
            {
                resultWorkpiece = Part.getSurfaceOnIndex(index).getParametersOperation()[i].getResultsOfCalculation();

                form.richTextBoxResult.Text += "\n" + i.ToString() + ") ";
                form.richTextBoxResult.Text += Part.getSurfaceOnIndex(index).getParametersOperation()[i].getNameOperation();
                form.richTextBoxResult.Text += "\nСоставляющая припуска E= " + resultWorkpiece.getdeviationOfInstallation().ToString() + "\nСоставляющая припуска P= " + resultWorkpiece.getSpatialDeviation().ToString() + "\nВеличина номинального припуска Znom= " + resultWorkpiece.getNominalAllowance().ToString() + "\nРазмер= " + resultWorkpiece.getSizeOfWorkprieceAfterOperation().ToString() + "(" + type + resultWorkpiece.getAccuracies() + ")";
            }
        }
        private ClassesToCalculate.ResultsOfCalculation[] getResultsOfCalculation()
        {
            int numberOfOperations = this.parametersForCalculation.getNumberOfOperations();

            double tolerance = parametersOfPart.getAllowance();

            if (tolerance == 0)
            {
                tolerance = accuracies[numberOfOperations - 1];
            }
            else
            {
                accuracies[numberOfOperations - 1] = parametersOfPart.getAllowance();
            }

            this.rounding(tolerance);

            ClassesToCalculate.ResultsOfCalculation[] resultsOfCalculation = new ClassesToCalculate.ResultsOfCalculation[numberOfOperations];

            for (int i = 0; i < numberOfOperations; i++)
            {
                resultsOfCalculation[i] = new ClassesToCalculate.ResultsOfCalculation(accuracies[i], spatialDeviationP[i], deviationOfInstallationE[i], nominalAllowanceZnom[i], sizeOfWorkprieceAfterOperation[i]);
            }

            return(resultsOfCalculation);
        }
Beispiel #3
0
        private void buttonSaveToDisk_Click(object sender, EventArgs e)
        {
            SaveFileDialog sfd = new SaveFileDialog();

            sfd.Filter = "Текстовый документ (*.txt)|*.txt|Все файлы (*.*)|*.*";
            List <Surface> surfaces = Part.getSurfaces();

            int count = surfaces.Count;

            if (sfd.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                StreamWriter sw = new StreamWriter(sfd.FileName);

                int  typeOfPart = Part.getParametersOfPart().getTypeOfPart().getIndex();
                char type;

                if (typeOfPart == 0)
                {
                    type = '-';
                }
                else
                {
                    type = '+';
                }

                ClassesToCalculate.ResultsOfCalculation resultWorkpiece = Part.getWorkpiece().getResultsOfCalculation();


                sw.WriteLine("Исходные данные: " + Part.getWorkpiece().getNameOfWorkpiece() + "\nСоставляющая припуска P= " + resultWorkpiece.getSpatialDeviation().ToString() + "\nРазмер= " + resultWorkpiece.getSizeOfWorkprieceAfterOperation().ToString() + "(" + type + Part.getWorkpiece().getResultsOfCalculation().getAccuracies() + ")");

                for (int index = 0; index < count; index++)
                {
                    for (int i = 0; i < Part.getSurfaceOnIndex(index).getCountLongListOperation(); i++)
                    {
                        resultWorkpiece = Part.getSurfaceOnIndex(index).getParametersOperation()[i].getResultsOfCalculation();

                        sw.WriteLine("\n" + i.ToString() + ") ");
                        sw.WriteLine(Part.getSurfaceOnIndex(index).getParametersOperation()[i].getNameOperation());
                        sw.WriteLine("\nСоставляющая припуска E= " + resultWorkpiece.getdeviationOfInstallation().ToString() + "\nСоставляющая припуска P= " + resultWorkpiece.getSpatialDeviation().ToString() + "\nВеличина номинального припуска Znom= " + resultWorkpiece.getNominalAllowance().ToString() + "\nРазмер= " + resultWorkpiece.getSizeOfWorkprieceAfterOperation().ToString() + "(" + type + resultWorkpiece.getAccuracies() + ")");
                    }
                }

                sw.Close();
            }
        }
        private static void saveToTableOfOperations(FormSaveToDataBase form, int index)
        {
            Surface surface = Part.getSurfaceOnIndex(0);

            List <ParametersOperation> parametersOperations = surface.getParametersOperation();

            int numberOfOperation = surface.getCountLongListOperation();

            for (int i = 0; i < numberOfOperation; i++)
            {
                ParametersOperation parametersOperation = parametersOperations[i];

                ClassesToCalculate.ResultsOfCalculation resultsOfCalculation = parametersOperation.getResultsOfCalculation();

                string nameOperation = parametersOperation.getTypeOfMachining() + ',' + parametersOperation.getPrecisionOfMachining();

                //  form.переходыTableAdapter.Insert(Convert.ToInt16(form.dataGridView1[0, index - 1].Value.ToString()) + 1, i + 1, nameOperation, parametersOperation.getTypeOfInstrument(), (float)parametersOperation.getSurfaceRoughnessRz(), (float)parametersOperation.getThicknessOfDefectiveCoating(), (float)resultsOfCalculation.getSpatialDeviation(), (float)resultsOfCalculation.getdeviationOfInstallation(), (float)resultsOfCalculation.getAccuracies(), (float)resultsOfCalculation.getNominalAllowance(), (float)resultsOfCalculation.getSizeOfWorkprieceAfterOperation(), parametersOperation.getIdOperation(), null, (float)parametersOperation.getCoefficientOfRefinement(), (int)parametersOperation.getKvalitet());
            }
        }
 public void setResultsOfCalculation(ClassesToCalculate.ResultsOfCalculation resultsOfCalculation)
 {
     this.resultsOfCalculation = resultsOfCalculation;
 }