fix lettura e deserializzazione parametri di base
This commit is contained in:
@@ -16,6 +16,7 @@ namespace WebDoorCreator.Data.DTO
|
||||
#endregion Public Constructors
|
||||
|
||||
#region Public Properties
|
||||
public string version { get; set; } = "0";
|
||||
|
||||
public string code { get; set; } = "0015943";
|
||||
public DateTime date { get; set; } = DateTime.Now;
|
||||
@@ -28,7 +29,6 @@ namespace WebDoorCreator.Data.DTO
|
||||
public string secure { get; set; } = "UP";
|
||||
public Sizing size { get; set; } = new Sizing();
|
||||
public string swing { get; set; } = "RH";
|
||||
public string version { get; set; } = "0";
|
||||
|
||||
#endregion Public Properties
|
||||
|
||||
@@ -78,7 +78,7 @@ namespace WebDoorCreator.Data.DTO
|
||||
|
||||
// aggiungo la parte doorOp come yaml reale/striped...
|
||||
if (!string.IsNullOrEmpty(serialDoorOps))
|
||||
{
|
||||
{
|
||||
fullData += serialDoorOps;
|
||||
}
|
||||
|
||||
|
||||
@@ -38,22 +38,58 @@ namespace WebDoorCreator.UI.Components.DoorDef
|
||||
//currVal = new Dictionary<string, string>();
|
||||
if (!string.IsNullOrEmpty(DoorOpInst.JsoncActVal))
|
||||
{
|
||||
var deserialized = JsonConvert.DeserializeObject<Dictionary<string, string>>(DoorOpInst.JsoncActVal!);
|
||||
var deserializedToComp = JsonConvert.DeserializeObject<Dictionary<string, string>>(DoorOpInst.JsoncActVal!);
|
||||
//var k = JsonConvert.DeserializeObject<Dictionary<string, Dictionary<string, string>>>(DoorOpInst.JsoncActVal!);
|
||||
var deserialized = JsonConvert.DeserializeObject<Dictionary<string, Dictionary<string, string>>>(DoorOpInst.JsoncActVal!);
|
||||
|
||||
var deserializedToComp = JsonConvert.DeserializeObject<Dictionary<string, Dictionary<string, string>>>(DoorOpInst.JsoncActVal!);
|
||||
if (deserialized != null)
|
||||
{
|
||||
currVal = deserialized;
|
||||
currValToCompare = deserializedToComp;
|
||||
foreach (var kvp in deserialized)
|
||||
{
|
||||
foreach (var val in kvp.Value)
|
||||
{
|
||||
if (!currVal.ContainsKey(val.Key))
|
||||
{
|
||||
|
||||
currVal.Add(val.Key, val.Value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
if (deserializedToComp != null)
|
||||
{
|
||||
foreach (var kvp in deserializedToComp)
|
||||
{
|
||||
foreach (var val in kvp.Value)
|
||||
{
|
||||
if (!currValToCompare.ContainsKey(val.Key))
|
||||
{
|
||||
currValToCompare.Add(val.Key, val.Value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void setupGraphicParams()
|
||||
{
|
||||
var deserialized = JsonConvert.DeserializeObject<Dictionary<string, List<string>>>(DoorOpInst.JsoncConfigVal!);
|
||||
var deserialized = JsonConvert.DeserializeObject<Dictionary<string, Dictionary<string, List<string>>>>(DoorOpInst.JsoncConfigVal!);
|
||||
if (deserialized != null)
|
||||
{
|
||||
graphicParams = deserialized;
|
||||
//graphicParamsTemp = deserialized;
|
||||
foreach (var kvp in deserialized)
|
||||
{
|
||||
foreach (var val in kvp.Value)
|
||||
{
|
||||
if (!graphicParams.ContainsKey(val.Key))
|
||||
{
|
||||
graphicParams.Add(val.Key, val.Value);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -64,12 +100,13 @@ namespace WebDoorCreator.UI.Components.DoorDef
|
||||
/// <summary>
|
||||
/// Array dati
|
||||
/// </summary>
|
||||
protected Dictionary<string, string> currVal { get; set; } = null!;
|
||||
protected Dictionary<string, string> currVal { get; set; } = new Dictionary<string, string>();
|
||||
|
||||
protected Dictionary<string, string>? currValToCompare { get; set; }
|
||||
protected Dictionary<string, string> currValToCompare { get; set; } = new Dictionary<string, string>();
|
||||
|
||||
|
||||
protected Dictionary<string, List<string>> graphicParams { get; set; } = null!;
|
||||
protected Dictionary<string, List<string>> graphicParams { get; set; } = new Dictionary<string, List<string>>();
|
||||
protected Dictionary<string, Dictionary<string, List<string>>> graphicParamsTemp { get; set; } = null!;
|
||||
|
||||
[Inject]
|
||||
protected IJSRuntime JSRuntime { get; set; } = null!;
|
||||
@@ -111,10 +148,10 @@ namespace WebDoorCreator.UI.Components.DoorDef
|
||||
{
|
||||
if (currValToCompare != null)
|
||||
{
|
||||
if (k.Value != currValToCompare[k.Key])
|
||||
{
|
||||
answ = true;
|
||||
}
|
||||
//if (k.Value != currValToCompare[k.Key])
|
||||
//{
|
||||
// answ = true;
|
||||
//}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -208,8 +245,11 @@ namespace WebDoorCreator.UI.Components.DoorDef
|
||||
|
||||
private async Task FullReloadData(bool isFirst)
|
||||
{
|
||||
setupCurrValues();
|
||||
setupGraphicParams();
|
||||
if (DoorOpInst.ObjectId != "Size")
|
||||
{
|
||||
setupCurrValues();
|
||||
setupGraphicParams();
|
||||
}
|
||||
//await ReloadData(isFirst);
|
||||
}
|
||||
|
||||
|
||||
@@ -4,7 +4,6 @@ using Newtonsoft.Json;
|
||||
using WebDoorCreator.Data.DbModels;
|
||||
using WebDoorCreator.Data.DTO;
|
||||
using WebDoorCreator.UI.Data;
|
||||
using YamlDotNet.RepresentationModel;
|
||||
|
||||
namespace WebDoorCreator.UI.Pages
|
||||
{
|
||||
@@ -25,17 +24,14 @@ namespace WebDoorCreator.UI.Pages
|
||||
#region Protected Properties
|
||||
|
||||
protected DoorModel? currDoor { get; set; } = null;
|
||||
protected WebDoorCreator.Data.DbModels.Edges edgesFirstInst { get; set; } = new WebDoorCreator.Data.DbModels.Edges();
|
||||
|
||||
protected int currDoorType { get; set; } = 0;
|
||||
|
||||
/// <summary>
|
||||
/// Unità di misura selezionata
|
||||
/// </summary>
|
||||
protected string currMeaUnit { get; set; } = "mm";
|
||||
|
||||
protected List<DoorModel>? DoorsList { get; set; } = null;
|
||||
|
||||
protected WebDoorCreator.Data.DbModels.Edges edgesFirstInst { get; set; } = new WebDoorCreator.Data.DbModels.Edges();
|
||||
protected int idOrd { get; set; } = -1;
|
||||
|
||||
[Inject]
|
||||
@@ -53,6 +49,8 @@ namespace WebDoorCreator.UI.Pages
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
protected DDFDto CurrentConf { get; set; } = new DDFDto();
|
||||
|
||||
protected async Task createDoor()
|
||||
{
|
||||
// conto le porte x questo ordine e uso x chiamata successiva...
|
||||
@@ -92,7 +90,8 @@ namespace WebDoorCreator.UI.Pages
|
||||
profCurrMach = listRecordEdge.Where(x => x.Value == "machining").FirstOrDefault();
|
||||
profCurrOverMat = listRecordEdge.Where(x => x.Value == "overmaterial").FirstOrDefault();
|
||||
}
|
||||
Dictionary<string, Dictionary<string, List<string>>> itemsDict = new Dictionary<string, Dictionary<string, List<string>>>();
|
||||
Dictionary<string, Dictionary<string, List<string>>> itemsDictDef = new Dictionary<string, Dictionary<string, List<string>>>();
|
||||
Dictionary<string, Dictionary<string, string>> itemsDictAct = new Dictionary<string, Dictionary<string,string>>();
|
||||
Dictionary<string, List<string>> paramsDict = new Dictionary<string, List<string>>();
|
||||
Dictionary<string, string> actDict = new Dictionary<string, string>();
|
||||
List<string> listDefVal = new List<string>();
|
||||
@@ -110,7 +109,7 @@ namespace WebDoorCreator.UI.Pages
|
||||
paramsDict.Add(item.Value, listDefVal);
|
||||
}
|
||||
|
||||
itemsDict.Add(item.DefaultVal, paramsDict);
|
||||
itemsDictDef.Add(item.DefaultVal, paramsDict);
|
||||
}
|
||||
//defaultParamsList.Add(listDefVal);
|
||||
}
|
||||
@@ -134,13 +133,12 @@ namespace WebDoorCreator.UI.Pages
|
||||
// salvo Door OP associate
|
||||
paramsDict.Clear();
|
||||
actDict.Clear();
|
||||
itemsDict.Clear();
|
||||
itemsDictDef.Clear();
|
||||
if (listRecordEdge != null)
|
||||
{
|
||||
listDefVal.Clear();
|
||||
if (profCurrType != null)
|
||||
{
|
||||
|
||||
foreach (var param in profCurrType.DefaultVal.Split(","))
|
||||
{
|
||||
listDefVal.Add(param.Trim());
|
||||
@@ -151,7 +149,7 @@ namespace WebDoorCreator.UI.Pages
|
||||
//listDefVal.Clear();
|
||||
}
|
||||
//itemsDict.Add(item.Value, paramsDict);
|
||||
//paramsDict.Clear();
|
||||
//paramsDict.Clear();
|
||||
}
|
||||
if (profCurrMach != null)
|
||||
{
|
||||
@@ -160,6 +158,7 @@ namespace WebDoorCreator.UI.Pages
|
||||
{
|
||||
listDefValCurrMach.Add(profCurrMach.DefaultVal.Trim());
|
||||
paramsDict.Add(profCurrMach.Value, listDefValCurrMach);
|
||||
actDict.Add(profCurrMach.Value, profCurrMach.DefaultVal.Trim());
|
||||
}
|
||||
}
|
||||
if (profCurrOverMat != null)
|
||||
@@ -169,24 +168,28 @@ namespace WebDoorCreator.UI.Pages
|
||||
{
|
||||
listDefValOverMat.Add(profCurrOverMat.DefaultVal.Trim());
|
||||
paramsDict.Add(profCurrOverMat.Value, listDefValOverMat);
|
||||
actDict.Add(profCurrOverMat.Value, profCurrOverMat.DefaultVal.Trim());
|
||||
}
|
||||
}
|
||||
}
|
||||
foreach (var item in listRecordEdge.Where(x => x.Value != "type" && x.Value != "machining" && x.Value != "overmaterial"))
|
||||
{
|
||||
if (!itemsDict.ContainsKey(item.Value))
|
||||
if (!itemsDictDef.ContainsKey(item.Value))
|
||||
{
|
||||
itemsDict.Add(item.Value, paramsDict);
|
||||
itemsDictDef.Add(item.Value, paramsDict);
|
||||
}
|
||||
if (!itemsDictAct.ContainsKey(item.Value))
|
||||
{
|
||||
itemsDictAct.Add(item.Value, actDict);
|
||||
}
|
||||
|
||||
//defaultParamsList.Add(listDefVal);
|
||||
//defaultDict.Add(item.Label, listDefVal);
|
||||
}
|
||||
}
|
||||
//actDict.Add(HwToShow.TableName, actParamsList);
|
||||
|
||||
jsonDef = JsonConvert.SerializeObject(itemsDict);
|
||||
jsonAct = JsonConvert.SerializeObject(actDict);
|
||||
jsonDef = JsonConvert.SerializeObject(itemsDictDef);
|
||||
jsonAct = JsonConvert.SerializeObject(itemsDictAct);
|
||||
|
||||
doorOpToAdd = new DoorOpModel()
|
||||
{
|
||||
@@ -209,12 +212,9 @@ namespace WebDoorCreator.UI.Pages
|
||||
await InvokeAsync(StateHasChanged);
|
||||
}
|
||||
|
||||
|
||||
// rimando alla pagina... dettaglio...
|
||||
NavManager.NavigateTo($"/DoorDefinition?idOrd={idOrd}&idDoor={doorId}");
|
||||
}
|
||||
protected DDFDto CurrentConf { get; set; } = new DDFDto();
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
await Task.Delay(1);
|
||||
|
||||
@@ -2,8 +2,9 @@
|
||||
#Config: EgtCompoBase
|
||||
#Door1
|
||||
|
||||
version: 2
|
||||
code: 0015943
|
||||
date: 2023-04-21T09:42:37.3671832+02:00
|
||||
date: 2023-04-21T12:51:15.4331164+02:00
|
||||
material: wood
|
||||
measures: millimiters
|
||||
order:
|
||||
@@ -37,21 +38,5 @@ size:
|
||||
height: 81.25
|
||||
thickness: 1.75
|
||||
swing: RH
|
||||
version: 2
|
||||
ept:
|
||||
- template: Generic\StdEPT
|
||||
ToptoCL: 15
|
||||
FacetoCL: 0.875
|
||||
- template: Generic\StdEPT
|
||||
ToptoCL: 15
|
||||
FacetoCL: 0.875
|
||||
|
||||
flush_bolts:
|
||||
- template: Corner\8501
|
||||
type: corner
|
||||
side: top
|
||||
position: 5
|
||||
offset_WS: 0.0
|
||||
|
||||
|
||||
---
|
||||
|
||||
Reference in New Issue
Block a user