radio key check
This commit is contained in:
parent
68686bda9d
commit
edf2ed1d5b
@ -1 +1 @@
|
||||
Subproject commit 7453c48ad3a55840ada65dd202aec78b87766dcc
|
||||
Subproject commit e7aa3e2723a435f0a714df661dc5d86dfd45a71c
|
||||
@ -1,10 +1,13 @@
|
||||
namespace LaaProduction.Data.Cordonel.Interfaces
|
||||
{
|
||||
using System;
|
||||
using LaaPackages.Features.Cordonel.Models;
|
||||
|
||||
using System.Collections.Generic;
|
||||
|
||||
public interface IPORepository<T> : IFilterRepository<T>
|
||||
{
|
||||
IEnumerable<string> GetPcbs(string ponr);
|
||||
|
||||
IEnumerable<RadioKeyEntry> HasRightRadioKey(ulong address);
|
||||
}
|
||||
}
|
||||
|
||||
@ -121,5 +121,41 @@
|
||||
PositionNr = x.GetValue<string>(5),
|
||||
FertigungsauftragNr = x.GetValue<string>(6),
|
||||
});
|
||||
|
||||
public IEnumerable<RadioKeyEntry> HasRightRadioKey(ulong address)
|
||||
=> this.sqlConnection
|
||||
.CreateCommand($@"
|
||||
SELECT DISTINCT
|
||||
apg.AuftragNr
|
||||
, apg.PositionNr
|
||||
, gm.Seriennummer
|
||||
, gm.FunkschluesselIndex
|
||||
, vmm.Wert
|
||||
, apg.IstDatum
|
||||
FROM Genesis_Meter AS gm
|
||||
JOIN AuftragPositionSerienNr AS aps
|
||||
ON gm.Seriennummer = aps.SerienNr
|
||||
JOIN AuftragPosition_Gesamt AS apg
|
||||
ON aps.AuftragNr = apg.AuftragNr
|
||||
AND aps.PositionNr = apg.PositionNr
|
||||
JOIN Identnr AS idn
|
||||
ON apg.IdentNr = idn.IdentNr
|
||||
JOIN VAKO_Merkmale AS vmm
|
||||
ON vmm.Basis = 'GNS'
|
||||
AND vmm.Stelle = 46
|
||||
AND vmm.Charcode = SUBSTRING(idn.VakoCode, vmm.Stelle, 1)
|
||||
WHERE gm.Adresse = @{nameof(address)}
|
||||
AND ((gm.FunkschluesselIndex IS NULL AND vmm.Charcode = '2')
|
||||
OR (gm.FunkschluesselIndex IS NOT NULL AND vmm.Charcode = '1'))")
|
||||
.SetParameter(nameof(address), $"10{address}")
|
||||
.ExecuteReader(x => new RadioKeyEntry
|
||||
{
|
||||
Auftrag = x.GetValue<int>(0),
|
||||
Position = x.GetValue<int>(1),
|
||||
SerienNr = x.GetValue<int>(2),
|
||||
KeyIndex = x.GetValue<string>(3),
|
||||
KeyType = x.GetValue<string>(4),
|
||||
IsDate = x.GetValue<DateTime>(5)
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@ -57,6 +57,7 @@
|
||||
this.TryGetPasswordFileContent(pcbId, out var passwordFile); // ~ slow
|
||||
|
||||
// Data comparison
|
||||
this.TryCompareRadioKeyUsed(productionData.Address);
|
||||
this.TryCompareRequirementsIdAndVersion(eolProgress, requirements);
|
||||
this.TryCompareAllPcbIds(pcbId, productionData, requirements, apps, eolProgress, metrologyValues);
|
||||
this.TryCompareProductionOrderNumber(productionData, requirements, eolProgress);
|
||||
@ -97,6 +98,23 @@
|
||||
return sentinelResult;
|
||||
}
|
||||
|
||||
private void TryCompareRadioKeyUsed(ulong address)
|
||||
{
|
||||
var entries = this.cordonelDbContext.ProductionOrders.HasRightRadioKey(address);
|
||||
|
||||
if (entries.Any())
|
||||
{
|
||||
var messages = new StringBuilder();
|
||||
|
||||
foreach (var entry in entries)
|
||||
{
|
||||
messages.AppendLine($"RadioKey mismatch: {entry.Auftrag}|{entry.Position}|{entry.SerienNr} - {entry.KeyType}|{entry.KeyIndex} - {entry.IsDate}");
|
||||
}
|
||||
|
||||
this.ThrowSentinelException(messages.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
internal void TryCompareAllPcbIds(int pcbId, CordonelProductionData productionData, CordonelRequirements requirements, CordonelAppsDictionary apps, EOLProgressModel eolProgress, CordonelMetrologyValues metrologyValues)
|
||||
{
|
||||
if (eolProgress.RequirementPcbIdChecked == EOLStatus.NA)
|
||||
|
||||
@ -1 +1 @@
|
||||
Subproject commit 7453c48ad3a55840ada65dd202aec78b87766dcc
|
||||
Subproject commit e7aa3e2723a435f0a714df661dc5d86dfd45a71c
|
||||
@ -1,19 +0,0 @@
|
||||
namespace LaaProductionWeb.Blazor.Components.CSD.Data
|
||||
{
|
||||
public class BasisCsdNwEr
|
||||
{
|
||||
public string Basis { get; set; }
|
||||
|
||||
public int SCDPosition { get; set; }
|
||||
|
||||
public int CSDLength { get; set; }
|
||||
|
||||
public string NWPosition { get; set; }
|
||||
|
||||
public string NWLength { get; set; }
|
||||
|
||||
public string ERPosition { get; set; }
|
||||
|
||||
public string ERLength { get; set; }
|
||||
}
|
||||
}
|
||||
@ -1,65 +0,0 @@
|
||||
namespace LaaProductionWeb.Blazor.Components.CSD.Data
|
||||
{
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
public class CSD
|
||||
{
|
||||
public string CharCode { get; set; }
|
||||
|
||||
public string Wert { get; set; }
|
||||
|
||||
public IEnumerable<CSDBasis> BasisCodes { get; private set; } = [];
|
||||
|
||||
public void AddBasisCodes(IEnumerable<string> basisCodes)
|
||||
{
|
||||
var _basisCodes = basisCodes.ToDictionary(x => x, x => new CSDBasis { Basis = x });
|
||||
|
||||
foreach (var basis in this.BasisCodes.Where(x => x.Selected).Select(x => x.Basis))
|
||||
{
|
||||
if (_basisCodes.ContainsKey(basis))
|
||||
{
|
||||
_basisCodes[basis].Selected = true;
|
||||
}
|
||||
}
|
||||
|
||||
this.BasisCodes = _basisCodes.Values;
|
||||
}
|
||||
}
|
||||
|
||||
public class CSDBasis
|
||||
{
|
||||
public string Basis { get; set; }
|
||||
|
||||
public bool Selected { get; set; }
|
||||
|
||||
public IEnumerable<CSDBezeichnung> Bezeichnungen { get; private set; } = [];
|
||||
|
||||
public void Clear() => this.Bezeichnungen = [];
|
||||
|
||||
public void AddBezeichnungen(IEnumerable<CSDBezeichnung> bezeichnungen)
|
||||
=> this.Bezeichnungen = bezeichnungen;
|
||||
}
|
||||
|
||||
public class CSDBezeichnung
|
||||
{
|
||||
public string Bezeichnung { get; set; }
|
||||
|
||||
public int Stelle { get; set; }
|
||||
|
||||
public int Laenge { get; set; }
|
||||
|
||||
public bool Selected { get; set; }
|
||||
|
||||
public IEnumerable<CSDCharCode> CharCodes { get; private set; } = [];
|
||||
}
|
||||
|
||||
public class CSDCharCode
|
||||
{
|
||||
public string CharCode { get; set; }
|
||||
|
||||
public string Value { get; set; }
|
||||
|
||||
public bool Selected { get; set; }
|
||||
}
|
||||
}
|
||||
@ -1,215 +0,0 @@
|
||||
namespace LaaProductionWeb.Blazor.Components.CSD.Data
|
||||
{
|
||||
using LaaPackages.SqlClient;
|
||||
|
||||
using Microsoft.Extensions.Configuration;
|
||||
|
||||
using SQLite;
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
public class CSDDBContext
|
||||
{
|
||||
private readonly SqlConnection connection;
|
||||
private readonly SQLiteConnection csdSQLite;
|
||||
|
||||
public CSDDBContext(IConfiguration configuration)
|
||||
{
|
||||
var connectionString = configuration.GetConnectionString("Auftrag");
|
||||
this.connection = SqlConnection.CreateSqlConnection(connectionString);
|
||||
this.csdSQLite = new SQLiteConnection(new SQLiteConnectionString("csd_parameters.db"));
|
||||
|
||||
this.SeedParameterValues();
|
||||
}
|
||||
|
||||
public IDictionary<string, CsdClient[]> GetAllCsds()
|
||||
=> this.connection
|
||||
.CreateCommand(@"
|
||||
SELECT DISTINCT
|
||||
csd.Basis
|
||||
, csd.Stelle
|
||||
, csd.Laenge
|
||||
, csd.Charcode
|
||||
, csd.Wert
|
||||
FROM VAKO_Merkmale AS csd
|
||||
WHERE csd.Wert LIKE 'CSD%'")
|
||||
.ExecuteReader(x => new CsdClient
|
||||
{
|
||||
Basis = x.GetValue<string>(0),
|
||||
Position = x.GetValue<int>(1),
|
||||
Length = x.GetValue<int>(2),
|
||||
Charcode = x.GetValue<string>(3),
|
||||
Client = x.GetValue<string>(4),
|
||||
})
|
||||
.GroupBy(x => x.Charcode)
|
||||
.ToDictionary(x => x.Key, x => x.ToArray());
|
||||
|
||||
public IEnumerable<BasisCsdNwEr> GetBasisCodes()
|
||||
=> this.connection
|
||||
.CreateCommand(@"
|
||||
SELECT DISTINCT
|
||||
vm.Basis
|
||||
, bs.Stelle AS CSDPosition
|
||||
, bs.Laenge AS CSDLength
|
||||
, nw.Stelle AS NWPosition
|
||||
, nw.Laenge AS NWLength
|
||||
, er.Stelle AS ERPosition
|
||||
, er.Laenge AS ERLength
|
||||
FROM VAKO_Merkmale AS vm
|
||||
LEFT JOIN (SELECT DISTINCT
|
||||
_bs.Basis
|
||||
, MAX(_bs.Stelle) OVER (PARTITION BY _bs.Basis) AS Stelle
|
||||
, _bs.Laenge
|
||||
FROM VAKO_Merkmale AS _bs
|
||||
WHERE _bs.Wert LIKE 'CSD%')
|
||||
AS bs
|
||||
ON vm.Basis = bs.Basis
|
||||
LEFT JOIN (SELECT DISTINCT
|
||||
_nw.Basis
|
||||
, MIN(_nw.Stelle) OVER (PARTITION BY _nw.Basis) AS Stelle
|
||||
, 1 AS Laenge
|
||||
FROM VAKO_Merkmale AS _nw
|
||||
WHERE _nw.Name LIKE '%nw%'
|
||||
OR _nw.Bezeichnung LIKE '%nw%'
|
||||
OR _nw.Schluessel LIKE '%nw%')
|
||||
AS nw
|
||||
ON vm.Basis = nw.Basis
|
||||
LEFT JOIN (SELECT DISTINCT
|
||||
_er.Basis
|
||||
, _er.Stelle
|
||||
, _er.Laenge
|
||||
FROM VAKO_Merkmale AS _er
|
||||
WHERE _er.Wert LIKE '%433%')
|
||||
AS er
|
||||
ON vm.Basis = er.Basis
|
||||
WHERE bs.Basis IS NOT NULL
|
||||
OR nw.Basis IS NOT NULL
|
||||
OR er.Basis IS NOT NULL
|
||||
ORDER BY vm.Basis")
|
||||
.ExecuteReader(x => new BasisCsdNwEr
|
||||
{
|
||||
Basis = x.GetValue<string>(0),
|
||||
SCDPosition = x.GetValue<int>(1),
|
||||
CSDLength = x.GetValue<int>(2),
|
||||
NWPosition = x.GetValue<string>(3),
|
||||
NWLength = x.GetValue<string>(4),
|
||||
ERPosition = x.GetValue<string>(5),
|
||||
ERLength = x.GetValue<string>(6),
|
||||
});
|
||||
|
||||
public IDictionary<string, ParameterValue[]> GetParameterValues()
|
||||
=> this.csdSQLite
|
||||
.Table<ParameterValue>()
|
||||
.GroupBy(x => x.Group)
|
||||
.ToDictionary(x => x.Key, x => x.ToArray());
|
||||
|
||||
private void SeedParameterValues()
|
||||
{
|
||||
var createResult = this.csdSQLite.CreateTable<ParameterValue>();
|
||||
|
||||
if (createResult == CreateTableResult.Created)
|
||||
{
|
||||
this.csdSQLite.Insert(new ParameterValue { Group = ParameterValueTypes.HoursAndDays, Name = "1 h", Value = 1 * 60 * 60 });
|
||||
this.csdSQLite.Insert(new ParameterValue { Group = ParameterValueTypes.HoursAndDays, Name = "2 h", Value = 2 * 60 * 60 });
|
||||
this.csdSQLite.Insert(new ParameterValue { Group = ParameterValueTypes.HoursAndDays, Name = "6 h", Value = 6 * 60 * 60 });
|
||||
this.csdSQLite.Insert(new ParameterValue { Group = ParameterValueTypes.HoursAndDays, Name = "12 h", Value = 12 * 60 * 60 });
|
||||
this.csdSQLite.Insert(new ParameterValue { Group = ParameterValueTypes.HoursAndDays, Name = "1 d", Value = 1 * 24 * 60 * 60 });
|
||||
this.csdSQLite.Insert(new ParameterValue { Group = ParameterValueTypes.HoursAndDays, Name = "2 d", Value = 2 * 24 * 60 * 60 });
|
||||
this.csdSQLite.Insert(new ParameterValue { Group = ParameterValueTypes.HoursAndDays, Name = "3 d", Value = 3 * 24 * 60 * 60 });
|
||||
this.csdSQLite.Insert(new ParameterValue { Group = ParameterValueTypes.HoursAndDays, Name = "7 d", Value = 7 * 24 * 60 * 60 });
|
||||
this.csdSQLite.Insert(new ParameterValue { Group = ParameterValueTypes.HoursAndDays, Name = "14 d", Value = 14 * 24 * 60 * 60 });
|
||||
|
||||
this.csdSQLite.Insert(new ParameterValue { Group = ParameterValueTypes.LitersPerHour, Name = "250 l/h", Value = 250 });
|
||||
this.csdSQLite.Insert(new ParameterValue { Group = ParameterValueTypes.LitersPerHour, Name = "375 l/h", Value = 375 });
|
||||
this.csdSQLite.Insert(new ParameterValue { Group = ParameterValueTypes.LitersPerHour, Name = "500 l/h", Value = 500 });
|
||||
this.csdSQLite.Insert(new ParameterValue { Group = ParameterValueTypes.LitersPerHour, Name = "625 l/h", Value = 625 });
|
||||
this.csdSQLite.Insert(new ParameterValue { Group = ParameterValueTypes.LitersPerHour, Name = "750 l/h", Value = 750 });
|
||||
this.csdSQLite.Insert(new ParameterValue { Group = ParameterValueTypes.LitersPerHour, Name = "875 l/h", Value = 875 });
|
||||
this.csdSQLite.Insert(new ParameterValue { Group = ParameterValueTypes.LitersPerHour, Name = "1000 l/h", Value = 1000 });
|
||||
this.csdSQLite.Insert(new ParameterValue { Group = ParameterValueTypes.LitersPerHour, Name = "1250 l/h", Value = 1250 });
|
||||
this.csdSQLite.Insert(new ParameterValue { Group = ParameterValueTypes.LitersPerHour, Name = "2500 l/h", Value = 2500 });
|
||||
this.csdSQLite.Insert(new ParameterValue { Group = ParameterValueTypes.LitersPerHour, Name = "3750 l/h", Value = 3750 });
|
||||
this.csdSQLite.Insert(new ParameterValue { Group = ParameterValueTypes.LitersPerHour, Name = "5000 l/h", Value = 5000 });
|
||||
this.csdSQLite.Insert(new ParameterValue { Group = ParameterValueTypes.LitersPerHour, Name = "6250 l/h", Value = 6250 });
|
||||
this.csdSQLite.Insert(new ParameterValue { Group = ParameterValueTypes.LitersPerHour, Name = "7500 l/h", Value = 7500 });
|
||||
this.csdSQLite.Insert(new ParameterValue { Group = ParameterValueTypes.LitersPerHour, Name = "8750 l/h", Value = 8750 });
|
||||
this.csdSQLite.Insert(new ParameterValue { Group = ParameterValueTypes.LitersPerHour, Name = "10000 l/h", Value = 10000 });
|
||||
|
||||
this.csdSQLite.Insert(new ParameterValue { Group = ParameterValueTypes.PeriodsInMinutes, Name = "1 min", Value = 5 * 60 });
|
||||
this.csdSQLite.Insert(new ParameterValue { Group = ParameterValueTypes.PeriodsInMinutes, Name = "2 min", Value = 5 * 60 });
|
||||
this.csdSQLite.Insert(new ParameterValue { Group = ParameterValueTypes.PeriodsInMinutes, Name = "3 min", Value = 5 * 60 });
|
||||
this.csdSQLite.Insert(new ParameterValue { Group = ParameterValueTypes.PeriodsInMinutes, Name = "4 min", Value = 5 * 60 });
|
||||
this.csdSQLite.Insert(new ParameterValue { Group = ParameterValueTypes.PeriodsInMinutes, Name = "5 min", Value = 5 * 60 });
|
||||
this.csdSQLite.Insert(new ParameterValue { Group = ParameterValueTypes.PeriodsInMinutes, Name = "6 min", Value = 5 * 60 });
|
||||
this.csdSQLite.Insert(new ParameterValue { Group = ParameterValueTypes.PeriodsInMinutes, Name = "10 min", Value = 10 * 60 });
|
||||
this.csdSQLite.Insert(new ParameterValue { Group = ParameterValueTypes.PeriodsInMinutes, Name = "15 min", Value = 15 * 60 });
|
||||
this.csdSQLite.Insert(new ParameterValue { Group = ParameterValueTypes.PeriodsInMinutes, Name = "30 min", Value = 30 * 60 });
|
||||
this.csdSQLite.Insert(new ParameterValue { Group = ParameterValueTypes.PeriodsInMinutes, Name = "45 min", Value = 45 * 60 });
|
||||
this.csdSQLite.Insert(new ParameterValue { Group = ParameterValueTypes.PeriodsInMinutes, Name = "60 min", Value = 60 * 60 });
|
||||
this.csdSQLite.Insert(new ParameterValue { Group = ParameterValueTypes.PeriodsInMinutes, Name = "120 min", Value = 120 * 60 });
|
||||
this.csdSQLite.Insert(new ParameterValue { Group = ParameterValueTypes.PeriodsInMinutes, Name = "180 min", Value = 180 * 60 });
|
||||
this.csdSQLite.Insert(new ParameterValue { Group = ParameterValueTypes.PeriodsInMinutes, Name = "240 min", Value = 240 * 60 });
|
||||
this.csdSQLite.Insert(new ParameterValue { Group = ParameterValueTypes.PeriodsInMinutes, Name = "360 min", Value = 360 * 60 });
|
||||
this.csdSQLite.Insert(new ParameterValue { Group = ParameterValueTypes.PeriodsInMinutes, Name = "720 min", Value = 720 * 60 });
|
||||
this.csdSQLite.Insert(new ParameterValue { Group = ParameterValueTypes.PeriodsInMinutes, Name = "1440 min", Value = 1440 * 60 });
|
||||
|
||||
this.csdSQLite.Insert(new ParameterValue { Group = ParameterValueTypes.CubicMetersPerHour, Name = "7.5 m³/h", Value = (int)(7.5 * 1000) });
|
||||
this.csdSQLite.Insert(new ParameterValue { Group = ParameterValueTypes.CubicMetersPerHour, Name = "8.75 m³/h", Value = (int)(8.75 * 1000) });
|
||||
this.csdSQLite.Insert(new ParameterValue { Group = ParameterValueTypes.CubicMetersPerHour, Name = "10 m³/h", Value = 10 * 1000 });
|
||||
this.csdSQLite.Insert(new ParameterValue { Group = ParameterValueTypes.CubicMetersPerHour, Name = "12.5 m³/h", Value = (int)(12.5 * 1000) });
|
||||
this.csdSQLite.Insert(new ParameterValue { Group = ParameterValueTypes.CubicMetersPerHour, Name = "25 m³/h", Value = 25 * 1000 });
|
||||
this.csdSQLite.Insert(new ParameterValue { Group = ParameterValueTypes.CubicMetersPerHour, Name = "37.5 m³/h", Value = (int)(37.5 * 1000) });
|
||||
this.csdSQLite.Insert(new ParameterValue { Group = ParameterValueTypes.CubicMetersPerHour, Name = "50 m³/h", Value = 50 * 1000 });
|
||||
this.csdSQLite.Insert(new ParameterValue { Group = ParameterValueTypes.CubicMetersPerHour, Name = "62.5 m³/h", Value = (int)(62.5 * 1000) });
|
||||
this.csdSQLite.Insert(new ParameterValue { Group = ParameterValueTypes.CubicMetersPerHour, Name = "75 m³/h", Value = 75 * 1000 });
|
||||
this.csdSQLite.Insert(new ParameterValue { Group = ParameterValueTypes.CubicMetersPerHour, Name = "87.5 m³/h", Value = (int)(87.5 * 1000) });
|
||||
this.csdSQLite.Insert(new ParameterValue { Group = ParameterValueTypes.CubicMetersPerHour, Name = "100 m³/h", Value = 100 * 1000 });
|
||||
this.csdSQLite.Insert(new ParameterValue { Group = ParameterValueTypes.CubicMetersPerHour, Name = "125 m³/h", Value = 125 * 1000 });
|
||||
this.csdSQLite.Insert(new ParameterValue { Group = ParameterValueTypes.CubicMetersPerHour, Name = "250 m³/h", Value = 250 * 1000 });
|
||||
this.csdSQLite.Insert(new ParameterValue { Group = ParameterValueTypes.CubicMetersPerHour, Name = "375 m³/h", Value = 375 * 1000 });
|
||||
this.csdSQLite.Insert(new ParameterValue { Group = ParameterValueTypes.CubicMetersPerHour, Name = "500 m³/h", Value = 500 * 1000 });
|
||||
this.csdSQLite.Insert(new ParameterValue { Group = ParameterValueTypes.CubicMetersPerHour, Name = "625 m³/h", Value = 625 * 1000 });
|
||||
this.csdSQLite.Insert(new ParameterValue { Group = ParameterValueTypes.CubicMetersPerHour, Name = "750 m³/h", Value = 750 * 1000 });
|
||||
this.csdSQLite.Insert(new ParameterValue { Group = ParameterValueTypes.CubicMetersPerHour, Name = "875 m³/h", Value = 875 * 1000 });
|
||||
this.csdSQLite.Insert(new ParameterValue { Group = ParameterValueTypes.CubicMetersPerHour, Name = "1000 m³/h", Value = 1000 * 1000 });
|
||||
this.csdSQLite.Insert(new ParameterValue { Group = ParameterValueTypes.CubicMetersPerHour, Name = "1250 m³/h", Value = 1250 * 1000 });
|
||||
|
||||
for (var d = 1; d <= 29; d++)
|
||||
{
|
||||
this.csdSQLite.Insert(new ParameterValue { Group = ParameterValueTypes.Days, Name = $"{d} d", Value = d * 24 * 60 * 60 });
|
||||
}
|
||||
|
||||
this.csdSQLite.Insert(new ParameterValue { Group = ParameterValueTypes.Days, Name = "90 d", Value = 90 * 24 * 60 * 60 });
|
||||
|
||||
|
||||
this.csdSQLite.Insert(new ParameterValue { Group = ParameterValueTypes.WakeUpModes, Name = "3", Value = 3 });
|
||||
this.csdSQLite.Insert(new ParameterValue { Group = ParameterValueTypes.WakeUpModes, Name = "6", Value = 6 });
|
||||
|
||||
string name;
|
||||
|
||||
for (var h = -9; h <= 14; h++)
|
||||
{
|
||||
if (h < 0)
|
||||
{
|
||||
name = $"UTC {h:00}:00";
|
||||
}
|
||||
else if (h > 0)
|
||||
{
|
||||
name = $"UTC +{h:00}:00";
|
||||
}
|
||||
else
|
||||
{
|
||||
name = $"UTC {h:00}:00";
|
||||
}
|
||||
|
||||
this.csdSQLite.Insert(new ParameterValue { Group = ParameterValueTypes.UTCOffsetsSeconds, Name = name, Value = h * 24 * 60 * 60 });
|
||||
}
|
||||
|
||||
|
||||
this.csdSQLite.Insert(new ParameterValue { Group = ParameterValueTypes.TransmissionIntervals, Name = "15", Value = 15 });
|
||||
this.csdSQLite.Insert(new ParameterValue { Group = ParameterValueTypes.Lats, Name = "3", Value = 3 });
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,15 @@
|
||||
namespace LaaProductionWeb.Blazor.Components.CSD.Data
|
||||
{
|
||||
using System;
|
||||
|
||||
public class CSDMerkmal
|
||||
{
|
||||
public int Id { get; set; }
|
||||
|
||||
public string CSD { get; set; }
|
||||
|
||||
public string Pattern { get; set; }
|
||||
|
||||
public DateTime TimeStamp { get; set; }
|
||||
}
|
||||
}
|
||||
@ -1,15 +0,0 @@
|
||||
namespace LaaProductionWeb.Blazor.Components.CSD.Data
|
||||
{
|
||||
public class CsdClient
|
||||
{
|
||||
public string Basis { get; set; }
|
||||
|
||||
public int Position { get; set; }
|
||||
|
||||
public int Length { get; set; }
|
||||
|
||||
public string Charcode { get; set; }
|
||||
|
||||
public string Client { get; set; }
|
||||
}
|
||||
}
|
||||
@ -1,17 +0,0 @@
|
||||
namespace LaaProductionWeb.Blazor.Components.CSD.Data
|
||||
{
|
||||
using SQLite;
|
||||
|
||||
public class ParameterValue
|
||||
{
|
||||
[PrimaryKey]
|
||||
[AutoIncrement]
|
||||
public int Id { get; set; }
|
||||
|
||||
public string Group { get; set; }
|
||||
|
||||
public string Name { get; set; }
|
||||
|
||||
public int Value { get; set; }
|
||||
}
|
||||
}
|
||||
@ -1,15 +0,0 @@
|
||||
namespace LaaProductionWeb.Blazor.Components.CSD.Data
|
||||
{
|
||||
public class ParameterValueTypes
|
||||
{
|
||||
public const string HoursAndDays = nameof(HoursAndDays);
|
||||
public const string LitersPerHour = nameof(LitersPerHour);
|
||||
public const string PeriodsInMinutes = nameof(PeriodsInMinutes);
|
||||
public const string CubicMetersPerHour = nameof(CubicMetersPerHour);
|
||||
public const string Days = nameof(Days);
|
||||
public const string WakeUpModes = nameof(WakeUpModes);
|
||||
public const string UTCOffsetsSeconds = nameof(UTCOffsetsSeconds);
|
||||
public const string TransmissionIntervals = nameof(TransmissionIntervals);
|
||||
public const string Lats = nameof(Lats);
|
||||
}
|
||||
}
|
||||
@ -1,136 +0,0 @@
|
||||
namespace LaaProductionWeb.Blazor.Components.CSD.Data
|
||||
{
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
public class ProgrammingParameters
|
||||
{
|
||||
[Display(Name = "Leakage Period")]
|
||||
public int LeakagePeriode { get; set; }
|
||||
|
||||
[Display(Name = "Leakage Threshold")]
|
||||
public int LeakageThreshold { get; set; }
|
||||
|
||||
[Display(Name = "Broken Pipe Period")]
|
||||
public int BrokenPipePeriode { get; set; }
|
||||
|
||||
[Display(Name = "Broken Pipe Threshold")]
|
||||
public int BrokenPipeThreshold { get; set; }
|
||||
|
||||
[Display(Name = "Alert Leakage")]
|
||||
public bool AlertLeakage { get; set; }
|
||||
|
||||
[Display(Name = "Alert Broken Pipe")]
|
||||
public bool AlertBrokenPipe { get; set; }
|
||||
|
||||
[Display(Name = "Alert Low Battery")]
|
||||
public bool AlertLowBattery { get; set; }
|
||||
|
||||
[Display(Name = "Alert Magnetic Tampering")]
|
||||
public bool AlertMagneticTampering { get; set; }
|
||||
|
||||
[Display(Name = "Alert Backflow")]
|
||||
public bool AlertBackflow { get; set; }
|
||||
|
||||
[Display(Name = "Historic Error Limit")]
|
||||
public int HistoricErrorLimit { get; set; }
|
||||
|
||||
[Display(Name = "DL Period")]
|
||||
public int DataLoggingPeriod { get; set; }
|
||||
|
||||
[Display(Name = "DL Forward Counter")]
|
||||
public bool DataLoggingForwardCounter { get; set; }
|
||||
|
||||
[Display(Name = "DL Time Of Minimum Flow")]
|
||||
public bool DataLoggingTimeOfMinimumFlow { get; set; }
|
||||
|
||||
[Display(Name = "DL Minimum Flow")]
|
||||
public bool DataLoggingMinimumFlow { get; set; }
|
||||
|
||||
[Display(Name = "DL Time Of Broken Pipe")]
|
||||
public bool DataLoggingTimeOfBrokenPipe { get; set; }
|
||||
|
||||
[Display(Name = "DL Broken Pipe Flow")]
|
||||
public bool DataLoggingBrokenPipeFlow { get; set; }
|
||||
|
||||
[Display(Name = "DL Current Flow")]
|
||||
public bool DataLoggingCurrentFlow { get; set; }
|
||||
|
||||
[Display(Name = "DL Time Of Peak Flow")]
|
||||
public bool DataLoggingTimeOfPeakFlow { get; set; }
|
||||
|
||||
[Display(Name = "DL Peak Flow")]
|
||||
public bool DataLoggingPeakFlow { get; set; }
|
||||
|
||||
[Display(Name = "DL Time Of Maximum Flow")]
|
||||
public bool DataLoggingTimeOfMaximumFlow { get; set; }
|
||||
|
||||
[Display(Name = "DL Maximum Flow")]
|
||||
public bool DataLoggingMaximumFlow { get; set; }
|
||||
|
||||
[Display(Name = "DL Backward Volume")]
|
||||
public bool DataLoggingBackwardVolume { get; set; }
|
||||
|
||||
[Display(Name = "DL Counter")]
|
||||
public bool DataLoggingCounter { get; set; }
|
||||
|
||||
[Display(Name = "DL Alert State")]
|
||||
public bool DataLoggingAlertState { get; set; }
|
||||
|
||||
[Display(Name = "Reading Day Of Month")]
|
||||
public int ReadingDayofMonth { get; set; }
|
||||
|
||||
[Display(Name = "FDR Forward Counter")]
|
||||
public bool FixDataReadingForwardCounter { get; set; }
|
||||
|
||||
[Display(Name = "FDR Time Of Minimum Flow")]
|
||||
public bool FixDataReadingTimeOfMinimumFlow { get; set; }
|
||||
|
||||
[Display(Name = "FDR Minimum Flow")]
|
||||
public bool FixDataReadingMinimumFlow { get; set; }
|
||||
|
||||
[Display(Name = "FDR Time Of Broken Pipe Flow")]
|
||||
public bool FixDataReadingTimeOfBrokenPipe { get; set; }
|
||||
|
||||
[Display(Name = "FDR Broken Pipe Flow")]
|
||||
public bool FixDataReadingBrokenPipeFlow { get; set; }
|
||||
|
||||
[Display(Name = "FDR Current Flow")]
|
||||
public bool FixDataReadingCurrentFlow { get; set; }
|
||||
|
||||
[Display(Name = "FDR Time Of Peak Flow")]
|
||||
public bool FixDataReadingTimeOfPeakFlow { get; set; }
|
||||
|
||||
[Display(Name = "FDR Peak Flow")]
|
||||
public bool FixDataReadingPeakFlow { get; set; }
|
||||
|
||||
[Display(Name = "FDR Time Of Maximum Flow")]
|
||||
public bool FixDataReadingTimeOfMaximumFlow { get; set; }
|
||||
|
||||
[Display(Name = "FDR Maximum Flow")]
|
||||
public bool FixDataReadingMaximumFlow { get; set; }
|
||||
|
||||
[Display(Name = "FDR Backward Volume")]
|
||||
public bool FixDataReadingBackwardVolume { get; set; }
|
||||
|
||||
[Display(Name = "FDR Counter")]
|
||||
public bool FixDataReadingCounter { get; set; }
|
||||
|
||||
[Display(Name = "FDR Alert State")]
|
||||
public bool FixDataReadingAlertState { get; set; }
|
||||
|
||||
[Display(Name = "Wake Up Interval")]
|
||||
public int WakeUpInterval { get; set; }
|
||||
|
||||
[Display(Name = "UTC Offset")]
|
||||
public int UTCOffset { get; set; }
|
||||
|
||||
[Display(Name = "Transmission Interval")]
|
||||
public int TransmissionInterval { get; set; }
|
||||
|
||||
[Display(Name = "WM-Bus Transmission Interval")]
|
||||
public int TransmissionIntervalWMBus { get; set; }
|
||||
|
||||
[Display(Name = "Listen After Talk")]
|
||||
public int ListenAfterTalk { get; set; }
|
||||
}
|
||||
}
|
||||
@ -1,23 +0,0 @@
|
||||
namespace LaaProductionWeb.Blazor.Components.CSD.Data
|
||||
{
|
||||
using System;
|
||||
|
||||
public class SelectItem<T> where T : SelectItem<T>
|
||||
{
|
||||
public event Action<T> ItemSelected;
|
||||
|
||||
private bool selected;
|
||||
public bool Selected
|
||||
{
|
||||
get => this.selected;
|
||||
set
|
||||
{
|
||||
this.selected = value;
|
||||
|
||||
this.NotifyItemSelected();
|
||||
}
|
||||
}
|
||||
|
||||
protected void NotifyItemSelected() => this.ItemSelected?.Invoke(this as T);
|
||||
}
|
||||
}
|
||||
@ -1,406 +1,104 @@
|
||||
namespace LaaProductionWeb.Blazor.Components.CSD.Data
|
||||
{
|
||||
using LaaPackages.SqlClient;
|
||||
using LaaProductionWeb.Blazor.Components.CSD.Models;
|
||||
|
||||
using Microsoft.Extensions.Configuration;
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
public class VAKOMerkmaleDbContext
|
||||
{
|
||||
private static int uiid;
|
||||
|
||||
private readonly SqlConnection sqlConnection;
|
||||
private readonly HashSet<CharCode> charCodes;
|
||||
|
||||
private string basisFilter;
|
||||
private string parameterFilter;
|
||||
private string charCodeFilter;
|
||||
private string basis;
|
||||
private int stelle;
|
||||
private int laenge;
|
||||
|
||||
public VAKOMerkmaleDbContext(IConfiguration configuration)
|
||||
{
|
||||
this.basisFilter = "%%";
|
||||
this.parameterFilter = "%%";
|
||||
this.charCodeFilter = "%%";
|
||||
|
||||
var connectionString = configuration.GetConnectionString("Auftrag");
|
||||
this.sqlConnection = SqlConnection.CreateSqlConnection(connectionString);
|
||||
this.charCodes = [];
|
||||
|
||||
this.UniqueBasisCodes = [];
|
||||
this.UniqueParameters = [];
|
||||
this.UniqueCharCodes = [];
|
||||
this.SelectedItems = [];
|
||||
|
||||
this.InitializeVAKOMErkmale();
|
||||
}
|
||||
|
||||
public event Action SelectionChanged;
|
||||
|
||||
public ICollection<BasisCode> UniqueBasisCodes { get; private set; }
|
||||
|
||||
public ICollection<Parameter> UniqueParameters { get; private set; }
|
||||
|
||||
public ICollection<CharCode> UniqueCharCodes { get; private set; }
|
||||
|
||||
public SortedDictionary<string, SortedDictionary<string, SortedSet<CharCode>>> SelectedItems { get; }
|
||||
|
||||
public IEnumerable<string> GetUniqueVAKOCodePatterns()
|
||||
public IEnumerable<string> GetAllCSDs(string filter)
|
||||
{
|
||||
var vakoCodePatterns = new HashSet<string>();
|
||||
var orderedCharCodes = this.UniqueCharCodes
|
||||
.OrderBy(x => x.Stelle)
|
||||
.GroupBy(x => x.Stelle)
|
||||
.ToDictionary(x => x.Key, x => x.ToList());
|
||||
|
||||
if (orderedCharCodes.Count > 0)
|
||||
{
|
||||
var key = orderedCharCodes.Min(x => x.Key);
|
||||
var patterns = new List<char[]>();
|
||||
|
||||
GenerateUniqueCombinations(orderedCharCodes, patterns, this.basis, key);
|
||||
|
||||
foreach (var pattern in patterns)
|
||||
{
|
||||
vakoCodePatterns.Add(new string(pattern));
|
||||
}
|
||||
}
|
||||
|
||||
return vakoCodePatterns;
|
||||
}
|
||||
|
||||
public void SetBasisFilter(object filter)
|
||||
{
|
||||
this.basisFilter = $"%{filter}%";
|
||||
|
||||
this.UpdateBasisCodes();
|
||||
this.UpdateParameters();
|
||||
this.UpdateCharCodes();
|
||||
}
|
||||
|
||||
public void SetParameterFilter(object filter)
|
||||
{
|
||||
this.parameterFilter = $"%{filter}%";
|
||||
|
||||
this.UpdateParameters();
|
||||
this.UpdateCharCodes();
|
||||
}
|
||||
|
||||
public void SetCharCodeFilter(object filter)
|
||||
{
|
||||
this.charCodeFilter = $"%{filter}%";
|
||||
|
||||
this.UpdateCharCodes();
|
||||
}
|
||||
|
||||
public void BasisSelected(BasisCode basisCode)
|
||||
{
|
||||
this.basisFilter = $"%{basisCode.Name}%";
|
||||
this.basis = basisCode.Name;
|
||||
this.stelle = 0;
|
||||
this.laenge = 0;
|
||||
|
||||
this.charCodes.Clear();
|
||||
this.SelectedItems.Clear();
|
||||
this.UpdateParameters();
|
||||
this.UpdateCharCodes();
|
||||
}
|
||||
|
||||
public void ParameterSelected(Parameter parameter)
|
||||
{
|
||||
this.stelle = parameter.Stelle;
|
||||
this.laenge = parameter.Laenge;
|
||||
|
||||
this.UpdateParameters();
|
||||
this.UpdateCharCodes();
|
||||
}
|
||||
|
||||
public void CharcodeSelected(CharCode charCode)
|
||||
{
|
||||
this.charCodes.Add(charCode);
|
||||
this.charCodes.RemoveWhere(x => !x.Selected);
|
||||
}
|
||||
|
||||
private void InitializeVAKOMErkmale()
|
||||
{
|
||||
this.UpdateBasisCodes();
|
||||
this.UpdateParameters();
|
||||
}
|
||||
|
||||
private void UpdateBasisCodes()
|
||||
=> this.UniqueBasisCodes = this.sqlConnection
|
||||
.CreateCommand($@"
|
||||
SELECT DISTINCT
|
||||
vmm.Basis
|
||||
FROM VAKO_Merkmale AS vmm
|
||||
WHERE vmm.Basis IS NOT NULL
|
||||
AND vmm.Basis LIKE @{nameof(basisFilter)}
|
||||
ORDER BY vmm.Basis")
|
||||
.SetParameter(nameof(this.basisFilter), this.basisFilter)
|
||||
.ExecuteReader(x => new BasisCode
|
||||
{
|
||||
UIId = $"uiid_{++uiid}",
|
||||
Name = x.GetValue<string>(0)
|
||||
})
|
||||
.ToList();
|
||||
|
||||
private void UpdateParameters()
|
||||
=> this.UniqueParameters = this.sqlConnection
|
||||
.CreateCommand($@"
|
||||
SELECT DISTINCT
|
||||
vmm.Basis
|
||||
, vmm.Bezeichnung
|
||||
, vmm.Stelle
|
||||
, vmm.Laenge
|
||||
FROM VAKO_Merkmale AS vmm
|
||||
WHERE vmm.Bezeichnung IS NOT NULL
|
||||
AND vmm.Basis LIKE @{nameof(this.basisFilter)}
|
||||
AND vmm.Bezeichnung LIKE @{nameof(this.parameterFilter)}
|
||||
ORDER BY vmm.Bezeichnung")
|
||||
.SetParameter(nameof(this.basisFilter), this.basisFilter)
|
||||
.SetParameter(nameof(this.parameterFilter), this.parameterFilter)
|
||||
.ExecuteReader(x => new Parameter
|
||||
{
|
||||
UIId = $"uiid_{++uiid}",
|
||||
Basis = x.GetValue<string>(0),
|
||||
Name = x.GetValue<string>(1),
|
||||
Stelle = x.GetValue<int>(2),
|
||||
Laenge = x.GetValue<int>(3)
|
||||
})
|
||||
.ToList();
|
||||
|
||||
private void UpdateCharCodes()
|
||||
{
|
||||
this.UniqueCharCodes = this.sqlConnection
|
||||
.CreateCommand($@"
|
||||
SELECT DISTINCT
|
||||
mm.Basis
|
||||
, mm.Bezeichnung
|
||||
, mm.Stelle
|
||||
, mm.Laenge
|
||||
, mm.Charcode
|
||||
, mm.Wert
|
||||
FROM (SELECT DISTINCT
|
||||
vmm.Basis
|
||||
, vmm.Bezeichnung
|
||||
, vmm.Stelle
|
||||
, vmm.Laenge
|
||||
, vmm.Charcode
|
||||
, vmm.Wert
|
||||
, ROW_NUMBER() OVER (PARTITION BY vmm.Charcode ORDER BY vmm.Wert DESC) AS RowNr
|
||||
FROM VAKO_Merkmale AS vmm
|
||||
WHERE vmm.Basis LIKE @{nameof(this.basisFilter)}
|
||||
AND vmm.Stelle = @{nameof(this.stelle)}
|
||||
AND vmm.Laenge = @{nameof(this.laenge)})
|
||||
AS mm
|
||||
WHERE RowNr = 1
|
||||
AND mm.Wert LIKE @{nameof(this.charCodeFilter)}
|
||||
ORDER BY mm.Charcode")
|
||||
.SetParameter(nameof(this.basisFilter), this.basisFilter)
|
||||
.SetParameter(nameof(this.stelle), this.stelle)
|
||||
.SetParameter(nameof(this.laenge), this.laenge)
|
||||
.SetParameter(nameof(this.charCodeFilter), this.charCodeFilter)
|
||||
.ExecuteReader(x => new CharCode
|
||||
{
|
||||
UIId = $"uiid_{++uiid}",
|
||||
Basis = x.GetValue<string>(0),
|
||||
Name = x.GetValue<string>(1),
|
||||
Stelle = x.GetValue<int>(2),
|
||||
Laenge = x.GetValue<int>(3),
|
||||
Code = x.GetValue<string>(4),
|
||||
Value = x.GetValue<string>(5),
|
||||
})
|
||||
.ToList();
|
||||
|
||||
foreach (var charCode in charCodes)
|
||||
{
|
||||
charCode.Selected = this.charCodes
|
||||
.FirstOrDefault(x => x.Basis == charCode.Basis
|
||||
&& x.Stelle == charCode.Stelle
|
||||
&& x.Laenge == charCode.Laenge
|
||||
&& x.Code == charCode.Code)
|
||||
?.Selected ?? false;
|
||||
}
|
||||
}
|
||||
|
||||
private static void GenerateUniqueCombinations(Dictionary<int, List<CharCode>> charCodes, List<char[]> patterns, string basis, int key)
|
||||
{
|
||||
var nextKey = charCodes.FirstOrDefault(x => x.Key > key).Key;
|
||||
|
||||
if (nextKey > default(int))
|
||||
{
|
||||
var parameter = charCodes[nextKey].FirstOrDefault();
|
||||
|
||||
if (parameter != null)
|
||||
{
|
||||
var length = parameter.Stelle + parameter.Laenge;
|
||||
var tempalte = new char[length];
|
||||
|
||||
for (var ix = 0; ix < length; ix++)
|
||||
{
|
||||
tempalte[ix] = '_';
|
||||
}
|
||||
|
||||
for (var ix = 0; ix < basis.Length; ix++)
|
||||
{
|
||||
tempalte[ix] = basis[ix];
|
||||
}
|
||||
|
||||
tempalte[length - 1] = '%';
|
||||
|
||||
if (patterns.Count == 0)
|
||||
{
|
||||
patterns.Add(tempalte);
|
||||
}
|
||||
else
|
||||
{
|
||||
patterns[0] = tempalte;
|
||||
}
|
||||
}
|
||||
|
||||
GenerateUniqueCombinations(charCodes, patterns, basis, nextKey);
|
||||
}
|
||||
|
||||
var templatePatterns = new List<char[]>();
|
||||
templatePatterns.AddRange(patterns);
|
||||
patterns.Clear();
|
||||
|
||||
foreach (var parameter in charCodes[key])
|
||||
{
|
||||
foreach (var template in templatePatterns)
|
||||
{
|
||||
var pattern = new char[template.Length];
|
||||
|
||||
Array.Copy(template, 0, pattern, 0, pattern.Length);
|
||||
|
||||
var codeLength = parameter.Code.Length;
|
||||
|
||||
for (var charIX = 0; charIX < codeLength; charIX++)
|
||||
{
|
||||
pattern[parameter.Stelle + charIX - 1] = parameter.Code[charIX];
|
||||
}
|
||||
|
||||
patterns.Add(pattern);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public IEnumerable<CSD> GetAllCSDs(string filter)
|
||||
{
|
||||
var like = $"csd%{filter}%";
|
||||
var likeCSD = $"csd%{filter}%";
|
||||
var likeQA = $"qa%{filter}%";
|
||||
|
||||
return this.sqlConnection
|
||||
.CreateCommand($@"
|
||||
SELECT DISTINCT
|
||||
vmm.Charcode
|
||||
, vmm.Wert
|
||||
FROM VAKO_Merkmale AS vmm
|
||||
WHERE vmm.Wert LIKE @{nameof(like)}
|
||||
ORDER BY vmm.Wert")
|
||||
.SetParameter(nameof(like), like)
|
||||
.ExecuteReader(x => new CSD
|
||||
{
|
||||
CharCode = x.GetValue<string>(0),
|
||||
Wert = x.GetValue<string>(1),
|
||||
});
|
||||
SELECT DISTINCT
|
||||
vmm.Wert
|
||||
FROM VAKO_Merkmale AS vmm
|
||||
WHERE vmm.Wert LIKE @{nameof(likeCSD)}
|
||||
OR vmm.Wert LIKE @{nameof(likeQA)}
|
||||
ORDER BY vmm.Wert")
|
||||
.SetParameter(nameof(likeQA), likeQA)
|
||||
.SetParameter(nameof(likeCSD), likeCSD)
|
||||
.ExecuteReader(x => x.GetValue<string>(0));
|
||||
}
|
||||
|
||||
public IEnumerable<string> GetBasisCodesForCSD(string csd)
|
||||
=> this.sqlConnection
|
||||
.CreateCommand($@"
|
||||
SELECT DISTINCT vmm.Basis
|
||||
SELECT DISTINCT
|
||||
vmm.Basis
|
||||
FROM VAKO_Merkmale AS vmm
|
||||
WHERE vmm.Wert = @{nameof(csd)}
|
||||
ORDER BY vmm.Basis")
|
||||
.SetParameter(nameof(csd), csd)
|
||||
.ExecuteReader(x => x.GetValue<string>(0));
|
||||
|
||||
public IEnumerable<CSDBezeichnung> GetBezeichnungenForCSDAndBasis(string csd, string basis)
|
||||
public IEnumerable<string> GetBezeichnungenForBasis(string basis)
|
||||
=> this.sqlConnection
|
||||
.CreateCommand($@"
|
||||
SELECT DISTINCT
|
||||
vmm.Bezeichnung
|
||||
, vmm.Stelle
|
||||
, vmm.Laenge
|
||||
vmm.Bezeichnung
|
||||
FROM VAKO_Merkmale AS vmm
|
||||
WHERE vmm.Basis = @{nameof(basis)}
|
||||
AND vmm.Bezeichnung <> @{nameof(basis)}
|
||||
AND vmm.Wert <> @{nameof(csd)}
|
||||
ORDER BY vmm.Bezeichnung")
|
||||
.SetParameter(nameof(csd), csd)
|
||||
.SetParameter(nameof(basis), basis)
|
||||
.ExecuteReader(x => new CSDBezeichnung
|
||||
.ExecuteReader(x => x.GetValue<string>(0));
|
||||
|
||||
public IEnumerable<Charcode> GetCharcodesForBezeichnung(string basis, string bezeichnung)
|
||||
=> this.sqlConnection
|
||||
.CreateCommand($@"
|
||||
SELECT DISTINCT
|
||||
vmm.Basis
|
||||
, vmm.Bezeichnung
|
||||
, vmm.Stelle
|
||||
, vmm.Laenge
|
||||
, vmm.Charcode
|
||||
, vmm.Wert
|
||||
FROM VAKO_Merkmale AS vmm
|
||||
WHERE vmm.Basis = @{nameof(basis)}
|
||||
AND vmm.Bezeichnung = @{nameof(bezeichnung)}
|
||||
ORDER BY vmm.Charcode")
|
||||
.SetParameter(nameof(basis), basis)
|
||||
.SetParameter(nameof(bezeichnung), bezeichnung)
|
||||
.ExecuteReader(x => new Charcode
|
||||
{
|
||||
Bezeichnung = x.GetValue<string>(0),
|
||||
Stelle = x.GetValue<int>(1),
|
||||
Laenge = x.GetValue<int>(2),
|
||||
Basis = x.GetValue<string>(0),
|
||||
Bezeichnung = x.GetValue<string>(1),
|
||||
Stelle = x.GetValue<int>(2),
|
||||
Laenge = x.GetValue<int>(3),
|
||||
Code = x.GetValue<string>(4),
|
||||
Value = x.GetValue<string>(5),
|
||||
});
|
||||
|
||||
public IEnumerable<CSDMerkmal> GetPatternsForCSD(string csd)
|
||||
=> this.sqlConnection
|
||||
.CreateCommand($@"
|
||||
SELECT cmm.Id
|
||||
, cmm.Csd
|
||||
, cmm.Pattern
|
||||
, cmm.TimeStamp
|
||||
FROM CSD_Merkmale AS cmm
|
||||
WHERE cmm.CSD = @{nameof(csd)}")
|
||||
.SetParameter(nameof(csd), csd)
|
||||
.ExecuteReader(x => new CSDMerkmal
|
||||
{
|
||||
Id = x.GetValue<int>(0),
|
||||
CSD = x.GetValue<string>(1),
|
||||
Pattern = x.GetValue<string>(2),
|
||||
TimeStamp = x.GetValue<DateTime>(3),
|
||||
});
|
||||
}
|
||||
|
||||
public class BasisCode
|
||||
{
|
||||
public string UIId { get; set; }
|
||||
|
||||
public string Name { get; set; }
|
||||
}
|
||||
|
||||
public class Parameter
|
||||
{
|
||||
public string UIId { get; set; }
|
||||
|
||||
public string Name { get; set; }
|
||||
|
||||
public string Basis { get; set; }
|
||||
|
||||
public int Stelle { get; set; }
|
||||
|
||||
public int Laenge { get; set; }
|
||||
}
|
||||
|
||||
public class CharCode
|
||||
{
|
||||
public event Action SelectionChanged;
|
||||
|
||||
public string UIId { get; set; }
|
||||
|
||||
public string Name { get; set; }
|
||||
|
||||
public string Value { get; set; }
|
||||
|
||||
public string Code { get; set; }
|
||||
|
||||
public string Basis { get; set; }
|
||||
|
||||
public int Stelle { get; set; }
|
||||
|
||||
public int Laenge { get; set; }
|
||||
|
||||
private bool selected;
|
||||
public bool Selected
|
||||
{
|
||||
get => this.selected;
|
||||
set
|
||||
{
|
||||
this.selected = value;
|
||||
|
||||
this.SelectionChanged?.Invoke();
|
||||
}
|
||||
}
|
||||
|
||||
public override bool Equals(object other)
|
||||
=> other is CharCode charcode
|
||||
&& charcode.Code == this.Code;
|
||||
|
||||
public override int GetHashCode()
|
||||
=> this.Code?.GetHashCode()
|
||||
?? default;
|
||||
|
||||
public override string ToString()
|
||||
=> this.Code;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,23 +0,0 @@
|
||||
namespace LaaProductionWeb.Blazor.Components.CSD.Models
|
||||
{
|
||||
using System;
|
||||
|
||||
public class BasisItem(string basis)
|
||||
{
|
||||
public event Action<BasisItem> BasisSelected;
|
||||
|
||||
public string Basis { get; } = basis;
|
||||
|
||||
private bool selected;
|
||||
public bool Selected
|
||||
{
|
||||
get => this.selected;
|
||||
set
|
||||
{
|
||||
this.selected = value;
|
||||
|
||||
this.BasisSelected?.Invoke(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,7 +0,0 @@
|
||||
namespace LaaProductionWeb.Blazor.Components.CSD.Models
|
||||
{
|
||||
public class CSDItem
|
||||
{
|
||||
public string Name { get; set; }
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,54 @@
|
||||
namespace LaaProductionWeb.Blazor.Components.CSD.Models
|
||||
{
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
public class Charcode
|
||||
{
|
||||
private string uiid;
|
||||
public string UIId
|
||||
{
|
||||
get
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(this.uiid))
|
||||
{
|
||||
this.uiid = Regex.Replace($"{this.Basis}_{this.Bezeichnung}_{this.Stelle}_{this.Laenge}_{this.Code}_{this.Value}", "[^a-zA-Z0-9]", "_").ToLower();
|
||||
}
|
||||
|
||||
return this.uiid;
|
||||
}
|
||||
}
|
||||
|
||||
public string Basis { get; set; }
|
||||
|
||||
public string Bezeichnung { get; set; }
|
||||
|
||||
public int Stelle { get; set; }
|
||||
|
||||
public int Laenge { get; set; }
|
||||
|
||||
public string Code { get; set; }
|
||||
|
||||
public string Value { get; set; }
|
||||
|
||||
public bool Selected { get; set; }
|
||||
|
||||
public override bool Equals(object other)
|
||||
=> other is Charcode charcode && charcode == this;
|
||||
|
||||
public override int GetHashCode()
|
||||
=> this.UIId.GetHashCode();
|
||||
|
||||
public override string ToString()
|
||||
=> $"{this.Basis} {this.Bezeichnung} {this.Stelle} {this.Laenge} {this.Code} {this.Value}";
|
||||
|
||||
public static bool operator ==(Charcode left, Charcode right)
|
||||
=> left?.Basis == right?.Basis
|
||||
&& left?.Bezeichnung == right?.Bezeichnung
|
||||
&& left?.Stelle == right?.Stelle
|
||||
&& left?.Laenge == right?.Laenge
|
||||
&& left?.Code == right?.Code;
|
||||
|
||||
public static bool operator !=(Charcode left, Charcode right)
|
||||
=> !(left == right);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,20 @@
|
||||
namespace LaaProductionWeb.Blazor.Components.CSD.Models
|
||||
{
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
public readonly struct UIElement(string value)
|
||||
{
|
||||
public string UIId { get; } = Regex.Replace($"{value}", "[^a-zA-Z0-9]", "_").ToLower();
|
||||
|
||||
public string Value { get; } = value;
|
||||
|
||||
public override string ToString()
|
||||
=> this.Value;
|
||||
|
||||
public static implicit operator UIElement(string value)
|
||||
=> new (value);
|
||||
|
||||
public static implicit operator string(UIElement basis)
|
||||
=> basis.Value;
|
||||
}
|
||||
}
|
||||
@ -2,45 +2,222 @@
|
||||
{
|
||||
using LaaProductionWeb.Blazor.Components.CSD.Data;
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
public class VAKOMerkmaleModel
|
||||
public class VAKOMerkmaleModel(VAKOMerkmaleDbContext vakoMerkmaleDbContext)
|
||||
{
|
||||
private readonly VAKOMerkmaleDbContext vakoMerkmaleDbContext;
|
||||
private readonly VAKOMerkmaleDbContext vakoMerkmaleDbContext = vakoMerkmaleDbContext;
|
||||
private Dictionary<string, Dictionary<string, HashSet<Charcode>>> charcodes;
|
||||
|
||||
public VAKOMerkmaleModel(VAKOMerkmaleDbContext vakoMerkmaleDbContext)
|
||||
=> this.vakoMerkmaleDbContext = vakoMerkmaleDbContext;
|
||||
public event Action StateChanged;
|
||||
|
||||
public string CSD { get; private set; }
|
||||
|
||||
public CSD CSD { get; private set; }
|
||||
public string CSDKey { get; private set; }
|
||||
|
||||
public IEnumerable<CSD> GetAllCSDs(string filter)
|
||||
public string Basis { get; private set; }
|
||||
|
||||
public string Bezeichnung { get; private set; }
|
||||
|
||||
public ICollection<string> BasisCodes { get; private set; } = [];
|
||||
|
||||
public ICollection<string> Bezeichnungen { get; private set; } = [];
|
||||
|
||||
public IEnumerable<Charcode> Charcodes { get; private set; } = [];
|
||||
|
||||
public IEnumerable<string> Patterns { get; private set; } = [];
|
||||
|
||||
public IEnumerable<string> GetAllCSDs(string filter)
|
||||
=> this.vakoMerkmaleDbContext.GetAllCSDs(filter);
|
||||
|
||||
public void CSDSelected(CSD kvp)
|
||||
public void CSDSelected(string csd)
|
||||
{
|
||||
this.CSD = kvp;
|
||||
this.CSDKey = this.GetCSDKey(csd);
|
||||
this.CSD = csd;
|
||||
this.BasisCodes = [];
|
||||
this.Bezeichnungen = [];
|
||||
this.Charcodes = [];
|
||||
|
||||
var basisCodes = this.vakoMerkmaleDbContext.GetBasisCodesForCSD(kvp.Wert);
|
||||
foreach (UIElement basis in this.vakoMerkmaleDbContext.GetBasisCodesForCSD(this.CSD))
|
||||
{
|
||||
this.BasisCodes.Add(basis);
|
||||
}
|
||||
|
||||
this.CSD.AddBasisCodes(basisCodes);
|
||||
// this.Patterns = this.vakoMerkmaleDbContext.GetPatternsForCSD(this.CSDKey);
|
||||
}
|
||||
|
||||
public void BasisSelected()
|
||||
public void BasisSelected(string basis)
|
||||
{
|
||||
foreach (var basis in this.CSD.BasisCodes)
|
||||
{
|
||||
if (!basis.Selected)
|
||||
{
|
||||
basis.Clear();
|
||||
this.Basis = basis;
|
||||
this.Bezeichnungen = [];
|
||||
this.Charcodes = this.vakoMerkmaleDbContext.GetCharcodesForBezeichnung(this.Basis, this.Bezeichnung);
|
||||
|
||||
continue;
|
||||
foreach (UIElement bezeichnung in this.vakoMerkmaleDbContext.GetBezeichnungenForBasis(this.Basis))
|
||||
{
|
||||
this.Bezeichnungen.Add(bezeichnung);
|
||||
}
|
||||
}
|
||||
|
||||
public void BezeichnungSelected(string bezeichnung)
|
||||
{
|
||||
this.Bezeichnung = bezeichnung;
|
||||
this.Charcodes = this.vakoMerkmaleDbContext.GetCharcodesForBezeichnung(this.Basis, this.Bezeichnung);
|
||||
|
||||
foreach (var _charcode in this.SelectedCharcodes())
|
||||
{
|
||||
foreach (var charcode in this.Charcodes)
|
||||
{
|
||||
if (_charcode == charcode)
|
||||
{
|
||||
charcode.Selected = _charcode.Selected;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void MerkmalSelected(Charcode charcode)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(this.Basis) || string.IsNullOrWhiteSpace(this.Bezeichnung))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.charcodes is null)
|
||||
{
|
||||
this.charcodes = [];
|
||||
}
|
||||
|
||||
if (!this.charcodes.ContainsKey(this.Basis))
|
||||
{
|
||||
this.charcodes[this.Basis] = [];
|
||||
}
|
||||
|
||||
if (!this.charcodes[this.Basis].ContainsKey(this.Bezeichnung))
|
||||
{
|
||||
this.charcodes[this.Basis][this.Bezeichnung] = [];
|
||||
}
|
||||
|
||||
charcode.Selected = !this.IsMerkmalSelected(charcode);
|
||||
|
||||
if (charcode.Selected)
|
||||
{
|
||||
this.charcodes[this.Basis][this.Bezeichnung].Add(charcode);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.charcodes[this.Basis][this.Bezeichnung].RemoveWhere(x => x == charcode);
|
||||
}
|
||||
|
||||
this.UpdatePatterns();
|
||||
this.StateChanged?.Invoke();
|
||||
}
|
||||
|
||||
public bool IsMerkmalSelected(Charcode charcode)
|
||||
{
|
||||
var __charcode = default(Charcode);
|
||||
|
||||
foreach (var _charcode in this.SelectedCharcodes())
|
||||
{
|
||||
if (_charcode == charcode)
|
||||
{
|
||||
__charcode = _charcode;
|
||||
}
|
||||
}
|
||||
|
||||
if (__charcode is not null)
|
||||
{
|
||||
return __charcode.Selected;
|
||||
}
|
||||
|
||||
return charcode.Selected;
|
||||
}
|
||||
|
||||
public IEnumerable<Charcode> SelectedCharcodes()
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(this.Basis) || string.IsNullOrWhiteSpace(this.Bezeichnung))
|
||||
{
|
||||
yield break;
|
||||
}
|
||||
|
||||
if (this.charcodes is null)
|
||||
{
|
||||
this.charcodes = [];
|
||||
}
|
||||
|
||||
if (!this.charcodes.ContainsKey(this.Basis))
|
||||
{
|
||||
this.charcodes[this.Basis] = [];
|
||||
}
|
||||
|
||||
if (!this.charcodes[this.Basis].ContainsKey(this.Bezeichnung))
|
||||
{
|
||||
this.charcodes[this.Basis][this.Bezeichnung] = [];
|
||||
}
|
||||
|
||||
foreach (var charcode in this.charcodes[this.Basis][this.Bezeichnung])
|
||||
{
|
||||
yield return charcode;
|
||||
}
|
||||
}
|
||||
|
||||
private string GetCSDKey(string csd)
|
||||
{
|
||||
if (!string.IsNullOrWhiteSpace(csd))
|
||||
{
|
||||
var tokens = new string [0];
|
||||
|
||||
csd = csd.Trim();
|
||||
|
||||
if (csd.StartsWith("CSD", StringComparison.CurrentCultureIgnoreCase))
|
||||
{
|
||||
tokens = csd
|
||||
.Split(' ', StringSplitOptions.RemoveEmptyEntries)
|
||||
.Take(2)
|
||||
.ToArray();
|
||||
}
|
||||
else if (csd.StartsWith("QA", StringComparison.CurrentCultureIgnoreCase))
|
||||
{
|
||||
tokens = csd
|
||||
.Split(' ', StringSplitOptions.RemoveEmptyEntries)
|
||||
.Take(1)
|
||||
.ToArray();
|
||||
}
|
||||
|
||||
var bezeichnungen = this.vakoMerkmaleDbContext.GetBezeichnungenForCSDAndBasis(this.CSD.Wert, basis.Basis);
|
||||
|
||||
basis.AddBezeichnungen(bezeichnungen);
|
||||
return string.Join(" ", tokens);
|
||||
}
|
||||
|
||||
return default(string);
|
||||
}
|
||||
|
||||
private void UpdatePatterns()
|
||||
{
|
||||
var patterns = new List<string>();
|
||||
|
||||
foreach (var (basis, bezeichnungen) in this.charcodes)
|
||||
{
|
||||
var charcodes = bezeichnungen
|
||||
.SelectMany(x => x.Value)
|
||||
.OrderBy(x => x.Stelle)
|
||||
.ThenBy(x => x.Laenge)
|
||||
.ThenBy(x => x.Code)
|
||||
.GroupBy(x => x.Stelle)
|
||||
.ToDictionary(x => x.Key, x => x.ToArray());
|
||||
var basisPatterns = new List<string>() { basis };
|
||||
|
||||
foreach (var (stelle, codes) in charcodes)
|
||||
{
|
||||
var actualPatterns = new List<string>() { basis };
|
||||
|
||||
foreach (var code in codes)
|
||||
{
|
||||
patterns.Add($"{basis}{new string('_', code.Stelle + code.Laenge - 1 - basis.Length)}{code}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this.Patterns = patterns;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,112 +1,41 @@
|
||||
<table class="table table-light table-sm table-bordered mb-0">
|
||||
<table class="table table-sm table-light mb-0">
|
||||
<tr>
|
||||
<td class="p-0">
|
||||
<td>
|
||||
<div class="dropdown">
|
||||
<button class="form-select form-select-sm border-0 rounded-0 bg-light" data-bs-toggle="dropdown" aria-expanded="false">
|
||||
@if (this.VAKOMerkmaleModel.CSD is null)
|
||||
<button class="form-select form-select-sm border-0 rounded-0 bg-light shadow-none text-start" data-bs-toggle="dropdown" aria-expanded="false">
|
||||
@if (string.IsNullOrWhiteSpace(this.VAKOMerkmaleModel.CSD))
|
||||
{
|
||||
<i class="small text-secondary">CSD auswählen</i>
|
||||
<i class="text-secondary">CSD auswählen</i>
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
<i class="small text-secondary">@this.VAKOMerkmaleModel.CSD.Wert</i>
|
||||
<strong>@this.VAKOMerkmaleModel.CSDKey - @this.VAKOMerkmaleModel.CSD</strong>
|
||||
@foreach (var pattern in this.VAKOMerkmaleModel.Patterns)
|
||||
{
|
||||
<div>@pattern</div>
|
||||
}
|
||||
}
|
||||
</button>
|
||||
<div class="dropdown-menu dropdown-nav w-100 mt-1 pt-0">
|
||||
<div class="dropdown-menu dropdown-nav w-100 mt-1 pt-0" style="z-index: 1030 !important">
|
||||
<input class="form-control form-control-sm border-start-0 border-top-0 border-end-0 rounded-0 sticky-top py-2"
|
||||
value="@this.csdFilter"
|
||||
@oninput="this.OnCSDFilterInput"/>
|
||||
<div class="overflow-y-auto" style="height: 500px;">
|
||||
@foreach (var kvp in this.FilterCSDs() ?? [])
|
||||
value="@this.csdFilter"
|
||||
placeholder="... filter CSDs"
|
||||
@oninput="this.OnCSDFilterInput" />
|
||||
<div class="overflow-y-auto overflow-x-hidden pt-2" style="max-height: 500px;">
|
||||
@foreach (var csd in this.FilterCSDs() ?? [])
|
||||
{
|
||||
var bg = kvp.CharCode == this.VAKOMerkmaleModel.CSD?.CharCode ? "bg-secondary bg-opacity-25" : null;
|
||||
<div class="dropdown-item cursor-pointer @bg" @onclick="_ => this.CSDSelected(kvp)">@kvp.Wert</div>
|
||||
var bg = csd == this.VAKOMerkmaleModel.CSD ? "bg-secondary bg-opacity-25" : null;
|
||||
<div class="dropdown-item cursor-pointer @bg" @onclick="_ => this.CSDSelected(csd)">@csd</div>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
<td class="p-0">
|
||||
<div class="dropdown">
|
||||
<button class="form-select form-select-sm border-0 rounded-0 bg-light" data-bs-toggle="dropdown" aria-expanded="false" data-bs-auto-close="outside">
|
||||
<i class="small text-secondary">Basis auswählen</i>
|
||||
</button>
|
||||
<div class="dropdown-menu dropdown-nav w-100 mt-1 pt-0 overflow-y-auto" style="height: 500px">
|
||||
@foreach (var basis in this.VAKOMerkmaleModel.CSD?.BasisCodes ?? [])
|
||||
{
|
||||
var id = @basis.Basis.ToLower();
|
||||
|
||||
<div class="dropdown-item">
|
||||
<div class="form-check d-flex align-items-center">
|
||||
<input class="form-check-input cursor-pointer" id="@id" type="checkbox" @onchange="args => this.BasisSelected(basis, args)">
|
||||
<label class="form-check-label ms-2 cursor-pointer" for="@id">@basis.Basis</label>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
<td class="p-0">
|
||||
<div class="dropdown">
|
||||
<button class="form-select form-select-sm border-0 rounded-0 bg-light" data-bs-toggle="dropdown" aria-expanded="false" data-bs-auto-close="outside">
|
||||
<i class="small text-secondary">Bezeichnung auswählen</i>
|
||||
</button>
|
||||
<div class="dropdown-menu dropdown-nav w-100 mt-1 pt-0 overflow-y-auto" style="height: 500px">
|
||||
@{
|
||||
var nr = 1;
|
||||
|
||||
foreach (var bezeichnung in this.VAKOMerkmaleModel.CSD?.BasisCodes?.SelectMany(x => x.Bezeichnungen) ?? [])
|
||||
{
|
||||
var id = $"bezeichnung_{nr++}";
|
||||
|
||||
<div class="dropdown-item">
|
||||
<div class="form-check d-flex align-items-center">
|
||||
<input class="form-check-input cursor-pointer" id="@id" type="radio">
|
||||
<label class="form-check-label ms-2 cursor-pointer" for="@id">@bezeichnung.Bezeichnung</label>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
<td class="p-0">
|
||||
<div class="dropdown">
|
||||
<button class="form-select form-select-sm border-0 rounded-0 bg-light" data-bs-toggle="dropdown" aria-expanded="false" data-bs-auto-close="outside">
|
||||
<i class="small text-secondary">Bezeichnung auswählen</i>
|
||||
</button>
|
||||
<div class="dropdown-menu dropdown-nav w-100 mt-1 pt-0 overflow-y-auto" style="height: 500px">
|
||||
@* @foreach (var basis in this.VAKOMerkmaleModel.CSD.)
|
||||
{
|
||||
var id = @basis.Basis.ToLower();
|
||||
|
||||
<div class="dropdown-item">
|
||||
<div class="form-check d-flex align-items-center">
|
||||
<input class="form-check-input cursor-pointer" id="@id" type="checkbox" @onchange="args => this.BasisSelected(basis, args)">
|
||||
<label class="form-check-label ms-2 cursor-pointer" for="@id">@basis.Basis</label>
|
||||
</div>
|
||||
</div>
|
||||
} *@
|
||||
</div>
|
||||
</div>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="bg-light px-2 pb-2">
|
||||
<a class="link-dark link-underline-opacity-25-hover" href="/csd/options">Optionen</a>
|
||||
<a class="link-dark link-underline-opacity-10-hover" href="/csd/programmingparameters">Programmierung</a>
|
||||
</td>
|
||||
</tr>
|
||||
@if (this.VAKOMerkmaleModel?.CSD is not null)
|
||||
{
|
||||
<tr>
|
||||
<td class="p-2 align-text-top bg-light">
|
||||
@this.VAKOMerkmaleModel.CSD.Wert
|
||||
</td>
|
||||
<td class="p-2 align-text-top bg-light">
|
||||
@foreach (var basis in this.VAKOMerkmaleModel.CSD.BasisCodes?.Where(x => x.Selected) ?? [])
|
||||
{
|
||||
<div>@basis.Basis</div>
|
||||
}
|
||||
</td>
|
||||
<td class="p-2 align-text-top bg-light">
|
||||
</td>
|
||||
<td class="p-2 align-text-top bg-light">
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
</table>
|
||||
|
||||
@ -1,6 +1,5 @@
|
||||
namespace LaaProductionWeb.Blazor.Components.CSD
|
||||
{
|
||||
using LaaProductionWeb.Blazor.Components.CSD.Data;
|
||||
using LaaProductionWeb.Blazor.Components.CSD.Models;
|
||||
|
||||
using Microsoft.AspNetCore.Components;
|
||||
@ -14,29 +13,38 @@
|
||||
[Inject]
|
||||
private VAKOMerkmaleModel VAKOMerkmaleModel { get; set; }
|
||||
|
||||
[Parameter]
|
||||
public EventCallback StateChanged { get; set; }
|
||||
|
||||
protected override void OnInitialized()
|
||||
=> this.VAKOMerkmaleModel.StateChanged += this.StateHasChanged;
|
||||
|
||||
private void OnCSDFilterInput(ChangeEventArgs args)
|
||||
{
|
||||
this.csdFilter = $"{args.Value}";
|
||||
|
||||
this.StateHasChanged();
|
||||
|
||||
if (this.StateChanged.HasDelegate)
|
||||
{
|
||||
this.StateChanged.InvokeAsync();
|
||||
}
|
||||
}
|
||||
|
||||
private IEnumerable<CSD> FilterCSDs()
|
||||
private IEnumerable<string> FilterCSDs()
|
||||
=> this.VAKOMerkmaleModel.GetAllCSDs(this.csdFilter);
|
||||
|
||||
private void CSDSelected(CSD kvp)
|
||||
private void CSDSelected(string csd)
|
||||
{
|
||||
this.VAKOMerkmaleModel.CSDSelected(kvp);
|
||||
this.csdFilter = default;
|
||||
|
||||
this.VAKOMerkmaleModel.CSDSelected(csd);
|
||||
this.StateHasChanged();
|
||||
}
|
||||
|
||||
private void BasisSelected(CSDBasis basis, ChangeEventArgs args)
|
||||
{
|
||||
basis.Selected = args.Value is bool selected && selected;
|
||||
|
||||
this.VAKOMerkmaleModel.BasisSelected();
|
||||
this.StateHasChanged();
|
||||
if (this.StateChanged.HasDelegate)
|
||||
{
|
||||
this.StateChanged.InvokeAsync();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,59 @@
|
||||
@page "/csd/options"
|
||||
|
||||
@using System.Text.RegularExpressions
|
||||
|
||||
<div class="d-flex flex-column h-100 my-0 py-0" style="max-height: calc(100% - 60px) !important">
|
||||
<Navbar StateChanged="this.StateHasChanged" />
|
||||
<div class="d-flex flex-row h-100 overflow-y-hidden">
|
||||
<div class="d-flex flex-column border-end h-100 overflow-y-auto font-monospace w-25">
|
||||
<div class="list-group border-0 rounded-0">
|
||||
@foreach (var basis in this.VAKOMerkmaleModel.BasisCodes)
|
||||
{
|
||||
var selected = default(string);
|
||||
|
||||
if (this.VAKOMerkmaleModel.Basis == basis)
|
||||
{
|
||||
selected = "bg-secondary bg-opacity-25";
|
||||
}
|
||||
|
||||
<div class="list-group-item cursor-pointer border-0 hover-light @selected" @onclick="_ => this.BasisSelected(basis)">@basis</div>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
<div class="d-flex flex-column border-end h-100 overflow-y-auto font-monospace w-25">
|
||||
<div class="list-group border-0 rounded-0">
|
||||
@foreach (var bezeichnung in this.VAKOMerkmaleModel.Bezeichnungen)
|
||||
{
|
||||
var selected = default(string);
|
||||
|
||||
if (this.VAKOMerkmaleModel.Bezeichnung == bezeichnung)
|
||||
{
|
||||
selected = "bg-secondary bg-opacity-25";
|
||||
}
|
||||
|
||||
<div class="list-group-item cursor-pointer border-0 hover-light @selected" @onclick="_ => this.BezeichnungSelected(bezeichnung)">@bezeichnung</div>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
<div class="d-flex flex-column h-100 overflow-y-auto font-monospace align-self-stretch w-100">
|
||||
<div class="list-group border-0 rounded-0">
|
||||
@foreach (var charcode in this.VAKOMerkmaleModel.Charcodes)
|
||||
{
|
||||
var isSelected = this.VAKOMerkmaleModel.IsMerkmalSelected(charcode);
|
||||
var selected = default(string);
|
||||
|
||||
if (isSelected)
|
||||
{
|
||||
selected = "bg-secondary bg-opacity-25";
|
||||
}
|
||||
|
||||
<div class="list-group-item cursor-pointer border-0 hover-light @selected" @onclick="_ => this.MerkmalSelected(charcode)">
|
||||
<span class="text-danger fw-bold">@charcode.Code</span>
|
||||
<i class="text-secondary" style="font-size: 80%;">[@(charcode.Stelle)..@(charcode.Laenge)]</i>
|
||||
<span>@charcode.Value</span>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -0,0 +1,21 @@
|
||||
namespace LaaProductionWeb.Blazor.Components.CSD
|
||||
{
|
||||
using LaaProductionWeb.Blazor.Components.CSD.Models;
|
||||
|
||||
using Microsoft.AspNetCore.Components;
|
||||
|
||||
public partial class Options : ComponentBase
|
||||
{
|
||||
[Inject]
|
||||
private VAKOMerkmaleModel VAKOMerkmaleModel { get; set; }
|
||||
|
||||
private void BasisSelected(string basis)
|
||||
=> this.VAKOMerkmaleModel.BasisSelected(basis);
|
||||
|
||||
private void BezeichnungSelected(string bezeichnung)
|
||||
=> this.VAKOMerkmaleModel.BezeichnungSelected(bezeichnung);
|
||||
|
||||
private void MerkmalSelected(Charcode charcode)
|
||||
=> this.VAKOMerkmaleModel.MerkmalSelected(charcode);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,12 @@
|
||||
export function setChecked (id) {
|
||||
let input = document.querySelector(`input[id="${id}"]`);
|
||||
if (input) {
|
||||
input.checked = true;
|
||||
}
|
||||
}
|
||||
export function setNotChecked(id) {
|
||||
let input = document.querySelector(`input[id="${id}"]`);
|
||||
if (input) {
|
||||
input.checked = false;
|
||||
}
|
||||
}
|
||||
@ -3,56 +3,6 @@
|
||||
<div class="d-flex flex-column h-100 my-0 py-0" style="max-height: calc(100% - 60px) !important">
|
||||
<Navbar />
|
||||
<div class="d-flex flex-row h-100 overflow-y-hidden">
|
||||
<div class="list-group w-auto border-end rounded-0 p-0 h-100 overflow-y-auto font-monospace small w-auto">
|
||||
<input class="form-control rounded-0 border-start-0 border-top-0 border-end-0 sticky-top small shadow-none" placeholder="Basis" @oninput="this.FilterBasisCodes" />
|
||||
@foreach (var basisCode in this.VAKOMerkmale.UniqueBasisCodes)
|
||||
{
|
||||
var id = basisCode.Name.ToLower();
|
||||
|
||||
<div class="list-group-item border-0 p-0">
|
||||
<input type="radio" class="btn-check" name="basis_codes" id="@id" autocomplete="off" @onchange="args => this.BasisSelected(basisCode, args)">
|
||||
<label class="btn btn-light border-0 rounded-0 w-100 text-start small text-nowrap" for="@id">@basisCode.Name</label>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
<div class="list-group w-auto border-end rounded-0 p-0 h-100 overflow-y-auto font-monospace small w-auto">
|
||||
<input class="form-control rounded-0 border-start-0 border-top-0 border-end-0 sticky-top small shadow-none" placeholder="Bezeichnung" @oninput="this.FilterParameters" />
|
||||
@foreach (var parameter in this.VAKOMerkmale.UniqueParameters)
|
||||
{
|
||||
var id = parameter.UIId;
|
||||
|
||||
<div class="list-group-item border-0 p-0">
|
||||
<input type="radio" class="btn-check" name="parameters" id="@id" autocomplete="off" @onchange="args => this.ParameterSelected(parameter, args)">
|
||||
<label class="btn btn-light border-0 rounded-0 w-100 text-start small text-nowrap" for="@id">
|
||||
@parameter.Name - <b class="text-secondary smaller">[@(parameter.Stelle)..@(parameter.Laenge)]</b>
|
||||
</label>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
<div class="list-group w-auto border-end rounded-0 p-0 h-100 overflow-y-auto font-monospace small w-auto">
|
||||
<input class="form-control rounded-0 border-start-0 border-top-0 border-end-0 sticky-top small shadow-none" placeholder="Wert" @oninput="this.FilterCharcodes" />
|
||||
@foreach (var charCode in this.VAKOMerkmale.UniqueCharCodes)
|
||||
{
|
||||
charCode.SelectionChanged += this.StateHasChanged;
|
||||
|
||||
var id = charCode.UIId;
|
||||
|
||||
<div class="list-group-item border-0 p-0">
|
||||
<input type="checkbox" class="btn-check" id="@id" autocomplete="off" @bind="charCode.Selected">
|
||||
<label class="btn btn-light border-0 rounded-0 w-100 text-start small text-nowrap" for="@id">
|
||||
<b class="text-danger smaller">@charCode.Code</b>
|
||||
- @charCode.Value
|
||||
</label>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
<div class="list-group w-auto border-end rounded-0 p-0 h-100 overflow-y-auto font-monospace small w-100">
|
||||
@foreach (var pattern in this.VAKOMerkmale.GetUniqueVAKOCodePatterns())
|
||||
{
|
||||
<div class="small text-danger text-wrap px-3 pt-3">
|
||||
<b>@pattern</b>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -1,48 +1,12 @@
|
||||
namespace LaaProductionWeb.Blazor.Components.CSD
|
||||
{
|
||||
using LaaProductionWeb.Blazor.Components.CSD.Data;
|
||||
using LaaProductionWeb.Blazor.Components.CSD.Models;
|
||||
|
||||
using Microsoft.AspNetCore.Components;
|
||||
|
||||
public partial class ProgrammingParameters : ComponentBase
|
||||
{
|
||||
[Inject]
|
||||
private VAKOMerkmaleDbContext VAKOMerkmale { get; set; }
|
||||
|
||||
private void FilterBasisCodes(ChangeEventArgs args)
|
||||
{
|
||||
this.VAKOMerkmale.SetBasisFilter(args.Value);
|
||||
this.StateHasChanged();
|
||||
}
|
||||
|
||||
private void FilterParameters(ChangeEventArgs args)
|
||||
{
|
||||
this.VAKOMerkmale.SetParameterFilter(args.Value);
|
||||
this.StateHasChanged();
|
||||
}
|
||||
|
||||
private void FilterCharcodes(ChangeEventArgs args)
|
||||
{
|
||||
this.VAKOMerkmale.SetCharCodeFilter(args.Value);
|
||||
this.StateHasChanged();
|
||||
}
|
||||
|
||||
private void BasisSelected(BasisCode basisCode, ChangeEventArgs args)
|
||||
{
|
||||
if (args.Value is string state && state == "on")
|
||||
{
|
||||
this.VAKOMerkmale.BasisSelected(basisCode);
|
||||
this.StateHasChanged();
|
||||
}
|
||||
}
|
||||
|
||||
private void ParameterSelected(Parameter parameter, ChangeEventArgs args)
|
||||
{
|
||||
if (args.Value is string state && state == "on")
|
||||
{
|
||||
this.VAKOMerkmale.ParameterSelected(parameter);
|
||||
this.StateHasChanged();
|
||||
}
|
||||
}
|
||||
private VAKOMerkmaleModel VAKOMerkmaleModel { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@ -14,10 +14,6 @@
|
||||
<NoWarn>IDE1701;IDE1702;CA2254;</NoWarn>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Include="Components\CSD\Data\ProgrammingParameters.cs" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.AspNetCore.SignalR.Client" Version="9.0.3" />
|
||||
<PackageReference Include="Microsoft.Data.SqlClient" Version="6.0.1" />
|
||||
|
||||
@ -39,7 +39,6 @@ namespace LaaProductionWeb.Blazor
|
||||
services.AddScoped<HeliumTesterService>();
|
||||
services.AddScoped<MatchCollectionModel>();
|
||||
services.AddScoped<RecipesCollectionModel>();
|
||||
services.AddScoped<CSDDBContext>();
|
||||
services.AddScoped<VAKOMerkmaleDbContext>();
|
||||
services.AddScoped<VAKOMerkmaleModel>();
|
||||
services.AddScoped<PcbRecipeModel>();
|
||||
@ -62,9 +61,6 @@ namespace LaaProductionWeb.Blazor
|
||||
app.UseAuthentication();
|
||||
app.UseAuthorization();
|
||||
app.MapStaticAssets();
|
||||
//app.UseCors(c => c.AllowAnyHeader()
|
||||
// .AllowAnyOrigin()
|
||||
// .AllowAnyMethod());
|
||||
app.MapRazorComponents<App>()
|
||||
.AddInteractiveServerRenderMode(options =>
|
||||
{
|
||||
|
||||
@ -119,9 +119,19 @@ table.recipes-table input.form-check-input {
|
||||
}
|
||||
|
||||
.form-select {
|
||||
--bs-form-select-bg-img: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" fill="currentColor" class="bi bi-chevron-expand" viewBox="0 0 16 16"><path fill-rule="evenodd" d="M3.646 9.146a.5.5 0 0 1 .708 0L8 12.793l3.646-3.647a.5.5 0 0 1 .708.708l-4 4a.5.5 0 0 1-.708 0l-4-4a.5.5 0 0 1 0-.708m0-2.292a.5.5 0 0 0 .708 0L8 3.207l3.646 3.647a.5.5 0 0 0 .708-.708l-4-4a.5.5 0 0 0-.708 0l-4 4a.5.5 0 0 0 0 .708"/></svg>');
|
||||
--bs-form-select-bg-img: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-chevron-expand" viewBox="0 0 16 16"><path fill-rule="evenodd" d="M3.646 9.146a.5.5 0 0 1 .708 0L8 12.793l3.646-3.647a.5.5 0 0 1 .708.708l-4 4a.5.5 0 0 1-.708 0l-4-4a.5.5 0 0 1 0-.708m0-2.292a.5.5 0 0 0 .708 0L8 3.207l3.646 3.647a.5.5 0 0 0 .708-.708l-4-4a.5.5 0 0 0-.708 0l-4 4a.5.5 0 0 0 0 .708"/></svg>');
|
||||
background-color: inherit;
|
||||
background-image: var(--bs-form-select-bg-img), var(--bs-form-select-bg-icon, none);
|
||||
background-repeat: no-repeat;
|
||||
background-position: left .25rem center;
|
||||
background-size: 12px 12px;
|
||||
padding-left: 24px;
|
||||
}
|
||||
|
||||
.dropdown-menu.dropdown-nav {
|
||||
--bs-dropdown-link-active-bg: var(--bs-light);
|
||||
}
|
||||
|
||||
.hover-light:hover {
|
||||
background: var(--bs-light);
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user