Get text from OI

This commit is contained in:
Mike Phares 2024-08-28 15:58:20 -07:00
parent 1ad6246b8d
commit b824c4ba36
6 changed files with 15 additions and 14 deletions

View File

@ -11,6 +11,6 @@ public interface IWaferCounterController<T>
static string GetRouteName() => nameof(IWaferCounterController<T>)[1..^10]; 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); string? GetSlotMap(string line1, string line2);
DataModels.WaferCounter? GetLastQuantityAndSlotMap(string area, string waferSize); DataModels.WaferCounter? GetLastQuantityAndSlotMap(string area, string waferSize, string text);
} }

View File

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

View File

@ -14,13 +14,13 @@ public class WaferCounterController : Controller, IWaferCounterController<IActio
[ProducesResponseType(StatusCodes.Status400BadRequest)] [ProducesResponseType(StatusCodes.Status400BadRequest)]
[HttpGet("{waferSize}/last-quantity-and-slot-map")] [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) if (waferCounter is null)
return this.BadRequest(); return BadRequest();
else if (!string.IsNullOrEmpty(waferCounter.Message)) else if (!string.IsNullOrEmpty(waferCounter.Message))
return this.BadRequest(waferCounter.Message); return BadRequest(waferCounter.Message);
else else
return Json(waferCounter); return Json(waferCounter);
} }

View File

@ -17,9 +17,9 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Dapper" Version="2.1.44" /> <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="jQuery" Version="3.7.1" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Server" Version="8.0.5" /> <PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Server" Version="8.0.8" />
<PackageReference Include="Microsoft.Extensions.Caching.Memory" Version="8.0.0" /> <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.Json" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.UserSecrets" Version="8.0.0" /> <PackageReference Include="Microsoft.Extensions.Configuration.UserSecrets" Version="8.0.0" />
@ -29,7 +29,7 @@
<PackageReference Include="Microsoft.Extensions.Logging.Console" 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.Extensions.Logging.EventLog" Version="8.0.0" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" /> <PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.6.1" /> <PackageReference Include="Swashbuckle.AspNetCore" Version="6.7.3" />
<PackageReference Include="System.Data.SqlClient" Version="4.8.6" /> <PackageReference Include="System.Data.SqlClient" Version="4.8.6" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>

View File

@ -28,13 +28,15 @@ public class WaferCounterRepository : IWaferCounterRepository
_RepositoryName = nameof(WaferCounterRepository)[..^10]; _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; Calendar calendar = new CultureInfo("en-US").Calendar;
string from = Path.Combine(waferSizeDirectory, nginxFileSystemSortable.Name); 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 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.MoveFile(from, to);
_FileShareRepository.FileWrite($"{to}.txt", text);
} }
private static Record GetRecord(string line1, string line2) private static Record GetRecord(string line1, string line2)
@ -172,7 +174,7 @@ public class WaferCounterRepository : IWaferCounterRepository
return result; return result;
} }
WaferCounter? IWaferCounterRepository.GetLastQuantityAndSlotMap(string area, string waferSize) WaferCounter? IWaferCounterRepository.GetLastQuantityAndSlotMap(string area, string waferSize, string text)
{ {
WaferCounter? result; WaferCounter? result;
Uri waferSizeUri = GetWaferSizeUri(area, waferSize); Uri waferSizeUri = GetWaferSizeUri(area, waferSize);
@ -185,7 +187,7 @@ public class WaferCounterRepository : IWaferCounterRepository
{ {
result = GetLastQuantityAndSlotMap(waferSize, httpClient, nginxFileSystemSortableCollection[0]); result = GetLastQuantityAndSlotMap(waferSize, httpClient, nginxFileSystemSortableCollection[0]);
for (int i = 0; i < nginxFileSystemSortableCollection.Count; i++) for (int i = 0; i < nginxFileSystemSortableCollection.Count; i++)
MoveFile(waferSizeDirectory, nginxFileSystemSortableCollection[i]); MoveFile(area, waferSize, text, waferSizeDirectory, nginxFileSystemSortableCollection[i]);
} }
return result; return result;
} }