Add link to WorkMaterial

Add new columns OC and OS count
This commit is contained in:
Mike Phares 2023-04-18 11:43:52 -07:00
parent 70c1e1a52a
commit c655ed5c6b
4 changed files with 59 additions and 26 deletions

View File

@ -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<InfinityQSEvent>();
else
{

View File

@ -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<InfinityQSEvent>();
else
{

View File

@ -71,6 +71,7 @@
<li>@Html.ActionLink("Run Information", "RunInfo", "Pages", new { area = "" }, null)</li>
<li>@Html.ActionLink("Run Headers", "RunHeaders", "Pages", new { area = "" }, null)</li>
<li>@Html.ActionLink("Export", "Index", "Export", new { area = "" }, null)</li>
<li>@Html.ActionLink("Work Material", "WorkMaterial", "Reactors", new { area = "" }, null)</li>
<li><a href="https://oi-metrology-viewer-archive.mes.infineon.com/" target="_blank">Archive</a></li>
</ul>
<p class="navbar-text navbar-right">

View File

@ -1,16 +1,18 @@
namespace OI.Metrology.Shared.DataModels;
public record InfinityQSBase(int? SE_SGRP,
int? SE_SGTM,
int? SE_TSNO,
public record InfinityQSBase(int EV_COUNT,
int CL_COUNT,
int SL_COUNT,
int SE_SGRP,
int SE_SGTM,
int SE_TSNO,
int TD_TEST,
string? PR_NAME,
string? JD_NAME,
string? PL_NAME,
string? PD_NAME,
int? TD_TEST,
string? TD_NAME,
double? SE_VAL,
int? EV_COUNT)
double? SE_VAL)
{
public static InfinityQSBaseV2[] Convert(InfinityQSBase[] collection)
@ -18,36 +20,40 @@ public record InfinityQSBase(int? SE_SGRP,
List<InfinityQSBaseV2> results = new();
foreach (InfinityQSBase item in collection)
results.Add(Map(item));
return results.ToArray();
return (from l in results orderby l.EventCount descending, l.ControlLimitCount descending, l.SpecLimitCount descending, l.SubGroupId, l.SiteNumber, l.VariableNumber select l).ToArray();
}
public static InfinityQSBaseV2 Map(InfinityQSBase item)
{
InfinityQSBaseV2 result = new(item.SE_SGRP,
InfinityQSBaseV2 result = new(item.EV_COUNT,
item.CL_COUNT,
item.SL_COUNT,
item.SE_SGRP,
item.SE_SGTM,
item.SE_TSNO,
item.TD_TEST,
item.PR_NAME,
item.JD_NAME,
item.PL_NAME,
item.PD_NAME,
item.TD_TEST,
item.TD_NAME,
item.SE_VAL,
item.EV_COUNT);
item.SE_VAL);
return result;
}
}
public record InfinityQSBaseV2(int? SubGroupId,
int? SubGroupDateTime,
int? SiteNumber,
public record InfinityQSBaseV2(int EventCount,
int ControlLimitCount,
int SpecLimitCount,
int SubGroupId,
int SubGroupDateTime,
int SiteNumber,
int VariableNumber,
string? Process,
string? Job,
string? Lot,
string? Part,
int? VariableNumber,
string? Variable,
double? Value,
int? EventCount)
double? Value)
{ }