From 9989c7767ea5535c5ce04905ba2c4846421d201f Mon Sep 17 00:00:00 2001 From: Samuele Locatelli Date: Tue, 17 Mar 2026 14:54:16 +0100 Subject: [PATCH] Review namespace Task --> Job + fix JobStep/JobTask --- .../Controllers/LuxController.cs | 4 +- EgwCoreLib.Lux.Data/DataLayerContext.cs | 2 +- .../DbModel/Cost/ResourceModel.cs | 2 +- .../DbModel/Items/SellingItemModel.cs | 2 +- .../{Task => Job}/JobDriverConfigModel.cs | 2 +- .../DbModel/{Task => Job}/JobDriverModel.cs | 2 +- .../DbModel/{Task => Job}/JobStepItemModel.cs | 2 +- .../DbModel/{Task => Job}/JobStepModel.cs | 4 +- .../DbModel/{Task => Job}/JobStepTagModel.cs | 2 +- .../DbModel/{Task => Job}/JobTaskModel.cs | 2 +- .../DbModel/{Task => Job}/JobTaskTagModel.cs | 2 +- .../DbModel/{Task => Job}/PhaseModel.cs | 2 +- .../Production/ProductionItemStepModel.cs | 2 +- .../DbModel/Production/ProductionODLModel.cs | 2 +- .../DbModel/Utils/TagsModel.cs | 2 +- EgwCoreLib.Lux.Data/ModelBuilderExtensions.cs | 2 +- .../Repository/Job/IJobStepRepository.cs | 23 +++ .../Repository/Job/IJobTaskRepository.cs | 25 +++ .../Repository/Job/JobStepRepository.cs | 121 ++++++++++++++ .../Repository/Job/JobTaskRepository.cs | 156 ++++++++++++++++++ .../Services/DataLayerServices.cs | 4 +- .../Services/Job/IJobStepService.cs | 19 +++ .../Services/Job/IJobTaskService.cs | 21 +++ .../Services/Job/JobStepService.cs | 121 ++++++++++++++ .../Services/Job/JobTaskService.cs | 145 ++++++++++++++++ Lux.API/Lux.API.csproj | 2 +- Lux.API/Program.cs | 6 + .../Compo/Item/SellingItemEdit.razor.cs | 2 +- .../Compo/JobTask/JobStepMan.razor.cs | 29 ++-- .../Compo/JobTask/JobTaskListMan.razor.cs | 33 ++-- .../Compo/JobTask/ResourcesMan.razor.cs | 2 +- Lux.UI/Components/Pages/Items.razor.cs | 8 +- Lux.UI/Components/Pages/JobRoute.razor.cs | 15 +- Lux.UI/Components/Pages/Resources.razor.cs | 2 +- Lux.UI/Lux.UI.csproj | 2 +- Lux.UI/Program.cs | 6 + Resources/ChangeLog.html | 2 +- Resources/VersNum.txt | 2 +- Resources/manifest.xml | 2 +- 39 files changed, 716 insertions(+), 68 deletions(-) rename EgwCoreLib.Lux.Data/DbModel/{Task => Job}/JobDriverConfigModel.cs (98%) rename EgwCoreLib.Lux.Data/DbModel/{Task => Job}/JobDriverModel.cs (95%) rename EgwCoreLib.Lux.Data/DbModel/{Task => Job}/JobStepItemModel.cs (97%) rename EgwCoreLib.Lux.Data/DbModel/{Task => Job}/JobStepModel.cs (97%) rename EgwCoreLib.Lux.Data/DbModel/{Task => Job}/JobStepTagModel.cs (93%) rename EgwCoreLib.Lux.Data/DbModel/{Task => Job}/JobTaskModel.cs (98%) rename EgwCoreLib.Lux.Data/DbModel/{Task => Job}/JobTaskTagModel.cs (92%) rename EgwCoreLib.Lux.Data/DbModel/{Task => Job}/PhaseModel.cs (95%) create mode 100644 EgwCoreLib.Lux.Data/Repository/Job/IJobStepRepository.cs create mode 100644 EgwCoreLib.Lux.Data/Repository/Job/IJobTaskRepository.cs create mode 100644 EgwCoreLib.Lux.Data/Repository/Job/JobStepRepository.cs create mode 100644 EgwCoreLib.Lux.Data/Repository/Job/JobTaskRepository.cs create mode 100644 EgwCoreLib.Lux.Data/Services/Job/IJobStepService.cs create mode 100644 EgwCoreLib.Lux.Data/Services/Job/IJobTaskService.cs create mode 100644 EgwCoreLib.Lux.Data/Services/Job/JobStepService.cs create mode 100644 EgwCoreLib.Lux.Data/Services/Job/JobTaskService.cs diff --git a/EgwCoreLib.Lux.Data/Controllers/LuxController.cs b/EgwCoreLib.Lux.Data/Controllers/LuxController.cs index e21199da..a22cd49d 100644 --- a/EgwCoreLib.Lux.Data/Controllers/LuxController.cs +++ b/EgwCoreLib.Lux.Data/Controllers/LuxController.cs @@ -3,10 +3,10 @@ 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.Job; using EgwCoreLib.Lux.Data.DbModel.Production; using EgwCoreLib.Lux.Data.DbModel.Sales; using EgwCoreLib.Lux.Data.DbModel.Stats; -using EgwCoreLib.Lux.Data.DbModel.Task; using EgwCoreLib.Lux.Data.DbModel.Utils; using EgwCoreLib.Lux.Data.Domains; using EgwMultiEngineManager.Data; @@ -294,6 +294,7 @@ namespace EgwCoreLib.Lux.Data.Controllers return dbResult; } +#if false /// /// Eliminazione record richiesto /// @@ -711,6 +712,7 @@ namespace EgwCoreLib.Lux.Data.Controllers } return answ; } +#endif /// /// Esegue il cloning completo di un offerta e di TUTTE le relative righe di offerta... diff --git a/EgwCoreLib.Lux.Data/DataLayerContext.cs b/EgwCoreLib.Lux.Data/DataLayerContext.cs index 1448d370..f470e8fa 100644 --- a/EgwCoreLib.Lux.Data/DataLayerContext.cs +++ b/EgwCoreLib.Lux.Data/DataLayerContext.cs @@ -6,7 +6,7 @@ using EgwCoreLib.Lux.Data.DbModel.Production; using EgwCoreLib.Lux.Data.DbModel.Sales; using EgwCoreLib.Lux.Data.DbModel.Stats; using EgwCoreLib.Lux.Data.DbModel.Stock; -using EgwCoreLib.Lux.Data.DbModel.Task; +using EgwCoreLib.Lux.Data.DbModel.Job; using EgwCoreLib.Lux.Data.DbModel.Utils; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.Configuration; diff --git a/EgwCoreLib.Lux.Data/DbModel/Cost/ResourceModel.cs b/EgwCoreLib.Lux.Data/DbModel/Cost/ResourceModel.cs index e3e9744d..8d2b713d 100644 --- a/EgwCoreLib.Lux.Data/DbModel/Cost/ResourceModel.cs +++ b/EgwCoreLib.Lux.Data/DbModel/Cost/ResourceModel.cs @@ -1,5 +1,5 @@ using EgwCoreLib.Lux.Data.DbModel.Sales; -using EgwCoreLib.Lux.Data.DbModel.Task; +using EgwCoreLib.Lux.Data.DbModel.Job; using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; diff --git a/EgwCoreLib.Lux.Data/DbModel/Items/SellingItemModel.cs b/EgwCoreLib.Lux.Data/DbModel/Items/SellingItemModel.cs index 40618a2b..238ef859 100644 --- a/EgwCoreLib.Lux.Data/DbModel/Items/SellingItemModel.cs +++ b/EgwCoreLib.Lux.Data/DbModel/Items/SellingItemModel.cs @@ -1,4 +1,4 @@ -using EgwCoreLib.Lux.Data.DbModel.Task; +using EgwCoreLib.Lux.Data.DbModel.Job; using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; using static EgwCoreLib.Lux.Core.Enums; diff --git a/EgwCoreLib.Lux.Data/DbModel/Task/JobDriverConfigModel.cs b/EgwCoreLib.Lux.Data/DbModel/Job/JobDriverConfigModel.cs similarity index 98% rename from EgwCoreLib.Lux.Data/DbModel/Task/JobDriverConfigModel.cs rename to EgwCoreLib.Lux.Data/DbModel/Job/JobDriverConfigModel.cs index 097b0cfc..928c5679 100644 --- a/EgwCoreLib.Lux.Data/DbModel/Task/JobDriverConfigModel.cs +++ b/EgwCoreLib.Lux.Data/DbModel/Job/JobDriverConfigModel.cs @@ -10,7 +10,7 @@ using System.Threading.Tasks; // // This is here so CodeMaid doesn't reorganize this document // -namespace EgwCoreLib.Lux.Data.DbModel.Task +namespace EgwCoreLib.Lux.Data.DbModel.Job { /// /// Configurazione JobDriver abilitati per un Job e relativi coefficienti di conversione verso CostDriver diff --git a/EgwCoreLib.Lux.Data/DbModel/Task/JobDriverModel.cs b/EgwCoreLib.Lux.Data/DbModel/Job/JobDriverModel.cs similarity index 95% rename from EgwCoreLib.Lux.Data/DbModel/Task/JobDriverModel.cs rename to EgwCoreLib.Lux.Data/DbModel/Job/JobDriverModel.cs index 0286607d..0eff8024 100644 --- a/EgwCoreLib.Lux.Data/DbModel/Task/JobDriverModel.cs +++ b/EgwCoreLib.Lux.Data/DbModel/Job/JobDriverModel.cs @@ -7,7 +7,7 @@ using System.Linq; using System.Text; using System.Threading.Tasks; -namespace EgwCoreLib.Lux.Data.DbModel.Task +namespace EgwCoreLib.Lux.Data.DbModel.Job { /// /// Definizione driver di calcolo dall'Engine x la stima del CostDriver equivalente tempi/costi diff --git a/EgwCoreLib.Lux.Data/DbModel/Task/JobStepItemModel.cs b/EgwCoreLib.Lux.Data/DbModel/Job/JobStepItemModel.cs similarity index 97% rename from EgwCoreLib.Lux.Data/DbModel/Task/JobStepItemModel.cs rename to EgwCoreLib.Lux.Data/DbModel/Job/JobStepItemModel.cs index 20229775..bc247746 100644 --- a/EgwCoreLib.Lux.Data/DbModel/Task/JobStepItemModel.cs +++ b/EgwCoreLib.Lux.Data/DbModel/Job/JobStepItemModel.cs @@ -5,7 +5,7 @@ using System.ComponentModel.DataAnnotations.Schema; // // This is here so CodeMaid doesn't reorganize this document // -namespace EgwCoreLib.Lux.Data.DbModel.Task +namespace EgwCoreLib.Lux.Data.DbModel.Job { [Table("task_job_step_item")] public class JobStepItemModel diff --git a/EgwCoreLib.Lux.Data/DbModel/Task/JobStepModel.cs b/EgwCoreLib.Lux.Data/DbModel/Job/JobStepModel.cs similarity index 97% rename from EgwCoreLib.Lux.Data/DbModel/Task/JobStepModel.cs rename to EgwCoreLib.Lux.Data/DbModel/Job/JobStepModel.cs index 07bc7a70..62a4f810 100644 --- a/EgwCoreLib.Lux.Data/DbModel/Task/JobStepModel.cs +++ b/EgwCoreLib.Lux.Data/DbModel/Job/JobStepModel.cs @@ -1,5 +1,5 @@ using EgwCoreLib.Lux.Data.DbModel.Cost; -using EgwCoreLib.Lux.Data.DbModel.Task; +using EgwCoreLib.Lux.Data.DbModel.Job; using EgwCoreLib.Lux.Data.DbModel.Utils; using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; @@ -7,7 +7,7 @@ using System.ComponentModel.DataAnnotations.Schema; // // This is here so CodeMaid doesn't reorganize this document // -namespace EgwCoreLib.Lux.Data.DbModel.Task +namespace EgwCoreLib.Lux.Data.DbModel.Job { /// /// Routing dei cicli di lavoro, con riferimento a risorse e fasi diff --git a/EgwCoreLib.Lux.Data/DbModel/Task/JobStepTagModel.cs b/EgwCoreLib.Lux.Data/DbModel/Job/JobStepTagModel.cs similarity index 93% rename from EgwCoreLib.Lux.Data/DbModel/Task/JobStepTagModel.cs rename to EgwCoreLib.Lux.Data/DbModel/Job/JobStepTagModel.cs index c1b3ad03..825b2021 100644 --- a/EgwCoreLib.Lux.Data/DbModel/Task/JobStepTagModel.cs +++ b/EgwCoreLib.Lux.Data/DbModel/Job/JobStepTagModel.cs @@ -6,7 +6,7 @@ using System.Linq; using System.Text; using System.Threading.Tasks; -namespace EgwCoreLib.Lux.Data.DbModel.Task +namespace EgwCoreLib.Lux.Data.DbModel.Job { [Table("task_job_step_tag")] public class JobStepTagModel diff --git a/EgwCoreLib.Lux.Data/DbModel/Task/JobTaskModel.cs b/EgwCoreLib.Lux.Data/DbModel/Job/JobTaskModel.cs similarity index 98% rename from EgwCoreLib.Lux.Data/DbModel/Task/JobTaskModel.cs rename to EgwCoreLib.Lux.Data/DbModel/Job/JobTaskModel.cs index c5e99254..2936cdaf 100644 --- a/EgwCoreLib.Lux.Data/DbModel/Task/JobTaskModel.cs +++ b/EgwCoreLib.Lux.Data/DbModel/Job/JobTaskModel.cs @@ -5,7 +5,7 @@ using System.ComponentModel.DataAnnotations.Schema; // // This is here so CodeMaid doesn't reorganize this document // -namespace EgwCoreLib.Lux.Data.DbModel.Task +namespace EgwCoreLib.Lux.Data.DbModel.Job { /// /// Definizione macro dei Cicli di Lavoro / Job diff --git a/EgwCoreLib.Lux.Data/DbModel/Task/JobTaskTagModel.cs b/EgwCoreLib.Lux.Data/DbModel/Job/JobTaskTagModel.cs similarity index 92% rename from EgwCoreLib.Lux.Data/DbModel/Task/JobTaskTagModel.cs rename to EgwCoreLib.Lux.Data/DbModel/Job/JobTaskTagModel.cs index fb868c75..2dc4caad 100644 --- a/EgwCoreLib.Lux.Data/DbModel/Task/JobTaskTagModel.cs +++ b/EgwCoreLib.Lux.Data/DbModel/Job/JobTaskTagModel.cs @@ -6,7 +6,7 @@ using System.Linq; using System.Text; using System.Threading.Tasks; -namespace EgwCoreLib.Lux.Data.DbModel.Task +namespace EgwCoreLib.Lux.Data.DbModel.Job { [Table("task_job_task_tag")] public class JobTaskTagModel diff --git a/EgwCoreLib.Lux.Data/DbModel/Task/PhaseModel.cs b/EgwCoreLib.Lux.Data/DbModel/Job/PhaseModel.cs similarity index 95% rename from EgwCoreLib.Lux.Data/DbModel/Task/PhaseModel.cs rename to EgwCoreLib.Lux.Data/DbModel/Job/PhaseModel.cs index a7990bfd..c6419f59 100644 --- a/EgwCoreLib.Lux.Data/DbModel/Task/PhaseModel.cs +++ b/EgwCoreLib.Lux.Data/DbModel/Job/PhaseModel.cs @@ -9,7 +9,7 @@ using System.Threading.Tasks; // // This is here so CodeMaid doesn't reorganize this document // -namespace EgwCoreLib.Lux.Data.DbModel.Task +namespace EgwCoreLib.Lux.Data.DbModel.Job { /// /// Fase di lavorazione / ProductionStage diff --git a/EgwCoreLib.Lux.Data/DbModel/Production/ProductionItemStepModel.cs b/EgwCoreLib.Lux.Data/DbModel/Production/ProductionItemStepModel.cs index c7f75dc6..0a111729 100644 --- a/EgwCoreLib.Lux.Data/DbModel/Production/ProductionItemStepModel.cs +++ b/EgwCoreLib.Lux.Data/DbModel/Production/ProductionItemStepModel.cs @@ -1,5 +1,5 @@ using EgwCoreLib.Lux.Data.DbModel.Cost; -using EgwCoreLib.Lux.Data.DbModel.Task; +using EgwCoreLib.Lux.Data.DbModel.Job; using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; diff --git a/EgwCoreLib.Lux.Data/DbModel/Production/ProductionODLModel.cs b/EgwCoreLib.Lux.Data/DbModel/Production/ProductionODLModel.cs index c6664394..559a30e7 100644 --- a/EgwCoreLib.Lux.Data/DbModel/Production/ProductionODLModel.cs +++ b/EgwCoreLib.Lux.Data/DbModel/Production/ProductionODLModel.cs @@ -1,7 +1,7 @@ using EgwCoreLib.Lux.Core.Generic; using EgwCoreLib.Lux.Core.RestPayload; using EgwCoreLib.Lux.Data.DbModel.Cost; -using EgwCoreLib.Lux.Data.DbModel.Task; +using EgwCoreLib.Lux.Data.DbModel.Job; using Newtonsoft.Json; using System; using System.Collections.Generic; diff --git a/EgwCoreLib.Lux.Data/DbModel/Utils/TagsModel.cs b/EgwCoreLib.Lux.Data/DbModel/Utils/TagsModel.cs index dee3cf59..6a68f6eb 100644 --- a/EgwCoreLib.Lux.Data/DbModel/Utils/TagsModel.cs +++ b/EgwCoreLib.Lux.Data/DbModel/Utils/TagsModel.cs @@ -1,4 +1,4 @@ -using EgwCoreLib.Lux.Data.DbModel.Task; +using EgwCoreLib.Lux.Data.DbModel.Job; using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; diff --git a/EgwCoreLib.Lux.Data/ModelBuilderExtensions.cs b/EgwCoreLib.Lux.Data/ModelBuilderExtensions.cs index 04cc41b6..a708d992 100644 --- a/EgwCoreLib.Lux.Data/ModelBuilderExtensions.cs +++ b/EgwCoreLib.Lux.Data/ModelBuilderExtensions.cs @@ -4,7 +4,7 @@ using EgwCoreLib.Lux.Data.DbModel.Items; using EgwCoreLib.Lux.Data.DbModel.Production; using EgwCoreLib.Lux.Data.DbModel.Sales; using EgwCoreLib.Lux.Data.DbModel.Stock; -using EgwCoreLib.Lux.Data.DbModel.Task; +using EgwCoreLib.Lux.Data.DbModel.Job; using EgwCoreLib.Lux.Data.DbModel.Utils; using Microsoft.EntityFrameworkCore; diff --git a/EgwCoreLib.Lux.Data/Repository/Job/IJobStepRepository.cs b/EgwCoreLib.Lux.Data/Repository/Job/IJobStepRepository.cs new file mode 100644 index 00000000..d685e088 --- /dev/null +++ b/EgwCoreLib.Lux.Data/Repository/Job/IJobStepRepository.cs @@ -0,0 +1,23 @@ +using EgwCoreLib.Lux.Data.DbModel.Job; + +namespace EgwCoreLib.Lux.Data.Repository.Job +{ + public interface IJobStepRepository : IBaseRepository + { + #region Public Methods + + Task AddAsync(JobStepModel entity); + + Task DeleteAsync(JobStepModel entity); + + Task GetByIdAsync(int recId); + + Task> GetByParentAsync(int jobID); + + Task MoveAsync(JobStepModel selRec, bool moveUp); + + Task UpdateAsync(JobStepModel entity); + + #endregion Public Methods + } +} diff --git a/EgwCoreLib.Lux.Data/Repository/Job/IJobTaskRepository.cs b/EgwCoreLib.Lux.Data/Repository/Job/IJobTaskRepository.cs new file mode 100644 index 00000000..913ff98c --- /dev/null +++ b/EgwCoreLib.Lux.Data/Repository/Job/IJobTaskRepository.cs @@ -0,0 +1,25 @@ +using EgwCoreLib.Lux.Data.DbModel.Job; + +namespace EgwCoreLib.Lux.Data.Repository.Job +{ + public interface IJobTaskRepository : IBaseRepository + { + #region Public Methods + + Task AddAsync(JobTaskModel entity); + + Task DeleteAsync(JobTaskModel entity); + + Task> GetAllAsync(); + + Task GetByIdAsync(int recId); + + Task MergeTagsAsync(int JobID, List reqTagList); + + Task MoveAsync(JobTaskModel selRec, bool moveUp); + + Task UpdateAsync(JobTaskModel entity); + + #endregion Public Methods + } +} \ No newline at end of file diff --git a/EgwCoreLib.Lux.Data/Repository/Job/JobStepRepository.cs b/EgwCoreLib.Lux.Data/Repository/Job/JobStepRepository.cs new file mode 100644 index 00000000..5c14f6b6 --- /dev/null +++ b/EgwCoreLib.Lux.Data/Repository/Job/JobStepRepository.cs @@ -0,0 +1,121 @@ +using EgwCoreLib.Lux.Data.DbModel.Job; +using Microsoft.EntityFrameworkCore; + +namespace EgwCoreLib.Lux.Data.Repository.Job +{ + public class JobStepRepository : BaseRepository, IJobStepRepository + { + #region Public Constructors + + public JobStepRepository(IDbContextFactory ctxFactory) : base(ctxFactory) + { + } + + #endregion Public Constructors + + #region Public Methods + + public async Task AddAsync(JobStepModel entity) + { + await using var dbCtx = await CreateContextAsync(); + await dbCtx.DbSetJobStep.AddAsync(entity); + return await dbCtx.SaveChangesAsync() > 0; + } + + public async Task DeleteAsync(JobStepModel rec2del) + { + await using var dbCtx = await CreateContextAsync(); + + var dbResult = await dbCtx.DbSetJobStep + .FirstOrDefaultAsync(x => x.JobStepID == rec2del.JobStepID); + + if (dbResult == null) + return false; + + var list2Move = await dbCtx.DbSetJobStep + .Where(x => x.JobID == rec2del.JobID && x.Index > dbResult.Index) + .ToListAsync(); + + foreach (var item in list2Move) + { + item.Index--; + dbCtx.Entry(item).State = EntityState.Modified; + } + + dbCtx.DbSetJobStep.Remove(dbResult); + + return await dbCtx.SaveChangesAsync() > 0; + } + + public async Task GetByIdAsync(int recId) + { + await using var dbCtx = await CreateContextAsync(); + return await dbCtx.DbSetJobStep.FirstOrDefaultAsync(x => x.JobStepID == recId); + } + + public async Task> GetByParentAsync(int jobID) + { + await using var dbCtx = await CreateContextAsync(); + return await dbCtx.DbSetJobStep + .Where(x => x.JobID == jobID) + .Include(c => c.JobNav) + .Include(c => c.PhaseNav) + .Include(c => c.ResourceNav) + .Include(c => c.TagNav) + .Include(c => c.ResourceNav.DriverNav) + .AsNoTracking() + .ToListAsync(); + } + + public async Task MoveAsync(JobStepModel selRec, bool moveUp) + { + await using var dbCtx = await CreateContextAsync(); + var currRec = await dbCtx.DbSetJobStep + .FirstOrDefaultAsync(x => x.JobStepID == selRec.JobStepID); + + if (currRec == null) + return false; + + int numRec = await dbCtx.DbSetJobStep + .CountAsync(x => x.JobID == selRec.JobID); + + int newPos = moveUp ? currRec.Index - 1 : currRec.Index + 1; + + bool canMove = moveUp ? newPos > 0 : newPos <= numRec; + if (!canMove) + return false; + + var otherRec = await dbCtx.DbSetJobStep + .FirstOrDefaultAsync(x => x.JobID == selRec.JobID && x.Index == newPos); + + if (otherRec == null) + return false; + + otherRec.Index = currRec.Index; + currRec.Index = newPos; + + dbCtx.Entry(otherRec).State = EntityState.Modified; + dbCtx.Entry(currRec).State = EntityState.Modified; + + return await dbCtx.SaveChangesAsync() > 0; + } + + public async Task UpdateAsync(JobStepModel entity) + { + await using var dbCtx = await CreateContextAsync(); + var trackedEntity = dbCtx.DbSetJobStep.Local.FirstOrDefault(x => x.JobStepID == entity.JobStepID); + + if (trackedEntity != null) + { + dbCtx.Entry(trackedEntity).CurrentValues.SetValues(entity); + } + else + { + dbCtx.DbSetJobStep.Update(entity); + } + return await dbCtx.SaveChangesAsync() > 0; + } + + #endregion Public Methods + } +} diff --git a/EgwCoreLib.Lux.Data/Repository/Job/JobTaskRepository.cs b/EgwCoreLib.Lux.Data/Repository/Job/JobTaskRepository.cs new file mode 100644 index 00000000..6400d28b --- /dev/null +++ b/EgwCoreLib.Lux.Data/Repository/Job/JobTaskRepository.cs @@ -0,0 +1,156 @@ +using EgwCoreLib.Lux.Data.DbModel.Job; +using Microsoft.EntityFrameworkCore; + +namespace EgwCoreLib.Lux.Data.Repository.Job +{ + public class JobTaskRepository : BaseRepository, IJobTaskRepository + { + #region Public Constructors + + public JobTaskRepository(IDbContextFactory ctxFactory) : base(ctxFactory) + { + } + + #endregion Public Constructors + + #region Public Methods + + public async Task AddAsync(JobTaskModel entity) + { + await using var dbCtx = await CreateContextAsync(); + await dbCtx.DbSetJobTask.AddAsync(entity); + return await dbCtx.SaveChangesAsync() > 0; + } + + public async Task DeleteAsync(JobTaskModel rec2del) + { + await using var dbCtx = await CreateContextAsync(); + + var dbResult = await dbCtx.DbSetJobTask + .FirstOrDefaultAsync(x => x.JobID == rec2del.JobID); + + if (dbResult == null) + return false; + + var list2Move = await dbCtx.DbSetJobTask + .Where(x => x.JobID == rec2del.JobID && x.Index > dbResult.Index) + .ToListAsync(); + + foreach (var item in list2Move) + { + item.Index--; + dbCtx.Entry(item).State = EntityState.Modified; + } + + dbCtx.DbSetJobTask.Remove(dbResult); + + return await dbCtx.SaveChangesAsync() > 0; + } + + public async Task> GetAllAsync() + { + await using var dbCtx = await CreateContextAsync(); + return await dbCtx.DbSetJobTask + .Include(c => c.TagNav) + .Include(c => c.JobStepNav) + .AsNoTracking() + .ToListAsync(); + } + + public async Task GetByIdAsync(int recId) + { + await using var dbCtx = await CreateContextAsync(); + return await dbCtx.DbSetJobTask.FirstOrDefaultAsync(x => x.JobID == recId); + } + + public async Task MergeTagsAsync(int JobID, List reqTagList) + { + await using var dbCtx = await CreateContextAsync(); + var currRec = await dbCtx.DbSetJobTask + .Where(x => x.JobID == JobID) + .Include(t => t.TagNav) + .FirstOrDefaultAsync(); + + if (currRec == null) + return false; + + var currentTags = currRec.TagNav.Select(t => t.CodTag).ToList(); + + // calcolo modifiche + var toAdd = reqTagList.Except(currentTags).ToList(); + var toRemove = currentTags.Except(reqTagList).ToList(); + + // aggiunte + foreach (var tag in toAdd) + { + currRec.TagNav.Add(new JobTaskTagModel + { + JobID = JobID, + CodTag = tag + }); + } + // rimozioni + foreach (var tag in toRemove) + { + var entity = currRec.TagNav.FirstOrDefault(t => t.CodTag == tag); + if (entity != null) + dbCtx.Remove(entity); + } + + dbCtx.Entry(currRec).State = EntityState.Modified; + + return await dbCtx.SaveChangesAsync() > 0; + } + + public async Task MoveAsync(JobTaskModel selRec, bool moveUp) + { + await using var dbCtx = await CreateContextAsync(); + var currRec = await dbCtx.DbSetJobTask + .FirstOrDefaultAsync(x => x.JobID == selRec.JobID); + + if (currRec == null) + return false; + + int numRec = await dbCtx.DbSetJobTask + .CountAsync(); + + int newPos = moveUp ? currRec.Index - 1 : currRec.Index + 1; + + bool canMove = moveUp ? newPos > 0 : newPos <= numRec; + if (!canMove) + return false; + + var otherRec = await dbCtx.DbSetJobTask + .FirstOrDefaultAsync(x => x.Index == newPos); + + if (otherRec == null) + return false; + + otherRec.Index = currRec.Index; + currRec.Index = newPos; + + dbCtx.Entry(otherRec).State = EntityState.Modified; + dbCtx.Entry(currRec).State = EntityState.Modified; + + return await dbCtx.SaveChangesAsync() > 0; + } + + public async Task UpdateAsync(JobTaskModel entity) + { + await using var dbCtx = await CreateContextAsync(); + var trackedEntity = dbCtx.DbSetJobTask.Local.FirstOrDefault(x => x.JobID == entity.JobID); + + if (trackedEntity != null) + { + dbCtx.Entry(trackedEntity).CurrentValues.SetValues(entity); + } + else + { + dbCtx.DbSetJobTask.Update(entity); + } + return await dbCtx.SaveChangesAsync() > 0; + } + + #endregion Public Methods + } +} diff --git a/EgwCoreLib.Lux.Data/Services/DataLayerServices.cs b/EgwCoreLib.Lux.Data/Services/DataLayerServices.cs index f3fb7e2c..aae363c4 100644 --- a/EgwCoreLib.Lux.Data/Services/DataLayerServices.cs +++ b/EgwCoreLib.Lux.Data/Services/DataLayerServices.cs @@ -3,9 +3,9 @@ using EgwCoreLib.Lux.Core.RestPayload; using EgwCoreLib.Lux.Data.Controllers; using EgwCoreLib.Lux.Data.DbModel.Cost; using EgwCoreLib.Lux.Data.DbModel.Items; +using EgwCoreLib.Lux.Data.DbModel.Job; using EgwCoreLib.Lux.Data.DbModel.Production; using EgwCoreLib.Lux.Data.DbModel.Sales; -using EgwCoreLib.Lux.Data.DbModel.Task; using EgwCoreLib.Lux.Data.DbModel.Utils; using EgwMultiEngineManager.Data; using Microsoft.Extensions.Configuration; @@ -316,6 +316,7 @@ namespace EgwCoreLib.Lux.Data.Services return result; } +#if false /// /// Esegue eliminazione + refresh cache /// @@ -488,6 +489,7 @@ namespace EgwCoreLib.Lux.Data.Services LogTrace($"{source} | trace: {activity?.TraceId} | {activity?.Duration.TotalMilliseconds}ms"); return result; } +#endif /// /// Esegue clone completo dell'offerta indicata e svuota la cache diff --git a/EgwCoreLib.Lux.Data/Services/Job/IJobStepService.cs b/EgwCoreLib.Lux.Data/Services/Job/IJobStepService.cs new file mode 100644 index 00000000..9e065ddc --- /dev/null +++ b/EgwCoreLib.Lux.Data/Services/Job/IJobStepService.cs @@ -0,0 +1,19 @@ +using EgwCoreLib.Lux.Data.DbModel.Job; + +namespace EgwCoreLib.Lux.Data.Services.Job +{ + public interface IJobStepService + { + #region Public Methods + + Task DeleteAsync(JobStepModel entity); + + Task> GetByParentAsync(int jobID); + + Task MoveAsync(JobStepModel selRec, bool moveUp); + + Task UpsertAsync(JobStepModel upsRec); + + #endregion Public Methods + } +} \ No newline at end of file diff --git a/EgwCoreLib.Lux.Data/Services/Job/IJobTaskService.cs b/EgwCoreLib.Lux.Data/Services/Job/IJobTaskService.cs new file mode 100644 index 00000000..c4cbb0d8 --- /dev/null +++ b/EgwCoreLib.Lux.Data/Services/Job/IJobTaskService.cs @@ -0,0 +1,21 @@ +using EgwCoreLib.Lux.Data.DbModel.Job; + +namespace EgwCoreLib.Lux.Data.Services.Job +{ + public interface IJobTaskService + { + #region Public Methods + + Task DeleteAsync(JobTaskModel entity); + + Task> GetAllAsync(); + + Task MergeTagsAsync(int JobID, List reqTagList); + + Task MoveAsync(JobTaskModel selRec, bool moveUp); + + Task UpsertAsync(JobTaskModel upsRec); + + #endregion Public Methods + } +} \ No newline at end of file diff --git a/EgwCoreLib.Lux.Data/Services/Job/JobStepService.cs b/EgwCoreLib.Lux.Data/Services/Job/JobStepService.cs new file mode 100644 index 00000000..e53ce399 --- /dev/null +++ b/EgwCoreLib.Lux.Data/Services/Job/JobStepService.cs @@ -0,0 +1,121 @@ +using EgwCoreLib.Lux.Data.DbModel.Job; +using EgwCoreLib.Lux.Data.Repository.Job; +using Microsoft.Extensions.Configuration; +using StackExchange.Redis; + +namespace EgwCoreLib.Lux.Data.Services.Job +{ + public class JobStepService : BaseServ, IJobStepService + { + #region Public Constructors + + public JobStepService( + IConfiguration config, + IConnectionMultiplexer redis, + IJobStepRepository repo) : base(config, redis) + { + _className = "JobStep"; + _repo = repo; + } + + #endregion Public Constructors + + #region Public Methods + + public async Task DeleteAsync(JobStepModel rec2del) + { + return await TraceAsync($"{_className}.Delete", async (activity) => + { + var dbResult = await _repo.GetByIdAsync(rec2del.JobStepID); + if (dbResult == null) return false; + + bool success = await _repo.DeleteAsync(dbResult); + + if (success) + { + await ClearCacheAsync($"{_redisBaseKey}:{_className}*"); + await ClearCacheAsync($"{_redisBaseKey}:JobTaskList:*"); + await ClearCacheAsync($"{_redisBaseKey}:Resources:*"); + } + + return success; + }); + } + + public async Task> GetByParentAsync(int jobID) + { + return await TraceAsync($"{_className}.GetByParent", async (activity) => + { + return await GetOrSetCacheAsync( + $"{_redisBaseKey}:{_className}:{jobID}", + async () => await _repo.GetByParentAsync(jobID), + UltraLongCache + ); + }); + } + + public async Task MoveAsync(JobStepModel selRec, bool moveUp) + { + return await TraceAsync($"{_className}.Move", async (activity) => + { + var currRec = await _repo.GetByIdAsync(selRec.JobStepID); + if (currRec == null) return false; + + string operation = "Move"; + bool success = await _repo.MoveAsync(selRec, moveUp); + if (currRec != null) + + activity?.SetTag("db.operation", operation); + + if (success) + { + await ClearCacheAsync($"{_redisBaseKey}:{_className}*"); + await ClearCacheAsync($"{_redisBaseKey}:JobTaskList:*"); + await ClearCacheAsync($"{_redisBaseKey}:Resources:*"); + } + + return success; + }); + } + + public async Task UpsertAsync(JobStepModel upsRec) + { + return await TraceAsync($"{_className}.Upsert", async (activity) => + { + var currRec = await _repo.GetByIdAsync(upsRec.JobStepID); + + string operation = "UPDATE"; + bool success = false; + if (currRec != null) + { + success = await _repo.UpdateAsync(upsRec); + } + else + { + operation = "INSERT"; + success = await _repo.AddAsync(upsRec); + } + + activity?.SetTag("db.operation", operation); + + if (success) + { + await ClearCacheAsync($"{_redisBaseKey}:{_className}*"); + await ClearCacheAsync($"{_redisBaseKey}:JobTaskList:*"); + await ClearCacheAsync($"{_redisBaseKey}:Resources:*"); + } + + return success; + }); + } + + #endregion Public Methods + + #region Private Fields + + private readonly string _className; + private readonly IJobStepRepository _repo; + + #endregion Private Fields + } +} \ No newline at end of file diff --git a/EgwCoreLib.Lux.Data/Services/Job/JobTaskService.cs b/EgwCoreLib.Lux.Data/Services/Job/JobTaskService.cs new file mode 100644 index 00000000..ae18254f --- /dev/null +++ b/EgwCoreLib.Lux.Data/Services/Job/JobTaskService.cs @@ -0,0 +1,145 @@ +using EgwCoreLib.Lux.Data.DbModel.Job; +using EgwCoreLib.Lux.Data.Repository.Job; +using Microsoft.Extensions.Configuration; +using StackExchange.Redis; + +namespace EgwCoreLib.Lux.Data.Services.Job +{ + public class JobTaskService : BaseServ, IJobTaskService + { + #region Public Constructors + + public JobTaskService( + IConfiguration config, + IConnectionMultiplexer redis, + IJobTaskRepository repo) : base(config, redis) + { + _className = "JobTask"; + _repo = repo; + } + + #endregion Public Constructors + + #region Public Methods + + public async Task DeleteAsync(JobTaskModel rec2del) + { + return await TraceAsync($"{_className}.Delete", async (activity) => + { + var dbResult = await _repo.GetByIdAsync(rec2del.JobID); + if (dbResult == null) return false; + + bool success = await _repo.DeleteAsync(dbResult); + + if (success) + { + await ClearCacheAsync($"{_redisBaseKey}:{_className}*"); + await ClearCacheAsync($"{_redisBaseKey}:JobStep:*"); + await ClearCacheAsync($"{_redisBaseKey}:Resources:*"); + } + + return success; + }); + } + + public async Task> GetAllAsync() + { + return await TraceAsync($"{_className}.GetAll", async (activity) => + { + return await GetOrSetCacheAsync( + $"{_redisBaseKey}:{_className}:ALL", + async () => await _repo.GetAllAsync(), + UltraLongCache + ); + }); + } + + public async Task MergeTagsAsync(int JobID, List reqTagList) + { + return await TraceAsync($"{_className}.MergeTags", async (activity) => + { + var currRec = await _repo.GetByIdAsync(JobID); + if (currRec == null) return false; + + string operation = "MergeTags"; + bool success = await _repo.MergeTagsAsync(JobID, reqTagList); + if (currRec != null) + + activity?.SetTag("db.operation", operation); + + if (success) + { + await ClearCacheAsync($"{_redisBaseKey}:{_className}*"); + await ClearCacheAsync($"{_redisBaseKey}:JobStep:*"); + await ClearCacheAsync($"{_redisBaseKey}:Resources:*"); + } + + return success; + }); + } + + public async Task MoveAsync(JobTaskModel selRec, bool moveUp) + { + return await TraceAsync($"{_className}.Move", async (activity) => + { + var currRec = await _repo.GetByIdAsync(selRec.JobID); + if (currRec == null) return false; + + string operation = "Move"; + bool success = await _repo.MoveAsync(selRec, moveUp); + if (currRec != null) + + activity?.SetTag("db.operation", operation); + + if (success) + { + await ClearCacheAsync($"{_redisBaseKey}:{_className}*"); + await ClearCacheAsync($"{_redisBaseKey}:JobStep:*"); + await ClearCacheAsync($"{_redisBaseKey}:Resources:*"); + } + + return success; + }); + } + + public async Task UpsertAsync(JobTaskModel upsRec) + { + return await TraceAsync($"{_className}.Upsert", async (activity) => + { + var currRec = await _repo.GetByIdAsync(upsRec.JobID); + + string operation = "UPDATE"; + bool success = false; + if (currRec != null) + { + success = await _repo.UpdateAsync(upsRec); + } + else + { + operation = "INSERT"; + success = await _repo.AddAsync(upsRec); + } + + activity?.SetTag("db.operation", operation); + + if (success) + { + await ClearCacheAsync($"{_redisBaseKey}:{_className}*"); + await ClearCacheAsync($"{_redisBaseKey}:JobStep:*"); + await ClearCacheAsync($"{_redisBaseKey}:Resources:*"); + } + + return success; + }); + } + + #endregion Public Methods + + #region Private Fields + + private readonly string _className; + private readonly IJobTaskRepository _repo; + + #endregion Private Fields + } +} \ No newline at end of file diff --git a/Lux.API/Lux.API.csproj b/Lux.API/Lux.API.csproj index 090ab4c1..2f14e283 100644 --- a/Lux.API/Lux.API.csproj +++ b/Lux.API/Lux.API.csproj @@ -4,7 +4,7 @@ net8.0 enable enable - 1.1.2603.1711 + 1.1.2603.1714 diff --git a/Lux.API/Program.cs b/Lux.API/Program.cs index d7b95a99..7d6e2821 100644 --- a/Lux.API/Program.cs +++ b/Lux.API/Program.cs @@ -1,10 +1,12 @@ using EgwCoreLib.Lux.Data; using EgwCoreLib.Lux.Data.Repository.Config; using EgwCoreLib.Lux.Data.Repository.Items; +using EgwCoreLib.Lux.Data.Repository.Job; using EgwCoreLib.Lux.Data.Repository.Utils; using EgwCoreLib.Lux.Data.Services; using EgwCoreLib.Lux.Data.Services.Config; using EgwCoreLib.Lux.Data.Services.Items; +using EgwCoreLib.Lux.Data.Services.Job; using EgwCoreLib.Lux.Data.Services.Utils; using Lux.API.Services; using Microsoft.EntityFrameworkCore; @@ -174,6 +176,8 @@ builder.Services.AddScoped(); builder.Services.AddScoped(); builder.Services.AddScoped(); builder.Services.AddScoped(); +builder.Services.AddScoped(); +builder.Services.AddScoped(); builder.Services.AddScoped(); builder.Services.AddScoped(); builder.Services.AddScoped(); @@ -186,6 +190,8 @@ builder.Services.AddScoped(); builder.Services.AddScoped(); builder.Services.AddScoped(); builder.Services.AddScoped(); +builder.Services.AddScoped(); +builder.Services.AddScoped(); builder.Services.AddScoped(); builder.Services.AddScoped(); builder.Services.AddScoped(); diff --git a/Lux.UI/Components/Compo/Item/SellingItemEdit.razor.cs b/Lux.UI/Components/Compo/Item/SellingItemEdit.razor.cs index 748b4fef..a4c18429 100644 --- a/Lux.UI/Components/Compo/Item/SellingItemEdit.razor.cs +++ b/Lux.UI/Components/Compo/Item/SellingItemEdit.razor.cs @@ -1,5 +1,5 @@ using EgwCoreLib.Lux.Data.DbModel.Items; -using EgwCoreLib.Lux.Data.DbModel.Task; +using EgwCoreLib.Lux.Data.DbModel.Job; using EgwCoreLib.Lux.Data.Services; using EgwCoreLib.Lux.Data.Services.Items; using Microsoft.AspNetCore.Components; diff --git a/Lux.UI/Components/Compo/JobTask/JobStepMan.razor.cs b/Lux.UI/Components/Compo/JobTask/JobStepMan.razor.cs index 7b4034c0..968f9b53 100644 --- a/Lux.UI/Components/Compo/JobTask/JobStepMan.razor.cs +++ b/Lux.UI/Components/Compo/JobTask/JobStepMan.razor.cs @@ -1,6 +1,7 @@ using EgwCoreLib.Lux.Data.DbModel.Cost; -using EgwCoreLib.Lux.Data.DbModel.Task; +using EgwCoreLib.Lux.Data.DbModel.Job; using EgwCoreLib.Lux.Data.Services; +using EgwCoreLib.Lux.Data.Services.Job; using Microsoft.AspNetCore.Components; using Microsoft.JSInterop; @@ -48,6 +49,9 @@ namespace Lux.UI.Components.Compo.JobTask [Inject] protected DataLayerServices DLService { get; set; } = null!; + [Inject] + protected IJobStepService JSService { get; set; } = null!; + [Inject] protected IJSRuntime JSRuntime { get; set; } = null!; @@ -118,21 +122,17 @@ namespace Lux.UI.Components.Compo.JobTask var recExist = CurrRecords.Count(x => x.Description == newRecord.Description); if (recExist > 0) { - errorMsg = $"Errore: record già esistente | {newRecord.Description}"; + errorMsg = $"Errore: record gi� esistente | {newRecord.Description}"; } else { errorMsg = ""; // faccio upsert record... - await DLService.JobStepUpsertAsync(newRecord); + await JSService.UpsertAsync(newRecord); // segnalo update x reload await EC_Updated.InvokeAsync(true); newRecord = null; addVisible = false; -#if false - // rileggo - ReloadData(); -#endif } } } @@ -140,11 +140,11 @@ namespace Lux.UI.Components.Compo.JobTask /// /// Annullamento salvataggio /// - protected async void DoCancel() + protected Task DoCancel() { editRecord = null; selRecord = null; - await EC_Updated.InvokeAsync(true); + return EC_Updated.InvokeAsync(true); } /// @@ -157,14 +157,10 @@ namespace Lux.UI.Components.Compo.JobTask return; // esegue eliminazione del record... - await DLService.JobStepDeleteAsync(rec2del); + await JSService.DeleteAsync(rec2del); // segnalo update x reload await EC_Updated.InvokeAsync(true); -#if false - // rileggo - ReloadData(); -#endif } /// @@ -175,9 +171,6 @@ namespace Lux.UI.Components.Compo.JobTask { editRecord = curRec; selRecord = curRec; -#if false - await EC_Selected.InvokeAsync(curRec); -#endif return Task.Delay(1); } @@ -201,7 +194,7 @@ namespace Lux.UI.Components.Compo.JobTask { errorMsg = ""; // faccio upsert record... - await DLService.JobStepUpsertAsync(editRecord); + await JSService.UpsertAsync(editRecord); // segnalo update x reload await EC_Updated.InvokeAsync(true); editRecord = null; diff --git a/Lux.UI/Components/Compo/JobTask/JobTaskListMan.razor.cs b/Lux.UI/Components/Compo/JobTask/JobTaskListMan.razor.cs index ed9b6a30..23835fac 100644 --- a/Lux.UI/Components/Compo/JobTask/JobTaskListMan.razor.cs +++ b/Lux.UI/Components/Compo/JobTask/JobTaskListMan.razor.cs @@ -1,9 +1,8 @@ using EgwCoreLib.Lux.Data.DbModel.Cost; -using EgwCoreLib.Lux.Data.DbModel.Task; -using EgwCoreLib.Lux.Data.DbModel.Utils; +using EgwCoreLib.Lux.Data.DbModel.Job; using EgwCoreLib.Lux.Data.Services; +using EgwCoreLib.Lux.Data.Services.Job; using Microsoft.AspNetCore.Components; -using Microsoft.AspNetCore.WebUtilities; using Microsoft.JSInterop; namespace Lux.UI.Components.Compo.JobTask @@ -50,6 +49,9 @@ namespace Lux.UI.Components.Compo.JobTask [Inject] protected IJSRuntime JSRuntime { get; set; } = null!; + [Inject] + protected IJobTaskService JTService { get; set; } = null!; + protected List ListCostDrivers { get => CostDriverLists @@ -73,13 +75,13 @@ namespace Lux.UI.Components.Compo.JobTask var recExist = CurrRecords.Count(x => x.Description == newRecord.Description); if (recExist > 0) { - errorMsg = $"Errore: record già esistente | {newRecord.Description}"; + errorMsg = $"Errore: record gi� esistente | {newRecord.Description}"; } else { errorMsg = ""; // faccio upsert record... - await DLService.JobTaskUpsertAsync(newRecord); + await JTService.UpsertAsync(newRecord); // segnalo update x reload await EC_Updated.InvokeAsync(true); newRecord = null; @@ -104,7 +106,7 @@ namespace Lux.UI.Components.Compo.JobTask return; // esegue eliminazione del record... - await DLService.JobTaskDeleteAsync(rec2del); + await JTService.DeleteAsync(rec2del); // segnalo update x reload await EC_Updated.InvokeAsync(true); @@ -116,20 +118,17 @@ namespace Lux.UI.Components.Compo.JobTask /// Edit articolo selezionato /// /// - protected async void DoEdit(JobTaskModel curRec) + protected Task DoEdit(JobTaskModel curRec) { editRecord = curRec; selRecord = curRec; -#if false - await EC_Selected.InvokeAsync(curRec); -#endif - await Task.Delay(1); + return Task.Delay(1); } /// /// Reset selezione /// - protected async void DoReset() + protected async Task DoReset() { editRecord = null; selRecord = null; @@ -141,10 +140,10 @@ namespace Lux.UI.Components.Compo.JobTask /// Selezione articolo x display info /// /// - protected async void DoSelect(JobTaskModel curRec) + protected Task DoSelect(JobTaskModel curRec) { selRecord = curRec; - await EC_Selected.InvokeAsync(curRec); + return EC_Selected.InvokeAsync(curRec); } /// @@ -245,10 +244,8 @@ namespace Lux.UI.Components.Compo.JobTask private async Task DoSaveTags(TagDisplay.SavePayload args) { // chiamo update - await DLService.JobTask2TagsUpsertAsync(args.Id, args.Tags); + await JTService.MergeTagsAsync(args.Id, args.Tags); await EC_Updated.InvokeAsync(true); - //// refresh! - //ResetEdit(); } /// @@ -259,7 +256,7 @@ namespace Lux.UI.Components.Compo.JobTask /// private async Task MoveRec(JobTaskModel curRec, bool moveUp) { - await DLService.JobTaskMoveAsync(curRec, moveUp); + await JTService.MoveAsync(curRec, moveUp); await EC_Updated.InvokeAsync(true); } diff --git a/Lux.UI/Components/Compo/JobTask/ResourcesMan.razor.cs b/Lux.UI/Components/Compo/JobTask/ResourcesMan.razor.cs index a2efed64..a44c3ce4 100644 --- a/Lux.UI/Components/Compo/JobTask/ResourcesMan.razor.cs +++ b/Lux.UI/Components/Compo/JobTask/ResourcesMan.razor.cs @@ -1,5 +1,5 @@ using EgwCoreLib.Lux.Data.DbModel.Cost; -using EgwCoreLib.Lux.Data.DbModel.Task; +using EgwCoreLib.Lux.Data.DbModel.Job; using EgwCoreLib.Lux.Data.Services; using Microsoft.AspNetCore.Components; using Microsoft.AspNetCore.DataProtection; diff --git a/Lux.UI/Components/Pages/Items.razor.cs b/Lux.UI/Components/Pages/Items.razor.cs index edc335c6..a4df052c 100644 --- a/Lux.UI/Components/Pages/Items.razor.cs +++ b/Lux.UI/Components/Pages/Items.razor.cs @@ -1,8 +1,9 @@ using EgwCoreLib.Lux.Core; using EgwCoreLib.Lux.Data.DbModel.Items; -using EgwCoreLib.Lux.Data.DbModel.Task; +using EgwCoreLib.Lux.Data.DbModel.Job; using EgwCoreLib.Lux.Data.Services; using EgwCoreLib.Lux.Data.Services.Items; +using EgwCoreLib.Lux.Data.Services.Job; using Microsoft.AspNetCore.Components; namespace Lux.UI.Components.Pages @@ -45,6 +46,9 @@ namespace Lux.UI.Components.Pages [Inject] private DataLayerServices DLService { get; set; } = null!; + [Inject] + private IJobTaskService JTService { get; set; } = null!; + [Inject] private IItemService IService { get; set; } = null!; @@ -139,7 +143,7 @@ namespace Lux.UI.Components.Pages private async Task ReloadBaseData() { ListItemGroup = await DLService.ItemGroupGetAllAsync(); - ListJobTask = await DLService.JobTaskGetAllAsync(); + ListJobTask = await JTService.GetAllAsync(); isLoading = false; } diff --git a/Lux.UI/Components/Pages/JobRoute.razor.cs b/Lux.UI/Components/Pages/JobRoute.razor.cs index abfec7b4..edf6f2fe 100644 --- a/Lux.UI/Components/Pages/JobRoute.razor.cs +++ b/Lux.UI/Components/Pages/JobRoute.razor.cs @@ -1,6 +1,7 @@ using EgwCoreLib.Lux.Data.DbModel.Cost; -using EgwCoreLib.Lux.Data.DbModel.Task; +using EgwCoreLib.Lux.Data.DbModel.Job; using EgwCoreLib.Lux.Data.Services; +using EgwCoreLib.Lux.Data.Services.Job; using Microsoft.AspNetCore.Components; namespace Lux.UI.Components.Pages @@ -12,6 +13,12 @@ namespace Lux.UI.Components.Pages [Inject] protected DataLayerServices DLService { get; set; } = null!; + [Inject] + protected IJobStepService JSService { get; set; } = null!; + + [Inject] + protected IJobTaskService JTService { get; set; } = null!; + #endregion Protected Properties #region Protected Methods @@ -68,7 +75,7 @@ namespace Lux.UI.Components.Pages ListCostDrivers = await DLService.CostDriverGetAllAsync(); ListPhases = await DLService.PhasesGetAllAsync(); ListResources = await DLService.ResourcesGetAllAsync(); - ListJobTask = await DLService.JobTaskGetAllAsync(); + ListJobTask = await JTService.GetAllAsync(); ListStep = null; isLoading = false; } @@ -82,7 +89,7 @@ namespace Lux.UI.Components.Pages { if (selRecord != null) { - ListStep = await DLService.JobStepGetAsync(selRecord.JobID); + ListStep = await JSService.GetByParentAsync(selRecord.JobID); } else { @@ -100,7 +107,7 @@ namespace Lux.UI.Components.Pages // ricarico dal DB if (selRec != null) { - ListStep = await DLService.JobStepGetAsync(selRec.JobID); + ListStep = await JSService.GetByParentAsync(selRec.JobID); } else { diff --git a/Lux.UI/Components/Pages/Resources.razor.cs b/Lux.UI/Components/Pages/Resources.razor.cs index 4482ec91..ad9eb98d 100644 --- a/Lux.UI/Components/Pages/Resources.razor.cs +++ b/Lux.UI/Components/Pages/Resources.razor.cs @@ -1,5 +1,5 @@ using EgwCoreLib.Lux.Data.DbModel.Cost; -using EgwCoreLib.Lux.Data.DbModel.Task; +using EgwCoreLib.Lux.Data.DbModel.Job; using EgwCoreLib.Lux.Data.Services; using Lux.UI.Components.Compo.JobTask; using Microsoft.AspNetCore.Components; diff --git a/Lux.UI/Lux.UI.csproj b/Lux.UI/Lux.UI.csproj index b670f31b..8b7f1ce4 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 - 1.1.2603.1711 + 1.1.2603.1714 diff --git a/Lux.UI/Program.cs b/Lux.UI/Program.cs index d9cf259b..0bed67b7 100644 --- a/Lux.UI/Program.cs +++ b/Lux.UI/Program.cs @@ -1,10 +1,12 @@ using EgwCoreLib.Lux.Data; using EgwCoreLib.Lux.Data.Repository.Config; using EgwCoreLib.Lux.Data.Repository.Items; +using EgwCoreLib.Lux.Data.Repository.Job; using EgwCoreLib.Lux.Data.Repository.Utils; using EgwCoreLib.Lux.Data.Services; using EgwCoreLib.Lux.Data.Services.Config; using EgwCoreLib.Lux.Data.Services.Items; +using EgwCoreLib.Lux.Data.Services.Job; using EgwCoreLib.Lux.Data.Services.Utils; using Lux.UI.Components; using Lux.UI.Components.Account; @@ -212,6 +214,8 @@ builder.Services.AddScoped(); builder.Services.AddScoped(); builder.Services.AddScoped(); builder.Services.AddScoped(); +builder.Services.AddScoped(); +builder.Services.AddScoped(); builder.Services.AddScoped(); builder.Services.AddScoped(); builder.Services.AddScoped(); @@ -224,6 +228,8 @@ builder.Services.AddScoped(); builder.Services.AddScoped(); builder.Services.AddScoped(); builder.Services.AddScoped(); +builder.Services.AddScoped(); +builder.Services.AddScoped(); builder.Services.AddScoped(); builder.Services.AddScoped(); builder.Services.AddScoped(); diff --git a/Resources/ChangeLog.html b/Resources/ChangeLog.html index e953f775..048c181b 100644 --- a/Resources/ChangeLog.html +++ b/Resources/ChangeLog.html @@ -1,6 +1,6 @@ LUX - Web Windows MES -

Versione: 1.1.2603.1711

+

Versione: 1.1.2603.1714


Note di rilascio:
  • diff --git a/Resources/VersNum.txt b/Resources/VersNum.txt index 45ee234c..f6a1306f 100644 --- a/Resources/VersNum.txt +++ b/Resources/VersNum.txt @@ -1 +1 @@ -1.1.2603.1711 +1.1.2603.1714 diff --git a/Resources/manifest.xml b/Resources/manifest.xml index a9c20312..f2ca5d88 100644 --- a/Resources/manifest.xml +++ b/Resources/manifest.xml @@ -1,6 +1,6 @@ - 1.1.2603.1711 + 1.1.2603.1714 http://nexus.steamware.net/repository/SWS/GPW/stable/GPW.UI.zip http://nexus.steamware.net/repository/SWS/GPW/stable/ChangeLog.html false