Inseriti check x evitare deserializzazione obj vuoti
This commit is contained in:
@@ -25,31 +25,33 @@ namespace EgwCoreLib.Lux.Core.RestPayload
|
||||
uID = UID;
|
||||
// deserializzo risultati calcolo
|
||||
machineCalcResults = JsonConvert.DeserializeObject<List<MachineCalcResultDTO>>(rawData) ?? new List<MachineCalcResultDTO>();
|
||||
// calcolo "esito sinteico" della lavorabilità (NESSUNA part UnHealthy su ogni macchina)
|
||||
workable = machineCalcResults.Sum(x => x.NumPartsKo) == 0;
|
||||
// lista completa...
|
||||
var firstMachine = machineCalcResults.FirstOrDefault();
|
||||
if (firstMachine != null)
|
||||
if (!string.IsNullOrEmpty(rawData) && rawData.Count() > 2)
|
||||
{
|
||||
listComplete = firstMachine.PartList.Select(x => x.Tag).ToList();
|
||||
// pezzi lavorabili
|
||||
listWorkable = MachineCalc.Utils.IntersectTags(machineCalcResults, p => p.CalcResult == Enums.PartVerificationResult.MACHINABLE).ToList();
|
||||
// cerco l'insieme dei pezzi NON lavorabili
|
||||
listUnWorkable = MachineCalc.Utils.IntersectTags(machineCalcResults, p => p.CalcResult != Enums.PartVerificationResult.MACHINABLE).ToList();
|
||||
listVincolated = listComplete
|
||||
.Except(listWorkable)
|
||||
.Except(ListUnWorkable)
|
||||
.ToList();
|
||||
numKo = listUnWorkable.Count();
|
||||
numOk = listWorkable.Count();
|
||||
numOkVin = listVincolated.Count();
|
||||
// se non ok verifico SE ci siano part unhealty su OGNI macchina (altrimenti è cmq lavorabile
|
||||
if (!workable)
|
||||
// calcolo "esito sinteico" della lavorabilità (NESSUNA part UnHealthy su ogni macchina)
|
||||
workable = machineCalcResults.Sum(x => x.NumPartsKo) == 0;
|
||||
// lista completa...
|
||||
var firstMachine = machineCalcResults.FirstOrDefault();
|
||||
if (firstMachine != null)
|
||||
{
|
||||
workable = !listUnWorkable.Any();
|
||||
listComplete = firstMachine.PartList.Select(x => x.Tag).ToList();
|
||||
// pezzi lavorabili
|
||||
listWorkable = MachineCalc.Utils.IntersectTags(machineCalcResults, p => p.CalcResult == Enums.PartVerificationResult.MACHINABLE).ToList();
|
||||
// cerco l'insieme dei pezzi NON lavorabili
|
||||
listUnWorkable = MachineCalc.Utils.IntersectTags(machineCalcResults, p => p.CalcResult != Enums.PartVerificationResult.MACHINABLE).ToList();
|
||||
listVincolated = listComplete
|
||||
.Except(listWorkable)
|
||||
.Except(ListUnWorkable)
|
||||
.ToList();
|
||||
numKo = listUnWorkable.Count();
|
||||
numOk = listWorkable.Count();
|
||||
numOkVin = listVincolated.Count();
|
||||
// se non ok verifico SE ci siano part unhealty su OGNI macchina (altrimenti è cmq lavorabile
|
||||
if (!workable)
|
||||
{
|
||||
workable = !listUnWorkable.Any();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
LoadDetail = MachineCalc.Utils.CalculateIntersections(machineCalcResults);
|
||||
}
|
||||
|
||||
@@ -135,7 +137,7 @@ namespace EgwCoreLib.Lux.Core.RestPayload
|
||||
/// </summary>
|
||||
public decimal TotMaxTime
|
||||
{
|
||||
get => LoadDetail.Max(x => x.MaxTime);
|
||||
get => LoadDetail != null ? LoadDetail.Max(x => x.MaxTime) : 0;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Version>0.9.2512.0918</Version>
|
||||
<Version>0.9.2512.1210</Version>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -239,8 +239,8 @@ else
|
||||
<div class="small text-secondary" title="RockBottom Price">(@item.Original.UnitCost.ToString("C2"))</div>
|
||||
</td> *@
|
||||
|
||||
<td class="text-center align-content-center fs-4" title="@item.WorkLoad.ListMachines">
|
||||
<span class="px-2">@item.WorkLoad.NumMachines</span>
|
||||
<td class="text-center align-content-center fs-4" title="@(item.WorkLoad?.ListMachines ?? "")">
|
||||
<span class="px-2">@item.WorkLoad?.NumMachines ?? ""</span>
|
||||
@*@if (@item.WorkLoad.Workable)
|
||||
{
|
||||
<i class="fa-solid fa-thumbs-up text-success"></i>
|
||||
@@ -256,31 +256,34 @@ else
|
||||
</div>
|
||||
</td>
|
||||
<td class="text-center align-content-center text-nowrap">
|
||||
@if (item.WorkLoad.NumKo > 0)
|
||||
@if (item.WorkLoad != null)
|
||||
{
|
||||
<button class="btn btn-lg btn-danger shadow w-100" @onclick="() => ShowWLD(item.WorkLoad, EditMode.WorkLoadDetailTag)">
|
||||
<span class="fw-bold px-1" title="# Pezzi KO">
|
||||
@($"{item.WorkLoad.NumKo:N0}")
|
||||
</span>
|
||||
<i class="fa-solid fa-thumbs-down"></i>
|
||||
</button>
|
||||
}
|
||||
else if (item.WorkLoad.NumOkVin > 0)
|
||||
{
|
||||
<button class="btn btn-lg btn-primary shadow w-100" @onclick="() => ShowWLD(item.WorkLoad, EditMode.WorkLoadDetailTag)">
|
||||
<span class="fw-bold px-1" title="# Pezzi Vinc">
|
||||
@($"{item.WorkLoad.NumOkVin:N0}")
|
||||
</span>
|
||||
</button>
|
||||
}
|
||||
else if (item.WorkLoad.NumOk > 0)
|
||||
{
|
||||
<button class="btn btn-lg btn-success shadow w-100" @onclick="() => ShowWLD(item.WorkLoad, EditMode.WorkLoadDetailTag)">
|
||||
<span class="fw-bold px-1" title="# Pezzi OK">
|
||||
@($"{item.WorkLoad.NumOk:N0}")
|
||||
</span>
|
||||
<i class="fa-solid fa-thumbs-up"></i>
|
||||
</button>
|
||||
if (item.WorkLoad.NumKo > 0)
|
||||
{
|
||||
<button class="btn btn-lg btn-danger shadow w-100" @onclick="() => ShowWLD(item.WorkLoad, EditMode.WorkLoadDetailTag)">
|
||||
<span class="fw-bold px-1" title="# Pezzi KO">
|
||||
@($"{item.WorkLoad.NumKo:N0}")
|
||||
</span>
|
||||
<i class="fa-solid fa-thumbs-down"></i>
|
||||
</button>
|
||||
}
|
||||
else if (item.WorkLoad.NumOkVin > 0)
|
||||
{
|
||||
<button class="btn btn-lg btn-primary shadow w-100" @onclick="() => ShowWLD(item.WorkLoad, EditMode.WorkLoadDetailTag)">
|
||||
<span class="fw-bold px-1" title="# Pezzi Vinc">
|
||||
@($"{item.WorkLoad.NumOkVin:N0}")
|
||||
</span>
|
||||
</button>
|
||||
}
|
||||
else if (item.WorkLoad.NumOk > 0)
|
||||
{
|
||||
<button class="btn btn-lg btn-success shadow w-100" @onclick="() => ShowWLD(item.WorkLoad, EditMode.WorkLoadDetailTag)">
|
||||
<span class="fw-bold px-1" title="# Pezzi OK">
|
||||
@($"{item.WorkLoad.NumOk:N0}")
|
||||
</span>
|
||||
<i class="fa-solid fa-thumbs-up"></i>
|
||||
</button>
|
||||
}
|
||||
}
|
||||
</td>
|
||||
@if (DisplayMode == EgwCoreLib.Lux.Core.Enums.DisplayMode.Edit)
|
||||
@@ -320,9 +323,16 @@ else
|
||||
@item.Original.MaxDiscount.ToString("P2")
|
||||
</td> *@
|
||||
<td class="text-end text-nowrap align-content-center" title="Tempi Stimati">
|
||||
@if (item.WorkLoad!=null)
|
||||
{
|
||||
<button class="btn btn-lg btn-primary shadow w-100" @onclick="() => ShowWLD(item.WorkLoad, EditMode.WorkLoadDetailTime)">
|
||||
@FormatDatetime(item.WorkLoad.TotMaxTime)
|
||||
</button>
|
||||
</button>
|
||||
}
|
||||
else
|
||||
{
|
||||
<button class="btn btn-lg btn-secondary disabled w-100">???</button>
|
||||
}
|
||||
</td>
|
||||
}
|
||||
@if (DisplayMode == EgwCoreLib.Lux.Core.Enums.DisplayMode.Edit)
|
||||
|
||||
@@ -104,8 +104,8 @@ namespace Lux.UI.Components.Compo
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
public OrderRowModel Original { get; set; }
|
||||
public WorkLoadDetailDTO WorkLoad { get; set; }
|
||||
public OrderRowModel Original { get; set; } = null!;
|
||||
public WorkLoadDetailDTO? WorkLoad { get; set; }
|
||||
|
||||
#endregion Public Properties
|
||||
}
|
||||
@@ -176,7 +176,7 @@ namespace Lux.UI.Components.Compo
|
||||
decimal answ = 0;
|
||||
if (ListRecords != null && ListRecords.Count > 0)
|
||||
{
|
||||
answ = ListRecords.Sum(x => x.WorkLoad.TotMaxTime);
|
||||
answ = ListRecords.Sum(x => x.WorkLoad?.TotMaxTime ?? 0);
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
@@ -205,7 +205,7 @@ namespace Lux.UI.Components.Compo
|
||||
int answ = 0;
|
||||
if (ListRecords != null && ListRecords.Count > 0)
|
||||
{
|
||||
answ = ListRecords.Sum(x => x.WorkLoad.NumKo);
|
||||
answ = ListRecords.Sum(x => x.WorkLoad?.NumKo ?? 0);
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
@@ -218,7 +218,7 @@ namespace Lux.UI.Components.Compo
|
||||
int answ = 0;
|
||||
if (ListRecords != null && ListRecords.Count > 0)
|
||||
{
|
||||
answ = ListRecords.Sum(x => x.WorkLoad.NumOk);
|
||||
answ = ListRecords.Sum(x => x.WorkLoad?.NumOk ?? 0);
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
@@ -231,7 +231,7 @@ namespace Lux.UI.Components.Compo
|
||||
int answ = 0;
|
||||
if (ListRecords != null && ListRecords.Count > 0)
|
||||
{
|
||||
answ = ListRecords.Sum(x => x.WorkLoad.NumOkVin);
|
||||
answ = ListRecords.Sum(x => x.WorkLoad?.NumOkVin ?? 0);
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
@@ -554,7 +554,7 @@ namespace Lux.UI.Components.Compo
|
||||
.Select(item => new MergedOrderRow
|
||||
{
|
||||
Original = item,
|
||||
WorkLoad = WorkLoadDetail(item.OrderRowUID, item.ProdEstimate)
|
||||
WorkLoad = !string.IsNullOrEmpty(item.ProdEstimate) ? WorkLoadDetail(item.OrderRowUID, item.ProdEstimate) : null
|
||||
})
|
||||
.ToList();
|
||||
return mergedList;
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<Nullable>enable</Nullable>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<UserSecretsId>aspnet-Lux.UI-a758c101-a2f4-4e38-977d-1c4887dbbd50</UserSecretsId>
|
||||
<Version>0.9.2512.1209</Version>
|
||||
<Version>0.9.2512.1210</Version>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<body>
|
||||
<i>LUX - Web Windows MES</i>
|
||||
<h4>Versione: 0.9.2512.0918</h4>
|
||||
<h4>Versione: 0.9.2512.1210</h4>
|
||||
<br /> Note di rilascio:
|
||||
<ul>
|
||||
<li>
|
||||
|
||||
@@ -1 +1 @@
|
||||
0.9.2512.0918
|
||||
0.9.2512.1210
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<item>
|
||||
<version>0.9.2512.0918</version>
|
||||
<version>0.9.2512.1210</version>
|
||||
<url>http://nexus.steamware.net/repository/SWS/GPW/stable/GPW.UI.zip</url>
|
||||
<changelog>http://nexus.steamware.net/repository/SWS/GPW/stable/ChangeLog.html</changelog>
|
||||
<mandatory>false</mandatory>
|
||||
|
||||
Reference in New Issue
Block a user