cordonel apps and versions on FW version and pcb
This commit is contained in:
parent
ea8d86b9cf
commit
c6a95981a2
@ -20,6 +20,15 @@
|
||||
, gm.Adresse
|
||||
, aps.Pruefgangnr
|
||||
, aps.StatusFertigung
|
||||
, CASE WHEN fs.Charcode = 'X'
|
||||
THEN 'None'
|
||||
WHEN fs.Charcode = '1'
|
||||
THEN 'Standard'
|
||||
WHEN fs.Charcode = '2'
|
||||
THEN 'Random'
|
||||
WHEN fs.Charcode = '3'
|
||||
THEN 'CSD'
|
||||
END AS EncryptionKeyKind
|
||||
FROM CordonelMapPcbToAssignedPicking AS pcb
|
||||
LEFT JOIN AlleAuftragPositionen AS aap
|
||||
ON pcb.FertigungsauftragNr = aap.FertigungsauftragNr
|
||||
@ -31,11 +40,155 @@
|
||||
ON aap.IdentNr = idn.IdentNr
|
||||
AND idn.Stelle = 4
|
||||
AND idn.Laenge = 2
|
||||
LEFT JOIN AlleIdentNrVakoMerkmale AS fs
|
||||
ON aap.IdentNr = fs.IdentNr
|
||||
AND fs.Stelle = 46
|
||||
AND fs.Laenge = 1
|
||||
LEFT JOIN CordonelMeterSizes AS ms
|
||||
ON idn.Charcode = ms.Dn_VakoID
|
||||
WHERE pcb.PcbId = @{0}
|
||||
ORDER BY aps.Pruefgangnr DESC";
|
||||
|
||||
/// <summary>
|
||||
/// Contains placeholder for the pcbId at positon: 0
|
||||
/// Contains placeholder for the FW version at positon: 1
|
||||
/// </summary>
|
||||
private const string APPS_VERSIONS_CRC_BY_PCB_V = @"
|
||||
---------------------------------------------------------------------------------------------------
|
||||
-- Declarations
|
||||
---------------------------------------------------------------------------------------------------
|
||||
DECLARE @pcbIdVarchar AS VARCHAR(20) = @{0};
|
||||
DECLARE @fwVersion AS VARCHAR(20) = @{1};
|
||||
DECLARE @progressId AS INT;
|
||||
DECLARE @frequency AS INT;
|
||||
DECLARE @meterSize AS INT;
|
||||
---------------------------------------------------------------------------------------------------
|
||||
-- Find and set latest progress id
|
||||
---------------------------------------------------------------------------------------------------
|
||||
SELECT @progressId = MAX(Id)
|
||||
FROM CordonelProgress
|
||||
WHERE PcbId = @pcbIdVarchar
|
||||
---------------------------------------------------------------------------------------------------
|
||||
-- Find and set meter size and frequency
|
||||
---------------------------------------------------------------------------------------------------
|
||||
SELECT @frequency = (SELECT TOP 1 CASE WHEN idn.Charcode = 'A'
|
||||
THEN 868
|
||||
WHEN idn.Charcode = 'B'
|
||||
THEN 433
|
||||
ELSE 0 END
|
||||
FROM AlleIdentNrVakoMerkmale AS idn
|
||||
WHERE idn.IdentNr = aap.IdentNr
|
||||
AND idn.Stelle = 43
|
||||
ORDER BY idn.Stelle)
|
||||
, @meterSize = (SELECT TOP 1 cms.Dn_InternalId
|
||||
FROM AlleIdentNrVakoMerkmale AS idn
|
||||
JOIN CordonelMeterSizes AS cms
|
||||
ON idn.Charcode = cms.Dn_VakoID
|
||||
WHERE idn.IdentNr = aap.IdentNr
|
||||
AND idn.Stelle = 4
|
||||
ORDER BY idn.Stelle)
|
||||
FROM MapPcbIdToSerialNumber AS map
|
||||
JOIN AuftragPositionSerienNr AS aps
|
||||
ON map.MapPcbIdToSerialNumber_SerialNumber = aps.SerienNr
|
||||
JOIN AlleAuftragPositionen AS aap
|
||||
ON aps.AuftragNr = aap.AuftragNr
|
||||
AND aps.PositionNr = aap.PositionNr
|
||||
WHERE map.MapPcbIdToSerialNumber_PcbId = @pcbIdVarchar
|
||||
---------------------------------------------------------------------------------------------------
|
||||
-- Select all apps with their versions and crc
|
||||
---------------------------------------------------------------------------------------------------
|
||||
SELECT DISTINCT
|
||||
apps.PcbId AS AppsPcbId
|
||||
, apps.AppId AS AppsAppId
|
||||
, apps.Version AS AppsAppVersion
|
||||
, history.PcbId AS HistoryPcbId
|
||||
, history.HistoryAppVersion
|
||||
, history.HistoryAppCrc
|
||||
, files.FlexnetAppId
|
||||
, files.FlexnetVersion
|
||||
, files.MetrologyVersion
|
||||
, files.CoreRevisionMin
|
||||
, files.CoreRevisionMax
|
||||
, files.FilesAppId
|
||||
, files.FilesAppVersion
|
||||
, files.FilesAppCrc
|
||||
, files.ClusterFileId
|
||||
, files.FileName
|
||||
FROM (SELECT _progress.PcbId
|
||||
, RIGHT(CONVERT(VARCHAR(10), CONVERT(BINARY(1), _apps.AppId, 2), 2), 2) AS AppId
|
||||
, CASE WHEN LEN(_apps.Version) >= 4
|
||||
THEN RIGHT('0' + REPLACE(_apps.Version, '.', ''), 4)
|
||||
ELSE NULL END AS Version
|
||||
FROM CordonelProgress AS _progress
|
||||
JOIN CordonelAppVersion AS _apps
|
||||
ON _progress.Id = _apps.ProgressId
|
||||
WHERE _progress.Id = @progressId
|
||||
AND _apps.Version IS NOT NULL)
|
||||
AS apps
|
||||
LEFT JOIN(SELECT _history_.PcbId
|
||||
, RIGHT(_history_.HistoryAppVersion, 2) + LEFT(_history_.HistoryAppVersion, 2) AS HistoryAppVersion
|
||||
, RIGHT(_history_.HistoryAppCrc, 2) + LEFT(_history_.HistoryAppCrc, 2) AS HistoryAppCrc
|
||||
FROM (SELECT _history.PcbId
|
||||
, LEFT(REPLACE(_history.Version, '-', ''), 4) AS HistoryAppVersion
|
||||
, LEFT(REPLACE(_history.Crc, '-', ''), 4) AS HistoryAppCrc
|
||||
FROM (SELECT _left.PcbId
|
||||
, _left.Value AS Version
|
||||
, _right.Value AS Crc
|
||||
, ROW_NUMBER() OVER (PARTITION BY _left.Value ORDER BY _right.Value, _right.date DESC) AS RN
|
||||
FROM GenesisMeterRegisterHistory AS _left
|
||||
JOIN GenesisMeterRegisterHistory AS _right
|
||||
ON _left.PcbId = _right.PcbId
|
||||
AND _left.ID + 1 = _right.ID
|
||||
WHERE _left.PcbId = @pcbIdVarchar
|
||||
AND _left.Address = '00-01'
|
||||
AND _right.Address = '00-0D')
|
||||
AS _history
|
||||
WHERE _history.RN = 1)
|
||||
AS _history_)
|
||||
AS history
|
||||
ON apps.Version = history.HistoryAppVersion
|
||||
LEFT JOIN(SELECT _files.FlexnetAppId
|
||||
, _files.Version AS FlexnetVersion
|
||||
, _files.MetrologyVersion
|
||||
, _files.CoreRevisionMin
|
||||
, _files.CoreRevisionMax
|
||||
, _files.AppId AS FilesAppId
|
||||
, RIGHT(_files.AppVersion, 2) + LEFT(_files.AppVersion, 2) AS FilesAppVersion
|
||||
, RIGHT(_files.FileCrc, 2) + LEFT(_files.FileCrc, 2) AS FilesAppCrc
|
||||
, _files.ClusterFileId
|
||||
, _files.FileName
|
||||
, _files.FileContent
|
||||
FROM (SELECT DISTINCT
|
||||
cluster.FileId AS ClusterFileId
|
||||
, fw.FlexnetAppId
|
||||
, fw.Version
|
||||
, fw.CoreRevisionMin
|
||||
, fw.CoreRevisionMax
|
||||
, fw.MetrologyVersion
|
||||
, SUBSTRING(CONVERT(VARCHAR(MAX), __files.FileContent, 2), 81, 2) AS AppId
|
||||
, SUBSTRING(CONVERT(VARCHAR(MAX), __files.FileContent, 2), 13, 4) AS AppVersion
|
||||
, SUBSTRING(CONVERT(VARCHAR(MAX), __files.FileContent, 2), 9, 4) AS FileCrc
|
||||
, __files.FileName
|
||||
, CASE WHEN __files.FileName LIKE '%.txt'
|
||||
THEN CONVERT(VARCHAR(MAX), __files.FileContent, 0)
|
||||
ELSE CONVERT(VARCHAR(MAX), __files.FileContent, 2)
|
||||
END AS FileContent
|
||||
FROM Cordonel_CurrentFw AS fw
|
||||
JOIN FileClusterStore AS cluster
|
||||
ON cluster.FileId = fw.FileClusterStoreId
|
||||
JOIN FileMapToCluster AS filemap
|
||||
ON cluster.FileId = filemap.FileMapToCluster_FileClusterId
|
||||
LEFT JOIN [File] AS __files
|
||||
ON filemap.FileMapToCluster_FileId = __files.FileId
|
||||
WHERE fw.Name = @fwVersion
|
||||
AND fw.CurrentForProd = 1
|
||||
AND fw.IsReleased = 1)
|
||||
AS _files)
|
||||
AS files
|
||||
ON apps.AppId = files.FilesAppId
|
||||
WHERE apps.Version IS NOT NULL
|
||||
ORDER BY apps.AppId";
|
||||
|
||||
/// <summary>
|
||||
/// Contains placeholder for the pcbId variable name at positon: 0
|
||||
/// </summary>
|
||||
|
||||
@ -67,7 +67,8 @@
|
||||
PcbId = x.GetValue<int>(9),
|
||||
Address = x.GetValue<ulong>(10),
|
||||
PruefgangNr = x.GetValue<int>(11),
|
||||
StatusFertigung = x.GetValue<int>(12)
|
||||
StatusFertigung = x.GetValue<int>(12),
|
||||
EncryptionKeyKind = x.GetValue<CordonelEncryptionKeyKind>(13)
|
||||
});
|
||||
|
||||
internal virtual EOLProgressModel GetEOLProgressModel(int pcbId)
|
||||
@ -87,6 +88,31 @@
|
||||
ValueHex = reader.GetValue<string>(2),
|
||||
});
|
||||
|
||||
internal virtual IEnumerable<CordonelAppVeriosnCrc> GetAppsWithVersions(int pcbId, string version)
|
||||
=> this.SqlConnection
|
||||
.CreateCommand(string.Format(APPS_VERSIONS_CRC_BY_PCB_V, nameof(pcbId), nameof(version)))
|
||||
.SetParameter(nameof(pcbId), pcbId)
|
||||
.SetParameter(nameof(version), version)
|
||||
.ExecuteReader(reader => new CordonelAppVeriosnCrc
|
||||
{
|
||||
AppsPcbId = reader.GetValue<int>(0),
|
||||
AppsAppId = reader.GetValue<string>(1),
|
||||
AppsAppVersion = reader.GetValue<string>(2),
|
||||
HistoryPcbId = reader.GetValue<int>(3),
|
||||
HistoryAppVersion = reader.GetValue<string>(4),
|
||||
HistoryAppCrc = reader.GetValue<string>(5),
|
||||
FlexnetAppId = reader.GetValue<string>(6),
|
||||
FlexnetVersion = reader.GetValue<string>(7),
|
||||
MetrologyVersion = reader.GetValue<int>(8),
|
||||
CoreRevisionMin = reader.GetValue<int>(9),
|
||||
CoreRevisionMax = reader.GetValue<int>(10),
|
||||
FilesAppId = reader.GetValue<string>(11),
|
||||
FilesAppVersion = reader.GetValue<string>(12),
|
||||
FilesAppCrc = reader.GetValue<string>(13),
|
||||
ClusterFileId = reader.GetValue<int>(14),
|
||||
FileName = reader.GetValue<string>(15),
|
||||
});
|
||||
|
||||
internal virtual IEnumerable<CordonelAppVeriosnCrc> GetLatestAppsWithVersions(int pcbId)
|
||||
=> this.SqlConnection
|
||||
.CreateCommand(string.Format(LATEST_APPS_VERSIONS_CRC_BY_PCB, nameof(pcbId)))
|
||||
|
||||
@ -48,14 +48,13 @@
|
||||
|
||||
try
|
||||
{
|
||||
|
||||
// Data loading
|
||||
this.TryGetUniqueProductionData(pcbId, out var productionData); // Tested
|
||||
this.TryGetEOLProgressModel(pcbId, out var eolProgress); // Tested
|
||||
this.TryGetCordonelRequirements(pcbId, out var requirements); // Tested
|
||||
this.TryGetProgrammingParameters(pcbId, out var parameters);
|
||||
this.TryGetCordonelAppsAndRegisterValues(pcbId, out var apps); // Tested
|
||||
this.TryGetCordonelAppsAndFWVersionValues(pcbId, out var appsVersionsCrcs); // Tested
|
||||
this.TryGetCordonelAppsAndFWVersionValues(pcbId, requirements.FwVersion, out var appsVersionsCrcs); // Tested
|
||||
this.TryGetCordonelMetrologyValues(pcbId, requirements.SkipCalibration ?? false, out var metrologyValues); // Tested
|
||||
this.TryGetCordonelRadioDefaults(pcbId, requirements.SkipRadioCheck ?? false, out var rssiValues); // Tested
|
||||
this.TryGetPasswordFileContent(pcbId, out var passwordFile);
|
||||
@ -82,7 +81,7 @@
|
||||
this.TryCompareMeterSize(productionData, requirements, eolProgress, apps, metrologyValues);
|
||||
this.TryCompareLUTCRCVersion(requirements, eolProgress, apps);
|
||||
this.TryCompareAppsAndFWVersion(requirements, eolProgress, apps, appsVersionsCrcs);
|
||||
this.TryCompareMetrologyValues(requirements, eolProgress, apps, metrologyValues); // TODO: klären wie ???
|
||||
this.TryCompareMetrologyValues(requirements, eolProgress, apps, metrologyValues); // TODO: Sentinel: klären wie ???
|
||||
this.TryCompareRadioSignalStreight(requirements, eolProgress, rssiValues);
|
||||
this.TryCompareBatteryLimits(requirements, apps, eolProgress);
|
||||
this.TryCompareRadioSystemState(requirements, apps, eolProgress);
|
||||
@ -209,6 +208,16 @@
|
||||
, eolProgress.ProductionStatusFwVersion);
|
||||
}
|
||||
|
||||
foreach (var kvp in apps)
|
||||
{
|
||||
var app = kvp.Value;
|
||||
|
||||
if (app is null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
var requirementFlexnetVersion = requirements
|
||||
.FwVersion
|
||||
.Replace(".", string.Empty)
|
||||
@ -244,11 +253,7 @@
|
||||
firstIteration = !firstIteration;
|
||||
}
|
||||
|
||||
if (appVersionCrc.AppsAppId == byte.MaxValue.ToString("X2"))
|
||||
{
|
||||
// TODO: compare min max and metrology
|
||||
}
|
||||
else if (appVersionCrc.AppsAppVersion != appVersionCrc.HistoryAppVersion)
|
||||
if (appVersionCrc.AppsAppVersion != appVersionCrc.HistoryAppVersion)
|
||||
{
|
||||
this.ThrowSentinelException(
|
||||
nameof(CordonelAppVeriosnCrc)
|
||||
@ -750,6 +755,8 @@
|
||||
{
|
||||
this.ThrowSentinelException($"{nameof(EOLProgressModel)}.{nameof(EOLProgressModel.FinalRadioSystemState)} ist nicht gleich {nameof(radioSystemState)}({radioSystemState}))");
|
||||
}
|
||||
|
||||
// TODO: Sentinel: check enkryption key type
|
||||
}
|
||||
|
||||
internal void TryCompareRegionSizeKey(CordonelProductionData productionData, CordonelRequirements requirements, EOLProgressModel eolProgress)
|
||||
@ -858,10 +865,10 @@
|
||||
}
|
||||
}
|
||||
|
||||
internal void TryGetCordonelAppsAndFWVersionValues(int pcbId, out CordonelAppVeriosnCrc[] appsVersionsCrc)
|
||||
internal void TryGetCordonelAppsAndFWVersionValues(int pcbId, string version, out CordonelAppVeriosnCrc[] appsVersionsCrc)
|
||||
{
|
||||
appsVersionsCrc = this.cordonelDbContext
|
||||
?.GetLatestAppsWithVersions(pcbId)
|
||||
?.GetAppsWithVersions(pcbId, version)
|
||||
?.ToArray();
|
||||
|
||||
if (appsVersionsCrc is null)
|
||||
@ -877,7 +884,7 @@
|
||||
internal void TryGetCordonelMetrologyValues(int pcbId, bool skipMetrology, out CordonelMetrologyValues metrologyValues)
|
||||
{
|
||||
metrologyValues = this.meterProcessState?.GetLatestGenesisFlowValues(pcbId);
|
||||
//TODO: load values from independent source (this.cordonelDbContext?.GetLatestGenesisFlowValues(pcbId));
|
||||
//TODO: Sentinel: load values from independent source (this.cordonelDbContext?.GetLatestGenesisFlowValues(pcbId));
|
||||
|
||||
if (metrologyValues is null && skipMetrology != true)
|
||||
{
|
||||
@ -1057,7 +1064,7 @@
|
||||
var sentinelVersion = $"{nameof(Sentinel)} - V{assemblyVersion.Major}.{assemblyVersion.MajorRevision}.{assemblyVersion.Minor}";
|
||||
var exported = this.meterProcessState.MakeSAPExport(pcbId, state, nameof(Sentinel));
|
||||
|
||||
//TODO SAP export
|
||||
//TODO Sentinel: SAP export
|
||||
//if (!exported)
|
||||
//{
|
||||
// this.ThrowSentinelException($"SAP export für PcbId: {pcbId} wurde nicht durchgeführt");
|
||||
|
||||
@ -1 +1 @@
|
||||
Subproject commit 6a016687bc8a3aee54697cc0afdb4a5d29029c36
|
||||
Subproject commit d9861aa167739fa74d15402a22aacdc6d5bb3c58
|
||||
Loading…
Reference in New Issue
Block a user