Separated Wafer-Counter
JsonElement instead of Request body Attachment Class Bump Ready to test GetLastGroupIdWithValue Changed to v4
This commit is contained in:
@ -37,119 +37,117 @@ public class InfinityQSV4Repository : IInfinityQSV4Repository
|
||||
|
||||
string IInfinityQSV4Repository.GetCommandText(string subGroupId)
|
||||
{ // cSpell:disable
|
||||
StringBuilder result = new();
|
||||
List<string> results = [];
|
||||
if (string.IsNullOrEmpty(subGroupId))
|
||||
throw new ArgumentException(null, nameof(subGroupId));
|
||||
_ = result
|
||||
.AppendLine(" select ")
|
||||
.AppendLine(" sd.f_sgrp sd_sgrp, ")
|
||||
.AppendLine(" sd.f_tsno sd_tsno, ")
|
||||
.AppendLine(" dd.f_dsgp dd_dsgp, ")
|
||||
.AppendLine(" dg.f_name gd_name, ")
|
||||
.AppendLine(" dd.f_name dd_name ")
|
||||
.AppendLine(" from [SPCEPIWORLD].[dbo].[SGRP_DSC] sd ")
|
||||
.AppendLine(" join [SPCEPIWORLD].[dbo].[DESC_DAT] dd ")
|
||||
.AppendLine(" on sd.f_dsgp = dd.f_dsgp ")
|
||||
.AppendLine(" and sd.f_desc = dd.f_desc ")
|
||||
.AppendLine(" join [SPCEPIWORLD].[dbo].[DESC_GRP] dg ")
|
||||
.AppendLine(" on dd.f_dsgp = dg.f_dsgp ");
|
||||
_ = result.Append(" where sd.f_sgrp = ").Append(subGroupId).AppendLine(" ");
|
||||
_ = result.AppendLine(" for json path ");
|
||||
return result.ToString();
|
||||
results.Add(" select ");
|
||||
results.Add(" sd.f_sgrp sd_sgrp, ");
|
||||
results.Add(" sd.f_tsno sd_tsno, ");
|
||||
results.Add(" dd.f_dsgp dd_dsgp, ");
|
||||
results.Add(" dg.f_name gd_name, ");
|
||||
results.Add(" dd.f_name dd_name ");
|
||||
results.Add(" from [SPCEPIWORLD].[dbo].[SGRP_DSC] sd ");
|
||||
results.Add(" join [SPCEPIWORLD].[dbo].[DESC_DAT] dd ");
|
||||
results.Add(" on sd.f_dsgp = dd.f_dsgp ");
|
||||
results.Add(" and sd.f_desc = dd.f_desc ");
|
||||
results.Add(" join [SPCEPIWORLD].[dbo].[DESC_GRP] dg ");
|
||||
results.Add(" on dd.f_dsgp = dg.f_dsgp ");
|
||||
results.Add($" where sd.f_sgrp = {subGroupId} ");
|
||||
results.Add(" for json path ");
|
||||
return string.Join(' ', results);
|
||||
} // cSpell:enable
|
||||
|
||||
string IInfinityQSV4Repository.GetCommandText(string? subGroupId, string? process, string? job, string? part, string? lot, string? dateTime)
|
||||
{ // cSpell:disable
|
||||
StringBuilder result = new();
|
||||
List<string> results = [];
|
||||
const string dateTimeFormat = "yyyy-MM-dd HH:mm:ss";
|
||||
if (!string.IsNullOrEmpty(dateTime) && (dateTime.Contains('-') || dateTime.Contains(' ') || dateTime.Contains(':')) && dateTime.Length != dateTimeFormat.Length)
|
||||
throw new ArgumentException(null, nameof(dateTime));
|
||||
_ = result
|
||||
.AppendLine(" select case when iq.sl_loos is null then 0 else iq.sl_loos end + ")
|
||||
.AppendLine(" case when iq.sl_uoos is null then 0 else iq.sl_uoos end + ")
|
||||
.AppendLine(" iq.ev_count as iq_sum, ")
|
||||
.AppendLine(" iq.sl_aflag, ")
|
||||
.AppendLine(" iq.sl_loos, ")
|
||||
.AppendLine(" iq.sl_uoos, ")
|
||||
.AppendLine(" iq.se_sgrp, ")
|
||||
.AppendLine(" iq.se_sgtm, ")
|
||||
.AppendLine(" iq.se_tsno, ")
|
||||
.AppendLine(" iq.td_test, ")
|
||||
.AppendLine(" iq.pr_name, ")
|
||||
.AppendLine(" iq.jd_name, ")
|
||||
.AppendLine(" iq.pl_name, ")
|
||||
.AppendLine(" iq.pd_name, ")
|
||||
.AppendLine(" iq.td_name, ")
|
||||
.AppendLine(" iq.se_val, ")
|
||||
.AppendLine(" iq.sl_eflag, ")
|
||||
.AppendLine(" iq.sl_scal, ")
|
||||
.AppendLine(" iq.sl_sls, ")
|
||||
.AppendLine(" iq.sl_usl ")
|
||||
.AppendLine(" from ( ")
|
||||
.AppendLine(" select ")
|
||||
.AppendLine(" se.f_sgrp se_sgrp, ")
|
||||
.AppendLine(" se.f_sgtm se_sgtm, ")
|
||||
.AppendLine(" se.f_tsno se_tsno, ")
|
||||
.AppendLine(" se.f_val se_val, ")
|
||||
.AppendLine(" pr.f_name pr_name, ")
|
||||
.AppendLine(" jd.f_name jd_name, ")
|
||||
.AppendLine(" pl.f_name pl_name, ")
|
||||
.AppendLine(" pd.f_name pd_name, ")
|
||||
.AppendLine(" td.f_test td_test, ")
|
||||
.AppendLine(" td.f_name td_name, ")
|
||||
.AppendLine(" sl.f_eflag sl_eflag, ")
|
||||
.AppendLine(" sl.f_aflag sl_aflag, ")
|
||||
.AppendLine(" sl.f_scal sl_scal, ")
|
||||
.AppendLine(" sl.f_lsl sl_sls, ")
|
||||
.AppendLine(" sl.f_usl sl_usl, ")
|
||||
.AppendLine(" case when sl.f_aflag is null or sl.f_aflag = 0 then null else ")
|
||||
.AppendLine(" case when round(se.f_val, sl.F_scal, 1) < sl.f_lsl then 1 else 0 end ")
|
||||
.AppendLine(" end as sl_loos, ")
|
||||
.AppendLine(" case when sl.f_aflag is null or sl.f_aflag = 0 then null else ")
|
||||
.AppendLine(" case when round(se.f_val, sl.F_scal, 1) > sl.f_usl then 1 else 0 end ")
|
||||
.AppendLine(" end as sl_uoos, ")
|
||||
.AppendLine(" (select count(ev.f_evnt) ")
|
||||
.AppendLine(" from [spcepiworld].[dbo].[evnt_inf] ev ")
|
||||
.AppendLine(" where ev.f_prcs = pr.f_prcs ")
|
||||
.AppendLine(" and ev.f_part = pd.f_part ")
|
||||
.AppendLine(" and ev.f_sgtm = se.f_sgtm ")
|
||||
.AppendLine(" ) ev_count ")
|
||||
.AppendLine(" from [spcepiworld].[dbo].[sgrp_ext] se ")
|
||||
.AppendLine(" join [spcepiworld].[dbo].[prcs_dat] pr ")
|
||||
.AppendLine(" on se.f_prcs = pr.f_prcs ")
|
||||
.AppendLine(" join [spcepiworld].[dbo].[job_dat] jd ")
|
||||
.AppendLine(" on se.f_job = jd.f_job ")
|
||||
.AppendLine(" join [spcepiworld].[dbo].[part_lot] pl ")
|
||||
.AppendLine(" on se.f_lot = pl.f_lot ")
|
||||
.AppendLine(" join [spcepiworld].[dbo].[part_dat] pd ")
|
||||
.AppendLine(" on se.f_part = pd.f_part ")
|
||||
.AppendLine(" join [spcepiworld].[dbo].[test_dat] td ")
|
||||
.AppendLine(" on se.f_test = td.f_test ")
|
||||
.AppendLine(" left join [spcepiworld].[dbo].[spec_lim] sl ")
|
||||
.AppendLine(" on se.f_part = sl.f_part ")
|
||||
.AppendLine(" and se.f_test = sl.f_test ")
|
||||
.AppendLine(" where se.f_flag = 0 ")
|
||||
.AppendLine(" and (sl.f_prcs is null or se.f_prcs = sl.f_prcs or sl.f_prcs = 0) ");
|
||||
results.Add(" select case when iq.sl_loos is null then 0 else iq.sl_loos end + ");
|
||||
results.Add(" case when iq.sl_uoos is null then 0 else iq.sl_uoos end + ");
|
||||
results.Add(" iq.ev_count as iq_sum, ");
|
||||
results.Add(" iq.sl_aflag, ");
|
||||
results.Add(" iq.sl_loos, ");
|
||||
results.Add(" iq.sl_uoos, ");
|
||||
results.Add(" iq.se_sgrp, ");
|
||||
results.Add(" iq.se_sgtm, ");
|
||||
results.Add(" iq.se_tsno, ");
|
||||
results.Add(" iq.td_test, ");
|
||||
results.Add(" iq.pr_name, ");
|
||||
results.Add(" iq.jd_name, ");
|
||||
results.Add(" iq.pl_name, ");
|
||||
results.Add(" iq.pd_name, ");
|
||||
results.Add(" iq.td_name, ");
|
||||
results.Add(" iq.se_val, ");
|
||||
results.Add(" iq.sl_eflag, ");
|
||||
results.Add(" iq.sl_scal, ");
|
||||
results.Add(" iq.sl_sls, ");
|
||||
results.Add(" iq.sl_usl ");
|
||||
results.Add(" from ( ");
|
||||
results.Add(" select ");
|
||||
results.Add(" se.f_sgrp se_sgrp, ");
|
||||
results.Add(" se.f_sgtm se_sgtm, ");
|
||||
results.Add(" se.f_tsno se_tsno, ");
|
||||
results.Add(" se.f_val se_val, ");
|
||||
results.Add(" pr.f_name pr_name, ");
|
||||
results.Add(" jd.f_name jd_name, ");
|
||||
results.Add(" pl.f_name pl_name, ");
|
||||
results.Add(" pd.f_name pd_name, ");
|
||||
results.Add(" td.f_test td_test, ");
|
||||
results.Add(" td.f_name td_name, ");
|
||||
results.Add(" sl.f_eflag sl_eflag, ");
|
||||
results.Add(" sl.f_aflag sl_aflag, ");
|
||||
results.Add(" sl.f_scal sl_scal, ");
|
||||
results.Add(" sl.f_lsl sl_sls, ");
|
||||
results.Add(" sl.f_usl sl_usl, ");
|
||||
results.Add(" case when sl.f_aflag is null or sl.f_aflag = 0 then null else ");
|
||||
results.Add(" case when round(se.f_val, sl.F_scal, 1) < sl.f_lsl then 1 else 0 end ");
|
||||
results.Add(" end as sl_loos, ");
|
||||
results.Add(" case when sl.f_aflag is null or sl.f_aflag = 0 then null else ");
|
||||
results.Add(" case when round(se.f_val, sl.F_scal, 1) > sl.f_usl then 1 else 0 end ");
|
||||
results.Add(" end as sl_uoos, ");
|
||||
results.Add(" (select count(ev.f_evnt) ");
|
||||
results.Add(" from [spcepiworld].[dbo].[evnt_inf] ev ");
|
||||
results.Add(" where ev.f_prcs = pr.f_prcs ");
|
||||
results.Add(" and ev.f_part = pd.f_part ");
|
||||
results.Add(" and ev.f_sgtm = se.f_sgtm ");
|
||||
results.Add(" ) ev_count ");
|
||||
results.Add(" from [spcepiworld].[dbo].[sgrp_ext] se ");
|
||||
results.Add(" join [spcepiworld].[dbo].[prcs_dat] pr ");
|
||||
results.Add(" on se.f_prcs = pr.f_prcs ");
|
||||
results.Add(" join [spcepiworld].[dbo].[job_dat] jd ");
|
||||
results.Add(" on se.f_job = jd.f_job ");
|
||||
results.Add(" join [spcepiworld].[dbo].[part_lot] pl ");
|
||||
results.Add(" on se.f_lot = pl.f_lot ");
|
||||
results.Add(" join [spcepiworld].[dbo].[part_dat] pd ");
|
||||
results.Add(" on se.f_part = pd.f_part ");
|
||||
results.Add(" join [spcepiworld].[dbo].[test_dat] td ");
|
||||
results.Add(" on se.f_test = td.f_test ");
|
||||
results.Add(" left join [spcepiworld].[dbo].[spec_lim] sl ");
|
||||
results.Add(" on se.f_part = sl.f_part ");
|
||||
results.Add(" and se.f_test = sl.f_test ");
|
||||
results.Add(" where se.f_flag = 0 ");
|
||||
results.Add(" and (sl.f_prcs is null or se.f_prcs = sl.f_prcs or sl.f_prcs = 0) ");
|
||||
if (!string.IsNullOrEmpty(subGroupId))
|
||||
_ = result.Append(" and se.f_sgrp = ").Append(subGroupId.Split(" ")[0]).AppendLine(" ");
|
||||
results.Add($" and se.f_sgrp = {subGroupId.Split(" ")[0]} ");
|
||||
if (!string.IsNullOrEmpty(process))
|
||||
_ = result.Append(" and pr.f_name = '").Append(process).AppendLine("' ");
|
||||
results.Add($" and pr.f_name = '{process}' ");
|
||||
if (!string.IsNullOrEmpty(part))
|
||||
_ = result.Append(" and pd.f_name = '").Append(part).AppendLine("' ");
|
||||
results.Add($" and pd.f_name = '{part}' ");
|
||||
if (!string.IsNullOrEmpty(job))
|
||||
_ = result.Append(" and jd.f_name = '").Append(job).AppendLine("' ");
|
||||
results.Add($" and jd.f_name = '{job}' ");
|
||||
if (!string.IsNullOrEmpty(lot))
|
||||
_ = result.Append(" and pl.f_name = '").Append(lot).AppendLine("' ");
|
||||
results.Add($" and pl.f_name = '{lot}' ");
|
||||
if (!string.IsNullOrEmpty(dateTime) && (dateTime.Contains('-') || dateTime.Contains(' ') || dateTime.Contains(':')))
|
||||
_ = result.Append(" and dateadd(HH, -7, (dateadd(SS, convert(bigint, se.f_sgtm), '19700101'))) = '").Append(dateTime).AppendLine("' ");
|
||||
_ = result.AppendLine(" ) as iq ")
|
||||
.AppendLine(" order by iq.sl_loos + iq.sl_uoos + iq.ev_count desc, ")
|
||||
.AppendLine(" iq.sl_aflag desc, ")
|
||||
.AppendLine(" iq.se_sgrp, ")
|
||||
.AppendLine(" iq.se_tsno, ")
|
||||
.AppendLine(" iq.td_test ")
|
||||
.AppendLine(" for json path ");
|
||||
return result.ToString();
|
||||
results.Add($" and dateadd(HH, -7, (dateadd(SS, convert(bigint, se.f_sgtm), '19700101'))) = '{dateTime}' ");
|
||||
results.Add(" ) as iq ");
|
||||
results.Add(" order by iq.sl_loos + iq.sl_uoos + iq.ev_count desc, ");
|
||||
results.Add(" iq.sl_aflag desc, ");
|
||||
results.Add(" iq.se_sgrp, ");
|
||||
results.Add(" iq.se_tsno, ");
|
||||
results.Add(" iq.td_test ");
|
||||
results.Add(" for json path ");
|
||||
return string.Join(' ', results);
|
||||
} // cSpell:enable
|
||||
|
||||
private JsonElement[] GetAllReactorsAsJsonElementElement()
|
||||
@ -293,33 +291,32 @@ public class InfinityQSV4Repository : IInfinityQSV4Repository
|
||||
|
||||
string IInfinityQSV4Repository.GetCommandText(InfinityQSV4 infinityQSV4)
|
||||
{ // cSpell:disable
|
||||
StringBuilder result = new();
|
||||
List<string> results = [];
|
||||
if (string.IsNullOrEmpty(infinityQSV4.Process))
|
||||
throw new ArgumentException(nameof(infinityQSV4.Process));
|
||||
if (string.IsNullOrEmpty(infinityQSV4.Part))
|
||||
throw new ArgumentException(nameof(infinityQSV4.Part));
|
||||
_ = result
|
||||
.AppendLine(" select ")
|
||||
.AppendLine(" ev.f_evnt [ev_evnt], ")
|
||||
.AppendLine(" ev.f_sgtm [ev_sgtm], ")
|
||||
.AppendLine(" dateadd(HH, -7, (dateadd(SS, convert(bigint, ev.f_sgtm), '19700101'))) [ev_utc7], ")
|
||||
.AppendLine(" pr.f_name [pr_name], ")
|
||||
.AppendLine(" pd.f_name [pd_name], ")
|
||||
.AppendLine(" td.f_test [td_test], ")
|
||||
.AppendLine(" td.f_name [td_name], ")
|
||||
.AppendLine(" ev.f_name [ev_name] ")
|
||||
.AppendLine(" from [spcepiworld].[dbo].[evnt_inf] ev ")
|
||||
.AppendLine(" join [spcepiworld].[dbo].[prcs_dat] pr ")
|
||||
.AppendLine(" on ev.f_prcs = pr.f_prcs ")
|
||||
.AppendLine(" join [spcepiworld].[dbo].[part_dat] pd ")
|
||||
.AppendLine(" on ev.f_part = pd.f_part ")
|
||||
.AppendLine(" join [spcepiworld].[dbo].[test_dat] td ")
|
||||
.AppendLine(" on ev.f_test = td.f_test ")
|
||||
.Append(" where pr.f_name = '").Append(infinityQSV4.Process).AppendLine("' ")
|
||||
.Append(" and pd.f_name = '").Append(infinityQSV4.Part).AppendLine("' ")
|
||||
.Append(" and ev.f_sgtm = ").Append(infinityQSV4.SubGroupDateTime).AppendLine(" ")
|
||||
.AppendLine(" for json path ");
|
||||
return result.ToString();
|
||||
results.Add(" select ");
|
||||
results.Add(" ev.f_evnt [ev_evnt], ");
|
||||
results.Add(" ev.f_sgtm [ev_sgtm], ");
|
||||
results.Add(" dateadd(HH, -7, (dateadd(SS, convert(bigint, ev.f_sgtm), '19700101'))) [ev_utc7], ");
|
||||
results.Add(" pr.f_name [pr_name], ");
|
||||
results.Add(" pd.f_name [pd_name], ");
|
||||
results.Add(" td.f_test [td_test], ");
|
||||
results.Add(" td.f_name [td_name], ");
|
||||
results.Add(" ev.f_name [ev_name] ");
|
||||
results.Add(" from [spcepiworld].[dbo].[evnt_inf] ev ");
|
||||
results.Add(" join [spcepiworld].[dbo].[prcs_dat] pr ");
|
||||
results.Add(" on ev.f_prcs = pr.f_prcs ");
|
||||
results.Add(" join [spcepiworld].[dbo].[part_dat] pd ");
|
||||
results.Add(" on ev.f_part = pd.f_part ");
|
||||
results.Add(" join [spcepiworld].[dbo].[test_dat] td ");
|
||||
results.Add(" on ev.f_test = td.f_test ");
|
||||
results.Add($" where pr.f_name = '{infinityQSV4.Process}' ");
|
||||
results.Add($" and pd.f_name = '{infinityQSV4.Part}' ");
|
||||
results.Add($" and ev.f_sgtm = {infinityQSV4.SubGroupDateTime} ");
|
||||
results.Add(" for json path ");
|
||||
return string.Join(' ', results);
|
||||
} // cSpell:enable
|
||||
|
||||
Result<InfinityQSV4[]> IInfinityQSV4Repository.GetHeader(string subGroupId)
|
||||
@ -348,28 +345,27 @@ public class InfinityQSV4Repository : IInfinityQSV4Repository
|
||||
|
||||
string IInfinityQSV4Repository.GetCommandText(string process, string? part)
|
||||
{ // cSpell:disable
|
||||
StringBuilder result = new();
|
||||
List<string> results = [];
|
||||
if (string.IsNullOrEmpty(process))
|
||||
throw new ArgumentException(null, nameof(process));
|
||||
if (string.IsNullOrEmpty(part))
|
||||
throw new ArgumentException(null, nameof(part));
|
||||
_ = result
|
||||
.AppendLine(" select [f_mean] as ProcessMean, ")
|
||||
.AppendLine(" [f_sp] as ProcessSigma ")
|
||||
.AppendLine(" from [spcepiworld].[dbo].[test_dat] test ")
|
||||
.AppendLine(" join [spcepiworld].[dbo].[ctrl_lim] ctrl ")
|
||||
.AppendLine(" on test.f_test = ctrl.f_test ")
|
||||
.AppendLine(" and test.f_tsgp = 1104848523 /* Product Data */ ")
|
||||
.AppendLine(" join [spcepiworld].[dbo].[part_dat] part ")
|
||||
.AppendLine(" on part.f_part = ctrl.f_part ")
|
||||
.AppendLine(" and ctrl.f_test = 1125073605 /* Average Sum of Defects */ ")
|
||||
.AppendLine(" join [spcepiworld].[dbo].[prcs_dat] process ")
|
||||
.AppendLine(" on process.f_prcs = ctrl.f_prcs ")
|
||||
.AppendLine(" where test.f_name = 'Average Sum of Defects' ")
|
||||
.Append(" and process.f_name = '").Append(process).AppendLine("' ")
|
||||
.Append(" and part.f_name = '").Append(part).AppendLine("' ")
|
||||
.AppendLine(" for json path; ");
|
||||
return result.ToString();
|
||||
results.Add(" select [f_mean] as ProcessMean, ");
|
||||
results.Add(" [f_sp] as ProcessSigma ");
|
||||
results.Add(" from [spcepiworld].[dbo].[test_dat] test ");
|
||||
results.Add(" join [spcepiworld].[dbo].[ctrl_lim] ctrl ");
|
||||
results.Add(" on test.f_test = ctrl.f_test ");
|
||||
results.Add(" and test.f_tsgp = 1104848523 /* Product Data */ ");
|
||||
results.Add(" join [spcepiworld].[dbo].[part_dat] part ");
|
||||
results.Add(" on part.f_part = ctrl.f_part ");
|
||||
results.Add(" and ctrl.f_test = 1125073605 /* Average Sum of Defects */ ");
|
||||
results.Add(" join [spcepiworld].[dbo].[prcs_dat] process ");
|
||||
results.Add(" on process.f_prcs = ctrl.f_prcs ");
|
||||
results.Add(" where test.f_name = 'Average Sum of Defects' ");
|
||||
results.Add($" and process.f_name = '{process}' ");
|
||||
results.Add($" and part.f_name = '{part}' ");
|
||||
results.Add(" for json path; ");
|
||||
return string.Join(' ', results);
|
||||
} // cSpell:enable
|
||||
|
||||
string IInfinityQSV4Repository.GetProductDataAverageSumOfDefectsProcessMeanProcessSigma(string process, string? recipe)
|
||||
@ -393,53 +389,52 @@ public class InfinityQSV4Repository : IInfinityQSV4Repository
|
||||
|
||||
string IInfinityQSV4Repository.GetCommandText(List<string> eppReactorNumbers)
|
||||
{ // cSpell:disable
|
||||
StringBuilder result = new();
|
||||
_ = result
|
||||
.AppendLine(" select se.f_sgrp, ")
|
||||
.AppendLine(" dateadd(HH, -7, (dateadd(SS, convert(bigint, se.f_sgrp), '19700101'))) date_time, ")
|
||||
.AppendLine(" iq.pr_name, ")
|
||||
.AppendLine(" iq.pd_name, ")
|
||||
.AppendLine(" max(case ")
|
||||
.AppendLine(" when td.f_test = 1104769646 ")
|
||||
.AppendLine(" then se.f_val ")
|
||||
.AppendLine(" else null ")
|
||||
.AppendLine(" end) as iq_value, ")
|
||||
.AppendLine(" max(case ")
|
||||
.AppendLine(" when td.f_test = 1312288843 ")
|
||||
.AppendLine(" then se.f_val else null ")
|
||||
.AppendLine(" end) as iq_temp_offset_percent ")
|
||||
.AppendLine(" from ( ")
|
||||
.AppendLine(" select ")
|
||||
.AppendLine(" max(se.f_sgrp) se_max_sgrp, ")
|
||||
.AppendLine(" se.f_test se_test, ")
|
||||
.AppendLine(" pr.f_name pr_name, ")
|
||||
.AppendLine(" pd.f_name pd_name ")
|
||||
.AppendLine(" from [spcepiworld].[dbo].[sgrp_ext] se ")
|
||||
.AppendLine(" join [spcepiworld].[dbo].[prcs_dat] pr ")
|
||||
.AppendLine(" on se.f_prcs = pr.f_prcs ")
|
||||
.AppendLine(" join [spcepiworld].[dbo].[part_dat] pd ")
|
||||
.AppendLine(" on se.f_part = pd.f_part ")
|
||||
.AppendLine(" where se.f_flag = 0 ")
|
||||
.Append(" and pr.f_name in (").Append(string.Join(',', eppReactorNumbers)).AppendLine(") ")
|
||||
.AppendLine(" and pd.f_name = '1090 - Full Load' ")
|
||||
.AppendLine(" and se.f_test in (1104769646, 1312288843) ")
|
||||
.AppendLine(" group by se.f_test, ")
|
||||
.AppendLine(" pr.f_name, ")
|
||||
.AppendLine(" pd.f_name ")
|
||||
.AppendLine(" ) as iq ")
|
||||
.AppendLine(" join [spcepiworld].[dbo].[sgrp_ext] se ")
|
||||
.AppendLine(" on iq.se_max_sgrp = se.f_sgrp ")
|
||||
.AppendLine(" join [spcepiworld].[dbo].[test_dat] td ")
|
||||
.AppendLine(" on iq.se_test = td.f_test ")
|
||||
.AppendLine(" and se.f_test = td.f_test ")
|
||||
.AppendLine(" where se.f_flag = 0 ")
|
||||
.AppendLine(" and td.f_test in (1104769646, 1312288843) ")
|
||||
.AppendLine(" group by se.f_sgrp, ")
|
||||
.AppendLine(" iq.pr_name, ")
|
||||
.AppendLine(" iq.pd_name ")
|
||||
.AppendLine(" order by iq.pr_name ")
|
||||
.AppendLine(" for json path; ");
|
||||
return result.ToString();
|
||||
List<string> results = [];
|
||||
results.Add(" select se.f_sgrp, ");
|
||||
results.Add(" dateadd(HH, -7, (dateadd(SS, convert(bigint, se.f_sgrp), '19700101'))) date_time, ");
|
||||
results.Add(" iq.pr_name, ");
|
||||
results.Add(" iq.pd_name, ");
|
||||
results.Add(" max(case ");
|
||||
results.Add(" when td.f_test = 1104769646 ");
|
||||
results.Add(" then se.f_val ");
|
||||
results.Add(" else null ");
|
||||
results.Add(" end) as iq_value, ");
|
||||
results.Add(" max(case ");
|
||||
results.Add(" when td.f_test = 1312288843 ");
|
||||
results.Add(" then se.f_val else null ");
|
||||
results.Add(" end) as iq_temp_offset_percent ");
|
||||
results.Add(" from ( ");
|
||||
results.Add(" select ");
|
||||
results.Add(" max(se.f_sgrp) se_max_sgrp, ");
|
||||
results.Add(" se.f_test se_test, ");
|
||||
results.Add(" pr.f_name pr_name, ");
|
||||
results.Add(" pd.f_name pd_name ");
|
||||
results.Add(" from [spcepiworld].[dbo].[sgrp_ext] se ");
|
||||
results.Add(" join [spcepiworld].[dbo].[prcs_dat] pr ");
|
||||
results.Add(" on se.f_prcs = pr.f_prcs ");
|
||||
results.Add(" join [spcepiworld].[dbo].[part_dat] pd ");
|
||||
results.Add(" on se.f_part = pd.f_part ");
|
||||
results.Add(" where se.f_flag = 0 ");
|
||||
results.Add($" and pr.f_name in ({string.Join(',', eppReactorNumbers)} ");
|
||||
results.Add(" and pd.f_name = '1090 - Full Load' ");
|
||||
results.Add(" and se.f_test in (1104769646, 1312288843) ");
|
||||
results.Add(" group by se.f_test, ");
|
||||
results.Add(" pr.f_name, ");
|
||||
results.Add(" pd.f_name ");
|
||||
results.Add(" ) as iq ");
|
||||
results.Add(" join [spcepiworld].[dbo].[sgrp_ext] se ");
|
||||
results.Add(" on iq.se_max_sgrp = se.f_sgrp ");
|
||||
results.Add(" join [spcepiworld].[dbo].[test_dat] td ");
|
||||
results.Add(" on iq.se_test = td.f_test ");
|
||||
results.Add(" and se.f_test = td.f_test ");
|
||||
results.Add(" where se.f_flag = 0 ");
|
||||
results.Add(" and td.f_test in (1104769646, 1312288843) ");
|
||||
results.Add(" group by se.f_sgrp, ");
|
||||
results.Add(" iq.pr_name, ");
|
||||
results.Add(" iq.pd_name ");
|
||||
results.Add(" order by iq.pr_name ");
|
||||
results.Add(" for json path; ");
|
||||
return string.Join(' ', results);
|
||||
} // cSpell:enable
|
||||
|
||||
List<string[]> IInfinityQSV4Repository.GetEpiProTempVerificationRows(int[] night)
|
||||
@ -651,4 +646,55 @@ public class InfinityQSV4Repository : IInfinityQSV4Repository
|
||||
return result;
|
||||
}
|
||||
|
||||
private static string GetCommandText(string process, string? part, int? test)
|
||||
{ // cSpell:disable
|
||||
List<string> results = [];
|
||||
if (string.IsNullOrEmpty(process))
|
||||
throw new ArgumentException(null, nameof(process));
|
||||
if (string.IsNullOrEmpty(part))
|
||||
throw new ArgumentException(null, nameof(part));
|
||||
if (test is null)
|
||||
throw new ArgumentException(null, nameof(test));
|
||||
results.Add(" select se_max_sgrp, se.f_val se_value ");
|
||||
results.Add(" from ( ");
|
||||
results.Add(" select ");
|
||||
results.Add(" max(se.f_sgrp) se_max_sgrp ");
|
||||
results.Add(" from [spcepiworld].[dbo].[sgrp_ext] se ");
|
||||
results.Add(" join [spcepiworld].[dbo].[prcs_dat] pr ");
|
||||
results.Add(" on se.f_prcs = pr.f_prcs ");
|
||||
results.Add(" join [spcepiworld].[dbo].[part_dat] pd ");
|
||||
results.Add(" on se.f_part = pd.f_part ");
|
||||
results.Add(" where se.f_flag = 0 ");
|
||||
results.Add(" and se.f_tsno = 1 ");
|
||||
results.Add($" and pr.f_name = '{process}' ");
|
||||
results.Add($" and pd.f_name = '{part}' ");
|
||||
results.Add($" and se.f_test = {test.Value} ");
|
||||
results.Add(" ) as iq ");
|
||||
results.Add(" join [spcepiworld].[dbo].[sgrp_ext] se ");
|
||||
results.Add(" on se_max_sgrp = se.f_sgrp ");
|
||||
results.Add(" where se.f_flag = 0 ");
|
||||
results.Add(" and se.f_tsno = 1 ");
|
||||
results.Add($" and se.f_test = {test.Value} ");
|
||||
results.Add(" for json path ");
|
||||
return string.Join(' ', results);
|
||||
} // cSpell:enable
|
||||
|
||||
string IInfinityQSV4Repository.GetLastGroupIdWithValue(string process, string? part, int? test)
|
||||
{
|
||||
StringBuilder result;
|
||||
if (!string.IsNullOrEmpty(_MockRoot))
|
||||
{
|
||||
string json = File.ReadAllText(Path.Combine(string.Concat(AppContext.BaseDirectory, _MockRoot), $"{_RepositoryName}-{nameof(IInfinityQSV4Repository.GetLastGroupIdWithValue)}.json"));
|
||||
result = new(json);
|
||||
}
|
||||
else
|
||||
{
|
||||
string commandText = GetCommandText(process, part, test);
|
||||
result = GetForJsonPath(_DBConnectionFactory, commandText, useIqsConnection: false);
|
||||
if (result.Length == 0)
|
||||
result = new("{}");
|
||||
}
|
||||
return result.ToString();
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user