From b13dc6540de71481336afbe8886186377b6df77d Mon Sep 17 00:00:00 2001 From: Annamaria Sassi Date: Thu, 9 Oct 2025 17:46:13 +0200 Subject: [PATCH] - Aggiunta gestione Template - Aggiornato tipo apertura per hardware --- Test.UI/Components/Pages/EditJWD.razor | 13 - Test.UI/Components/Pages/EditJWD.razor.cs | 10 +- Test.UI/Components/Pages/Gerarchia.razor | 37 +- Test.UI/Components/Pages/Gerarchia.razor.cs | 105 ++- Test.UI/Data/FinestraDueAnteSeparate.jwd | 4 +- Test.UI/Hardware/Setup.json | 738 +++++++++--------- WebWindowComplex/DTO/LivePayload.cs | 10 + WebWindowComplex/Json/WindowConst.cs | 22 +- WebWindowComplex/TableComp.razor | 7 +- WebWindowComplex/TableComp.razor.cs | 37 +- WebWindowComplex/WebWindowComplex.csproj | 18 +- WebWindowComplex/Window.cs | 171 ++-- .../WebWindowConfigurator.csproj | 10 +- 13 files changed, 658 insertions(+), 524 deletions(-) diff --git a/Test.UI/Components/Pages/EditJWD.razor b/Test.UI/Components/Pages/EditJWD.razor index 48e4a75..9f4fea9 100644 --- a/Test.UI/Components/Pages/EditJWD.razor +++ b/Test.UI/Components/Pages/EditJWD.razor @@ -25,16 +25,3 @@ else if (!string.IsNullOrEmpty(outSave))

@currJwd

- -@* - IN_ColorMaterialList="@AvailColorMaterialList" - IN_FamilyHardwareList="@AvailFamilyHardwareList" - IN_GlassList="@AvailGlassList" - IN_HardwareList="@AvailHardwareList" - IN_MaterialList="@AvailMaterialList" - LiveSVG="@currSvg" - CurrJwd="@InitialJwd" - IN_SelFamilyHardware="@SelFamilyHardware" - IN_SelColorMaterial="@SelColorMaterial" - IN_SelMaterial="@SelMaterial" - IN_SelGlass="@SelGlass" *@ \ No newline at end of file diff --git a/Test.UI/Components/Pages/EditJWD.razor.cs b/Test.UI/Components/Pages/EditJWD.razor.cs index c32518f..c7a406e 100644 --- a/Test.UI/Components/Pages/EditJWD.razor.cs +++ b/Test.UI/Components/Pages/EditJWD.razor.cs @@ -44,8 +44,8 @@ namespace Test.UI.Components.Pages protected List AvailHardwareList { get; set; } = new List(); protected List AvailFamilyHardwareList { get; set; } = new List() { - new string("Arc"), - new string("Profilo78") + new string("Profilo78"), + new string("Arc") }; protected List AvailColorMaterialList { get; set; } = new List() { @@ -93,10 +93,6 @@ namespace Test.UI.Components.Pages protected override async Task OnInitializedAsync() { ConfInit(); - //SelFamilyHardware = "Natura"; - //SelColorMaterial = "Black"; - //SelColorMaterial = "Pine"; - //SelGlass = "4T/16/4T"; InitialJwd = File.ReadAllText("Data\\AntaDoppia.jwd"); currJwd = InitialJwd; // rileggo altri dati @@ -113,7 +109,7 @@ namespace Test.UI.Components.Pages }; CurrData = new LivePayload() { - CurrJwd = InitialJwd, + InitJwd = InitialJwd, SvgPreview = currSvg }; DLService.CalcDonePipe.EA_NewMessage += CalcDonePipe_EA_NewMessage; diff --git a/Test.UI/Components/Pages/Gerarchia.razor b/Test.UI/Components/Pages/Gerarchia.razor index bfd60ee..e1d9177 100644 --- a/Test.UI/Components/Pages/Gerarchia.razor +++ b/Test.UI/Components/Pages/Gerarchia.razor @@ -3,21 +3,32 @@ Gerarchia - + EC_OnClose="CloseObj" + EC_OnSelectedTemplate="SetTemplate"> + + +@if (!string.IsNullOrEmpty(outClose)) +{ +
+ @outClose +
+} +else if (!string.IsNullOrEmpty(outSave)) +{ +
+ @outSave +
+} +

+ + @(temp); +

+ @*

@m_CurrArgs.GetValueOrDefault("Jwd") diff --git a/Test.UI/Components/Pages/Gerarchia.razor.cs b/Test.UI/Components/Pages/Gerarchia.razor.cs index 010780f..283284a 100644 --- a/Test.UI/Components/Pages/Gerarchia.razor.cs +++ b/Test.UI/Components/Pages/Gerarchia.razor.cs @@ -1,12 +1,13 @@ -using EgwCoreLib.Lux.Core; +using Egw.Window.Data; +using EgwCoreLib.Lux.Core; using EgwCoreLib.Lux.Core.RestPayload; using EgwCoreLib.Lux.Data.Services; using Microsoft.AspNetCore.Components; using Newtonsoft.Json; using NLog; using System.Diagnostics; +using System.Numerics; using System.Security.AccessControl; -using Egw.Window.Data; using WebWindowComplex; using WebWindowComplex.DTO; @@ -16,6 +17,8 @@ namespace Test.UI.Components.Pages { #region Public Properties + string temp = ""; + public string InitialJwd = ""; public Template SelTemplate { get; set; } = new Template(0, "---SELECT---", "", ""); @@ -33,6 +36,7 @@ namespace Test.UI.Components.Pages #region Protected Fields protected string currJwd = "..."; + protected string prevJwd = ""; protected Dictionary m_CurrArgs = new Dictionary(); #endregion Protected Fields @@ -43,8 +47,8 @@ namespace Test.UI.Components.Pages protected List AvailHardwareList { get; set; } = new List(); protected List AvailFamilyHardwareList { get; set; } = new List() { - new string("Natura"), - new string("Optima") + new string("Profilo78"), + new string("Arc") }; protected List AvailColorMaterialList { get; set; } = new List() { @@ -54,17 +58,17 @@ namespace Test.UI.Components.Pages }; protected List AvailMaterialList { get; set; } = new List() { - new string("Pine"), - new string("Fir") + new string("Pino"), + new string("Abete") }; protected List AvailGlassList { get; set; } = new List() { - new string("4/12/4"), - new string("4/16/4"), - new string("4/12/4/12/4"), - new string("4/16/4/16/4"), - new string("4T/12/4T"), - new string("4T/16/4T") + new string("Vetro BE 2S 4/12/4"), + new string("Vetro BE 2S 4/16/4"), + new string("Vetro BE 3S 4/12/4/12/4"), + new string("Vetro BE 3S 4/16/4/16/4"), + new string("Vetro BE 2S 4T/12/4T"), + new string("Vetro BE 2S 4T/16/4T") }; protected string SelFamilyHardware { get; set; } = ""; protected string SelColorMaterial { get; set; } = ""; @@ -92,14 +96,48 @@ namespace Test.UI.Components.Pages protected override async Task OnInitializedAsync() { ConfInit(); - SelFamilyHardware = "Natura"; - SelColorMaterial = "Black"; - SelMaterial = "Pine"; - SelGlass = "4T/16/4T"; - DLService.CalcDonePipe.EA_NewMessage += CalcDonePipe_EA_NewMessage; + // rileggo altri dati await ReloadData(); + // preparo conf oggetti x controllo + SetupList = new BaseListPayload() + { + ColorMaterial = AvailColorMaterialList, + FamilyHardware = AvailFamilyHardwareList, + Glass = AvailGlassList, + Hardware = AvailHardwareList, + Material = AvailMaterialList, + TemplateDTO = AvailTemplateList + }; + CurrData = new LivePayload() + { + //CurrJwd = InitialJwd, + CurrJwd = "", + SvgPreview = currSvg + }; + SelectData = new SelectPayload() + { + FamilyHardware = "Profilo78", + ColorMaterial = "Black", + Material = "Pino", + Glass = "Vetro BE 2S 4T / 16 / 4T", + Template = null, + }; + DLService.CalcDonePipe.EA_NewMessage += CalcDonePipe_EA_NewMessage; } + ///

+ /// Configurazione elenchi anagrafiche + /// + protected BaseListPayload SetupList = new BaseListPayload(); + /// + /// Predisposizione valori live SVG/JWD + /// + protected LivePayload CurrData = new LivePayload(); + /// + /// Predisposizione elementi selezionati + /// + protected SelectPayload SelectData = new SelectPayload(); + #endregion Protected Methods #region Private Fields @@ -119,6 +157,9 @@ namespace Test.UI.Components.Pages private string windowUid = "CurrWindow"; + private string outClose = ""; + private string outSave = ""; + #endregion Private Fields #region Private Methods @@ -133,6 +174,8 @@ namespace Test.UI.Components.Pages if (currArgs.msgUid.Equals($"{subChannel}:{windowUid}")) { currSvg = currArgs.newMessage; + CurrData.SvgPreview = currArgs.newMessage; + m_CurrArgs.TryGetValue("Jwd", out temp); } await InvokeAsync(StateHasChanged); } @@ -187,13 +230,23 @@ namespace Test.UI.Components.Pages private async Task SaveJWD(Dictionary CurrArgs) { + outClose = ""; + outSave = ""; m_CurrArgs = CurrArgs; - // chiamo la chiamata POST alla API, che manda la richiesta via REDIS - if (currJwd != null) + // verifico se contiene JWD, lo aggiorno + if (CurrArgs.ContainsKey("Jwd")) { + currJwd = CurrArgs["Jwd"]; + CurrData.CurrJwd = currJwd; + } + // se il SSE variato --> invio + if (!currJwd.Equals(prevJwd)) + { + prevJwd = currJwd; CalcRequestDTO calcRequestDTO = new CalcRequestDTO(); calcRequestDTO.EnvType = EgwMultiEngineManager.Data.Constants.EXECENVIRONMENTS.WINDOW; calcRequestDTO.DictExec = m_CurrArgs; + // chiamo la chiamata POST alla API, che manda la richiesta via REDIS await ICService.CallRestPost($"{apiUrl}/{GenericBasePath}", $"{calcTag}/{CalcUid}", calcRequestDTO); } } @@ -202,14 +255,26 @@ namespace Test.UI.Components.Pages { string rawVal = ""; currSel = selTemp; - // brutale,d a rivedere... + // brutale,da rivedere... if (File.Exists(selTemp.JwdFileName)) { rawVal = File.ReadAllText(selTemp.JwdFileName); } SelTemplate = new Template(selTemp.Index, selTemp.Description, selTemp.SVGFileName, rawVal); + SelectData.Template = SelTemplate; + } + + /// + /// Effettua chiusura oggetto con eventuale save + /// + /// + private void CloseObj(bool reqSave) + { + outClose = !reqSave ? "Richiesto chiusura!" : ""; + outSave = reqSave ? "Richiesto salvataggio!" : ""; } #endregion Private Methods + } } \ No newline at end of file diff --git a/Test.UI/Data/FinestraDueAnteSeparate.jwd b/Test.UI/Data/FinestraDueAnteSeparate.jwd index 5bedcb0..5e0671c 100644 --- a/Test.UI/Data/FinestraDueAnteSeparate.jwd +++ b/Test.UI/Data/FinestraDueAnteSeparate.jwd @@ -95,7 +95,7 @@ ], "BottomRail": false, "BottomRailQty": 0, - "Hardware": "000000", + "Hardware": "000558", "IdGroup": 4, "AreaList": [ { @@ -144,7 +144,7 @@ ], "BottomRail": false, "BottomRailQty": 0, - "Hardware": "000000", + "Hardware": "000558", "IdGroup": 7, "AreaList": [ { diff --git a/Test.UI/Hardware/Setup.json b/Test.UI/Hardware/Setup.json index 4a81ba4..9c015d0 100644 --- a/Test.UI/Hardware/Setup.json +++ b/Test.UI/Hardware/Setup.json @@ -1,371 +1,371 @@ [ - { - "Description": "Rect_Sash_Compl", - "FamilyName": "Rect", - "Id": "000547", - "OpeningType": "CO", - "SashPosition": 1, - "SashQty": 2, - "Shape": "Rectangular" - }, - { - "Description": "Vasistas", - "FamilyName": "Vasistas", - "Id": "000573", - "OpeningType": "VA", - "SashPosition": 1, - "SashQty": 1, - "Shape": "Rectangular" - }, - { - "Description": "Profilo78_Rect_TripleSash_HiddenHinges", - "FamilyName": "Profilo78", - "Id": "000561", - "OpeningType": "AR", - "SashPosition": 1, - "SashQty": 3, - "Shape": "Rectangular" - }, - { - "Description": "Profilo78_TurnOnly_Rect_DoubleSash", - "FamilyName": "Profilo78", - "Id": "000563", - "OpeningType": "AB", - "SashPosition": 1, - "SashQty": 2, - "Shape": "Rectangular" - }, - { - "Description": "Profilo78_TurnOnly_Rect_TripleSash", - "FamilyName": "Profilo78", - "Id": "000564", - "OpeningType": "AB", - "SashPosition": 2, - "SashQty": 3, - "Shape": "Rectangular" - }, - { - "Description": "SegArc_2S_TurnOnly", - "FamilyName": "SegArc", - "Id": "000603", - "OpeningType": "AB", - "SashPosition": 1, - "SashQty": 2, - "Shape": "Arc" - }, - { - "Description": "Arc_2S_TurnOnly", - "FamilyName": "Arc", - "Id": "000602", - "OpeningType": "AB", - "SashPosition": 1, - "SashQty": 2, - "Shape": "FullArc" - }, - { - "Description": "SegArc_1S_TurnOnly", - "FamilyName": "SegArc", - "Id": "000601", - "OpeningType": "AB", - "SashPosition": 1, - "SashQty": 1, - "Shape": "Arc" - }, - { - "Description": "SemiArc_1S", - "FamilyName": "SemiArc", - "Id": "000610", - "OpeningType": "AR", - "SashPosition": 1, - "SashQty": 1, - "Shape": "SemiFullArc" - }, - { - "Description": "SemiSegArc_S1", - "FamilyName": "SemiSegArc", - "Id": "000611", - "OpeningType": "AR", - "SashPosition": 1, - "SashQty": 1, - "Shape": "SemiArc" - }, - { - "Description": "Arc_1S", - "FamilyName": "Arc", - "Id": "000596", - "OpeningType": "AR", - "SashPosition": 1, - "SashQty": 1, - "Shape": "FullArc" - }, - { - "Description": "SegArc_2S", - "FamilyName": "SegArc", - "Id": "000599", - "OpeningType": "AR", - "SashPosition": 1, - "SashQty": 2, - "Shape": "Arc" - }, - { - "Description": "SegArc_1S", - "FamilyName": "SegArc", - "Id": "000597", - "OpeningType": "AR", - "SashPosition": 1, - "SashQty": 1, - "Shape": "Arc" - }, - { - "Description": "Test aria 4", - "FamilyName": "Test aria 4", - "Id": "000609", - "OpeningType": "AR", - "SashPosition": 1, - "SashQty": 2, - "Shape": "Arc" - }, - { - "Description": "Arc_2S", - "FamilyName": "Arc", - "Id": "000598", - "OpeningType": "AR", - "SashPosition": 1, - "SashQty": 2, - "Shape": "FullArc" - }, - { - "Description": "Arc_1S_TurnOnly", - "FamilyName": "Arc", - "Id": "000600", - "OpeningType": "AB", - "SashPosition": 1, - "SashQty": 1, - "Shape": "FullArc" - }, - { - "Description": "Trap_S1_TurnOnly", - "FamilyName": "Trap", - "Id": "000606", - "OpeningType": "AB", - "SashPosition": 1, - "SashQty": 1, - "Shape": "Trapezoidal" - }, - { - "Description": "Trap_S2", - "FamilyName": "Trap", - "Id": "000605", - "OpeningType": "AR", - "SashPosition": 1, - "SashQty": 2, - "Shape": "Trapezoidal" - }, - { - "Description": "Trap_S2_TurnOnly", - "FamilyName": "Trap", - "Id": "000607", - "OpeningType": "AB", - "SashPosition": 1, - "SashQty": 2, - "Shape": "Trapezoidal" - }, - { - "Description": "Trap_S1", - "FamilyName": "Trap", - "Id": "000604", - "OpeningType": "AR", - "SashPosition": 1, - "SashQty": 1, - "Shape": "Trapezoidal" - }, - { - "Description": "Slide_quadruple", - "FamilyName": "Slide", - "Id": "000595", - "OpeningType": "AS", - "SashPosition": 2, - "SashQty": 4, - "Shape": "Rectangular" - }, - { - "Description": "Slide_2S", - "FamilyName": "Slide", - "Id": "000592", - "OpeningType": "AS", - "SashPosition": 1, - "SashQty": 2, - "Shape": "Rectangular" - }, - { - "Description": "Slide_4S", - "FamilyName": "Slide", - "Id": "000594", - "OpeningType": "AS", - "SashPosition": 2, - "SashQty": 4, - "Shape": "Rectangular" - }, - { - "Description": "Slide_double", - "FamilyName": "Slide", - "Id": "000593", - "OpeningType": "AS", - "SashPosition": 1, - "SashQty": 2, - "Shape": "Rectangular" - }, - { - "Description": "Profilo78_TurnOnly_Rect_QuadrupleSash", - "FamilyName": "Profilo78", - "Id": "000575", - "OpeningType": "AB", - "SashPosition": 2, - "SashQty": 4, - "Shape": "Rectangular" - }, - { - "Description": "Profilo78_Rect_Sash", - "FamilyName": "Profilo78", - "Id": "000558", - "OpeningType": "AR", - "SashPosition": 1, - "SashQty": 1, - "Shape": "Rectangular" - }, - { - "Description": "Profilo78_Rect_DoubleSash", - "FamilyName": "Profilo78", - "Id": "000559", - "OpeningType": "AR", - "SashPosition": 1, - "SashQty": 2, - "Shape": "Rectangular" - }, - { - "Description": "Profilo78_TurnOnly_Rect_TripleSash_CenterHandle", - "FamilyName": "Profilo78", - "Id": "000566", - "OpeningType": "AB", - "SashPosition": 2, - "SashQty": 3, - "Shape": "Rectangular" - }, - { - "Description": "Profilo78_TurnOnly_Rect_TripleSash_SideHandle", - "FamilyName": "Profilo78", - "Id": "000565", - "OpeningType": "AB", - "SashPosition": 1, - "SashQty": 3, - "Shape": "Rectangular" - }, - { - "Description": "Profilo78_Rect_Sash", - "FamilyName": "Profilo78", - "Id": "000562", - "OpeningType": "AB", - "SashPosition": 1, - "SashQty": 1, - "Shape": "Rectangular" - }, - { - "Description": "Profilo78_Rect_TripleSash", - "FamilyName": "Profilo78", - "Id": "000560", - "OpeningType": "AR", - "SashPosition": 1, - "SashQty": 3, - "Shape": "Rectangular" - }, - { - "Description": "Rect_DoubleSash_4", - "FamilyName": "Rect", - "Id": "000550", - "OpeningType": "AR", - "SashPosition": 1, - "SashQty": 2, - "Shape": "Rectangular" - }, - { - "Description": "Rect_DoubleSashStrana", - "FamilyName": "Rect", - "Id": "000552", - "OpeningType": "AR", - "SashPosition": 1, - "SashQty": 3, - "Shape": "Rectangular" - }, - { - "Description": "Rect_DoubleSash", - "FamilyName": "Rect", - "Id": "000549", - "OpeningType": "AR", - "SashPosition": 1, - "SashQty": 2, - "Shape": "Rectangular" - }, - { - "Description": "Round_Sash", - "FamilyName": "Round", - "Id": "000555", - "OpeningType": "BI", - "SashPosition": 1, - "SashQty": 1, - "Shape": "Circular" - }, - { - "Description": "Rect_Sash_Bilico", - "FamilyName": "Rect", - "Id": "000556", - "OpeningType": "BI", - "SashPosition": 1, - "SashQty": 1, - "Shape": "Rectangular" - }, - { - "Description": "Rect_QuadrupolSash_Bandiera", - "FamilyName": "Rect", - "Id": "000554", - "OpeningType": "AB", - "SashPosition": 2, - "SashQty": 4, - "Shape": "Rectangular" - }, - { - "Description": "Rect_Sash_Bandiera", - "FamilyName": "Rect", - "Id": "000551", - "OpeningType": "AB", - "SashPosition": 1, - "SashQty": 1, - "Shape": "Rectangular" - }, - { - "Description": "Rect_Sash", - "FamilyName": "Rect", - "Id": "000544", - "OpeningType": "AR", - "SashPosition": 1, - "SashQty": 1, - "Shape": "Rectangular" - }, - { - "Description": "Rect_TripleSash", - "FamilyName": "Rect", - "Id": "000553", - "OpeningType": "AR", - "SashPosition": 1, - "SashQty": 3, - "Shape": "Rectangular" - }, - { - "Description": "Rect_Sash_4", - "FamilyName": "Rect", - "Id": "000545", - "OpeningType": "AR", - "SashPosition": 1, - "SashQty": 1, - "Shape": "Rectangular" - } + { + "id": "000548", + "familyName": "Rect", + "description": "Rect_DoubleSash", + "openingType": "TiltTurn", + "shape": "Rectangular", + "sashQty": 2, + "sashPosition": 1 + }, + { + "id": "000546", + "familyName": "Trap", + "description": "Trap_Sash", + "openingType": "TiltTurn", + "shape": "Trapezoidal", + "sashQty": 1, + "sashPosition": 1 + }, + { + "id": "000547", + "familyName": "Rect", + "description": "Rect_Sash_Compl", + "openingType": "ComplanarSlide", + "shape": "Rectangular", + "sashQty": 2, + "sashPosition": 1 + }, + { + "id": "000561", + "familyName": "Profilo78", + "description": "Profilo78_Rect_TripleSash_HiddenHinges", + "openingType": "TiltTurn", + "shape": "Rectangular", + "sashQty": 3, + "sashPosition": 1 + }, + { + "id": "000563", + "familyName": "Profilo78", + "description": "Profilo78_TurnOnly_Rect_DoubleSash", + "openingType": "TurnOnly", + "shape": "Rectangular", + "sashQty": 2, + "sashPosition": 1 + }, + { + "id": "000564", + "familyName": "Profilo78", + "description": "Profilo78_TurnOnly_Rect_TripleSash", + "openingType": "TurnOnly", + "shape": "Rectangular", + "sashQty": 3, + "sashPosition": 2 + }, + { + "id": "000603", + "familyName": "SegArc", + "description": "SegArc_2S_TurnOnly", + "openingType": "TurnOnly", + "shape": "Arc", + "sashQty": 2, + "sashPosition": 1 + }, + { + "id": "000602", + "familyName": "Arc", + "description": "Arc_2S_TurnOnly", + "openingType": "TurnOnly", + "shape": "FullArc", + "sashQty": 2, + "sashPosition": 1 + }, + { + "id": "000601", + "familyName": "SegArc", + "description": "SegArc_1S_TurnOnly", + "openingType": "TurnOnly", + "shape": "Arc", + "sashQty": 1, + "sashPosition": 1 + }, + { + "id": "000610", + "familyName": "SemiArc", + "description": "SemiArc_1S", + "openingType": "TiltTurn", + "shape": "SemiFullArc", + "sashQty": 1, + "sashPosition": 1 + }, + { + "id": "000611", + "familyName": "SemiSegArc", + "description": "SemiSegArc_S1", + "openingType": "TiltTurn", + "shape": "SemiArc", + "sashQty": 1, + "sashPosition": 1 + }, + { + "id": "000596", + "familyName": "Arc", + "description": "Arc_1S", + "openingType": "TiltTurn", + "shape": "FullArc", + "sashQty": 1, + "sashPosition": 1 + }, + { + "id": "000599", + "familyName": "SegArc", + "description": "SegArc_2S", + "openingType": "TiltTurn", + "shape": "Arc", + "sashQty": 2, + "sashPosition": 1 + }, + { + "id": "000597", + "familyName": "SegArc", + "description": "SegArc_1S", + "openingType": "TiltTurn", + "shape": "Arc", + "sashQty": 1, + "sashPosition": 1 + }, + { + "id": "000598", + "familyName": "Arc", + "description": "Arc_2S", + "openingType": "TiltTurn", + "shape": "FullArc", + "sashQty": 2, + "sashPosition": 1 + }, + { + "id": "000600", + "familyName": "Arc", + "description": "Arc_1S_TurnOnly", + "openingType": "TurnOnly", + "shape": "FullArc", + "sashQty": 1, + "sashPosition": 1 + }, + { + "id": "000606", + "familyName": "Trap", + "description": "Trap_S1_TurnOnly", + "openingType": "TurnOnly", + "shape": "Trapezoidal", + "sashQty": 1, + "sashPosition": 1 + }, + { + "id": "000605", + "familyName": "Trap", + "description": "Trap_S2", + "openingType": "TiltTurn", + "shape": "Trapezoidal", + "sashQty": 2, + "sashPosition": 1 + }, + { + "id": "000607", + "familyName": "Trap", + "description": "Trap_S2_TurnOnly", + "openingType": "TurnOnly", + "shape": "Trapezoidal", + "sashQty": 2, + "sashPosition": 1 + }, + { + "id": "000604", + "familyName": "Trap", + "description": "Trap_S1", + "openingType": "TiltTurn", + "shape": "Trapezoidal", + "sashQty": 1, + "sashPosition": 1 + }, + { + "id": "000595", + "familyName": "Slide", + "description": "Slide_quadruple", + "openingType": "LiftSlide", + "shape": "Rectangular", + "sashQty": 4, + "sashPosition": 2 + }, + { + "id": "000592", + "familyName": "Slide", + "description": "Slide_2S", + "openingType": "LiftSlide", + "shape": "Rectangular", + "sashQty": 2, + "sashPosition": 1 + }, + { + "id": "000594", + "familyName": "Slide", + "description": "Slide_4S", + "openingType": "LiftSlide", + "shape": "Rectangular", + "sashQty": 4, + "sashPosition": 2 + }, + { + "id": "000593", + "familyName": "Slide", + "description": "Slide_double", + "openingType": "LiftSlide", + "shape": "Rectangular", + "sashQty": 2, + "sashPosition": 1 + }, + { + "id": "000575", + "familyName": "Profilo78", + "description": "Profilo78_TurnOnly_Rect_QuadrupleSash", + "openingType": "TurnOnly", + "shape": "Rectangular", + "sashQty": 4, + "sashPosition": 2 + }, + { + "id": "000558", + "familyName": "Profilo78", + "description": "Profilo78_Rect_Sash", + "openingType": "TiltTurn", + "shape": "Rectangular", + "sashQty": 1, + "sashPosition": 1 + }, + { + "id": "000559", + "familyName": "Profilo78", + "description": "Profilo78_Rect_DoubleSash", + "openingType": "TiltTurn", + "shape": "Rectangular", + "sashQty": 2, + "sashPosition": 1 + }, + { + "id": "000566", + "familyName": "Profilo78", + "description": "Profilo78_TurnOnly_Rect_TripleSash_CenterHandle", + "openingType": "TurnOnly", + "shape": "Rectangular", + "sashQty": 3, + "sashPosition": 2 + }, + { + "id": "000565", + "familyName": "Profilo78", + "description": "Profilo78_TurnOnly_Rect_TripleSash_SideHandle", + "openingType": "TurnOnly", + "shape": "Rectangular", + "sashQty": 3, + "sashPosition": 1 + }, + { + "id": "000562", + "familyName": "Profilo78", + "description": "Profilo78_Rect_Sash", + "openingType": "TurnOnly", + "shape": "Rectangular", + "sashQty": 1, + "sashPosition": 1 + }, + { + "id": "000560", + "familyName": "Profilo78", + "description": "Profilo78_Rect_TripleSash", + "openingType": "TiltTurn", + "shape": "Rectangular", + "sashQty": 3, + "sashPosition": 1 + }, + { + "id": "000550", + "familyName": "Rect", + "description": "Rect_DoubleSash_4", + "openingType": "TiltTurn", + "shape": "Rectangular", + "sashQty": 2, + "sashPosition": 1 + }, + { + "id": "000552", + "familyName": "Rect", + "description": "Rect_DoubleSashStrana", + "openingType": "TiltTurn", + "shape": "Rectangular", + "sashQty": 3, + "sashPosition": 1 + }, + { + "id": "000549", + "familyName": "Rect", + "description": "Rect_DoubleSash", + "openingType": "TiltTurn", + "shape": "Rectangular", + "sashQty": 2, + "sashPosition": 1 + }, + { + "id": "000555", + "familyName": "Round", + "description": "Round_Sash", + "openingType": "Pivot", + "shape": "Circular", + "sashQty": 1, + "sashPosition": 1 + }, + { + "id": "000556", + "familyName": "Rect", + "description": "Rect_Sash_Bilico", + "openingType": "Pivot", + "shape": "Rectangular", + "sashQty": 1, + "sashPosition": 1 + }, + { + "id": "000554", + "familyName": "Rect", + "description": "Rect_QuadrupolSash_Bandiera", + "openingType": "TurnOnly", + "shape": "Rectangular", + "sashQty": 4, + "sashPosition": 2 + }, + { + "id": "000551", + "familyName": "Rect", + "description": "Rect_Sash_Bandiera", + "openingType": "TurnOnly", + "shape": "Rectangular", + "sashQty": 1, + "sashPosition": 1 + }, + { + "id": "000544", + "familyName": "Rect", + "description": "Rect_Sash", + "openingType": "TiltTurn", + "shape": "Rectangular", + "sashQty": 1, + "sashPosition": 1 + }, + { + "id": "000553", + "familyName": "Rect", + "description": "Rect_TripleSash", + "openingType": "TiltTurn", + "shape": "Rectangular", + "sashQty": 3, + "sashPosition": 1 + }, + { + "id": "000545", + "familyName": "Rect", + "description": "Rect_Sash_4", + "openingType": "TiltTurn", + "shape": "Rectangular", + "sashQty": 1, + "sashPosition": 1 + } ] \ No newline at end of file diff --git a/WebWindowComplex/DTO/LivePayload.cs b/WebWindowComplex/DTO/LivePayload.cs index f1f3da8..3ec9cd2 100644 --- a/WebWindowComplex/DTO/LivePayload.cs +++ b/WebWindowComplex/DTO/LivePayload.cs @@ -18,6 +18,16 @@ namespace WebWindowComplex.DTO /// public string CurrJwd { get; set; } = string.Empty; + /// + /// JWD Iniziale + /// + public string InitJwd { get; set; } = string.Empty; + + /// + /// JWD Corrente + /// + public TemplateSelectDTO CurrTemplate { get; set; } = new TemplateSelectDTO(); + /// /// Preview SVG /// diff --git a/WebWindowComplex/Json/WindowConst.cs b/WebWindowComplex/Json/WindowConst.cs index c9eb397..1b429e1 100644 --- a/WebWindowComplex/Json/WindowConst.cs +++ b/WebWindowComplex/Json/WindowConst.cs @@ -84,17 +84,17 @@ namespace WebWindowComplex.Json LIFTSLIDE_RIGHT = 12 } - public enum OpeningTypes : int - { - NULL = 0, - TURNONLY = 1, - TILTTURN = 2, - TILTONLY = 3, - PIVOT = 4, - FIXED = 5, - COMPLANARSLIDE = 6, - LIFTSLIDE = 7 - } + //public enum OpeningTypes : int + //{ + // NULL = 0, + // TURNONLY = 1, + // TILTTURN = 2, + // TILTONLY = 3, + // PIVOT = 4, + // FIXED = 5, + // COMPLANARSLIDE = 6, + // LIFTSLIDE = 7 + //} public enum OpeningSides : int { diff --git a/WebWindowComplex/TableComp.razor b/WebWindowComplex/TableComp.razor index c9d5e7f..6c5f8c9 100644 --- a/WebWindowComplex/TableComp.razor +++ b/WebWindowComplex/TableComp.razor @@ -5,7 +5,7 @@
- @if (string.IsNullOrEmpty(LiveData.CurrJwd)) + @if (string.IsNullOrEmpty(LiveData.InitJwd)) { @if (currStep == CompileStep.Template && ListPayload.TemplateDTO != null) { @@ -167,8 +167,9 @@
Dimension
@foreach (FrameDimension dimension in FrameWindow.DimensionList) { + int n = dimension.nIndex;
- @dimension.sName + @dimension.sName mm
diff --git a/WebWindowComplex/TableComp.razor.cs b/WebWindowComplex/TableComp.razor.cs index 5e372b3..a5fa229 100644 --- a/WebWindowComplex/TableComp.razor.cs +++ b/WebWindowComplex/TableComp.razor.cs @@ -7,6 +7,8 @@ using Newtonsoft.Json.Linq; using System.Reflection.Metadata; using System.Reflection.Metadata.Ecma335; using System.Runtime.InteropServices; +using System.Text.Json; +using System.Text.Json.Serialization; using WebWindowComplex.DTO; using WebWindowComplex.Json; using static WebWindowComplex.Json.WindowConst; @@ -243,6 +245,7 @@ namespace WebWindowComplex } protected string m_SelSVG { get; set; } = ""; + protected string m_CurrJwd { get; set; } = ""; /// /// Componente SVG da mostrare @@ -616,10 +619,17 @@ namespace WebWindowComplex Area.nCounterGroup = 0; UpdateSelParameter(); JsonWindow WindowFromJson; - if (string.IsNullOrEmpty(LiveData.CurrJwd)) + if (string.IsNullOrEmpty(LiveData.InitJwd)) + { WindowFromJson = JsonConvert.DeserializeObject(m_SelTemplate.JWD, new PolymorphicJsonConverter()) ?? new JsonWindow("", "", "", ""); + m_SelTemplate = CurrSelection!.Template; + LiveData.CurrJwd = m_SelTemplate.JWD; + } else - WindowFromJson = JsonConvert.DeserializeObject(LiveData.CurrJwd!, new PolymorphicJsonConverter()) ?? new JsonWindow("", "", "", ""); + { + WindowFromJson = JsonConvert.DeserializeObject(LiveData.InitJwd!, new PolymorphicJsonConverter()) ?? new JsonWindow("", "", "", ""); + LiveData.CurrJwd = LiveData.InitJwd; + } if (m_CurrWindow != null) { m_CurrWindow.OnPreview -= M_CurrWindow_OnPreview; @@ -681,20 +691,22 @@ namespace WebWindowComplex if (ListPayload.IsValid()) { // controllo sia popolato anche per la componente LIVE - if (LiveData.IsValid()) + if (!LiveData.InitJwd.Equals("")) { // SOLO SE modificato live data... if (prevLiveData == null || !prevLiveData.Equals(LiveData)) { prevLiveData = new LivePayload() { - CurrJwd = LiveData.CurrJwd, + CurrJwd = LiveData.InitJwd, SvgPreview = LiveData.SvgPreview }; + if(m_CurrJwd.Equals("")) + m_CurrJwd = LiveData.InitJwd; m_SelSVG = LiveData.SvgPreview; // Aggiornati parametri di ingresso selezionati UpdateSelParameter(); - JsonWindow WindowFromJson = JsonConvert.DeserializeObject(LiveData.CurrJwd, new PolymorphicJsonConverter()) ?? new JsonWindow("", "", "", ""); + JsonWindow WindowFromJson = JsonConvert.DeserializeObject(m_CurrJwd, new PolymorphicJsonConverter()) ?? new JsonWindow("", "", "", ""); setCurrWindow(WindowFromJson); //SOLO SE non sono in edit... if (!editLock) @@ -706,16 +718,18 @@ namespace WebWindowComplex } else if (CurrSelection != null && CurrSelection.Template != null) { + JsonWindow WindowFromJson; // Se viene passato il template selezionato oppure se non è ancora stato selezionato un template oppure se si cambia template di selezione if (m_SelTemplate == null || (m_SelTemplate != null && CurrSelection.Template.nIndex != m_SelTemplate.nIndex) && !string.IsNullOrEmpty(CurrSelection.Template.JWD)) { m_SelTemplate = CurrSelection.Template; - // Aggiornamento parametri di ingresso selezionati - UpdateSelParameter(); - JsonWindow WindowFromJson = JsonConvert.DeserializeObject(m_SelTemplate.JWD, new PolymorphicJsonConverter()) ?? new JsonWindow("", "", "", ""); - setCurrWindow(WindowFromJson); - currStep = CompileStep.Template; + LiveData.CurrJwd = CurrSelection.Template.JWD; + currStep = CompileStep.Tree; } + // Aggiornamento parametri di ingresso selezionati + UpdateSelParameter(); + WindowFromJson = JsonConvert.DeserializeObject(LiveData.CurrJwd, new PolymorphicJsonConverter()) ?? new JsonWindow("", "", "", ""); + setCurrWindow(WindowFromJson); updateSvg = true; } if (SashList.Count > 0) @@ -784,6 +798,7 @@ namespace WebWindowComplex SelColorMaterial = CurrSelection.ColorMaterial ?? ""; SelMaterial = CurrSelection.Material ?? ""; SelGlass = CurrSelection.Glass ?? ""; + m_SelTemplate = CurrSelection.Template; } } @@ -821,7 +836,7 @@ namespace WebWindowComplex private Window? m_PreviousWindow { get; set; } = null; - private string m_SelFamilyHardware { get; set; } = ""; + //private string m_SelFamilyHardware { get; set; } = ""; private Template m_SelTemplate { get; set; } = null!; diff --git a/WebWindowComplex/WebWindowComplex.csproj b/WebWindowComplex/WebWindowComplex.csproj index c3ecb29..98fbdca 100644 --- a/WebWindowComplex/WebWindowComplex.csproj +++ b/WebWindowComplex/WebWindowComplex.csproj @@ -6,7 +6,7 @@ net8.0 enable enable - 2.7.10.818 + 2.7.10.916 Annamaria Sassi Egalware Componente gestione Configurazioni avanzate Window per LUX @@ -18,7 +18,7 @@ - + @@ -123,6 +123,20 @@ + + + + + + + + + + + + + + diff --git a/WebWindowComplex/Window.cs b/WebWindowComplex/Window.cs index d7bacff..4a664c9 100644 --- a/WebWindowComplex/Window.cs +++ b/WebWindowComplex/Window.cs @@ -1,5 +1,6 @@ using Egw.Window.Data; using Newtonsoft.Json; +using Newtonsoft.Json.Converters; using Newtonsoft.Json.Linq; using System.Collections; using System.Collections.ObjectModel; @@ -1172,9 +1173,9 @@ namespace WebWindowComplex internal void SetSelHardwareFromId(string sId) { if (m_HardwareList.Count == 0) - m_SelHardware = m_HardwareCompleteList.FirstOrDefault(x => x.Id.Equals(sId)) ?? new Hardware("", "", "", "", "", 0, 0); + m_SelHardware = m_HardwareCompleteList.FirstOrDefault(x => x.Id.Equals(sId)) ?? new Hardware("", "", "", Enums.OpeningTypes.NULL, "", 0, 0); else - m_SelHardware = m_HardwareList.FirstOrDefault(x => x.Id.Equals(sId)) ?? new Hardware("", "", "", "", "", 0, 0); + m_SelHardware = m_HardwareList.FirstOrDefault(x => x.Id.Equals(sId)) ?? new Hardware("", "", "", Enums.OpeningTypes.NULL, "", 0, 0); if (m_SelHardware == null) m_SelHardware = m_HardwareList[0]; //SelFamilyHardware = m_SelHardware.FamilyName; @@ -1188,7 +1189,7 @@ namespace WebWindowComplex } set { - m_SelHardware = m_HardwareList.FirstOrDefault(x => !string.IsNullOrEmpty(value) && x.Id.Equals(value)) ?? new Hardware("", "", "", "", "", 0, 0); + m_SelHardware = m_HardwareList.FirstOrDefault(x => !string.IsNullOrEmpty(value) && x.Id.Equals(value)) ?? new Hardware("", "", "", Enums.OpeningTypes.NULL, "", 0, 0); ParentWindow.OnUpdatePreview(ParentWindow.sSerialized()); } } @@ -1238,58 +1239,112 @@ namespace WebWindowComplex return "Rectangular"; } - internal OpeningTypes GetOpeningType(Openings OpeningType) + internal Enums.OpeningTypes GetOpeningType(Openings OpeningType) { switch (OpeningType) { case Openings.TURNONLY_LEFT: case Openings.TURNONLY_RIGHT: { - return OpeningTypes.TURNONLY; + return Enums.OpeningTypes.TURNONLY; } case Openings.TILTTURN_LEFT: case Openings.TILTTURN_RIGHT: { - return OpeningTypes.TILTTURN; + return Enums.OpeningTypes.TILTTURN; } case Openings.TILTONLY_TOP: case Openings.TILTONLY_BOTTOM: { - return OpeningTypes.TILTONLY; + return Enums.OpeningTypes.TILTONLY; } case Openings.PIVOT: { - return OpeningTypes.PIVOT; + return Enums.OpeningTypes.PIVOT; } case Openings.FIXED: { - return OpeningTypes.FIXED; + return Enums.OpeningTypes.FIXED; } case Openings.COMPLANARSLIDE_LEFT: case Openings.COMPLANARSLIDE_RIGHT: { - return OpeningTypes.COMPLANARSLIDE; + return Enums.OpeningTypes.COMPLANARSLIDE; } case Openings.LIFTSLIDE_LEFT: case Openings.LIFTSLIDE_RIGHT: { - return OpeningTypes.LIFTSLIDE; + return Enums.OpeningTypes.LIFTSLIDE; } default: { - return OpeningTypes.NULL; + return Enums.OpeningTypes.NULL; } } } - private string ConvertOpeningType() + //private string ConvertOpeningType() + //{ + // if (m_SashList.Count > 1) + // { + // for (int i = 0; i < m_SashList.Count; i++) + // { + // if (m_SashList[i].bHasHandle) + // { + // if (GetOpeningType(m_SashList[i].OpeningType) == OpeningTypes.TURNONLY) + // return "AB"; + // else + // return "AR"; + // } + + // } + // return ""; + // } + // else if (m_SashList.Count == 1) + // { + // switch (GetOpeningType(m_SashList[0].OpeningType)) + // { + // case OpeningTypes.TILTTURN: + // { + // return "AR"; + // } + // case OpeningTypes.TURNONLY: + // { + // return "AB"; + // } + // case OpeningTypes.TILTONLY: + // { + // return "VA"; + // } + // case OpeningTypes.PIVOT: + // { + // return "BI"; + // } + // case OpeningTypes.COMPLANARSLIDE: + // { + // return "CO"; + // } + // case OpeningTypes.LIFTSLIDE: + // { + // return "AS"; + // } + // default: + // { + // return ""; + // } + // } + // } + // return ""; + //} + + private Enums.OpeningTypes ConvertOpeningType() { if (m_SashList.Count > 1) { @@ -1297,50 +1352,16 @@ namespace WebWindowComplex { if (m_SashList[i].bHasHandle) { - if (GetOpeningType(m_SashList[i].OpeningType) == OpeningTypes.TURNONLY) - return "AB"; - else - return "AR"; + return GetOpeningType(m_SashList[i].OpeningType); } } - return ""; + return Enums.OpeningTypes.NULL; } - else if (m_SashList.Count == 1) + else { - switch (GetOpeningType(m_SashList[0].OpeningType)) - { - case OpeningTypes.TILTTURN: - { - return "AR"; - } - case OpeningTypes.TURNONLY: - { - return "AB"; - } - case OpeningTypes.TILTONLY: - { - return "VA"; - } - case OpeningTypes.PIVOT: - { - return "BI"; - } - case OpeningTypes.COMPLANARSLIDE: - { - return "CO"; - } - case OpeningTypes.LIFTSLIDE: - { - return "AS"; - } - default: - { - return ""; - } - } + return GetOpeningType(m_SashList[0].OpeningType); } - return ""; } public void RefreshHardwareList() @@ -1349,11 +1370,11 @@ namespace WebWindowComplex { m_HardwareList.Clear(); string sSashShape = FindSashShape(); - string sOpeningType = ConvertOpeningType(); + Enums.OpeningTypes sOpeningType = ConvertOpeningType(); var iComp = StringComparison.InvariantCultureIgnoreCase; var rawList = m_HardwareCompleteList .Where(x => x.Id == "000000" || - (!string.IsNullOrEmpty(m_SelFamilyHardware) && x.FamilyName.Equals(m_SelFamilyHardware, iComp) && x.SashQty == nSashQty && x.Shape.Equals(sSashShape, iComp) && x.OpeningType.Equals(sOpeningType, iComp)) + (!string.IsNullOrEmpty(m_SelFamilyHardware) && x.FamilyName.Equals(m_SelFamilyHardware, iComp) && x.SashQty == nSashQty && x.Shape.Equals(sSashShape, iComp) && x.OpeningType == sOpeningType) ) .ToList(); if (rawList != null && rawList.Count > 0) @@ -1735,28 +1756,34 @@ namespace WebWindowComplex AreaList.Clear(); SetSplitQtyVert(0); SetSplitQtyHoriz(0); - if (m_SelSplitShape == SplitShapes.VERTICAL) + switch (SelSplitShape) { - // Inserisco valori di default - SetSplitQtyVert(1); - SetSplitStartVert(true); - } - else if (m_SelSplitShape == SplitShapes.HORIZONTAL) - { - // Inserisco valori di default - SetSplitQtyHoriz(1); - SetSplitStartVert(false); - } - else - { - // Inserisco valori di default - SetSplitQtyVert(1); - SetSplitQtyHoriz(1); - SetSplitStartVert(true); + case SplitShapes.VERTICAL: + { + // Inserisco valori di default + SetSplitQtyVert(1); + SetSplitStartVert(true); + break; + } + case SplitShapes.HORIZONTAL: + { + // Inserisco valori di default + SetSplitQtyHoriz(1); + SetSplitStartVert(false); + break; + } + case SplitShapes.GRID: + { + // Inserisco valori di default + SetSplitQtyVert(1); + SetSplitQtyHoriz(1); + SetSplitStartVert(true); + break; + } } // Aggiungo area Splitted e vetro - int nVert = m_SplitVertList.Count > 0 ? m_SplitVertList.Count : 1; - int nHoriz = m_SplitHorizList.Count > 0 ? m_SplitHorizList.Count : 1; + int nVert = SplitVertList.Count > 0 ? SplitVertList.Count : 1; + int nHoriz = SplitHorizList.Count > 0 ? SplitHorizList.Count : 1; for (var SplitIndex = 0; SplitIndex <= (nVert * nHoriz) - 1; SplitIndex++) { AreaList.Add(Splitted.CreateSplitted(this)); diff --git a/WebWindowConfigurator/WebWindowConfigurator.csproj b/WebWindowConfigurator/WebWindowConfigurator.csproj index 833cdad..7d44d51 100644 --- a/WebWindowConfigurator/WebWindowConfigurator.csproj +++ b/WebWindowConfigurator/WebWindowConfigurator.csproj @@ -6,7 +6,7 @@ net8.0 enable enable - 2.7.10.818 + 2.7.10.916 Annamaria Sassi Egalware Componente gestione JWD per LUX @@ -163,6 +163,14 @@ + + + + + + + +