Layer with EpiProTempVerificationRows
This commit is contained in:
parent
cff2e06f68
commit
7e16ee7f98
2
.gitignore
vendored
2
.gitignore
vendored
@ -342,4 +342,4 @@ ASALocalRun/
|
||||
# Libman.json
|
||||
/wwwroot/lib/*
|
||||
|
||||
.kanbn/**/*
|
||||
Tests/.kanbn/**/*
|
@ -59,4 +59,12 @@ public class InfinityQSV3Controller : Controller, IInfinityQSV3Controller<IActio
|
||||
return Content(result, "text/html", System.Text.Encoding.UTF8);
|
||||
}
|
||||
|
||||
[HttpGet("epi-pro-temp-verification-rows")]
|
||||
public IActionResult GetEpiProTempVerificationRows(int[] night)
|
||||
{
|
||||
List<string[]> results = _InfinityQSRepositoryV3.GetEpiProTempVerificationRows(night);
|
||||
string json = JsonSerializer.Serialize(results);
|
||||
return Content(json, "application/json", System.Text.Encoding.UTF8);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,70 @@
|
||||
[
|
||||
[
|
||||
"40",
|
||||
"Unscheduled Down",
|
||||
"617354",
|
||||
"1090",
|
||||
"-3.25",
|
||||
"11/7/2023 9:53:35 AM",
|
||||
"168",
|
||||
"\u0026nbsp;",
|
||||
"44",
|
||||
"Productive",
|
||||
"617355",
|
||||
"1040",
|
||||
"-1.75",
|
||||
"11/14/2023 5:25:07 AM",
|
||||
"4"
|
||||
],
|
||||
[
|
||||
"42",
|
||||
"Productive",
|
||||
"\u0026nbsp;",
|
||||
"1070",
|
||||
"2.5",
|
||||
"11/12/2023 10:38:41 AM",
|
||||
"47",
|
||||
"\u0026nbsp;",
|
||||
"46",
|
||||
"Productive",
|
||||
"\u0026nbsp;",
|
||||
"1069",
|
||||
"5",
|
||||
"11/14/2023 5:38:02 AM",
|
||||
"4"
|
||||
],
|
||||
[
|
||||
"48",
|
||||
"Productive",
|
||||
"\u0026nbsp;",
|
||||
"1075",
|
||||
"-10.75",
|
||||
"11/11/2023 6:54:58 AM",
|
||||
"75",
|
||||
"\u0026nbsp;",
|
||||
"54",
|
||||
"Non-Scheduled",
|
||||
"\u0026nbsp;",
|
||||
"1067",
|
||||
"-5",
|
||||
"8/17/2023 4:12:20 AM",
|
||||
"2142"
|
||||
],
|
||||
[
|
||||
"50",
|
||||
"Productive",
|
||||
"\u0026nbsp;",
|
||||
"1078",
|
||||
"-11",
|
||||
"11/12/2023 6:47:21 AM",
|
||||
"51",
|
||||
"\u0026nbsp;",
|
||||
"\u0026nbsp;",
|
||||
"\u0026nbsp;",
|
||||
"\u0026nbsp;",
|
||||
"\u0026nbsp;",
|
||||
"\u0026nbsp;",
|
||||
"\u0026nbsp;",
|
||||
"\u0026nbsp;"
|
||||
]
|
||||
]
|
@ -107,6 +107,9 @@
|
||||
<None Include="Data\Tests\InfinityQSV3-GetEpiProTempVerification.html">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="Data\Tests\InfinityQSV3-GetEpiProTempVerificationRows.json">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="Data\Tests\InfinityQSV3-GetHeader.json">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
|
@ -413,7 +413,7 @@ public class InfinityQSV3Repository : IInfinityQSV3Repository
|
||||
return result.ToString();
|
||||
}
|
||||
|
||||
private List<string> Convert(int[] night)
|
||||
private static List<string> Convert(int[] night)
|
||||
{
|
||||
List<string> results = new();
|
||||
foreach (int reactor in night)
|
||||
@ -421,34 +421,9 @@ public class InfinityQSV3Repository : IInfinityQSV3Repository
|
||||
return results;
|
||||
}
|
||||
|
||||
private static void Append(StringBuilder result, int loadedCount, Reactor reactor, string loadedRDS, TimeSpan timeSpan, InfinityQS1090FullLoad infinityQS1090FullLoad)
|
||||
List<string[]> IInfinityQSV3Repository.GetEpiProTempVerificationRows(int[] night)
|
||||
{
|
||||
_ = result.
|
||||
Append("<td>").Append(reactor.ReactorNo).Append("</td>").
|
||||
Append("<td class='").Append(reactor.E10State).Append("'>").Append(reactor.E10State).Append("</td>").
|
||||
Append("<td class='LoadedRDSCount").Append(loadedCount).Append("'>").Append(loadedRDS).Append("</td>").
|
||||
Append("<td>").Append(infinityQS1090FullLoad.Value).Append("</td>").
|
||||
Append("<td>").Append(infinityQS1090FullLoad.TemperatureOffsetPercentage).Append("</td>").
|
||||
Append("<td>").Append(infinityQS1090FullLoad.SubGroupIdFormated).Append("</td>").
|
||||
Append("<td>").Append(Math.Floor(timeSpan.TotalHours)).Append("</td>");
|
||||
}
|
||||
|
||||
private static void Append(StringBuilder result)
|
||||
{
|
||||
_ = result.
|
||||
Append("<td> </td>").
|
||||
Append("<td> </td>").
|
||||
Append("<td> </td>").
|
||||
Append("<td> </td>").
|
||||
Append("<td> </td>").
|
||||
Append("<td> </td>").
|
||||
Append("<td> </td>").
|
||||
Append("<td> </td>");
|
||||
}
|
||||
|
||||
string IInfinityQSV3Repository.GetEpiProTempVerification(int[] night)
|
||||
{
|
||||
StringBuilder result;
|
||||
List<string[]>? results;
|
||||
List<string> eppReactorNumbers = new();
|
||||
List<string> nightSiftReactors = Convert(night);
|
||||
ReadOnlyDictionary<int, Reactor> eppReactors = GetReactorsMatchingType("EPP");
|
||||
@ -456,18 +431,21 @@ public class InfinityQSV3Repository : IInfinityQSV3Repository
|
||||
eppReactorNumbers.Add($"'{keyValuePair.Key}'");
|
||||
if (!string.IsNullOrEmpty(_MockRoot))
|
||||
{
|
||||
string html = File.ReadAllText(Path.Combine(string.Concat(AppContext.BaseDirectory, _MockRoot), $"{_RepositoryName}-{nameof(IInfinityQSV3Repository.GetEpiProTempVerification)}.html"));
|
||||
result = new(html);
|
||||
string json = File.ReadAllText(Path.Combine(string.Concat(AppContext.BaseDirectory, _MockRoot), $"{_RepositoryName}-{nameof(IInfinityQSV3Repository.GetEpiProTempVerificationRows)}.json"));
|
||||
results = JsonSerializer.Deserialize<List<string[]>>(json);
|
||||
if (results is null)
|
||||
throw new NullReferenceException(nameof(results));
|
||||
}
|
||||
else
|
||||
{
|
||||
bool found;
|
||||
result = new();
|
||||
results = new();
|
||||
int loadedCount;
|
||||
Reactor? reactor;
|
||||
string loadedRDS;
|
||||
int reactorNumber;
|
||||
TimeSpan timeSpan;
|
||||
List<string> columns;
|
||||
List<int> used = new();
|
||||
List<int> dayShiftOrder = new();
|
||||
long ticks = DateTime.Now.Ticks;
|
||||
@ -476,12 +454,12 @@ public class InfinityQSV3Repository : IInfinityQSV3Repository
|
||||
IInfinityQSV3Repository infinityQSV3Repository = this;
|
||||
string commandText = infinityQSV3Repository.GetCommandText(eppReactorNumbers);
|
||||
StringBuilder stringBuilder = GetForJsonPath(_DBConnectionFactory, commandText);
|
||||
InfinityQS1090FullLoad[]? results = stringBuilder.Length == 0 ? Array.Empty<InfinityQS1090FullLoad>() : JsonSerializer.Deserialize(stringBuilder.ToString(), InfinityQS1090FullLoadArraySourceGenerationContext.Default.InfinityQS1090FullLoadArray);
|
||||
if (results is null)
|
||||
throw new NullReferenceException(nameof(results));
|
||||
for (int i = 0; i < results.Length; i++)
|
||||
InfinityQS1090FullLoad[]? infinityQS1090FullLoads = stringBuilder.Length == 0 ? Array.Empty<InfinityQS1090FullLoad>() : JsonSerializer.Deserialize(stringBuilder.ToString(), InfinityQS1090FullLoadArraySourceGenerationContext.Default.InfinityQS1090FullLoadArray);
|
||||
if (infinityQS1090FullLoads is null)
|
||||
throw new NullReferenceException(nameof(infinityQS1090FullLoads));
|
||||
for (int i = 0; i < infinityQS1090FullLoads.Length; i++)
|
||||
{
|
||||
infinityQS1090FullLoad = results[i];
|
||||
infinityQS1090FullLoad = infinityQS1090FullLoads[i];
|
||||
if (infinityQS1090FullLoad.Reactor is null)
|
||||
continue;
|
||||
if (!int.TryParse(infinityQS1090FullLoad.Reactor, out reactorNumber))
|
||||
@ -493,11 +471,11 @@ public class InfinityQSV3Repository : IInfinityQSV3Repository
|
||||
else
|
||||
nightShiftOrder.Add(i);
|
||||
}
|
||||
for (int i = 0; i < results.Length; i++)
|
||||
for (int i = 0; i < infinityQS1090FullLoads.Length; i++)
|
||||
{
|
||||
if (used.Contains(i) || !dayShiftOrder.Contains(i))
|
||||
continue;
|
||||
infinityQS1090FullLoad = results[i];
|
||||
infinityQS1090FullLoad = infinityQS1090FullLoads[i];
|
||||
if (infinityQS1090FullLoad.Reactor is null)
|
||||
continue;
|
||||
if (!int.TryParse(infinityQS1090FullLoad.Reactor, out reactorNumber))
|
||||
@ -508,14 +486,22 @@ public class InfinityQSV3Repository : IInfinityQSV3Repository
|
||||
found = false;
|
||||
timeSpan = new(ticks - infinityQS1090FullLoad.SubGroupIdFormated.Ticks);
|
||||
loadedCount = reactor.LoadedRDS is null ? 0 : reactor.LoadedRDS.Count;
|
||||
loadedRDS = reactor.LoadedRDS is null ? "" : reactor.LoadedRDS[0].ToString();
|
||||
_ = result.Append("<tr>");
|
||||
Append(result, loadedCount, reactor, loadedRDS, timeSpan, infinityQS1090FullLoad);
|
||||
for (int j = i + 1; j < results.Length; j++)
|
||||
loadedRDS = reactor.LoadedRDS is null ? " " : reactor.LoadedRDS[0].ToString();
|
||||
results.Add(new string[]
|
||||
{
|
||||
reactor.ReactorNo.ToString(),
|
||||
reactor.E10State,
|
||||
loadedRDS,
|
||||
infinityQS1090FullLoad.Value.ToString(),
|
||||
infinityQS1090FullLoad.TemperatureOffsetPercentage.ToString(),
|
||||
infinityQS1090FullLoad.SubGroupIdFormated.ToString(),
|
||||
Math.Floor(timeSpan.TotalHours).ToString()
|
||||
});
|
||||
for (int j = i + 1; j < infinityQS1090FullLoads.Length; j++)
|
||||
{
|
||||
if (used.Contains(j) || !nightShiftOrder.Contains(j))
|
||||
continue;
|
||||
infinityQS1090FullLoad = results[j];
|
||||
infinityQS1090FullLoad = infinityQS1090FullLoads[j];
|
||||
if (infinityQS1090FullLoad.Reactor is null)
|
||||
continue;
|
||||
if (!int.TryParse(infinityQS1090FullLoad.Reactor, out reactorNumber))
|
||||
@ -524,18 +510,56 @@ public class InfinityQSV3Repository : IInfinityQSV3Repository
|
||||
continue;
|
||||
used.Add(j);
|
||||
found = true;
|
||||
_ = result.Append("<td> </td>");
|
||||
timeSpan = new(ticks - infinityQS1090FullLoad.SubGroupIdFormated.Ticks);
|
||||
loadedCount = reactor.LoadedRDS is null ? 0 : reactor.LoadedRDS.Count;
|
||||
loadedRDS = reactor.LoadedRDS is null ? "" : reactor.LoadedRDS[0].ToString();
|
||||
Append(result, loadedCount, reactor, loadedRDS, timeSpan, infinityQS1090FullLoad);
|
||||
loadedRDS = reactor.LoadedRDS is null ? " " : reactor.LoadedRDS[0].ToString();
|
||||
columns = new();
|
||||
columns.AddRange(results[^1]);
|
||||
columns.AddRange(new string[]
|
||||
{
|
||||
" ",
|
||||
reactor.ReactorNo.ToString(),
|
||||
reactor.E10State,
|
||||
loadedRDS,
|
||||
infinityQS1090FullLoad.Value.ToString(),
|
||||
infinityQS1090FullLoad.TemperatureOffsetPercentage.ToString(),
|
||||
infinityQS1090FullLoad.SubGroupIdFormated.ToString(),
|
||||
Math.Floor(timeSpan.TotalHours).ToString()
|
||||
});
|
||||
results[^1] = columns.ToArray();
|
||||
break;
|
||||
}
|
||||
if (!found)
|
||||
Append(result);
|
||||
_ = result.Append("</tr>");
|
||||
{
|
||||
columns = new();
|
||||
columns.AddRange(results[^1]);
|
||||
columns.Add(" ");
|
||||
columns.Add(" ");
|
||||
columns.Add(" ");
|
||||
columns.Add(" ");
|
||||
columns.Add(" ");
|
||||
columns.Add(" ");
|
||||
columns.Add(" ");
|
||||
columns.Add(" ");
|
||||
results[^1] = columns.ToArray();
|
||||
}
|
||||
}
|
||||
}
|
||||
return results;
|
||||
}
|
||||
|
||||
string IInfinityQSV3Repository.GetEpiProTempVerification(int[] night)
|
||||
{
|
||||
StringBuilder result = new();
|
||||
IInfinityQSV3Repository infinityQSV3Repository = this;
|
||||
List<string[]> collection = infinityQSV3Repository.GetEpiProTempVerificationRows(night);
|
||||
foreach (string[] row in collection)
|
||||
{
|
||||
_ = result.Append("<tr>");
|
||||
foreach (string coulmn in row)
|
||||
_ = result.Append("<td>").Append(coulmn).Append("</td>");
|
||||
_ = result.Append("</tr>");
|
||||
}
|
||||
return result.ToString();
|
||||
}
|
||||
|
||||
|
@ -14,6 +14,7 @@ public interface IInfinityQSV3Controller<T>
|
||||
T GetHeader(string sub_group_id);
|
||||
T GetDescriptors(string sub_group_id);
|
||||
T GetEpiProTempVerification(int[] night);
|
||||
T GetEpiProTempVerificationRows(int[] night);
|
||||
T GetProductDataAverageSumOfDefectsProcessMeanProcessSigma(string process, string? recipe);
|
||||
T GetCommandText(string sub_group_id, string process, string job, string part, string lot, string date_time);
|
||||
|
||||
|
@ -12,6 +12,7 @@ public interface IInfinityQSV3Repository
|
||||
Result<InfinityQSV3[]> GetHeader(string subGroupId);
|
||||
string GetCommandText(string process, string? part);
|
||||
string GetCommandText(List<string> eppReactorNumbers);
|
||||
List<string[]> GetEpiProTempVerificationRows(int[] night);
|
||||
Result<InfinityQSDescriptorV3[]> GetDescriptors(string subGroupId);
|
||||
string GetProductDataAverageSumOfDefectsProcessMeanProcessSigma(string process, string? recipe);
|
||||
string GetCommandText(string? subGroupId, string? process, string? job, string? part, string? lot, string? dateTime);
|
||||
|
@ -186,6 +186,32 @@ public class UnitTestInfinityQSV3Controller
|
||||
NonThrowTryCatch();
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void GetEpiProTempVerificationRows()
|
||||
{
|
||||
_Logger?.LogInformation("Starting Web Application");
|
||||
int[] night = new int[] { 44, 46, 52, 54 };
|
||||
IServiceProvider? serviceProvider = _WebApplicationFactory?.Services.CreateScope().ServiceProvider;
|
||||
IInfinityQSV3Repository? infinityQSV3Repository = serviceProvider?.GetRequiredService<IInfinityQSV3Repository>();
|
||||
List<string[]>? results = infinityQSV3Repository?.GetEpiProTempVerificationRows(night);
|
||||
Assert.IsNotNull(results);
|
||||
_Logger?.LogInformation("{TestName} completed", _TestContext?.TestName);
|
||||
NonThrowTryCatch();
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public async Task GetEpiProTempVerificationRowsApi()
|
||||
{
|
||||
HttpClient? httpClient = _WebApplicationFactory?.CreateClient();
|
||||
_Logger?.LogInformation("Starting Web Application");
|
||||
Assert.IsTrue(httpClient is not null);
|
||||
string? result = await httpClient.GetStringAsync($"api/{_ControllerName}/epi-pro-temp-verification-collection/?night=44&night=46&night=52&night=54");
|
||||
File.WriteAllText(Path.Combine(AppContext.BaseDirectory, $"{_ControllerName}-{nameof(GetEpiProTempVerificationRows)}.json"), result);
|
||||
Assert.IsNotNull(result);
|
||||
_Logger?.LogInformation("{TestName} completed", _TestContext?.TestName);
|
||||
NonThrowTryCatch();
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void GetEpiProTempVerification()
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user