From b824c4ba36ba05f9876152658ae25b2a0223d406 Mon Sep 17 00:00:00 2001 From: Mike Phares Date: Wed, 28 Aug 2024 15:58:20 -0700 Subject: [PATCH] Get text from OI --- Shared/Models/Stateless/IWaferCounterController.cs | 2 +- Shared/Models/Stateless/IWaferCounterRepository.cs | 2 +- Tests/UnitTestExportController.cs | 1 - Wafer-Counter/ApiControllers/WaferCounterController.cs | 8 ++++---- Wafer-Counter/OI.Metrology.Wafer.Counter.csproj | 6 +++--- Wafer-Counter/Repositories/WaferCounterRepository.cs | 10 ++++++---- 6 files changed, 15 insertions(+), 14 deletions(-) diff --git a/Shared/Models/Stateless/IWaferCounterController.cs b/Shared/Models/Stateless/IWaferCounterController.cs index 6c5a4fa..17e1b1f 100644 --- a/Shared/Models/Stateless/IWaferCounterController.cs +++ b/Shared/Models/Stateless/IWaferCounterController.cs @@ -11,6 +11,6 @@ public interface IWaferCounterController static string GetRouteName() => nameof(IWaferCounterController)[1..^10]; - T GetLastQuantityAndSlotMap(string area, string waferSize); + T GetLastQuantityAndSlotMap(string area, string waferSize, string text); } \ No newline at end of file diff --git a/Shared/Models/Stateless/IWaferCounterRepository.cs b/Shared/Models/Stateless/IWaferCounterRepository.cs index 791e571..bbc41b0 100644 --- a/Shared/Models/Stateless/IWaferCounterRepository.cs +++ b/Shared/Models/Stateless/IWaferCounterRepository.cs @@ -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); } \ No newline at end of file diff --git a/Tests/UnitTestExportController.cs b/Tests/UnitTestExportController.cs index 2ccda27..7e6bc80 100644 --- a/Tests/UnitTestExportController.cs +++ b/Tests/UnitTestExportController.cs @@ -233,7 +233,6 @@ public class UnitTestExportController _Logger?.LogInformation("{TestName} completed", _TestContext?.TestName); } - [Ignore] [TestMethod] public void GetCSVExport() { diff --git a/Wafer-Counter/ApiControllers/WaferCounterController.cs b/Wafer-Counter/ApiControllers/WaferCounterController.cs index e99229a..3af5213 100644 --- a/Wafer-Counter/ApiControllers/WaferCounterController.cs +++ b/Wafer-Counter/ApiControllers/WaferCounterController.cs @@ -14,13 +14,13 @@ public class WaferCounterController : Controller, IWaferCounterController - + - + @@ -29,7 +29,7 @@ - + diff --git a/Wafer-Counter/Repositories/WaferCounterRepository.cs b/Wafer-Counter/Repositories/WaferCounterRepository.cs index d350f43..066360a 100644 --- a/Wafer-Counter/Repositories/WaferCounterRepository.cs +++ b/Wafer-Counter/Repositories/WaferCounterRepository.cs @@ -28,13 +28,15 @@ public class WaferCounterRepository : IWaferCounterRepository _RepositoryName = nameof(WaferCounterRepository)[..^10]; } - private void MoveFile(string waferSizeDirectory, NginxFileSystemSortable nginxFileSystemSortable) + private void MoveFile(string area, string waferSize, string text, string waferSizeDirectory, NginxFileSystemSortable nginxFileSystemSortable) { Calendar calendar = new CultureInfo("en-US").Calendar; string from = Path.Combine(waferSizeDirectory, nginxFileSystemSortable.Name); + string archive = Path.Combine(_AppSettings.EcCharacterizationSi, "Archive", $"{area}-{waferSize}"); 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 to = Path.Combine(archive, weekOfYear, nginxFileSystemSortable.DateTime.ToString("yyyy-MM-dd"), nginxFileSystemSortable.Name); _FileShareRepository.MoveFile(from, to); + _FileShareRepository.FileWrite($"{to}.txt", text); } private static Record GetRecord(string line1, string line2) @@ -172,7 +174,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); @@ -185,7 +187,7 @@ public class WaferCounterRepository : IWaferCounterRepository { result = GetLastQuantityAndSlotMap(waferSize, httpClient, nginxFileSystemSortableCollection[0]); for (int i = 0; i < nginxFileSystemSortableCollection.Count; i++) - MoveFile(waferSizeDirectory, nginxFileSystemSortableCollection[i]); + MoveFile(area, waferSize, text, waferSizeDirectory, nginxFileSystemSortableCollection[i]); } return result; }