diff --git a/Test.UI/Components/Pages/EditJWD.razor.cs b/Test.UI/Components/Pages/EditJWD.razor.cs index c7e0d11..fd351a1 100644 --- a/Test.UI/Components/Pages/EditJWD.razor.cs +++ b/Test.UI/Components/Pages/EditJWD.razor.cs @@ -517,11 +517,13 @@ namespace Test.UI.Components.Pages // deserializzo il dizionario delle risposte... Dictionary rawDict = JsonConvert.DeserializeObject>(currArgs.newMessage) ?? new Dictionary(); if (rawDict.Count > 0) - { currHwOption = rawDict; - CurrData.DictOptionsXml = currHwOption; - } } + else + { + currHwOption = new Dictionary(); + } + CurrData.DictOptionsXml = currHwOption; await InvokeAsync(StateHasChanged); } await Task.Delay(1); diff --git a/Test.UI/Data/AntaDoppia.jwd b/Test.UI/Data/AntaDoppia.jwd index b462eba..f78a0d0 100644 --- a/Test.UI/Data/AntaDoppia.jwd +++ b/Test.UI/Data/AntaDoppia.jwd @@ -152,12 +152,12 @@ "SashType": "NULL", "BottomRail": false, "BottomRailQty": 0, - //"BottomRailElemDimList": [ - // { - // "Index": 1, - // "Value": 78.0 - // } - //], + "BottomRailElemDimList": [ + { + "Index": 1, + "Value": 78.0 + } + ], "Hardware": "000633", "HwOptionList": [ { diff --git a/WebWindowComplex/Compo/AreaSash.razor.cs b/WebWindowComplex/Compo/AreaSash.razor.cs index 149a2a1..a4eaf32 100644 --- a/WebWindowComplex/Compo/AreaSash.razor.cs +++ b/WebWindowComplex/Compo/AreaSash.razor.cs @@ -64,6 +64,12 @@ namespace WebWindowComplex.Compo [Parameter] public EventCallback EC_EditView { get; set; } + /// + /// Evento per richiedere reset dizionari + /// + [Parameter] + public EventCallback EC_ReqResetDict { get; set; } + /// /// Anta corrente /// @@ -144,6 +150,7 @@ namespace WebWindowComplex.Compo { if (CurrSashDim.SelOpeningTypeIndex != value) { + _ = EC_ReqResetDict.InvokeAsync(new DataUpdateRes { req = LayoutConst.DataAction.ResetHwOpt }); CurrSashDim.SelOpeningTypeIndex = value; _ = EC_UpdateSashDim.InvokeAsync(CurrSashDim); } diff --git a/WebWindowComplex/Compo/CardFrame.razor.cs b/WebWindowComplex/Compo/CardFrame.razor.cs index ee3f71f..72c3603 100644 --- a/WebWindowComplex/Compo/CardFrame.razor.cs +++ b/WebWindowComplex/Compo/CardFrame.razor.cs @@ -15,7 +15,7 @@ namespace WebWindowComplex.Compo public EventCallback EC_ReqClose { get; set; } /// - /// Evento per richiedere reset dizionario Shape + /// Evento per richiedere reset dizionari /// [Parameter] public EventCallback EC_ReqResetDict { get; set; } @@ -77,9 +77,10 @@ namespace WebWindowComplex.Compo if (CurrFrameWindow.SelShapeIndex != value) { CurrFrameWindow.SelShapeIndex = value; - // richiesta reset dict shape + // richiesta reset dict shape, profili element e hw option _ = EC_ReqResetDict.InvokeAsync(new DataUpdateRes { req = LayoutConst.DataAction.ResetDictShape}); _ = EC_ReqResetDict.InvokeAsync(new DataUpdateRes { req = LayoutConst.DataAction.ResetDimElem }); + _ = EC_ReqResetDict.InvokeAsync(new DataUpdateRes { req = LayoutConst.DataAction.ResetHwOpt }); foreach (var s in SashList) { s.SelHardwareFromId = "000000"; diff --git a/WebWindowComplex/Compo/CardSashGroup.razor b/WebWindowComplex/Compo/CardSashGroup.razor index b9ace2a..e340b36 100644 --- a/WebWindowComplex/Compo/CardSashGroup.razor +++ b/WebWindowComplex/Compo/CardSashGroup.razor @@ -186,6 +186,7 @@ EditMode="editMode" EC_UpdateSash="UpdateSash" EC_UpdateSashDim="UpdateSashDimension" + EC_ReqResetDict="ResetDict" EC_EditView="EditView"> diff --git a/WebWindowComplex/Compo/CardSashGroup.razor.cs b/WebWindowComplex/Compo/CardSashGroup.razor.cs index 4e7b1e4..da4f366 100644 --- a/WebWindowComplex/Compo/CardSashGroup.razor.cs +++ b/WebWindowComplex/Compo/CardSashGroup.razor.cs @@ -91,6 +91,7 @@ namespace WebWindowComplex.Compo { CurrSashGroup.nSashQty = value; _ = EC_ReqResetDict.InvokeAsync(new DataUpdateRes { req = LayoutConst.DataAction.ResetDimElem }); + _ = EC_ReqResetDict.InvokeAsync(new DataUpdateRes { req = LayoutConst.DataAction.ResetHwOpt }); var args = new DataUpdateSash() { currSash = CurrSashGroup, @@ -98,7 +99,8 @@ namespace WebWindowComplex.Compo }; _ = EC_UpdateSashGroup.InvokeAsync(args); _ = EC_ReqElement.InvokeAsync(CurrSashGroup); - _ = EC_ReqOptionHw.InvokeAsync(CurrSashGroup); + if(CurrSashGroup.SelHardware.Id != "000000") + _ = EC_ReqOptionHw.InvokeAsync(CurrSashGroup); } } } @@ -328,6 +330,12 @@ namespace WebWindowComplex.Compo await EC_UpdateSashGroup.InvokeAsync(args); } } + + protected async Task ResetDict(DataUpdateRes args) + { + await EC_ReqResetDict.InvokeAsync(args); + } + #endregion Protected Methods #region Private Methods diff --git a/WebWindowComplex/Models/Sash.cs b/WebWindowComplex/Models/Sash.cs index 4d6ddcf..0695cf6 100644 --- a/WebWindowComplex/Models/Sash.cs +++ b/WebWindowComplex/Models/Sash.cs @@ -845,11 +845,11 @@ namespace WebWindowComplex.Models foreach (var HwOption in HwOptionList) JsonSash.HwOptionList.Add(HwOption.Serialize()); } - else - { - foreach (var HwOption in SelHwOptionList) - JsonSash.HwOptionList.Add(new JsonHwOption(HwOption.Key, HwOption.Value)); - } + //else if(currHwId != "000000") + //{ + // foreach (var HwOption in SelHwOptionList) + // JsonSash.HwOptionList.Add(new JsonHwOption(HwOption.Key, HwOption.Value)); + //} //if (SashArcElem != null) // JsonSash.ArcElement = SashArcElem.Serialize(); //else diff --git a/WebWindowComplex/TableComp.razor.cs b/WebWindowComplex/TableComp.razor.cs index b7034e3..2f41adf 100644 --- a/WebWindowComplex/TableComp.razor.cs +++ b/WebWindowComplex/TableComp.razor.cs @@ -602,11 +602,7 @@ namespace WebWindowComplex { listErrLink.Add("Window", $"Deserializing Error:{Environment.NewLine}{ex}"); // uso un oggetto "basico" per non fermarmi - //string jwd = "{\r\n \"ProfilePath\": \"Profilo78\",\r\n \"Material\": \"Pino\",\r\n \"ColorMaterial\": \"Black\",\r\n \"Glass\": \"Vetro BE 2S 4T/16/4T\",\r\n \"AreaList\": [\r\n {\r\n \"Shape\": \"RECTANGLE\",\r\n \"DimensionList\": [\r\n {\r\n \"Index\": 1,\r\n \"Name\": \"Width\",\r\n \"Value\": 800.0\r\n },\r\n {\r\n \"Index\": 2,\r\n \"Name\": \"Height\",\r\n \"Value\": 1200.0\r\n }\r\n ],\r\n \"JointList\": [\r\n {\r\n \"Index\": 1,\r\n \"JointType\": \"FULL_H\"\r\n },\r\n {\r\n \"Index\": 2,\r\n \"JointType\": \"FULL_H\"\r\n },\r\n {\r\n \"Index\": 3,\r\n \"JointType\": \"FULL_H\"\r\n },\r\n {\r\n \"Index\": 4,\r\n \"JointType\": \"FULL_H\"\r\n }\r\n ],\r\n \"BottomRail\": false,\r\n \"BottomRailQty\": 0,\r\n \"GroupId\": 1,\r\n \"AreaList\": [\r\n {\r\n \"FillType\": \"GLASS\",\r\n \"GroupId\": 7,\r\n \"AreaList\": [],\r\n \"AreaType\": \"FILL\"\r\n }\r\n ],\r\n \"AreaType\": \"FRAME\"\r\n }\r\n ]\r\n}"; - //WindowFromJson = JsonConvert.DeserializeObject(jwd, new PolymorphicJsonConverter()) ?? new JsonWindow("", "", "", ""); - //setCurrWindow(WindowFromJson); - //await DoPreviewSvg(true); - BuildFrameDefault(); + await BuildFrameDefault(); } } else @@ -654,7 +650,7 @@ namespace WebWindowComplex } else { - BuildFrameDefault(); + await BuildFrameDefault(); } } else @@ -703,22 +699,31 @@ namespace WebWindowComplex fill.GroupId = 2; frame.AreaList.Add(fill); JsonWindow jsonWindow = window.Serialize(); - //JsonWindow jsonWindow = new JsonWindow("Profilo78", "Pino", "Black", "Vetro BE 2S 4T/16/4T"); - //jsonWindow.Deserialize(); - //JsonFrame jsonFrame = new JsonFrame(Shapes.RECTANGLE, "Bottom", false, 0, 1); - //jsonWindow.AreaList.Add(jsonFrame); - ////jsonFrame.ArcElement = ae.Serialize(); - //foreach (var Dimension in DimensionList) - // jsonFrame.DimensionList.Add(Dimension.Serialize()); - //foreach (var Joint in JointList) - // jsonFrame.JointList.Add(Joint.Serialize()); - //JsonFill jsonFill = new JsonFill(FillTypes.GLASS, 2); string jwd = JsonConvert.SerializeObject(jsonWindow); JsonWindow WindowFromJson = JsonConvert.DeserializeObject(jwd, new PolymorphicJsonConverter()) ?? new JsonWindow("", "", "", ""); setCurrWindow(WindowFromJson); await DoPreviewSvg(true); } + /// + /// Metodo per controllare che non ci siano duplicati di GroupId + /// + /// + /// + protected bool CheckGroupId(Window window) + { + List groupIdList = new List(); + SearchInWindow(window.AreaList.First(), groupIdList); + var duplicati = groupIdList.GroupBy(x => x) + .Where(g => g.Count() > 1) + .Select(g => g.Key) + .ToList(); + if (duplicati.Count > 0) + return false; + else + return true; + } + /// /// Metodo per costruire oggetti della Window /// @@ -730,7 +735,8 @@ namespace WebWindowComplex m_CurrWindow = null; } m_CurrWindow = WindowFromJson.Deserialize(); - if(m_CurrWindow.AreaList != null && m_CurrWindow.AreaList.Count > 0) + groupIdOK = CheckGroupId(m_CurrWindow); + if(m_CurrWindow.AreaList != null && m_CurrWindow.AreaList.Count > 0 && groupIdOK) { FrameWindow = m_CurrWindow.AreaList[0]; if (m_PreviousWindow != null) @@ -860,6 +866,7 @@ namespace WebWindowComplex private CompileStep currStep; private bool editLock = false; private bool firstDisplay = true; + private bool groupIdOK = false; /// /// Booleana fase loading @@ -974,7 +981,6 @@ namespace WebWindowComplex // verifico 1:1 le liste e i valori siano coerenti... if (ListPayload.ColorMaterial != null && ListPayload.ColorMaterial.Count > 0) { - // verifico colore attuale sia consistente... if (m_CurrWindow != null) { if (ListPayload.ColorMaterial == null || !ListPayload.ColorMaterial.Contains(m_CurrWindow.sColorMaterial)) @@ -993,6 +999,10 @@ namespace WebWindowComplex { listWarnings.Add("Profile", $"Missing Profile: {m_CurrWindow.sProfilePath}"); } + if (!groupIdOK) + { + listWarnings.Add("GroupId", "JWD not correct!"); + } } } } @@ -1580,6 +1590,23 @@ namespace WebWindowComplex return "btn btn-secondary btn-sm"; } + + /// + /// Metodo per ottenere lista groupId + /// + /// Area da aggiungere alla lista groupId + /// Lista group id + protected void SearchInWindow(Area node, List groupIdList) + { + if (node != null) + { + groupIdList.Add(node.GroupId); + foreach (var item in node.AreaList) + { + SearchInWindow(item, groupIdList); + } + } + } #endregion Private Methods } } \ No newline at end of file diff --git a/WebWindowComplex/WebWindowComplex.csproj b/WebWindowComplex/WebWindowComplex.csproj index d99b038..bc4fa32 100644 --- a/WebWindowComplex/WebWindowComplex.csproj +++ b/WebWindowComplex/WebWindowComplex.csproj @@ -6,7 +6,7 @@ net8.0 enable enable - 3.1.2.410 + 3.1.2.415 Annamaria Sassi Egalware Componente gestione Configurazioni avanzate Window per LUX @@ -67,6 +67,8 @@ + + diff --git a/WebWindowConfigurator/WebWindowConfigurator.csproj b/WebWindowConfigurator/WebWindowConfigurator.csproj index dd59260..f174a1b 100644 --- a/WebWindowConfigurator/WebWindowConfigurator.csproj +++ b/WebWindowConfigurator/WebWindowConfigurator.csproj @@ -6,7 +6,7 @@ net8.0 enable enable - 3.1.2.410 + 3.1.2.415 Annamaria Sassi Egalware Componente gestione JWD per LUX @@ -56,6 +56,31 @@ + + + + + + + + + + + + + + + + + + + + + + + + +