Minor changes for Max RDS
This commit is contained in:
parent
617a4989e2
commit
5f7450e442
@ -22,7 +22,6 @@ public class Max
|
||||
public string spec_cres_mtool { get; set; }
|
||||
public string spec_cres_mrecipe { get; set; }
|
||||
public int ci_no { get; set; }
|
||||
public string spec_clean_tool { get; set; }
|
||||
public int? mv_no { get; set; }
|
||||
public string scan_tool { get; set; }
|
||||
public string spec_surfscan_recipe { get; set; }
|
||||
|
@ -14,12 +14,19 @@ namespace OI.Metrology.Archive.Repositories;
|
||||
public class RdsMaxRepo : IRdsMaxRepo
|
||||
{
|
||||
|
||||
private readonly IMemoryCache _Cache;
|
||||
private readonly IMemoryCache _MemoryCache;
|
||||
private readonly Models.AppSettings _AppSettings;
|
||||
|
||||
public RdsMaxRepo(Models.AppSettings appSettings, IMemoryCache memoryCache)
|
||||
{
|
||||
_Cache = memoryCache;
|
||||
_MemoryCache = memoryCache;
|
||||
_AppSettings = appSettings;
|
||||
}
|
||||
|
||||
public RdsMaxRepo(string json, IMemoryCache memoryCache)
|
||||
{
|
||||
_MemoryCache = memoryCache;
|
||||
Models.AppSettings appSettings = System.Text.Json.JsonSerializer.Deserialize<Models.AppSettings>(json);
|
||||
_AppSettings = appSettings;
|
||||
}
|
||||
|
||||
@ -27,7 +34,7 @@ public class RdsMaxRepo : IRdsMaxRepo
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine("CacheItem: " + key);
|
||||
|
||||
_ = _Cache.Set(key, v, new MemoryCacheEntryOptions().SetSlidingExpiration(TimeSpan.FromMinutes(1)));
|
||||
_ = _MemoryCache.Set(key, v, new MemoryCacheEntryOptions().SetSlidingExpiration(TimeSpan.FromMinutes(1)));
|
||||
}
|
||||
|
||||
private static string GetMaxRdsSql()
|
||||
@ -40,7 +47,8 @@ public class RdsMaxRepo : IRdsMaxRepo
|
||||
Append(" , rt.zone ").
|
||||
Append(" , rr.load_lock_side ").
|
||||
Append(" , rr.rds_no ").
|
||||
Append(" , rt.ps_no ").
|
||||
Append(" , rr.wo_no ").
|
||||
Append(" , rr.ps_no ").
|
||||
Append(" , rr.recipe_name ").
|
||||
Append(" , rr.recipe_no ").
|
||||
Append(" , rr.spec_type ").
|
||||
@ -51,7 +59,6 @@ public class RdsMaxRepo : IRdsMaxRepo
|
||||
Append(" , rt.spec_cres_mtool ").
|
||||
Append(" , rt.spec_cres_mrecipe ").
|
||||
Append(" , ci.ci_no ").
|
||||
Append(" , ci.spec_clean_tool ").
|
||||
Append(" , cr.mv_no ").
|
||||
Append(" , cr.scan_tool ").
|
||||
Append(" , cr.spec_surfscan_recipe ").
|
||||
@ -70,8 +77,9 @@ public class RdsMaxRepo : IRdsMaxRepo
|
||||
Append(" ) as qc ").
|
||||
Append(" inner join lsl2sql.dbo.react_run rr ").
|
||||
Append(" on qc.rds_no = rr.rds_no ").
|
||||
Append(" left join [lsl2sql].[dbo].[rds_test] rt ").
|
||||
Append(" inner join [lsl2sql].[dbo].[rds_test] rt ").
|
||||
Append(" on rr.rds_no = rt.rds_no ").
|
||||
Append(" and rr.ps_no = rt.ps_no ").
|
||||
Append(" left join [lsl2sql].[dbo].[clean_insp] ci ").
|
||||
Append(" on rr.rds_no = ci.rds_no ").
|
||||
Append(" and ci.stage = 'LWI' ").
|
||||
@ -109,7 +117,7 @@ public class RdsMaxRepo : IRdsMaxRepo
|
||||
{
|
||||
Max[] cached;
|
||||
string cacheKey = "GetMaxRDS";
|
||||
if (_Cache.TryGetValue(cacheKey, out cached))
|
||||
if (_MemoryCache.TryGetValue(cacheKey, out cached))
|
||||
return cached;
|
||||
|
||||
string loadSigDTM = DateTime.Now.AddDays(-90).ToString("yyyy-MM-dd 00:00:00.000");
|
||||
@ -246,7 +254,7 @@ public class RdsMaxRepo : IRdsMaxRepo
|
||||
List<string> thick = new();
|
||||
List<string> centerRes = new();
|
||||
StringBuilder stringBuilder = new();
|
||||
_ = stringBuilder.Append($"Reactor\tReactorType\tRDS\tPSN\tName\tSpecType\tRes\tThick\tCenter Res\tClean");
|
||||
_ = stringBuilder.Append($"Reactor\tReactorType\tRDS\tPSN\tName\tSpecType\tRes\tThick\tCenter Res\tScan");
|
||||
row = stringBuilder.ToString().Split('\t');
|
||||
results.Add(row);
|
||||
Dictionary<int, List<Max>> reactorToRecords = GetReactorToRecords(collection);
|
||||
|
@ -12,12 +12,6 @@ public class SQLDbConnectionFactory : IDbConnectionFactory
|
||||
|
||||
public SQLDbConnectionFactory(AppSettings appSettings) => _AppSettings = appSettings;
|
||||
|
||||
public SQLDbConnectionFactory(string json)
|
||||
{
|
||||
AppSettings appSettings = System.Text.Json.JsonSerializer.Deserialize<AppSettings>(json);
|
||||
_AppSettings = appSettings;
|
||||
}
|
||||
|
||||
public DbConnection GetDbConnection()
|
||||
{
|
||||
DbProviderFactories.RegisterFactory(
|
||||
|
@ -20,7 +20,6 @@ public record Max(
|
||||
[property: JsonPropertyName("spec_cres_mtool")] string SpecCresMtool,
|
||||
[property: JsonPropertyName("spec_cres_mrecipe")] string SpecCresMrecipe,
|
||||
[property: JsonPropertyName("ci_no")] int CiNo,
|
||||
[property: JsonPropertyName("spec_clean_tool")] string SpecCleanTool,
|
||||
[property: JsonPropertyName("mv_no")] int? MvNo,
|
||||
[property: JsonPropertyName("scan_tool")] string ScanTool,
|
||||
[property: JsonPropertyName("spec_surfscan_recipe")] string SpecSurfscanRecipe,
|
||||
|
@ -75,8 +75,7 @@ public class UnitTestArchive
|
||||
string jsonFile = Path.Combine(AppContext.BaseDirectory, "RdsMaxRepo.json");
|
||||
Assert.IsTrue(File.Exists(jsonFile));
|
||||
json = JsonSerializer.Serialize(_AppSettings);
|
||||
IDbConnectionFactory dbConnectionFactory = new SQLDbConnectionFactory(json);
|
||||
IRdsMaxRepo rdsMaxRepo = new RdsMaxRepo(dbConnectionFactory, _MemoryCache);
|
||||
IRdsMaxRepo rdsMaxRepo = new RdsMaxRepo(json, _MemoryCache);
|
||||
json = File.ReadAllText(jsonFile);
|
||||
Shared.DataModels.RDS.Max[]? collection = JsonSerializer.Deserialize<Shared.DataModels.RDS.Max[]>(json);
|
||||
if (collection is null)
|
||||
|
Loading…
x
Reference in New Issue
Block a user