0
0

Compare commits

..

No commits in common. "ef35ac999025339e779f95ab07a1f6ae4ea3fe95" and "06c520633e9ee86f12e8d5ae6942afd5bcb66554" have entirely different histories.

17 changed files with 93 additions and 187 deletions

40
.vscode/launch.json vendored Normal file
View File

@ -0,0 +1,40 @@
{
"version": "0.2.0",
"configurations": [
{
// Use IntelliSense to find out which attributes exist for C# debugging
// Use hover for the description of the existing attributes
// For further information visit https://github.com/OmniSharp/omnisharp-vscode/blob/master/debugger-launchjson.md
"name": ".NET Core Launch (web)",
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build",
// If you have changed target frameworks, make sure to update the program path.
"program": "${workspaceFolder}/RhSolutions.Api/bin/Debug/net6.0/RhSolutions.Api.dll",
"args": [],
"cwd": "${workspaceFolder}/RhSolutions.Api",
"stopAtEntry": false,
// Enable launching a web browser when ASP.NET Core starts. For more information: https://aka.ms/VSCode-CS-LaunchJson-WebBrowser
// "serverReadyAction": {
// "action": "openExternally",
// "pattern": "\\bNow listening on:\\s+(https?://\\S+)"
// },
"env": {
"ASPNETCORE_ENVIRONMENT": "Development",
"DB_HOST": "localhost",
"DB_PORT": "5432",
"DB_USER": "user",
"DB_PASSWORD": "password",
"DB_DATABASE": "database"
},
"sourceFileMap": {
"/Views": "${workspaceFolder}/Views"
}
},
{
"name": ".NET Core Attach",
"type": "coreclr",
"request": "attach"
}
]
}

41
.vscode/tasks.json vendored Normal file
View File

@ -0,0 +1,41 @@
{
"version": "2.0.0",
"tasks": [
{
"label": "build",
"command": "dotnet",
"type": "process",
"args": [
"build",
"${workspaceFolder}/RhSolutions.Api/RhSolutions.Api.csproj",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
],
"problemMatcher": "$msCompile"
},
{
"label": "publish",
"command": "dotnet",
"type": "process",
"args": [
"publish",
"${workspaceFolder}/RhSolutions.Api/RhSolutions.Api.csproj",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
],
"problemMatcher": "$msCompile"
},
{
"label": "watch",
"command": "dotnet",
"type": "process",
"args": [
"watch",
"run",
"--project",
"${workspaceFolder}/RhSolutions.Api/RhSolutions.Api.csproj"
],
"problemMatcher": "$msCompile"
}
]
}

View File

@ -1,6 +1,7 @@
using System.Web;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.Primitives;
using RhSolutions.Api.Services;
public abstract class ProductQueryModifierTests
{
protected ProductQueryModifierFactory _factory;

View File

@ -7,11 +7,6 @@ public class RautitanFittingsTests : ProductQueryModifierTests
public void SleeveTest(string query, string modified)
=> Execute(productType: "Монтажная гильза", query, modified);
[TestCase("Фиксирующий желоб для ПЭ-трубы 16", "Фиксирующий желоб для ПЭ-трубы 16/17")]
[TestCase("Фиксирующий желоб для ПЭ-трубы 20", "Фиксирующий желоб для ПЭ-трубы 20")]
public void SupportingClipTest(string query, string modified)
=> Execute(productType: "Желоб", query, modified);
[TestCase("Тройник 20-16-16", "Тройник RAUTITAN -PLATINUM 20-16-16")]
[TestCase("Тройник 20x16x16", "Тройник RAUTITAN -PLATINUM 20-16-16")]
public void TPieceTest(string query, string modified)
@ -75,11 +70,6 @@ public class RautitanFittingsTests : ProductQueryModifierTests
public void ThreadElbowWallInternalTest(string query, string modified)
=> Execute(productType: "Угольник настенный внутренний", query, modified);
[TestCase("Проточный настенный угольник 16/16-Rp 1/2 длинный RX+", "Проточный настенный угольник 16/16-Rp 1/2 длинный")]
[TestCase("Проточный настенный угольник 16/16-Rp 1/2 короткий RX+", "Проточный настенный угольник 16/16-Rp 1/2 короткий")]
public void ThreadElbowDoubleWallInternalTest(string query, string modified)
=> Execute(productType: "Проточный настенный угольник", query, modified);
[TestCase("Трубка из. нерж. стали для подкл. радиатора, Г-образная 16/250", "Трубка Г-образная 16/250")]
[TestCase("Монтажная трубка для радиатора, конечная, 16 х 15 х 300 мм", "Трубка Г-образная 16/250")]
public void ConnectionBendTest(string query, string modified)
@ -89,34 +79,4 @@ public class RautitanFittingsTests : ProductQueryModifierTests
[TestCase("Монтажная трубка для радиатора, проходная 20 х 15 х 300 мм", "Трубка Т-образная 20/250")]
public void ConnectionTeeTest(string query, string modified)
=> Execute(productType: "Трубка Т-образная", query, modified);
[TestCase("Заглушка для полимерн. трубы 16 RX+", "Заглушка для полимерн. трубы 16")]
[TestCase("Заглушка 20", "Заглушка для полимерн. трубы 20")]
[TestCase("Заглушка, 16, латунь", "Заглушка для полимерн. трубы 16")]
public void DummyPlugTest(string query, string modified)
=> Execute(productType: "Заглушка труб RAUTITAN", query, modified);
[TestCase("Концовка разб. 3/4'' (еврок) для универс. трубы 16", "Резьбозажимное соединение flex/pink 16х2,2xG3/4")]
[TestCase("Переходник компрессионный PEX 20х2.8-G 3/4\" Евроконус", "Резьбозажимное соединение flex/pink 20х2,8xG3/4")]
[TestCase("Резьбозажимное соединение flex/pink 20х2,8xG3/4", "Резьбозажимное соединение flex/pink 20х2,8xG3/4")]
public void EuroconeFlexTest(string query, string modified)
=> Execute(productType: "Резьбозажимное flex", query, modified);
[TestCase("Резьбозажимное соединение stabil 16,2x2,6xG3/4", "Резьбозажимное соединение stabil 16,2x2,6xG3/4")]
[TestCase("Резьбозажимное соединение stabil 20x2,9xG3/4", "Резьбозажимное соединение stabil 20x2,9xG3/4")]
[TestCase("Концовка разб.3/4''(еврок.) для PE-Xc и PE-MDXс 16", "Резьбозажимное соединение stabil 16,2x2,6xG3/4")]
public void EuroconeStabilTest(string query, string modified)
=> Execute(productType: "Резьбозажимное stabil", query, modified);
[TestCase("Переходник на евроконус 16-G 3/4", "Переходник на евроконус 16-G 3/4")]
[TestCase("Соед.прям. с вн.резьбой (н.гайка, еврок.) 16 ник.", "Переходник на евроконус 16-G 3/4")]
[TestCase("Переходник с накидной гайкой 16x2.2 -G 3/4\" Евроконус, c гильзой в комплекте", "Переходник на евроконус 16-G 3/4")]
public void EuroconeAdapterTest(string query, string modified)
=> Execute(productType: "Переходник на евроконус", query, modified);
[TestCase("Резьбозажимное соединение для металлической трубки G 3/4 -15", "Резьбозажимное соединение для металлической трубки G 3/4 -15")]
[TestCase("Концовка для монтажной трубы 15 х 1/2''", "Резьбозажимное соединение для металлической трубки G 3/4 -15")]
[TestCase("Фитинг подключения L и T-образной медной трубки - D15 - G 3/4", "Резьбозажимное соединение для металлической трубки G 3/4 -15")]
public void EuroconeConnectionBendTest(string query, string modified)
=> Execute(productType: "Резьбозажимное для трубки", query, modified);
}

View File

@ -16,7 +16,7 @@
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\RhSolutions.QueryModifiers\RhSolutions.QueryModifiers.csproj" />
<ProjectReference Include="..\RhSolutions.Api\RhSolutions.Api.csproj" />
</ItemGroup>
</Project>

View File

@ -1,6 +0,0 @@
namespace RhSolutions.QueryModifiers.DrinkingWaterHeatingFittings;
public class DummyPlug : DrinkingWaterHeatingFitting
{
protected override string _title => "Заглушка для полимерн. трубы";
}

View File

@ -1,21 +0,0 @@
namespace RhSolutions.QueryModifiers.DrinkingWaterHeatingFittings;
public abstract class Eurocone : DrinkingWaterHeatingFitting
{
protected virtual Dictionary<string, string> _titles { get; } = new();
protected override string? BuildRhSolutionsName(string query)
{
var diameterMatch = _diameter.Match(query);
if (diameterMatch.Success)
{
string diameter = diameterMatch.Groups["Diameter"].Value;
if (_titles.TryGetValue(diameter, out string? title))
{
return title;
}
else return null;
}
return null;
}
}

View File

@ -1,16 +0,0 @@
namespace RhSolutions.QueryModifiers.DrinkingWaterHeatingFittings;
public class EuroconeAdapter : DrinkingWaterHeatingFitting
{
protected override string _title => "Переходник на евроконус";
protected override string? BuildRhSolutionsName(string query)
{
var diameterMatch = _diameter.Match(query);
if (diameterMatch.Success)
{
string diameter = diameterMatch.Groups["Diameter"].Value;
return $"{_title} {diameter}-G 3/4";
}
return null;
}
}

View File

@ -1,9 +0,0 @@
namespace RhSolutions.QueryModifiers.DrinkingWaterHeatingFittings;
public class EuroconeConnectionBend : DrinkingWaterHeatingFitting
{
protected override string? BuildRhSolutionsName(string query)
{
return "Резьбозажимное соединение для металлической трубки G 3/4 -15";
}
}

View File

@ -1,10 +0,0 @@
namespace RhSolutions.QueryModifiers.DrinkingWaterHeatingFittings;
public class EuroconeFlex : Eurocone
{
protected override Dictionary<string, string> _titles => new()
{
["16"] = "Резьбозажимное соединение flex/pink 16х2,2xG3/4",
["20"] = "Резьбозажимное соединение flex/pink 20х2,8xG3/4"
};
}

View File

@ -1,10 +0,0 @@
namespace RhSolutions.QueryModifiers.DrinkingWaterHeatingFittings;
public class EuroconeStabil : Eurocone
{
protected override Dictionary<string, string> _titles => new()
{
["16"] = "Резьбозажимное соединение stabil 16,2x2,6xG3/4",
["20"] = "Резьбозажимное соединение stabil 20x2,9xG3/4"
};
}

View File

@ -1,21 +0,0 @@
namespace RhSolutions.QueryModifiers.DrinkingWaterHeatingFittings;
public class SupportingClip : DrinkingWaterHeatingFitting
{
protected override string _title => "Фиксирующий желоб для ПЭ-трубы";
protected override string? BuildRhSolutionsName(string query)
{
var diameterMatch = _diameter.Match(query);
if (diameterMatch.Success)
{
string diameter = diameterMatch.Groups["Diameter"].Value;
if (diameter == "16")
{
diameter += "/17";
}
return $"{_title} {diameter}";
}
return null;
}
}

View File

@ -1,29 +0,0 @@
using System.Text.RegularExpressions;
namespace RhSolutions.QueryModifiers.DrinkingWaterHeatingFittings;
public class ThreadElbowDoubleWallInternal : DrinkingWaterHeatingFitting
{
protected override string _title => "Проточный настенный угольник";
private Regex _type = new(@"([\b\Wу])(?<Type>длин)([\b\w\.\s])");
protected override string? BuildRhSolutionsName(string query)
{
var diameterMatches = _diameter.Matches(query);
if (diameterMatches.Count == 0)
{
return null;
}
var threadMatch = _thread.Match(query);
if (!threadMatch.Success)
{
return null;
}
var typeMatch = _type.Match(query);
string[] diameters = diameterMatches.Select(x => x.Groups["Diameter"].Value).ToArray();
string thread = threadMatch.Groups["Thread"].Value;
string type = typeMatch.Success ? "длинный" : "короткий";
return $"{_title} {diameters[0]}/{(diameters.Length > 1 ? diameters[1] : diameters[0])}-Rp {thread} {type}";
}
}

View File

@ -5,12 +5,12 @@ public class BlackPipe : DrinkingWaterHeatingPipe
protected override string _title => "Black";
protected override Dictionary<int, string> _diameterNames => new()
{
[16] = "16х2,2",
[20] = "20х2,8",
[25] = "25х3,5",
[32] = string.Empty,
[40] = string.Empty,
[50] = string.Empty,
[63] = string.Empty
[16] = "16<EFBFBD>2,2",
[20] = "20<EFBFBD>2,8",
[25] = "25<EFBFBD>3,5",
[32] = "32<33>4,4",
[40] = "40<34>5,5",
[50] = "50<35>6,9",
[63] = "63<36>8,6"
};
}

View File

@ -18,6 +18,6 @@ public class PinkPipe : DrinkingWaterHeatingPipe
[32] = "32х4,4",
[40] = "40х5,5",
[50] = "50х6,9",
[63] = "63х8,7"
[63] = "63х8,6"
};
}

View File

@ -11,8 +11,6 @@ public class ProductQueryModifierFactory
{
case "Монтажная гильза":
return new Sleeve();
case "Желоб":
return new SupportingClip();
case "Тройник RAUTITAN":
return new TPiece();
case "Тройник RAUTITAN резьбовой наружный":
@ -33,8 +31,6 @@ public class ProductQueryModifierFactory
return new ThreadElbowWallExternal();
case "Угольник настенный внутренний":
return new ThreadElbowWallInternal();
case "Проточный настенный угольник":
return new ThreadElbowDoubleWallInternal();
case "Угольник с накидной гайкой":
return new ScrewcapElbow();
case "Муфта соединительная":
@ -49,16 +45,6 @@ public class ProductQueryModifierFactory
return new ConnectionBend();
case "Трубка Т-образная":
return new ConnectionTee();
case "Резьбозажимное flex":
return new EuroconeFlex();
case "Резьбозажимное stabil":
return new EuroconeStabil();
case "Переходник на евроконус":
return new EuroconeAdapter();
case "Резьбозажимное для трубки":
return new EuroconeConnectionBend();
case "Заглушка труб RAUTITAN":
return new DummyPlug();
case "Flex":
return new FlexPipe();
case "Pink":