5 Commits

Author SHA1 Message Date
0a529a0206 Bump
Remove static from solution
2025-02-21 10:46:20 -07:00
141f9c084a AzureDevOpsRepository
Switch to DataGrid
Markdown links
Add css for files, leo and mes
copySelectedB
Logic for other collections
monospace
Ticks bug fix, default to *.wc files and formatting
2024-10-14 12:24:43 -07:00
018382e218 Characterization Data with Static Site 2024-09-23 10:27:36 -07:00
4c2bef71ec Characterization Data
FI Backlog with Ignore Tag
2024-09-19 10:13:10 -07:00
b824c4ba36 Get text from OI 2024-08-28 15:58:20 -07:00
49 changed files with 989 additions and 153 deletions

2
.gitignore vendored
View File

@ -344,3 +344,5 @@ ASALocalRun/
.kanbn
Tests/.kanbn
/Wafer-Counter/.vscode/.UserSecrets/secrets.json

View File

@ -28,19 +28,19 @@
<PackageReference Include="Dapper" Version="2.1.44" />
<PackageReference Include="EntityFramework" Version="6.5.1" />
<PackageReference Include="jQuery" Version="3.7.1" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Server" Version="8.0.7" />
<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.UserSecrets" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Hosting.WindowsServices" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Hosting" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.EventLog" Version="8.0.0" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Server" Version="8.0.10" />
<PackageReference Include="Microsoft.Extensions.Caching.Memory" Version="8.0.1" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="8.0.1" />
<PackageReference Include="Microsoft.Extensions.Configuration.UserSecrets" Version="8.0.1" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="8.0.1" />
<PackageReference Include="Microsoft.Extensions.Hosting.WindowsServices" Version="8.0.1" />
<PackageReference Include="Microsoft.Extensions.Hosting" Version="8.0.1" />
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="8.0.1" />
<PackageReference Include="Microsoft.Extensions.Logging.EventLog" Version="8.0.1" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.6.2" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.8.1" />
<PackageReference Include="System.Data.SqlClient" Version="4.8.6" />
<PackageReference Include="System.Drawing.Common" Version="8.0.7" />
<PackageReference Include="System.Drawing.Common" Version="8.0.10" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Shared\OI.Metrology.Shared.csproj" />

View File

@ -2,6 +2,7 @@ using OI.Metrology.Server.Models;
using OI.Metrology.Shared.DataModels;
using OI.Metrology.Shared.Models;
using OI.Metrology.Shared.Models.Stateless;
using System.Collections.ObjectModel;
using System.Data;
using System.Globalization;
using System.Text;
@ -44,15 +45,15 @@ public class ExportRepository : IExportRepository
List<NginxFileSystemSortable> results = new();
Uri uri;
string[] weeks = Get();
List<NginxFileSystemSortable> nginxFileSystemSortableCollection;
ReadOnlyCollection<NginxFileSystemSortable> collection;
foreach (string weekYear in weeks)
{
if (headerCommon.ID < 1)
uri = _FileShareRepository.Append(new Uri(_AppSettings.EcMesaFileShareMetrologySi), "Archive", "API", weekYear, $"-{headerCommon.PSN}", $"-{headerCommon.Reactor}", $"-{headerCommon.RDS}");
else
uri = _FileShareRepository.Append(new Uri(_AppSettings.EcMesaFileShareMetrologySi), "Archive", "API", weekYear, $"-{headerCommon.PSN}", $"-{headerCommon.Reactor}", $"-{headerCommon.RDS}", $"-{headerCommon.ID}");
nginxFileSystemSortableCollection = _FileShareRepository.GetNginxFileSystemSortableCollection(httpClient, uri, endsWith);
results.AddRange(nginxFileSystemSortableCollection);
collection = _FileShareRepository.GetNginxFileSystemSortableCollection(httpClient, uri, endsWith);
results.AddRange(collection);
}
return results.OrderByDescending(l => l.DateTime).ToArray();
}

View File

@ -1,5 +1,7 @@
using OI.Metrology.Shared.DataModels;
using OI.Metrology.Shared.Models;
using OI.Metrology.Shared.Models.Stateless;
using System.Collections.ObjectModel;
using System.Text.Json;
using System.Web;
@ -78,7 +80,7 @@ public class FileShareRepository : IFileShareRepository
return result;
}
List<NginxFileSystemSortable> IFileShareRepository.GetNginxFileSystemSortableCollection(HttpClient httpClient, Uri uri, string? endsWith)
ReadOnlyCollection<NginxFileSystemSortable> IFileShareRepository.GetNginxFileSystemSortableCollection(HttpClient httpClient, Uri uri, string? endsWith)
{
List<NginxFileSystemSortable> results = new();
Task<HttpResponseMessage> httpResponseMessage = httpClient.GetAsync(uri);
@ -97,7 +99,13 @@ public class FileShareRepository : IFileShareRepository
results.Add(nginxFileSystemSortable);
}
}
return results;
return new(results);
}
ReadOnlyCollection<CharacterizationInfo> IFileShareRepository.GetArchiveData(CharacterizationParameters archiveParameters) =>
throw new NotImplementedException();
ReadOnlyCollection<ToolTypeNameId> IFileShareRepository.GetEquipmentIds() =>
throw new NotImplementedException();
}

View File

@ -0,0 +1,36 @@
using System.Text.Json.Serialization;
namespace OI.Metrology.Shared.DataModels;
public class WaferCounterArchive
{
public long ID { get; set; }
public DateTime InsertDate { get; set; }
public Guid AttachmentID { get; set; }
public string? Title { get; set; }
public DateTime Date { get; set; }
public long ToolTypeID { get; set; }
public string? ToolTypeName { get; set; }
public string? MesEntity { get; set; }
public string? Employee { get; set; }
public string? Layer { get; set; }
public string? PSN { get; set; }
public string? RDS { get; set; }
public string? Reactor { get; set; }
public string? Recipe { get; set; }
public string? Zone { get; set; }
public string? SlotMap { get; set; }
public string? Text { get; set; }
public int? Total { get; set; }
}
[JsonSourceGenerationOptions(WriteIndented = true, NumberHandling = JsonNumberHandling.AllowReadingFromString)]
[JsonSerializable(typeof(WaferCounterArchive))]
public partial class WaferCounterArchiveSourceGenerationContext : JsonSerializerContext
{
}

View File

@ -0,0 +1,5 @@
namespace OI.Metrology.Shared.Models;
public record CharacterizationInfo(string? Lot,
DateTime LastWriteTime,
string[] Lines);

View File

@ -0,0 +1,16 @@
using System.Text.Json.Serialization;
namespace OI.Metrology.Shared.Models;
public record CharacterizationParameters([property: JsonPropertyName("area")] string? Area,
[property: JsonPropertyName("equipment-id")] string? EquipmentId,
[property: JsonPropertyName("search-pattern")] string? SearchPattern,
[property: JsonPropertyName("start-time")] string? StartTime,
[property: JsonPropertyName("end-time")] string? EndTime,
[property: JsonPropertyName("wafer-size")] string? WaferSize);
[JsonSourceGenerationOptions(WriteIndented = true)]
[JsonSerializable(typeof(CharacterizationParameters))]
public partial class CharacterizationParametersSourceGenerationContext : JsonSerializerContext
{
}

View File

@ -0,0 +1,17 @@
using System.Text.Json.Serialization;
namespace OI.Metrology.Shared.Models;
public record PollValue(string? Json,
[property: JsonPropertyName("id")] int? Id,
[property: JsonPropertyName("page")] string? Page,
string? QueryString,
string? RemoteIpAddress,
[property: JsonPropertyName("time")] long? Time,
[property: JsonPropertyName("value")] int? Value);
[JsonSourceGenerationOptions(WriteIndented = true, NumberHandling = JsonNumberHandling.AllowReadingFromString)]
[JsonSerializable(typeof(PollValue))]
public partial class PollValueSourceGenerationContext : JsonSerializerContext
{
}

View File

@ -0,0 +1,16 @@
namespace OI.Metrology.Shared.Models.Stateless;
public interface IAzureDevOpsController<T>
{
enum Action : int
{
Index = 0,
Save = 1
}
static string GetRouteName() => nameof(IAzureDevOpsController<T>)[1..^10];
T Save();
}

View File

@ -0,0 +1,8 @@
namespace OI.Metrology.Shared.Models.Stateless;
public interface IAzureDevOpsRepository
{
void Save(PollValue pollValue);
}

View File

@ -1,3 +1,6 @@
using OI.Metrology.Shared.DataModels;
using System.Collections.ObjectModel;
namespace OI.Metrology.Shared.Models.Stateless;
public interface IFileShareRepository
@ -7,9 +10,10 @@ public interface IFileShareRepository
void MoveFile(string from, string to);
Uri Append(Uri uri, params string[] paths);
void FileWrite(string path, string contents);
ReadOnlyCollection<ToolTypeNameId> GetEquipmentIds();
HttpResponseMessage ReadFile(HttpClient httpClient, Uri uri);
void CopyFile(HttpClient httpClient, string from, string to);
void MoveFile(HttpClient httpClient, string from, string to);
List<NginxFileSystemSortable> GetNginxFileSystemSortableCollection(HttpClient httpClient, Uri uri, string? endsWith);
ReadOnlyCollection<CharacterizationInfo> GetArchiveData(CharacterizationParameters characterizationParameters);
ReadOnlyCollection<NginxFileSystemSortable> GetNginxFileSystemSortableCollection(HttpClient httpClient, Uri uri, string? endsWith);
}

View File

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

View File

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

View File

@ -50,6 +50,7 @@
<li><a href="/export.html">Export</a></li>
<li><a href="https://oi-metrology-viewer-archive.mes.infineon.com/" target="_blank">Archive</a></li>
<li><a href="https://goto.infineon.com/oiwizard" target="_blank">OI Web Services</a></li>
<li><a href="/mes.html" target="_blank">FI Backlog</a></li>
</ul>
<p class="navbar-text navbar-right">
&nbsp;

View File

@ -50,6 +50,7 @@
<li><a href="/export.html">Export</a></li>
<li><a href="https://oi-metrology-viewer-archive.mes.infineon.com/" target="_blank">Archive</a></li>
<li><a href="https://goto.infineon.com/oiwizard" target="_blank">OI Web Services</a></li>
<li><a href="/mes.html" target="_blank">FI Backlog</a></li>
</ul>
<p class="navbar-text navbar-right">
&nbsp;

View File

@ -50,6 +50,7 @@
<li><a href="/export.html">Export</a></li>
<li><a href="https://oi-metrology-viewer-archive.mes.infineon.com/" target="_blank">Archive</a></li>
<li><a href="https://goto.infineon.com/oiwizard" target="_blank">OI Web Services</a></li>
<li><a href="/mes.html" target="_blank">FI Backlog</a></li>
</ul>
<p class="navbar-text navbar-right">
&nbsp;

View File

@ -50,6 +50,7 @@
<li><a href="/export.html">Export</a></li>
<li><a href="https://oi-metrology-viewer-archive.mes.infineon.com/" target="_blank">Archive</a></li>
<li><a href="https://goto.infineon.com/oiwizard" target="_blank">OI Web Services</a></li>
<li><a href="/mes.html" target="_blank">FI Backlog</a></li>
</ul>
<p class="navbar-text navbar-right">
&nbsp;

View File

@ -50,6 +50,7 @@
<li><a href="/export.html">Export</a></li>
<li><a href="https://oi-metrology-viewer-archive.mes.infineon.com/" target="_blank">Archive</a></li>
<li><a href="https://goto.infineon.com/oiwizard" target="_blank">OI Web Services</a></li>
<li><a href="/mes.html" target="_blank">FI Backlog</a></li>
</ul>
<p class="navbar-text navbar-right">
&nbsp;

View File

@ -50,6 +50,7 @@
<li><a href="/export.html">Export</a></li>
<li><a href="https://oi-metrology-viewer-archive.mes.infineon.com/" target="_blank">Archive</a></li>
<li><a href="https://goto.infineon.com/oiwizard" target="_blank">OI Web Services</a></li>
<li><a href="/mes.html" target="_blank">FI Backlog</a></li>
</ul>
<p class="navbar-text navbar-right">
&nbsp;

View File

@ -50,6 +50,7 @@
<li><a href="/export.html">Export</a></li>
<li><a href="https://oi-metrology-viewer-archive.mes.infineon.com/" target="_blank">Archive</a></li>
<li><a href="https://goto.infineon.com/oiwizard" target="_blank">OI Web Services</a></li>
<li><a href="/mes.html" target="_blank">FI Backlog</a></li>
</ul>
<p class="navbar-text navbar-right">
&nbsp;

View File

@ -50,6 +50,7 @@
<li><a href="/export.html">Export</a></li>
<li><a href="https://oi-metrology-viewer-archive.mes.infineon.com/" target="_blank">Archive</a></li>
<li><a href="https://goto.infineon.com/oiwizard" target="_blank">OI Web Services</a></li>
<li><a href="/mes.html" target="_blank">FI Backlog</a></li>
</ul>
<p class="navbar-text navbar-right">
&nbsp;

View File

@ -50,6 +50,7 @@
<li><a href="/export.html">Export</a></li>
<li><a href="https://oi-metrology-viewer-archive.mes.infineon.com/" target="_blank">Archive</a></li>
<li><a href="https://goto.infineon.com/oiwizard" target="_blank">OI Web Services</a></li>
<li><a href="/mes.html" target="_blank">FI Backlog</a></li>
</ul>
<p class="navbar-text navbar-right">
&nbsp;

View File

@ -49,6 +49,7 @@
<li><a href="/export.html">Export</a></li>
<li><a href="https://oi-metrology-viewer-archive.mes.infineon.com/" target="_blank">Archive</a></li>
<li><a href="https://goto.infineon.com/oiwizard" target="_blank">OI Web Services</a></li>
<li><a href="/mes.html" target="_blank">FI Backlog</a></li>
</ul>
<p class="navbar-text navbar-right">
&nbsp;

View File

@ -50,6 +50,7 @@
<li><a href="/export.html" class="alert-info">Export</a></li>
<li><a href="https://oi-metrology-viewer-archive.mes.infineon.com/" target="_blank">Archive</a></li>
<li><a href="https://goto.infineon.com/oiwizard" target="_blank">OI Web Services</a></li>
<li><a href="/mes.html" target="_blank">FI Backlog</a></li>
</ul>
<p class="navbar-text navbar-right">
&nbsp;

BIN
Static/favicon.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

View File

@ -6,25 +6,25 @@
<meta name="viewport" content="width=device-width" />
<title>File(s)</title>
<script src="/js/modernizr-3.6.0-custom.js?no-cache=2024-06-18-10-54" type="text/javascript"></script>
<script src="/js/modernizr-3.6.0-custom.js?no-cache=2024-10-04-08-34" type="text/javascript"></script>
<link href="/styles/bootstrap.min.css?no-cache=2024-06-18-10-54" rel="stylesheet" />
<link href="/igniteui/css/themes/bootstrap3/default/infragistics.theme.css?no-cache=2024-06-18-10-54"
<link href="/styles/bootstrap.min.css?no-cache=2024-10-04-08-34" rel="stylesheet" />
<link href="/igniteui/css/themes/bootstrap3/default/infragistics.theme.css?no-cache=2024-10-04-08-34"
rel="stylesheet" />
<link href="/igniteui/css/structure/infragistics.css?no-cache=2024-06-18-10-54" rel="stylesheet" />
<link href="/styles/site-server.css?no-cache=2024-06-18-10-54" rel="stylesheet" />
<link href="/styles/index.css?no-cache=2024-06-18-10-54" rel="stylesheet" />
<link href="/igniteui/css/structure/infragistics.css?no-cache=2024-10-04-08-34" rel="stylesheet" />
<link href="/styles/site-server.css?no-cache=2024-10-04-08-34" rel="stylesheet" />
<link href="/styles/files.css?no-cache=2024-10-04-08-34" rel="stylesheet" />
<script src="/js/jquery-3.6.0.min.js?no-cache=2024-06-18-10-54" type="text/javascript"></script>
<script src="/js/jquery-ui.min.js?no-cache=2024-06-18-10-54" type="text/javascript"></script>
<script src="/igniteui/js/infragistics.core.js?no-cache=2024-06-18-10-54" type="text/javascript"></script>
<script src="/igniteui/js/infragistics.lob.js?no-cache=2024-06-18-10-54" type="text/javascript"></script>
<script src="/igniteui/js/infragistics.dv.js?no-cache=2024-06-18-10-54" type="text/javascript"></script>
<script src="/js/jquery-3.6.0.min.js?no-cache=2024-10-04-08-34" type="text/javascript"></script>
<script src="/js/jquery-ui.min.js?no-cache=2024-10-04-08-34" type="text/javascript"></script>
<script src="/igniteui/js/infragistics.core.js?no-cache=2024-10-04-08-34" type="text/javascript"></script>
<script src="/igniteui/js/infragistics.lob.js?no-cache=2024-10-04-08-34" type="text/javascript"></script>
<script src="/igniteui/js/infragistics.dv.js?no-cache=2024-10-04-08-34" type="text/javascript"></script>
<script src="/js/chart-4.3.0.min.js" type="module"></script>
<script src="/js/common.js?no-cache=2024-06-18-10-54" type="text/javascript"></script>
<script src="/js/site-server.js?no-cache=2024-06-18-10-54" type="text/javascript"></script>
<script src="/js/common.js?no-cache=2024-10-04-08-34" type="text/javascript"></script>
<script src="/js/site-server.js?no-cache=2024-10-04-08-34" type="text/javascript"></script>
</head>
<body>
@ -50,6 +50,7 @@
<li><a href="/export.html">Export</a></li>
<li><a href="https://oi-metrology-viewer-archive.mes.infineon.com/" target="_blank">Archive</a></li>
<li><a href="https://goto.infineon.com/oiwizard" target="_blank">OI Web Services</a></li>
<li><a href="/mes.html" target="_blank">FI Backlog</a></li>
</ul>
<p class="navbar-text navbar-right">
&nbsp;
@ -63,7 +64,7 @@
<form class="form-inline mb-4">
<div class="form-group">
<label for="ToolType">Tool Type</label>
<label for="ToolType">Tool</label>
<div class="form-control" id="ToolType"></div>
</div>
<div class="form-group">
@ -93,7 +94,7 @@
</div>
</form>
<div style="height: 300px;" id="HeaderGridDiv">
<div style="height: 500px;" id="HeaderGridDiv">
<span id="ToolTypeID" hidden></span>
<table id="HeaderGrid"></table>
</div>
@ -102,46 +103,14 @@
<div class="col-xs-1">
<input type="button" class="btn" id="GetDataButton" value="Get Data" disabled />
</div>
<div class="col-xs-1">
<input type="button" class="btn" id="ReviewButton" value="Review" disabled />
</div>
<div class="col-xs-1">
<input type="button" class="btn" id="RecipeParametersButton" value="Parameters" disabled />
</div>
<div class="col-xs-1">
<input type="button" class="btn" id="ViewButton" value="View" disabled />
</div>
<div class="col-xs-1">
<input type="button" class="btn" id="PinButton" value="Pin" disabled />
</div>
</div>
<div id="DetailsDiv" hidden>
<span id="HeaderId" hidden></span>
<span id="HeaderAttachmentId" hidden></span>
<div style="padding-bottom: 20px;" id="DetailsGridDiv">
<table id="DetailsGrid"></table>
</div>
<div id="ExportDiv" style="margin-top: 10px;" hidden>
<input type="button" value="Send to OpenInsight" id="OIExportButton" />
<span id="OIExportResult" style="margin-left: 10px; font-weight: bold; color: #366b02;"></span>
</div>
<p style="margin-top: 20px;">
<iframe id="DataAttachmentFrame" style="height:900px; border-width:thin; margin-right: 10px;"
hidden></iframe>
<iframe id="HeaderAttachmentFrame" style="height:900px; border-width:thin;" hidden></iframe>
&nbsp;
<div id="DataAttachmentDiv" hidden>
<canvas id="DataAttachmentCanvas"></canvas>
</div>
<div id="HeaderAttachmentDiv" hidden>
<canvas id="HeaderAttachmentCanvas"></canvas>
</div>
</p>
</div>
<hr />
@ -152,9 +121,9 @@
<div id="MessageModal"></div>
<script src="/js/bootstrap.min.js?no-cache=2024-06-18-10-54" type="text/javascript"></script>
<script src="/js/respond.min.js?no-cache=2024-06-18-10-54" type="text/javascript"></script>
<script src="/js/files.js?no-cache=2024-06-18-10-54" type="text/javascript"></script>
<script src="/js/bootstrap.min.js?no-cache=2024-10-04-08-34" type="text/javascript"></script>
<script src="/js/respond.min.js?no-cache=2024-10-04-08-34" type="text/javascript"></script>
<script src="/js/files.js?no-cache=2024-10-04-08-34" type="text/javascript"></script>
</body>
</html>

View File

@ -50,6 +50,7 @@
<li><a href="/export.html">Export</a></li>
<li><a href="https://oi-metrology-viewer-archive.mes.infineon.com/" target="_blank">Archive</a></li>
<li><a href="https://goto.infineon.com/oiwizard" target="_blank">OI Web Services</a></li>
<li><a href="/mes.html" target="_blank">FI Backlog</a></li>
</ul>
<p class="navbar-text navbar-right">
&nbsp;

View File

@ -1,10 +1,5 @@
$(document).ready(function () {
const queryString = window.location.search;
const urlParams = new URLSearchParams(queryString);
const initialHeaderId = urlParams.get('headerid');
const initialToolTypeID = urlParams.get('tooltypeid');
const initialHeaderAttachmentId = urlParams.get('headerattachmentid');
initFiles("https://oi-metrology-viewer-prod.mes.infineon.com:4433/api", "https://oi-metrology-viewer-prod.mes.infineon.com", initialToolTypeID, initialHeaderId, initialHeaderAttachmentId);
initFiles("https://oi-metrology-viewer-prod.mes.infineon.com:4438/api", "https://oi-metrology-viewer-prod.mes.infineon.com", "https://eaf-prod.mes.infineon.com:4439");
});

View File

@ -2,12 +2,14 @@ var _chart = null;
var _CdeId = null;
var _apiUrl = null;
var _BioRadId = null;
var _Collection = [];
var _toolType = null;
var _StaticUrl = null;
var _workMaterial = {};
var _initialHeaderId = null;
var _toolTypeMetaData = null;
var _initialHeaderAttachmentId = null;
var _EcMesaFileShareCharacterizationSi = null;
async function loadRunInfoAwaitingDisposition() {
var row = $("#grid").igGrid("selectedRow");
@ -169,6 +171,34 @@ function loadHeaderGridRunInfo() {
});
}
function loadHeaderGridFiles() {
var toolTypeName = $("#ToolType").igCombo("text");
$("#ToolTypeID").text("");
hideDetailsDivRunInfo();
disableHeaderButtonsRunInfo();
$("#HeaderId").text("");
$("#HeaderAttachmentId").text("");
var gridCreated = $("#HeaderGrid").data("igGrid");
if (gridCreated)
$("#HeaderGrid").igGrid("destroy");
$.ajax({
type: "GET",
url: _EcMesaFileShareCharacterizationSi + "/Archive/" + toolTypeName + ".json",
success: function (r) {
if ((r.Results == null) || (r.Results.ToolType == null) || (r.Results.Metadata == null))
ShowErrorMessage("Invalid tool-type: " + toolTypeName);
else {
_toolType = r.Results.ToolType;
_toolTypeMetaData = r.Results.Metadata;
requestHeaderDataFiles();
}
},
error: function (e) {
DisplayWSMessage("error", "There was an error getting tool-type info by archive.", e);
}
});
}
function disableHeaderButtonsRunInfo() {
$("#GetDataButton").prop("disabled", true);
$("#ReviewButton").prop("disabled", true);
@ -632,6 +662,39 @@ function copySelected(attachmentID, title, data) {
copy(allText);
}
function copySelectedB(attachmentID, title, collection) {
var allText = "";
var headerText = "";
var selectedRow = $("#HeaderGrid").data("igGridSelection").selectedRow();
if (selectedRow !== null) {
var rowData = $("#HeaderGrid").data("igGrid").dataSource.dataView()[selectedRow.index];
for (const property in rowData) {
if (property === "ID" || property === attachmentID || property === title)
continue;
allText = allText + property + '\t';
headerText = headerText + rowData[property] + '\t';
}
}
for (var i = 0; i < collection.length; i++) {
if (i === 0) {
for (const property in collection[i]) {
if (property === "ID" || property === "InsertDate" || property === attachmentID || property === title)
continue;
allText = allText + property + '\t';
}
allText = allText + '\r';
}
allText = allText + headerText;
for (const property in collection[i]) {
if (property === "ID" || property === "InsertDate" || property === attachmentID || property === title)
continue;
allText = allText + collection[i][property] + '\t';
}
allText = allText + '\r';
}
copy(allText);
}
function loadDetailsRunInfo() {
showDetailsDivRunInfo();
loadHeaderAttachmentRunInfo();
@ -667,7 +730,7 @@ function loadDetailsRunInfo() {
}
}
$.getJSON(detailsURL, function (data) {
var gridParms = {
var gridParams = {
autoGenerateColumns: false,
primaryKey: "ID",
features: [
@ -682,21 +745,96 @@ function loadDetailsRunInfo() {
dataBound: markAsReviewedRunInfo,
};
if ((_toolType != null) && (_toolType.DataGridAttributes != null)) {
jQuery.extend(gridParms, JSON.parse(_toolType.DataGridAttributes));
jQuery.extend(gridParams, JSON.parse(_toolType.DataGridAttributes));
}
$("#DetailsGrid").igGrid(gridParms);
$("#DetailsGrid").igGrid(gridParams);
if ($("#chkCopyOnGet").is(':checked')) {
copySelected(attachmentID, title, data);
}
});
}
function loadDetailsGridFiles() {
showDetailsDivRunInfo();
loadHeaderAttachmentRunInfo();
var collection = [];
var gridCreated = $("#DetailsGrid").data("igGrid");
if (gridCreated)
$("#DetailsGrid").igGrid("destroy");
var title = "Title";
var attachmentID = "AttachmentID";
var gridColumns = [
{ key: "ID", dataType: "number", hidden: true },
{ key: attachmentID, dataType: "string", hidden: true },
{ key: title, dataType: "string", hidden: true },
];
var selectedRow = $("#HeaderGrid").data("igGridSelection").selectedRow();
if (selectedRow == null)
return;
var rowData = $("#HeaderGrid").data("igGrid").dataSource.dataView()[selectedRow.index];
for (var i = 0; i < _Collection.length; i++) {
if (_Collection[i].Details == null || _Collection[i].ID !== rowData.ID || _Collection[i].ArchiveLot !== rowData.ArchiveLot)
continue;
for (var j = 0; j < _Collection[i].Details.length; j++) {
_Collection[i].Details[j]['ID'] = j;
collection.push(_Collection[i].Details[j]);
}
}
if (collection.length === 0) {
gridColumns.push({
key: "No Data",
headerText: "No Data",
width: "150px",
});
}
else {
for (var i = 0; i < _toolTypeMetaData.length; i++) {
var f = _toolTypeMetaData[i];
if ((f.Header == false) && (f.GridDisplayOrder > 0)) {
var col = {
key: f.ApiName,
headerText: f.DisplayTitle,
width: "150px",
};
if (f.GridAttributes != null)
jQuery.extend(col, JSON.parse(f.GridAttributes));
if (col.formatter != null) {
if (col.formatter == "boolToYesNo")
col.formatter = boolToYesNo;
else
col.formatter = null;
}
gridColumns.push(col);
}
}
}
var gridParams = {
autoGenerateColumns: false,
primaryKey: "ID",
features: [
{ name: "Selection", mode: "row" },
{ name: "Resizing" },
{ name: "Sorting", type: "local" }
],
columns: gridColumns,
dataSource: collection,
dataSourceType: 'json'
};
if ((_toolType != null) && (_toolType.DataGridAttributes != null)) {
jQuery.extend(gridParams, JSON.parse(_toolType.DataGridAttributes));
}
$("#DetailsGrid").igGrid(gridParams);
if ($("#chkCopyOnGet").is(':checked')) {
copySelectedB(attachmentID, title, collection);
}
}
function requestHeaderDataRunInfo() {
var startDate = $("#StartDate").igDatePicker("value");
var startTime = $("#StartTime").igTimePicker("value");
var endDate = $("#EndDate").igDatePicker("value");
var endTime = $("#EndTime").igTimePicker("value");
var parms = {
var params = {
datebegin: new Date(
startDate.getFullYear(), startDate.getMonth(), startDate.getDate(),
startTime.getHours(), startTime.getMinutes(), startTime.getSeconds()).toISOString(),
@ -707,7 +845,7 @@ function requestHeaderDataRunInfo() {
var headerId = 0;
if (_initialHeaderId > 0) {
headerId = _initialHeaderId;
parms.headerid = headerId;
params.headerid = headerId;
$("#HeaderId").text(headerId);
$("#HeaderAttachmentId").text(_initialHeaderAttachmentId);
_initialHeaderId = -1;
@ -716,7 +854,7 @@ function requestHeaderDataRunInfo() {
$("#PinButton").hide();
else
$("#PinButton").show();
var headerURL = _apiUrl + "/tooltypes/" + _toolType.ID + "/headers?" + $.param(parms);
var headerURL = _apiUrl + "/tooltypes/" + _toolType.ID + "/headers?" + $.param(params);
var gridColumns = [
{ key: "ID", dataType: "number", hidden: true },
{ key: "AttachmentID", dataType: "string", hidden: true },
@ -741,7 +879,7 @@ function requestHeaderDataRunInfo() {
gridColumns.push(col);
}
}
var gridParms = {
var gridParams = {
autoGenerateColumns: false,
primaryKey: "ID",
height: "100%",
@ -758,14 +896,99 @@ function requestHeaderDataRunInfo() {
responseDataKey: "Results",
};
if ((_toolType != null) && (_toolType.HeaderGridAttributes != null)) {
jQuery.extend(gridParms, JSON.parse(_toolType.HeaderGridAttributes));
jQuery.extend(gridParams, JSON.parse(_toolType.HeaderGridAttributes));
}
$("#HeaderGrid").igGrid(gridParms);
$("#HeaderGrid").igGrid(gridParams);
if (headerId > 0) {
loadDetailsRunInfo();
}
}
function clearArray(array) {
if (array !== null) {
while (array.length > 0) {
array.pop();
}
}
}
function requestHeaderDataFiles() {
clearArray(_Collection);
var toolTypeName = $("#ToolType").igCombo("text");
var startDate = $("#StartDate").igDatePicker("value");
var startTime = $("#StartTime").igTimePicker("value");
var endDate = $("#EndDate").igDatePicker("value");
var endTime = $("#EndTime").igTimePicker("value");
var params = {
area: null,
'end-time': new Date(
endDate.getFullYear(), endDate.getMonth(), endDate.getDate(),
endTime.getHours(), endTime.getMinutes(), endTime.getSeconds()).toISOString(),
'equipment-id': toolTypeName,
'search-pattern': '*.wc',
'start-time': new Date(
startDate.getFullYear(), startDate.getMonth(), startDate.getDate(),
startTime.getHours(), startTime.getMinutes(), startTime.getSeconds()).toISOString(),
'wafer-size': null,
}
var headerURL = _apiUrl + "/v1/file-share/archive-data/?" + $.param(params);
var gridColumns = [
{ key: "ID", dataType: "number", hidden: true },
{ key: "ArchiveLot", dataType: "string", hidden: true },
{ key: "ArchiveLastWriteTime", dataType: "date", hidden: true },
{ key: "AttachmentID", dataType: "string", hidden: true },
{ key: "Title", dataType: "string", hidden: true },
];
for (var i = 0; i < _toolTypeMetaData.length; i++) {
var f = _toolTypeMetaData[i];
if ((f.Header == true) && (f.GridDisplayOrder > 0)) {
var col = {
key: f.ApiName,
headerText: f.DisplayTitle,
width: "150px",
};
if (f.GridAttributes != null)
jQuery.extend(col, JSON.parse(f.GridAttributes));
if (col.formatter != null) {
if (col.formatter == "boolToYesNo")
col.formatter = boolToYesNo;
else
col.formatter = null;
}
gridColumns.push(col);
}
}
$.getJSON(headerURL, function (data) {
var singleton;
for (var i = 0; i < data.length; i++) {
singleton = JSON.parse(data[i].lines.join(' '));
singleton['ID'] = i;
singleton['ArchiveLot'] = data[i].lot;
singleton['ArchiveLastWriteTime'] = data[i].lastWriteTime;
_Collection.push(singleton);
}
var gridParams = {
autoGenerateColumns: false,
height: "100%",
width: "100%",
features: [
{ name: "Paging", type: "local", recordCountKey: "TotalRows", pageSize: 100, pageSizeList: [50, 100, 250, 500], pageSizeUrlKey: "pageSize", "pageIndexUrlKey": "page" },
{ name: "Selection", mode: "row", rowSelectionChanged: headerSelectionChangedRunInfo },
{ name: "Filtering", type: "local" },
{ name: 'Resizing' },
{ name: "Sorting", type: "local" }
],
columns: gridColumns,
dataSource: _Collection,
responseDataKey: "Results",
};
if ((_toolType != null) && (_toolType.HeaderGridAttributes != null)) {
jQuery.extend(gridParams, JSON.parse(_toolType.HeaderGridAttributes));
}
$("#HeaderGrid").igGrid(gridParams);
});
}
function reviewButtonRunInfo() {
var toolTypeId = $("#ToolTypeID").text();
var headerId = parseInt($("#HeaderId").text());
@ -1274,43 +1497,29 @@ function restartButton() {
clearWorkMaterial();
};
function initFiles(apiUrl, staticUrl, initialToolTypeID, initialHeaderId, initialHeaderAttachmentId) {
function initFiles(apiUrl, staticUrl, ecMesaFileShareCharacterizationSi) {
_apiUrl = apiUrl;
_initialHeaderId = ""
_StaticUrl = staticUrl;
_initialHeaderId = initialHeaderId === null ? "" : initialHeaderId;
_initialHeaderAttachmentId = initialHeaderAttachmentId === null ? "" : initialHeaderAttachmentId;
$.getJSON(_apiUrl + '/tooltypes', function (data) {
for (var i = 0; i < data.Results.length; i++) {
if (data.Results[i].ToolTypeName === "CDE") {
_CdeId = data.Results[i].ID;
}
else if (data.Results[i].ToolTypeName === "BioRad") {
_BioRadId = data.Results[i].ID;
}
}
_initialHeaderAttachmentId = "";
_EcMesaFileShareCharacterizationSi = ecMesaFileShareCharacterizationSi;
$.getJSON(_apiUrl + '/v1/file-share/equipment-ids', function (data) {
$("#ToolType").igCombo({
dataSource: data,
responseDataKey: "Results",
textKey: "ToolTypeName",
valueKey: "ID",
textKey: "toolTypeName",
valueKey: "id",
mode: "dropdown",
width: 150,
itemsRendered: function (evt, ui) {
loadHeaderGridRunInfo();
itemsRendered: function () {
loadHeaderGridFiles();
},
selectionChanged: loadHeaderGridRunInfo,
initialSelectedItems: [{ value: initialToolTypeID === null ? 1 : initialToolTypeID }]
selectionChanged: loadHeaderGridFiles,
});
});
setInitialDateTimesRunInfo(6 * 60 * 60 * 1000);
$("#HeaderGrid").on("dblclick", "tr", loadDetailsRunInfo);
$("#LoadHeadersButton").click(loadHeaderGridRunInfo);
$("#GetDataButton").click(loadDetailsRunInfo);
$("#ReviewButton").click(reviewButtonRunInfo);
$("#RecipeParametersButton").click(recipeParametersButtonRunInfo);
$("#ViewButton").click(viewButtonRunInfo);
$("#PinButton").click(pinButtonRunInfo);
$("#OIExportButton").click(oiExportButtonRunInfo);
$("#HeaderGrid").on("dblclick", "tr", loadDetailsGridFiles);
$("#LoadHeadersButton").click(loadHeaderGridFiles);
$("#GetDataButton").click(loadDetailsGridFiles);
setInterval(function () {
if ($("#chkAutoRefresh").is(':checked')) {
setInitialDateTimesRunInfo(null);

View File

@ -50,6 +50,7 @@
<li><a href="/export.html">Export</a></li>
<li><a href="https://oi-metrology-viewer-archive.mes.infineon.com/" target="_blank">Archive</a></li>
<li><a href="https://goto.infineon.com/oiwizard" target="_blank">OI Web Services</a></li>
<li><a href="/mes.html" target="_blank">FI Backlog</a></li>
</ul>
<p class="navbar-text navbar-right">
&nbsp;

12
Static/styles/files.css Normal file
View File

@ -0,0 +1,12 @@
#HeaderGridDiv,
#DetailsGridDiv {
font-size: 12px;
}
#HeaderGrid {
font-family: monospace;
}
#DetailsGrid {
font-family: monospace;
}

View File

@ -26,19 +26,20 @@
<DefineConstants>Linux</DefineConstants>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="coverlet.collector" Version="6.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.DependencyInjection" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Hosting" Version="8.0.0" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="6.0.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
<PackageReference Include="MSTest.TestAdapter" Version="3.1.1" />
<PackageReference Include="MSTest.TestFramework" Version="3.1.1" />
<PackageReference Include="coverlet.collector" Version="6.0.4" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="8.0.1" />
<PackageReference Include="Microsoft.Extensions.Configuration.UserSecrets" Version="8.0.1" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="8.0.1" />
<PackageReference Include="Microsoft.Extensions.Hosting" Version="8.0.1" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="8.0.12" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.12.0" />
<PackageReference Include="MSTest.TestAdapter" Version="3.7.2" />
<PackageReference Include="MSTest.TestFramework" Version="3.7.2" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Shared\OI.Metrology.Shared.csproj" />
<ProjectReference Include="..\Server\OI.Metrology.Server.csproj" />
<ProjectReference Include="..\Wafer-Counter\OI.Metrology.Wafer.Counter.csproj" />
</ItemGroup>
<ItemGroup>
<None Include="..\.Data\RdsMaxRepo.json">

View File

@ -233,7 +233,6 @@ public class UnitTestExportController
_Logger?.LogInformation("{TestName} completed", _TestContext?.TestName);
}
[Ignore]
[TestMethod]
public void GetCSVExport()
{

View File

@ -1,7 +1,10 @@
using Microsoft.AspNetCore.Mvc.Testing;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using OI.Metrology.Shared.DataModels;
using OI.Metrology.Shared.Models;
using OI.Metrology.Shared.Models.Stateless;
using System.Collections.ObjectModel;
namespace OI.Metrology.Tests;
@ -14,7 +17,7 @@ public class UnitTestFileShareController
private static ILogger? _Logger;
private static string _ControllerName;
private static TestContext _TestContext;
private static WebApplicationFactory<Server.Program>? _WebApplicationFactory;
private static WebApplicationFactory<Wafer.Counter.Program>? _WebApplicationFactory;
#pragma warning restore
@ -22,10 +25,11 @@ public class UnitTestFileShareController
public static void ClassInitAsync(TestContext testContext)
{
_TestContext = testContext;
_WebApplicationFactory = new WebApplicationFactory<Server.Program>();
_WebApplicationFactory = new WebApplicationFactory<Wafer.Counter.Program>();
IServiceProvider serviceProvider = _WebApplicationFactory.Services.CreateScope().ServiceProvider;
_Logger = serviceProvider.GetRequiredService<ILogger<Server.Program>>();
_ControllerName = nameof(Server.ApiControllers.FileShareController)[..^10];
_Logger = serviceProvider.GetRequiredService<ILogger<Wafer.Counter.Program>>();
// _ControllerName = nameof(Server.ApiControllers.FileShareController)[..^10];
_ControllerName = nameof(Wafer.Counter.ApiControllers.FileShareController)[..^10];
}
private static void NonThrowTryCatch()
@ -82,4 +86,61 @@ public class UnitTestFileShareController
NonThrowTryCatch();
}
[TestMethod]
public void GetArchiveData()
{
_Logger?.LogInformation("Starting Web Application");
ReadOnlyCollection<CharacterizationInfo>? result;
CharacterizationParameters characterizationParameters;
IServiceProvider? serviceProvider = _WebApplicationFactory?.Services.CreateScope().ServiceProvider;
IFileShareRepository? fileShareRepository = serviceProvider?.GetRequiredService<IFileShareRepository>();
characterizationParameters = new("FQA", "FQA-8INCH", "*.wc", null, null, "8INCH");
result = fileShareRepository?.GetArchiveData(characterizationParameters);
Assert.IsNotNull(result);
characterizationParameters = new(string.Empty, "BIORAD4", "BIO*.json", null, null, "8INCH");
result = fileShareRepository?.GetArchiveData(characterizationParameters);
Assert.IsNotNull(result);
characterizationParameters = new(string.Empty, "CDE5", "CDE*.json", null, null, "8INCH");
result = fileShareRepository?.GetArchiveData(characterizationParameters);
Assert.IsNotNull(result);
_Logger?.LogInformation("{TestName} completed", _TestContext?.TestName);
NonThrowTryCatch();
}
[TestMethod]
public async Task ArchiveDataApi()
{
HttpClient? httpClient = _WebApplicationFactory?.CreateClient();
_Logger?.LogInformation("Starting Web Application");
Assert.IsTrue(httpClient is not null);
string? response = await httpClient.GetStringAsync($"api/v1/file-share/archive-data/?area=FQA&equipment-id=FQA-8INCH&search-pattern=*.wc&wafer-size=8INCH");
Assert.IsNotNull(response);
_Logger?.LogInformation("{TestName} completed", _TestContext?.TestName);
NonThrowTryCatch();
}
[TestMethod]
public void EquipmentIds()
{
_Logger?.LogInformation("Starting Web Application");
IServiceProvider? serviceProvider = _WebApplicationFactory?.Services.CreateScope().ServiceProvider;
IFileShareRepository? fileShareRepository = serviceProvider?.GetRequiredService<IFileShareRepository>();
ReadOnlyCollection<ToolTypeNameId>? result = fileShareRepository?.GetEquipmentIds();
Assert.IsNotNull(result);
_Logger?.LogInformation("{TestName} completed", _TestContext?.TestName);
NonThrowTryCatch();
}
[TestMethod]
public async Task EquipmentIdsApi()
{
HttpClient? httpClient = _WebApplicationFactory?.CreateClient();
_Logger?.LogInformation("Starting Web Application");
Assert.IsTrue(httpClient is not null);
string? response = await httpClient.GetStringAsync($"api/v1/file-share/equipment-ids");
Assert.IsNotNull(response);
_Logger?.LogInformation("{TestName} completed", _TestContext?.TestName);
NonThrowTryCatch();
}
}

View File

@ -0,0 +1,74 @@
using Microsoft.AspNetCore.Mvc.Testing;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using OI.Metrology.Shared.DataModels;
using OI.Metrology.Shared.Models.Stateless;
namespace OI.Metrology.Tests;
[TestClass]
public class UnitTestWaferCounterController
{
#pragma warning disable CS8618
private static ILogger? _Logger;
private static string _ControllerName;
private static TestContext _TestContext;
private static WebApplicationFactory<Wafer.Counter.Program>? _WebApplicationFactory;
#pragma warning restore
[ClassInitialize]
public static void ClassInitAsync(TestContext testContext)
{
_TestContext = testContext;
_WebApplicationFactory = new WebApplicationFactory<Wafer.Counter.Program>();
IServiceProvider serviceProvider = _WebApplicationFactory.Services.CreateScope().ServiceProvider;
_Logger = serviceProvider.GetRequiredService<ILogger<Wafer.Counter.Program>>();
_ControllerName = nameof(Wafer.Counter.ApiControllers.WaferCounterController)[..^10];
}
private static void NonThrowTryCatch()
{
try
{ throw new Exception(); }
catch (Exception) { }
}
[TestMethod]
public void TestControllerName()
{
_Logger?.LogInformation("Starting Web Application");
Assert.AreEqual(IFileShareController<string>.GetRouteName(), _ControllerName);
_Logger?.LogInformation("{TestName} completed", _TestContext?.TestName);
NonThrowTryCatch();
}
[Ignore]
[TestMethod]
public void GetLastQuantityAndSlotMap()
{
_Logger?.LogInformation("Starting Web Application");
IServiceProvider? serviceProvider = _WebApplicationFactory?.Services.CreateScope().ServiceProvider;
IWaferCounterRepository? waferCounterRepository = serviceProvider?.GetRequiredService<IWaferCounterRepository>();
WaferCounter? result = waferCounterRepository?.GetLastQuantityAndSlotMap(area: "FQA", waferSize: "8INCH", text: "Test");
Assert.IsNotNull(result);
_Logger?.LogInformation("{TestName} completed", _TestContext?.TestName);
NonThrowTryCatch();
}
[Ignore]
[TestMethod]
public async Task LastQuantityAndSlotMapApi()
{
HttpClient? httpClient = _WebApplicationFactory?.CreateClient();
_Logger?.LogInformation("Starting Web Application");
Assert.IsTrue(httpClient is not null);
string? response = await httpClient.GetStringAsync($"api/v1/{_ControllerName}/FQA/last-quantity-and-slot-map/?waferSize=8INCH&text=Test");
Assert.IsNotNull(response);
_Logger?.LogInformation("{TestName} completed", _TestContext?.TestName);
NonThrowTryCatch();
}
}

5
Wafer-Counter/.vscode/mklink.md vendored Normal file
View File

@ -0,0 +1,5 @@
# mklink
```bash Thu Aug 29 2024 09:47:22 GMT-0700 (Mountain Standard Time)
mklink /J "L:\DevOps\Mesa_FI\OI-Metrology\Wafer-Counter\.vscode\.UserSecrets" "C:\Users\phares\AppData\Roaming\Microsoft\UserSecrets\2a0acd34-8f61-47a3-8818-73fa8fe04902"
```

View File

@ -1,6 +1,16 @@
{
"version": "2.0.0",
"tasks": [
{
"label": "dotnetRunDebug",
"command": "dotnet OI.Metrology.Wafer.Counter.dll",
"dependsOn": "build",
"problemMatcher": [],
"type": "shell",
"options": {
"cwd": "${workspaceFolder}/bin/Debug/net8.0"
}
},
{
"label": "build",
"command": "dotnet",

View File

@ -0,0 +1,26 @@
using Microsoft.AspNetCore.Mvc;
using OI.Metrology.Shared.Models;
using OI.Metrology.Shared.Models.Stateless;
using OI.Metrology.Wafer.Counter.Helper;
namespace OI.Metrology.Wafer.Counter.ApiControllers;
[Route("api/v1/ado")]
public class AzureDevOpsController : Controller, IAzureDevOpsController<IResult>
{
private readonly IAzureDevOpsRepository _AzureDevOpsRepository;
public AzureDevOpsController(IAzureDevOpsRepository azureDevOpsRepository) =>
_AzureDevOpsRepository = azureDevOpsRepository;
[HttpPost("save")]
public IResult Save()
{
PollValue? pollValue = ParameterHelper.GetPollValue(Request.HttpContext.Connection?.RemoteIpAddress, Request.Body);
ArgumentNullException.ThrowIfNull(pollValue);
_AzureDevOpsRepository.Save(pollValue);
return Results.Ok();
}
}

View File

@ -1,5 +1,9 @@
using Microsoft.AspNetCore.Mvc;
using OI.Metrology.Shared.DataModels;
using OI.Metrology.Shared.Models;
using OI.Metrology.Shared.Models.Stateless;
using OI.Metrology.Wafer.Counter.Helper;
using System.Collections.ObjectModel;
namespace OI.Metrology.Wafer.Counter.ApiControllers;
@ -33,4 +37,21 @@ public class FileShareController : Controller, IFileShareController<IResult>
return Results.Ok();
}
[HttpGet("archive-data")]
public IActionResult ArchiveData()
{
ReadOnlyCollection<CharacterizationInfo> results;
CharacterizationParameters? characterizationParameters = ParameterHelper.GetCharacterizationParameters(Request.QueryString);
ArgumentNullException.ThrowIfNull(characterizationParameters);
results = _FileShareRepository.GetArchiveData(characterizationParameters);
return Json(results);
}
[HttpGet("equipment-ids")]
public IActionResult EquipmentIds()
{
ReadOnlyCollection<ToolTypeNameId> results = _FileShareRepository.GetEquipmentIds();
return Json(results);
}
}

View File

@ -14,13 +14,13 @@ public class WaferCounterController : Controller, IWaferCounterController<IActio
[ProducesResponseType(StatusCodes.Status400BadRequest)]
[HttpGet("{waferSize}/last-quantity-and-slot-map")]
public IActionResult GetLastQuantityAndSlotMap(string area, string waferSize)
public IActionResult GetLastQuantityAndSlotMap(string area, string waferSize, string text)
{
Shared.DataModels.WaferCounter? waferCounter = _WaferCounterRepository.GetLastQuantityAndSlotMap(area, waferSize);
Shared.DataModels.WaferCounter? waferCounter = _WaferCounterRepository.GetLastQuantityAndSlotMap(area, waferSize, text);
if (waferCounter is null)
return this.BadRequest();
return BadRequest();
else if (!string.IsNullOrEmpty(waferCounter.Message))
return this.BadRequest(waferCounter.Message);
return BadRequest(waferCounter.Message);
else
return Json(waferCounter);
}

View File

@ -0,0 +1,82 @@
using OI.Metrology.Shared.Models;
using System.Collections.Specialized;
using System.Net;
using System.Text.Json;
using System.Web;
namespace OI.Metrology.Wafer.Counter.Helper;
public class ParameterHelper
{
private static Dictionary<string, string?> GetKeyValuePairs(QueryString queryString)
{
Dictionary<string, string?> results = [];
if (queryString.HasValue)
{
NameValueCollection nameValueCollection = HttpUtility.ParseQueryString(queryString.Value);
foreach (string? key in nameValueCollection.AllKeys)
{
if (key is null)
continue;
results.Add(key, nameValueCollection[key]);
}
}
return results;
}
internal static CharacterizationParameters? GetCharacterizationParameters(QueryString queryString)
{
CharacterizationParameters? result;
Dictionary<string, string?> keyValuePairs = GetKeyValuePairs(queryString);
string json = JsonSerializer.Serialize(keyValuePairs, new JsonSerializerOptions() { WriteIndented = true });
result = string.IsNullOrEmpty(json) ? null : JsonSerializer.Deserialize(json, CharacterizationParametersSourceGenerationContext.Default.CharacterizationParameters);
return result;
}
private static string? GetQueryString(Stream stream)
{
string? result;
if (!stream.CanRead)
result = null;
else
{
Task<string> task = new StreamReader(stream).ReadToEndAsync();
result = task.Result;
}
return result;
}
private static Dictionary<string, string?> GetKeyValuePairs(string? queryString)
{
Dictionary<string, string?> results = [];
if (!string.IsNullOrEmpty(queryString))
{
NameValueCollection nameValueCollection = HttpUtility.ParseQueryString(queryString);
foreach (string? key in nameValueCollection.AllKeys)
{
if (key is null)
continue;
results.Add(key, nameValueCollection[key]);
}
}
return results;
}
internal static PollValue? GetPollValue(IPAddress? remoteIpAddress, Stream stream)
{
PollValue? result;
string? queryString = GetQueryString(stream);
Dictionary<string, string?> keyValuePairs = GetKeyValuePairs(queryString);
string json = JsonSerializer.Serialize(keyValuePairs, new JsonSerializerOptions() { WriteIndented = true });
result = string.IsNullOrEmpty(json) ? null : JsonSerializer.Deserialize(json, PollValueSourceGenerationContext.Default.PollValue);
if (result is not null)
{
result = new(null, result.Id, result.Page, queryString, remoteIpAddress is null ? string.Empty : remoteIpAddress.ToString(), result.Time, result.Value);
json = JsonSerializer.Serialize(result, PollValueSourceGenerationContext.Default.PollValue);
result = new(json, result.Id, result.Page, queryString, remoteIpAddress is null ? string.Empty : remoteIpAddress.ToString(), result.Time, result.Value);
}
return result;
}
}

View File

@ -0,0 +1,11 @@
using System.Text.RegularExpressions;
namespace OI.Metrology.Wafer.Counter.Helper;
public partial class RegexHelper
{
[GeneratedRegex(@"[\\,\/,\:,\*,\?,\"",\<,\>,\|]")]
internal static partial Regex WindowsFileSystem();
}

View File

@ -1,8 +1,10 @@
using System.Text.Json;
using System.Text.Json.Serialization;
namespace OI.Metrology.Wafer.Counter.Models;
public record AppSettings(string BuildNumber,
public record AppSettings(string AzureDevOpsDestinationDirectory,
string BuildNumber,
string Company,
string EcCharacterizationSi,
string EcMesaFileShareCharacterizationSi,
@ -20,8 +22,14 @@ public record AppSettings(string BuildNumber,
public override string ToString()
{
string result = JsonSerializer.Serialize(this, new JsonSerializerOptions() { WriteIndented = true });
string result = JsonSerializer.Serialize(this, AppSettingsSourceGenerationContext.Default.AppSettings);
return result;
}
}
[JsonSourceGenerationOptions(WriteIndented = true)]
[JsonSerializable(typeof(AppSettings))]
public partial class AppSettingsSourceGenerationContext : JsonSerializerContext
{
}

View File

@ -6,6 +6,7 @@ namespace OI.Metrology.Wafer.Counter.Models.Binder;
public class AppSettings
{
public string? AzureDevOpsDestinationDirectory { get; set; }
public string? BuildNumber { get; set; }
public string? Company { get; set; }
public string? EcCharacterizationSi { get; set; }
@ -23,7 +24,7 @@ public class AppSettings
public override string ToString()
{
string result = JsonSerializer.Serialize(this, new JsonSerializerOptions() { WriteIndented = true });
string result = JsonSerializer.Serialize(this, BinderAppSettingsSourceGenerationContext.Default.AppSettings);
return result;
}
@ -48,6 +49,7 @@ public class AppSettings
{
Models.AppSettings result;
if (appSettings is null) throw new NullReferenceException(nameof(appSettings));
if (appSettings.AzureDevOpsDestinationDirectory is null) throw new NullReferenceException(nameof(AzureDevOpsDestinationDirectory));
if (appSettings.BuildNumber is null) throw new NullReferenceException(nameof(BuildNumber));
if (appSettings.Company is null) throw new NullReferenceException(nameof(Company));
if (appSettings.EcCharacterizationSi is null) throw new NullReferenceException(nameof(EcCharacterizationSi));
@ -62,7 +64,8 @@ public class AppSettings
if (appSettings.WaferCounterDestinationDirectory is null) throw new NullReferenceException(nameof(WaferCounterDestinationDirectory));
if (appSettings.WaferCounterTwoFileSecondsWait is null) throw new NullReferenceException(nameof(WaferCounterTwoFileSecondsWait));
if (appSettings.WorkingDirectoryName is null) throw new NullReferenceException(nameof(WorkingDirectoryName));
result = new(appSettings.BuildNumber,
result = new(appSettings.AzureDevOpsDestinationDirectory,
appSettings.BuildNumber,
appSettings.Company,
appSettings.EcCharacterizationSi,
appSettings.EcMesaFileShareCharacterizationSi,

View File

@ -17,19 +17,19 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Dapper" Version="2.1.44" />
<PackageReference Include="EntityFramework" Version="6.4.4" />
<PackageReference Include="EntityFramework" Version="6.5.1" />
<PackageReference Include="jQuery" Version="3.7.1" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Server" Version="8.0.5" />
<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.UserSecrets" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Hosting.WindowsServices" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Hosting" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.EventLog" Version="8.0.0" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Server" Version="8.0.10" />
<PackageReference Include="Microsoft.Extensions.Caching.Memory" Version="8.0.1" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="8.0.1" />
<PackageReference Include="Microsoft.Extensions.Configuration.UserSecrets" Version="8.0.1" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="8.0.1" />
<PackageReference Include="Microsoft.Extensions.Hosting.WindowsServices" Version="8.0.1" />
<PackageReference Include="Microsoft.Extensions.Hosting" Version="8.0.1" />
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="8.0.1" />
<PackageReference Include="Microsoft.Extensions.Logging.EventLog" Version="8.0.1" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.6.1" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.8.1" />
<PackageReference Include="System.Data.SqlClient" Version="4.8.6" />
</ItemGroup>
<ItemGroup>

View File

@ -31,6 +31,7 @@ public class Program
_ = webApplicationBuilder.Services.AddHttpClient();
_ = webApplicationBuilder.Services.AddSingleton(_ => appSettings);
_ = webApplicationBuilder.Services.AddSingleton<IFileShareRepository, FileShareRepository>();
_ = webApplicationBuilder.Services.AddSingleton<IAzureDevOpsRepository, AzureDevOpsRepository>();
_ = webApplicationBuilder.Services.AddSingleton<IWaferCounterRepository, WaferCounterRepository>();
_ = webApplicationBuilder.Services.AddSingleton<IAppSettingsRepository<Models.Binder.AppSettings>>(_ => appSettingsRepository);

View File

@ -0,0 +1,25 @@
using OI.Metrology.Shared.Models;
using OI.Metrology.Shared.Models.Stateless;
using OI.Metrology.Wafer.Counter.Models;
namespace OI.Metrology.Wafer.Counter.Repository;
public class AzureDevOpsRepository : IAzureDevOpsRepository
{
private readonly AppSettings _AppSettings;
public AzureDevOpsRepository(AppSettings appSettings) =>
_AppSettings = appSettings;
void IAzureDevOpsRepository.Save(PollValue pollValue)
{
ArgumentNullException.ThrowIfNull(pollValue.Id);
ArgumentNullException.ThrowIfNull(pollValue.Page);
string directory = Path.Combine(_AppSettings.AzureDevOpsDestinationDirectory, pollValue.Page, pollValue.Id.Value.ToString());
if (!Directory.Exists(directory))
_ = Directory.CreateDirectory(directory);
File.WriteAllText(Path.Combine(directory, $"{pollValue.Time}.json"), pollValue.Json is null ? string.Empty : pollValue.Json);
}
}

View File

@ -1,5 +1,9 @@
using OI.Metrology.Shared.DataModels;
using OI.Metrology.Shared.Models;
using OI.Metrology.Shared.Models.Stateless;
using OI.Metrology.Wafer.Counter.Models;
using System.Collections.ObjectModel;
using System.Globalization;
using System.Text.Json;
namespace OI.Metrology.Wafer.Counter.Repository;
@ -7,6 +11,11 @@ namespace OI.Metrology.Wafer.Counter.Repository;
public class FileShareRepository : IFileShareRepository
{
private readonly AppSettings _AppSettings;
public FileShareRepository(AppSettings appSettings) =>
_AppSettings = appSettings;
Uri IFileShareRepository.Append(Uri uri, params string[] paths) =>
new(paths.Aggregate(uri.AbsoluteUri, (current, path) =>
string.Format("{0}/{1}", current.TrimEnd('/'), path.TrimStart('/'))));
@ -74,7 +83,7 @@ public class FileShareRepository : IFileShareRepository
return result;
}
List<NginxFileSystemSortable> IFileShareRepository.GetNginxFileSystemSortableCollection(HttpClient httpClient, Uri uri, string? endsWith)
ReadOnlyCollection<NginxFileSystemSortable> IFileShareRepository.GetNginxFileSystemSortableCollection(HttpClient httpClient, Uri uri, string? endsWith)
{
List<NginxFileSystemSortable> results = new();
Task<HttpResponseMessage> httpResponseMessage = httpClient.GetAsync(uri);
@ -93,7 +102,172 @@ public class FileShareRepository : IFileShareRepository
results.Add(nginxFileSystemSortable);
}
}
return results;
return new(results);
}
private static ReadOnlyCollection<string> GetValidDirectories(string equipmentDirectory, DateTime startDateTime, DateTime endDateTime)
{
List<string> results = [];
DateTime dateTime;
string weekOfYear;
Calendar calendar = new CultureInfo("en-US").Calendar;
for (int i = 0; i < int.MaxValue; i++)
{
dateTime = startDateTime.AddDays(i);
if (dateTime > endDateTime)
break;
weekOfYear = $"{dateTime:yyyy}_Week_{calendar.GetWeekOfYear(dateTime, CalendarWeekRule.FirstDay, DayOfWeek.Sunday):00}";
results.Add(Path.Combine(equipmentDirectory, weekOfYear, dateTime.ToString("yyyy-MM-dd")));
}
return new(results);
}
private static ReadOnlyCollection<string> GetFiles(CharacterizationParameters characterizationParameters, string equipmentDirectory, string searchPattern, DateTime startDateTime, DateTime endDateTime, ReadOnlyCollection<string> validDirectories)
{
List<string> results = [];
string[] directories;
string startDateTimeTicks = startDateTime.Ticks.ToString();
string delta = (endDateTime.Ticks - startDateTime.Ticks).ToString();
string ticksSearchPattern = $"{startDateTime.Ticks.ToString()[..(startDateTimeTicks.Length - delta.Length - 1)]}*";
bool check = characterizationParameters.SearchPattern is null || searchPattern == characterizationParameters.SearchPattern;
if (check)
results.AddRange(Directory.GetFiles(equipmentDirectory, searchPattern, SearchOption.AllDirectories));
foreach (string validDirectory in validDirectories)
{
if (string.IsNullOrEmpty(validDirectory) || !Directory.Exists(validDirectory))
continue;
if (check)
results.AddRange(Directory.GetFiles(validDirectory, searchPattern, SearchOption.AllDirectories));
else
{
directories = Directory.GetDirectories(validDirectory, ticksSearchPattern, SearchOption.AllDirectories);
foreach (string directory in directories)
results.AddRange(Directory.GetFiles(directory, searchPattern, SearchOption.TopDirectoryOnly));
}
}
return new(results);
}
private static ReadOnlyCollection<FileInfo> GetCollection(CharacterizationParameters characterizationParameters, string equipmentDirectory, string searchPattern, DateTime startDateTime, DateTime endDateTime, ReadOnlyCollection<string> validDirectories)
{
FileInfo[] results;
ReadOnlyCollection<string> files = GetFiles(characterizationParameters, equipmentDirectory, searchPattern, startDateTime, endDateTime, validDirectories);
FileInfo[] collection = files.Select(l => new FileInfo(l)).ToArray();
results = (from l in collection where l.LastWriteTime >= startDateTime && l.LastWriteTime <= endDateTime orderby l.LastWriteTime descending select l).ToArray();
return new(results);
}
private static ReadOnlyCollection<string> GetDirectoryNames(string directory)
{
List<string> results = new();
string? fileName;
string? checkDirectory = directory;
string? pathRoot = Path.GetPathRoot(directory);
string extension = Path.GetExtension(directory);
if (string.IsNullOrEmpty(pathRoot))
throw new NullReferenceException(nameof(pathRoot));
if (Directory.Exists(directory))
{
fileName = Path.GetFileName(directory);
if (!string.IsNullOrEmpty(fileName))
results.Add(fileName);
}
else if ((string.IsNullOrEmpty(extension) || extension.Length > 3) && !File.Exists(directory))
{
fileName = Path.GetFileName(directory);
if (!string.IsNullOrEmpty(fileName))
results.Add(fileName);
}
for (int i = 0; i < int.MaxValue; i++)
{
checkDirectory = Path.GetDirectoryName(checkDirectory);
if (string.IsNullOrEmpty(checkDirectory) || checkDirectory == pathRoot)
break;
fileName = Path.GetFileName(checkDirectory);
if (string.IsNullOrEmpty(fileName))
continue;
results.Add(fileName);
}
results.Add(pathRoot);
results.Reverse();
return new(results);
}
private static ReadOnlyCollection<CharacterizationInfo> GetCharacterizationData(CharacterizationParameters characterizationParameters, string equipmentDirectory, string searchPattern)
{
List<CharacterizationInfo> results = [];
string[] lines;
string? directoryName;
string? checkDirectory;
CharacterizationInfo archiveInfo;
ReadOnlyCollection<string> directoryNames;
DateTime endDateTime = characterizationParameters.EndTime is null ? DateTime.Now : DateTime.Parse(characterizationParameters.EndTime).ToLocalTime();
DateTime startDateTime = characterizationParameters.StartTime is null ? DateTime.Now.AddHours(-6) : DateTime.Parse(characterizationParameters.StartTime).ToLocalTime();
ReadOnlyCollection<string> validDirectories = GetValidDirectories(equipmentDirectory, startDateTime, endDateTime);
ReadOnlyCollection<FileInfo> collection = GetCollection(characterizationParameters, equipmentDirectory, searchPattern, startDateTime, endDateTime, validDirectories);
foreach (FileInfo fileInfo in collection)
{
if (string.IsNullOrEmpty(fileInfo.DirectoryName))
continue;
checkDirectory = fileInfo.DirectoryName;
directoryName = Path.GetFileName(fileInfo.DirectoryName);
directoryNames = GetDirectoryNames(fileInfo.DirectoryName);
foreach (string _ in directoryNames)
{
if (string.IsNullOrEmpty(checkDirectory))
continue;
if (validDirectories.Contains(checkDirectory))
{
directoryName = Path.GetFileName(checkDirectory);
break;
}
}
lines = File.ReadAllLines(fileInfo.FullName);
archiveInfo = new(directoryName, fileInfo.LastWriteTime, lines);
results.Add(archiveInfo);
}
return new(results);
}
ReadOnlyCollection<CharacterizationInfo> IFileShareRepository.GetArchiveData(CharacterizationParameters characterizationParameters)
{
List<CharacterizationInfo> results = [];
string searchPattern;
string equipmentDirectory;
if (!string.IsNullOrEmpty(characterizationParameters.Area) && !string.IsNullOrEmpty(characterizationParameters.WaferSize))
{
searchPattern = characterizationParameters.SearchPattern is null ? "*" : characterizationParameters.SearchPattern;
equipmentDirectory = Path.Combine(_AppSettings.EcCharacterizationSi, "WaferCounter", characterizationParameters.Area, characterizationParameters.WaferSize);
if (Directory.Exists(equipmentDirectory))
results.AddRange(GetCharacterizationData(characterizationParameters, equipmentDirectory, searchPattern));
}
if (!string.IsNullOrEmpty(characterizationParameters.EquipmentId))
{
searchPattern = "*.json";
equipmentDirectory = Path.Combine(_AppSettings.EcCharacterizationSi, "Archive", characterizationParameters.EquipmentId);
if (Directory.Exists(equipmentDirectory))
results.AddRange(GetCharacterizationData(characterizationParameters, equipmentDirectory, searchPattern));
}
return new(results);
}
ReadOnlyCollection<ToolTypeNameId> IFileShareRepository.GetEquipmentIds()
{
List<ToolTypeNameId> results = [];
string directoryName;
ToolTypeNameId toolTypeNameId;
string archiveDirectory = Path.Combine(_AppSettings.EcCharacterizationSi, "Archive");
string[] directories = Directory.GetDirectories(archiveDirectory, "*", SearchOption.TopDirectoryOnly);
string[] fileNames = Directory.GetFiles(archiveDirectory, "*.json", SearchOption.TopDirectoryOnly).Select(l => Path.GetFileNameWithoutExtension(l)).ToArray();
for (int i = 0; i < directories.Length; i++)
{
directoryName = Path.GetFileName(directories[i]);
if (!fileNames.Contains(directoryName))
continue;
toolTypeNameId = new() { ID = i, ToolTypeName = directoryName };
results.Add(toolTypeNameId);
}
return new(results);
}
}

View File

@ -1,8 +1,12 @@
using OI.Metrology.Shared.DataModels;
using OI.Metrology.Shared.Models;
using OI.Metrology.Shared.Models.Stateless;
using OI.Metrology.Wafer.Counter.Helper;
using OI.Metrology.Wafer.Counter.Models;
using System.Collections.ObjectModel;
using System.Globalization;
using System.Text.Json;
using System.Text.RegularExpressions;
namespace OI.Metrology.Wafer.Counter.Repository;
@ -13,6 +17,7 @@ public class WaferCounterRepository : IWaferCounterRepository
int Total,
string? SlotMap);
private readonly Regex _Regex;
private readonly string _MockRoot;
private readonly string _RepositoryName;
private readonly AppSettings _AppSettings;
@ -24,16 +29,32 @@ public class WaferCounterRepository : IWaferCounterRepository
_AppSettings = appSettings;
_MockRoot = appSettings.MockRoot;
_HttpClientFactory = httpClientFactory;
_Regex = RegexHelper.WindowsFileSystem();
_FileShareRepository = fileShareRepository;
_RepositoryName = nameof(WaferCounterRepository)[..^10];
}
private void MoveFile(string waferSizeDirectory, NginxFileSystemSortable nginxFileSystemSortable)
private void MoveFile(string area, string waferSize, WaferCounter? waferCounter, string windowsFileSystemSafeText, string waferSizeDirectory, NginxFileSystemSortable nginxFileSystemSortable)
{
string equipmentId = $"{area}-{waferSize}";
WaferCounterArchive waferCounterArchive = new()
{
Date = nginxFileSystemSortable.DateTime,
MesEntity = equipmentId,
RDS = windowsFileSystemSafeText,
SlotMap = waferCounter?.SlotMap,
Text = waferCounter?.Text,
Total = waferCounter?.Total,
};
Calendar calendar = new CultureInfo("en-US").Calendar;
string from = Path.Combine(waferSizeDirectory, nginxFileSystemSortable.Name);
string archive = Path.Combine(_AppSettings.EcCharacterizationSi, "Archive", equipmentId);
string weekOfYear = $"{nginxFileSystemSortable.DateTime:yyyy}_Week_{calendar.GetWeekOfYear(nginxFileSystemSortable.DateTime, CalendarWeekRule.FirstDay, DayOfWeek.Sunday):00}";
string to = Path.Combine(waferSizeDirectory, "Archive", weekOfYear, nginxFileSystemSortable.Name);
string directory = Path.Combine(archive, weekOfYear, nginxFileSystemSortable.DateTime.ToString("yyyy-MM-dd"), windowsFileSystemSafeText);
string file = Path.Combine(directory, nginxFileSystemSortable.DateTime.Ticks.ToString(), $"{nginxFileSystemSortable.Name}.json");
string json = JsonSerializer.Serialize(waferCounterArchive, WaferCounterArchiveSourceGenerationContext.Default.WaferCounterArchive);
_FileShareRepository.FileWrite(file, json);
string to = Path.Combine(directory, nginxFileSystemSortable.Name);
_FileShareRepository.MoveFile(from, to);
}
@ -134,10 +155,12 @@ public class WaferCounterRepository : IWaferCounterRepository
{
List<NginxFileSystemSortable> results = new();
DateTime dateTime = DateTime.Now;
ReadOnlyCollection<NginxFileSystemSortable> collection;
long ticks = dateTime.AddSeconds(_AppSettings.WaferCounterTwoFileSecondsWait).Ticks;
for (int i = 0; i < int.MaxValue; i++)
{
results = _FileShareRepository.GetNginxFileSystemSortableCollection(httpClient, waferSizeUri, ".wc");
collection = _FileShareRepository.GetNginxFileSystemSortableCollection(httpClient, waferSizeUri, ".wc");
results.AddRange(collection);
if (results.Count > 0 || DateTime.Now.Ticks > ticks)
break;
Thread.Sleep(250);
@ -172,7 +195,7 @@ public class WaferCounterRepository : IWaferCounterRepository
return result;
}
WaferCounter? IWaferCounterRepository.GetLastQuantityAndSlotMap(string area, string waferSize)
WaferCounter? IWaferCounterRepository.GetLastQuantityAndSlotMap(string area, string waferSize, string text)
{
WaferCounter? result;
Uri waferSizeUri = GetWaferSizeUri(area, waferSize);
@ -183,9 +206,10 @@ public class WaferCounterRepository : IWaferCounterRepository
result = WaferCounter.GetWaferCounter("No files!");
else
{
string windowsFileSystemSafeText = _Regex.Replace(text, ".");
result = GetLastQuantityAndSlotMap(waferSize, httpClient, nginxFileSystemSortableCollection[0]);
for (int i = 0; i < nginxFileSystemSortableCollection.Count; i++)
MoveFile(waferSizeDirectory, nginxFileSystemSortableCollection[i]);
MoveFile(area, waferSize, result, windowsFileSystemSafeText, waferSizeDirectory, nginxFileSystemSortableCollection[i]);
}
return result;
}