From 84144b4beb3dcade4710e6f367d8d84989721ce6 Mon Sep 17 00:00:00 2001 From: Samuele Locatelli Date: Mon, 23 Mar 2026 10:25:42 +0100 Subject: [PATCH] Fix metodi folder Offer --- Lux.UI/Components/Pages/Offers.razor.cs | 587 ++++++++++++------------ Lux.UI/Lux.UI.csproj | 2 +- Resources/ChangeLog.html | 2 +- Resources/VersNum.txt | 2 +- Resources/manifest.xml | 2 +- 5 files changed, 285 insertions(+), 310 deletions(-) diff --git a/Lux.UI/Components/Pages/Offers.razor.cs b/Lux.UI/Components/Pages/Offers.razor.cs index 3040f02a..868632d2 100644 --- a/Lux.UI/Components/Pages/Offers.razor.cs +++ b/Lux.UI/Components/Pages/Offers.razor.cs @@ -51,90 +51,10 @@ namespace Lux.UI.Components.Pages } } - [Inject] - protected IConfiguration Config { get; set; } = null!; - - [Inject] - protected CalcRuidService CRService { get; set; } = null!; - - protected string DivMainCss - { - get => SelRecord != null ? "col-6" : "col-12"; - } - - [Inject] - protected DataLayerServices DLService { get; set; } = null!; - - [Inject] - protected IJSRuntime JSRuntime { get; set; } = null!; - - [Inject] - protected ProdService PService { get; set; } = null!; - - protected string txtState - { - get => allState ? "Tutte" : "Aperte"; - } - #endregion Protected Properties #region Protected Methods - protected string CheckSelect(OfferModel curRec) - { - string answ = ""; - if (SelRecord != null) - { - answ = curRec.OfferID == SelRecord.OfferID ? "table-info" : ""; - } - return answ; - } - - protected void DoAdd() - { - EditRecord = new OfferModel() - { - RefYear = DateTime.Today.Year, - Description = $"Nuova Offerta {DateTime.Today:ddd yyyy.MM.dd}", - ValidUntil = DateTime.Today.AddMonths(1) - }; - } - - protected async Task DoClone(OfferModel rec2clone) - { - if (!await JSRuntime.InvokeAsync("confirm", $"Confermi di voler duplicare interamente l'offerta selezionata?{Environment.NewLine}---------------------------{Environment.NewLine}Env: {rec2clone.Envir} | {rec2clone.OfferCode}{Environment.NewLine}{rec2clone.Description}{Environment.NewLine}Articoli: {rec2clone.NumItems}{Environment.NewLine}---------------------------{Environment.NewLine}Importo: {rec2clone.TotalPrice:C2}")) - return; - // clona intera offerta + tutte le righe... - await OffService.CloneAsync(rec2clone); - await ReloadData(); - UpdateTable(); - } - - protected void DoEdit(OfferModel curRec) - { - currStep = CompileStep.Header; - EditRecord = curRec; - } - - protected async Task DoEsc(OfferModel? updRec) - { - EditRecord = null; - SelRecord = null; - // salvo record SE non è nullo - if (updRec != null) - { - if (!await JSRuntime.InvokeAsync("confirm", $"Vuoi salvare e chiudere l'Offerta?")) - return; - - await OffService.UpsertAsync(updRec); - } - } - - protected void DoSelect(OfferModel curRec) - { - SelRecord = curRec; - } - protected override async Task OnInitializedAsync() { // prendo il trim corrente + anno precedente... @@ -147,25 +67,303 @@ namespace Lux.UI.Components.Pages UpdateTable(); } - protected void SaveNumRec(int newNum) + #endregion Protected Methods + + #region Private Fields + + private List AllConfEnvir = new(); + + private List AllRecords = new List(); + + private bool allState = false; + + /// + /// Base path x network share files + /// + private string basePath = "unsafe_uploads"; + + private int currPage = 1; + + private CompileStep currStep = CompileStep.Draft; + + private OfferModel? EditRecord = null; + + private OfferModel? EditStateRec = null; + + private bool isLoading = false; + + private List ListFilt = new List(); + + private List ListRecords = new List(); + + private int numRecord = 10; + + /// + /// Periodo selezionato attuale + /// + private EgwCoreLib.Utils.DtUtils.Periodo PeriodoSel = new EgwCoreLib.Utils.DtUtils.Periodo(EgwCoreLib.Utils.DtUtils.PeriodSet.ThisYear); + + private string searchVal = ""; + + private OfferModel? SelRecord = null; + + private int totalCount = 0; + + private string txtStyle = "font-size: 1.2em; font-weight:bold; fill: white;"; + + #endregion Private Fields + + #region Private Properties + + [Inject] + private IConfiguration Config { get; set; } = null!; + + [Inject] + private CalcRuidService CRService { get; set; } = null!; + + private string DivMainCss + { + get => SelRecord != null ? "col-6" : "col-12"; + } + + [Inject] + private DataLayerServices DLService { get; set; } = null!; + + [Inject] + private IEnvirParamService EPService { get; set; } = null!; + + [Inject] + private IJSRuntime JSRuntime { get; set; } = null!; + + private List listBord01 { get; set; } = new(); + + [Inject] + private IOfferService OffService { get; set; } = default!; + + [Inject] + private IOrderService OrdService { get; set; } = default!; + + [Inject] + private IProductionItemService PIService { get; set; } = default!; + + [Inject] + private ProdService PService { get; set; } = null!; + + private string txtState + { + get => allState ? "Tutte" : "Aperte"; + } + + #endregion Private Properties + + #region Private Methods + + private void AdvStep(CompileStep newStep) + { + currStep = newStep; + } + + private string ArrowBackCol(CompileStep arrowStep) + { + string answ = $"fill: #000000;"; + if (arrowStep == currStep) + { + answ = $"fill: #123456;"; + } + else if (arrowStep < currStep) + { + answ = $"fill: #456789;"; + } + else + { + answ = $"fill: #89ABCD;"; + } + return answ; + } + + private string CheckSelect(OfferModel curRec) + { + string answ = ""; + if (SelRecord != null) + { + answ = curRec.OfferID == SelRecord.OfferID ? "table-info" : ""; + } + return answ; + } + + private void ConfInit() + { + basePath = Config.GetValue("ServerConf:FileSharePath") ?? "unsafe_uploads"; + } + + private void DoAction(string args) + { + if (args == "EditRow") + { + currStep = CompileStep.Rows; + EditRecord = SelRecord; + } + } + + private void DoAdd() + { + EditRecord = new OfferModel() + { + RefYear = DateTime.Today.Year, + Description = $"Nuova Offerta {DateTime.Today:ddd yyyy.MM.dd}", + ValidUntil = DateTime.Today.AddMonths(1) + }; + } + + private async Task DoClone(OfferModel rec2clone) + { + if (!await JSRuntime.InvokeAsync("confirm", $"Confermi di voler duplicare interamente l'offerta selezionata?{Environment.NewLine}---------------------------{Environment.NewLine}Env: {rec2clone.Envir} | {rec2clone.OfferCode}{Environment.NewLine}{rec2clone.Description}{Environment.NewLine}Articoli: {rec2clone.NumItems}{Environment.NewLine}---------------------------{Environment.NewLine}Importo: {rec2clone.TotalPrice:C2}")) + return; + // clona intera offerta + tutte le righe... + await OffService.CloneAsync(rec2clone); + await ReloadData(); + UpdateTable(); + } + + private void DoClose() + { + EditRecord = null; + } + + private void DoEdit(OfferModel curRec) + { + currStep = CompileStep.Header; + EditRecord = curRec; + } + + private async Task DoEsc(OfferModel? updRec) + { + EditRecord = null; + SelRecord = null; + // salvo record SE non è nullo + if (updRec != null) + { + if (!await JSRuntime.InvokeAsync("confirm", $"Vuoi salvare e chiudere l'Offerta?")) + return; + + await OffService.UpsertAsync(updRec); + } + } + + private void DoFilter() + { + // verifico eventuali filtri + ListFilt = AllRecords + .Where(x => x.OffertState == OfferStates.Open || allState) + .ToList(); + if (!string.IsNullOrEmpty(searchVal)) + { + ListFilt = ListFilt + .Where(x => x.Description.Contains(searchVal, StringComparison.InvariantCultureIgnoreCase) || x.OfferCode.Contains(searchVal, StringComparison.InvariantCultureIgnoreCase)) + .ToList(); + } + totalCount = ListFilt.Count(); + } + + /// + /// Salva record ed avanza compilazione + /// + /// + /// + private async Task DoSave(OfferModel updRec) + { + // salvo record + await OffService.UpsertAsync(updRec); + // cambio step + CompileStep nextStep = currStep < CompileStep.FinalCheck ? currStep + 1 : currStep; + AdvStep(nextStep); + } + + private void DoSelect(OfferModel curRec) + { + SelRecord = curRec; + } + + private void EditState(OfferModel? curRec) + { + EditStateRec = curRec; + } + + /// + /// Path da parent record + /// + /// + /// + private string FolderPath(int objID) + { + return $"SO-{objID:X8}"; + } + + /// + /// Rilegge tabella + /// + private async Task ForceReload() + { + isLoading = true; + await Task.Delay(50); + await ReloadData(); + await Task.Delay(50); + UpdateTable(); + await Task.Delay(50); + isLoading = false; + await Task.Delay(50); + } + + /// + /// Rilettura info di base + /// + /// + private async Task ReloadBaseData() + { + AllConfEnvir = await EPService.GetAllAsync(); + } + + /// + /// Legge i dati dei record completi + /// + private async Task ReloadData() + { + await OffService.CheckExpiredAsync(); + AllRecords = await OffService.GetFiltAsync(PeriodoSel.Inizio, PeriodoSel.Fine); + DoFilter(); + } + + private void SaveNumRec(int newNum) { numRecord = newNum; UpdateTable(); } - protected void SavePage(int newNum) + private void SavePage(int newNum) { currPage = newNum; UpdateTable(); } + /// + /// Imposta periodo da filtro + /// + /// + /// + private async Task SetPeriodo(EgwCoreLib.Utils.DtUtils.Periodo newPeriod) + { + PeriodoSel = newPeriod; + await ReloadData(); + UpdateTable(); + } + /// /// Imposta lo stato dell'offerta VERIFICANDO i vari casi di stato di artenza/arrivo... /// /// /// /// - protected async Task SetState(OfferModel currRec, OfferStates newStatus) + private async Task SetState(OfferModel currRec, OfferStates newStatus) { /* --------------------------------- * se lo conferma: esegue step speciali come @@ -285,204 +483,6 @@ namespace Lux.UI.Components.Pages UpdateTable(); } - #endregion Protected Methods - - #region Private Fields - - private List AllConfEnvir = new(); - - private List AllRecords = new List(); - - private bool allState = false; - - /// - /// Base path x network share files - /// - private string basePath = "unsafe_uploads"; - - private int currPage = 1; - - private CompileStep currStep = CompileStep.Draft; - - private OfferModel? EditRecord = null; - - private OfferModel? EditStateRec = null; - - private bool isLoading = false; - - private List ListFilt = new List(); - - private List ListRecords = new List(); - - private int numRecord = 10; - - /// - /// Periodo selezionato attuale - /// - private EgwCoreLib.Utils.DtUtils.Periodo PeriodoSel = new EgwCoreLib.Utils.DtUtils.Periodo(EgwCoreLib.Utils.DtUtils.PeriodSet.ThisYear); - - private string searchVal = ""; - - private OfferModel? SelRecord = null; - - private int totalCount = 0; - - private string txtStyle = "font-size: 1.2em; font-weight:bold; fill: white;"; - - #endregion Private Fields - - #region Private Properties - - [Inject] - private IEnvirParamService EPService { get; set; } = null!; - - private List listBord01 { get; set; } = new(); - - [Inject] - private IOfferService OffService { get; set; } = default!; - - [Inject] - private IOrderService OrdService { get; set; } = default!; - - [Inject] - private IProductionItemService PIService { get; set; } = default!; - - #endregion Private Properties - - #region Private Methods - - private void AdvStep(CompileStep newStep) - { - currStep = newStep; - } - - private string ArrowBackCol(CompileStep arrowStep) - { - string answ = $"fill: #000000;"; - if (arrowStep == currStep) - { - answ = $"fill: #123456;"; - } - else if (arrowStep < currStep) - { - answ = $"fill: #456789;"; - } - else - { - answ = $"fill: #89ABCD;"; - } - return answ; - } - - private void ConfInit() - { - basePath = Config.GetValue("ServerConf:FileSharePath") ?? "unsafe_uploads"; - } - - private void DoAction(string args) - { - if (args == "EditRow") - { - currStep = CompileStep.Rows; - EditRecord = SelRecord; - } - } - - private void DoClose() - { - EditRecord = null; - } - - private void DoFilter() - { - // verifico eventuali filtri - ListFilt = AllRecords - .Where(x => x.OffertState == OfferStates.Open || allState) - .ToList(); - if (!string.IsNullOrEmpty(searchVal)) - { - ListFilt = ListFilt - .Where(x => x.Description.Contains(searchVal, StringComparison.InvariantCultureIgnoreCase) || x.OfferCode.Contains(searchVal, StringComparison.InvariantCultureIgnoreCase)) - .ToList(); - } - totalCount = ListFilt.Count(); - } - - /// - /// Salva record ed avanza compilazione - /// - /// - /// - private async Task DoSave(OfferModel updRec) - { - // salvo record - await OffService.UpsertAsync(updRec); - // cambio step - CompileStep nextStep = currStep < CompileStep.FinalCheck ? currStep + 1 : currStep; - AdvStep(nextStep); - } - - private void EditState(OfferModel? curRec) - { - EditStateRec = curRec; - } - - /// - /// Path da parent record - /// - /// - /// - private string FolderPath(int objID) - { - return $"SO-{objID:X8}"; - } - - /// - /// Rilegge tabella - /// - private async Task ForceReload() - { - isLoading = true; - await Task.Delay(50); - await ReloadData(); - await Task.Delay(50); - UpdateTable(); - await Task.Delay(50); - isLoading = false; - await Task.Delay(50); - } - - /// - /// Rilettura info di base - /// - /// - private async Task ReloadBaseData() - { - AllConfEnvir = await EPService.GetAllAsync(); - } - - /// - /// Legge i dati dei record completi - /// - private async Task ReloadData() - { - await OffService.CheckExpiredAsync(); - AllRecords = await OffService.GetFiltAsync(PeriodoSel.Inizio, PeriodoSel.Fine); - DoFilter(); - } - - /// - /// Imposta periodo da filtro - /// - /// - /// - private async Task SetPeriodo(EgwCoreLib.Utils.DtUtils.Periodo newPeriod) - { - PeriodoSel = newPeriod; - await ReloadData(); - UpdateTable(); - } - private void SetupArrows() { listBord01 = new(); @@ -505,30 +505,5 @@ namespace Lux.UI.Components.Pages } #endregion Private Methods - -#if false - - protected void SetNumRec(int newNum) - { - numRecord = newNum; - RefreshDisplay(); - } - - protected void SetPage(int newNum) - { - currPage = newNum; - RefreshDisplay(); - } - - protected void SortRequested(Sorter.SortCallBack e) - { - if (sortField == e.ParamName) - { - sortAsc = e.IsAscending; - } - sortField = e.ParamName; - RefreshDisplay(); - } -#endif } } \ No newline at end of file diff --git a/Lux.UI/Lux.UI.csproj b/Lux.UI/Lux.UI.csproj index bf59de4d..5a792384 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.2309 + 1.1.2603.2310 diff --git a/Resources/ChangeLog.html b/Resources/ChangeLog.html index bcb40771..b3df74fb 100644 --- a/Resources/ChangeLog.html +++ b/Resources/ChangeLog.html @@ -1,6 +1,6 @@ LUX - Web Windows MES -

Versione: 1.1.2603.2309

+

Versione: 1.1.2603.2310


Note di rilascio:
  • diff --git a/Resources/VersNum.txt b/Resources/VersNum.txt index 99ec335e..6514f5bf 100644 --- a/Resources/VersNum.txt +++ b/Resources/VersNum.txt @@ -1 +1 @@ -1.1.2603.2309 +1.1.2603.2310 diff --git a/Resources/manifest.xml b/Resources/manifest.xml index 125b69e9..ebd53735 100644 --- a/Resources/manifest.xml +++ b/Resources/manifest.xml @@ -1,6 +1,6 @@ - 1.1.2603.2309 + 1.1.2603.2310 http://nexus.steamware.net/repository/SWS/GPW/stable/GPW.UI.zip http://nexus.steamware.net/repository/SWS/GPW/stable/ChangeLog.html false