[성현모] TestTrend 기능 추가
This commit is contained in:
@ -2,6 +2,8 @@
|
||||
using SystemX.Core.DB;
|
||||
using Web.Tra.Model;
|
||||
using SystemX.Core.Utils;
|
||||
using Microsoft.AspNetCore.Mvc.Infrastructure;
|
||||
using Radzen.Blazor;
|
||||
|
||||
public static class ObjectExtend
|
||||
{
|
||||
@ -101,6 +103,7 @@ public static class ObjectExtend
|
||||
//parse
|
||||
var parse = logData.Select(x=>x.ParseTestResult(testList)).Where(x=> x is not null && string.IsNullOrEmpty(x.MeasuredValue) == false).ToList();
|
||||
testResult.ParseTestResult = parse;
|
||||
testResult.No = (long)histTestResult.No;
|
||||
|
||||
return testResult;
|
||||
}
|
||||
@ -195,7 +198,14 @@ public static class ObjectExtend
|
||||
if (rows.FirstOrDefault().Dimension.ToLower() == "dez" || rows.FirstOrDefault().Dimension.ToLower() == "v" ||
|
||||
rows.FirstOrDefault().Dimension.ToLower() == "float" || rows.FirstOrDefault().Dimension.ToLower() == "int")
|
||||
{
|
||||
summary.Average = rows.Average(x => Convert.ToDouble(x.MeasuredValue)).ToString();
|
||||
try
|
||||
{
|
||||
summary.Average = rows.Average(x => Convert.ToDouble(x.MeasuredValue)).ToString();
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
summary.Average = string.Empty;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -231,4 +241,50 @@ public static class ObjectExtend
|
||||
TestRequestsID = testHistories.FirstOrDefault().TestListReqID,
|
||||
};
|
||||
}
|
||||
|
||||
public static TestTrend ToTestTrend(this List<TestHistory> histories, List<TestResult> testResult, TestSummary summary, int stepId)
|
||||
{
|
||||
TestTrend result = new TestTrend();
|
||||
result.ParseTestTrend = new List<ParseTestTrend>();
|
||||
result.TestStepInfo = summary.ParseTestSummary.Where(x=>x.StepNo == stepId)?.FirstOrDefault();
|
||||
result.TestDataInfo = histories.GetTestSummaryInformation();
|
||||
|
||||
if (histories?.Count > 0)
|
||||
{
|
||||
int rowNo = 0;
|
||||
foreach (var history in histories.OrderBy(x=>x.TestDateTime))
|
||||
{
|
||||
var r = testResult.Where(x => x.No == history.No)?.FirstOrDefault();
|
||||
if (r is not null)
|
||||
{
|
||||
var step = r.ParseTestResult.Where(x => x.StepNo == stepId)?.FirstOrDefault();
|
||||
if(step is not null)
|
||||
{
|
||||
result.ParseTestTrend.Add(new ParseTestTrend
|
||||
{
|
||||
RowNo = rowNo + 1,
|
||||
TestTime = (DateTime)history.TestDateTime,
|
||||
MO = step.MO,
|
||||
ProductID = history.ProductID,
|
||||
Min = step.Min,
|
||||
Value = step.MeasuredValue,
|
||||
Max = step.Max,
|
||||
Result = step.Result,
|
||||
Duration = step.Duration
|
||||
});
|
||||
}
|
||||
}
|
||||
rowNo += 1;
|
||||
}
|
||||
}
|
||||
|
||||
result.MesuredDataAnalysis = new MesuredDataAnalysis
|
||||
{
|
||||
Average = result.ParseTestTrend.Average(x => x.Value.GetType()== typeof(double) ? Convert.ToDouble(x.Value) : 0.0),
|
||||
Min = result.ParseTestTrend.Min(x => x.Value.GetType() == typeof(double) ? Convert.ToDouble(x.Value) : 0.0),
|
||||
Max = result.ParseTestTrend.Max(x => x.Value.GetType() == typeof(double) ? Convert.ToDouble(x.Value) : 0.0),
|
||||
};
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user