Completamento move DataLayerServices

This commit is contained in:
Samuele Locatelli
2026-03-24 12:55:16 +01:00
parent fe03d05930
commit 53e69c0b78
34 changed files with 415 additions and 372 deletions
@@ -6,7 +6,6 @@ using EgwCoreLib.Lux.Data.Repository.Production;
using EgwCoreLib.Lux.Data.Repository.Sales;
using EgwCoreLib.Lux.Data.Repository.Stats;
using EgwCoreLib.Lux.Data.Repository.Utils;
using EgwCoreLib.Lux.Data.Services;
using EgwCoreLib.Lux.Data.Services.Config;
using EgwCoreLib.Lux.Data.Services.Cost;
using EgwCoreLib.Lux.Data.Services.General;
@@ -100,7 +99,7 @@ namespace EgwCoreLib.Lux.Data
services.TryAddScoped<ITemplateRowService, TemplateRowService>();
// Facade / DataLayerService
services.TryAddScoped<DataLayerServices>();
services.TryAddScoped<IDataLayerServices, DataLayerServices>();
services.TryAddScoped<ICalcRuidService, CalcRuidService>();
//builder.Services.AddSingleton<DataLayerServices>();
//services.TryAddScoped<IDataLayerServices, DataLayerServices>();
@@ -14,9 +14,9 @@ using StackExchange.Redis;
using System.Diagnostics;
using System.Runtime.CompilerServices;
namespace EgwCoreLib.Lux.Data.Services
namespace EgwCoreLib.Lux.Data.Services.General
{
public class DataLayerServices : BaseServ
public class DataLayerServices : BaseServ, IDataLayerServices
{
#region Public Constructors
@@ -66,7 +66,7 @@ namespace EgwCoreLib.Lux.Data.Services
/// <param name="dtStart"></param>
/// <param name="dtEnd"></param>
/// <returns></returns>
public async Task<Dictionary<string, List<EventDto>>?> PlannerGetEvents(DateTime dtStart, DateTime dtEnd)
public async Task<Dictionary<string, List<EventDto>>?> PlannerGetEventsAsync(DateTime dtStart, DateTime dtEnd)
{
using var activity = StartActivity();
string source = "DB";
@@ -0,0 +1,84 @@
using EgwCoreLib.Lux.Core.Generic;
using EgwCoreLib.Lux.Data.Services.Internal;
using EgwMultiEngineManager.Data;
namespace EgwCoreLib.Lux.Data.Services.General
{
/// <summary>
/// Interfaccia servizio livello dati (orchestrazione)
/// </summary>
public interface IDataLayerServices
{
#region Public Properties
public MessagePipe PipeBom { get; set; }
public MessagePipe PipeHwList { get; set; }
public MessagePipe PipeHwOpt { get; set; }
public MessagePipe PipePng { get; set; }
public MessagePipe PipeProd { get; set; }
public MessagePipe PipeProfElement { get; set; }
public MessagePipe PipeProfList { get; set; }
public MessagePipe PipeShape { get; set; }
public MessagePipe PipeSvg { get; set; }
public MessagePipe PipeUpdate { get; set; }
#endregion Public Properties
#region Public Methods
/// <summary>
/// Reset completo cache sistema (modalità async)
/// </summary>
/// <param name="cancellationToken">Token di cancellazione</param>
/// <returns>Task di completamento</returns>
Task FlushCacheAsync();
/// <summary>
/// Restituisce un dizionario di EventDto da usare nel planner
/// </summary>
/// <param name="dtStart">Data inizio</param>
/// <param name="dtEnd">Data fine</param>
/// <returns>Dizionario fasi -> eventi</returns>
Task<Dictionary<string, List<EventDto>>?> PlannerGetEventsAsync(DateTime dtStart, DateTime dtEnd);
/// <summary>
/// Esegue salvataggio BOM sul DB
/// </summary>
/// <param name="uID">UID dell'item offerta</param>
/// <param name="qMode">Mode della chiamata</param>
/// <param name="execEnvironment">Environment dell'item</param>
/// <param name="bomContent">BOM serializzata</param>
/// <returns>Task di completamento</returns>
Task SaveBomAsync(string uID, Egw.Window.Data.Enums.QuestionModes qMode, Constants.EXECENVIRONMENTS execEnvironment, string bomContent);
/// <summary>
/// Esegue salvataggio ProdBalance (di un gruppo lavorazioni per riga ordine) sul DB
/// </summary>
/// <param name="uID">UID dell'item offerta</param>
/// <param name="rGroup">Prod Group di riferimento</param>
/// <param name="execEnvironment">Environment dell'item</param>
/// <param name="balance">Stima Balance serializzata</param>
/// <returns>True se salvato con successo</returns>
Task<bool> SaveProdBalanceAsync(string uID, string rGroup, Constants.EXECENVIRONMENTS execEnvironment, string balance);
/// <summary>
/// Esegue salvataggio ProdEstimate (per riga ordine) sul DB
/// </summary>
/// <param name="uID">UID dell'item offerta</param>
/// <param name="execEnvironment">Environment dell'item</param>
/// <param name="prodEstim">Stima ProdEstimate serializzata</param>
/// <returns>True se salvato con successo</returns>
Task<bool> SaveProdEstimateAsync(string uID, Constants.EXECENVIRONMENTS execEnvironment, string prodEstim);
#endregion Public Methods
}
}
+1 -1
View File
@@ -189,7 +189,7 @@ namespace Lux.API.Controllers
#region Private Properties
private DataLayerServices _DSService { get; set; }
private IDataLayerServices _DSService { get; set; }
private IOfferRowService _OffRService { get; set; }
private IOrderRowService _OrdRService { get; set; }
private ImageCacheService _imgService { get; set; }
@@ -1,6 +1,6 @@
using EgwCoreLib.Lux.Data.DbModel.Config;
using EgwCoreLib.Lux.Data.Services;
using EgwCoreLib.Lux.Data.Services.Config;
using EgwCoreLib.Lux.Data.Services.General;
using Microsoft.AspNetCore.Components;
using Microsoft.JSInterop;
@@ -14,7 +14,7 @@ namespace Lux.UI.Components.Compo.Config
protected IConfGlassService CGService { get; set; } = null!;
[Inject]
protected DataLayerServices DLService { get; set; } = null!;
protected IDataLayerServices DLService { get; set; } = null!;
[Inject]
protected IJSRuntime JSRuntime { get; set; } = null!;
@@ -1,6 +1,5 @@
using EgwCoreLib.Lux.Core.RestPayload;
using EgwCoreLib.Lux.Data.DbModel.Config;
using EgwCoreLib.Lux.Data.Services;
using EgwCoreLib.Lux.Data.Services.General;
using EgwMultiEngineManager.Data;
using Microsoft.AspNetCore.Components;
@@ -89,7 +88,7 @@ namespace Lux.UI.Components.Compo.Config
private ICalcRequestService CService { get; set; } = null!;
[Inject]
private DataLayerServices DLService { get; set; } = null!;
private IDataLayerServices DLService { get; set; } = null!;
[Inject]
private IJSRuntime JSRuntime { get; set; } = null!;
@@ -105,7 +105,7 @@ namespace Lux.UI.Components.Compo.Config
}
[Inject]
private DataLayerServices DLService { get; set; } = null!;
private IDataLayerServices DLService { get; set; } = null!;
[Inject]
private IJSRuntime JSRuntime { get; set; } = null!;
@@ -1,6 +1,6 @@
using EgwCoreLib.Lux.Data.DbModel.Config;
using EgwCoreLib.Lux.Data.Services;
using EgwCoreLib.Lux.Data.Services.Config;
using EgwCoreLib.Lux.Data.Services.General;
using Microsoft.AspNetCore.Components;
using Microsoft.JSInterop;
@@ -40,7 +40,7 @@ namespace Lux.UI.Components.Compo.Config
private IConfWoodService CWService { get; set; } = null!;
[Inject]
private DataLayerServices DLService { get; set; } = null!;
private IDataLayerServices DLService { get; set; } = null!;
[Inject]
private IJSRuntime JSRuntime { get; set; } = null!;
+123 -123
View File
@@ -1,7 +1,7 @@
using EgwCoreLib.Lux.Core.RestPayload;
using EgwCoreLib.Lux.Data.DbModel.Items;
using EgwCoreLib.Lux.Data.DbModel.Sales;
using EgwCoreLib.Lux.Data.Services;
using EgwCoreLib.Lux.Data.Services.General;
using EgwCoreLib.Lux.Data.Services.Items;
using EgwMultiEngineManager.Data;
using Microsoft.AspNetCore.Components;
@@ -28,107 +28,25 @@ namespace Lux.UI.Components.Compo
#region Protected Properties
[Inject]
protected DataLayerServices DLService { get; set; } = null!;
[Inject]
protected IItemService IService { get; set; } = null!;
protected double ImportoTotale
protected bool showMassEditSave
{
get
{
double valTot = 0;
if (bomDict != null)
{
valTot = bomDict.Sum(x => x.TotalCost);
}
return valTot;
}
}
protected double QtyTotale
{
get
{
double valTot = 0;
if (bomDict != null)
{
valTot = bomDict.Sum(x => x.Qty);
}
return valTot;
}
}
protected int TotItemQty
{
get
{
int numTot = 0;
if (bomDict != null)
{
numTot = bomDict.Sum(x => x.ItemQty);
}
return numTot;
}
}
protected bool SelAll
{
get => selAll;
set
{
if (selAll != value)
{
selAll = value;
foreach (var item in bomDict)
{
item.isSelected = selAll;
}
}
}
}
protected double VolTotale
{
get
{
double valTot = 0;
if (bomDict != null)
{
valTot = bomDict.Sum(x => x.Volume);
}
return valTot;
}
get => bomDict != null && bomDict.Any(x => x.isSelected);
}
#endregion Protected Properties
#region Protected Methods
protected void DoCancel()
protected async Task ForceItemPrice()
{
EditRecord = null;
isLoading = false;
}
protected async Task DoEdit(BomDtoSel editRec)
{
if (editRec.ItemID > 0)
{
// carico elenco alternative...
ListItemAlt = await IService.GetAltAsync(editRec.ItemID);
// riordino...
ListItemAlt = ListItemAlt
.OrderBy(x => x.ItemIDParent)
.ThenBy(x => x.Description)
.ToList();
}
else
{
ListItemAlt = new List<ItemModel>();
}
EditRecord = editRec;
isLoading = true;
// chiamo metodo update x i soli valori selezionati...
var list2upd = bomDict.Where(x => x.isSelected).Cast<BomItemDTO>().ToList();
await IService.MassUpdateAsync(list2upd, totCost, (double)defMargin, defQtyMax, defUM, defRound);
// ...e passo al controller parent LINQ projection to base type
List<BomItemDTO> baseList = bomDict.Cast<BomItemDTO>().ToList();
await EC_Updated.InvokeAsync(baseList);
SelAll = false;
}
/// <summary>
@@ -166,18 +84,6 @@ namespace Lux.UI.Components.Compo
}
}
protected void SaveNumRec(int newNum)
{
numRecord = newNum;
UpdateTable();
}
protected void SavePage(int newNum)
{
currPage = newNum;
UpdateTable();
}
#endregion Protected Methods
#region Private Fields
@@ -215,23 +121,6 @@ namespace Lux.UI.Components.Compo
#endregion Private Fields
protected async Task ForceItemPrice()
{
isLoading = true;
// chiamo metodo update x i soli valori selezionati...
var list2upd = bomDict.Where(x => x.isSelected).Cast<BomItemDTO>().ToList();
await IService.MassUpdateAsync(list2upd, totCost, (double)defMargin, defQtyMax, defUM, defRound);
// ...e passo al controller parent LINQ projection to base type
List<BomItemDTO> baseList = bomDict.Cast<BomItemDTO>().ToList();
await EC_Updated.InvokeAsync(baseList);
SelAll = false;
}
protected bool showMassEditSave
{
get => bomDict != null && bomDict.Any(x => x.isSelected);
}
#region Protected Classes
protected class BomDtoSel : BomItemDTO
@@ -248,15 +137,114 @@ namespace Lux.UI.Components.Compo
#region Private Properties
[Inject]
private IDataLayerServices DLService { get; set; } = null!;
private double ImportoTotale
{
get
{
double valTot = 0;
if (bomDict != null)
{
valTot = bomDict.Sum(x => x.TotalCost);
}
return valTot;
}
}
[Inject]
private IItemService IService { get; set; } = null!;
private double QtyTotale
{
get
{
double valTot = 0;
if (bomDict != null)
{
valTot = bomDict.Sum(x => x.Qty);
}
return valTot;
}
}
private bool SelAll
{
get => selAll;
set
{
if (selAll != value)
{
selAll = value;
foreach (var item in bomDict)
{
item.isSelected = selAll;
}
}
}
}
private bool ShowVolume
{
get => CurrRowRec.Envir == Constants.EXECENVIRONMENTS.BEAM || CurrRowRec.Envir == Constants.EXECENVIRONMENTS.WALL;
}
private int TotItemQty
{
get
{
int numTot = 0;
if (bomDict != null)
{
numTot = bomDict.Sum(x => x.ItemQty);
}
return numTot;
}
}
private double VolTotale
{
get
{
double valTot = 0;
if (bomDict != null)
{
valTot = bomDict.Sum(x => x.Volume);
}
return valTot;
}
}
#endregion Private Properties
#region Private Methods
private void DoCancel()
{
EditRecord = null;
isLoading = false;
}
private async Task DoEdit(BomDtoSel editRec)
{
if (editRec.ItemID > 0)
{
// carico elenco alternative...
ListItemAlt = await IService.GetAltAsync(editRec.ItemID);
// riordino...
ListItemAlt = ListItemAlt
.OrderBy(x => x.ItemIDParent)
.ThenBy(x => x.Description)
.ToList();
}
else
{
ListItemAlt = new List<ItemModel>();
}
EditRecord = editRec;
}
/// <summary>
/// Salvataggio con conversion a list + ritorno a parent
/// </summary>
@@ -276,6 +264,18 @@ namespace Lux.UI.Components.Compo
await EC_Updated.InvokeAsync(baseList);
}
private void SaveNumRec(int newNum)
{
numRecord = newNum;
UpdateTable();
}
private void SavePage(int newNum)
{
currPage = newNum;
UpdateTable();
}
/// <summary>
/// Update item nel dictionary
/// </summary>
@@ -38,7 +38,7 @@ namespace Lux.UI.Components.Compo.FileMan
#region Private Properties
[Inject]
private DataLayerServices DLService { get; set; } = null!;
private IDataLayerServices DLService { get; set; } = null!;
[Inject]
private IOfferRowService ORService { get; set; } = null!;
@@ -1,6 +1,5 @@
using EgwCoreLib.Lux.Core;
using EgwCoreLib.Lux.Data.DbModel.Items;
using EgwCoreLib.Lux.Data.Services;
using EgwCoreLib.Lux.Data.Services.Items;
using Microsoft.AspNetCore.Components;
@@ -55,9 +54,6 @@ namespace Lux.UI.Components.Compo.Item
#region Private Properties
[Inject]
private DataLayerServices DLService { get; set; } = null!;
[Inject]
private IItemGroupService IGService { get; set; } = null!;
+2 -10
View File
@@ -1,6 +1,6 @@
using EgwCoreLib.Lux.Core;
using EgwCoreLib.Lux.Data.DbModel.Items;
using EgwCoreLib.Lux.Data.Services;
using EgwCoreLib.Lux.Data.Services.General;
using EgwCoreLib.Lux.Data.Services.Items;
using Microsoft.AspNetCore.Components;
using Microsoft.JSInterop;
@@ -56,7 +56,7 @@ namespace Lux.UI.Components.Compo.Item
#region Private Properties
[Inject]
private DataLayerServices DLService { get; set; } = null!;
private IDataLayerServices DLService { get; set; } = null!;
[Inject]
private IItemService IService { get; set; } = null!;
@@ -66,14 +66,6 @@ namespace Lux.UI.Components.Compo.Item
#endregion Private Properties
#if false
private async Task DoCancel()
{
await ResetEdit();
UpdateTable();
}
#endif
#region Private Methods
/// <summary>
@@ -38,7 +38,7 @@ namespace Lux.UI.Components.Compo.Item
#region Private Properties
[Inject]
private DataLayerServices DLService { get; set; } = null!;
private IDataLayerServices DLService { get; set; } = null!;
[Inject]
private IFileService FService { get; set; } = null!;
@@ -86,7 +86,7 @@ namespace Lux.UI.Components.Compo.Item
private IConfiguration Config { get; set; } = null!;
[Inject]
private DataLayerServices DLService { get; set; } = null!;
private IDataLayerServices DLService { get; set; } = null!;
[Inject]
private IImageCacheService ICService { get; set; } = null!;
@@ -1,6 +1,6 @@
using EgwCoreLib.Lux.Data.DbModel.Cost;
using EgwCoreLib.Lux.Data.DbModel.Job;
using EgwCoreLib.Lux.Data.Services;
using EgwCoreLib.Lux.Data.Services.General;
using EgwCoreLib.Lux.Data.Services.Job;
using Microsoft.AspNetCore.Components;
using Microsoft.JSInterop;
@@ -44,21 +44,50 @@ namespace Lux.UI.Components.Compo.JobTask
#endregion Protected Fields
#region Protected Properties
#region Protected Methods
protected override void OnParametersSet()
{
ReloadData();
}
#endregion Protected Methods
#region Private Fields
private bool addVisible = false;
private int currPage = 1;
private JobStepModel? editRecord = null;
private string errorMsg = "";
private JobStepModel? newRecord = null;
private int numRecord = 10;
private JobStepModel? selRecord = null;
private int totalCount = 0;
#endregion Private Fields
#region Private Properties
[Inject]
protected DataLayerServices DLService { get; set; } = null!;
private IDataLayerServices DLService { get; set; } = null!;
[Inject]
protected IJobStepService JSService { get; set; } = null!;
private IJSRuntime JSRuntime { get; set; } = null!;
[Inject]
protected IJSRuntime JSRuntime { get; set; } = null!;
private IJobStepService JSService { get; set; } = null!;
/// <summary>
/// Elenco ordinato fasi
/// </summary>
protected List<PhaseModel> ListPhasesOrd
private List<PhaseModel> ListPhasesOrd
{
get => ListPhases.OrderBy(x => x.CodPhase).ThenBy(x => x.Name).ToList();
}
@@ -66,12 +95,12 @@ namespace Lux.UI.Components.Compo.JobTask
/// <summary>
/// Elenco ordinato risorse
/// </summary>
protected List<ResourceModel> ListResourcesOrd
private List<ResourceModel> ListResourcesOrd
{
get => ListResources.OrderBy(x => x.CodResource).ThenBy(x => x.Name).ToList();
}
protected int PhaseId
private int PhaseId
{
get => newRecord != null ? newRecord.PhaseID : 0;
set
@@ -83,7 +112,7 @@ namespace Lux.UI.Components.Compo.JobTask
}
}
protected decimal ProductivityRateProxy
private decimal ProductivityRateProxy
{
get => editRecord != null ? Math.Round(editRecord.ProductivityRate, 3) : 0;
set
@@ -95,7 +124,7 @@ namespace Lux.UI.Components.Compo.JobTask
}
}
protected int ResourceId
private int ResourceId
{
get => newRecord != null ? newRecord.ResourceID : 0;
set
@@ -107,14 +136,29 @@ namespace Lux.UI.Components.Compo.JobTask
}
}
#endregion Protected Properties
#endregion Private Properties
#region Protected Methods
#region Private Methods
/// <summary>
/// Check selezione riga item
/// </summary>
/// <param name="curRec"></param>
/// <returns></returns>
private string checkSel(JobStepModel curRec)
{
string answ = "";
if (selRecord != null)
{
answ = curRec.JobStepID == selRecord.JobStepID ? "table-info" : "";
}
return answ;
}
/// <summary>
/// Genera nuovo record e lo salva
/// </summary>
protected async Task DoAdd()
private async Task DoAdd()
{
if (newRecord != null)
{
@@ -140,7 +184,7 @@ namespace Lux.UI.Components.Compo.JobTask
/// <summary>
/// Annullamento salvataggio
/// </summary>
protected Task DoCancel()
private Task DoCancel()
{
editRecord = null;
selRecord = null;
@@ -151,7 +195,7 @@ namespace Lux.UI.Components.Compo.JobTask
/// Eliminazione record
/// </summary>
/// <param name="rec2del"></param>
protected async Task DoDelete(JobStepModel rec2del)
private async Task DoDelete(JobStepModel rec2del)
{
if (!await JSRuntime.InvokeAsync<bool>("confirm", $"Sicuro di voler eliminare il record? {rec2del.Description} ({rec2del.JobStepID})"))
return;
@@ -167,7 +211,7 @@ namespace Lux.UI.Components.Compo.JobTask
/// Edit articolo selezionato
/// </summary>
/// <param name="curRec"></param>
protected Task DoEdit(JobStepModel curRec)
private Task DoEdit(JobStepModel curRec)
{
editRecord = curRec;
selRecord = curRec;
@@ -177,7 +221,7 @@ namespace Lux.UI.Components.Compo.JobTask
/// <summary>
/// Reset selezione
/// </summary>
protected Task DoReset()
private Task DoReset()
{
editRecord = null;
selRecord = null;
@@ -188,7 +232,7 @@ namespace Lux.UI.Components.Compo.JobTask
/// Effettua salvataggio record
/// </summary>
/// <returns></returns>
protected async Task DoSave()
private async Task DoSave()
{
if (editRecord != null)
{
@@ -206,68 +250,12 @@ namespace Lux.UI.Components.Compo.JobTask
/// Selezione articolo x display info
/// </summary>
/// <param name="curRec"></param>
protected Task DoSelect(JobStepModel curRec)
private Task DoSelect(JobStepModel curRec)
{
selRecord = curRec;
return EC_Selected.InvokeAsync(curRec);
}
protected override void OnParametersSet()
{
ReloadData();
}
protected void ToggleAdd()
{
addVisible = !addVisible;
if (addVisible)
{
newRecord = new JobStepModel()
{
JobID = CurrJob.JobID,
Index = totalCount + 1,
Description = $"Fase {totalCount + 1}",
PhaseID = 0,
ResourceID = 0
};
}
}
#endregion Protected Methods
#region Private Fields
private bool addVisible = false;
private int currPage = 1;
private JobStepModel? editRecord = null;
private string errorMsg = "";
private JobStepModel? newRecord = null;
private int numRecord = 10;
private JobStepModel? selRecord = null;
private int totalCount = 0;
#endregion Private Fields
#region Private Methods
/// <summary>
/// Check selezione riga item
/// </summary>
/// <param name="curRec"></param>
/// <returns></returns>
private string checkSel(JobStepModel curRec)
{
string answ = "";
if (selRecord != null)
{
answ = curRec.JobStepID == selRecord.JobStepID ? "table-info" : "";
}
return answ;
}
private void ReloadData()
{
if (CurrRecords != null)
@@ -293,6 +281,22 @@ namespace Lux.UI.Components.Compo.JobTask
}
}
private void ToggleAdd()
{
addVisible = !addVisible;
if (addVisible)
{
newRecord = new JobStepModel()
{
JobID = CurrJob.JobID,
Index = totalCount + 1,
Description = $"Fase {totalCount + 1}",
PhaseID = 0,
ResourceID = 0
};
}
}
#endregion Private Methods
}
}
@@ -1,6 +1,6 @@
using EgwCoreLib.Lux.Data.DbModel.Cost;
using EgwCoreLib.Lux.Data.DbModel.Job;
using EgwCoreLib.Lux.Data.Services;
using EgwCoreLib.Lux.Data.Services.General;
using EgwCoreLib.Lux.Data.Services.Job;
using Microsoft.AspNetCore.Components;
using Microsoft.JSInterop;
@@ -34,25 +34,47 @@ namespace Lux.UI.Components.Compo.JobTask
#endregion Public Properties
#region Protected Fields
#region Protected Methods
protected List<JobTaskModel> FiltRecords = new List<JobTaskModel>();
protected List<JobTaskModel> ListRecords = new List<JobTaskModel>();
protected override void OnParametersSet()
{
ReloadData();
}
#endregion Protected Fields
#endregion Protected Methods
#region Protected Properties
#region Private Fields
private bool addVisible = false;
private int currPage = 1;
private JobTaskModel? editRecord = null;
private string errorMsg = "";
private List<JobTaskModel> FiltRecords = new List<JobTaskModel>();
private bool isLoading = false;
private List<JobTaskModel> ListRecords = new List<JobTaskModel>();
private JobTaskModel? newRecord = null;
private int numRecord = 10;
private JobTaskModel? selRecord = null;
private int totalCount = 0;
#endregion Private Fields
#region Private Properties
[Inject]
protected DataLayerServices DLService { get; set; } = null!;
private IDataLayerServices DLService { get; set; } = null!;
[Inject]
protected IJSRuntime JSRuntime { get; set; } = null!;
private IJSRuntime JSRuntime { get; set; } = null!;
[Inject]
protected IJobTaskService JTService { get; set; } = null!;
private IJobTaskService JTService { get; set; } = null!;
protected List<string> ListCostDrivers
private List<string> ListCostDrivers
{
get => CostDriverLists
.Select(x => x.Name)
@@ -60,14 +82,29 @@ namespace Lux.UI.Components.Compo.JobTask
.ToList();
}
#endregion Protected Properties
#endregion Private Properties
#region Protected Methods
#region Private Methods
/// <summary>
/// Check selezione riga item
/// </summary>
/// <param name="curRec"></param>
/// <returns></returns>
private string checkSel(JobTaskModel curRec)
{
string answ = "";
if (selRecord != null)
{
answ = curRec.JobID == selRecord.JobID ? "table-info" : "";
}
return answ;
}
/// <summary>
/// Genera nuovo record e lo salva
/// </summary>
protected async Task DoAdd()
private async Task DoAdd()
{
if (newRecord != null)
{
@@ -96,7 +133,7 @@ namespace Lux.UI.Components.Compo.JobTask
/// Eliminazione record
/// </summary>
/// <param name="rec2del"></param>
protected async Task DoDelete(JobTaskModel rec2del)
private async Task DoDelete(JobTaskModel rec2del)
{
// controlo che NON abbia child obj... altrimenti esco
if (rec2del.NumChild > 0)
@@ -118,7 +155,7 @@ namespace Lux.UI.Components.Compo.JobTask
/// Edit articolo selezionato
/// </summary>
/// <param name="curRec"></param>
protected Task DoEdit(JobTaskModel curRec)
private Task DoEdit(JobTaskModel curRec)
{
editRecord = curRec;
selRecord = curRec;
@@ -128,7 +165,7 @@ namespace Lux.UI.Components.Compo.JobTask
/// <summary>
/// Reset selezione
/// </summary>
protected async Task DoReset()
private async Task DoReset()
{
editRecord = null;
selRecord = null;
@@ -136,11 +173,23 @@ namespace Lux.UI.Components.Compo.JobTask
await EC_Updated.InvokeAsync(true);
}
/// <summary>
/// Update record x elenco tags
/// </summary>
/// <param name="args"></param>
/// <returns></returns>
private async Task DoSaveTags(TagDisplay.SavePayload args)
{
// chiamo update
await JTService.MergeTagsAsync(args.Id, args.Tags);
await EC_Updated.InvokeAsync(true);
}
/// <summary>
/// Selezione articolo x display info
/// </summary>
/// <param name="curRec"></param>
protected Task DoSelect(JobTaskModel curRec)
private Task DoSelect(JobTaskModel curRec)
{
selRecord = curRec;
return EC_Selected.InvokeAsync(curRec);
@@ -151,7 +200,7 @@ namespace Lux.UI.Components.Compo.JobTask
/// </summary>
/// <param name="curRec"></param>
/// <returns></returns>
protected List<string> ListDriversName(JobTaskModel curRec)
private List<string> ListDriversName(JobTaskModel curRec)
{
List<string> result = new List<string>();
if (CostDriverLists != null && ResourceLists != null)
@@ -177,77 +226,6 @@ namespace Lux.UI.Components.Compo.JobTask
return result;
}
protected override void OnParametersSet()
{
ReloadData();
}
protected void ToggleAdd()
{
addVisible = !addVisible;
if (addVisible)
{
newRecord = new JobTaskModel()
{
Description = $"Nuovo Ciclo-{DateTime.Now:yyyy.MM.dd-HH.mm.ss}",
Index = totalCount + 1
};
}
}
#endregion Protected Methods
#region Private Fields
private bool addVisible = false;
private int currPage = 1;
private JobTaskModel? editRecord = null;
private string errorMsg = "";
private bool isLoading = false;
private JobTaskModel? newRecord = null;
private int numRecord = 10;
private JobTaskModel? selRecord = null;
private int totalCount = 0;
#endregion Private Fields
#region Private Methods
/// <summary>
/// Check selezione riga item
/// </summary>
/// <param name="curRec"></param>
/// <returns></returns>
private string checkSel(JobTaskModel curRec)
{
string answ = "";
if (selRecord != null)
{
answ = curRec.JobID == selRecord.JobID ? "table-info" : "";
}
return answ;
}
/// <summary>
/// Update record x elenco tags
/// </summary>
/// <param name="args"></param>
/// <returns></returns>
private async Task DoSaveTags(TagDisplay.SavePayload args)
{
// chiamo update
await JTService.MergeTagsAsync(args.Id, args.Tags);
await EC_Updated.InvokeAsync(true);
}
/// <summary>
/// Esegue spostamento
/// </summary>
@@ -291,6 +269,19 @@ namespace Lux.UI.Components.Compo.JobTask
ReloadData();
}
private void ToggleAdd()
{
addVisible = !addVisible;
if (addVisible)
{
newRecord = new JobTaskModel()
{
Description = $"Nuovo Ciclo-{DateTime.Now:yyyy.MM.dd-HH.mm.ss}",
Index = totalCount + 1
};
}
}
#endregion Private Methods
}
}
@@ -1,6 +1,6 @@
using EgwCoreLib.Lux.Data.DbModel.Cost;
using EgwCoreLib.Lux.Data.Services;
using EgwCoreLib.Lux.Data.Services.Cost;
using EgwCoreLib.Lux.Data.Services.General;
using Microsoft.AspNetCore.Components;
using Microsoft.JSInterop;
@@ -61,7 +61,7 @@ namespace Lux.UI.Components.Compo.JobTask
private ICostDriverService CDService { get; set; } = null!;
[Inject]
private DataLayerServices DLService { get; set; } = null!;
private IDataLayerServices DLService { get; set; } = null!;
[Inject]
private IJSRuntime JSRuntime { get; set; } = null!;
@@ -108,7 +108,7 @@ namespace Lux.UI.Components.Compo
private ICalcRequestService CService { get; set; } = null!;
[Inject]
private DataLayerServices DLService { get; set; } = null!;
private IDataLayerServices DLService { get; set; } = null!;
[Inject]
private IConfGlassService CGService { get; set; } = null!;
+6 -13
View File
@@ -1,7 +1,6 @@
using EgwCoreLib.Lux.Core;
using EgwCoreLib.Lux.Core.Generic;
using EgwCoreLib.Lux.Data.DbModel.Sales;
using EgwCoreLib.Lux.Data.Services;
using EgwCoreLib.Lux.Data.Services.Sales;
using Microsoft.AspNetCore.Components;
@@ -20,18 +19,18 @@ namespace Lux.UI.Components.Compo
[Parameter]
public OfferModel CurrRecord { get; set; } = null!;
/// <summary>
/// Evento che indica variazione rispetto ai dati originali
/// </summary>
[Parameter]
public EventCallback<EditStepDto> EC_Changed { get; set; }
/// <summary>
/// Callback invocato a richiesta cancel editing della finestra
/// </summary>
[Parameter]
public EventCallback<bool> EC_Cancel { get; set; }
/// <summary>
/// Evento che indica variazione rispetto ai dati originali
/// </summary>
[Parameter]
public EventCallback<EditStepDto> EC_Changed { get; set; }
/// <summary>
/// Callback invocato alla richiesta di salvataggio con l'offerta aggiornata.
/// </summary>
@@ -76,12 +75,6 @@ namespace Lux.UI.Components.Compo
[Inject]
private ICustomerService CService { get; set; } = null!;
/// <summary>
/// Servizi di accesso ai dati iniettati dal framework.
/// </summary>
[Inject]
private DataLayerServices DLService { get; set; } = null!;
[Inject]
private IDealerService DService { get; set; } = null!;
+1 -1
View File
@@ -310,7 +310,7 @@ namespace Lux.UI.Components.Compo
private IConfWoodService CWService { get; set; } = null!;
[Inject]
private DataLayerServices DLService { get; set; } = default!;
private IDataLayerServices DLService { get; set; } = default!;
[Inject]
private IEnvirParamService EPService { get; set; } = null!;
+1 -2
View File
@@ -7,7 +7,6 @@ using EgwCoreLib.Lux.Data.DbModel.Production;
using EgwCoreLib.Lux.Data.DbModel.Sales;
using EgwCoreLib.Lux.Data.DbModel.Utils;
using EgwCoreLib.Lux.Data.Domains;
using EgwCoreLib.Lux.Data.Services;
using EgwCoreLib.Lux.Data.Services.Config;
using EgwCoreLib.Lux.Data.Services.General;
using EgwCoreLib.Lux.Data.Services.Items;
@@ -345,7 +344,7 @@ namespace Lux.UI.Components.Compo
private IConfWoodService CWService { get; set; } = null!;
[Inject]
private DataLayerServices DLService { get; set; } = null!;
private IDataLayerServices DLService { get; set; } = null!;
[Inject]
private IEnvirParamService EPService { get; set; } = null!;
@@ -1,6 +1,6 @@
using EgwCoreLib.Lux.Core;
using EgwCoreLib.Lux.Data.DbModel.Catalog;
using EgwCoreLib.Lux.Data.Services;
using EgwCoreLib.Lux.Data.Services.General;
using EgwCoreLib.Lux.Data.Services.Utils;
using Microsoft.AspNetCore.Components;
using Microsoft.JSInterop;
@@ -67,7 +67,7 @@ namespace Lux.UI.Components.Compo.Templates
/// Servizi di accesso ai dati iniettati dal framework.
/// </summary>
[Inject]
private DataLayerServices DLService { get; set; } = null!;
private IDataLayerServices DLService { get; set; } = null!;
[Inject]
private ITemplateService TService { get; set; } = default!;
@@ -284,7 +284,7 @@ namespace Lux.UI.Components.Compo.Templates
/// Servizi di accesso ai dati iniettati dal framework.
/// </summary>
[Inject]
private DataLayerServices DLService { get; set; } = null!;
private IDataLayerServices DLService { get; set; } = null!;
[Inject]
private IEnvirParamService EPService { get; set; } = null!;
@@ -1,6 +1,5 @@
using EgwCoreLib.Lux.Core;
using EgwCoreLib.Lux.Data.DbModel.Items;
using EgwCoreLib.Lux.Data.Services;
using EgwCoreLib.Lux.Data.Services.Items;
using Microsoft.AspNetCore.Components;
using Microsoft.JSInterop;
@@ -74,9 +73,6 @@ namespace Lux.UI.Components.Compo.WorkLoad
#region Protected Properties
[Inject]
protected DataLayerServices DLService { get; set; } = null!;
[Inject]
protected IItemService IService { get; set; } = null!;
@@ -87,9 +83,6 @@ namespace Lux.UI.Components.Compo.WorkLoad
#region Protected Methods
/// <summary>
/// Selezione articolo x display info
/// </summary>
@@ -129,7 +122,6 @@ namespace Lux.UI.Components.Compo.WorkLoad
private int currPage = 1;
private bool isLoading = false;
private int numRecord = 10;
@@ -2,10 +2,9 @@ using EgwCoreLib.Lux.Core.Generic;
using EgwCoreLib.Lux.Core.RestPayload;
using EgwCoreLib.Lux.Data.DbModel.Production;
using EgwCoreLib.Lux.Data.DbModel.Sales;
using EgwCoreLib.Lux.Data.Services;
using EgwCoreLib.Lux.Data.Services.General;
using Microsoft.AspNetCore.Components;
using Microsoft.JSInterop;
using NLog.Targets.Wrappers;
namespace Lux.UI.Components.Compo.WorkLoad
{
@@ -97,7 +96,7 @@ namespace Lux.UI.Components.Compo.WorkLoad
}
[Inject]
protected DataLayerServices DLService { get; set; } = null!;
private IDataLayerServices DLService { get; set; } = null!;
protected string MainCss
{
+2 -2
View File
@@ -1,7 +1,7 @@
using EgwCoreLib.Lux.Core;
using EgwCoreLib.Lux.Data.DbModel.Items;
using EgwCoreLib.Lux.Data.DbModel.Job;
using EgwCoreLib.Lux.Data.Services;
using EgwCoreLib.Lux.Data.Services.General;
using EgwCoreLib.Lux.Data.Services.Items;
using EgwCoreLib.Lux.Data.Services.Job;
using Microsoft.AspNetCore.Components;
@@ -37,7 +37,7 @@ namespace Lux.UI.Components.Pages
private FiltSelect CurrFilt { get; set; } = new FiltSelect();
[Inject]
private DataLayerServices DLService { get; set; } = null!;
private IDataLayerServices DLService { get; set; } = null!;
[Inject]
private IItemGroupService IGService { get; set; } = null!;
+2 -2
View File
@@ -1,7 +1,7 @@
using EgwCoreLib.Lux.Data.DbModel.Cost;
using EgwCoreLib.Lux.Data.DbModel.Job;
using EgwCoreLib.Lux.Data.Services;
using EgwCoreLib.Lux.Data.Services.Cost;
using EgwCoreLib.Lux.Data.Services.General;
using EgwCoreLib.Lux.Data.Services.Job;
using EgwCoreLib.Lux.Data.Services.Utils;
using Microsoft.AspNetCore.Components;
@@ -47,7 +47,7 @@ namespace Lux.UI.Components.Pages
private ICostDriverService CDService { get; set; } = null!;
[Inject]
private DataLayerServices DLService { get; set; } = null!;
private IDataLayerServices DLService { get; set; } = null!;
[Inject]
private IJobStepService JStService { get; set; } = null!;
+1 -1
View File
@@ -112,7 +112,7 @@ namespace Lux.UI.Components.Pages
}
[Inject]
private DataLayerServices DLService { get; set; } = null!;
private IDataLayerServices DLService { get; set; } = null!;
[Inject]
private IEnvirParamService EPService { get; set; } = null!;
+1 -1
View File
@@ -48,7 +48,7 @@ namespace Lux.UI.Components.Pages
}
[Inject]
private DataLayerServices DLService { get; set; } = null!;
private IDataLayerServices DLService { get; set; } = null!;
[Inject]
private IProductionItemService PIService { get; set; } = default!;
+5 -10
View File
@@ -1,19 +1,11 @@
using EgwCoreLib.Lux.Core.Generic;
using EgwCoreLib.Lux.Data.Services;
using EgwCoreLib.Lux.Data.Services.General;
using Microsoft.AspNetCore.Components;
using System.Collections.Generic;
namespace Lux.UI.Components.Pages
{
public partial class ProdPlanner
{
#region Protected Properties
[Inject]
protected DataLayerServices DLService { get; set; } = null!;
#endregion Protected Properties
#region Private Fields
/// <summary>
@@ -25,6 +17,9 @@ namespace Lux.UI.Components.Pages
#region Private Properties
[Inject]
private IDataLayerServices DLService { get; set; } = null!;
private List<EventDto> ListEventi { get; set; } = new();
#endregion Private Properties
@@ -36,7 +31,7 @@ namespace Lux.UI.Components.Pages
/// </summary>
private async Task ReloadDataAsync()
{
var rawData = await DLService.PlannerGetEvents(PeriodoSel.Inizio, PeriodoSel.Fine);
var rawData = await DLService.PlannerGetEventsAsync(PeriodoSel.Inizio, PeriodoSel.Fine);
if (rawData != null && rawData.Count > 0)
{
ListEventi.Clear();
+2 -2
View File
@@ -1,12 +1,12 @@
@page "/ResetCache"
@using EgwCoreLib.Lux.Data.Services
@using EgwCoreLib.Lux.Data.Services.General
<LoadingData Title="Resetting Cache..." DisplaySize="LoadingData.CtrlSize.Large" DisplayMode="LoadingData.SpinMode.BounceLine"></LoadingData>
@code {
[Inject]
protected DataLayerServices DLService { get; set; } = null!;
private IDataLayerServices DLService { get; set; } = null!;
[Inject]
private NavigationManager NavMan { get; set; } = null!;
+1 -1
View File
@@ -32,7 +32,7 @@ namespace Lux.UI.Components.Pages
protected IConfiguration Config { get; set; } = null!;
[Inject]
protected DataLayerServices DLService { get; set; } = null!;
private IDataLayerServices DLService { get; set; } = null!;
[Inject]
protected ImageCacheService ICService { get; set; } = null!;
+2 -2
View File
@@ -1,7 +1,7 @@
using EgwCoreLib.Lux.Core;
using EgwCoreLib.Lux.Data.DbModel.Items;
using EgwCoreLib.Lux.Data.DbModel.Job;
using EgwCoreLib.Lux.Data.Services;
using EgwCoreLib.Lux.Data.Services.General;
using EgwCoreLib.Lux.Data.Services.Items;
using EgwCoreLib.Lux.Data.Services.Job;
using Microsoft.AspNetCore.Components;
@@ -37,7 +37,7 @@ namespace Lux.UI.Components.Pages
private FiltSelect CurrFilt { get; set; } = new FiltSelect();
[Inject]
private DataLayerServices DLService { get; set; } = null!;
private IDataLayerServices DLService { get; set; } = null!;
[Inject]
private IItemGroupService IGService { get; set; } = null!;
@@ -78,7 +78,7 @@ namespace Lux.UI.Components.Pages
private ICalcRequestService CService { get; set; } = null!;
[Inject]
private DataLayerServices DLService { get; set; } = null!;
private IDataLayerServices DLService { get; set; } = null!;
[Inject]
private IGenValService GVService { get; set; } = default!;