Characterization Data with Static Site
This commit is contained in:
@ -2,6 +2,7 @@ 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;
|
||||
using System.Text.RegularExpressions;
|
||||
@ -32,17 +33,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, new JsonSerializerOptions() { WriteIndented = true });
|
||||
_FileShareRepository.FileWrite(file, json);
|
||||
string to = Path.Combine(directory, nginxFileSystemSortable.Name);
|
||||
_FileShareRepository.MoveFile(from, to);
|
||||
@ -145,10 +154,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 +208,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;
|
||||
}
|
||||
|
Reference in New Issue
Block a user