Aggiunta gestione controllo articoli in Istanze KIT come chil
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<Version>8.16.2605.2813</Version>
|
||||
<Version>8.16.2605.2814</Version>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<RootNamespace>MP_TAB3</RootNamespace>
|
||||
</PropertyGroup>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<body>
|
||||
<i>Modulo MAPOSPEC </i>
|
||||
<h4>Versione: 8.16.2605.2813</h4>
|
||||
<h4>Versione: 8.16.2605.2814</h4>
|
||||
<br /> Note di rilascio:
|
||||
<ul>
|
||||
<li>
|
||||
|
||||
@@ -1 +1 @@
|
||||
8.16.2605.2813
|
||||
8.16.2605.2814
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<item>
|
||||
<version>8.16.2605.2813</version>
|
||||
<version>8.16.2605.2814</version>
|
||||
<url>https://nexus.steamware.net/repository/SWS/MP-TAB3/stable/LAST/MP-TAB3.zip</url>
|
||||
<changelog>https://nexus.steamware.net/repository/SWS/MP-TAB3/stable/LAST/ChangeLog.html</changelog>
|
||||
<mandatory>false</mandatory>
|
||||
|
||||
@@ -379,15 +379,13 @@ namespace MP.Data.Controllers
|
||||
public List<string> ArticleWithDossier()
|
||||
{
|
||||
List<string> dbResult = new List<string>();
|
||||
using (var dbCtx = new MoonPro_FluxContext(_configuration))
|
||||
{
|
||||
dbResult = dbCtx
|
||||
.DbSetDossiers
|
||||
.AsNoTracking()
|
||||
.Select(i => i.CodArticolo)
|
||||
.Distinct()
|
||||
.ToList();
|
||||
}
|
||||
using var dbCtx = new MoonPro_FluxContext(_configuration);
|
||||
dbResult = dbCtx
|
||||
.DbSetDossiers
|
||||
.AsNoTracking()
|
||||
.Select(i => i.CodArticolo)
|
||||
.Distinct()
|
||||
.ToList();
|
||||
return dbResult;
|
||||
}
|
||||
|
||||
@@ -572,6 +570,22 @@ namespace MP.Data.Controllers
|
||||
return dbResult;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Elenco Articoli che sono in KIT Child
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public async Task<List<AnagArticoliModel>> ArticoliInKitAsync()
|
||||
{
|
||||
List<AnagArticoliModel> dbResult = new List<AnagArticoliModel>();
|
||||
using var dbCtx = new MoonProContext(options);
|
||||
dbResult = await dbCtx
|
||||
.DbSetArticoli
|
||||
.FromSqlRaw("EXEC stp_TempKIT_getArtChild")
|
||||
.AsNoTracking()
|
||||
.ToListAsync();
|
||||
return dbResult;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Update Record
|
||||
/// </summary>
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<Nullable>enable</Nullable>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<RootNamespace>MP.INVE</RootNamespace>
|
||||
<Version>8.16.2605.2813</Version>
|
||||
<Version>8.16.2605.2814</Version>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<body>
|
||||
<i>Modulo MAPOINVE </i>
|
||||
<h4>Versione: 8.16.2605.2813</h4>
|
||||
<h4>Versione: 8.16.2605.2814</h4>
|
||||
<br /> Note di rilascio:
|
||||
<ul>
|
||||
<li>
|
||||
|
||||
@@ -1 +1 @@
|
||||
8.16.2605.2813
|
||||
8.16.2605.2814
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<item>
|
||||
<version>8.16.2605.2813</version>
|
||||
<version>8.16.2605.2814</version>
|
||||
<url>https://nexus.steamware.net/repository/SWS/MP-INVE/stable/LAST/MP.INVE.zip</url>
|
||||
<changelog>https://nexus.steamware.net/repository/SWS/MP-INVE/stable/LAST/ChangeLog.html</changelog>
|
||||
<mandatory>false</mandatory>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Version>8.16.2605.2813</Version>
|
||||
<Version>8.16.2605.2814</Version>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<body>
|
||||
<i>Modulo MP-IOC </i>
|
||||
<h4>Versione: 8.16.2605.2813</h4>
|
||||
<h4>Versione: 8.16.2605.2814</h4>
|
||||
<br /> Note di rilascio:
|
||||
<ul>
|
||||
<li>
|
||||
|
||||
@@ -1 +1 @@
|
||||
8.16.2605.2813
|
||||
8.16.2605.2814
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<item>
|
||||
<version>8.16.2605.2813</version>
|
||||
<version>8.16.2605.2814</version>
|
||||
<url>https://nexus.steamware.net/repository/SWS/MP-IOC/stable/LAST/MP.IOC.zip</url>
|
||||
<changelog>https://nexus.steamware.net/repository/SWS/MP-IOC/stable/LAST/ChangeLog.html</changelog>
|
||||
<mandatory>false</mandatory>
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<RootNamespace>MP.Land</RootNamespace>
|
||||
<Version>8.16.2605.2813</Version>
|
||||
<Version>8.16.2605.2814</Version>
|
||||
<Configurations>Debug;Release;Debug_LiManDebug</Configurations>
|
||||
<SatelliteResourceLanguages>en</SatelliteResourceLanguages>
|
||||
<RunAnalyzersDuringBuild>True</RunAnalyzersDuringBuild>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<body>
|
||||
<i>Modulo Tablet MAPO - DotNet6</i>
|
||||
<h4>Versione: 8.16.2605.2813</h4>
|
||||
<h4>Versione: 8.16.2605.2814</h4>
|
||||
<br />
|
||||
Note di rilascio:
|
||||
<ul>
|
||||
|
||||
@@ -1 +1 @@
|
||||
8.16.2605.2813
|
||||
8.16.2605.2814
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<item>
|
||||
<version>8.16.2605.2813</version>
|
||||
<version>8.16.2605.2814</version>
|
||||
<url>https://nexus.steamware.net/repository/SWS/MP-LAND/stable/LAST/MP.Land.zip</url>
|
||||
<changelog>https://nexus.steamware.net/repository/SWS/MP-LAND/stable/LAST/ChangeLog.html</changelog>
|
||||
<mandatory>false</mandatory>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<RootNamespace>MP.MON</RootNamespace>
|
||||
<AssemblyName>$(AssemblyName.Replace(' ', '_'))</AssemblyName>
|
||||
<Version>8.16.2605.2813</Version>
|
||||
<Version>8.16.2605.2814</Version>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<body>
|
||||
<i>Modulo MAPOSPEC </i>
|
||||
<h4>Versione: 8.16.2605.2813</h4>
|
||||
<h4>Versione: 8.16.2605.2814</h4>
|
||||
<br /> Note di rilascio:
|
||||
<ul>
|
||||
<li>
|
||||
|
||||
@@ -1 +1 @@
|
||||
8.16.2605.2813
|
||||
8.16.2605.2814
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<item>
|
||||
<version>8.16.2605.2813</version>
|
||||
<version>8.16.2605.2814</version>
|
||||
<url>https://nexus.steamware.net/repository/SWS/MP-MON/stable/LAST/MP.MON.zip</url>
|
||||
<changelog>https://nexus.steamware.net/repository/SWS/MP-MON/stable/LAST/ChangeLog.html</changelog>
|
||||
<mandatory>false</mandatory>
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<RootNamespace>MP.Prog</RootNamespace>
|
||||
<Version>8.16.2605.2813</Version>
|
||||
<Version>8.16.2605.2814</Version>
|
||||
<GenerateDocumentationFile>True</GenerateDocumentationFile>
|
||||
</PropertyGroup>
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<body>
|
||||
<i>Modulo gestione Programmi MAPO</i>
|
||||
<h4>Versione: 8.16.2605.2813</h4>
|
||||
<h4>Versione: 8.16.2605.2814</h4>
|
||||
<br />
|
||||
Note di rilascio:
|
||||
<ul>
|
||||
|
||||
@@ -1 +1 @@
|
||||
8.16.2605.2813
|
||||
8.16.2605.2814
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<item>
|
||||
<version>8.16.2605.2813</version>
|
||||
<version>8.16.2605.2814</version>
|
||||
<url>https://nexus.steamware.net/repository/SWS/MP-PROG/stable/LAST/MP.Prog.zip</url>
|
||||
<changelog>https://nexus.steamware.net/repository/SWS/MP-PROG/stable/LAST/ChangeLog.html</changelog>
|
||||
<mandatory>false</mandatory>
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<Nullable>enable</Nullable>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<RootNamespace>MP.RIOC</RootNamespace>
|
||||
<Version>8.16.2605.2813</Version>
|
||||
<Version>8.16.2605.2814</Version>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<body>
|
||||
<i>Modulo MP-RIOC </i>
|
||||
<h4>Versione: 8.16.2605.2813</h4>
|
||||
<h4>Versione: 8.16.2605.2814</h4>
|
||||
<br /> Note di rilascio:
|
||||
<ul>
|
||||
<li>
|
||||
|
||||
@@ -1 +1 @@
|
||||
8.16.2605.2813
|
||||
8.16.2605.2814
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<item>
|
||||
<version>8.16.2605.2813</version>
|
||||
<version>8.16.2605.2814</version>
|
||||
<url>https://nexus.steamware.net/repository/SWS/MP-RIOC/stable/LAST/MP.RIOC.zip</url>
|
||||
<changelog>https://nexus.steamware.net/repository/SWS/MP-RIOC/stable/LAST/ChangeLog.html</changelog>
|
||||
<mandatory>false</mandatory>
|
||||
|
||||
@@ -287,6 +287,23 @@ namespace MP.SPEC.Data
|
||||
);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Elenco articoli contenuti in Kit (come child), non eliminabli
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public async Task<List<AnagArticoliModel>> ArticoliInKitAsync()
|
||||
{
|
||||
string redisKey = $"{Utils.redisArtList}:InKit";
|
||||
return await GetOrFetchAsync(
|
||||
operationName: "ArticoliInKitAsync",
|
||||
cacheKey: redisKey,
|
||||
expiration: getRandTOut(redisLongTimeCache),
|
||||
fetchFunc: async () =>
|
||||
await dbController.ArticoliInKitAsync() ?? new List<AnagArticoliModel>(),
|
||||
tagList: [Utils.redisArtList, $"{Utils.redisArtList}:InKit"]
|
||||
);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Restitusice elenco articoli cercati
|
||||
/// </summary>
|
||||
@@ -337,8 +354,8 @@ namespace MP.SPEC.Data
|
||||
using var activity = ActivitySource.StartActivity("ArticoloDelEnabled");
|
||||
string codArticolo = $"{CodArt}";
|
||||
|
||||
int numUsed = _usedArtIdsCache.Count;
|
||||
int numUnused = _unusedArtIdsCache.Count;
|
||||
int numUsed = _listCodArtUsed.Count;
|
||||
int numUnused = _listCodArtNotUsed.Count;
|
||||
bool usato = true;
|
||||
string source = "MEMORY";
|
||||
// 1. Controllo immediato sulla cache locale (HashSet) x eventuale refresh
|
||||
@@ -351,20 +368,24 @@ namespace MP.SPEC.Data
|
||||
task.Wait();
|
||||
|
||||
// rileggo
|
||||
numUsed = _usedArtIdsCache.Count;
|
||||
numUnused = _unusedArtIdsCache.Count;
|
||||
numUsed = _listCodArtUsed.Count;
|
||||
numUnused = _listCodArtNotUsed.Count;
|
||||
}
|
||||
|
||||
// verifico quale sia l'elenco
|
||||
if (numUsed > 0)
|
||||
{
|
||||
usato = _usedArtIdsCache.Contains(codArticolo);
|
||||
usato = _listCodArtUsed.Contains(codArticolo);
|
||||
}
|
||||
else
|
||||
{
|
||||
usato = !_unusedArtIdsCache.Contains(codArticolo);
|
||||
usato = !_listCodArtNotUsed.Contains(codArticolo);
|
||||
}
|
||||
// verifico infine anche che NON sia nell'elenco degli articoli in KIT
|
||||
if (!usato)
|
||||
{
|
||||
usato = _listCodArtInKit.Contains(CodArt);
|
||||
}
|
||||
|
||||
activity?.SetTag("data.source", source);
|
||||
activity?.Stop();
|
||||
LogTrace($"ArticoloDelEnabled | Cod: {codArticolo} | {source} | {activity?.Duration.TotalMilliseconds}ms");
|
||||
@@ -726,7 +747,7 @@ namespace MP.SPEC.Data
|
||||
/// </summary>
|
||||
public async Task EnsureArtCacheLoadedAsync(bool forceReload)
|
||||
{
|
||||
if (!forceReload && (DateTime.Now < _artCacheExpiry && (_usedArtIdsCache.Count > 0 || _unusedArtIdsCache.Count > 0)))
|
||||
if (!forceReload && (DateTime.Now < _artCacheExpiry && (_listCodArtUsed.Count > 0 || _listCodArtNotUsed.Count > 0)))
|
||||
return;
|
||||
|
||||
try
|
||||
@@ -738,16 +759,20 @@ namespace MP.SPEC.Data
|
||||
if (usedCount <= (totalCount - usedCount))
|
||||
{
|
||||
var usedList = await dbController.ArticoliGetUsedAsync();
|
||||
_usedArtIdsCache = new HashSet<string>(usedList.Select(x => x.CodArticolo));
|
||||
_unusedArtIdsCache.Clear();
|
||||
_listCodArtUsed = new HashSet<string>(usedList.Select(x => x.CodArticolo));
|
||||
_listCodArtNotUsed.Clear();
|
||||
}
|
||||
else
|
||||
{
|
||||
var unusedList = await dbController.ArticoliGetUnusedAsync();
|
||||
_unusedArtIdsCache = new HashSet<string>(unusedList.Select(x => x.CodArticolo));
|
||||
_usedArtIdsCache.Clear();
|
||||
_listCodArtNotUsed = new HashSet<string>(unusedList.Select(x => x.CodArticolo));
|
||||
_listCodArtUsed.Clear();
|
||||
}
|
||||
_artCacheExpiry = DateTime.Now.AddMinutes(15); // TTL ragionevole per la cache locale
|
||||
// calcolo anche elenco articoli impiegati in istanzanKIT
|
||||
var listInKit = await dbController.ArticoliInKitAsync();
|
||||
_listCodArtInKit = new HashSet<string>(listInKit.Select(x => x.CodArticolo));
|
||||
|
||||
_artCacheExpiry = DateTime.Now.AddMinutes(5); // TTL ragionevole per la cache locale
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@@ -2524,10 +2549,20 @@ namespace MP.SPEC.Data
|
||||
|
||||
private Dictionary<string, string> _configData = new();
|
||||
|
||||
private HashSet<string> _unusedArtIdsCache = new();
|
||||
/// <summary>
|
||||
/// Elenco CodArticolo NON usati (per verifica eliminabilità)
|
||||
/// </summary>
|
||||
private HashSet<string> _listCodArtNotUsed = new();
|
||||
|
||||
// Cache per controllo eliminazione articoli (Smart HashSet approach)
|
||||
private HashSet<string> _usedArtIdsCache = new();
|
||||
/// <summary>
|
||||
/// Elenco CodArticolo usati (per verifica eliminabilità)
|
||||
/// </summary>
|
||||
private HashSet<string> _listCodArtUsed = new();
|
||||
|
||||
/// <summary>
|
||||
/// Elenco CodArticolo usati in istanza KIT (per verifica eliminabilità)
|
||||
/// </summary>
|
||||
private HashSet<string> _listCodArtInKit = new();
|
||||
|
||||
private string canCacheParametri = "";
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<RootNamespace>MP.Stats</RootNamespace>
|
||||
<UserSecretsId>826e877c-ba70-4253-84cb-d0b1cafd4440</UserSecretsId>
|
||||
<Version>8.16.2605.2813</Version>
|
||||
<Version>8.16.2605.2814</Version>
|
||||
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
||||
<SatelliteResourceLanguages>en</SatelliteResourceLanguages>
|
||||
</PropertyGroup>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<body>
|
||||
<i>Modulo statistiche MAPO</i>
|
||||
<h4>Versione: 8.16.2605.2813</h4>
|
||||
<h4>Versione: 8.16.2605.2814</h4>
|
||||
<br />
|
||||
Note di rilascio:
|
||||
<ul>
|
||||
|
||||
@@ -1 +1 @@
|
||||
8.16.2605.2813
|
||||
8.16.2605.2814
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<item>
|
||||
<version>8.16.2605.2813</version>
|
||||
<version>8.16.2605.2814</version>
|
||||
<url>https://nexus.steamware.net/repository/SWS/MP-STATS/stable/LAST/MP.Stats.zip</url>
|
||||
<changelog>https://nexus.steamware.net/repository/SWS/MP-STATS/stable/LAST/ChangeLog.html</changelog>
|
||||
<mandatory>false</mandatory>
|
||||
|
||||
Reference in New Issue
Block a user