Ancora fix righe offerta

This commit is contained in:
Samuele Locatelli
2025-10-20 11:02:27 +02:00
parent 28378344f9
commit ed8d2cb8ab
9 changed files with 65 additions and 47 deletions
@@ -96,7 +96,15 @@ namespace EgwCoreLib.Lux.Data.DbModel.Sales
/// Numero Item compresi
/// </summary>
[NotMapped]
public int NumItems
public double NumItems
{
get => OfferRowNav?.Sum(x => x.Qty) ?? 0;
}
/// <summary>
/// Numero Item compresi
/// </summary>
[NotMapped]
public int NumRows
{
get => OfferRowNav?.Count ?? 0;
}
+1 -1
View File
@@ -4,7 +4,7 @@
<TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<Version>0.9.2510.2009</Version>
<Version>0.9.2510.2010</Version>
</PropertyGroup>
<ItemGroup>
+19 -17
View File
@@ -95,7 +95,14 @@ else
@if (DisplayMode == EgwCoreLib.Lux.Core.Enums.DisplayMode.Edit)
{
<td>
<img class="img-fluid" src="@(imgUrl(item.OfferRowUID, $"{item.Envir}"))" width="48" @onclick="() => DoEditJwd(item)" title="Edit Item" />
@if (string.IsNullOrEmpty(item.SerStruct) || item.SerStruct.Length <= 2)
{
<img class="img-fluid" src="@(imgUrl(item.OfferRowUID, $"{item.Envir}"))" width="48" />
}
else
{
<img class="img-fluid" src="@(imgUrl(item.OfferRowUID, $"{item.Envir}"))" width="48" @onclick="() => DoEditJwd(item)" title="Edit Item" />
}
</td>
}
<td class="small">
@@ -113,7 +120,7 @@ else
@if (item.Envir != EgwMultiEngineManager.Data.Constants.EXECENVIRONMENTS.WINDOW || !string.IsNullOrEmpty(item.FileName))
{
<div class="input-group input-group-sm">
@if (EditFileRecord != null && EditFileRecord.OfferRowID == item.OfferRowID)
@if (EditRecord != null && EditRecord.OfferRowID == item.OfferRowID)
{
<span>
<InputFile class="form-control" OnChange="UploadFile" style="width: 24rem;" />
@@ -132,13 +139,11 @@ else
{
<td>
<div class="input-group">
<input class="form-input" style="width: 14rem;" type="text" @bind="@item.Note" />
<input class="form-input w-100" style="width: 16rem;" type="text" @bind="@item.Note" />
</div>
</td>
<td class="text-end">
<div class="input-group">
<input class="form-input" style="width: 4rem;" type="number" @bind="@item.Qty" />
</div>
<input class="text-end" style="width: 4rem;" type="number" @bind="@item.Qty" />
</td>
}
else
@@ -167,14 +172,7 @@ else
<td class="text-end">
@if (!string.IsNullOrEmpty(item.ItemBOM))
{
if (CurrEditMode == EditMode.RecData && EditRecord != null && EditRecord.OfferRowID == item.OfferRowID)
{
<button class="btn btn-sm btn-info" title="Cambio materiali assegnati" @onclick="() => DoSwapMat(item)"><i class="fa-solid fa-arrow-right-arrow-left"></i></button>
}
else
{
<button class="btn btn-sm btn-secondary disabled" title="Cambio materiali assegnati"><i class="fa-solid fa-arrow-right-arrow-left"></i></button>
}
<button class="btn btn-sm btn-info" title="Cambio materiali assegnati" @onclick="() => DoSwapMat(item)"><i class="fa-solid fa-arrow-right-arrow-left"></i></button>
}
</td>
}
@@ -226,7 +224,11 @@ else
{
<th colspan="1"></th>
}
<th class="text-end">@($"{GrandTotPrice:C2}")</th>
<th class="text-end">
@($"{GrandTotPrice:C2}")
<div class="small text-secondary" title="RockBottom Price">(@($"{GrandTotCost:C2}"))</div>
</th>
<th class="text-end">@($"{GrandTotMargin:P2}")</th>
@if (DisplayMode == EgwCoreLib.Lux.Core.Enums.DisplayMode.Edit)
{
@@ -239,13 +241,13 @@ else
</div>
</div>
}
@if (showChangeMat && EditBomRecord != null)
@if (EditRecord != null && CurrEditMode== EditMode.BOM)
{
<div class="modal" tabindex="-1" style="display:block; background-color: rgba(10,10,10,.6);" role="dialog">
<div class="modal-dialog modal-xl">
<div class="modal-content">
<div class="modal-header">
<div class="modal-title fs-4">Cambio Materiali offerta <b>@EditBomRecord.OfferRowUID</b></div>
<div class="modal-title fs-4">Cambio Materiali offerta <b>@EditRecord.OfferRowUID</b></div>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close" @onclick="ClosePopup">
</button>
</div>
+28 -24
View File
@@ -107,6 +107,14 @@ namespace Lux.UI.Components.Compo
[Inject]
protected DataLayerServices DLService { get; set; } = null!;
/// <summary>
/// Costo totale calcolato x offerta
/// </summary>
protected double GrandTotCost
{
get => AllRecords != null && AllRecords.Count > 0 ? AllRecords.Sum(x => x.TotalCost) : 0;
}
/// <summary>
/// Margine medio calcolato x offerta
/// </summary>
@@ -133,7 +141,7 @@ namespace Lux.UI.Components.Compo
/// </summary>
protected double GrandTotPrice
{
get => AllRecords != null && AllRecords.Count > 0 ? AllRecords.Sum(x => x.TotalCost) : 0;
get => AllRecords != null && AllRecords.Count > 0 ? AllRecords.Sum(x => x.TotalPrice) : 0;
}
/// <summary>
@@ -167,8 +175,8 @@ namespace Lux.UI.Components.Compo
protected void ClosePopup()
{
showChangeMat = false;
EditBomRecord = null;
CurrEditMode = EditMode.None;
EditRecord = null;
}
/// <summary>
@@ -301,11 +309,12 @@ namespace Lux.UI.Components.Compo
protected async Task DoSave(OfferRowModel curRec)
{
isLoading = true;
// salvo record modificato...
await DLService.OffertRowUpsert(curRec);
// reset
CurrEditMode = EditMode.None;
EditRecord = null;
await Task.Delay(20);
await DLService.FlushCacheOffersAsync();
await Task.Delay(20);
await ReloadData();
UpdateTable();
isLoading = false;
@@ -313,9 +322,9 @@ namespace Lux.UI.Components.Compo
protected void DoSwapMat(OfferRowModel currRow)
{
showChangeMat = true;
EditBomRecord = currRow;
CurrBomList = DLService.OffertGetBomList(EditBomRecord);
CurrEditMode = EditMode.BOM;
EditRecord = currRow;
CurrBomList = DLService.OffertGetBomList(EditRecord);
}
/// <summary>
@@ -521,10 +530,6 @@ namespace Lux.UI.Components.Compo
private string currSvg = "";
private OfferRowModel? EditBomRecord = null;
private OfferRowModel? EditFileRecord = null;
/// <summary>
/// Record in Edit corrente
/// </summary>
@@ -557,8 +562,6 @@ namespace Lux.UI.Components.Compo
/// </summary>
private Dictionary<string, string> reqDict = new Dictionary<string, string>();
private bool showChangeMat = false;
private string subChannel = "";
private int totalCount = 0;
@@ -875,20 +878,21 @@ namespace Lux.UI.Components.Compo
/// </summary>
private void ToggleFileEdit(OfferRowModel? currRec)
{
EditFileRecord = currRec;
CurrEditMode = currRec == null ? EditMode.None : EditMode.File;
EditRecord = currRec;
}
/// <summary>
/// salva nel record corrente la BOM aggiornata e poi ricalcola importo...
/// Salva nel record corrente la BOM aggiornata e poi ricalcola importo...
/// </summary>
/// <param name="newBomList"></param>
/// <exception cref="NotImplementedException"></exception>
private async void UpdateBom(List<BomItemDTO> newBomList)
{
if (EditBomRecord != null)
if (EditRecord != null)
{
// salvo BOM nel record corrente...
bool fatto = await DLService.OffertRowUpdateBom(EditBomRecord.OfferRowID, newBomList);
bool fatto = await DLService.OffertRowUpdateBom(EditRecord.OfferRowID, newBomList);
// ricalcolo offerta completa
await ReloadData();
UpdateTable();
@@ -949,7 +953,7 @@ namespace Lux.UI.Components.Compo
private async Task UploadFile(InputFileChangeEventArgs e)
{
if (EditFileRecord != null)
if (EditRecord != null)
{
// init dizionari arg richiesta update
Dictionary<string, string> fileArgs = new Dictionary<string, string>();
@@ -965,11 +969,11 @@ namespace Lux.UI.Components.Compo
// calcolo il nome del file trusted...
string trustedFileName = Path.GetRandomFileName();
EditFileRecord.FileResource = trustedFileName;
EditFileRecord.FileName = file.Name;
EditFileRecord.FileSize = rawContent.LongCount();
EditRecord.FileResource = trustedFileName;
EditRecord.FileName = file.Name;
EditRecord.FileSize = rawContent.LongCount();
// salvo sul DB i dati (nome, nome sicuro, size...)
await DLService.OffertRowUpdateFileData(EditFileRecord);
await DLService.OffertRowUpdateFileData(EditRecord);
// parametri richiesta
fileArgs.Add("Mode", $"{(int)Egw.Window.Data.Enums.QuestionModes.PREVIEW}");
@@ -978,7 +982,7 @@ namespace Lux.UI.Components.Compo
CalcRequestDTO calcRequestDTO = new CalcRequestDTO();
calcRequestDTO.EnvType = EgwMultiEngineManager.Data.Constants.EXECENVIRONMENTS.BEAM;
calcRequestDTO.DictExec = fileArgs;
await ICService.CallRestPost($"{apiUrl}/{GenericBasePath}", $"{calcTag}/{EditFileRecord.OfferRowUID}", calcRequestDTO);
await ICService.CallRestPost($"{apiUrl}/{GenericBasePath}", $"{calcTag}/{EditRecord.OfferRowUID}", calcRequestDTO);
#if false
// salvo in locale il file: SISTEMARE PERMESSI
+4
View File
@@ -124,6 +124,7 @@ else
{
<th>Descrizione</th>
}
<th class="text-end"># righe</th>
<th class="text-end"># articoli</th>
<th class="text-end">Importo</th>
<th class="text-end">Marg.</th>
@@ -161,6 +162,9 @@ else
{
<td>@item.Description</td>
}
<td class="text-end">
@item.NumRows
</td>
<td class="text-end">
@item.NumItems
</td>
+1 -1
View File
@@ -5,7 +5,7 @@
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<UserSecretsId>aspnet-Lux.UI-a758c101-a2f4-4e38-977d-1c4887dbbd50</UserSecretsId>
<Version>0.9.2510.2009</Version>
<Version>0.9.2510.2010</Version>
</PropertyGroup>
<ItemGroup>
+1 -1
View File
@@ -1,6 +1,6 @@
<body>
<i>LUX - Web Windows MES</i>
<h4>Versione: 0.9.2510.2009</h4>
<h4>Versione: 0.9.2510.2010</h4>
<br /> Note di rilascio:
<ul>
<li>
+1 -1
View File
@@ -1 +1 @@
0.9.2510.2009
0.9.2510.2010
+1 -1
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<item>
<version>0.9.2510.2009</version>
<version>0.9.2510.2010</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>