diff --git a/EgwCoreLib.Lux.Data/DataLayerContext.cs b/EgwCoreLib.Lux.Data/DataLayerContext.cs index eba62547..387f5a5e 100644 --- a/EgwCoreLib.Lux.Data/DataLayerContext.cs +++ b/EgwCoreLib.Lux.Data/DataLayerContext.cs @@ -89,6 +89,7 @@ namespace EgwCoreLib.Lux.Data if (string.IsNullOrEmpty(connString)) { #if DEBUG + //connString = "Server=mdb.ufficio;port=3306;database=Lux_000;uid=lux_user;pwd=Egal_pwd!;sslmode=None;"; connString = "Server=mdb.ufficio;port=3306;database=Lux_000_dev;uid=lux_user;pwd=Egal_pwd!;sslmode=None;"; #else connString = "Server=mdb.ufficio;port=3306;database=Lux_000;uid=lux_user;pwd=Egal_pwd!;sslmode=None;"; diff --git a/Lux.API/Lux.API.csproj b/Lux.API/Lux.API.csproj index 6af2b9a4..4ddc20a2 100644 --- a/Lux.API/Lux.API.csproj +++ b/Lux.API/Lux.API.csproj @@ -4,7 +4,7 @@ net8.0 enable enable - 0.9.2510.0618 + 0.9.2510.0716 @@ -65,7 +65,7 @@ - + diff --git a/Lux.API/appsettings.Development.json b/Lux.API/appsettings.Development.json index c294297e..e186d4f6 100644 --- a/Lux.API/appsettings.Development.json +++ b/Lux.API/appsettings.Development.json @@ -7,7 +7,8 @@ }, "ServerConf": { "BaseUrl": "/lux/srv/", - "PubChannel": "EgwEngineInput", - "SubChannel": "EgwEngineOutput" + "PubChannel": "EgwDevEngineInput", + "SubChannel": "EgwDevEngineOutput", + "ImageBaseUrl": "https://iis01.egalware.com/lux/srv/api/window/" } } diff --git a/Lux.API/appsettings.Production.json b/Lux.API/appsettings.Production.json index c294297e..535094eb 100644 --- a/Lux.API/appsettings.Production.json +++ b/Lux.API/appsettings.Production.json @@ -8,6 +8,7 @@ "ServerConf": { "BaseUrl": "/lux/srv/", "PubChannel": "EgwEngineInput", - "SubChannel": "EgwEngineOutput" + "SubChannel": "EgwEngineOutput", + "ImageBaseUrl": "https://office.egalware.com/lux/srv/api/window/" } } diff --git a/Lux.API/appsettings.json b/Lux.API/appsettings.json index 0beef624..827253c5 100644 --- a/Lux.API/appsettings.json +++ b/Lux.API/appsettings.json @@ -56,8 +56,8 @@ }, "ServerConf": { "CalcTag": "calc", - "PubChannel": "EgwDevEngineInput", - "SubChannel": "EgwDevEngineOutput", + "PubChannel": "EgwEngineInput", + "SubChannel": "EgwEngineOutput", "SvgChannel": "Egw:svg:img", "BomChannel": "Egw:bom", "UpdateChannel": "Egw:update", diff --git a/Lux.UI.Client/Lux.UI.Client.csproj b/Lux.UI.Client/Lux.UI.Client.csproj index b6016145..ee438118 100644 --- a/Lux.UI.Client/Lux.UI.Client.csproj +++ b/Lux.UI.Client/Lux.UI.Client.csproj @@ -9,8 +9,8 @@ - - + + diff --git a/Lux.UI/Components/Compo/OfferRowMan.razor b/Lux.UI/Components/Compo/OfferRowMan.razor index 43dfbcb1..cded099c 100644 --- a/Lux.UI/Components/Compo/OfferRowMan.razor +++ b/Lux.UI/Components/Compo/OfferRowMan.razor @@ -3,23 +3,11 @@

EDITING

@EditRecord.OfferRowUID

- + EC_OnClose="CloseEdit"> - @* - IN_TemplateDTOList="@AvailTemplateList" - IN_SelTemplate="@SelTemplate" - IN_SelFamilyHardware="@SelFamilyHardware" - IN_SelColorMaterial="@SelColorMaterial" - IN_SelMaterial="@SelMaterial" - IN_SelGlass="@SelGlass" - *@ } else { diff --git a/Lux.UI/Components/Compo/OfferRowMan.razor.cs b/Lux.UI/Components/Compo/OfferRowMan.razor.cs index 7410ae73..d18e4f03 100644 --- a/Lux.UI/Components/Compo/OfferRowMan.razor.cs +++ b/Lux.UI/Components/Compo/OfferRowMan.razor.cs @@ -11,6 +11,8 @@ using Microsoft.AspNetCore.Components; using Microsoft.AspNetCore.Components.Forms; using Microsoft.EntityFrameworkCore.Storage.Json; using Microsoft.JSInterop; +using NLog.LayoutRenderers; +using WebWindowComplex.DTO; using static EgwCoreLib.Lux.Core.Enums; namespace Lux.UI.Components.Compo @@ -43,6 +45,20 @@ namespace Lux.UI.Components.Compo #endregion Public Methods + #region Protected Fields + + /// + /// Predisposizione valori live SVG/JWD + /// + protected LivePayload CurrData = new LivePayload(); + + /// + /// Configurazione elenchi anagrafiche + /// + protected BaseListPayload SetupList = new BaseListPayload(); + + #endregion Protected Fields + #region Protected Properties [Inject] @@ -57,15 +73,15 @@ namespace Lux.UI.Components.Compo [Inject] protected DataLayerServices DLService { get; set; } = null!; + [Inject] + protected IWebHostEnvironment HostEnv { get; set; } = null!; + [Inject] protected ImageCacheService ICService { get; set; } = null!; [Inject] protected IJSRuntime JSRuntime { get; set; } = null!; - [Inject] - protected IWebHostEnvironment HostEnv { get; set; } = null!; - #endregion Protected Properties #region Protected Methods @@ -78,9 +94,24 @@ namespace Lux.UI.Components.Compo protected void DoEdit(OfferRowModel curRec) { + // preparazione dati da record corrente + PrepareWindowData(curRec.SerStruct); + // reset prev + prevJwd = ""; + // imposto edit record EditRecord = curRec; } + /// + /// Versione precedente JWD x test e confronto + /// + private string prevJwd = ""; + + /// + /// Versione originale (pre edit) + /// + private string origJwd = ""; + protected void DoSwapMat(OfferRowModel currRow) { showChangeMat = true; @@ -88,6 +119,16 @@ namespace Lux.UI.Components.Compo CurrBomList = DLService.OffertGetBomList(EditBomRecord); } + /// + /// Display fileSize scalato + /// + /// + /// + protected string fSize(long size) + { + return EgwCoreLib.Utils.FileHelpers.SizeSuffix(size, 1); + } + /// /// Calcolo URL immagine /// @@ -108,6 +149,7 @@ namespace Lux.UI.Components.Compo protected override async Task OnInitializedAsync() { ConfInit(); + prevJwd = ""; await ReloadBaseList(); DLService.UpdatePipe.EA_NewMessage += UpdatePipe_EA_NewMessage; DLService.CalcDonePipe.EA_NewMessage += CalcDonePipe_EA_NewMessage; @@ -136,6 +178,16 @@ namespace Lux.UI.Components.Compo if (!await JSRuntime.InvokeAsync("confirm", $"Confermi di voler ricalcolare la BOM?")) return; + await reqBomUpdate(currRec); + } + + /// + /// Effettua vera richiesta della BOM + /// + /// + /// + private async Task reqBomUpdate(OfferRowModel currRec) + { // salvo richiesta BOM su record currRec.AwaitBom = true; currRec.AwaitPrice = true; @@ -173,6 +225,7 @@ namespace Lux.UI.Components.Compo private List AllColors = new(); private List AllConfEnvir = new(); + private List AllConfGlass = new(); private List AllConfHardware = new(); @@ -187,13 +240,13 @@ namespace Lux.UI.Components.Compo private List AvailColorMaterialList = new List(); + private List AvailFamilyHardwareList = new List(); + private List AvailGlassList = new List(); private List AvailHardwareList = new(); private List AvailMaterialList = new List(); - private List AvailFamilyHardwareList = new List(); - private string calcTag = "calc"; @@ -203,9 +256,10 @@ namespace Lux.UI.Components.Compo private string currSvg = ""; - private OfferRowModel? EditFileRecord = null; private OfferRowModel? EditBomRecord = null; + private OfferRowModel? EditFileRecord = null; + private OfferRowModel? EditRecord = null; private string genBasePath = "generic"; @@ -248,6 +302,8 @@ namespace Lux.UI.Components.Compo if (currArgs.msgUid.Equals($"{subChannel}:{EditRecord.OfferRowUID}")) { currSvg = currArgs.newMessage; + // salvo in live data... + CurrData.SvgPreview = currSvg; } await InvokeAsync(StateHasChanged); } @@ -292,6 +348,29 @@ namespace Lux.UI.Components.Compo isLoading = false; } + /// + /// Preparazione dati x componente edit JWD + /// + /// + private void PrepareWindowData(string currJwd) + { + // preparo conf oggetti x controllo + SetupList = SetupList = new BaseListPayload() + { + ColorMaterial = AvailColorMaterialList, + FamilyHardware = AvailFamilyHardwareList, + Glass = AvailGlassList, + Hardware = AvailHardwareList, + Material = AvailMaterialList, + TemplateDTO = null + }; + CurrData = new LivePayload() + { + CurrJwd = currJwd, + SvgPreview = currSvg + }; + } + /// /// init classi configurazione /// @@ -343,6 +422,23 @@ namespace Lux.UI.Components.Compo } } + /// + /// Esegue salvataggio del file ricevuto + /// + /// Nome secure da impiegare + /// Contenuto file + private bool saveFileContent(string folderPath, string secureName, string content) + { + bool answ = false; + if (!string.IsNullOrEmpty(folderPath)) + { + // calcolo path file... + string filePath = Path.Combine("unsafe_uploads", folderPath, secureName); + File.WriteAllText(filePath, content); + } + return answ; + } + /// /// Salvataggio del JWD aggiornato nella mia riga di offerta /// @@ -352,16 +448,38 @@ namespace Lux.UI.Components.Compo // ...se ho editing if (EditRecord != null) { - // SE contiene il mio JWD... - if (args.ContainsKey("JWD")) + // SE contiene il mio Jwd... + if (args.ContainsKey("Jwd")) { - string serStruct = args["JWD"]; - // salvo! - await DLService.OffertRowUpdateSerStruct(EditRecord.OfferRowID, serStruct); + reqDict = args; + string serStruct = reqDict["Jwd"]; + // controllo SE variato... + if (!prevJwd.Equals(serStruct)) + { + // aggiorno val prev + prevJwd = serStruct; + // aggiorno live data + CurrData.CurrJwd = serStruct; + // chiamo richiesta update + CalcRequestDTO calcRequestDTO = new CalcRequestDTO(); + calcRequestDTO.EnvType = EditRecord.Envir; + calcRequestDTO.DictExec = reqDict; + // chiamo la chiamata POST alla API, che manda la richiesta via REDIS + await ICService.CallRestPost($"{apiUrl}/{GenericBasePath}", $"{calcTag}/{EditRecord.OfferRowUID}", calcRequestDTO); +#if false + // salvo su DB! + await DLService.OffertRowUpdateSerStruct(EditRecord.OfferRowID, serStruct); +#endif + } } } } + /// + /// Dizionario richieste + /// + private Dictionary reqDict = new Dictionary(); + private async Task setAwaitPrice(bool awaitPrice, bool flushCache) { foreach (var item in AllRecords) @@ -370,6 +488,14 @@ namespace Lux.UI.Components.Compo } } + /// + /// Toggle visibilità modifica file indicando ID della OfferRow corrente (o zero se deselect) + /// + private void ToggleFileEdit(OfferRowModel? currRec) + { + EditFileRecord = currRec; + } + /// /// salva nel record corrente la BOM aggiornata e poi ricalcola importo... /// @@ -432,9 +558,6 @@ namespace Lux.UI.Components.Compo isLoading = false; } - #endregion Private Methods - - /// /// Esegue lettura file + invio richiesta specifica /// @@ -445,9 +568,10 @@ namespace Lux.UI.Components.Compo { if (EditFileRecord != null) { - Dictionary Args = new Dictionary(); + // init dizionari arg richiesta update + Dictionary fileArgs = new Dictionary(); - // leggo il contenuto del PRIMO (singolo) file + // leggo il contenuto del PRIMO (singolo) file IBrowserFile file = e.File; // limite file size (al momento 10 MB) var maxAllowedSize = 10 * 1024 * 1024; @@ -464,55 +588,69 @@ namespace Lux.UI.Components.Compo // salvo sul DB i dati (nome, nome sicuro, size...) await DLService.OffertRowUpdateFileData(EditFileRecord); - // parametri richiesta - Args.Add("Mode", $"{(int)Egw.Window.Data.Enums.QuestionModes.PREVIEW}"); - Args.Add("Btl", rawContent); + // parametri richiesta + fileArgs.Add("Mode", $"{(int)Egw.Window.Data.Enums.QuestionModes.PREVIEW}"); + fileArgs.Add("Btl", rawContent); // invio! CalcRequestDTO calcRequestDTO = new CalcRequestDTO(); calcRequestDTO.EnvType = EgwMultiEngineManager.Data.Constants.EXECENVIRONMENTS.BEAM; - calcRequestDTO.DictExec = Args; + calcRequestDTO.DictExec = fileArgs; await ICService.CallRestPost($"{apiUrl}/{GenericBasePath}", $"{calcTag}/{EditFileRecord.OfferRowUID}", calcRequestDTO); #if false // salvo in locale il file: SISTEMARE PERMESSI - saveFileContent(EditFileRecord.OfferRowUID, trustedFileName, rawContent); + saveFileContent(EditFileRecord.OfferRowUID, trustedFileName, rawContent); #endif } } - /// - /// Esegue salvataggio del file ricevuto - /// - /// Nome secure da impiegare - /// Contenuto file - private bool saveFileContent(string folderPath, string secureName, string content) - { - bool answ = false; - if (!string.IsNullOrEmpty(folderPath)) - { - // calcolo path file... - string filePath = Path.Combine("unsafe_uploads", folderPath, secureName); - File.WriteAllText(filePath, content); - } - return answ; - } /// - /// Display fileSize scalato + /// Chiude edit andando eventualmente a salvare /// - /// + /// /// - protected string fSize(long size) + private async Task CloseEdit(bool doSave) { - return EgwCoreLib.Utils.FileHelpers.SizeSuffix(size, 1); - } - - /// - /// Toggle visibilità modifica file indicando ID della OfferRow corrente (o zero se deselect) - /// - private void ToggleFileEdit(OfferRowModel? currRec) - { - EditFileRecord = currRec; + // ...se ho editing + if (EditRecord != null) + { + bool updateBom = false; + // SE richiesto salvataggio... + if (doSave) + { + // salvo su DB! + await DLService.OffertRowUpdateSerStruct(EditRecord.OfferRowID, prevJwd); + updateBom = true; + } + else + // altrimenti ricalcolo valore salvato + { + prevJwd = EditRecord.SerStruct; + CurrData.CurrJwd = EditRecord.SerStruct; + } + if(updateBom) + { + await reqBomUpdate(EditRecord); + } + // aggiorno nel dizionari + if (reqDict.ContainsKey("Jwd")) + { + reqDict["Jwd"] = prevJwd; + } + + if (reqDict != null && reqDict.Count > 0) + { + // chiamo richiesta update + CalcRequestDTO calcRequestDTO = new CalcRequestDTO(); + calcRequestDTO.EnvType = EditRecord.Envir; + calcRequestDTO.DictExec = reqDict; + // chiamo la chiamata POST alla API, che manda la richiesta via REDIS + await ICService.CallRestPost($"{apiUrl}/{GenericBasePath}", $"{calcTag}/{EditRecord.OfferRowUID}", calcRequestDTO); + } + EditRecord = null; + } } + #endregion Private Methods } } \ No newline at end of file diff --git a/Lux.UI/Lux.UI.csproj b/Lux.UI/Lux.UI.csproj index 68aab77a..5528f1e3 100644 --- a/Lux.UI/Lux.UI.csproj +++ b/Lux.UI/Lux.UI.csproj @@ -5,7 +5,7 @@ enable enable aspnet-Lux.UI-a758c101-a2f4-4e38-977d-1c4887dbbd50 - 0.9.2510.0618 + 0.9.2510.0716 @@ -17,8 +17,8 @@ - - + + @@ -44,8 +44,8 @@ - - + + diff --git a/Lux.UI/appsettings.json b/Lux.UI/appsettings.json index 5c755c52..fb0e4de4 100644 --- a/Lux.UI/appsettings.json +++ b/Lux.UI/appsettings.json @@ -64,8 +64,8 @@ "Prog.ApiUrl": "https://localhost:7135/api", "ImageBaseUrl": "window", "RouteBaseUrl": "window", - "PubChannel": "EgwDevEngineInput", - "SubChannel": "EgwDevEngineOutput", + "PubChannel": "EgwEngineInput", + "SubChannel": "EgwEngineOutput", "SvgChannel": "Egw:svg:img", "BomChannel": "Egw:bom", "UpdateChannel": "Egw:update", diff --git a/Resources/ChangeLog.html b/Resources/ChangeLog.html index bbd05bfd..3a0113c7 100644 --- a/Resources/ChangeLog.html +++ b/Resources/ChangeLog.html @@ -1,6 +1,6 @@ LUX - Web Windows MES -

Versione: 0.9.2510.0618

+

Versione: 0.9.2510.0716


Note di rilascio:
  • diff --git a/Resources/VersNum.txt b/Resources/VersNum.txt index b9966371..3500876c 100644 --- a/Resources/VersNum.txt +++ b/Resources/VersNum.txt @@ -1 +1 @@ -0.9.2510.0618 +0.9.2510.0716 diff --git a/Resources/manifest.xml b/Resources/manifest.xml index b167440a..dcacd156 100644 --- a/Resources/manifest.xml +++ b/Resources/manifest.xml @@ -1,6 +1,6 @@ - 0.9.2510.0618 + 0.9.2510.0716 http://nexus.steamware.net/repository/SWS/GPW/stable/GPW.UI.zip http://nexus.steamware.net/repository/SWS/GPW/stable/ChangeLog.html false