AzureDevOpsRepository
Markdown links
Ticks bug fix, default to *.wc files and formatting
This commit is contained in:
2025-02-21 11:13:56 -07:00
parent 4c2bef71ec
commit 2afb312065
32 changed files with 661 additions and 593 deletions

View File

@ -1,7 +1,9 @@
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;
@ -32,17 +34,25 @@ public class WaferCounterRepository : IWaferCounterRepository
_RepositoryName = nameof(WaferCounterRepository)[..^10];
}
private void MoveFile(string area, string waferSize, string windowsFileSystemSafeText, 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);
HeaderCommon headerCommon = new() { RDS = windowsFileSystemSafeText, MesEntity = equipmentId };
string weekOfYear = $"{nginxFileSystemSortable.DateTime:yyyy}_Week_{calendar.GetWeekOfYear(nginxFileSystemSortable.DateTime, CalendarWeekRule.FirstDay, DayOfWeek.Sunday):00}";
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 });
string json = JsonSerializer.Serialize(waferCounterArchive, WaferCounterArchiveSourceGenerationContext.Default.WaferCounterArchive);
_FileShareRepository.FileWrite(file, json);
string to = Path.Combine(directory, nginxFileSystemSortable.Name);
_FileShareRepository.MoveFile(from, to);
@ -145,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);
@ -197,7 +209,7 @@ public class WaferCounterRepository : IWaferCounterRepository
string windowsFileSystemSafeText = _Regex.Replace(text, ".");
result = GetLastQuantityAndSlotMap(waferSize, httpClient, nginxFileSystemSortableCollection[0]);
for (int i = 0; i < nginxFileSystemSortableCollection.Count; i++)
MoveFile(area, waferSize, windowsFileSystemSafeText, waferSizeDirectory, nginxFileSystemSortableCollection[i]);
MoveFile(area, waferSize, result, windowsFileSystemSafeText, waferSizeDirectory, nginxFileSystemSortableCollection[i]);
}
return result;
}