diff --git a/EgwCoreLib.Lux.Data/Controllers/LuxController.cs b/EgwCoreLib.Lux.Data/Controllers/LuxController.cs index c941ad31..625f4038 100644 --- a/EgwCoreLib.Lux.Data/Controllers/LuxController.cs +++ b/EgwCoreLib.Lux.Data/Controllers/LuxController.cs @@ -1,5 +1,6 @@ using EgwCoreLib.Lux.Core.RestPayload; using EgwCoreLib.Lux.Data.DbModel.Config; +using EgwCoreLib.Lux.Data.DbModel.Cost; using EgwCoreLib.Lux.Data.DbModel.Items; using EgwCoreLib.Lux.Data.DbModel.Sales; using EgwCoreLib.Lux.Data.DbModel.Task; @@ -1228,9 +1229,6 @@ namespace EgwCoreLib.Lux.Data.Controllers return dbResult; } - - - /// /// Esegue spostamento nell'ordinamento /// NB: verifica spostamento sia ammissibile: se primo rec non "sale", se ultimo non "scende"... @@ -1337,12 +1335,6 @@ namespace EgwCoreLib.Lux.Data.Controllers return answ; } - - - - - - /// /// Eliminazione record richiesto /// @@ -1362,7 +1354,6 @@ namespace EgwCoreLib.Lux.Data.Controllers .FirstOrDefaultAsync(); if (dbResult != null) { - // cerco righe successive var list2move = dbCtx .DbSetJobTask @@ -2127,6 +2118,54 @@ namespace EgwCoreLib.Lux.Data.Controllers return answ; } + /// + /// Elenco record Fasi da DB + /// + /// + internal async Task> PhasesGetAllAsync() + { + List dbResult = new List(); + //using (DataLayerContext dbCtx = new DataLayerContext(_config)) + using (DataLayerContext dbCtx = new DataLayerContext()) + { + try + { + dbResult = await dbCtx + .DbSetPhase + .ToListAsync(); + } + catch (Exception exc) + { + Log.Error($"Eccezione durante PhasesGetAllAsync{Environment.NewLine}{exc}"); + } + } + return dbResult; + } + + /// + /// Elenco record risorse da DB + /// + /// + internal async Task> ResourcesGetAllAsync() + { + List dbResult = new List(); + //using (DataLayerContext dbCtx = new DataLayerContext(_config)) + using (DataLayerContext dbCtx = new DataLayerContext()) + { + try + { + dbResult = await dbCtx + .DbSetResource + .ToListAsync(); + } + catch (Exception exc) + { + Log.Error($"Eccezione durante ResourcesGetAllAsync{Environment.NewLine}{exc}"); + } + } + return dbResult; + } + #endregion Internal Methods #region Private Fields diff --git a/EgwCoreLib.Lux.Data/Services/DataLayerServices.cs b/EgwCoreLib.Lux.Data/Services/DataLayerServices.cs index c6c8fd54..b1c64c4b 100644 --- a/EgwCoreLib.Lux.Data/Services/DataLayerServices.cs +++ b/EgwCoreLib.Lux.Data/Services/DataLayerServices.cs @@ -19,6 +19,7 @@ using static System.Runtime.InteropServices.JavaScript.JSType; using EgwCoreLib.Lux.Data.DbModel.Items; using EgwCoreLib.Lux.Data.DbModel.Config; using EgwCoreLib.Lux.Data.DbModel.Task; +using EgwCoreLib.Lux.Data.DbModel.Cost; namespace EgwCoreLib.Lux.Data.Services { @@ -737,6 +738,19 @@ namespace EgwCoreLib.Lux.Data.Services return result; } + /// + /// Esegue Upsert del record ricevuto + /// + /// + /// + public async Task JobStepUpsertAsync(JobStepModel currRec) + { + bool result = await dbController.JobStepUpsertAsync(currRec); + await ExecFlushRedisPatternAsync((RedisValue)$"{redisBaseKey}:JobTaskList:*"); + await ExecFlushRedisPatternAsync((RedisValue)$"{redisBaseKey}:JobStep:*"); + return result; + } + /// /// Esegue eliminazione + refresh cache /// @@ -1080,6 +1094,74 @@ namespace EgwCoreLib.Lux.Data.Services return fatto; } + /// + /// Elenco completo Fasi + /// + /// + public async Task> PhasesGetAllAsync() + { + string source = "DB"; + Stopwatch sw = new Stopwatch(); + sw.Start(); + List? result = new List(); + // cerco in redis... + string currKey = $"{redisBaseKey}:GenClass"; + RedisValue rawData = await redisDb.StringGetAsync(currKey); + if (rawData.HasValue) + { + result = JsonConvert.DeserializeObject>($"{rawData}"); + source = "REDIS"; + } + else + { + result = await dbController.PhasesGetAllAsync(); + // serializzo e salvo con config x evitare loop... + rawData = JsonConvert.SerializeObject(result, JSSettings); + await redisDb.StringSetAsync(currKey, rawData, LongCache); + } + if (result == null) + { + result = new List(); + } + sw.Stop(); + Log.Debug($"PhasesGetAllAsync | {source} | {sw.Elapsed.TotalMilliseconds}ms"); + return result; + } + + /// + /// Elenco completo Risorse + /// + /// + public async Task> ResourcesGetAllAsync() + { + string source = "DB"; + Stopwatch sw = new Stopwatch(); + sw.Start(); + List? result = new List(); + // cerco in redis... + string currKey = $"{redisBaseKey}:GenClass"; + RedisValue rawData = await redisDb.StringGetAsync(currKey); + if (rawData.HasValue) + { + result = JsonConvert.DeserializeObject>($"{rawData}"); + source = "REDIS"; + } + else + { + result = await dbController.ResourcesGetAllAsync(); + // serializzo e salvo con config x evitare loop... + rawData = JsonConvert.SerializeObject(result, JSSettings); + await redisDb.StringSetAsync(currKey, rawData, LongCache); + } + if (result == null) + { + result = new List(); + } + sw.Stop(); + Log.Debug($"ResourcesGetAllAsync | {source} | {sw.Elapsed.TotalMilliseconds}ms"); + return result; + } + /// /// Esegue salvataggio BOM sul DB /// diff --git a/Lux.API/Lux.API.csproj b/Lux.API/Lux.API.csproj index 03d63352..7116e98e 100644 --- a/Lux.API/Lux.API.csproj +++ b/Lux.API/Lux.API.csproj @@ -4,7 +4,7 @@ net8.0 enable enable - 0.9.2510.2918 + 0.9.2510.2919 diff --git a/Lux.UI/Components/Compo/JobTask/JobStepMan.razor b/Lux.UI/Components/Compo/JobTask/JobStepMan.razor index 8a247079..33ced016 100644 --- a/Lux.UI/Components/Compo/JobTask/JobStepMan.razor +++ b/Lux.UI/Components/Compo/JobTask/JobStepMan.razor @@ -1,4 +1,68 @@ -
+@if (addVisible) +{ + +} +
Dettaglio Fasi job
diff --git a/Lux.UI/Components/Compo/JobTask/JobStepMan.razor.cs b/Lux.UI/Components/Compo/JobTask/JobStepMan.razor.cs index 0deeda99..47218b8e 100644 --- a/Lux.UI/Components/Compo/JobTask/JobStepMan.razor.cs +++ b/Lux.UI/Components/Compo/JobTask/JobStepMan.razor.cs @@ -1,3 +1,4 @@ +using EgwCoreLib.Lux.Data.DbModel.Cost; using EgwCoreLib.Lux.Data.DbModel.Task; using EgwCoreLib.Lux.Data.Services; using Microsoft.AspNetCore.Components; @@ -21,6 +22,12 @@ namespace Lux.UI.Components.Compo.JobTask [Parameter] public EventCallback EC_Updated { get; set; } + + [Parameter] + public List ListPhases { get; set; } + + [Parameter] + public List ListResources { get; set; } #endregion Public Properties #region Protected Fields @@ -38,6 +45,35 @@ namespace Lux.UI.Components.Compo.JobTask [Inject] protected DataLayerServices DLService { get; set; } = null!; + private string errorMsg = ""; + + /// + /// Genera nuovo record e lo salva + /// + protected async Task DoAdd() + { + if (newRecord != null) + { + // verifico non sia duplicato... + var recExist = CurrRecords.Count(x => x.Description == newRecord.Description); + if (recExist > 0) + { + errorMsg = $"Errore: record già esistente | {newRecord.Description}"; + } + else + { + errorMsg = ""; + // faccio upsert record... + await DLService.JobStepUpsertAsync(newRecord); + // segnalo update x reload + await EC_Updated.InvokeAsync(true); + newRecord = null; + addVisible = false; + // rileggo + ReloadData(); + } + } + } /// /// Eliminazione record /// @@ -118,7 +154,9 @@ namespace Lux.UI.Components.Compo.JobTask newRecord = new JobStepModel() { Index = totalCount + 1, - Description = $"Fase {totalCount + 1} | {DateTime.Now:yyyy.MM.dd-HH.mm.ss}" + Description = $"Fase {totalCount + 1}", + PhaseID = 1, + ResourceID = 1 }; } } diff --git a/Lux.UI/Components/Pages/JobRoute.razor b/Lux.UI/Components/Pages/JobRoute.razor index 299b1c1c..e58491a9 100644 --- a/Lux.UI/Components/Pages/JobRoute.razor +++ b/Lux.UI/Components/Pages/JobRoute.razor @@ -31,7 +31,7 @@ @if (selRecord != null) {
- +
} } diff --git a/Lux.UI/Components/Pages/JobRoute.razor.cs b/Lux.UI/Components/Pages/JobRoute.razor.cs index 12db077c..b4cc154d 100644 --- a/Lux.UI/Components/Pages/JobRoute.razor.cs +++ b/Lux.UI/Components/Pages/JobRoute.razor.cs @@ -1,3 +1,4 @@ +using EgwCoreLib.Lux.Data.DbModel.Cost; using EgwCoreLib.Lux.Data.DbModel.Items; using EgwCoreLib.Lux.Data.DbModel.Task; using EgwCoreLib.Lux.Data.DbModel.Utils; @@ -66,6 +67,8 @@ namespace Lux.UI.Components.Pages private async Task ReloadData() { isLoading = true; + ListPhases = await DLService.PhasesGetAllAsync(); + ListResources = await DLService.ResourcesGetAllAsync(); ListJobTask = await DLService.JobTaskGetAllAsync(); ListStep = null; isLoading = false; @@ -92,6 +95,8 @@ namespace Lux.UI.Components.Pages private List? ListStep = null; + private List ListPhases = new List(); + private List ListResources = new List(); #endregion Private Methods } } \ No newline at end of file diff --git a/Lux.UI/Lux.UI.csproj b/Lux.UI/Lux.UI.csproj index c1b3a584..68dc6e49 100644 --- a/Lux.UI/Lux.UI.csproj +++ b/Lux.UI/Lux.UI.csproj @@ -5,7 +5,7 @@ enable enable aspnet-Lux.UI-a758c101-a2f4-4e38-977d-1c4887dbbd50 - 0.9.2510.2918 + 0.9.2510.2919 diff --git a/Resources/ChangeLog.html b/Resources/ChangeLog.html index 1749fc8c..7d792f4f 100644 --- a/Resources/ChangeLog.html +++ b/Resources/ChangeLog.html @@ -1,6 +1,6 @@ LUX - Web Windows MES -

Versione: 0.9.2510.2918

+

Versione: 0.9.2510.2919


Note di rilascio:
  • diff --git a/Resources/VersNum.txt b/Resources/VersNum.txt index cd7f7ab7..1b4837b3 100644 --- a/Resources/VersNum.txt +++ b/Resources/VersNum.txt @@ -1 +1 @@ -0.9.2510.2918 +0.9.2510.2919 diff --git a/Resources/manifest.xml b/Resources/manifest.xml index 160b94e3..8838a2d2 100644 --- a/Resources/manifest.xml +++ b/Resources/manifest.xml @@ -1,6 +1,6 @@ - 0.9.2510.2918 + 0.9.2510.2919 http://nexus.steamware.net/repository/SWS/GPW/stable/GPW.UI.zip http://nexus.steamware.net/repository/SWS/GPW/stable/ChangeLog.html false