Compare commits

...

2 Commits

Author SHA1 Message Date
39be358af3 Add 40 MX couplings support 2024-10-10 14:52:03 +03:00
a122f491b9 Add 40 MX sleeves support 2024-10-10 14:50:37 +03:00
2 changed files with 11 additions and 13 deletions

View File

@ -1,6 +1,4 @@
using System.Text.RegularExpressions; namespace RhSolutions.Services;
namespace RhSolutions.Services;
public class CouplingsCalculator : IFittingsCalculator public class CouplingsCalculator : IFittingsCalculator
{ {
@ -42,7 +40,7 @@ public class CouplingsCalculator : IFittingsCalculator
"20" => new Product("11080121001"), "20" => new Product("11080121001"),
"25" => new Product("11080131001"), "25" => new Product("11080131001"),
"32" => new Product("11080141001"), "32" => new Product("11080141001"),
"40" => new Product("11600151001"), "40" => new Product("11080151001"),
"50" => new Product("14563021001"), "50" => new Product("14563021001"),
"63" => new Product("14563031001"), "63" => new Product("14563031001"),
_ => throw new Exception($"Неизвестный диаметр {kvp.Key}") _ => throw new Exception($"Неизвестный диаметр {kvp.Key}")

View File

@ -1,6 +1,4 @@
using System.Text.RegularExpressions; namespace RhSolutions.Services;
namespace RhSolutions.Services;
public class SleevesCalculator : IFittingsCalculator public class SleevesCalculator : IFittingsCalculator
{ {
@ -17,13 +15,14 @@ public class SleevesCalculator : IFittingsCalculator
["20"] = 0, ["20"] = 0,
["25"] = 0, ["25"] = 0,
["32"] = 0, ["32"] = 0,
["40"] = 0,
["50"] = 0,
["63"] = 0,
["16PX"] = 0, ["16PX"] = 0,
["20PX"] = 0, ["20PX"] = 0,
["25PX"] = 0, ["25PX"] = 0,
["32PX"] = 0, ["32PX"] = 0,
["40"] = 0, ["40PX"] = 0
["50"] = 0,
["63"] = 0,
}; };
var rautitanProducts = products.Where(kvp => kvp.Key.ProductLines.Contains("RAUTITAN")); var rautitanProducts = products.Where(kvp => kvp.Key.ProductLines.Contains("RAUTITAN"));
@ -35,7 +34,7 @@ public class SleevesCalculator : IFittingsCalculator
CaptureCollection collection = doubleCollection[0].Groups["Sleeve"].Captures; CaptureCollection collection = doubleCollection[0].Groups["Sleeve"].Captures;
foreach (Capture sleeve in collection) foreach (Capture sleeve in collection)
{ {
if (kvp.Key.Name.Contains("PX") && sleeve.Value != "40") if (kvp.Key.Name.Contains("PX"))
{ {
result[$"{sleeve.Value}PX"] += kvp.Value * 2; result[$"{sleeve.Value}PX"] += kvp.Value * 2;
} }
@ -52,7 +51,7 @@ public class SleevesCalculator : IFittingsCalculator
CaptureCollection collection = singleCollection[0].Groups["Sleeve"].Captures; CaptureCollection collection = singleCollection[0].Groups["Sleeve"].Captures;
foreach (Capture sleeve in collection) foreach (Capture sleeve in collection)
{ {
if (kvp.Key.Name.Contains("PX") && sleeve.Value != "40") if (kvp.Key.Name.Contains("PX"))
{ {
result[$"{sleeve.Value}PX"] += kvp.Value; result[$"{sleeve.Value}PX"] += kvp.Value;
} }
@ -72,11 +71,12 @@ public class SleevesCalculator : IFittingsCalculator
"20" => new Product("11080021001"), "20" => new Product("11080021001"),
"25" => new Product("11080031001"), "25" => new Product("11080031001"),
"32" => new Product("11080041001"), "32" => new Product("11080041001"),
"40" => new Product("11080051001"),
"16PX" => new Product("11600011001"), "16PX" => new Product("11600011001"),
"20PX" => new Product("11600021001"), "20PX" => new Product("11600021001"),
"25PX" => new Product("11600031001"), "25PX" => new Product("11600031001"),
"32PX" => new Product("11600041001"), "32PX" => new Product("11600041001"),
"40" => new Product("11600051001"), "40PX" => new Product("11600051001"),
"50" => new Product("11397713002"), "50" => new Product("11397713002"),
"63" => new Product("11397813002"), "63" => new Product("11397813002"),
_ => throw new Exception($"Неизвестный диаметр {kvp.Key}") _ => throw new Exception($"Неизвестный диаметр {kvp.Key}")