[성현모] TRA 버그 수정, Json Convert Tool 추가
This commit is contained in:
@ -299,19 +299,17 @@ namespace SystemX.Product.TRA.DataManager
|
||||
|
||||
public DataTable SearchTestSummary(string[] testReqID, List<Int64> vnpSummaryNo)
|
||||
{
|
||||
DateTime start = DateTime.Now;
|
||||
try
|
||||
{
|
||||
string requId = testReqID?.First();
|
||||
if (string.IsNullOrEmpty(requId) == false && requId.Contains(";") == true || requId.Contains("@") == true)
|
||||
{
|
||||
start = Convert.ToDateTime(requId.Split(';','@')[0]);
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
//start = DateTime
|
||||
}
|
||||
string strGetDataTime = testReqID?.First().Split('@',';')[0];
|
||||
|
||||
int nGetDataTimeYYYY = Convert.ToInt32(strGetDataTime.Substring(0, 4));
|
||||
int nGetDataTimemm = Convert.ToInt32(strGetDataTime.Substring(4, 2));
|
||||
int nGetDataTimeDD = Convert.ToInt32(strGetDataTime.Substring(6, 2));
|
||||
int nGetDataTimeHH = Convert.ToInt32(strGetDataTime.Substring(8, 2));
|
||||
int nGetDataTimeMM = Convert.ToInt32(strGetDataTime.Substring(10, 2));
|
||||
int nGetDataTimeSS = Convert.ToInt32(strGetDataTime.Substring(12, 2));
|
||||
int nGetDataTimeFFF = Convert.ToInt32(strGetDataTime.Substring(14, 3));
|
||||
|
||||
DateTime start = new DateTime(nGetDataTimeYYYY, nGetDataTimemm, nGetDataTimeDD, nGetDataTimeHH, nGetDataTimeMM, nGetDataTimeSS, nGetDataTimeFFF);//Convert.ToDateTime(testReqID?.First().Split('@')[0]);
|
||||
|
||||
if (TestSummarySelectView == eSelectDataView.DataDocumentViewC1)
|
||||
{
|
||||
@ -367,24 +365,48 @@ namespace SystemX.Product.TRA.DataManager
|
||||
list.AddRange(JsonConvert.DeserializeObject<List<CPXV2Log.Tables.HIST_TestResult>>(dtResult.Rows[i]["LogData"].ToString().GzipDecompress()));
|
||||
}
|
||||
|
||||
/*
|
||||
strQuery += $"SELECT ";
|
||||
strQuery += $"Y.[StepID], ";
|
||||
strQuery += $"AVG(CASE WHEN (Y.[MeasValStr] = NULL OR Y.[MeasValStr] = '') AND (Y.[Message] = NULL OR Y.[Message] = '') AND (Y.[MeasVal] != 0.00000 AND Y.[Result] != 'NONE') THEN Y.[MeasVal] ELSE NULL END) AS Average, ";
|
||||
strQuery += $"COUNT(Y.[Result]) AS Total, ";
|
||||
strQuery += $"COUNT(CASE WHEN Y.[Result] = 'OK' THEN 1 END) AS OK, ";
|
||||
strQuery += $"COUNT(CASE WHEN Y.[Result] = 'NG' OR X.[Result] = 'ERROR' THEN 1 END) AS NG ";
|
||||
strQuery += $" ";
|
||||
strQuery += $"FROM [{DMCommon.SummaryLogTable}] AS X WITH(NOLOCK) ";
|
||||
strQuery += $"INNER JOIN [{strTableTerm}] AS Y WITH(NOLOCK) ON (Y.AccessKey BETWEEN X.AccessStart AND X.AccessEnd) ";
|
||||
*/
|
||||
|
||||
dtResult = list.GroupBy(x => x.StepID).Select(y => new
|
||||
{
|
||||
StepID = y.First().StepID,
|
||||
Average = GetAvg(y.Average(z => z.MeasVal)),
|
||||
Average = GetAvg(y.ToList()),
|
||||
Total = y.Count(),
|
||||
OK = y.Count(z=>z.Result.Contains("OK")),
|
||||
NG = y.Count(z=>!z.Result.Contains("OK"))
|
||||
}).OrderBy(y=>y.StepID).ToDataTable();
|
||||
OK = y.Count(z => z.Result.Contains("OK")),
|
||||
NG = y.Count(z => !z.Result.Contains("OK"))
|
||||
}).OrderBy(y => y.StepID).ToDataTable();
|
||||
|
||||
return dtResult;
|
||||
}
|
||||
|
||||
string GetAvg(decimal avg)
|
||||
string GetAvg(List<CPXV2Log.Tables.HIST_TestResult> res)
|
||||
{
|
||||
if (avg > 0)
|
||||
return avg.ToString();
|
||||
else
|
||||
return string.Empty;
|
||||
CPXV2Log.Tables.HIST_TestResult value = res.First();
|
||||
|
||||
if (string.IsNullOrEmpty(value.MeasValStr) &&
|
||||
string.IsNullOrEmpty(value.Message) &&
|
||||
((value.MeasVal != 0) &&
|
||||
string.Compare(value.Result, "NONE") != 0))
|
||||
return res.Average(x => x.MeasVal).ToString();
|
||||
|
||||
string strDefaultValue = string.Empty;
|
||||
|
||||
if (string.IsNullOrEmpty(value.MeasValStr) == false)
|
||||
strDefaultValue = value.MeasValStr;
|
||||
else if (string.IsNullOrEmpty(value.Message) == false)
|
||||
strDefaultValue = value.Message;
|
||||
|
||||
return strDefaultValue;
|
||||
}
|
||||
|
||||
DataTable GetRawResult(DetailTestDataCollection data)
|
||||
|
||||
Reference in New Issue
Block a user