Characterization Data

FI Backlog with Ignore Tag
This commit is contained in:
2024-09-19 10:13:10 -07:00
parent b824c4ba36
commit 4c2bef71ec
31 changed files with 783 additions and 16 deletions

View File

@ -3,6 +3,8 @@ using OI.Metrology.Shared.Models;
using OI.Metrology.Shared.Models.Stateless;
using OI.Metrology.Wafer.Counter.Models;
using System.Globalization;
using System.Text.Json;
using System.Text.RegularExpressions;
namespace OI.Metrology.Wafer.Counter.Repository;
@ -13,6 +15,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,19 +27,25 @@ public class WaferCounterRepository : IWaferCounterRepository
_AppSettings = appSettings;
_MockRoot = appSettings.MockRoot;
_HttpClientFactory = httpClientFactory;
_Regex = RegexHelper.WindowsFileSystem();
_FileShareRepository = fileShareRepository;
_RepositoryName = nameof(WaferCounterRepository)[..^10];
}
private void MoveFile(string area, string waferSize, string text, string waferSizeDirectory, NginxFileSystemSortable nginxFileSystemSortable)
private void MoveFile(string area, string waferSize, string windowsFileSystemSafeText, string waferSizeDirectory, NginxFileSystemSortable nginxFileSystemSortable)
{
string equipmentId = $"{area}-{waferSize}";
Calendar calendar = new CultureInfo("en-US").Calendar;
string from = Path.Combine(waferSizeDirectory, nginxFileSystemSortable.Name);
string archive = Path.Combine(_AppSettings.EcCharacterizationSi, "Archive", $"{area}-{waferSize}");
string archive = Path.Combine(_AppSettings.EcCharacterizationSi, "Archive", equipmentId);
HeaderCommon headerCommon = new() { RDS = windowsFileSystemSafeText, MesEntity = equipmentId };
string weekOfYear = $"{nginxFileSystemSortable.DateTime:yyyy}_Week_{calendar.GetWeekOfYear(nginxFileSystemSortable.DateTime, CalendarWeekRule.FirstDay, DayOfWeek.Sunday):00}";
string to = Path.Combine(archive, weekOfYear, nginxFileSystemSortable.DateTime.ToString("yyyy-MM-dd"), 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(headerCommon, new JsonSerializerOptions() { WriteIndented = true });
_FileShareRepository.FileWrite(file, json);
string to = Path.Combine(directory, nginxFileSystemSortable.Name);
_FileShareRepository.MoveFile(from, to);
_FileShareRepository.FileWrite($"{to}.txt", text);
}
private static Record GetRecord(string line1, string line2)
@ -185,9 +194,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(area, waferSize, text, waferSizeDirectory, nginxFileSystemSortableCollection[i]);
MoveFile(area, waferSize, windowsFileSystemSafeText, waferSizeDirectory, nginxFileSystemSortableCollection[i]);
}
return result;
}