diff --git a/Server/Repositories/InfinityQSRepository.cs b/Server/Repositories/InfinityQSRepository.cs index 5e295fc..bf35afb 100644 --- a/Server/Repositories/InfinityQSRepository.cs +++ b/Server/Repositories/InfinityQSRepository.cs @@ -52,6 +52,8 @@ public class InfinityQSRepository : IInfinityQSRepository if (!string.IsNullOrEmpty(dateTime) && (dateTime.Contains('-') || dateTime.Contains(' ') || dateTime.Contains(':')) && dateTime.Length != dateTimeFormat.Length) throw new ArgumentException(nameof(dateTime)); _ = result + .AppendLine(" select iq.ev_count, iq.cl_count, iq.sl_count, iq.se_sgrp, iq.se_sgtm, iq.se_tsno, iq.td_test, iq.pr_name, iq.jd_name, iq.pl_name, iq.pd_name, iq.td_name, iq.se_val ") + .AppendLine(" from ( ") .AppendLine(" select ") .AppendLine(" se.f_sgrp se_sgrp, ") .AppendLine(" se.f_sgtm se_sgtm, ") @@ -63,11 +65,22 @@ public class InfinityQSRepository : IInfinityQSRepository .AppendLine(" pd.f_name pd_name, ") .AppendLine(" td.f_test td_test, ") .AppendLine(" td.f_name td_name, ") + .AppendLine(" (select count(cl.f_part) ") + .AppendLine(" from [spcepiworld].[dbo].[ctrl_lim] cl, ") + .AppendLine(" where cl.f_part = pd.f_part ") + .AppendLine(" and cl.f_test = td.f_test ") + .AppendLine(" ) cl_count ") + .AppendLine(" (select count(sl.f_part) ") + .AppendLine(" from [spcepiworld].[dbo].[spec_lim] sl, ") + .AppendLine(" where sl.f_part = pd.f_part ") + .AppendLine(" and sl.f_test = td.f_test ") + .AppendLine(" ) sl_count, ") .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) ev_count ") + .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 ") @@ -92,6 +105,8 @@ public class InfinityQSRepository : IInfinityQSRepository _ = result.Append(" and pl.f_name = '").Append(lot).AppendLine("' "); 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 "); + _ = result.AppendLine(" order by iq.ev_count desc, iq.cl_count desc, iq.sl_count desc, iq.se_sgrp, iq.se_tsno, iq.td_test "); _ = result.AppendLine(" for json path "); return result.ToString(); } @@ -184,8 +199,6 @@ public class InfinityQSRepository : IInfinityQSRepository throw new ArgumentException(nameof(infinityQSBase.PR_NAME)); if (string.IsNullOrEmpty(infinityQSBase.PD_NAME)) throw new ArgumentException(nameof(infinityQSBase.PD_NAME)); - if (infinityQSBase.SE_SGTM is null) - throw new ArgumentException(nameof(infinityQSBase.SE_SGTM)); _ = result .AppendLine(" select ") .AppendLine(" ev.f_evnt [ev_evnt], ") @@ -225,7 +238,7 @@ public class InfinityQSRepository : IInfinityQSRepository InfinityQSEvent[]? results; IInfinityQSRepository infinityQSRepository = this; InfinityQSBase infinityQSBase = GetInfinityQSBase(_DBConnectionFactory, infinityQSRepository, subGroupId); - if (!infinityQSBase.EV_COUNT.HasValue || infinityQSBase.EV_COUNT.Value <= 0) + if (infinityQSBase.EV_COUNT <= 0) results = Array.Empty(); else { diff --git a/Server/Repositories/InfinityQSV2Repository.cs b/Server/Repositories/InfinityQSV2Repository.cs index 973adef..63d4e3a 100644 --- a/Server/Repositories/InfinityQSV2Repository.cs +++ b/Server/Repositories/InfinityQSV2Repository.cs @@ -52,6 +52,8 @@ public class InfinityQSV2Repository : IInfinityQSV2Repository if (!string.IsNullOrEmpty(dateTime) && (dateTime.Contains('-') || dateTime.Contains(' ') || dateTime.Contains(':')) && dateTime.Length != dateTimeFormat.Length) throw new ArgumentException(null, nameof(dateTime)); _ = result + .AppendLine(" select iq.ev_count, iq.cl_count, iq.sl_count, iq.se_sgrp, iq.se_sgtm, iq.se_tsno, iq.td_test, iq.pr_name, iq.jd_name, iq.pl_name, iq.pd_name, iq.td_name, iq.se_val ") + .AppendLine(" from ( ") .AppendLine(" select ") .AppendLine(" se.f_sgrp se_sgrp, ") .AppendLine(" se.f_sgtm se_sgtm, ") @@ -63,11 +65,22 @@ public class InfinityQSV2Repository : IInfinityQSV2Repository .AppendLine(" pd.f_name pd_name, ") .AppendLine(" td.f_test td_test, ") .AppendLine(" td.f_name td_name, ") + .AppendLine(" (select count(cl.f_part) ") + .AppendLine(" from [spcepiworld].[dbo].[ctrl_lim] cl, ") + .AppendLine(" where cl.f_part = pd.f_part ") + .AppendLine(" and cl.f_test = td.f_test ") + .AppendLine(" ) cl_count ") + .AppendLine(" (select count(sl.f_part) ") + .AppendLine(" from [spcepiworld].[dbo].[spec_lim] sl, ") + .AppendLine(" where sl.f_part = pd.f_part ") + .AppendLine(" and sl.f_test = td.f_test ") + .AppendLine(" ) sl_count, ") .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) ev_count ") + .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 ") @@ -92,6 +105,8 @@ public class InfinityQSV2Repository : IInfinityQSV2Repository _ = result.Append(" and pl.f_name = '").Append(lot).AppendLine("' "); 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 "); + _ = result.AppendLine(" order by iq.ev_count desc, iq.cl_count desc, iq.sl_count desc, iq.se_sgrp, iq.se_tsno, iq.td_test "); _ = result.AppendLine(" for json path "); return result.ToString(); } @@ -119,7 +134,7 @@ public class InfinityQSV2Repository : IInfinityQSV2Repository InfinityQSBaseV2[] results = InfinityQSBase.Convert(collection); // if (results.Select(l => l.SubGroupId).Distinct().Count() != 1) // throw new NotSupportedException("Multiple ids are present!"); - result = (from l in results orderby l.SubGroupId, l.SiteNumber, l.VariableNumber select l).First(); + result = results.First(); return result; } @@ -187,8 +202,6 @@ public class InfinityQSV2Repository : IInfinityQSV2Repository throw new ArgumentException(nameof(infinityQSBase.Process)); if (string.IsNullOrEmpty(infinityQSBase.Part)) throw new ArgumentException(nameof(infinityQSBase.Part)); - if (infinityQSBase.SubGroupDateTime is null) - throw new ArgumentException(nameof(infinityQSBase.SubGroupDateTime)); _ = result .AppendLine(" select ") .AppendLine(" ev.f_evnt [ev_evnt], ") @@ -228,7 +241,7 @@ public class InfinityQSV2Repository : IInfinityQSV2Repository InfinityQSEvent[]? collection; IInfinityQSV2Repository infinityQSV2Repository = this; InfinityQSBaseV2 infinityQSBase = GetInfinityQSBase(_DBConnectionFactory, infinityQSV2Repository, subGroupId); - if (!infinityQSBase.EventCount.HasValue || infinityQSBase.EventCount.Value <= 0) + if (infinityQSBase.EventCount <= 0) collection = Array.Empty(); else { diff --git a/Server/Views/Shared/_Layout.cshtml b/Server/Views/Shared/_Layout.cshtml index 6d02b57..17b4a21 100644 --- a/Server/Views/Shared/_Layout.cshtml +++ b/Server/Views/Shared/_Layout.cshtml @@ -71,6 +71,7 @@
  • @Html.ActionLink("Run Information", "RunInfo", "Pages", new { area = "" }, null)
  • @Html.ActionLink("Run Headers", "RunHeaders", "Pages", new { area = "" }, null)
  • @Html.ActionLink("Export", "Index", "Export", new { area = "" }, null)
  • +
  • @Html.ActionLink("Work Material", "WorkMaterial", "Reactors", new { area = "" }, null)
  • Archive