добавлено чтение с db
This commit is contained in:
BIN
Data/limits.db
Normal file
BIN
Data/limits.db
Normal file
Binary file not shown.
@@ -23,9 +23,7 @@
|
|||||||
th,
|
th,
|
||||||
td,
|
td,
|
||||||
form,
|
form,
|
||||||
h2,
|
h2 {
|
||||||
h3,
|
|
||||||
img {
|
|
||||||
border: 1px solid #ddd;
|
border: 1px solid #ddd;
|
||||||
padding: 8px;
|
padding: 8px;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
@@ -38,7 +36,6 @@
|
|||||||
</style>
|
</style>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
<table border="1">
|
<table border="1">
|
||||||
<caption>
|
<caption>
|
||||||
<h2>Расчет размеров поковки</h2>
|
<h2>Расчет размеров поковки</h2>
|
||||||
@@ -191,10 +188,10 @@
|
|||||||
</thead>
|
</thead>
|
||||||
</table>
|
</table>
|
||||||
<br>
|
<br>
|
||||||
<h3>Результат без пробы</h3>
|
<h2>Результат без пробы</h2>
|
||||||
<p class="aligncenter"><img src="/images/Result_WithoutBlank.png" alt="Результат без пробы"></p>
|
<p class="aligncenter"><img src="/images/Result_WithoutBlank.png" alt="Результат без пробы"></p>
|
||||||
<br>
|
<br>
|
||||||
<h3>Результат с пробой</h3>
|
<h2>Результат с пробой</h2>
|
||||||
<p class="aligncenter"><img src="/images/Result_WithBlank.png" alt="Результат с пробой"></p>
|
<p class="aligncenter"><img src="/images/Result_WithBlank.png" alt="Результат с пробой"></p>
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
|
|||||||
@@ -1,10 +1,9 @@
|
|||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.Data.Sqlite;
|
||||||
using Microsoft.AspNetCore.Mvc.RazorPages;
|
using Microsoft.AspNetCore.Mvc.RazorPages;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using System.Drawing.Drawing2D;
|
|
||||||
using System.Drawing.Imaging;
|
using System.Drawing.Imaging;
|
||||||
using System.Drawing.Text;
|
using System.Drawing.Text;
|
||||||
using System.IO;
|
|
||||||
|
|
||||||
public class ResultsModel : PageModel
|
public class ResultsModel : PageModel
|
||||||
{
|
{
|
||||||
@@ -205,6 +204,33 @@ public class ResultsModel : PageModel
|
|||||||
ResultImage("Result_WithBlank", mDisk_nom_2_O, mDisk_max_2_O, _dd, d_BilletWithBlank, limit6, _H, H_BilletWithBlank, _D, D_BilletWithBlank, limit4);
|
ResultImage("Result_WithBlank", mDisk_nom_2_O, mDisk_max_2_O, _dd, d_BilletWithBlank, limit6, _H, H_BilletWithBlank, _D, D_BilletWithBlank, limit4);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public (int Delta, int Tolerance) SearchLimit(double D, double H)
|
||||||
|
{
|
||||||
|
using var connection = new SqliteConnection("Data Source=tolerances.db");
|
||||||
|
connection.Open();
|
||||||
|
|
||||||
|
var command = connection.CreateCommand();
|
||||||
|
command.CommandText = @"
|
||||||
|
SELECT Delta, Tolerance
|
||||||
|
FROM Tolerances
|
||||||
|
WHERE @height > HeightFrom
|
||||||
|
AND @height <= HeightTo
|
||||||
|
AND @diameter > DiameterFrom
|
||||||
|
AND @diameter <= DiameterTo
|
||||||
|
LIMIT 1";
|
||||||
|
|
||||||
|
command.Parameters.AddWithValue("@height", H);
|
||||||
|
command.Parameters.AddWithValue("@diameter", D);
|
||||||
|
|
||||||
|
using var reader = command.ExecuteReader();
|
||||||
|
if (reader.Read())
|
||||||
|
{
|
||||||
|
return (reader.GetInt32(0), reader.GetInt32(1));
|
||||||
|
}
|
||||||
|
return (-1, -1);
|
||||||
|
}
|
||||||
|
/*
|
||||||
private (int, int) SearchLimit(double D, double H)
|
private (int, int) SearchLimit(double D, double H)
|
||||||
{
|
{
|
||||||
// Диапазоны высоты H
|
// Диапазоны высоты H
|
||||||
@@ -291,7 +317,7 @@ public class ResultsModel : PageModel
|
|||||||
|
|
||||||
return limits[hIndex, dIndex];
|
return limits[hIndex, dIndex];
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
private string ResultImage(string imageName, double weightNom, double weightMax, double d, double d_Billet,
|
private string ResultImage(string imageName, double weightNom, double weightMax, double d, double d_Billet,
|
||||||
double limit5, double H, double H_Billet, double D, double D_Billet, double limit3)
|
double limit5, double H, double H_Billet, double D, double D_Billet, double limit3)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -7,11 +7,6 @@ builder.Services.AddRazorPages(options =>
|
|||||||
options.Conventions.ConfigureFilter(new IgnoreAntiforgeryTokenAttribute());
|
options.Conventions.ConfigureFilter(new IgnoreAntiforgeryTokenAttribute());
|
||||||
});
|
});
|
||||||
|
|
||||||
builder.WebHost.ConfigureKestrel(serverOptions =>
|
|
||||||
{
|
|
||||||
serverOptions.ListenAnyIP(5146);
|
|
||||||
});
|
|
||||||
|
|
||||||
var app = builder.Build();
|
var app = builder.Build();
|
||||||
app.MapRazorPages();
|
app.MapRazorPages();
|
||||||
app.UseStaticFiles();
|
app.UseStaticFiles();
|
||||||
|
|||||||
@@ -7,6 +7,7 @@
|
|||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<PackageReference Include="Microsoft.Data.Sqlite" Version="9.0.7" />
|
||||||
<PackageReference Include="System.Drawing.Common" Version="9.0.7" />
|
<PackageReference Include="System.Drawing.Common" Version="9.0.7" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user