1 Commits

Author SHA1 Message Date
5c9f0d1aff Remove with Text
Remove GetEngineeringSpcReview
Better error message
EnforceCodeStyleInBuild
NginxFileSystem
Remove Reactors and Working Directory
AppSettings
Delete self contained Thunder Tests
Back to .net8.0
api/v4/InfinityQS
ApiExplorerSettings
Wafer Counter
2024-04-15 13:13:55 -07:00
17 changed files with 152 additions and 348 deletions

2
.vscode/tasks.json vendored
View File

@ -221,7 +221,7 @@
{ {
"label": "File-Folder-Helper AOT s M Self .Kanbn Tasks", "label": "File-Folder-Helper AOT s M Self .Kanbn Tasks",
"type": "shell", "type": "shell",
"command": "& L:/DevOps/Mesa_FI/File-Folder-Helper/bin/Release/net7.0/win-x64/publish/File-Folder-Helper.exe s M '.kanbn/tasks'", "command": "L:/DevOps/Mesa_FI/File-Folder-Helper/bin/Release/net8.0/win-x64/publish/File-Folder-Helper.exe s M L:/DevOps/Mesa_FI/OI-Metrology -s L:/DevOps/Mesa_FI/OI-Metrology/.kanbn/tasks",
"problemMatcher": [] "problemMatcher": []
} }
] ]

View File

@ -13,6 +13,44 @@
], ],
"problemMatcher": "$msCompile" "problemMatcher": "$msCompile"
}, },
{
"label": "buildTests",
"command": "dotnet",
"type": "process",
"args": [
"build",
"${workspaceFolder}/../Tests/OI.Metrology.Tests.csproj",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
],
"problemMatcher": "$msCompile"
},
{
"label": "testDebug",
"command": "dotnet",
"type": "process",
"args": [
"test",
"${workspaceFolder}/../Tests/OI.Metrology.Tests.csproj",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
],
"problemMatcher": "$msCompile"
},
{
"label": "testRelease",
"command": "dotnet",
"type": "process",
"args": [
"test",
"${workspaceFolder}/../Tests/OI.Metrology.Tests.csproj",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary",
"-c",
"Release"
],
"problemMatcher": "$msCompile"
},
{ {
"label": "Format", "label": "Format",
"command": "dotnet", "command": "dotnet",
@ -36,7 +74,14 @@
"publish", "publish",
"${workspaceFolder}/OI.Metrology.Server.csproj", "${workspaceFolder}/OI.Metrology.Server.csproj",
"/property:GenerateFullPaths=true", "/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary" "/consoleloggerparameters:NoSummary",
"--configuration",
"Release",
"--runtime",
"win-x64",
"--self-contained",
"-o",
"D:/web-sites/OI-Metrology/hh-3498d1da-_______-OI-Metrology-Release/Server"
], ],
"problemMatcher": "$msCompile" "problemMatcher": "$msCompile"
}, },
@ -87,9 +132,9 @@
} }
}, },
{ {
"label": "File-Folder-Helper AOT s V Repositories", "label": "File-Folder-Helper AOT s X Server",
"type": "shell", "type": "shell",
"command": "& L:/DevOps/Mesa_FI/File-Folder-Helper/bin/Release/net7.0/win-x64/publish/File-Folder-Helper.exe s V Repositories", "command": "L:/DevOps/Mesa_FI/File-Folder-Helper/bin/Release/net8.0/win-x64/publish/File-Folder-Helper.exe s X L:/DevOps/Mesa_FI/OI-Metrology Day-Helper-2024-01-08 L:/DevOps/Mesa_FI/OI-Metrology/Server",
"problemMatcher": [] "problemMatcher": []
} }
] ]

View File

@ -79,12 +79,4 @@ public class InfinityQSV4Controller : Controller, IInfinityQSV4Controller<IActio
public IActionResult GetProductionSpecification(string part) => public IActionResult GetProductionSpecification(string part) =>
Content(_InfinityQSRepositoryV4.GetProductionSpecification(part)); Content(_InfinityQSRepositoryV4.GetProductionSpecification(part));
[HttpGet("engineering-spc-review")]
public IActionResult GetEngineeringSpcReview()
{
Dictionary<string, List<string>> results = _InfinityQSRepositoryV4.GetEngineeringSpcReview();
string json = JsonSerializer.Serialize(results);
return Content(json, "application/json", System.Text.Encoding.UTF8);
}
} }

View File

@ -3,7 +3,7 @@ using OI.Metrology.Shared.Models.Stateless;
namespace OI.Metrology.Server.ApiControllers; namespace OI.Metrology.Server.ApiControllers;
[Route("api/v1/WaferCounter")] [Route("api/v1/[controller]")]
public class WaferCounterController : Controller, IWaferCounterController<IActionResult> public class WaferCounterController : Controller, IWaferCounterController<IActionResult>
{ {
@ -15,8 +15,4 @@ public class WaferCounterController : Controller, IWaferCounterController<IActio
[HttpGet("{waferSize}/last-quantity-and-slot-map")] [HttpGet("{waferSize}/last-quantity-and-slot-map")]
public IActionResult GetLastQuantityAndSlotMap(string area, string waferSize) => public IActionResult GetLastQuantityAndSlotMap(string area, string waferSize) =>
Json(_WaferCounterRepository.GetLastQuantityAndSlotMap(area, waferSize)); Json(_WaferCounterRepository.GetLastQuantityAndSlotMap(area, waferSize));
[HttpGet("{waferSize}/last-quantity-and-slot-map-with-text")]
public IActionResult GetLastQuantityAndSlotMapWithText(string area, string waferSize, string text) =>
Json(_WaferCounterRepository.GetLastQuantityAndSlotMapWithText(area, waferSize, text));
} }

View File

@ -6,6 +6,7 @@
<SccLocalPath>SAK</SccLocalPath> <SccLocalPath>SAK</SccLocalPath>
</PropertyGroup> </PropertyGroup>
<PropertyGroup> <PropertyGroup>
<EnforceCodeStyleInBuild>true</EnforceCodeStyleInBuild>
<ImplicitUsings>enable</ImplicitUsings> <ImplicitUsings>enable</ImplicitUsings>
<IsPackable>false</IsPackable> <IsPackable>false</IsPackable>
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
@ -24,10 +25,10 @@
<Content Remove="compilerconfig.json" /> <Content Remove="compilerconfig.json" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Dapper" Version="2.1.24" /> <PackageReference Include="Dapper" Version="2.1.37" />
<PackageReference Include="EntityFramework" Version="6.4.4" /> <PackageReference Include="EntityFramework" Version="6.4.4" />
<PackageReference Include="jQuery" Version="3.7.1" /> <PackageReference Include="jQuery" Version="3.7.1" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Server" Version="8.0.0" /> <PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Server" Version="8.0.3" />
<PackageReference Include="Microsoft.Extensions.Caching.Memory" Version="8.0.0" /> <PackageReference Include="Microsoft.Extensions.Caching.Memory" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="8.0.0" /> <PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.UserSecrets" Version="8.0.0" /> <PackageReference Include="Microsoft.Extensions.Configuration.UserSecrets" Version="8.0.0" />
@ -38,8 +39,8 @@
<PackageReference Include="Microsoft.Extensions.Logging.EventLog" Version="8.0.0" /> <PackageReference Include="Microsoft.Extensions.Logging.EventLog" Version="8.0.0" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" /> <PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.5.0" /> <PackageReference Include="Swashbuckle.AspNetCore" Version="6.5.0" />
<PackageReference Include="System.Data.SqlClient" Version="4.8.5" /> <PackageReference Include="System.Data.SqlClient" Version="4.8.6" />
<PackageReference Include="System.Drawing.Common" Version="8.0.0" /> <PackageReference Include="System.Drawing.Common" Version="8.0.3" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\Shared\OI.Metrology.Shared.csproj" /> <ProjectReference Include="..\Shared\OI.Metrology.Shared.csproj" />

View File

@ -33,6 +33,8 @@ public class FileShareRepository : IFileShareRepository
string directory = Path.GetDirectoryName(to) ?? throw new NullReferenceException(); string directory = Path.GetDirectoryName(to) ?? throw new NullReferenceException();
if (!Directory.Exists(directory)) if (!Directory.Exists(directory))
_ = Directory.CreateDirectory(directory); _ = Directory.CreateDirectory(directory);
if (File.Exists(to))
File.Move(to, $"{to}.{DateTime.Now.Ticks}.old");
File.Move(from, to); File.Move(from, to);
} }

View File

@ -6,7 +6,6 @@ using OI.Metrology.Shared.Repositories;
using System.Collections.ObjectModel; using System.Collections.ObjectModel;
using System.Data; using System.Data;
using System.Data.Common; using System.Data.Common;
using System.Reflection;
using System.Text; using System.Text;
using System.Text.Json; using System.Text.Json;
@ -153,6 +152,22 @@ public class InfinityQSV4Repository : IInfinityQSV4Repository
return result.ToString(); return result.ToString();
} // cSpell:enable } // cSpell:enable
private JsonElement[] GetAllReactorsAsJsonElementElement()
{
JsonElement[]? results;
HttpClient httpClient = _HttpClientFactory.CreateClient();
Task<string> task = httpClient.GetStringAsync($"{_OpenInsightApplicationProgrammingInterface}/reactors");
task.Wait();
JsonElement? jsonElement = JsonSerializer.Deserialize<JsonElement>(task.Result);
if (jsonElement is null)
throw new NullReferenceException(nameof(jsonElement));
string json = jsonElement.Value.EnumerateObject().First().Value.ToString();
results = JsonSerializer.Deserialize<JsonElement[]>(json);
if (results is null)
throw new NullReferenceException(nameof(results));
return results;
}
private static StringBuilder GetForJsonPath(IDbConnectionFactory dbConnectionFactory, string commandText, bool useIqsConnection) private static StringBuilder GetForJsonPath(IDbConnectionFactory dbConnectionFactory, string commandText, bool useIqsConnection)
{ {
StringBuilder stringBuilder = new(); StringBuilder stringBuilder = new();
@ -165,6 +180,49 @@ public class InfinityQSV4Repository : IInfinityQSV4Repository
return stringBuilder; return stringBuilder;
} }
private void GetOI(InfinityQSV4 infinityQSV4)
{
IInfinityQSV4Repository infinityQSV4Repository = this;
if (string.IsNullOrEmpty(infinityQSV4.Part))
throw new ArgumentException(nameof(infinityQSV4.Part));
string json = infinityQSV4Repository.GetProductionSpecification(infinityQSV4.Part);
ProdSpecRoot? prodSpec = JsonSerializer.Deserialize(json, ProdSpecRootSourceGenerationContext.Default.ProdSpecRoot);
if (prodSpec is null)
{
if (prodSpec is null)
{ }
}
}
private static List<string> Convert(int[] night)
{
List<string> results = new();
foreach (int reactor in night)
results.Add(reactor.ToString());
return results;
}
private ReadOnlyDictionary<int, Reactor> GetReactorsMatchingType(string? reactTypeFilter)
{
Dictionary<int, Reactor> results = new();
string json;
Reactor? reactor;
JsonElement[]? jsonElements = GetAllReactorsAsJsonElementElement();
foreach (JsonElement jsonElement in jsonElements)
{
json = jsonElement.EnumerateObject().First().Value.ToString();
if (reactTypeFilter is not null && !json.Contains(reactTypeFilter))
continue;
try
{ reactor = JsonSerializer.Deserialize(json, ReactorSourceGenerationContext.Default.Reactor); }
catch (Exception) { reactor = null; }
if (reactor is null || (reactTypeFilter is not null && reactor.ReactType != reactTypeFilter))
continue;
results.Add(reactor.ReactorNo, reactor);
}
return new(results);
}
private static InfinityQSV4 GetInfinityQSV4(IDbConnectionFactory dbConnectionFactory, IInfinityQSV4Repository infinityQSV4Repository, string subGroupId) private static InfinityQSV4 GetInfinityQSV4(IDbConnectionFactory dbConnectionFactory, IInfinityQSV4Repository infinityQSV4Repository, string subGroupId)
{ {
InfinityQSV4 result; InfinityQSV4 result;
@ -333,43 +391,6 @@ public class InfinityQSV4Repository : IInfinityQSV4Repository
return result.ToString(); return result.ToString();
} }
private JsonElement[] GetAllReactorsAsJsonElementElement()
{
JsonElement[]? results;
HttpClient httpClient = _HttpClientFactory.CreateClient();
Task<string> task = httpClient.GetStringAsync($"{_OpenInsightApplicationProgrammingInterface}/reactors");
task.Wait();
JsonElement? jsonElement = JsonSerializer.Deserialize<JsonElement>(task.Result);
if (jsonElement is null)
throw new NullReferenceException(nameof(jsonElement));
string json = jsonElement.Value.EnumerateObject().First().Value.ToString();
results = JsonSerializer.Deserialize<JsonElement[]>(json);
if (results is null)
throw new NullReferenceException(nameof(results));
return results;
}
private ReadOnlyDictionary<int, Reactor> GetReactorsMatchingType(string? reactTypeFilter)
{
Dictionary<int, Reactor> results = new();
string json;
Reactor? reactor;
JsonElement[]? jsonElements = GetAllReactorsAsJsonElementElement();
foreach (JsonElement jsonElement in jsonElements)
{
json = jsonElement.EnumerateObject().First().Value.ToString();
if (reactTypeFilter is not null && !json.Contains(reactTypeFilter))
continue;
try
{ reactor = JsonSerializer.Deserialize(json, ReactorSourceGenerationContext.Default.Reactor); }
catch (Exception) { reactor = null; }
if (reactor is null || (reactTypeFilter is not null && reactor.ReactType != reactTypeFilter))
continue;
results.Add(reactor.ReactorNo, reactor);
}
return new(results);
}
string IInfinityQSV4Repository.GetCommandText(List<string> eppReactorNumbers) string IInfinityQSV4Repository.GetCommandText(List<string> eppReactorNumbers)
{ // cSpell:disable { // cSpell:disable
StringBuilder result = new(); StringBuilder result = new();
@ -421,14 +442,6 @@ public class InfinityQSV4Repository : IInfinityQSV4Repository
return result.ToString(); return result.ToString();
} // cSpell:enable } // cSpell:enable
private static List<string> Convert(int[] night)
{
List<string> results = new();
foreach (int reactor in night)
results.Add(reactor.ToString());
return results;
}
List<string[]> IInfinityQSV4Repository.GetEpiProTempVerificationRows(int[] night) List<string[]> IInfinityQSV4Repository.GetEpiProTempVerificationRows(int[] night)
{ {
List<string[]>? results; List<string[]>? results;
@ -638,171 +651,4 @@ public class InfinityQSV4Repository : IInfinityQSV4Repository
return result; return result;
} }
private void GetOI(InfinityQSV4 infinityQSV4)
{
IInfinityQSV4Repository infinityQSV4Repository = this;
if (string.IsNullOrEmpty(infinityQSV4.Part))
throw new ArgumentException(nameof(infinityQSV4.Part));
string json = infinityQSV4Repository.GetProductionSpecification(infinityQSV4.Part);
ProdSpecRoot? prodSpec = JsonSerializer.Deserialize(json, ProdSpecRootSourceGenerationContext.Default.ProdSpecRoot);
if (prodSpec is null)
{
if (prodSpec is null)
{ }
}
}
private static Record? GetValue(AppSettings appSettings, string line)
{
Record? result;
string[] attributes = line.Split('>');
if (attributes.Length != 3)
result = null;
else
{
string[] text = attributes[1].Replace(appSettings.IqsRed, "red").Replace(appSettings.IqsYellow, "Yellow").Split($"</{line[1]}{line[2]}");
if (text.Length != 2)
result = null;
else
{
string[] attributeValues = attributes[0].Split('"');
if (attributeValues.Length != 3)
result = new(null, text[0]);
else
{
result = new(attributeValues[1], text[0]);
}
}
}
return result;
}
private static ReadOnlyCollection<Record> GetRecords(AppSettings appSettings, string[] lines)
{
Record? record;
List<Record> results = new();
List<string> checkColumns = new();
foreach (string line in lines)
{
if (line.StartsWith("<th"))
{
record = GetValue(appSettings, line);
if (record is null)
continue;
checkColumns.Add(record.Text);
}
if (line.StartsWith("<td"))
{
record = GetValue(appSettings, line);
if (record is null)
continue;
results.Add(record);
}
}
if (string.Join(',', checkColumns) != appSettings.IqsColumns)
throw new NotSupportedException("Columns don't match!");
return new(results);
}
private static List<Dictionary<string, Record>> GetCollection(string columns, ReadOnlyCollection<Record> records)
{
string[] columnNames = columns.Split(',');
List<Dictionary<string, Record>> collection = new();
Dictionary<string, Record> keyValuePairs;
for (int i = 0; i < records.Count; i++)
{
keyValuePairs = new();
for (int j = 0; j < columnNames.Length; j++)
{
keyValuePairs.Add(columnNames[j], records[i]);
i++;
}
i--;
collection.Add(keyValuePairs);
}
return collection;
}
private static Dictionary<string, List<string>> GetResults(AppSettings appSettings, List<Dictionary<string, Record>> collection)
{
Dictionary<string, List<string>> results = new();
Record record;
List<string>? colors;
foreach (Dictionary<string, Record> keyValuePairs in collection)
{
record = keyValuePairs[appSettings.IqsKey];
if (!results.TryGetValue(record.Text, out colors))
{
results.Add(record.Text, new());
if (!results.TryGetValue(record.Text, out colors))
throw new Exception();
}
if (record.Color is null)
continue;
colors.Add(record.Color.Replace(appSettings.IqsRed, "red").Replace(appSettings.IqsYellow, "Yellow"));
}
foreach (KeyValuePair<string, List<string>> keyValuePair in results)
keyValuePair.Value.Sort();
return results;
}
private void FileFindReplaceAndSave(FileInfo fileInfo, string value)
{
string lines = value.Replace(_AppSettings.IqsRed, "red").Replace(_AppSettings.IqsYellow, "Yellow");
File.WriteAllText(fileInfo.FullName, lines);
}
private static string GetWwwRootDirectory()
{
string result;
Assembly assembly = Assembly.GetExecutingAssembly();
string? assemblyName = assembly.GetName()?.Name;
if (string.IsNullOrEmpty(assemblyName))
throw new Exception();
result = Path.Combine(AppContext.BaseDirectory, "wwwroot");
if (!Directory.Exists(result))
_ = Directory.CreateDirectory(result);
return result;
}
Dictionary<string, List<string>> IInfinityQSV4Repository.GetEngineeringSpcReview()
{
Dictionary<string, List<string>>? results;
if (!string.IsNullOrEmpty(_MockRoot))
{
string json = File.ReadAllText(Path.Combine(string.Concat(AppContext.BaseDirectory, _MockRoot), $"{_RepositoryName}-{nameof(IInfinityQSV4Repository.GetEngineeringSpcReview)}.json"));
results = JsonSerializer.Deserialize<Dictionary<string, List<string>>>(json);
if (results is null)
throw new NullReferenceException(nameof(results));
}
else
{
string wwwRootDirectory = GetWwwRootDirectory();
HttpClient httpClient = _HttpClientFactory.CreateClient();
FileInfo localFileInfo = new(Path.Combine(wwwRootDirectory, _AppSettings.IqsFileSegments.Last()));
Uri uri = _FileShareRepository.Append(new Uri(_AppSettings.EcMesaFileShareCharacterizationSi), _AppSettings.IqsFileSegments[0..^1]);
List<NginxFileSystemSortable> nginxFileSystemSortableCollection = _FileShareRepository.GetNginxFileSystemSortableCollection(httpClient, uri, ".html");
if (!localFileInfo.Exists && nginxFileSystemSortableCollection.Count == 0)
results = new();
else
{
string[] lines;
HttpResponseMessage httpResponseMessage = _FileShareRepository.ReadFile(httpClient, nginxFileSystemSortableCollection[0].Uri);
Task<string> value = httpResponseMessage.Content.ReadAsStringAsync();
value.Wait();
if (localFileInfo.Exists && localFileInfo.LastWriteTime == nginxFileSystemSortableCollection[0].DateTime)
lines = File.ReadAllLines(localFileInfo.FullName);
else
{
FileFindReplaceAndSave(localFileInfo, value.Result);
lines = value.Result.Split("\r\n");
}
ReadOnlyCollection<Record> records = GetRecords(_AppSettings, lines);
List<Dictionary<string, Record>> collection = GetCollection(_AppSettings.IqsColumns, records);
results = GetResults(_AppSettings, collection);
}
}
return results;
}
} }

View File

@ -45,83 +45,84 @@ public class WaferCounterRepository : IWaferCounterRepository
private static Record GetRecord(string line1, string line2) private static Record GetRecord(string line1, string line2)
{ {
Record result; Record result;
string? waferMap = string.IsNullOrEmpty(line2) || line2.Length != 8 ? null : line2.Substring(1, 1); string? slotMap = string.IsNullOrEmpty(line2) || line2.Length != 8 ? null : line2.Substring(1, 1);
int check = waferMap == "1" ? 1 : 0; int check = slotMap == "1" ? 1 : 0;
int total = int.Parse(line1[1..]); #pragma warning disable IDE0057
// string wafers = Array.from(line2[2..]); int total = int.Parse(line1.Substring(1));
foreach (char item in line2[2..]) foreach (char item in line2.Substring(2))
#pragma warning restore IDE0057
{ {
switch (item) switch (item)
{ {
case '0': case '0':
check += 0; check += 0;
waferMap += "0000"; slotMap += "0000";
break; break;
case '1': case '1':
check += 1; check += 1;
waferMap += "0001"; slotMap += "0001";
break; break;
case '2': case '2':
check += 1; check += 1;
waferMap += "0010"; slotMap += "0010";
break; break;
case '3': case '3':
check += 2; check += 2;
waferMap += "0011"; slotMap += "0011";
break; break;
case '4': case '4':
check += 1; check += 1;
waferMap += "0100"; slotMap += "0100";
break; break;
case '5': case '5':
check += 2; check += 2;
waferMap += "0101"; slotMap += "0101";
break; break;
case '6': case '6':
check += 2; check += 2;
waferMap += "0110"; slotMap += "0110";
break; break;
case '7': case '7':
check += 3; check += 3;
waferMap += "0111"; slotMap += "0111";
break; break;
case '8': case '8':
check += 1; check += 1;
waferMap += "1000"; slotMap += "1000";
break; break;
case '9': case '9':
check += 2; check += 2;
waferMap += "1001"; slotMap += "1001";
break; break;
case 'A': case 'A':
check += 2; check += 2;
waferMap += "1010"; slotMap += "1010";
break; break;
case 'B': case 'B':
check += 3; check += 3;
waferMap += "1011"; slotMap += "1011";
break; break;
case 'C': case 'C':
check += 2; check += 2;
waferMap += "1100"; slotMap += "1100";
break; break;
case 'D': case 'D':
check += 3; check += 3;
waferMap += "1101"; slotMap += "1101";
break; break;
case 'E': case 'E':
check += 3; check += 3;
waferMap += "1110"; slotMap += "1110";
break; break;
case 'F': case 'F':
check += 4; check += 4;
waferMap += "1111"; slotMap += "1111";
break; break;
default: default:
break; break;
} }
} }
result = new(check, total, waferMap); result = new(check, total, slotMap);
return result; return result;
} }
@ -134,7 +135,7 @@ public class WaferCounterRepository : IWaferCounterRepository
string? IWaferCounterRepository.GetSlotMap(string line1, string line2) => string? IWaferCounterRepository.GetSlotMap(string line1, string line2) =>
GetRecord(line1, line2).SlotMap; GetRecord(line1, line2).SlotMap;
private List<NginxFileSystemSortable> GetNginxFileSystemSortableCollection(HttpClient httpClient, Uri waferSizeUri, string waferSizeDirectory) private List<NginxFileSystemSortable> GetNginxFileSystemSortableCollection(HttpClient httpClient, Uri waferSizeUri)
{ {
List<NginxFileSystemSortable> results = new(); List<NginxFileSystemSortable> results = new();
DateTime dateTime = DateTime.Now; DateTime dateTime = DateTime.Now;
@ -142,18 +143,17 @@ public class WaferCounterRepository : IWaferCounterRepository
for (int i = 0; i < int.MaxValue; i++) for (int i = 0; i < int.MaxValue; i++)
{ {
results = _FileShareRepository.GetNginxFileSystemSortableCollection(httpClient, waferSizeUri, ".wc"); results = _FileShareRepository.GetNginxFileSystemSortableCollection(httpClient, waferSizeUri, ".wc");
if (results.Count > 1 || DateTime.Now.Ticks > ticks) if (results.Count > 0 || DateTime.Now.Ticks > ticks)
break; break;
Thread.Sleep(250); Thread.Sleep(250);
} }
for (int i = 1; i < results.Count; i++)
MoveFile(waferSizeDirectory, results[i]);
return results; return results;
} }
private static WaferCounter GetLastQuantityAndSlotMapWithText(string waferSize, string text, HttpClient httpClient, NginxFileSystemSortable nginxFileSystemSortable) private static WaferCounter GetLastQuantityAndSlotMap(string waferSize, HttpClient httpClient, NginxFileSystemSortable nginxFileSystemSortable)
{ {
WaferCounter result; WaferCounter result;
string text = string.Empty;
Task<string> value = httpClient.GetStringAsync(nginxFileSystemSortable.Uri); Task<string> value = httpClient.GetStringAsync(nginxFileSystemSortable.Uri);
value.Wait(); value.Wait();
string[] lines = value.Result.Split("\r\n"); string[] lines = value.Result.Split("\r\n");
@ -163,9 +163,9 @@ public class WaferCounterRepository : IWaferCounterRepository
Record record = GetRecord(lines[0], lines[1]); Record record = GetRecord(lines[0], lines[1]);
string equipmentId = segments.Length <= 1 ? nginxFileSystemSortable.Name : segments[1].Split('.')[0]; string equipmentId = segments.Length <= 1 ? nginxFileSystemSortable.Name : segments[1].Split('.')[0];
if (string.IsNullOrEmpty(record.SlotMap) || record.SlotMap.Length != 25) if (string.IsNullOrEmpty(record.SlotMap) || record.SlotMap.Length != 25)
throw new Exception("Wrong length!"); throw new Exception("Wrong length for slot-map!");
if (record.Total != record.Check) if (record.Total != record.Check)
throw new Exception("Invalid!"); throw new Exception($"Invalid {record.Total} != {record.Check}");
result = new(nginxFileSystemSortable.DateTime, nginxFileSystemSortable.DateTime.ToString("yyyy-MM-dd hh:mm tt"), $"WC{waferSize}{equipmentId}", text, record.Total, record.SlotMap); result = new(nginxFileSystemSortable.DateTime, nginxFileSystemSortable.DateTime.ToString("yyyy-MM-dd hh:mm tt"), $"WC{waferSize}{equipmentId}", text, record.Total, record.SlotMap);
return result; return result;
} }
@ -176,35 +176,12 @@ public class WaferCounterRepository : IWaferCounterRepository
Uri waferSizeUri = GetWaferSizeUri(area, waferSize); Uri waferSizeUri = GetWaferSizeUri(area, waferSize);
HttpClient httpClient = _HttpClientFactory.CreateClient(); HttpClient httpClient = _HttpClientFactory.CreateClient();
string waferSizeDirectory = GetWaferSizeDirectory(area, waferSize, destination: false); string waferSizeDirectory = GetWaferSizeDirectory(area, waferSize, destination: false);
List<NginxFileSystemSortable> nginxFileSystemSortableCollection = GetNginxFileSystemSortableCollection(httpClient, waferSizeUri, waferSizeDirectory); List<NginxFileSystemSortable> nginxFileSystemSortableCollection = GetNginxFileSystemSortableCollection(httpClient, waferSizeUri);
if (nginxFileSystemSortableCollection.Count < 1) if (nginxFileSystemSortableCollection.Count < 1)
throw new Exception("No files!"); throw new Exception("No files!");
string text = string.Empty; result = GetLastQuantityAndSlotMap(waferSize, httpClient, nginxFileSystemSortableCollection[0]);
result = GetLastQuantityAndSlotMapWithText(waferSize, text, httpClient, nginxFileSystemSortableCollection[0]); for (int i = 0; i < nginxFileSystemSortableCollection.Count; i++)
return result; MoveFile(waferSizeDirectory, nginxFileSystemSortableCollection[i]);
}
private void Save(string waferSizeDestinationDirectory, string area, string waferSize, string text, NginxFileSystemSortable nginxFileSystemSortable, WaferCounter result) =>
_FileShareRepository.FileWrite(Path.Combine(waferSizeDestinationDirectory, $"{nginxFileSystemSortable.Name}.csv"), $"100,{waferSize},{area},{nginxFileSystemSortable.DateTime},{text},{result.Total:00},{result.SlotMap} ");
WaferCounter IWaferCounterRepository.GetLastQuantityAndSlotMapWithText(string area, string waferSize, string text)
{
WaferCounter result;
Uri waferSizeUri = GetWaferSizeUri(area, waferSize);
HttpClient httpClient = _HttpClientFactory.CreateClient();
string waferSizeDirectory = GetWaferSizeDirectory(area, waferSize, destination: false);
List<NginxFileSystemSortable> nginxFileSystemSortableCollection = GetNginxFileSystemSortableCollection(httpClient, waferSizeUri, waferSizeDirectory);
if (nginxFileSystemSortableCollection.Count < 1)
throw new Exception("No files!");
result = GetLastQuantityAndSlotMapWithText(waferSize, text, httpClient, nginxFileSystemSortableCollection[0]);
if (result is not null)
{
string waferSizeDestinationDirectory = _AppSettings.WaferCounterDestinationDirectory;
// string waferSizeDestinationDirectory = GetWaferSizeUri(area, waferSize, destination: true);
Save(waferSizeDestinationDirectory, area, waferSize, text, nginxFileSystemSortableCollection[0], result);
}
if (result is null)
throw new NullReferenceException(nameof(result));
return result; return result;
} }

View File

@ -12,7 +12,7 @@
<link href="~/igniteui/css/themes/bootstrap3/default/infragistics.theme.css" rel="stylesheet" <link href="~/igniteui/css/themes/bootstrap3/default/infragistics.theme.css" rel="stylesheet"
asp-append-version="true" /> asp-append-version="true" />
<link href="~/igniteui/css/structure/infragistics.css" rel="stylesheet" asp-append-version="true" /> <link href="~/igniteui/css/structure/infragistics.css" rel="stylesheet" asp-append-version="true" />
<link href="~/styles/site.css" rel="stylesheet" asp-append-version="true" /> <link href="~/styles/site-server.css" rel="stylesheet" asp-append-version="true" />
<script src="~/js/jquery-3.6.0.min.js" type="text/javascript" asp-append-version="true"></script> <script src="~/js/jquery-3.6.0.min.js" type="text/javascript" asp-append-version="true"></script>
<script src="~/js/jquery-ui.min.js" type="text/javascript" asp-append-version="true"></script> <script src="~/js/jquery-ui.min.js" type="text/javascript" asp-append-version="true"></script>
@ -23,7 +23,7 @@
<script src="~/js/chart-4.3.0.min.js" type="module"></script> <script src="~/js/chart-4.3.0.min.js" type="module"></script>
<script src="~/js/common.js" type="text/javascript" asp-append-version="true"></script> <script src="~/js/common.js" type="text/javascript" asp-append-version="true"></script>
<script src="~/js/site.js" type="text/javascript" asp-append-version="true"></script> <script src="~/js/site-server.js" type="text/javascript" asp-append-version="true"></script>
<script> <script>
$(document).ready(function () { $(document).ready(function () {
if (location.pathname == "/") { if (location.pathname == "/") {

View File

@ -17,7 +17,6 @@ public interface IInfinityQSV4Repository
string GetCommandText(List<string> eppReactorNumbers); string GetCommandText(List<string> eppReactorNumbers);
List<string[]> GetEpiProTempVerificationRows(int[] night); List<string[]> GetEpiProTempVerificationRows(int[] night);
Result<InfinityQSDescriptorV4[]> GetDescriptors(string subGroupId); Result<InfinityQSDescriptorV4[]> GetDescriptors(string subGroupId);
Dictionary<string, List<string>> GetEngineeringSpcReview();
string GetProductDataAverageSumOfDefectsProcessMeanProcessSigma(string process, string? recipe); string GetProductDataAverageSumOfDefectsProcessMeanProcessSigma(string process, string? recipe);
string GetCommandText(string? subGroupId, string? process, string? job, string? part, string? lot, string? dateTime); string GetCommandText(string? subGroupId, string? process, string? job, string? part, string? lot, string? dateTime);

View File

@ -12,6 +12,5 @@ public interface IWaferCounterController<T>
static string GetRouteName() => nameof(IWaferCounterController<T>)[1..^10]; static string GetRouteName() => nameof(IWaferCounterController<T>)[1..^10];
T GetLastQuantityAndSlotMap(string area, string waferSize); T GetLastQuantityAndSlotMap(string area, string waferSize);
T GetLastQuantityAndSlotMapWithText(string area, string waferSize, string text);
} }

View File

@ -5,6 +5,5 @@ public interface IWaferCounterRepository
string? GetSlotMap(string line1, string line2); string? GetSlotMap(string line1, string line2);
DataModels.WaferCounter GetLastQuantityAndSlotMap(string area, string waferSize); DataModels.WaferCounter GetLastQuantityAndSlotMap(string area, string waferSize);
DataModels.WaferCounter? GetLastQuantityAndSlotMapWithText(string area, string waferSize, string text);
} }

View File

@ -89,7 +89,7 @@
{ {
"label": "File-Folder-Helper AOT s V Repositories", "label": "File-Folder-Helper AOT s V Repositories",
"type": "shell", "type": "shell",
"command": "& L:/DevOps/Mesa_FI/File-Folder-Helper/bin/Release/net7.0/win-x64/publish/File-Folder-Helper.exe s V Repositories", "command": "L:/DevOps/Mesa_FI/File-Folder-Helper/bin/Release/net8.0/win-x64/publish/File-Folder-Helper.exe s V Repositories",
"problemMatcher": [] "problemMatcher": []
} }
] ]

View File

@ -295,29 +295,4 @@ public class UnitTestInfinityQSV4Controller
NonThrowTryCatch(); NonThrowTryCatch();
} }
[TestMethod]
public void GetEngineeringSpcReview()
{
_Logger?.LogInformation("Starting Web Application");
IServiceProvider? serviceProvider = _WebApplicationFactory?.Services.CreateScope().ServiceProvider;
IInfinityQSV4Repository? infinityQSV4Repository = serviceProvider?.GetRequiredService<IInfinityQSV4Repository>();
Dictionary<string, List<string>>? results = infinityQSV4Repository?.GetEngineeringSpcReview();
Assert.IsNotNull(results);
_Logger?.LogInformation("{TestName} completed", _TestContext?.TestName);
NonThrowTryCatch();
}
[TestMethod]
public async Task GetEngineeringSpcReviewApi()
{
HttpClient? httpClient = _WebApplicationFactory?.CreateClient();
_Logger?.LogInformation("Starting Web Application");
Assert.IsTrue(httpClient is not null);
string? result = await httpClient.GetStringAsync($"api/{_ControllerName}/engineering-spc-review");
File.WriteAllText(Path.Combine(AppContext.BaseDirectory, $"{_ControllerName}-{nameof(GetEngineeringSpcReview)}.json"), result);
Assert.IsNotNull(result);
_Logger?.LogInformation("{TestName} completed", _TestContext?.TestName);
NonThrowTryCatch();
}
} }

View File

@ -116,31 +116,4 @@ public class UnitTestWaferCounterController
NonThrowTryCatch(); NonThrowTryCatch();
} }
[Ignore]
[TestMethod]
public void GetLastQuantityAndSlotMapWithText()
{
_Logger?.LogInformation("Starting Web Application");
IServiceProvider? serviceProvider = _WebApplicationFactory?.Services.CreateScope().ServiceProvider;
IWaferCounterRepository? waferCounterRepository = serviceProvider?.GetRequiredService<IWaferCounterRepository>();
WaferCounter? result = waferCounterRepository?.GetLastQuantityAndSlotMapWithText("EPP-East", "8INCH", "123456");
Assert.IsNotNull(result);
_Logger?.LogInformation("{TestName} completed", _TestContext?.TestName);
NonThrowTryCatch();
}
[Ignore]
[TestMethod]
public async Task GetLastQuantityAndSlotMapWithTextApi()
{
HttpClient? httpClient = _WebApplicationFactory?.CreateClient();
_Logger?.LogInformation("Starting Web Application");
Assert.IsTrue(httpClient is not null);
string? json = await httpClient.GetStringAsync($"api/{_ControllerName}/8INCH/last-quantity-and-slot-map-with-text/?area=EPP-East&text=123456");
File.WriteAllText(Path.Combine(AppContext.BaseDirectory, $"{_ControllerName}-{nameof(GetLastQuantityAndSlotMapWithText)}.json"), json);
Assert.IsNotNull(json);
_Logger?.LogInformation("{TestName} completed", _TestContext?.TestName);
NonThrowTryCatch();
}
} }