From dc68787b0b1cc1ec34794e3f5a2f8a51b68db9bd Mon Sep 17 00:00:00 2001 From: KhasanovAMdev Date: Wed, 9 Jul 2025 16:15:14 +0400 Subject: [PATCH] Add project files. --- Pages/Index.cshtml | 40 +++++++++ Pages/Index.cshtml.cs | 160 +++++++++++++++++++++++++++++++++ Program.cs | 14 +++ Properties/launchSettings.json | 38 ++++++++ SumCalculator.csproj | 9 ++ SumCalculator.sln | 25 ++++++ appsettings.Development.json | 8 ++ appsettings.json | 9 ++ 8 files changed, 303 insertions(+) create mode 100644 Pages/Index.cshtml create mode 100644 Pages/Index.cshtml.cs create mode 100644 Program.cs create mode 100644 Properties/launchSettings.json create mode 100644 SumCalculator.csproj create mode 100644 SumCalculator.sln create mode 100644 appsettings.Development.json create mode 100644 appsettings.json diff --git a/Pages/Index.cshtml b/Pages/Index.cshtml new file mode 100644 index 0000000..a1b8139 --- /dev/null +++ b/Pages/Index.cshtml @@ -0,0 +1,40 @@ +@page +@model IndexModel + +

Модель расчета поковок кольцо раскатное

+
+

+
+ +

+

+
+ +

+

+
+ +

+

+
+ +

+

+
+ +

+

+
+ +

+

+
+ +

+

+
+ +

+ +
\ No newline at end of file diff --git a/Pages/Index.cshtml.cs b/Pages/Index.cshtml.cs new file mode 100644 index 0000000..50502de --- /dev/null +++ b/Pages/Index.cshtml.cs @@ -0,0 +1,160 @@ +using Microsoft.AspNetCore.Mvc.RazorPages; + +public class IndexModel : PageModel +{ + public double D { get; private set; } + public double dd { get; private set; } + public double H { get; private set; } + public double x { get; private set; } + public double y { get; private set; } + public double z { get; private set; } + public double Q { get; private set; } + public double onTO { get; private set; } + + public double h1 { get; private set; } + public double h2 { get; private set; } + + public void OnPost(double D, double dd, double H, double x, double y, double z, double Q, double onTO) + { + h1 = H * x + (y * z) + onTO; + h2 = H * x + (y * z) + Q + onTO; + + #region Расчет размеров поковки + + // H заготовки = (Н1+б)+-∆/2 + // Размер + double H_Billet = h1 + SearchLimit(D, h1).Item1; + // Допуск на размер +- + int limit1 = SearchLimit(D, h1).Item2; + + // H заготовки с пробой = (Н2+б)+-∆/2 + double H_BilletWithBlank = h2 + SearchLimit(D, h2).Item1; + // Допуск на размер +- + int limit2 = SearchLimit(D, h2).Item2; + + // D дет = D+напуск на ТО + double D_Detail = D + onTO; + + // D заг = (D+б)+-∆/2+напуск на ТО + double D_Billet = D_Detail + SearchLimit(D, h1).Item1 + onTO; + int limit3 = SearchLimit(D, h1).Item2; + + // D заг с пробой= (D+б)+-∆/2+напуск на ТО + double D_BilletWithBlank = D_Detail + SearchLimit(D, h2).Item1 + onTO; + int limit4 = SearchLimit(D, h2).Item2; + + // d дет=d-напуск на ТО + double d_Detail = dd + onTO; + + // d заг =(dдет-б)+-3б + double d_Billet = d_Detail - SearchLimit(D, h1).Item1; + int limit5 = SearchLimit(D, h1).Item2 * 3; + + //d заг с пробой =(dдет-б)+-3б + double d_BilletWithBlank = d_Detail - SearchLimit(D, h2).Item1; + int limit6 = SearchLimit(D, h2).Item2 * 3; + + #endregion + + #region Расчет массы поковки без пробы + + // Диск номинал + double D_calc = + + + #endregion + + #region Расчет массы поковки c пробой + + #endregion + + } + + private (int, int) SearchLimit(double D, double H) + { + // Диапазоны высоты H + double[] heightRanges = new double[] + { + 100, 150, 200, 250, 315, 400, 500, 630, 800, 1000, 1250, 1400, 1600, 1800, 2000, 2250, 2500 + }; + + // Диапазоны диаметра D + double[] diameterRanges = new double[] + { + 499, 500, 630, 800, 1000, 1250, 1400, 1600, 1800, 2000, 2250, 2500, 2800, 3150, 3500, 4000, 4500, 5000 + }; + + + (int, int)[,] limits = new (int, int)[,] + { + // Св. 100 до 150 включ. + { (24,9), (25,9), (27,10), (-1,-1), (-1,-1), (-1,-1), (-1,-1), (-1,-1), (-1,-1), (-1,-1), (-1,-1), (-1,-1), (-1,-1), (-1,-1), (-1,-1), (-1,-1), (-1,-1) }, + + // Св. 150 до 200 + { (24,9), (25,9), (27,10), (29,11), (31,11), (35,13), (-1,-1), (-1,-1), (-1,-1), (-1,-1), (-1,-1), (-1,-1), (-1,-1), (-1,-1), (-1,-1), (-1,-1), (-1,-1) }, + + // Св. 200 до 250 + { (25,9), (26,9), (28,10), (30,11), (32,12), (36,13), (38,14), (40,15), (-1,-1), (-1,-1), (-1,-1), (-1,-1), (-1,-1), (-1,-1), (-1,-1), (-1,-1), (-1,-1) }, + + // Св. 250 до 315 + { (27,10), (28,10), (30,11), (32,12), (34,13), (38,14), (41,15), (44,16), (47,18), (51,19), (-1,-1), (-1,-1), (-1,-1), (-1,-1), (-1,-1), (-1,-1), (-1,-1) }, + + // Св. 315 до 400 + { (28,10), (29,11), (31,11), (33,12), (35,13), (40,15), (42,16), (46,17), (49,19), (53,20), (57,21), (61,23), (-1,-1), (-1,-1), (-1,-1), (-1,-1), (-1,-1) }, + + // Св. 400 до 500 + { (29,11), (30,11), (31,11), (34,13), (36,13), (41,15), (44,16), (48,18), (51,19), (55,21), (59,22), (63,24), (67,25), (71,27), (-1,-1), (-1,-1), (-1,-1) }, + + // Св. 500 до 630 + { (30,11), (31,11), (33,12), (35,13), (37,14), (43,16), (46,17), (50,19), (53,20), (57,21), (61,23), (65,25), (69,26), (75,28), (80,30), (95,37), (-1,-1) }, + + // Св. 630 до 800 + { (-1,-1), (33,12), (36,13), (38,14), (41,15), (46,17), (50,19), (54,20), (57,21), (61,23), (65,25), (71,27), (77,29), (83,31), (89,34), (98,39), (105,43) }, + + // Св. 800 до 1000 + { (-1,-1), (-1,-1), (37,14), (40,15), (43,16), (48,18), (52,20), (56,21), (59,22), (63,24), (68,26), (74,28), (80,30), (86,33), (92,36), (101,41), (108,46) }, + + // Св. 1000 до 1250 + { (-1,-1), (-1,-1), (-1,-1), (44,16), (46,17), (52,20), (56,21), (60,23), (64,24), (68,26), (74,28), (81,30), (86,33), (92,36), (98,39), (105,43), (112,48) }, + + // Св. 1250 до 1400 + { (-1,-1), (-1,-1), (-1,-1), (-1,-1), (47,18), (54,20), (58,22), (62,23), (67,25), (72,27), (78,29), (83,31), (89,34), (95,37), (101,41), (108,45), (115,50) }, + + // Св. 1400 до 1600 + { (-1,-1), (-1,-1), (-1,-1), (-1,-1), (48,18), (56,21), (60,23), (65,24), (69,26), (75,28), (81,30), (87,34), (93,36), (99,39), (104,42), (110,47), (119,51) }, + + // Св. 1600 до 1800 + { (-1,-1), (-1,-1), (-1,-1), (-1,-1), (-1,-1), (58,22), (63,23), (67,25), (73,27), (79,29), (85,33), (91,35), (97,38), (102,41), (106,43), (113,48), (120,52) }, + + // Св. 1800 до 2000 + { (-1,-1), (-1,-1), (-1,-1), (-1,-1), (-1,-1), (-1,-1), (64,23), (68,25), (75,28), (81,30), (87,34), (92,36), (98,38), (103,41), (107,43), (115,50), (121,52) }, + + // Св. 2000 до 2250 + { (-1,-1), (-1,-1), (-1,-1), (-1,-1), (-1,-1), (-1,-1), (-1,-1), (69,26), (76,28), (82,30), (88,34), (94,37), (100,40), (104,42), (110,47), (116,50), (122,52) }, + + // Св. 2250 до 2500 + { (-1,-1), (-1,-1), (-1,-1), (-1,-1), (-1,-1), (-1,-1), (-1,-1), (-1,-1), (82,30), (85,32), (91,35), (97,38), (100,41), (108,43), (114,49), (119,51), (125,53) } + }; + + int FindIndex(double val, double[] ranges) + { + for (int i = 0; i < ranges.Length; i++) + { + if (val <= ranges[i]) + return i - 1; + } + return -1; + } + + int hIndex = FindIndex(H, heightRanges); + int dIndex = FindIndex(D, diameterRanges); + if (D < 499) + dIndex = 0; + + if (hIndex == -1 || dIndex == -1) + return (-1, -1); + + return limits[hIndex, dIndex]; + } +} + diff --git a/Program.cs b/Program.cs new file mode 100644 index 0000000..9fed10d --- /dev/null +++ b/Program.cs @@ -0,0 +1,14 @@ +using Microsoft.AspNetCore.Mvc; + +var builder = WebApplication.CreateBuilder(args); + +builder.Services.AddRazorPages(options => +{ + options.Conventions.ConfigureFilter(new IgnoreAntiforgeryTokenAttribute()); +}); + +var app = builder.Build(); + +app.MapRazorPages(); + +app.Run(); \ No newline at end of file diff --git a/Properties/launchSettings.json b/Properties/launchSettings.json new file mode 100644 index 0000000..d7f8156 --- /dev/null +++ b/Properties/launchSettings.json @@ -0,0 +1,38 @@ +{ + "$schema": "http://json.schemastore.org/launchsettings.json", + "iisSettings": { + "windowsAuthentication": false, + "anonymousAuthentication": true, + "iisExpress": { + "applicationUrl": "http://localhost:11414", + "sslPort": 44344 + } + }, + "profiles": { + "http": { + "commandName": "Project", + "dotnetRunMessages": true, + "launchBrowser": true, + "applicationUrl": "http://localhost:5146", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + }, + "https": { + "commandName": "Project", + "dotnetRunMessages": true, + "launchBrowser": true, + "applicationUrl": "https://localhost:7106;http://localhost:5146", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + }, + "IIS Express": { + "commandName": "IISExpress", + "launchBrowser": true, + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + } + } +} diff --git a/SumCalculator.csproj b/SumCalculator.csproj new file mode 100644 index 0000000..1b28a01 --- /dev/null +++ b/SumCalculator.csproj @@ -0,0 +1,9 @@ + + + + net8.0 + enable + enable + + + diff --git a/SumCalculator.sln b/SumCalculator.sln new file mode 100644 index 0000000..b705000 --- /dev/null +++ b/SumCalculator.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.14.36203.30 d17.14 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SumCalculator", "SumCalculator.csproj", "{D0BEB4F5-C30C-497E-94A7-88F1D4EDA4D3}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {D0BEB4F5-C30C-497E-94A7-88F1D4EDA4D3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D0BEB4F5-C30C-497E-94A7-88F1D4EDA4D3}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D0BEB4F5-C30C-497E-94A7-88F1D4EDA4D3}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D0BEB4F5-C30C-497E-94A7-88F1D4EDA4D3}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {0228A780-4353-439C-BDDC-ED3ABEE9D0BD} + EndGlobalSection +EndGlobal diff --git a/appsettings.Development.json b/appsettings.Development.json new file mode 100644 index 0000000..0c208ae --- /dev/null +++ b/appsettings.Development.json @@ -0,0 +1,8 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.AspNetCore": "Warning" + } + } +} diff --git a/appsettings.json b/appsettings.json new file mode 100644 index 0000000..10f68b8 --- /dev/null +++ b/appsettings.json @@ -0,0 +1,9 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.AspNetCore": "Warning" + } + }, + "AllowedHosts": "*" +}