This commit is contained in:
Emmanuele Sassi
2023-05-17 10:15:20 +02:00
40 changed files with 1222 additions and 163 deletions
File diff suppressed because one or more lines are too long
+20 -1
View File
@@ -94,6 +94,25 @@ namespace WebDoorCreator.Data.DbModels
[ForeignKey("TypeId")]
public virtual DoorTypeModel? TypeNav { get; set; }
public DoorModel ObjClone(string userId)
{
DateTime adesso = DateTime.Now;
DoorModel answ = new DoorModel()
{
MeasureUnit = MeasureUnit,
TypeId = TypeId,
DoorExtCode = DoorExtCode,
DateIns = adesso,
UserIdIns = userId,
DateMod = adesso,
UserIdMod = userId,
DoorDescript = DoorDescript,
UnitCost = UnitCost,
DateLockExpiry = DateLockExpiry,
UserIdLock = UserIdLock
};
return answ;
}
}
}
@@ -150,6 +150,30 @@ namespace WebDoorCreator.Data.Services
return errVal.ToString();
}
/// <summary>
/// Cerca nelle esecuzioni ultimo SVG della porta e lo restituisce...
/// </summary>
/// <param name="DoorId"></param>
/// <returns></returns>
public async Task<string> DoorGetLastSvg(int DoorId)
{
string answ = "";
// cerco in hashtable dei task eseguiti ultimo x porta corrente...
var doorData = await RequestDoneGetSingle(DoorId);
if (doorData != null && doorData.Count > 0)
{
var firstRecord = doorData.FirstOrDefault();
// recupero da REDIS
var currSvgKey = new RedisKey($"{Constants.CALC_REQ_SVG_CACHE}:{firstRecord.Key}:{firstRecord.Value}");
var rawData = await redisDb.StringGetAsync(currSvgKey);
if (rawData.HasValue)
{
answ = $"{rawData}";
}
}
return answ;
}
/// <summary>
/// Remove for single hash record
/// </summary>
@@ -370,6 +394,35 @@ namespace WebDoorCreator.Data.Services
return dictResult;
}
/// <summary>
/// Get LAST request done for DoorId
/// </summary>
/// <param name="DoorId"></param>
/// <returns></returns>
public async Task<Dictionary<string, string>> RequestDoneGetSingle(int DoorId)
{
string source = "REDIS";
long numReq = 0;
Dictionary<string, string> dictResult = new Dictionary<string, string>();
// cerco da cache
RedisKey currKey = new RedisKey(Constants.CALC_REQ_DONE);
Stopwatch stopWatch = new Stopwatch();
stopWatch.Start();
numReq = redisDb.HashLength(currKey);
if (numReq > 0)
{
var rawData = await redisDb.HashGetAsync(currKey, $"{DoorId}");
if (rawData.HasValue)
{
dictResult.Add($"{DoorId}", $"{rawData}");
}
}
stopWatch.Stop();
TimeSpan ts = stopWatch.Elapsed;
Log.Debug($"RequestDoneGetSingle | {source} in: {ts.TotalMilliseconds} ms");
return dictResult;
}
/// <summary>
/// Remove for single hash record
/// </summary>
@@ -609,7 +662,7 @@ namespace WebDoorCreator.Data.Services
{
// salvo in area REDIS
currSvgKey = new RedisKey($"{Constants.CALC_REQ_SVG_CACHE}:{sDoorId}:{sCurrVers}");
await redisDb.StringSetAsync(currSvgKey, calcTask.SvgGen, DayLongCache);
await redisDb.StringSetAsync(currSvgKey, calcTask.SvgGen, WeekLongCache);
// elimino dalle code proc/err
await RequestProcessingRemove(sDoorId);
await RequestErrRemove(sDoorId);
@@ -621,7 +674,7 @@ namespace WebDoorCreator.Data.Services
{
// salvo in area REDIS
currSvgKey = new RedisKey($"{Constants.CALC_REQ_ERRS}:{sDoorId}:{sCurrVers}");
await redisDb.StringSetAsync(currSvgKey, calcTask.ErrorMsg, DayLongCache);
await redisDb.StringSetAsync(currSvgKey, calcTask.ErrorMsg, WeekLongCache);
// elimino dalle code proc/done
await RequestProcessingRemove(sDoorId);
await RequestDoneRemove(sDoorId);
@@ -963,6 +1016,14 @@ namespace WebDoorCreator.Data.Services
get => TimeSpan.FromSeconds(cacheTtlLong * 10 * rnd.Next(900, 1100) / 1000);
}
/// <summary>
/// Durata cache di 24h
/// </summary>
private TimeSpan WeekLongCache
{
get => TimeSpan.FromHours(24 * 7);
}
#endregion Private Properties
#region Private Methods
@@ -14,8 +14,6 @@ namespace WebDoorCreator.UI.Components.DoorDef
set
{
_svgContent = value;
//Log.Info($"Ricevuto {value}");
//StateHasChanged();
}
}
@@ -4,19 +4,26 @@
{
<div class="row">
<div class="col-4 py-1">
<DoorSvgObj LineColor="rgb(39, 174, 96)" LineWidth="8" ObjH="200" ObjW="900" LeftTextClass="col-10 fs-1 fw-bold" RightTextClass="col-2" EC_ExeFunct="@(()=> createDoor(""))" ObjId="0" TextData="@AddDoorDict"></DoorSvgObj>
<DoorSvgObj LineColor="rgb(39, 174, 96)" LineWidth="8" ObjH="200" ObjW="900" LeftTextClass="col-10 fs-1 fw-bold" RightTextClass="col-2" EC_ExeFunct="@(()=> createDoor(""))" ObjId="-1" TextData="@AddDoorDict" ImagePath="images/LogoEgwBlack.png"></DoorSvgObj>
</div>
<div class="col-4 py-1">
<DoorSvgObj LineColor="rgb(39, 174, 96)" LineWidth="8" ObjH="200" ObjW="900" LeftTextClass="col-10 fs-1 fw-bold" RightTextClass="col-2" EC_ExeFunct="@(()=> createDoor(""))" ObjId="0" TextData="@AddFromTemplDict"></DoorSvgObj>
<DoorSvgObj LineColor="rgb(39, 174, 96)" LineWidth="8" ObjH="200" ObjW="900" LeftTextClass="col-10 fs-1 fw-bold" RightTextClass="col-2" EC_ExeFunct="@(()=> setCloneDoorMode(""))" ObjId="-2" TextData="@AddFromTemplDict" ImagePath="images/LogoEgwBlue.png"></DoorSvgObj>
</div>
<div class="col-4 py-1">
<DoorSvgObj LineColor="#8E44AD" LineWidth="8" ObjH="200" ObjW="900" LeftTextClass="col-10 fs-1 fw-bold" RightTextClass="col-2" EC_ExeFunct="@(()=> sendToAbh(currOrderId, orderStatus))" ObjId="0" TextData="@SendOrderDict" Message1="@currOrderId.ToString()" Message2="@orderStatus.ToString()"></DoorSvgObj>
<DoorSvgObj LineColor="#8E44AD" LineWidth="8" ObjH="200" ObjW="900" LeftTextClass="col-10 fs-1 fw-bold" RightTextClass="col-2" EC_ExeFunct="@(()=> sendToAbh(currOrderId, orderStatus))" ObjId="-3" TextData="@SendOrderDict" Message1="@currOrderId.ToString()" Message2="@orderStatus.ToString()" ImagePath="images/LogoEgwWhite.png"></DoorSvgObj>
</div>
</div>
}
<div class="row">
<div class="col-4">
<button @onclick="()=>setAddRemDoor()">ADD REM MODE</button>
</div>
</div>
<div class="row">
@if (DoorsList == null || DoorsList.Count == 0)
{ }
{
<LoadingDataSmall></LoadingDataSmall>
}
else
{
int idxCount = 0;
@@ -26,7 +33,20 @@
imgPath = $"images/LogoEgw{idxCount % 5:00}.png";
idxCount++;
<div class="col-3 py-1">
<DoorSvgObj LineColor="#2D3047" LineWidth="8" ObjH="200" ObjW="650" LeftTextClass="col-4" RightTextClass="col-8" EC_ExeFunct="@(()=> editRec(@door.DoorId.ToString()))" Message1="@door.DoorId.ToString()" ImagePath="@imgPath" ObjId="idxCount" TextData="@textDictSetup(door)"></DoorSvgObj>
@if (isCloneMode)
{
<DoorSvgObj LineColor="#2D3047" LineWidth="8" ObjH="200" ObjW="650" LeftTextClass="col-4" RightTextClass="col-8" EC_ExeClone="@(()=>doClone(""))" Message1="@door.DoorId.ToString()" ShowClone="true" ImagePath="@imgPath" ObjId="idxCount" TextData="@textDictSetup(door)"></DoorSvgObj>
}
else if (isAddRemMode)
{
<DoorSvgObj LineColor="#2D3047" LineWidth="8" ObjH="200" ObjW="650" LeftTextClass="col-4" RightTextClass="col-8" ShowPlusMinus="true" Message1="@door.DoorId.ToString()" Message2="@door.OrderId.ToString()" EC_ExePlus="@(()=>addOneDoorNumber("", ""))" EC_ExeMinus="@(()=>removeOneDoorNumber("", ""))" ImagePath="@DoorSvgUrl(door.DoorId)" ObjId="idxCount" TextData="@textDictSetup(door)"></DoorSvgObj>
}
else
{
<DoorSvgObj LineColor="#2D3047" LineWidth="8" ObjH="200" ObjW="650" LeftTextClass="col-4" RightTextClass="col-8" EC_ExeFunct="@(()=> editRec(@door.DoorId.ToString()))" Message1="@door.DoorId.ToString()" ImagePath="@DoorSvgUrl(door.DoorId)" ObjId="idxCount" TextData="@textDictSetup(door)"></DoorSvgObj>
}
</div>
}
@@ -177,6 +177,47 @@ namespace WebDoorCreator.UI.Components.DoorMan
// rimando alla pagina... dettaglio...
NavManager.NavigateTo($"/DoorDefinition?idOrd={currOrderId}&idDoor={doorId}");
}
/// <summary>
/// Path del servizio di recupero SVG delle porte
/// </summary>
/// <param name="doorId"></param>
/// <returns></returns>
protected string DoorSvgUrl(int doorId)
{
return $"api/DoorImage/GetImage.svg?DoorId={doorId}";
}
protected bool isCloneMode { get; set; }
protected bool isAddRemMode { get; set; }
protected async void setCloneDoorMode(string message)
{
await Task.Delay(1);
isCloneMode = !isCloneMode;
isAddRemMode = false;
await InvokeAsync(StateHasChanged);
}
protected async void setAddRemDoor()
{
await Task.Delay(1);
isAddRemMode = !isAddRemMode;
isCloneMode = false;
await InvokeAsync(StateHasChanged);
}
protected async Task doClone(string message)
{
var door2Clone = DoorsList?.Where(x => x.DoorId == int.Parse(message)).FirstOrDefault();
if (door2Clone != null)
{
var doorOpToAdd = door2Clone.ObjClone(userId);
// salvo!
var done = await WDService.DoorInsert(doorOpToAdd);
await ReloadData();
}
}
protected async void sendToAbh(int ordId, int orderStat)
{
if (orderStat == 10)
@@ -222,5 +263,26 @@ namespace WebDoorCreator.UI.Components.DoorMan
}
}
}
protected async Task addOneDoorNumber(string msg1, string msg2)
{
//var door = new DoorModel();
var done = await WDService.DoorModQty(int.Parse(msg1), int.Parse(msg2), true);
if (done)
{
await InvokeAsync(StateHasChanged);
await ReloadData();
}
}
protected async Task removeOneDoorNumber(string msg1, string msg2)
{
//var door = new DoorModel();
var done = await WDService.DoorModQty(int.Parse(msg1), int.Parse(msg2), false);
if (done)
{
await InvokeAsync(StateHasChanged);
await ReloadData();
}
}
}
}
@@ -4,16 +4,9 @@
@if (HwToShow != null)
{
<div class="row m-0">
<div class="text-center">
<div class="row col-4">
<div class="rectangle">
@(translate(HwToShow.Label))
<div class="circle" @onclick="()=>hwToAdd()"></div>
</div>
</div>
</div>
<HardwareNewPanel Lingua="@Lingua" HwCode="@HwToShow.TableName" HwAdded="@hwAdd" DoorId="@DoorId"></HardwareNewPanel>
<HardwareNewPanel HwLabel="@HwToShow.Label" E_act2Rel="setRefOnDelete" Lingua="@Lingua" HwCode="@HwToShow.TableName" HwAdded="@hwAdd" DoorId="@DoorId"></HardwareNewPanel>
</div>
<div>
@@ -21,8 +21,10 @@ namespace WebDoorCreator.UI.Components.Hardware
[CascadingParameter]
public string UserId { get; set; } = "";
#if false
[Parameter]
public bool isDoorOpConf { get; set; }
public bool isDoorOpConf { get; set; }
#endif
#endregion Public Properties
@@ -191,10 +193,7 @@ namespace WebDoorCreator.UI.Components.Hardware
{
HwToShow = null;
}
if (!isDoorOpConf)
{
await ReloadData();
}
await ReloadData();
}
protected string setBgColor(string ObjId)
@@ -247,6 +246,14 @@ namespace WebDoorCreator.UI.Components.Hardware
}
}
protected async Task setRefOnDelete(bool isDel)
{
if (isDel)
{
await ReloadData();
}
}
protected int getInstNumber(string hwCode)
{
int answ = 0;
@@ -1,12 +1,27 @@
@if (DoorOpList != null)
@if (isLoading)
{
<div class="row">
@foreach (var item in DoorOpList)
{
<div class="col-4" style="min-height: 20rem;">
<HwSingleInstance instanceN="@(instNum++)" Lingua="@Lingua" DoorOpInst="@item" HwCode="@HwCode" E_recordUpdate="manageUpdate"></HwSingleInstance>
<EgwCoreLib.Razor.LoadingDataSmall></EgwCoreLib.Razor.LoadingDataSmall>
}
else
{
@if (DoorOpList != null)
{
<div class="text-center">
<div class="row col-4">
<div class="rectangle">
@(translate(HwLabel))
<div class="circle" @onclick="()=>hwToAdd()"></div>
</div>
</div>
}
</div>
</div>
<div class="row">
@foreach (var item in DoorOpList)
{
<div class="col-4" style="min-height: 20rem;">
<HwSingleInstance E_act2Rel="setRefOnDelete" instanceN="@(instNum++)" Lingua="@Lingua" DoorOpInst="@item" HwCode="@HwCode" E_recordUpdate="manageUpdate"></HwSingleInstance>
</div>
}
</div>
}
}
@@ -1,16 +1,23 @@
using Microsoft.AspNetCore.Components;
using Newtonsoft.Json;
using WebDoorCreator.Data;
using WebDoorCreator.Data.DbModels;
using WebDoorCreator.UI.Components.DoorMan;
using WebDoorCreator.UI.Data;
using static WebDoorCreator.UI.Data.WDCRefreshService;
namespace WebDoorCreator.UI.Components.Hardware
{
public partial class HardwareNewPanel
public partial class HardwareNewPanel : IDisposable
{
#region Public Properties
[Parameter]
public int DoorId { get; set; } = 0;
[Parameter]
public EventCallback<bool> E_act2Rel { get; set; }
[Parameter]
public EventCallback<DoorOpModel> E_recordUpdate { get; set; }
@@ -22,50 +29,182 @@ namespace WebDoorCreator.UI.Components.Hardware
[Parameter]
public string HwCode { get; set; } = "";
[Parameter]
public string HwLabel { get; set; } = "";
[Parameter]
public string Lingua { get; set; } = "EN";
[CascadingParameter]
public string UserId { get; set; } = "";
protected bool _isDoorOpConf { get; set;} = false;
[Parameter]
public bool isDoorOpConf
{
get => _isDoorOpConf;
set
{
if (_isDoorOpConf != value)
{
_isDoorOpConf = value;
var pupd = InvokeAsync(async () => await ReloadData());
}
}
}
protected bool _isDoorOpConf { get; set; } = false;
#endregion Public Properties
#region Protected Properties
protected List<DoorOpModel>? DoorOpList { get; set; } = null!;
protected List<DoorOpModel> DoorOp2ModList { get; set; } = new List<DoorOpModel>();
protected int instNum { get; set; } = 1;
[Inject]
protected WebDoorCreatorService WDCService { get; set; } = null!;
protected WDCRefreshService WDCRefresh { get; set; } = null!;
[Inject]
protected WebDoorCreatorService WDCService { get; set; } = null!;
[Inject]
protected WDCVocabularyService WDVService { get; set; } = null!;
public void Dispose()
{
WDCRefresh.EA_ConfDoorOp -= WDCRefresh_EA_ConfDoorOp;
}
protected override async Task OnInitializedAsync()
{
await Task.Delay(1);
WDCRefresh.EA_ConfDoorOp += WDCRefresh_EA_ConfDoorOp;
//return base.OnInitializedAsync();
}
protected string translate(string lemma)
{
string answ = "";
answ = WDVService.Traduci(Lingua, lemma);
return answ;
}
private void WDCRefresh_EA_ConfDoorOp(object? sender, EventArgs e)
{
DOPEventArgs currArgs = (DOPEventArgs)e;
// SE sono sula porta indicata + objId corretto --> refresh
if (currArgs.DoorId == DoorId && currArgs.ObjectId == HwCode)
{
var pupd = InvokeAsync(async () => await ReloadData());
}
}
#endregion Protected Properties
#region Protected Methods
[Inject]
protected WDCRefreshService WDCRService { get; set; } = null!;
protected bool B_doorOpUpd
{
get => WDCRService.isDoorOpUpd;
set => WDCRService.isDoorOpUpd = value;
}
[Inject]
protected WDCRefreshService WDCRService { get; set; } = null!;
protected async Task hwToAdd()
{
await Task.Delay(1);
DateTime adesso = DateTime.Now;
List<DoorOpModel> listOp = new List<DoorOpModel>();
if (HwCode != null)
{
if (DoorOp2ModList.Count == 0)
{
var listRecordFolder = await WDCService.ListValuesGetAll(HwCode, "Folder");
var listRecordTmp = await WDCService.ListValuesGetAll(HwCode, "template");
if (listRecordTmp!.Count == 0)
{
listRecordTmp = await WDCService.ListValuesGetAll(HwCode, "shape");
}
Dictionary<string, List<string>> defaultDict = new Dictionary<string, List<string>>();
List<string> listDefVal = new List<string>();
Dictionary<string, string> actDict = new Dictionary<string, string>();
List<string> defaultParamsList = new List<string>();
string default2Design = "";
if (listRecordFolder != null)
{
var firstFolder = listRecordFolder.FirstOrDefault();
if (firstFolder != null)
{
actDict.Add(firstFolder.FieldName, firstFolder.Value.Trim());
if (listRecordTmp != null)
{
var listRecordTemplates = listRecordTmp.Where(x => x.Value.Contains(firstFolder.Value)).ToList();
if (listRecordTemplates != null)
{
var firstTemplate = listRecordTemplates.FirstOrDefault();
if (firstTemplate != null)
{
if (firstTemplate.DefaultVal != "")
{
default2Design = firstTemplate.DefaultVal;
}
else
{
default2Design = "1";
}
actDict.Add(firstTemplate.FieldName, firstTemplate.Value.Trim());
}
}
}
}
var listRecordGP = await WDCService.ListValuesGetAll(HwCode, $"Graphic Parameters{default2Design}");
if (listRecordGP != null)
{
foreach (var item in listRecordGP)
{
if (item.isSerializable && item.DefaultVal.Contains(","))
{
listDefVal = item.DefaultVal.Trim().Split(",").ToList();
actDict.Add(item.Value.Trim(), item.DefaultVal.Trim().Split(",")[0].Split("/")[0]);
}
else
{
if (item.DefaultVal.Contains("/"))
{
listDefVal = new List<string>() { item.DefaultVal.Trim().Split("/")[0] };
actDict.Add(item.Value.Trim(), item.DefaultVal.Trim().Split("/")[0]);
}
else
{
listDefVal = new List<string>() { item.DefaultVal.Trim() };
actDict.Add(item.Value.Trim(), item.DefaultVal.Trim());
}
}
//defaultParamsList.Add(listDefVal);
defaultDict.Add(item.Value.Trim(), listDefVal);
}
//actDict.Add(HwToShow.TableName, actParamsList);
var jsonDef = JsonConvert.SerializeObject(defaultDict);
var jsonAct = JsonConvert.SerializeObject(actDict);
DoorOpModel doorOpToAdd = new DoorOpModel()
{
DateIns = adesso,
DateMod = adesso,
UserIdIns = UserId,
UserIdMod = UserId,
ObjectId = HwCode,
DoorId = DoorId,
JsoncConfigVal = jsonDef,
JsoncActVal = jsonAct
};
listOp.Add(doorOpToAdd);
// salvo Door OP associate
bool fatto = await WDCService.DoorOpInsert(DoorId, listOp);
if (fatto)
{
//hwAdd = fatto;
await InvokeAsync(StateHasChanged);
}
}
}
}
}
}
/// <summary>
/// Gestione update da oggetto sottostante
/// </summary>
@@ -80,15 +219,14 @@ namespace WebDoorCreator.UI.Components.Hardware
var item2rem = DoorOpList.Where(x => x.DoorOpId == currItem.DoorOpId).FirstOrDefault();
if (item2rem != null)
{
DoorOpList.Remove(item2rem);
DoorOp2ModList.Remove(item2rem);
}
await Task.Delay(1);
B_doorOpUpd = true;
DoorOpList.Add(currItem);
DoorOp2ModList.Add(currItem);
}
}
protected override async Task OnParametersSetAsync()
{
await ReloadData();
@@ -98,16 +236,38 @@ namespace WebDoorCreator.UI.Components.Hardware
#region Private Methods
protected bool isLoading { get; set; } = false;
protected List<DoorOpModel>? ListRecord { get; set; } = null;
protected async Task setRefOnDelete(bool isDel)
{
if (isDel)
{
await ReloadData();
}
}
private async Task ReloadData()
{
var ListRecord = await WDCService.DoorOpGetByDoorId(DoorId);
isLoading = true;
//await Task.Delay(50);
await InvokeAsync(StateHasChanged);
ListRecord = null;
DoorOpList = null;
await Task.Delay(1);
ListRecord = await WDCService.DoorOpGetByDoorId(DoorId);
var tempListVal = await WDCService.ListValuesGetAll(HwCode, "Folder");
if (ListRecord != null)
{
DoorOpList = ListRecord.Where(x => (x.DoorId == DoorId) && (x.ObjectId == HwCode)).ToList();
}
isLoading = false;
//await Task.Delay(50);
await InvokeAsync(StateHasChanged);
}
#endregion Private Methods
}
}
@@ -0,0 +1,49 @@
.rectangle {
height: 2.75rem;
width: 75%;
background: #CFD8DC;
position: relative;
margin-bottom: 4rem;
margin-top: 1.25rem;
border-radius: 0.8rem;
display: flex;
flex-wrap: wrap;
align-items: center;
color: #000;
font-weight: bold;
}
.circle {
position: absolute;
height: 6.25rem;
width: 6.25rem;
border-radius: 50%;
border: 4px solid #CFD8DC;
left: 100%;
margin-left: -1.563rem;
top: -1.5rem;
background: black;
}
.rectangleDetail {
height: 2.75rem;
width: 75%;
position: relative;
margin-bottom: 4rem;
margin-top: 1.25rem;
border-radius: 0.8rem;
display: flex;
flex-wrap: wrap;
align-items: center;
color: #000;
font-weight: bold;
}
.circleDetail {
position: absolute;
height: 6.25rem;
width: 6.25rem;
border-radius: 50%;
border: 4px solid #CFD8DC;
left: 100%;
margin-left: -1.563rem;
top: -1.5rem;
background: black;
}
@@ -0,0 +1,58 @@
.rectangle {
height: 2.75rem;
width: 75%;
background: #CFD8DC;
position: relative;
margin-bottom: 4rem;
margin-top: 1.25rem;
border-radius: 0.8rem;
display: flex;
flex-wrap: wrap;
align-items: center;
color: #000;
font-weight: bold;
}
.circle {
position: absolute;
height: 6.25rem;
width: 6.25rem;
border-radius: 50%;
border: 4px solid #CFD8DC;
left: 100%;
margin-left: -1.563rem;
top: -1.5rem;
background: black;
}
.rectangleDetail {
height: 2.75rem;
width: 75%;
//background: #CFD8DC;
position: relative;
margin-bottom: 4rem;
margin-top: 1.25rem;
border-radius: 0.8rem;
display: flex;
flex-wrap: wrap;
align-items: center;
color: #000;
font-weight: bold;
}
.circleDetail {
position: absolute;
height: 6.25rem;
width: 6.25rem;
border-radius: 50%;
border: 4px solid #CFD8DC;
left: 100%;
margin-left: -1.563rem;
top: -1.5rem;
background: black;
}
.all {
//width: 72rem;
}
@@ -0,0 +1 @@
.rectangle{height:2.75rem;width:75%;background:#cfd8dc;position:relative;margin-bottom:4rem;margin-top:1.25rem;border-radius:.8rem;display:flex;flex-wrap:wrap;align-items:center;color:#000;font-weight:bold;}.circle{position:absolute;height:6.25rem;width:6.25rem;border-radius:50%;border:4px solid #cfd8dc;left:100%;margin-left:-1.563rem;top:-1.5rem;background:#000;}.rectangleDetail{height:2.75rem;width:75%;position:relative;margin-bottom:4rem;margin-top:1.25rem;border-radius:.8rem;display:flex;flex-wrap:wrap;align-items:center;color:#000;font-weight:bold;}.circleDetail{position:absolute;height:6.25rem;width:6.25rem;border-radius:50%;border:4px solid #cfd8dc;left:100%;margin-left:-1.563rem;top:-1.5rem;background:#000;}
@@ -2,9 +2,11 @@ using Microsoft.AspNetCore.Components;
using Microsoft.CodeAnalysis.CSharp.Syntax;
using Microsoft.JSInterop;
using Newtonsoft.Json;
using System.Security.Policy;
using WebDoorCreator.Data.DbModels;
using WebDoorCreator.Data.Services;
using WebDoorCreator.UI.Data;
using static WebDoorCreator.UI.Data.WDCRefreshService;
namespace WebDoorCreator.UI.Components.Hardware
{
@@ -17,6 +19,8 @@ namespace WebDoorCreator.UI.Components.Hardware
[Parameter]
public EventCallback<DoorOpModel> E_recordUpdate { get; set; }
[Parameter]
public EventCallback<bool> E_act2Rel { get; set; }
[Parameter]
public string HwCode { get; set; } = "";
@@ -160,9 +164,11 @@ namespace WebDoorCreator.UI.Components.Hardware
List<DoorOpModel> doorOpAddList = new List<DoorOpModel>() { doorOpToAdd };
// salvo!
await WDCService.DoorOpInsert(DoorOpInst.DoorId, doorOpAddList);
var done = await WDCService.DoorOpInsert(DoorOpInst.DoorId, doorOpAddList);
await E_act2Rel.InvokeAsync(done);
await FullReloadData();
}
#if false
protected async Task doConfirm()
{
@@ -177,15 +183,17 @@ namespace WebDoorCreator.UI.Components.Hardware
DoorOpInst.GraphicParams = graphicParams;
// salvo!
await doSave();
}
}
#endif
protected async Task doDeleteInst()
{
var done = await JSRuntime.InvokeAsync<bool>("confirm", "Delete PERMANENTLY the current record?");
var delConf = await JSRuntime.InvokeAsync<bool>("confirm", "Delete PERMANENTLY the current record?");
if (done)
if (delConf)
{
await WDCService.DoorOpDelete(DoorOpInst);
var done = await WDCService.DoorOpDelete(DoorOpInst);
await E_act2Rel.InvokeAsync(done);
await FullReloadData();
}
}
@@ -231,6 +239,35 @@ namespace WebDoorCreator.UI.Components.Hardware
await FullReloadData();
}
#if false
private void WDCRefresh_EA_ConfDoorOp(object? sender, EventArgs e)
{
DOPEventArgs currArgs = (DOPEventArgs)e;
// SE sono sula porta indicata + objId corretto --> refresh
if (currArgs.DoorId == DoorOpInst.DoorId && currArgs.DoorOpId == DoorOpInst.DoorOpId && currArgs.ObjectId == DoorOpInst.ObjectId)//&& currArgs.ObjectId == obid )
{
var pupd = InvokeAsync(async () => await FullReloadData());
}
}
public void Dispose()
{
WDCRefresh.EA_ConfDoorOp -= WDCRefresh_EA_ConfDoorOp;
}
[Inject]
protected WDCRefreshService WDCRefresh { get; set; } = null!;
protected override async Task OnInitializedAsync()
{
await FullReloadData();
await Task.Delay(1);
WDCRefresh.EA_ConfDoorOp += WDCRefresh_EA_ConfDoorOp;
}
#endif
protected string translate(string lemma)
{
string answ = "";
@@ -252,7 +289,7 @@ namespace WebDoorCreator.UI.Components.Hardware
private string pathFinder(int id)
{
string answ = $"HwPdfConfirm?idHwInst={id}";
string answ = $"HwPdfConfirm?doorOpId={id}&doorId={DoorOpInst.DoorId}&objectId={DoorOpInst.ObjectId}";
return answ;
}
@@ -37,10 +37,10 @@ else
</div>
</td>*@
<td class="text-end">
@* @if (item.OrderStatus < (int)Core.Enum.OrderStatus.Sent)
@if (item.OrderStatus <= 10)
{
<button class="btn btn-sm btn-danger" @onclick="() => deleteRecord(item)"><i class="fa-solid fa-trash-can"></i></button>
}*@
}
</td>
</tr>
}
@@ -1,14 +1,14 @@
<svg viewBox="0 0 @ObjW @ObjH" width="100%" height="100%" xmlns="http://www.w3.org/2000/svg">
<rect x="0" y="0" width="100%" height="100%" fill="white" fill-opacity="0.1"></rect>
@*<rect x="0" y="0" width="100%" height="100%" fill="white" fill-opacity="0.1"></rect>*@
<g transform="translate(0,@LineDist)">
<foreignObject width="@TextAreaWidth" height="@TextAreaHeight">
<div class="row" style="@TextStyle">
@foreach (var item in TextData)
{
<div class="@LeftTextClass">
<div class="">
@item.Key
</div>
<div class="@RightTextClass text-end">
<div class="text-end">
<b>@item.Value</b>
</div>
}
@@ -17,14 +17,39 @@
</g>
<line x1="@BaseLine.p1.px" y1="@BaseLine.p1.py" x2="@BaseLine.p2.px" y2="@BaseLine.p2.py" stroke="@LineColor" stroke-width="@LineWidth" />
<circle id="circleLine" cx="@CircleLine.cx" cy="@CircleLine.cy" r="@CircleLine.rad" stroke="@LineColor" stroke-width="@LineWidth" />
<circle id="circleLine" cx="@CircleLine.cx" cy="@CircleLine.cy" r="@CircleLine.rad" stroke="@LineColor" stroke-width="@LineWidth" fill="blue" />
<defs>
<pattern id="@($"contImg_{ObjId}")" patternContentUnits="userSpaceOnUse" width="1" height="1">
<image x="0" y="0" href="@ImagePath" width="50%" height="100%"></image>
<image x="0" y="0" href="images/Plus.png" width="30%" height="100%" style="transform: translate(-3px, -55px)" class="plusAnim"></image>
<image x="0" y="0" href="images/Minus.png" width="30%" height="100%" style="transform: translate(-3px, 42px)" class="minusAnim"></image>
<linearGradient id="BckGrad" x1="0" x2="0" y1="0" y2="1">
<stop offset="0%" stop-color="#AFCFD1" />
<stop offset="100%" stop-color="#92B2C4" />
</linearGradient>
<rect fill="url(#BckGrad)" x="0" y="0" height="100%" width="100%" style="opacity: 100%;"></rect>
<image x="@(CircleImg.rad/2)" y="0" href="@ImagePath" width="@CircleImg.rad" height="100%"></image>
@if (ShowPlusMinus)
{
<rect x="0" y="0" width="100%" height="50%" fill="@PlusColor" style="opacity: 20%;" />
<rect x="0" y="@(ObjH/2)" width="100%" height="50%" fill="@MinusColor" style="opacity: 20%;" />
}
else if (ShowClone)
{
<rect x="0" y="@(ObjH/2)" width="100%" height="100%" fill="blue" style="opacity: 20%;" @onclick="()=>execClone()" />
}
</pattern>
</defs>
<circle id="circleCont" cx="@CircleImg.cx" cy="@CircleImg.cy" r="@CircleImg.rad" fill="url(#@($"contImg_{ObjId}"))" @onclick="()=>execFunc()" style="cursor: pointer" />
@if (ShowPlusMinus)
{
<circle id="circleCont" cx="@CircleImg.cx" cy="@CircleImg.cy" r="@CircleImg.rad" fill="url(#@($"contImg_{ObjId}"))" style="cursor: pointer;" />
<rect x="@ClickArea.p1.px" y="0" width="@(ClickArea.p2.px-ClickArea.p1.px)" height="50%" fill="white" style="opacity: 0%;" @onclick="()=>execPlus()" />
<rect x="@ClickArea.p1.px" y="@(ObjH/2)" width="@(ClickArea.p2.px-ClickArea.p1.px)" height="50%" fill="white" style="opacity: 0%;" @onclick="()=>execMinus()" />
}
else if (ShowClone)
{
<circle id="circleCont" cx="@CircleImg.cx" cy="@CircleImg.cy" r="@CircleImg.rad" fill="url(#@($"contImg_{ObjId}"))" style="cursor: pointer;" @onclick="()=>execClone()" />
}
else
{
<circle id="circleCont" cx="@CircleImg.cx" cy="@CircleImg.cy" r="@CircleImg.rad" fill="url(#@($"contImg_{ObjId}"))" style="cursor: pointer;" @onclick="()=>execFunc()" />
}
</svg>
@@ -9,15 +9,39 @@ namespace WebDoorCreator.UI.Components.SvgComp
[Parameter]
public EventCallback<bool> EC_ExeFunct { get; set; }
[Parameter]
public EventCallback<bool> EC_ExeMinus { get; set; }
[Parameter]
public EventCallback<bool> EC_ExePlus { get; set; }
[Parameter]
public EventCallback<bool> EC_ExeClone { get; set; }
[Parameter]
public string ImagePath { get; set; } = "images/LogoEgw.png";
[Parameter]
public string LeftTextClass { get; set; } = "";
[Parameter]
public string LineColor { get; set; } = "#00838F";
[Parameter]
public int LineWidth { get; set; } = 8;
[Parameter]
public string Message1 { get; set; } = "";
[Parameter]
public string Message2 { get; set; } = "";
[Parameter]
public string PlusColor { get; set; } = "green";
[Parameter]
public string MinusColor { get; set; } = "red";
[Parameter]
public int ObjH { get; set; } = 204;
@@ -27,28 +51,28 @@ namespace WebDoorCreator.UI.Components.SvgComp
[Parameter]
public int ObjW { get; set; } = 450;
[Parameter]
public string RightTextClass { get; set; } = "";
[Parameter]
public bool ShowPlusMinus { get; set; } = false;
[Parameter]
public bool ShowClone { get; set; } = false;
[Parameter]
public Dictionary<string, string> TextData { get; set; } = new Dictionary<string, string>();
[Parameter]
public string TextStyle { get; set; } = "font-size: 1.5em; fill: #000;";
[Parameter]
public string Message1 { get; set; } = "";
[Parameter]
public string Message2 { get; set; } = "";
[Parameter]
public string LeftTextClass { get; set; } = "";
[Parameter]
public string RightTextClass { get; set; } = "";
#endregion Public Properties
#region Protected Properties
protected LineData BaseLine { get; set; } = null!;
protected LineData ClickArea { get; set; } = null!;
protected CircleData CircleImg { get; set; } = null!;
protected CircleData CircleLine { get; set; } = null!;
@@ -74,6 +98,20 @@ namespace WebDoorCreator.UI.Components.SvgComp
EC_ExeFunct.InvokeAsync(true);
}
protected void execMinus()
{
EC_ExeMinus.InvokeAsync(true);
}
protected void execPlus()
{
EC_ExePlus.InvokeAsync(true);
}
protected void execClone()
{
EC_ExeClone.InvokeAsync(true);
}
protected override void OnParametersSet()
{
setupGraphParams();
@@ -155,6 +193,7 @@ namespace WebDoorCreator.UI.Components.SvgComp
CircleLine = new CircleData(ObjW - LineWidth - (ObjH / 2), ObjH / 2, (ObjH - LineWidth) / 2);
CircleImg = new CircleData(ObjW - LineWidth - (ObjH / 2), ObjH / 2, (ObjH - 2 * LineWidth) / 2);
BaseLine = new LineData(new PointData(0, ObjH - LineWidth / 2), new PointData(ObjW - LineWidth - (ObjH / 2), ObjH - LineWidth / 2));
ClickArea = new LineData(new PointData(ObjW - LineWidth - ObjH, 0), new PointData(ObjW, 0));
LineDist = ObjH / 4;
}
@@ -0,0 +1,44 @@
<svg viewBox="0 0 @ObjW @ObjH" width="100%" height="100%" xmlns="http://www.w3.org/2000/svg">
<g transform="translate(0,@LineDist)">
<foreignObject width="@TextAreaWidth" height="100%">
<div class="d-flex justify-content-between rectangle p-3 @cardClass" style="@TextStyle" @onclick="()=>execFunc(false)">
<div>
@ItemName
</div>
<div class="pe-4">
@if (ItemCount > 0)
{
<b>@ItemCount</b>
}
else
{
<p>&nbsp;</p>
}
</div>
</div>
</foreignObject>
</g>
<circle id="circleLine" cx="@CircleLine.cx" cy="@CircleLine.cy" r="@CircleLine.rad" stroke="@LineColor" stroke-width="@LineWidth" fill="blue" />
<defs>
<pattern id="@($"contImg_{ObjId}")" patternContentUnits="userSpaceOnUse" width="1" height="1">
<linearGradient id="BckGrad" x1="0" x2="0" y1="0" y2="1">
<stop offset="0%" stop-color="#AFCFD1" />
<stop offset="100%" stop-color="#92B2C4" />
</linearGradient>
<rect fill="url(#BckGrad)" x="0" y="0" height="100%" width="100%" style="opacity: 100%;"></rect>
<image x="@(CircleImg.rad/2)" y="0" href="@ImagePath" width="@CircleImg.rad" height="100%"></image>
@if (ShowPlus)
{
<rect x="0" y="0" width="100%" height="100%" fill="@PlusColor" style="opacity: 20%;" />
}
</pattern>
</defs>
@if (ShowPlus)
{
<circle id="circleCont" cx="@CircleImg.cx" cy="@CircleImg.cy" r="@CircleImg.rad" fill="url(#@($"contImg_{ObjId}"))" style="cursor: pointer;" @onclick="()=>execPlus()" />
}
else
{
<circle id="circleCont" cx="@CircleImg.cx" cy="@CircleImg.cy" r="@CircleImg.rad" fill="url(#@($"contImg_{ObjId}"))" style="cursor: pointer;" @onclick="()=>execFunc(true)" />
}
</svg>
@@ -0,0 +1,209 @@
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.Components.SvgComp;
using WebDoorCreator.UI.Components.Filters;
using WebDoorCreator.UI.Components.Report;
using WebDoorCreator.UI.Shared;
using WebDoorCreator.Data.DbModels;
using EgwCoreLib.Razor;
namespace WebDoorCreator.UI.Components.SvgComp
{
public partial class HwSvgObj
{
#region Public Properties
[Parameter]
public EventCallback<bool> EC_ExeFunct { get; set; }
[Parameter]
public EventCallback<bool> EC_ExePlus { get; set; }
[Parameter]
public string ImagePath { get; set; } = "images/LogoEgw.png";
[Parameter]
public string LineColor { get; set; } = "#00838F";
[Parameter]
public int LineWidth { get; set; } = 8;
[Parameter]
public string ItemName { get; set; } = "";
[Parameter]
public int ItemCount { get; set; } = 0;
[Parameter]
public string PlusColor { get; set; } = "green";
[Parameter]
public int ObjH { get; set; } = 204;
[Parameter]
public int ObjId { get; set; } = 0;
[Parameter]
public int ObjW { get; set; } = 450;
[Parameter]
public bool ShowPlus { get; set; } = false;
[Parameter]
public string TextStyle { get; set; } = "font-size: 2.5em;";
#endregion Public Properties
#region Protected Properties
protected CircleData CircleImg { get; set; } = null!;
protected CircleData CircleLine { get; set; } = null!;
protected int LineDist { get; set; } = 20;
protected int TextAreaHeight
{
get => (ObjH / 2 * 110 / 100);
}
protected int TextAreaWidth
{
get => ObjW - (ObjH * 90 / 100);
}
protected string cardClass
{
get => ItemCount > 0 ? "bg-primary text-light" : "bg-inactive text-dark";
}
#endregion Protected Properties
#region Protected Methods
/// <summary>
/// Invia evento principale
/// </summary>
/// <param name="forceSend">se true manda sempre EC_ExeFunct, altrimenti NON invia se showPlus attivo...</param>
protected void execFunc(bool forceSend)
{
if (forceSend || !ShowPlus)
{
EC_ExeFunct.InvokeAsync(true);
}
}
protected void execPlus()
{
EC_ExePlus.InvokeAsync(true);
}
protected override void OnParametersSet()
{
setupGraphParams();
}
#endregion Protected Methods
#region Protected Classes
protected class CircleData
{
#region Public Constructors
public CircleData(int px, int py, int radius)
{
cx = px;
cy = py;
rad = radius;
}
#endregion Public Constructors
#region Public Properties
public int cx { get; set; } = 0;
public int cy { get; set; } = 0;
public int rad { get; set; } = 100;
#endregion Public Properties
}
protected class LineData
{
#region Public Constructors
public LineData(PointData pA, PointData pB)
{
p1 = pA;
p2 = pB;
}
#endregion Public Constructors
#region Public Properties
public PointData p1 { get; set; }
public PointData p2 { get; set; }
#endregion Public Properties
}
protected class PointData
{
#region Public Constructors
public PointData(int valx, int valy)
{
px = valx;
py = valy;
}
#endregion Public Constructors
#region Public Properties
public int px { get; set; } = 0;
public int py { get; set; } = 0;
#endregion Public Properties
}
#endregion Protected Classes
#region Private Methods
private void setupGraphParams()
{
// calcolo i dati del cerchi...
CircleLine = new CircleData(ObjW - LineWidth - (ObjH / 2), ObjH / 2, (ObjH - LineWidth) / 2);
CircleImg = new CircleData(ObjW - LineWidth - (ObjH / 2), ObjH / 2, (ObjH - 2 * LineWidth) / 2);
LineDist = ObjH / 4;
}
#endregion Private Methods
}
}
@@ -0,0 +1,7 @@
.rectangle {
border-radius: 1.2rem;
font-weight: bold;
}
.bg-inactive {
background-color: #CFD8DC;
}
@@ -0,0 +1,8 @@
.rectangle {
border-radius: 1.2rem;
font-weight: bold;
}
.bg-inactive {
background-color: #CFD8DC;
}
@@ -0,0 +1 @@
.rectangle{border-radius:1.2rem;font-weight:bold;}.bg-inactive{background-color:#cfd8dc;}
@@ -0,0 +1,52 @@
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using NLog;
using NLog.Fluent;
using WebDoorCreator.Data.Services;
using static System.Net.Mime.MediaTypeNames;
namespace WebDoorCreator.UI.Controllers
{
[Route("api/[controller]")]
[ApiController]
public class DoorImageController : ControllerBase
{
[HttpGet("GetImage.svg")]
public async Task<IActionResult> GetImage(int DoorId)
{
string svgContent = await QDataServ.DoorGetLastSvg(DoorId);
var result = System.Text.Encoding.UTF8.GetBytes(svgContent);
return File(result, "image/svg+xml");
}
// GET: api/Alive
[HttpGet]
public string Get()
{
return "OK";
}
public DoorImageController(IConfiguration configuration, QueueDataService DataService)
{
Log.Info("Starting DoorImageController");
_configuration = configuration;
QDataServ = DataService;
Log.Info("Avviato DoorImageController");
}
#region Private Fields
private static IConfiguration _configuration = null!;
private static Logger Log = LogManager.GetCurrentClassLogger();
#endregion Private Fields
#region Private Properties
private QueueDataService QDataServ { get; set; } = null!;
#endregion Private Properties
}
}
+25 -6
View File
@@ -1,12 +1,15 @@
namespace WebDoorCreator.UI.Data
using Microsoft.AspNetCore.Components;
using WebDoorCreator.Data;
namespace WebDoorCreator.UI.Data
{
public class WDCRefreshService
{
#region Public Events
public event Action EA_UpdDoorOp = null!;
public event Action EA_ConfDoorOp = null!;
//public EventCallback<DOPEventArgs> EA_ConfDoorOp { get; set; }
public event EventHandler EA_ConfDoorOp = delegate { };
#endregion Public Events
@@ -27,6 +30,7 @@
}
}
#if false
public bool isDoorOpConf
{
get => _isDoorOpConf;
@@ -38,7 +42,8 @@
reportDoorOpConf();
}
}
}
}
#endif
#endregion Public Properties
@@ -51,11 +56,18 @@
EA_UpdDoorOp?.Invoke();
}
}
protected void reportDoorOpConf()
public void ReportDoorOpConf(int doorId, int doorOpId, string objId)
{
DOPEventArgs currOpr = new DOPEventArgs()
{
DoorId = doorId,
DoorOpId = doorOpId,
ObjectId = objId
};
// se qualcuno ascolta sollevo evento nuovo valore...
if (EA_ConfDoorOp != null)
{
EA_ConfDoorOp?.Invoke();
EA_ConfDoorOp(this, currOpr);
}
}
#endregion Protected Methods
@@ -65,5 +77,12 @@
private bool _isDoorOpUpd { get; set; } = false;
private bool _isDoorOpConf { get; set; } = false;
#endregion Private Properties
public class DOPEventArgs : EventArgs
{
public int DoorId { get; set; } = 0;
public int DoorOpId { get; set; } = 0;
public string ObjectId { get; set; } = "";
}
}
}
@@ -1389,7 +1389,7 @@ namespace WebDoorCreator.UI.Data
{
var dbResult = await dbController.OrderUpdate(orderId, newStatus);
// elimino cache redis...
//bool answ = await DoorFlushCache(currRec.DoorId);
//bool answ = await DoorFlushCache(currRec.doorId);
// elimino cache redis dati ordine...
bool answ = await FlushRedisCache();
return dbResult;
+1 -1
View File
@@ -35,7 +35,7 @@
}
else if (currDefStep == 20)
{
<HardwareList isDoorOpConf="@WDCRService.isDoorOpConf" isHwStep="@setHwToNull" DoorId="@idDoor" Lingua="@userLang"></HardwareList>
<HardwareList isHwStep="@setHwToNull" DoorId="@idDoor" Lingua="@userLang"></HardwareList>
}
else if (currDefStep == 30)
{
@@ -6,6 +6,7 @@ using WebDoorCreator.Data;
using WebDoorCreator.Data.DbModels;
using WebDoorCreator.Data.Services;
using WebDoorCreator.UI.Data;
using static WebDoorCreator.UI.Data.WDCRefreshService;
namespace WebDoorCreator.UI.Pages
{
@@ -49,7 +50,7 @@ namespace WebDoorCreator.UI.Pages
protected QueueDataService QDataServ { get; set; } = null!;
protected string userLang { get; set; } = "EN";
protected bool isDoorOpConf{ get; set; } = false;
protected bool isDoorOpConf { get; set; } = false;
[Inject]
protected WDCRefreshService WDCRService { get; set; } = null!;
@@ -74,6 +75,7 @@ namespace WebDoorCreator.UI.Pages
});
}
/// <summary>
/// gestione rilettura info
/// </summary>
@@ -98,11 +100,15 @@ namespace WebDoorCreator.UI.Pages
await ReloadData();
}
userLang = WDCUService.currLanguage ?? "EN";
isDoorOpConf = WDCRService.isDoorOpConf;
#if false
isDoorOpConf = WDCRService.isDoorOpConf;
#endif
WDCUService.EA_CurrLanguage += WDUService_EA_CurrLanguage;
QDataServ.CalcDonePipe.EA_NewMessage += CalcDonePipe_EA_NewMessage;
WDCRService.EA_UpdDoorOp += WDService_EA_DoorOpUpdated;
WDCRService.EA_ConfDoorOp += WDService_EA_DoorOpConfirmed;
#if false
WDCRService.EA_ConfDoorOp += WDService_EA_DoorOpConfirmed;
#endif
}
protected async Task ReloadData()
@@ -111,6 +117,9 @@ namespace WebDoorCreator.UI.Pages
ListHwDoorOp = null;
orderStatus = null;
await Task.Delay(1);
// cerco img porta...
DoorSvgContent = await QDataServ.DoorGetLastSvg(idDoor);
// recupero altri dati
var ListRecordDoorOp = await WDService.DoorOpGetByDoorId(idDoor);
if (ListRecordDoorOp != null)
{
@@ -225,12 +234,14 @@ namespace WebDoorCreator.UI.Pages
userLang = WDCUService.currLanguage ?? "EN";
StateHasChanged();
}
#if false
private void WDService_EA_DoorOpConfirmed()
{
isDoorOpConf = WDCRService.isDoorOpConf;
StateHasChanged();
}
}
#endif
#endregion Private Methods
}
+33 -7
View File
@@ -15,7 +15,9 @@ namespace WebDoorCreator.UI.Pages
[Inject]
protected WDCRefreshService WDCRService { get; set; } = null!;
protected int idHwInst { get; set; } = 0;
protected int doorOpId { get; set; } = 0;
protected int doorId = 0;
protected string objectId = "";
protected DoorOpModel currDoorOp { get; set; } = new DoorOpModel();
protected List<DoorOpModel> allDoorOps { get; set; } = new List<DoorOpModel>();
@@ -23,16 +25,31 @@ namespace WebDoorCreator.UI.Pages
{
await Task.Delay(1);
var uri = NavManager.ToAbsoluteUri(NavManager.Uri);
if (QueryHelpers.ParseQuery(uri.Query).TryGetValue("idHwInst", out var _idHwInst))
QueryHelpers.ParseQuery(uri.Query).TryGetValue("objectId", out var sObjectId);
if (!string.IsNullOrEmpty(sObjectId))
{
idHwInst = int.Parse(_idHwInst);
objectId = sObjectId;
}
QueryHelpers.ParseQuery(uri.Query).TryGetValue("doorId", out var sDoorId);
if (!string.IsNullOrEmpty(sDoorId))
{
int.TryParse(sDoorId, out doorId);
}
if (QueryHelpers.ParseQuery(uri.Query).TryGetValue("doorOpId", out var sDoorOpId))
{
doorOpId = int.Parse(sDoorOpId);
await ReloadData();
}
#if false
// invio fake...
WDRService.ReportDoorOpConf(doorId, doorOpId, objectId);
#endif
}
protected async Task ReloadData()
{
currDoorOp = await WDService.DoorOpGetById(idHwInst);
currDoorOp = await WDService.DoorOpGetById(doorOpId);
if (currDoorOp != null)
{
allDoorOps = await WDService.DoorOpGetByDoorId(currDoorOp.DoorId);
@@ -42,6 +59,8 @@ namespace WebDoorCreator.UI.Pages
}
[Inject]
protected WebDoorCreatorService WDService { get; set; } = null!;
[Inject]
protected WDCRefreshService WDRService { get; set; } = null!;
protected async Task doConfirm()
{
@@ -53,8 +72,13 @@ namespace WebDoorCreator.UI.Pages
var done = await WDService.DoorOpUpdate(doorOps2Save);
if (done)
{
isDoorOpConf = true;
await InvokeAsync(StateHasChanged);
#if false
isDoorOpConf = true;
#endif
WDRService.ReportDoorOpConf(doorId, doorOpId, objectId);
#if false
await InvokeAsync(StateHasChanged);
#endif
}
}
@@ -63,11 +87,13 @@ namespace WebDoorCreator.UI.Pages
get => WDCUService.currLanguage ?? "EN";
set => WDCUService.currLanguage = value;
}
#if false
protected bool isDoorOpConf
{
get => WDCRService.isDoorOpConf;
set => WDCRService.isDoorOpConf = value;
}
}
#endif
protected bool checkIfConf()
{
@@ -2,28 +2,9 @@
<AuthorizeView>
<Authorized>
@*<div class="card">
<div class="pb-0 d-flex justify-content-start card-header">
<div class="fs-5">
ORDERS
</div>
</div>
<div class="card-body">
<!-- Button trigger modal -->
<div class="d-flex justify-content-between mb-2">
<h5 class="">Orders list</h5>
<button type="button" class="btn btn-sm btn-success" data-bs-toggle="modal" data-bs-target="#newOrderModal">
<i class="fa-solid fa-plus"></i> Add new order
</button>
</div>
</div>
</div>*@
<div style="border-radius: 18px; padding: 1rem 4rem 0.5rem 4rem; box-shadow: rgba(0, 0, 0, 0.45) 0px 20px 22px -9px; margin-top: 0.5rem; margin-bottom: 1rem;">
<div class="row mb-3">
@*<div>
<img src="images/LogoEgw.png" style="width: 30%;height: auto;box-shadow:rgba(0, 0, 0, 0.45) 0px -8px 22px -9px;" />
</div>*@
<div class="fw-bold fs-2 text-start col-4">
WEB DOOR CREATOR
</div>
@@ -33,9 +14,6 @@
<i class="fa-solid fa-plus"></i> Add new order
</button>
</div>
@* <div class="text-end">
<img src="images/LogoEgw.png" style="width: 30%;height: auto;box-shadow:rgba(0, 0, 0, 0.45) 0px -8px 22px -9px;" />
</div>*@
</div>
<div style="min-height: 35rem;">
<OrderList updateRecordCount="UpdateTotCount" actFilter="@currFilter" E_currOrderStatus="catchCurrOrder" B_doorChaged="@doorChange" UserCurrCompany="@userCurrCompany"></OrderList>
@@ -45,8 +23,6 @@
<EgwCoreLib.Razor.DataPager @ref="pagerOrderHP" PageSize="@numRecord" currPage="@currPage" numRecordChanged="ForceReload" numPageChanged="ForceReloadPage" totalCount="@totalCount" showLoading="@isLoading" />
</div>
</div>
<!-- Modal Order -->
<div class="modal fade" id="newOrderModal" tabindex="-1" aria-labelledby="newOrderModalLabel" aria-hidden="true">
<div class="modal-dialog">
@@ -0,0 +1,8 @@
@page "/ResetDdfReq"
<button class="btn btn-lg btn-primary" @onclick="()=>doSave()">DO RESET</button>
@if (done)
{
<h1>DONE!!!!</h1>
}
@@ -0,0 +1,118 @@
using Microsoft.AspNetCore.Components;
using System.Collections.Generic;
using WebDoorCreator.Data.DbModels;
using WebDoorCreator.Data.Services;
using WebDoorCreator.UI.Data;
using static Org.BouncyCastle.Math.EC.ECCurve;
namespace WebDoorCreator.UI.Pages
{
public partial class ResetDdfReq
{
protected List<DoorOpModel>? DoorOpsList { get; set; }
protected List<DoorModel> DoorsList { get; set; } = new List<DoorModel>();
protected List<OrderStatusViewModel>? OrdersList { get; set; }
protected List<string> ordListVal { get; set; } = new List<string>();
protected List<DoorOpModel> listOp { get; set; } = new List<DoorOpModel>();
protected List<DoorOpModel> listOpAll { get; set; } = new List<DoorOpModel>();
[Inject]
protected QueueDataService QDataServ { get; set; } = null!;
[Inject]
protected WebDoorCreatorService WDCService { get; set; } = null!;
protected async Task doorsGetAll()
{
await ordersGetAll();
if (OrdersList != null)
{
foreach (var item in OrdersList)
{
var doors2Add = await WDCService.DoorGetByOrderId(item.OrderId);
if (doors2Add != null)
{
foreach (var door in doors2Add)
{
DoorsList.Add(door);
}
}
}
}
}
protected bool done { get; set; } = false;
[Inject]
protected IConfiguration config { get; set; } = null!;
protected override void OnInitialized()
{
base.OnInitialized();
string vers = config.GetValue<string>("ConfDDF:VersNumber");
bool remDoorOp = config.GetValue<bool>("ConfDDF:RemoveDoorOps");
var headRows = config.GetSection("ConfDDF:Header").Get<List<string>>();
var footRows = config.GetSection("ConfDDF:Footer").Get<List<string>>();
currDdfConv = new WebDoorCreator.Data.DDF.Converter(vers, remDoorOp, headRows, footRows);
}
protected WebDoorCreator.Data.DDF.Converter currDdfConv { get; set; } = null!;
/// <summary>
/// Effettua salvataggio record e generazione DDF
/// </summary>
/// <returns></returns>
protected async Task doSave()
{
await doorsGetAll();
if (DoorsList != null)
{
foreach (var door in DoorsList)
{
await Task.Delay(50);
listOpAll = await WDCService.DoorOpGetByDoorId(door.DoorId);
if (listOpAll != null)
{
listOp = listOpAll.Where(x => x.userConfirm != "" && x.DtConfirm != null).ToList();
if (listOp != null)
{
// chiamo metodo x avewre DDF serializzato
//var list2Ord = ;
var CurrentCompoOrder = await WDCService.ListValuesGetAll("*", "Hardware");
if (CurrentCompoOrder != null)
{
foreach (var item in CurrentCompoOrder.OrderBy(x => x.Ordinal).ToList())
{
ordListVal.Add(item.TableName);
}
}
listOp = listOp.OrderBy(d => ordListVal.IndexOf(d.ObjectId)).ToList();
if (listOp.Count != 0 && listOp != null)
{
string currDdf = currDdfConv.GetSerialized(listOp);
// FIXME TODO: si potrebbe eliminare in futuro che va su REDIS
//await SaveYaml(currDdf);
// versione corrente del DDF generato
int currVers = await QDataServ.SendCalcReq(door.DoorId, currDdf);
}
}
}
}
}
done = true;
}
protected async Task ordersGetAll()
{
DateTime adesso = DateTime.Today;
OrdersList = await WDCService.OrderStatusGetFilt(0, 0, adesso.AddYears(-200), adesso.AddYears(200));
}
}
}
+55
View File
@@ -14,8 +14,48 @@
idxObj++;
}
</div>
<div class="row my-2">
<div class="col-3">
</div>
<div class="col-3">
<DoorSvgObj LineColor="#8E44AD" LineWidth="8" ObjH="200" ObjW="900" LeftTextClass="col-10 fs-1 fw-bold" RightTextClass="col-2" EC_ExeFunct="@(()=> exeFun())" ObjId="1" TextData="@msgList" Message1="messaggio 1" Message2="messaggio 2" ImagePath="@svgUrl(196)"></DoorSvgObj>
</div>
<div class="col-3">
<DoorSvgObj LineColor="#8E44AD" LineWidth="8" ObjH="200" ObjW="900" LeftTextClass="col-10 fs-1 fw-bold" RightTextClass="col-2" EC_ExeFunct="@(()=> exeFun())" ObjId="2" TextData="@msgList" Message1="messaggio 1" Message2="messaggio 2" ShowPlusMinus="true" ImagePath="@svgUrl(186)"></DoorSvgObj>
</div>
<div class="col-3">
</div>
</div>
<div class="row my-2">
<div class="col-4">
<HwSvgObj LineColor="#CFD8DC" LineWidth="8" ObjH="200" ObjW="700" EC_ExeFunct="@(()=> exeFun())" ObjId="21" ItemName="Flush Pull" ItemCount="2" ImagePath="@svgUrl(196)"></HwSvgObj>
</div>
<div class="col-4">
</div>
<div class="col-4">
<HwSvgObj LineColor="#CFD8DC" LineWidth="8" ObjH="200" ObjW="700" EC_ExeFunct="@(()=> exeFun())" ObjId="22" ItemName="Hinge" ItemCount="0" ShowPlus="true" ImagePath="@svgUrl(186)"></HwSvgObj>
</div>
</div>
<div class="row my-2">
@for (int i = 183; i < 205; i++)
{
<div class="col-1 text-center border rounded-2 m-2" style="height:100%; background: linear-gradient(#AFCFD1, #92B2C4);">
<b>@i</b><br />
<img width="80" height="80" src="@svgUrl(i)" />
</div>
}
</div>
@code {
protected string svgUrl(int doorId)
{
return $"api/DoorImage/GetImage.svg?DoorId={doorId}";
}
protected int idxObj { get; set; } = 1;
protected string stepText { get; set; } = "---";
protected string blockStyle(int idx)
@@ -37,4 +77,19 @@
}
return answ;
}
protected Dictionary<string, string> msgList = new Dictionary<string, string>();
protected override void OnInitialized()
{
msgList = new Dictionary<string, string>();
msgList.Add("T1", "Titolo");
msgList.Add("M1", "Messaggio 1");
msgList.Add("M2", "MEssaggio 2");
}
protected async Task exeFun()
{
await Task.Delay(1);
}
}
+1 -1
View File
@@ -52,7 +52,7 @@ builder.Services.AddRazorPages();
builder.Services.AddServerSideBlazor();
builder.Services.AddSingleton<WebDoorCreatorService>();
builder.Services.AddScoped<WDCUserService>();
builder.Services.AddScoped<WDCRefreshService>();
builder.Services.AddSingleton<WDCRefreshService>();
builder.Services.AddSingleton<WDCVocabularyService>();
builder.Services.AddSingleton<QueueDataService>();
builder.Services.AddScoped<AuthenticationStateProvider, RevalidatingIdentityAuthenticationStateProvider<IdentityUser>>();
+12
View File
@@ -66,5 +66,17 @@
{
"outputFile": "Components/SvgComp/DoorSvgObj.razor.css",
"inputFile": "Components/SvgComp/DoorSvgObj.razor.less"
},
{
"outputFile": "Components/Hardware/HardwareNewPanel.razor.css",
"inputFile": "Components/Hardware/HardwareNewPanel.razor.less"
},
{
"outputFile": "Components/SvgComp/HwSvgObj.css",
"inputFile": "Components/SvgComp/HwSvgObj.less"
},
{
"outputFile": "Components/SvgComp/HwSvgObj.razor.css",
"inputFile": "Components/SvgComp/HwSvgObj.razor.less"
}
]
+2 -34
View File
@@ -12,7 +12,7 @@ order:
project:
pO:
line:
date: 2023-05-15T00:00:00.0000000+02:00
date: 2023-05-17T00:00:00.0000000+02:00
piece: DO_1
size:
width: 33.8125
@@ -38,38 +38,6 @@ profiles:
type: SQ
machining: ON
overmaterial: 0.1
hardware:
vision_cut_outs:
- shape: Generic\Rect
length: 30
width: 16
top_rail: 5.5
lock_stile: 0
radius: 0
door_center: center
mail_slots:
- template: Generic\Rect
height: 3
bottom_rail: 20
delta_center: 0
hinges:
- template: Generic Conceiled\StdConHingeDeepR
ToptoCL: 4.875
back_set: 0.125
thickness: 0.25
- template: Generic Conceiled\StdConHingeDeepR
ToptoCL: 4.875
back_set: 0.125
thickness: 0.25
locks:
- template: Generic\Std86
position: 45.875
back_set: 2.0
offset_WS: 0.0
side: lock_top
hardware: {}
---
Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB