239 lines
11 KiB
C#
239 lines
11 KiB
C#
using Adaptation.Shared.Metrology;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
|
|
namespace Adaptation.Shared
|
|
{
|
|
|
|
public class IQSRecord
|
|
{
|
|
|
|
public string SID { get; protected set; }
|
|
public string Part { get; protected set; }
|
|
public string Process { get; protected set; }
|
|
public string Lot { get; protected set; }
|
|
public string SampleSize { get; protected set; }
|
|
public string ParameterName { get; protected set; }
|
|
public string TestNumber { get; protected set; }
|
|
public string ParameterValue { get; protected set; }
|
|
public string WaferID { get; protected set; }
|
|
public string WaferScribe { get; protected set; }
|
|
public string Pocket { get; protected set; }
|
|
public string EpiThicknessMean { get; protected set; }
|
|
public string WaferRegion { get; protected set; }
|
|
public string ToolID { get; protected set; }
|
|
public string EmployeeID { get; protected set; }
|
|
public string EmployeeName { get; protected set; }
|
|
public string Date { get; protected set; }
|
|
public Column Column { get; protected set; }
|
|
|
|
public IQSRecord(object sID, object part, object process, object lot, object sampleSize, object parameterName, object testNumber, object parameterValue, object waferID, object waferScribe, object pocket, object epiThicknessMean, object waferRegion, object toolID, object employeeID, object employeeName, object date, Dictionary<string, Column> keyValuePairs)
|
|
{
|
|
if (sID is null)
|
|
SID = string.Empty;
|
|
else
|
|
SID = sID.ToString();
|
|
if (part is null)
|
|
Part = string.Empty;
|
|
else
|
|
Part = part.ToString();
|
|
if (process is null)
|
|
Process = string.Empty;
|
|
else
|
|
Process = process.ToString();
|
|
if (lot is null)
|
|
Lot = string.Empty;
|
|
else
|
|
Lot = lot.ToString();
|
|
if (sampleSize is null)
|
|
SampleSize = string.Empty;
|
|
else
|
|
SampleSize = sampleSize.ToString();
|
|
if (parameterName is null)
|
|
ParameterName = string.Empty;
|
|
else
|
|
ParameterName = parameterName.ToString();
|
|
if (testNumber is null)
|
|
TestNumber = string.Empty;
|
|
else
|
|
TestNumber = testNumber.ToString();
|
|
if (parameterValue is null)
|
|
ParameterValue = string.Empty;
|
|
else
|
|
ParameterValue = parameterValue.ToString();
|
|
if (waferID is null)
|
|
WaferID = string.Empty;
|
|
else
|
|
WaferID = waferID.ToString();
|
|
if (waferScribe is null)
|
|
WaferScribe = string.Empty;
|
|
else
|
|
WaferScribe = waferScribe.ToString();
|
|
if (pocket is null)
|
|
Pocket = string.Empty;
|
|
else
|
|
Pocket = pocket.ToString();
|
|
if (epiThicknessMean is null)
|
|
EpiThicknessMean = string.Empty;
|
|
else
|
|
EpiThicknessMean = epiThicknessMean.ToString();
|
|
if (waferRegion is null)
|
|
WaferRegion = string.Empty;
|
|
else
|
|
WaferRegion = waferRegion.ToString();
|
|
if (toolID is null)
|
|
ToolID = string.Empty;
|
|
else
|
|
ToolID = toolID.ToString();
|
|
if (employeeID is null)
|
|
EmployeeID = string.Empty;
|
|
else
|
|
EmployeeID = employeeID.ToString();
|
|
if (employeeName is null)
|
|
EmployeeName = string.Empty;
|
|
else
|
|
EmployeeName = employeeName.ToString();
|
|
if (date is null)
|
|
Date = string.Empty;
|
|
else
|
|
Date = date.ToString();
|
|
if (parameterName is null || !keyValuePairs.ContainsKey(parameterName.ToString()))
|
|
Column = Column.AFM_Roughness;
|
|
else
|
|
Column = keyValuePairs[parameterName.ToString()];
|
|
}
|
|
|
|
private static string GetBaseTableJoins()
|
|
{
|
|
StringBuilder result = new StringBuilder();
|
|
result.Append(" from [irmnspc].[dbo].sgrp_ext se ").
|
|
Append(" join [irmnspc].[dbo].test_dat td on se.f_test = td.f_test ").
|
|
Append(" join [irmnspc].[dbo].part_dat pd on se.f_part = pd.f_part ").
|
|
Append(" join [irmnspc].[dbo].part_lot pl on se.f_lot = pl.f_lot ").
|
|
Append(" join [irmnspc].[dbo].prcs_dat pr on se.f_prcs = pr.f_prcs ").
|
|
Append(" join [irmnspc].[dbo].empl_inf em on se.f_empl = em.f_empl ");
|
|
return result.ToString();
|
|
}
|
|
|
|
internal static StringBuilder GetIqsRecordsSinceSql()
|
|
{
|
|
StringBuilder result = new StringBuilder();
|
|
result.Append(" select ").
|
|
Append(" se.f_sgrp [sid], concat(se.f_sgrp, ', ', td.f_name, ', ', pd.f_name, ', ', pl.f_name, ', ', pr.f_name, ', ', em.f_name, ', ', se.f_sgtm) [csv] ").
|
|
Append(GetBaseTableJoins()).
|
|
Append(" where se.f_sgrp >= 1543459064 ").
|
|
Append(" and se.f_sgrp > ( @lastSID - 20 ) ").
|
|
Append(" /* and dateadd(hh, -7, (dateadd(ss, convert(bigint, se.f_sgtm), '19700101'))) >= '2019-08-25 00:00:00.000' */ ").
|
|
Append(" and td.f_name = @key ").
|
|
Append(" group by se.f_sgrp, td.f_name, pd.f_name, pl.f_name, pr.f_name, em.f_name, se.f_sgtm ").
|
|
Append(" order by se.f_sgrp, pd.f_name, td.f_name ");
|
|
return result;
|
|
}
|
|
|
|
internal static StringBuilder GetIqsRecordsSql()
|
|
{
|
|
StringBuilder result = new StringBuilder();
|
|
result.Append(" select ").
|
|
Append(" ta.id [SID], ").
|
|
Append(" ta.ms [Part], ").
|
|
Append(" ta.pr [Process], ").
|
|
Append(" ta.lt [Lot], ").
|
|
Append(" ta.sz [Sample Size], ").
|
|
Append(" ta.pn [Parameter Name], ").
|
|
Append(" ta.tn [Test Number], ").
|
|
Append(" ta.pv [Parameter Value], ").
|
|
Append(" tb.v1337859646 [Wafer ID], ").
|
|
Append(" tb.v1337859592 [Wafer Scribe], ").
|
|
Append(" tb.v1342510661 [Pocket], ").
|
|
Append(" tb.v1340294286 [Epi Thickness Mean], ").
|
|
Append(" tb.v1345566180 [Wafer Region], ").
|
|
Append(" tb.v1363881711 [Tool ID], ").
|
|
Append(" ta.em [Employee ID], ").
|
|
Append(" ta.en [Employee Name], ").
|
|
Append(" ta.dt [Date] ").
|
|
Append(" from ( ").
|
|
Append(" select ").
|
|
Append(" se.f_sgrp id, ").
|
|
Append(" se.f_sgsz sz, ").
|
|
Append(" concat(se.f_tsno, '.', se.f_sbno) tn, ").
|
|
Append(" se.f_val pv, ").
|
|
Append(" se.f_empl em, ").
|
|
Append(" dateadd(hh, -7, (dateadd(ss, convert(bigint, se.f_sgtm), '19700101'))) dt, ").
|
|
Append(" td.f_name pn, ").
|
|
Append(" pd.f_name as ms, ").
|
|
Append(" pl.f_name lt, ").
|
|
Append(" pr.f_name pr, ").
|
|
Append(" em.f_name en ").
|
|
Append(GetBaseTableJoins()).
|
|
Append(" where se.f_sgrp = @sid ").
|
|
Append(" ) as ta ").
|
|
Append(" join ( ").
|
|
Append(" select ").
|
|
Append(" se.f_sgrp id, ").
|
|
Append(" max(case when dd.f_dsgp = 1337859646 then dd.f_name end) as v1337859646, ").
|
|
Append(" max(case when dd.f_dsgp = 1337859592 then dd.f_name end) as v1337859592, ").
|
|
Append(" max(case when dd.f_dsgp = 1342510661 then dd.f_name end) as v1342510661, ").
|
|
Append(" max(case when dd.f_dsgp = 1340294286 then dd.f_name end) as v1340294286, ").
|
|
Append(" max(case when dd.f_dsgp = 1345566180 then dd.f_name end) as v1345566180, ").
|
|
Append(" max(case when dd.f_dsgp = 1363881711 then dd.f_name end) as v1363881711 ").
|
|
Append(" from [irmnspc].[dbo].sgrp_ext se ").
|
|
Append(" join [irmnspc].[dbo].test_dat td on se.f_test = td.f_test ").
|
|
Append(" join [irmnspc].[dbo].sgrp_dsc sd on se.f_sgrp = sd.f_sgrp ").
|
|
Append(" join [irmnspc].[dbo].desc_dat dd on sd.f_desc = dd.f_desc ").
|
|
Append(" and isnull(dd.f_name, '') <> '' ").
|
|
Append(" where se.f_sgrp = @sid ").
|
|
Append(" and dd.f_dsgp in (1337859646 /* Wafer ID */, 1337859592 /* Wafer Scribe */, 1342510661 /* Pocket */, 1340294286 /* Epi Thickness Mean */, 1345566180 /* Wafer Region */, 1363881711 /* Tool ID */) ").
|
|
Append(" group by se.f_sgrp ").
|
|
Append(" ) tb on ta.id = tb.id ").
|
|
Append(" order by ta.id desc, ta.ms, ta.pr, ta.lt, ta.sz, ta.tn, ta.dt, ta.pn ");
|
|
return result;
|
|
}
|
|
|
|
internal static List<IQSRecord> GetIqsRecords(Dictionary<int, List<object>> rawData, int count)
|
|
{
|
|
List<IQSRecord> results = new List<IQSRecord>();
|
|
IQSRecord iqsRecord;
|
|
List<object> c0 = rawData[0];
|
|
List<object> c1 = rawData[1];
|
|
List<object> c2 = rawData[2];
|
|
List<object> c3 = rawData[3];
|
|
List<object> c4 = rawData[4];
|
|
List<object> c5 = rawData[5];
|
|
List<object> c6 = rawData[6];
|
|
List<object> c7 = rawData[7];
|
|
List<object> c8 = rawData[8];
|
|
List<object> c9 = rawData[9];
|
|
List<object> cA = rawData[10];
|
|
List<object> cB = rawData[11];
|
|
List<object> cC = rawData[12];
|
|
List<object> cD = rawData[13];
|
|
List<object> cE = rawData[14];
|
|
List<object> cF = rawData[15];
|
|
List<object> cG = rawData[16];
|
|
if (c0.Any())
|
|
{
|
|
Array array = Enum.GetValues(typeof(Column));
|
|
Dictionary<string, Column> keyValuePairs = new Dictionary<string, Column>();
|
|
foreach (Column column in array)
|
|
keyValuePairs.Add(column.GetDiplayName(), column);
|
|
for (int i = 0; i < c0.Count; i++)
|
|
{
|
|
iqsRecord = new IQSRecord(c0[i], c1[i], c2[i], c3[i], c4[i], c5[i], c6[i], c7[i], c8[i], c9[i], cA[i], cB[i], cC[i], cD[i], cE[i], cF[i], cG[i], keyValuePairs);
|
|
results.Add(iqsRecord);
|
|
}
|
|
}
|
|
return results;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
//(1337859646 /* Wafer ID */, 1337859592 /* Wafer Scribe */, 1342510661 /* Pocket */, 1340294286 /* Epi Thickness Mean */, 1345566180 /* Wafer Region */, 1363881711 /* Tool ID */) ").
|
|
//return string.Concat(SID, Part, Process, Lot, SampleSize, TestNumber, WaferID, WaferScribe, Pocket, EpiThicknessMean, WaferRegion, ToolID, EmployeeID, EmployeeName, Date);
|
|
return string.Concat(SID, Part, Process, Lot, SampleSize, TestNumber, EmployeeID, EmployeeName, Date);
|
|
}
|
|
|
|
}
|
|
|
|
} |