private static void saveSurfaces(int cipherDetail, int idCalculation)
        {
            List <Surface> surfaces     = Part.getSurfaces();
            int            countSufaces = Part.getCountSurfaces();

            for (int i = 1; i < countSufaces; i++)
            {
                Surface             surface             = surfaces[i];
                ParametersOfSurface parametersOfSurface = surface.getParametersOfSurface();

                string nameSurface = surface.getNameSurface();

                double diameterOfSurface = parametersOfSurface.getDiameterOfPart();

                int typeOfPart             = parametersOfSurface.getTypeOfPart().getIndex();
                int typeOfAllowance        = parametersOfSurface.getTypeOfAllowance().getIndex();
                int typeOfProcessedSurface = parametersOfSurface.getTypeOfProcessedSurface().getIndex();

                double surfaseRoughness = parametersOfSurface.getSurfaceRoughnessRz();

                double holeDepth = parametersOfSurface.getHoleDepth();
                double tolerance = parametersOfSurface.getAllowance();

                dbConnection.SetQuery($@"INSERT INTO {SURFACE} VALUES ({idCalculation}, '{nameSurface}', {doubleToStringForDb(diameterOfSurface)}, {typeOfPart}, {typeOfAllowance}, {typeOfProcessedSurface}, {doubleToStringForDb(surfaseRoughness)}, {doubleToStringForDb(holeDepth)}, {doubleToStringForDb(tolerance)})");

                int idSurface = getIdentCurrent(SURFACE);

                saveToTableOperationsAndResults(idSurface, surface, idCalculation);
            }
        }
        public static void getSurfacesTreeView(FormResult form)
        {
            try
            {
                TreeNode Surface = new TreeNode();

                List <Surface> surfaces = Part.getSurfaces();

                int count = surfaces.Count;

                for (int i = 1; i < count; i++)
                {
                    form.SurfacesTreeView.Nodes.Add(surfaces[i].getNameSurface());
                }
            }
            catch { }
        }
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();
            }
        }
Beispiel #4
0
        private static void changeIdOperationsInSurfaces(Operation operationInTechnologicalProcess, int idOnTechnologicalProcessNew)
        {
            int            countSurfaces = Part.getCountSurfaces();
            List <Surface> surfaces      = Part.getSurfaces();

            int idOnTechnologicalProcessOld = operationInTechnologicalProcess.getIdOnTechnologicalProcess();

            operationInTechnologicalProcess.setIdOnTechnologicalProcess(idOnTechnologicalProcessNew);

            for (int i = 1; i < countSurfaces; i++)
            {
                Surface surface = surfaces[i];

                foreach (Operation operation in surface.getOperations())
                {
                    if (operation.getIdOnTechnologicalProcess() == idOnTechnologicalProcessOld)
                    {
                        operation.setIdOnTechnologicalProcess(idOnTechnologicalProcessNew);
                    }
                }
            }
        }
Beispiel #5
0
        private static void checkIdOperationsInSurfaces()
        {
            List <Surface> surfaces      = Part.getSurfaces();
            int            countSurfaces = Part.getCountSurfaces();

            for (int i = 1; i < countSurfaces; i++)
            {
                Surface surface = surfaces[i];

                int countOperation = surface.getCountShortListOperation();

                for (int g = 0; g < countOperation; g++)
                {
                    Operation operation = surface.getOperationOnIndex(g);

                    if (!includedInTechnologicalProcess(operation))
                    {
                        surface.deleteOperation(g);
                        g--;
                        countOperation--;
                    }
                }
            }
        }