This commit is contained in:
zaccaria.majid
2023-04-26 16:52:05 +02:00
12 changed files with 273 additions and 199 deletions
+1 -1
View File
@@ -9,7 +9,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WebDoorCreator.Core", "WebD
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WebDoorCreator.Data", "WebDoorCreator.Data\WebDoorCreator.Data.csproj", "{26466C0D-8946-466B-A38C-C1A9603DA2DC}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WebDoorCreator.API", "WebDoorCreator.API\WebDoorCreator.API.csproj", "{2DFE8045-2F56-43E2-9D2F-1180EF7AD721}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WebDoorCreator.API", "WebDoorCreator.API\WebDoorCreator.API.csproj", "{2DFE8045-2F56-43E2-9D2F-1180EF7AD721}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -0,0 +1,11 @@
@if (CurrBaseDoorOp == null)
{
<EgwCoreLib.Razor.LoadingData></EgwCoreLib.Razor.LoadingData>
}
else
{
@foreach (var item in CurrBaseDoorOp)
{
<DoorDataBlock BlockDoorOp="@item"></DoorDataBlock>
}
}
@@ -0,0 +1,27 @@
using Microsoft.AspNetCore.Components;
using WebDoorCreator.Data.DbModels;
namespace WebDoorCreator.UI.Components.DoorDef
{
public partial class BaseParamList
{
#region Public Properties
/// <summary>
/// Elenco parametri di base
/// </summary>
[Parameter]
public List<DoorOpModel>? CurrBaseDoorOp { get; set; } = null;
#endregion Public Properties
#region Protected Properties
/// <summary>
/// Lingua utente (FixMe !!!)
/// </summary>
protected string userLang { get; set; } = "EN";
#endregion Protected Properties
}
}
@@ -0,0 +1,12 @@
<div class="text-center">
<h5>@BlockDoorOp.ObjectId</h5>
</div>
@if (bdpList != null)
{
foreach (var item in bdpList)
{
<DoorDefSizingSI Lingua="@userLang" currValRef="@item.Value" paramsConfig="@getParamsConfig(item.Key)" HwCode="@item.Key" E_ItemChanged="@doSaveBlock"></DoorDefSizingSI>
}
<hr />
}
@@ -0,0 +1,99 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Components;
using System.Net.Http;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Components.Authorization;
using Microsoft.AspNetCore.Components.Forms;
using Microsoft.AspNetCore.Components.Routing;
using Microsoft.AspNetCore.Components.Web;
using Microsoft.AspNetCore.Components.Web.Virtualization;
using Microsoft.JSInterop;
using WebDoorCreator.UI;
using WebDoorCreator.UI.Components;
using WebDoorCreator.UI.Components.Buttons;
using WebDoorCreator.UI.Components.CompMan;
using WebDoorCreator.UI.Components.DoorMan;
using WebDoorCreator.UI.Components.DoorDef;
using WebDoorCreator.UI.Components.Gen;
using WebDoorCreator.UI.Components.Order;
using WebDoorCreator.UI.Components.Users;
using WebDoorCreator.UI.Components.Hardware;
using WebDoorCreator.UI.Shared;
using WebDoorCreator.Data.DbModels;
using Newtonsoft.Json;
namespace WebDoorCreator.UI.Components.DoorDef
{
public partial class DoorDataBlock
{
/// <summary>
/// Blocco parametri di base
/// </summary>
[Parameter]
public DoorOpModel BlockDoorOp { get; set; } = null!;
protected string userLang { get; set; } = "EN";
/// <summary>
/// spacchetto componenti
/// </summary>
protected override void OnParametersSet()
{
setupCurrValues();
setupParamConfig();
}
protected Dictionary<string, Dictionary<string, string>>? bdpList { get; set; } = new Dictionary<string, Dictionary<string, string>>();
protected Dictionary<string, Dictionary<string, List<string>>>? bdpConfiglist { get; set; } = new Dictionary<string, Dictionary<string, List<string>>>();
public void setupCurrValues()
{
//currVal = new Dictionary<string, string>();
if (!string.IsNullOrEmpty(BlockDoorOp.JsoncActVal))
{
bdpList = JsonConvert.DeserializeObject<Dictionary<string, Dictionary<string, string>>>(BlockDoorOp.JsoncActVal!);
}
}
public void setupParamConfig()
{
bdpConfiglist = JsonConvert.DeserializeObject<Dictionary<string, Dictionary<string, List<string>>>>(BlockDoorOp.JsoncConfigVal!);
}
protected Dictionary<string, List<string>> getParamsConfig(string paramName)
{
Dictionary<string, List<string>> answ = new Dictionary<string, List<string>>();
if (bdpConfiglist != null && bdpConfiglist.Count > 0)
{
if (bdpConfiglist.ContainsKey(paramName))
{
answ = bdpConfiglist[paramName];
}
}
return answ;
}
protected async Task doSaveBlock(Dictionary<string, Dictionary<string, string>> updSet)
{
if (bdpList != null)
{
if (updSet != null && updSet.Count > 0)
{
KeyValuePair<string, Dictionary<string, string>> currSet = updSet.FirstOrDefault();
if (bdpList.ContainsKey(currSet.Key))
{
bdpList[currSet.Key] = currSet.Value;
// serializzo e salvo, rimandando evento ad obj contenitore
// FixMe ToDo !!!
}
}
}
}
}
}
@@ -1,13 +1,15 @@
@if (currVal == null)
{
<EgwCoreLib.Razor.LoadingData></EgwCoreLib.Razor.LoadingData>
<EgwCoreLib.Razor.LoadingDataSmall></EgwCoreLib.Razor.LoadingDataSmall>
}
else
{
<div class="d-flex justify-content-between small">
<div style="width: 90%">
<div style="width: 90%;">
<div class="row my-1">
<b>@HwCode</b>
</div>
@foreach (var item in currVal)
{
@if (isCombo(item.Key))
@@ -16,7 +18,6 @@ else
<div class="col-4 d-flex flex-wrap align-items-center">
<span>@translate(item.Key)</span>
</div>
<select class="col-7" @bind="@currVal[item.Key]">
@foreach (var param in comboSet(item.Key))
{
@@ -33,7 +34,6 @@ else
<div class="col-4 d-flex flex-wrap align-items-center">
<span>@translate(item.Key)</span>
</div>
<input type="text" class="col-7" @bind="@currVal[item.Key]" />
</div>
}
@@ -51,6 +51,19 @@ else
</div>
</div>
}
else
{
<div class="col-10">
<div class="btn-group w-100">
<button class="btn btn-outline-secondary" style="cursor: pointer;" disabled>
CANCEL
</button>
<button class="btn btn-outline-secondary" style="cursor: pointer;" disabled>
SAVE
</button>
</div>
</div>
}
</div>
</div>
</div>
@@ -1,7 +1,6 @@
using Microsoft.AspNetCore.Components;
using Microsoft.JSInterop;
using Newtonsoft.Json;
using WebDoorCreator.Data.DbModels;
using WebDoorCreator.Data.Services;
using WebDoorCreator.UI.Data;
@@ -11,114 +10,54 @@ namespace WebDoorCreator.UI.Components.DoorDef
{
#region Public Properties
/// <summary>
/// Array dati x comparazione
/// </summary>
[Parameter]
public DoorOpModel DoorOpInst { get; set; } = null!;
public Dictionary<string, string> currValRef { get; set; } = new Dictionary<string, string>();
[Parameter]
public int DoorId { get; set; } = 0;
[Parameter]
public EventCallback<Dictionary<string, Dictionary<string, string>>> E_ItemChanged { get; set; }
[Parameter]
public string HwCode { get; set; } = "";
[Parameter]
public int instanceN { get; set; } = 0;
[Parameter]
public string Lingua { get; set; } = "EN";
/// <summary>
/// parametri di configurazione oggetto
/// </summary>
[Parameter]
public int DoorId { get; set; } = 0;
public Dictionary<string, List<string>> paramsConfig { get; set; } = new Dictionary<string, List<string>>();
[CascadingParameter]
public string userId { get; set; } = "";
#endregion Public Properties
#region Public Methods
public void setupCurrValues()
{
//currVal = new Dictionary<string, string>();
if (!string.IsNullOrEmpty(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)
{
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, Dictionary<string, List<string>>>>(DoorOpInst.JsoncConfigVal!);
if (deserialized != null)
{
//graphicParamsTemp = deserialized;
foreach (var kvp in deserialized)
{
if (!graphicParams.ContainsKey(kvp.Key))
{
graphicParams.Add(kvp.Key, kvp.Value);
}
}
}
}
#endregion Public Methods
#region Protected Properties
/// <summary>
/// Array dati
/// Array dati effettivo x gestione modifiche
/// </summary>
protected Dictionary<string, string> currVal { get; set; } = new Dictionary<string, string>();
protected Dictionary<string, string> currValToCompare { get; set; } = new Dictionary<string, string>();
//protected Dictionary<string, List<string>> graphicParams { get; set; } = new Dictionary<string, List<string>>();
protected Dictionary<string, Dictionary<string, List<string>>> graphicParams { get; set; } = new Dictionary<string, Dictionary<string, List<string>>>();
protected Dictionary<string, Dictionary<string, List<string>>> graphicParamsTemp { get; set; } = null!;
[Inject]
protected IJSRuntime JSRuntime { get; set; } = null!;
[Inject]
protected QueueDataService QDataServ { get; set; } = null!;
[Inject]
protected WebDoorCreatorService WDCService { get; set; } = null!;
[Inject]
protected WDCVocabularyService WDVService { get; set; } = null!;
[Inject]
protected QueueDataService QDataServ { get; set; } = null!;
#endregion Protected Properties
#region Protected Methods
@@ -126,17 +65,10 @@ namespace WebDoorCreator.UI.Components.DoorDef
protected List<string> comboSet(string pKey)
{
List<string> answ = new List<string>();
foreach (var item in graphicParams)
if (paramsConfig.ContainsKey(pKey))
{
foreach (var param in item.Value)
{
//if (item.ContainsKey(pKey))
//{
// answ = param[pKey].ToList();
//}
}
answ = paramsConfig[pKey].ToList();
}
return answ;
}
@@ -148,85 +80,38 @@ namespace WebDoorCreator.UI.Components.DoorDef
protected bool doCheckVal()
{
bool answ = false;
if (currValToCompare != null)
if (currValRef != null)
{
foreach (var k in currVal)
{
if (currValToCompare != null)
if (currValRef != null)
{
//if (k.Value != currValToCompare[k.Key])
//{
// answ = true;
//}
if (k.Value != currValRef[k.Key])
{
answ = true;
}
}
}
}
return answ;
}
protected async Task doClone()
{
DateTime adesso = DateTime.Now;
DoorOpModel doorOpToAdd = new DoorOpModel()
{
DateIns = adesso,
DateMod = adesso,
UserIdIns = userId,
UserIdMod = userId,
ObjectId = DoorOpInst.ObjectId,
DoorId = DoorOpInst.DoorId,
JsoncConfigVal = DoorOpInst.JsoncConfigVal,
JsoncActVal = DoorOpInst.JsoncActVal,
userConfirm = DoorOpInst.userConfirm,
DtConfirm = DoorOpInst.DtConfirm
};
List<DoorOpModel> doorOpAddList = new List<DoorOpModel>() { doorOpToAdd };
// salvo!
await WDCService.DoorOpInsert(DoorOpInst.DoorId, doorOpAddList);
await FullReloadData(true);
}
protected async Task doConfirm()
{
DoorOpInst.userConfirm = userId;
DoorOpInst.DtConfirm = DateTime.Now;
// salvo!
await WDCService.DoorOpUpdate(DoorOpInst);
}
protected async Task doDeleteInst()
{
var done = await JSRuntime.InvokeAsync<bool>("confirm", "Delete PERMANENTLY the current record?");
if (done)
{
await WDCService.DoorOpDelete(DoorOpInst);
await FullReloadData(true);
}
}
protected async Task doSave()
{
// ri-serializzo i graphics parameters...
string serVal = JsonConvert.SerializeObject(currVal);
DoorOpInst.JsoncActVal = serVal;
// salvo!
await WDCService.DoorOpUpdate(DoorOpInst);
// invio msg dato "salvabile"
#if false
await QDataServ.sendCalcReq($"ORD{DoorOpInst.DoorId:00000}");
#endif
// rileggo
await FullReloadData(true);
await Task.Delay(1);
// preparo i dati...
Dictionary<string, Dictionary<string, string>> updSet = new Dictionary<string, Dictionary<string, string>>();
updSet.Add(HwCode, currVal);
// solleva evento con dizionario contentente chiave + valori current
await E_ItemChanged.InvokeAsync(updSet);
}
protected bool isCombo(string pKey)
{
bool answ = false;
if (graphicParams.ContainsKey(pKey))
if (paramsConfig.ContainsKey(pKey))
{
answ = graphicParams[pKey].Count > 1;
answ = paramsConfig[pKey].Count > 1;
}
return answ;
}
@@ -251,19 +136,19 @@ namespace WebDoorCreator.UI.Components.DoorDef
private async Task FullReloadData(bool isFirst)
{
if (DoorOpInst.ObjectId != "Size")
// serializzo e deserializzo i valori current da quelli di riferimento
string serObj = JsonConvert.SerializeObject(currValRef);
if (!string.IsNullOrEmpty(serObj))
{
setupCurrValues();
setupGraphicParams();
var newObj = JsonConvert.DeserializeObject<Dictionary<string, string>>(serObj);
if (newObj != null)
{
currVal = newObj;
}
}
//await ReloadData(isFirst);
await Task.Delay(1);
}
//private async Task ReloadData(bool isFirst)
//{
// await FullReloadData(true);
//}
#endregion Private Methods
}
}
@@ -99,8 +99,6 @@ else
<input type="text" class="col-7" @bind="@currVal[item.Key]" />
</div>
}
}
}
+2
View File
@@ -19,6 +19,8 @@
#region Public Properties
public Dictionary<string, string> UserPref { get; set; } = new Dictionary<string, string>();
public string userId
{
get => _userId;
+10 -17
View File
@@ -16,27 +16,20 @@
</div>
<div>
@if (currDefStep == Core.Enum.DoorDefStep.Door)
{
@if (ListBaseDoorOp != null)
<CascadingValue Value="@WDCUService.userId">
@if (currDefStep == Core.Enum.DoorDefStep.Door)
{
@foreach (var item in ListBaseDoorOp)
@if (ListBaseDoorOp != null)
{
<CascadingValue Value="@WDCUService.userId">
<DoorDefSizingSI Lingua="@userLang" DoorOpInst="@item" HwCode="@item.ObjectId"></DoorDefSizingSI>
</CascadingValue>
<BaseParamList CurrBaseDoorOp="@ListBaseDoorOp"></BaseParamList>
}
@*<DoorSizingStep E_paramChanged="catchParamChange" DoorId="@idDoor"></DoorSizingStep>*@
}
@*<DoorSizingStep E_paramChanged="catchParamChange" DoorId="@idDoor"></DoorSizingStep>*@
}
else if (currDefStep == Core.Enum.DoorDefStep.Hardware)
{
<CascadingValue Value="@WDCUService.userId">
<CascadingValue Value="@catchParamChange">
<HardwareList isHwStep="@setHwToNull" DoorId="@idDoor" Lingua="@userLang"></HardwareList>
</CascadingValue>
</CascadingValue>
}
else if (currDefStep == Core.Enum.DoorDefStep.Hardware)
{
<HardwareList isHwStep="@setHwToNull" DoorId="@idDoor" Lingua="@userLang"></HardwareList>
}
</CascadingValue>
</div>
</div>
<div class="col-5">
+32 -16
View File
@@ -15,6 +15,8 @@ namespace WebDoorCreator.UI.Pages
public void Dispose()
{
ListBaseDoorOp = null;
orderStatus = null;
WDCUService.EA_CurrLanguage -= WDUService_EA_CurrLanguage;
QDataServ.CalcDonePipe.EA_NewMessage -= CalcDonePipe_EA_NewMessage;
}
@@ -81,10 +83,20 @@ namespace WebDoorCreator.UI.Pages
protected async Task ReloadData()
{
ListBaseDoorOp = null;
ListHwDoorOp = null;
orderStatus = null;
await Task.Delay(1);
var ListRecordDoorOp = await WDService.DoorOpGetByDoorId(idDoor);
if (ListRecordDoorOp != null)
{
ListHwDoorOp = ListRecordDoorOp;
ListBaseDoorOp = ListRecordDoorOp.Where(x => x.ObjectId == "Size" || x.ObjectId == "Profiles").ToList();
// calcolo gli hw togliendo DoorOpBase
foreach (var item in ListBaseDoorOp)
{
ListHwDoorOp.Remove(item);
}
}
var domani = DateTime.Today.AddDays(1);
ListOrdersStatus = null;
@@ -97,22 +109,6 @@ namespace WebDoorCreator.UI.Pages
await Task.Delay(1);
}
#endregion Protected Methods
#region Private Fields
private static Logger Log = LogManager.GetCurrentClassLogger();
private List<DoorOpModel>? ListBaseDoorOp = null;
private List<OrderStatusViewModel>? ListOrdersStatus = null;
#endregion Private Fields
#region Private Methods
private Core.Enum.DoorDefStep currDefStep { get; set; } = Core.Enum.DoorDefStep.Door;
private bool setHwToNull { get; set; } = false;
/// <summary>
/// gestione impostazione step
/// </summary>
@@ -129,6 +125,26 @@ namespace WebDoorCreator.UI.Pages
}
}
#endregion Protected Methods
#region Private Fields
private static Logger Log = LogManager.GetCurrentClassLogger();
#endregion Private Fields
#region Private Properties
private Core.Enum.DoorDefStep currDefStep { get; set; } = Core.Enum.DoorDefStep.Door;
private List<DoorOpModel>? ListBaseDoorOp { get; set; } = null;
private List<DoorOpModel>? ListHwDoorOp { get; set; } = null;
private List<OrderStatusViewModel>? ListOrdersStatus { get; set; } = null;
private bool setHwToNull { get; set; } = false;
#endregion Private Properties
#region Private Methods
private async void CalcDonePipe_EA_NewMessage(object? sender, EventArgs e)
{
DoorSvgContent = "";
+19 -1
View File
@@ -12,7 +12,7 @@ order:
project:
pO:
line:
date: 2023-04-26T11:32:28.7333201+02:00
date: 2023-04-26T12:20:39.8125610+02:00
piece: DO_1
size:
width: 33.8125
@@ -43,6 +43,24 @@ hardware:
- 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
groove:
- template: Generic\Groove
type: side
width: 0.6
depth: 0.8
offset_WS: 0
side: bottom
---