diff --git a/Projects/WebClient/Web.Tra/Components/Module/TraGrid.razor b/Projects/WebClient/Web.Tra/Components/Module/TraGrid.razor index a198854..07e7cb7 100644 --- a/Projects/WebClient/Web.Tra/Components/Module/TraGrid.razor +++ b/Projects/WebClient/Web.Tra/Components/Module/TraGrid.razor @@ -1,6 +1,4 @@ -@typeparam TDataModel where TDataModel : IDataModel - -@inject ContextMenuService ContextMenuService +@typeparam TDataModel OnDoubleClickRow{ get; set; } - [Parameter] - public EventCallback OnClickContextMenu { get; set; } - [Parameter] public bool VisibleRowNo { get; set; } diff --git a/Projects/WebClient/Web.Tra/Components/Pages/TRA.razor b/Projects/WebClient/Web.Tra/Components/Pages/TRA.razor index d33b528..4f0d2be 100644 --- a/Projects/WebClient/Web.Tra/Components/Pages/TRA.razor +++ b/Projects/WebClient/Web.Tra/Components/Pages/TRA.razor @@ -7,6 +7,8 @@ @using Web.Tra.Services @inject CPXV2LogService CPXV2LogService @inject PopupService PopupService +@inject NavigationManager Navigation +@inject IJSRuntime JS @@ -103,21 +105,21 @@ @if (tab.Key.EnumTab == EnumTabs.OverviewC1) { - } @if (tab.Key.EnumTab == EnumTabs.OverviewC1Detail) { - } @if (tab.Key.EnumTab == EnumTabs.TestHistoryC1) { - } @@ -131,12 +133,12 @@ var history = tab.Key.Parent as TestHistory; if(history.TestResult.ToLower().Contains("ok") == true) { - + } else { - } + } @@ -149,22 +151,27 @@ @foreach (var prop in history.GetType().GetProperties()) { - - @prop.Name - @prop.GetValue(history) + + @prop.Name + @prop.GetValue(history) } + + } - + @if(tab.Value?.Count > 0) + { + + } } @@ -318,35 +325,12 @@ int tabId = Tabs.Max(x => x.Key.Id) + 1; Tabs.AddOrUpdate( new OrderdTab { Id = tabId, TabName = $"{EnumTabs.TestResultC1}({tabId})", EnumTab = EnumTabs.TestResultC1, Parent = row }, - key => s.ParseTestResult.Cast().ToList(), (key, oldValue) => s.ParseTestResult.Cast().ToList()); + key => s?.ParseTestResult?.Cast()?.ToList(), (key, oldValue) => s?.ParseTestResult?.Cast()?.ToList()); tabs.Reload(); SelectedTabIndex = Tabs.Count - 1; } - private void OnClickDetailOverviewContextMenu() - { - // DetailOverviews = OverviewService.SearchDetailOverview(SelectedDataService.SelectedOverview); - - // if (ListTabs.ContainsKey(EnumTabs.OverviewC1Detail.ToString()) == false) - // ListTabs.Add($"{EnumTabs.OverviewC1Detail.ToString()}", EnumTabs.OverviewC1Detail); - // tabs.Reload(); - - // SelectedTabIndex = ListTabs.Keys.ToList().IndexOf(EnumTabs.OverviewC1Detail.ToString()); - } - - private void OnClickHistoryContextMenu() - { - // TestHistories = OverviewService.SearchTestHistory(SelectedDataService.SelectedOverview); - - // int index = ListTabs.Count(x => x.Key.Contains(EnumTabs.TestHistoryC1.ToString())) + 1; - - // ListTabs.Add($"{EnumTabs.TestHistoryC1}({index})", EnumTabs.TestHistoryC1); - // tabs.Reload(); - - // SelectedTabIndex = ListTabs.Keys.ToList().IndexOf($"{EnumTabs.TestHistoryC1}({index})"); - } - void OnClickClose(int tabId) { CloseTab(tabId); @@ -372,26 +356,20 @@ { SelectedTabIndex = Tabs.Count - 1; } - - tabs.Reload(); } async Task OnChangeMergePartNumberOption() { PopupService.OpenIndicator(""); - - // foreach(var tab in Tabs) - // { - // if (tab.Value == EnumTabs.OverviewC1) - // continue; - - // CloseTab(tab.Key.ToString()); - // } - await GetOverviews(); await Task.Delay(300); PopupService.CloseIndicator(); } + + async Task OnClickDisplayTestList(TestHistory history) + { + await JS.InvokeVoidAsync("open", $"/testlist/{history.ProductNo}/{history.TestCode}/{SelectionStepVersion}", "_blank"); + } } \ No newline at end of file diff --git a/Projects/WebClient/Web.Tra/Components/Pages/TestListGrid.razor b/Projects/WebClient/Web.Tra/Components/Pages/TestListGrid.razor new file mode 100644 index 0000000..d011961 --- /dev/null +++ b/Projects/WebClient/Web.Tra/Components/Pages/TestListGrid.razor @@ -0,0 +1,29 @@ +@using SystemX.Core.DB +@using Web.Tra.Services + +@page "/testlist/{ProductNo}/{TestCode}/{StepVersion}" +@inject CPXV2LogService CPXV2LogService + + + + + + +@code { + [Parameter] + public string ProductNo { get; set; } + + [Parameter] + public string TestCode { get; set; } + + [Parameter] + public string StepVersion { get; set; } + + private TestList GetTestList = new TestList(); + + protected override async Task OnParametersSetAsync() + { + GetTestList = await CPXV2LogService?.GetTestList(ProductNo, TestCode, Convert.ToInt32(StepVersion)); + } +} diff --git a/Projects/WebClient/Web.Tra/Extended/ObjectExtended.cs b/Projects/WebClient/Web.Tra/Extended/ObjectExtended.cs index 566c9e3..7d242f5 100644 --- a/Projects/WebClient/Web.Tra/Extended/ObjectExtended.cs +++ b/Projects/WebClient/Web.Tra/Extended/ObjectExtended.cs @@ -79,7 +79,11 @@ public static class ObjectExtend StepVersion = Convert.ToInt32(data.Summary.StepVersion), Duration = data.Summary.Duration, TestResult = data.Summary.Result, - TestListReqID = data.Summary.TestListCntID + TestListReqID = data.Summary.TestListCntID, + + TestListFileName = data.Summary.TestListFileName, + TestListFileNo = data.Summary.TestListFileNo.ToString(), + TestListVariantNo = data.Summary.TestListVariantNo.ToString() }; } diff --git a/Projects/WebClient/Web.Tra/Model/TestHistory.cs b/Projects/WebClient/Web.Tra/Model/TestHistory.cs index a7344c1..7b09e53 100644 --- a/Projects/WebClient/Web.Tra/Model/TestHistory.cs +++ b/Projects/WebClient/Web.Tra/Model/TestHistory.cs @@ -18,5 +18,9 @@ public string Duration { get; set; } public string TestResult { get; set; } public string TestListReqID { get; set; } + + public string TestListFileName { get; set; } + public string TestListFileNo { get; set; } + public string TestListVariantNo { get; set; } } } diff --git a/Projects/WebClient/Web.Tra/Program.cs b/Projects/WebClient/Web.Tra/Program.cs index 818df3e..a99bb91 100644 --- a/Projects/WebClient/Web.Tra/Program.cs +++ b/Projects/WebClient/Web.Tra/Program.cs @@ -1,4 +1,5 @@ using Microsoft.EntityFrameworkCore.Storage; +using Microsoft.JSInterop; using Radzen; using SystemX.Core.Config.Model; using SystemX.Core.DB; diff --git a/Projects/WebClient/Web.Tra/Services/CPXV2LogService.cs b/Projects/WebClient/Web.Tra/Services/CPXV2LogService.cs index 636622e..46bc6ae 100644 --- a/Projects/WebClient/Web.Tra/Services/CPXV2LogService.cs +++ b/Projects/WebClient/Web.Tra/Services/CPXV2LogService.cs @@ -210,15 +210,12 @@ namespace Web.Tra.Services return testHistory.ToList(); } - public async Task GetTestResult(IDataModel row, int stepVersion) + public async Task GetTestList(string productNo, string testCode, int stepVersion) { - TestResult result = new TestResult(); - - var selectRow = row as TestHistory; - if(selectRow is not null) - { - TestList testList = new TestList(); + TestList testList = new TestList(); + if (TryParseTestCode(testCode, out var outTestCode) == true) + { //cpxv2 using (var scope = _scopeFactory.CreateScope()) { @@ -227,9 +224,7 @@ namespace Web.Tra.Services { if (context is not null) { - int testCode = (int)context.STAT_TestCodes.Where(x => x.TestCode == selectRow.TestCode)?.First()?.No; - - var prodRelease = context.PROD_Releases.Where(x => x.ProdNo_C == selectRow.ProductNo && x.TestCodeNo == testCode)?.FirstOrDefault(); + var prodRelease = context.PROD_Releases.Where(x => x.ProdNo_C == productNo && x.TestCodeNo == outTestCode)?.FirstOrDefault(); var prodVariant = context.PROD_Variants.Where(x => x.No == prodRelease.VariantNo)?.FirstOrDefault(); var prodGroup = context.PROD_Groups.Where(x => x.No == prodVariant.GroupNo)?.FirstOrDefault(); var statTestCode = context.STAT_TestCodes.Where(x => x.No == prodRelease.TestCodeNo)?.FirstOrDefault(); @@ -241,7 +236,7 @@ namespace Web.Tra.Services { stepVersion = maxStepVersion.LatestStepVersion; } - else if(stepVersion < 0) + else if (stepVersion < 0) { stepVersion = 0; } @@ -249,9 +244,9 @@ namespace Web.Tra.Services var findTestList = context.VRFY_TestListFileReleases .Where(x => x.TestListFileNo == prodVariant.TestListFileNo && x.StepVersion <= stepVersion) .OrderBy(x => x.StepID) - .ThenByDescending(x=>x.StepVersion) + .ThenByDescending(x => x.StepVersion) .AsEnumerable() - .DistinctBy(x=>x.StepID) + .DistinctBy(x => x.StepID) .ToList(); testList.ProdRelease = prodRelease; @@ -263,22 +258,44 @@ namespace Web.Tra.Services } } } + } - //log - if (Int32.TryParse(selectRow.TestDateTime?.Year.ToString(), out var year) == true) - { - using (var scope = _scopeFactory.CreateScope()) + return testList; + } + + public async Task GetTestResult(IDataModel row, int stepVersion) + { + TestResult result = new TestResult(); + + var selectRow = row as TestHistory; + if(selectRow is not null) + { + TestList testList = new TestList(); + + //if (TryParseTestCode(selectRow.TestCode, out var testCode) == true) + { + //testlist info + var testListInfo = await GetTestList(selectRow.ProductNo, selectRow.TestCode, stepVersion); + + //log + if(testListInfo?.TestListFile is not null) { - var provider = scope.ServiceProvider.GetRequiredService(); - using (var context = GetDBContext(provider, year)) + if (Int32.TryParse(selectRow.TestDateTime?.Year.ToString(), out var year) == true) { - if (context is not null) + using (var scope = _scopeFactory.CreateScope()) { - var testResult = context.HIST_TestResults.Where(x => x.No == selectRow.No)?.First(); - result = testResult.ToTestResult(testList); + var provider = scope.ServiceProvider.GetRequiredService(); + using (var context = GetDBContext(provider, year)) + { + if (context is not null) + { + var testResult = context.HIST_TestResults.Where(x => x.No == selectRow.No)?.First(); + result = testResult.ToTestResult(testListInfo); + } + } } } - } + } } } @@ -286,6 +303,32 @@ namespace Web.Tra.Services return result; } + public bool TryParseTestCode(string testCode, out int outValue) + { + bool result = false; + outValue = -1; + + //search testlist + using (var scope = _scopeFactory.CreateScope()) + { + var provider = scope.ServiceProvider.GetRequiredService(); + using (var context = GetDBContext(provider, 1)) + { + if (context is not null) + { + var selectTestCode = context.STAT_TestCodes.Where(x => x.TestCode == testCode)?.FirstOrDefault(); + if(selectTestCode is not null) + { + outValue = selectTestCode.No; + result = true; + } + } + } + } + + return result; + } + //Get DBContext private T? GetDBContext(DbContextProvider provider, int dbID) where T : DbContext { diff --git a/Projects/WebClient/Web.Tra/wwwroot/app.css b/Projects/WebClient/Web.Tra/wwwroot/app.css index e918493..aea4ba6 100644 --- a/Projects/WebClient/Web.Tra/wwwroot/app.css +++ b/Projects/WebClient/Web.Tra/wwwroot/app.css @@ -102,6 +102,6 @@ h1:focus { } /*common*/ -span{ - font-size: 1.5rem; +span { + font-size: 1.5rem; } \ No newline at end of file