Aggiunta hashset x velocizzare ricerca recipes x PODL
This commit is contained in:
@@ -1615,6 +1615,49 @@ namespace MP.Data.Controllers
|
||||
return dbResult;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Elenco da tabella Macchine filtro x gruppo
|
||||
/// </summary>
|
||||
/// <param name="codGruppo"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<List<MacchineModel>> MacchineGetFiltAsync(string codGruppo)
|
||||
{
|
||||
List<MacchineModel> dbResult = new List<MacchineModel>();
|
||||
try
|
||||
{
|
||||
using (var dbCtx = new MoonProContext(options))
|
||||
{
|
||||
if (codGruppo == "*")
|
||||
{
|
||||
dbResult = await dbCtx
|
||||
.DbSetMacchine
|
||||
.AsNoTracking()
|
||||
.OrderBy(x => x.IdxMacchina)
|
||||
.ToListAsync();
|
||||
}
|
||||
else
|
||||
{
|
||||
dbResult = await dbCtx
|
||||
.DbSetGrp2Macc
|
||||
.Where(g => g.CodGruppo == codGruppo)
|
||||
.Join(dbCtx.DbSetMacchine,
|
||||
g => g.IdxMacchina,
|
||||
m => m.IdxMacchina,
|
||||
(g, m) => m
|
||||
)
|
||||
.AsNoTracking()
|
||||
.OrderBy(x => x.IdxMacchina)
|
||||
.ToListAsync();
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Log.Error($"Eccezione in MacchineGetFiltAsync{Environment.NewLine}{exc}");
|
||||
}
|
||||
return dbResult;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Elenco id MacchineModel che abbiano dati FLuxLog, nel periodo indicato
|
||||
/// </summary>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Version>8.16.2605.1208</Version>
|
||||
<Version>8.16.2605.2519</Version>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<body>
|
||||
<i>Modulo MP-IOC </i>
|
||||
<h4>Versione: 8.16.2605.1208</h4>
|
||||
<h4>Versione: 8.16.2605.2519</h4>
|
||||
<br /> Note di rilascio:
|
||||
<ul>
|
||||
<li>
|
||||
|
||||
@@ -1 +1 @@
|
||||
8.16.2605.1208
|
||||
8.16.2605.2519
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<item>
|
||||
<version>8.16.2605.1208</version>
|
||||
<version>8.16.2605.2519</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>
|
||||
|
||||
@@ -1,32 +1,33 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- https://go.microsoft.com/fwlink/?LinkID=208121. -->
|
||||
<Project>
|
||||
<PropertyGroup>
|
||||
<WebPublishMethod>MSDeploy</WebPublishMethod>
|
||||
<LaunchSiteAfterPublish>true</LaunchSiteAfterPublish>
|
||||
<LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration>
|
||||
<LastUsedPlatform>Any CPU</LastUsedPlatform>
|
||||
<SiteUrlToLaunchAfterPublish>https://iis01.egalware.com/MP/RIOC/</SiteUrlToLaunchAfterPublish>
|
||||
<ExcludeApp_Data>false</ExcludeApp_Data>
|
||||
<ProjectGuid>b9188473-f4ae-4f9f-be2d-70edaace0db9</ProjectGuid>
|
||||
<SelfContained>false</SelfContained>
|
||||
<MSDeployServiceURL>https://iis01.egalware.com:8172/MsDeploy.axd</MSDeployServiceURL>
|
||||
<DeployIisAppPath>Default Web Site/MP/RIOC</DeployIisAppPath>
|
||||
<RemoteSitePhysicalPath />
|
||||
<SkipExtraFilesOnServer>false</SkipExtraFilesOnServer>
|
||||
<MSDeployPublishMethod>WMSVC</MSDeployPublishMethod>
|
||||
<EnableMSDeployBackup>true</EnableMSDeployBackup>
|
||||
<EnableMsDeployAppOffline>true</EnableMsDeployAppOffline>
|
||||
<UserName>jenkins</UserName>
|
||||
<_SavePWD>true</_SavePWD>
|
||||
<_TargetId>IISWebDeploy</_TargetId>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<MsDeploySkipRules Include="SkipLogFiles">
|
||||
<ObjectName>filePath</ObjectName>
|
||||
<AbsolutePath>logs\\.*\.log$</AbsolutePath>
|
||||
</MsDeploySkipRules>
|
||||
</ItemGroup>
|
||||
<PropertyGroup>
|
||||
<WebPublishMethod>MSDeploy</WebPublishMethod>
|
||||
<LaunchSiteAfterPublish>true</LaunchSiteAfterPublish>
|
||||
<LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration>
|
||||
<LastUsedPlatform>Any CPU</LastUsedPlatform>
|
||||
<SiteUrlToLaunchAfterPublish>https://iis01.egalware.com/MP/RIOC/</SiteUrlToLaunchAfterPublish>
|
||||
<ExcludeApp_Data>false</ExcludeApp_Data>
|
||||
<ProjectGuid>b9188473-f4ae-4f9f-be2d-70edaace0db9</ProjectGuid>
|
||||
<SelfContained>false</SelfContained>
|
||||
<MSDeployServiceURL>https://iis01.egalware.com:8172/MsDeploy.axd</MSDeployServiceURL>
|
||||
<DeployIisAppPath>Default Web Site/MP/RIOC</DeployIisAppPath>
|
||||
<RemoteSitePhysicalPath />
|
||||
<SkipExtraFilesOnServer>true</SkipExtraFilesOnServer>
|
||||
<MSDeployPublishMethod>WMSVC</MSDeployPublishMethod>
|
||||
<EnableMSDeployBackup>true</EnableMSDeployBackup>
|
||||
<EnableMsDeployAppOffline>true</EnableMsDeployAppOffline>
|
||||
<UserName>jenkins</UserName>
|
||||
<_SavePWD>true</_SavePWD>
|
||||
<_TargetId>IISWebDeploy</_TargetId>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
|
||||
<PublishReadyToRun>true</PublishReadyToRun>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<MsDeploySkipRules Include="SkipLogFiles">
|
||||
<ObjectName>filePath</ObjectName>
|
||||
<AbsolutePath>logs\\.*\.log$</AbsolutePath>
|
||||
</MsDeploySkipRules>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -168,28 +168,7 @@ namespace MP.SPEC.Components
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
ListStati = await MDService.AnagStatiComm();
|
||||
ListArtKit = MDService.ArticoliGetByTipo("KIT", "*");
|
||||
string strMachRecipe = await MDService.ConfigTryGetAsync("MachineWithRecipe");
|
||||
if (!string.IsNullOrEmpty(strMachRecipe))
|
||||
{
|
||||
bool.TryParse(strMachRecipe, out MachineWithRecipe);
|
||||
}
|
||||
string SPEC_PODL_gest = await MDService.ConfigTryGetAsync("SPEC_PODL_gest");
|
||||
if (!string.IsNullOrEmpty(SPEC_PODL_gest))
|
||||
{
|
||||
bool.TryParse(SPEC_PODL_gest, out enableStartPODL);
|
||||
}
|
||||
string SPEC_ODL_gest = await MDService.ConfigTryGetAsync("SPEC_ODL_gest");
|
||||
if (!string.IsNullOrEmpty(SPEC_ODL_gest))
|
||||
{
|
||||
bool.TryParse(SPEC_ODL_gest, out enableStopODL);
|
||||
}
|
||||
string SPEC_XODL_sync = await MDService.ConfigTryGetAsync("SPEC_XODL_sync");
|
||||
if (!string.IsNullOrEmpty(SPEC_XODL_sync))
|
||||
{
|
||||
bool.TryParse(SPEC_XODL_sync, out enableForceSync);
|
||||
}
|
||||
await ReloadBaseData();
|
||||
}
|
||||
|
||||
protected override async Task OnParametersSetAsync()
|
||||
@@ -216,10 +195,56 @@ namespace MP.SPEC.Components
|
||||
return idxOdl == 0;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Caricamento dati di base
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
protected async Task ReloadBaseData()
|
||||
{
|
||||
ListRecords = null;
|
||||
isLoading = true;
|
||||
|
||||
var machines = await MDService.MacchineGetFiltAsync("*");
|
||||
|
||||
_machinesWithConf = machines
|
||||
.Where(x => !string.IsNullOrEmpty(x.RecipePath))
|
||||
.Select(x => x.IdxMacchina)
|
||||
.ToHashSet();
|
||||
|
||||
_machinesWithArch = machines
|
||||
.Where(x => !string.IsNullOrEmpty(x.RecipeArchivePath))
|
||||
.Select(x => x.IdxMacchina)
|
||||
.ToHashSet();
|
||||
|
||||
ListStati = await MDService.AnagStatiComm();
|
||||
ListArtKit = MDService.ArticoliGetByTipo("KIT", "*");
|
||||
string strMachRecipe = await MDService.ConfigTryGetAsync("MachineWithRecipe");
|
||||
if (!string.IsNullOrEmpty(strMachRecipe))
|
||||
{
|
||||
bool.TryParse(strMachRecipe, out MachineWithRecipe);
|
||||
}
|
||||
string SPEC_PODL_gest = await MDService.ConfigTryGetAsync("SPEC_PODL_gest");
|
||||
if (!string.IsNullOrEmpty(SPEC_PODL_gest))
|
||||
{
|
||||
bool.TryParse(SPEC_PODL_gest, out enableStartPODL);
|
||||
}
|
||||
string SPEC_ODL_gest = await MDService.ConfigTryGetAsync("SPEC_ODL_gest");
|
||||
if (!string.IsNullOrEmpty(SPEC_ODL_gest))
|
||||
{
|
||||
bool.TryParse(SPEC_ODL_gest, out enableStopODL);
|
||||
}
|
||||
string SPEC_XODL_sync = await MDService.ConfigTryGetAsync("SPEC_XODL_sync");
|
||||
if (!string.IsNullOrEmpty(SPEC_XODL_sync))
|
||||
{
|
||||
bool.TryParse(SPEC_XODL_sync, out enableForceSync);
|
||||
}
|
||||
}
|
||||
|
||||
protected async Task ReloadData()
|
||||
{
|
||||
ListRecords = null;
|
||||
isLoading = true;
|
||||
|
||||
// verifico filtro odl...
|
||||
if (actFilter.ShowKit)
|
||||
{
|
||||
@@ -559,10 +584,15 @@ namespace MP.SPEC.Components
|
||||
/// <returns></returns>
|
||||
private bool machineHasRecipeArch(string idxMacchina)
|
||||
{
|
||||
var recipeArchive = MDService.MacchineRecipeArchive(idxMacchina);
|
||||
return !string.IsNullOrEmpty(recipeArchive);
|
||||
return _machinesWithArch.Contains(idxMacchina);
|
||||
//var recipeArchive = MDService.MacchineRecipeArchive(idxMacchina);
|
||||
//return !string.IsNullOrEmpty(recipeArchive);
|
||||
}
|
||||
|
||||
|
||||
private HashSet<string> _machinesWithConf = new();
|
||||
private HashSet<string> _machinesWithArch = new();
|
||||
|
||||
/// <summary>
|
||||
/// Verifica se la idxMaccSel abbia associata una ricetta (template)
|
||||
/// </summary>
|
||||
@@ -570,8 +600,9 @@ namespace MP.SPEC.Components
|
||||
/// <returns></returns>
|
||||
private bool machineHasRecipeConf(string idxMacchina)
|
||||
{
|
||||
var recipePath = MDService.MacchineRecipeConf(idxMacchina);
|
||||
return !string.IsNullOrEmpty(recipePath);
|
||||
return _machinesWithConf.Contains(idxMacchina);
|
||||
//var recipePath = MDService.MacchineRecipeConf(idxMacchina);
|
||||
//return !string.IsNullOrEmpty(recipePath);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -1725,7 +1725,43 @@ namespace MP.SPEC.Data
|
||||
activity?.SetTag("data.source", source);
|
||||
activity?.SetTag("result.count", 1);
|
||||
activity?.Stop();
|
||||
LogTrace($"MacchineGetAll | Read from {source}: {activity?.Duration.TotalMilliseconds}ms");
|
||||
LogTrace($"MacchineGetFilt | Read from {source}: {activity?.Duration.TotalMilliseconds}ms");
|
||||
return result;
|
||||
}
|
||||
/// <summary>
|
||||
/// Elenco di tutte le macchine filtrate x gruppo
|
||||
/// </summary>
|
||||
/// <param name="codGruppo"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<List<MacchineModel>> MacchineGetFiltAsync(string codGruppo)
|
||||
{
|
||||
using var activity = ActivitySource.StartActivity("MacchineGetFilt");
|
||||
List<MacchineModel>? result = new List<MacchineModel>();
|
||||
string source = "DB";
|
||||
string keyGrp = codGruppo != "*" ? codGruppo : "ALL";
|
||||
string currKey = $"{Utils.redisMacList}:{keyGrp}";
|
||||
// cerco in redis dato valore sel idxMaccSel...
|
||||
RedisValue rawData = await redisDb.StringGetAsync(currKey);
|
||||
if (rawData.HasValue)
|
||||
{
|
||||
result = JsonConvert.DeserializeObject<List<MacchineModel>>($"{rawData}");
|
||||
source = "REDIS";
|
||||
}
|
||||
else
|
||||
{
|
||||
result = await dbController.MacchineGetFiltAsync(codGruppo);
|
||||
// serializzo e salvo...
|
||||
rawData = JsonConvert.SerializeObject(result);
|
||||
await redisDb.StringSetAsync(currKey, rawData, getRandTOut(redisLongTimeCache));
|
||||
}
|
||||
if (result == null)
|
||||
{
|
||||
result = new List<MacchineModel>();
|
||||
}
|
||||
activity?.SetTag("data.source", source);
|
||||
activity?.SetTag("result.count", 1);
|
||||
activity?.Stop();
|
||||
LogTrace($"MacchineGetFiltAsync | Read from {source}: {activity?.Duration.TotalMilliseconds}ms");
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<Nullable>enable</Nullable>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<RootNamespace>MP.SPEC</RootNamespace>
|
||||
<Version>8.16.2605.2518</Version>
|
||||
<Version>8.16.2605.2616</Version>
|
||||
<UserSecretsId>1800a78a-6ff1-40f9-b490-87fb8bfc1394</UserSecretsId>
|
||||
<SatelliteResourceLanguages>en</SatelliteResourceLanguages>
|
||||
</PropertyGroup>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<body>
|
||||
<i>Modulo MAPOSPEC </i>
|
||||
<h4>Versione: 8.16.2605.2518</h4>
|
||||
<h4>Versione: 8.16.2605.2616</h4>
|
||||
<br /> Note di rilascio:
|
||||
<ul>
|
||||
<li>
|
||||
|
||||
@@ -1 +1 @@
|
||||
8.16.2605.2518
|
||||
8.16.2605.2616
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<item>
|
||||
<version>8.16.2605.2518</version>
|
||||
<version>8.16.2605.2616</version>
|
||||
<url>https://nexus.steamware.net/repository/SWS/MP-SPEC/stable/LAST/MP.SPEC.zip</url>
|
||||
<changelog>https://nexus.steamware.net/repository/SWS/MP-SPEC/stable/LAST/ChangeLog.html</changelog>
|
||||
<mandatory>false</mandatory>
|
||||
|
||||
Reference in New Issue
Block a user