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", "version": "2.0.0",
"options": {
"env": {
"serverUserSecretsId": "6501aa0f-8499-4be5-96a9-e99b11323eeb"
}
},
"tasks": [ "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", "label": "buildServer",
"command": "dotnet", "command": "dotnet",
@ -167,32 +211,6 @@
"endsPattern": "^.*Application started.*" "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

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

View File

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

View File

@ -1,27 +1,13 @@
namespace OI.Metrology.Shared.DataModels; namespace OI.Metrology.Shared.DataModels;
public record InfinityQSEvent(int F_EVNT, public record InfinityQSEvent(int EV_EVNT,
int F_CRTM, int EV_SGTM,
int F_EDTM, string EV_UTC7,
int F_TYPE, string PR_NAME,
string F_NAME, string PD_NAME,
int F_EMPL, int TD_TEST,
int F_EVTM, string TD_NAME,
int F_PRCS, string EV_NAME)
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 static InfinityQSEventV2[] Convert(InfinityQSEvent[] collection) public static InfinityQSEventV2[] Convert(InfinityQSEvent[] collection)
@ -34,53 +20,25 @@ public record InfinityQSEvent(int F_EVNT,
public static InfinityQSEventV2 Map(InfinityQSEvent item) public static InfinityQSEventV2 Map(InfinityQSEvent item)
{ {
InfinityQSEventV2 result = new(item.F_EVNT, InfinityQSEventV2 result = new(item.EV_EVNT,
item.F_CRTM, item.EV_SGTM,
item.F_EDTM, item.EV_UTC7,
item.F_TYPE, item.PR_NAME,
item.F_NAME, item.PD_NAME,
item.F_EMPL, item.TD_TEST,
item.F_EVTM, item.TD_NAME,
item.F_PRCS, item.EV_NAME);
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);
return result; return result;
} }
} }
public record InfinityQSEventV2(int Evnt, public record InfinityQSEventV2(int EventId,
int Crtm, int SubGroupDateTimeId,
int Edtm, string SubGroupDateTime,
int Type, string Process,
string Name, string Part,
int Empl, int VariableNumber,
int Evtm, string Variable,
int Prcs, string Name)
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)
{ } { }