Fix-Event II

This commit is contained in:
Mike Phares 2023-03-24 09:49:34 -07:00
parent 243c8dd888
commit 644cde644d
7 changed files with 91 additions and 109 deletions

70
.vscode/tasks.json vendored
View File

@ -1,6 +1,50 @@
{
"version": "2.0.0",
"options": {
"env": {
"serverUserSecretsId": "6501aa0f-8499-4be5-96a9-e99b11323eeb"
}
},
"tasks": [
{
"label": "userSecretsInit",
"command": "dotnet",
"type": "process",
"args": [
"user-secrets",
"-p",
"${workspaceFolder}/Server/OI.Metrology.Server.csproj",
"init"
],
"problemMatcher": "$msCompile"
},
{
"label": "userSecretsSet",
"command": "dotnet",
"type": "process",
"args": [
"user-secrets",
"-p",
"${workspaceFolder}/Server/OI.Metrology.Server.csproj",
"set",
"asdf",
"123"
],
"problemMatcher": "$msCompile"
},
{
"label": "userSecretsMkLink",
"command": "cmd",
"type": "shell",
"args": [
"/c",
"mklink",
"/J",
".vscode\\UserSecrets",
"${userHome}\\AppData\\Roaming\\Microsoft\\UserSecrets\\$env:serverUserSecretsId"
],
"problemMatcher": "$msCompile"
},
{
"label": "buildServer",
"command": "dotnet",
@ -167,32 +211,6 @@
"endsPattern": "^.*Application started.*"
}
}
},
{
"label": "userSecretsInit",
"command": "dotnet",
"type": "process",
"args": [
"user-secrets",
"-p",
"${workspaceFolder}/Server/OI.Metrology.Server.csproj",
"init"
],
"problemMatcher": "$msCompile"
},
{
"label": "userSecretsSet",
"command": "dotnet",
"type": "process",
"args": [
"user-secrets",
"-p",
"${workspaceFolder}/Server/OI.Metrology.Server.csproj",
"set",
"asdf",
"123"
],
"problemMatcher": "$msCompile"
}
]
}

View File

@ -15,7 +15,7 @@ public class PagesController : Controller
public PagesController(AppSettings appSettings, IMetrologyRepository metrologyRepository)
{
_AppSettings=appSettings;
_AppSettings = appSettings;
_MetrologyRepository = metrologyRepository;
_IsTestDatabase = appSettings.ConnectionString.Contains("test", StringComparison.InvariantCultureIgnoreCase);
}

View File

@ -187,12 +187,15 @@ public class InfinityQSRepository : IInfinityQSRepository
if (infinityQSBase.SE_SGTM is null)
throw new ArgumentException(nameof(infinityQSBase.SE_SGTM));
_ = result
.AppendLine(" select ev.f_evnt, ")
.AppendLine(" ev.f_sgtm, ")
.AppendLine(" pr.f_name, ")
.AppendLine(" pd.f_name, ")
.AppendLine(" td.f_name, ")
.AppendLine(" ev.f_name ")
.AppendLine(" select ")
.AppendLine(" ev.f_evnt [ev_evnt], ")
.AppendLine(" ev.f_sgtm [ev_sgtm], ")
.AppendLine(" dateadd(HH, -7, (dateadd(SS, convert(bigint, ev.f_sgtm), '19700101'))) [ev_utc7], ")
.AppendLine(" pr.f_name [pr_name], ")
.AppendLine(" pd.f_name [pd_name], ")
.AppendLine(" td.f_test [td_test], ")
.AppendLine(" td.f_name [td_name], ")
.AppendLine(" ev.f_name [ev_name] ")
.AppendLine(" from [spcepiworld].[dbo].[evnt_inf] ev ")
.AppendLine(" join [spcepiworld].[dbo].[prcs_dat] pr ")
.AppendLine(" on ev.f_prcs = pr.f_prcs ")

View File

@ -26,7 +26,7 @@ public class InfinityQSV2Repository : IInfinityQSV2Repository
{
StringBuilder result = new();
if (string.IsNullOrEmpty(subGroupId))
throw new ArgumentException(nameof(subGroupId));
throw new ArgumentException(null, nameof(subGroupId));
_ = result
.AppendLine(" select ")
.AppendLine(" sd.f_sgrp sd_sgrp, ")
@ -50,7 +50,7 @@ public class InfinityQSV2Repository : IInfinityQSV2Repository
StringBuilder result = new();
const string dateTimeFormat = "yyyy-MM-dd HH:mm:ss";
if (!string.IsNullOrEmpty(dateTime) && (dateTime.Contains('-') || dateTime.Contains(' ') || dateTime.Contains(':')) && dateTime.Length != dateTimeFormat.Length)
throw new ArgumentException(nameof(dateTime));
throw new ArgumentException(null, nameof(dateTime));
_ = result
.AppendLine(" select ")
.AppendLine(" se.f_sgrp se_sgrp, ")
@ -190,12 +190,15 @@ public class InfinityQSV2Repository : IInfinityQSV2Repository
if (infinityQSBase.SubGroupDateTime is null)
throw new ArgumentException(nameof(infinityQSBase.SubGroupDateTime));
_ = result
.AppendLine(" select ev.f_evnt, ")
.AppendLine(" ev.f_sgtm, ")
.AppendLine(" pr.f_name, ")
.AppendLine(" pd.f_name, ")
.AppendLine(" td.f_name, ")
.AppendLine(" ev.f_name ")
.AppendLine(" select ")
.AppendLine(" ev.f_evnt [ev_evnt], ")
.AppendLine(" ev.f_sgtm [ev_sgtm], ")
.AppendLine(" dateadd(HH, -7, (dateadd(SS, convert(bigint, ev.f_sgtm), '19700101'))) [ev_utc7], ")
.AppendLine(" pr.f_name [pr_name], ")
.AppendLine(" pd.f_name [pd_name], ")
.AppendLine(" td.f_test [td_test], ")
.AppendLine(" td.f_name [td_name], ")
.AppendLine(" ev.f_name [ev_name] ")
.AppendLine(" from [spcepiworld].[dbo].[evnt_inf] ev ")
.AppendLine(" join [spcepiworld].[dbo].[prcs_dat] pr ")
.AppendLine(" on ev.f_prcs = pr.f_prcs ")

View File

@ -1,27 +1,13 @@
namespace OI.Metrology.Shared.DataModels;
public record InfinityQSEvent(int F_EVNT,
int F_CRTM,
int F_EDTM,
int F_TYPE,
string F_NAME,
int F_EMPL,
int F_EVTM,
int F_PRCS,
int F_PART,
int F_TEST,
int F_SGTM,
int F_ACC,
int F_ACEM,
int F_ACTM,
int F_CAC,
int F_CAEM,
int F_CATM,
int F_FLAG,
int F_USER,
int F_DSBL,
int F_RFC,
int F_TRTM)
public record InfinityQSEvent(int EV_EVNT,
int EV_SGTM,
string EV_UTC7,
string PR_NAME,
string PD_NAME,
int TD_TEST,
string TD_NAME,
string EV_NAME)
{
public static InfinityQSEventV2[] Convert(InfinityQSEvent[] collection)
@ -34,53 +20,25 @@ public record InfinityQSEvent(int F_EVNT,
public static InfinityQSEventV2 Map(InfinityQSEvent item)
{
InfinityQSEventV2 result = new(item.F_EVNT,
item.F_CRTM,
item.F_EDTM,
item.F_TYPE,
item.F_NAME,
item.F_EMPL,
item.F_EVTM,
item.F_PRCS,
item.F_PART,
item.F_TEST,
item.F_SGTM,
item.F_ACC,
item.F_ACEM,
item.F_ACTM,
item.F_CAC,
item.F_CAEM,
item.F_CATM,
item.F_FLAG,
item.F_USER,
item.F_DSBL,
item.F_RFC,
item.F_TRTM);
InfinityQSEventV2 result = new(item.EV_EVNT,
item.EV_SGTM,
item.EV_UTC7,
item.PR_NAME,
item.PD_NAME,
item.TD_TEST,
item.TD_NAME,
item.EV_NAME);
return result;
}
}
public record InfinityQSEventV2(int Evnt,
int Crtm,
int Edtm,
int Type,
string Name,
int Empl,
int Evtm,
int Prcs,
int Part,
int Test,
int Sgtm,
int Acc,
int Acem,
int Actm,
int Cac,
int Caem,
int Catm,
int Flag,
int User,
int Dsbl,
int Rfc,
int Trtm)
public record InfinityQSEventV2(int EventId,
int SubGroupDateTimeId,
string SubGroupDateTime,
string Process,
string Part,
int VariableNumber,
string Variable,
string Name)
{ }

View File

@ -24,7 +24,7 @@ public class Pinned : HeaderCommon
ToolTypeName = headerCommon.ToolTypeName;
MesEntity = headerCommon.MesEntity;
Employee = headerCommon.Employee;
Layer = headerCommon.Layer;
PSN = headerCommon.PSN;

View File

@ -54,7 +54,7 @@ public class UnitAwaitingDispoController
public async Task IndexApi()
{
HttpClient httpClient = _WebApplicationFactory.CreateClient();
_Logger.Information("Starting Web Application");
_Logger.Information("Starting Web Application");
string? json = await httpClient.GetStringAsync($"api/{_ControllerName}");
File.WriteAllText(Path.Combine(AppContext.BaseDirectory, $"{_ControllerName}-{nameof(IMetrologyRepository.GetAwaitingDisposition)}Api.json"), json);
_Logger.Information($"{_TestContext?.TestName} completed");