Merge branch 'develop' of https://gitlab.steamware.net/etis/lux into develop
This commit is contained in:
@@ -206,6 +206,7 @@ namespace EgwCoreLib.Lux.Data.Controllers
|
||||
.DbSetItem
|
||||
.Where(x => (string.IsNullOrEmpty(CodGroup) || x.CodGroup == CodGroup)
|
||||
&& (ItemType == ItemClassType.ND || x.ItemType == ItemType))
|
||||
.Include(g => g.ItemGroupNav)
|
||||
.ToListAsync();
|
||||
}
|
||||
catch (Exception exc)
|
||||
@@ -390,6 +391,53 @@ namespace EgwCoreLib.Lux.Data.Controllers
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Inserisce o aggiorna il record
|
||||
/// </summary>
|
||||
/// <param name="currRec"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<bool> ItemUpsertAsync(ItemModel currRec)
|
||||
{
|
||||
bool result = false;
|
||||
//using (DataLayerContext dbCtx = new DataLayerContext(configuration))
|
||||
using (DataLayerContext dbCtx = new DataLayerContext())
|
||||
{
|
||||
try
|
||||
{
|
||||
var dbResult = await dbCtx
|
||||
.DbSetItem
|
||||
.Where(x => x.ItemID == currRec.ItemID)
|
||||
.FirstOrDefaultAsync();
|
||||
if (dbResult != null)
|
||||
{
|
||||
//dbCtx.DbSetItem.Remove(dbResult);
|
||||
dbResult.CodGroup = currRec.CodGroup;
|
||||
dbResult.ItemType = currRec.ItemType;
|
||||
dbResult.IsService = currRec.IsService;
|
||||
dbResult.ItemCode = currRec.ItemCode;
|
||||
dbResult.ExtItemCode = currRec.ExtItemCode;
|
||||
dbResult.Cost = currRec.Cost;
|
||||
dbResult.Margin = currRec.Margin;
|
||||
dbResult.Description = currRec.Description;
|
||||
dbResult.QtyMin = currRec.QtyMin;
|
||||
dbResult.QtyMax = currRec.QtyMax;
|
||||
dbResult.UM = currRec.UM;
|
||||
dbCtx.Entry(dbResult).State = EntityState.Modified;
|
||||
}
|
||||
else
|
||||
{
|
||||
dbCtx.DbSetItem.Add(currRec);
|
||||
}
|
||||
await dbCtx.SaveChangesAsync();
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Log.Error($"Eccezione durante ItemUpsertAsync{Environment.NewLine}{exc}");
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Upsert item ricevuti da BOM calcolata
|
||||
/// </summary>
|
||||
|
||||
@@ -79,6 +79,24 @@ namespace EgwCoreLib.Lux.Data.DbModel
|
||||
/// </summary>
|
||||
public string UM { get; set; } = "#";
|
||||
|
||||
/// <summary>
|
||||
/// Indica se il range quantity sia ok
|
||||
/// </summary>
|
||||
[NotMapped]
|
||||
public bool IsOkQty
|
||||
{
|
||||
get => QtyMax > 0 && (QtyMax - QtyMin) > 0;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Indica se il range quantity sia ok
|
||||
/// </summary>
|
||||
[NotMapped]
|
||||
public bool IsOkCost
|
||||
{
|
||||
get => Cost > 0;
|
||||
}
|
||||
|
||||
#if false
|
||||
/// <summary>
|
||||
/// Opzionale, valore JWD di default come template di partenza in formato JWD
|
||||
|
||||
@@ -267,6 +267,18 @@ namespace EgwCoreLib.Lux.Data.Services
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Update / Insert record item
|
||||
/// </summary>
|
||||
/// <param name="currRec"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<bool> ItemUpsertAsync(ItemModel currRec)
|
||||
{
|
||||
bool result = await dbController.ItemUpsertAsync(currRec);
|
||||
await ExecFlushRedisPatternAsync((RedisValue)$"{redisBaseKey}:Item:*");
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Elenco completo offerte da DB
|
||||
/// </summary>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Version>0.9.2508.0910</Version>
|
||||
<Version>0.9.2509.0416</Version>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -0,0 +1,99 @@
|
||||
<div class="rounded rounded-3 bg-secondary bg-opacity-25 bg-gradient p-2 m-0 shadow">
|
||||
|
||||
@if (CurrRecord != null)
|
||||
{
|
||||
<div><span class="fs-5"># <b>@(CurrRecord?.ItemID)</b></span> | Codice @CurrRecord.ItemCode</div>
|
||||
<div class="row g-1">
|
||||
<div class="col-md-2">
|
||||
<div class="form-floating">
|
||||
<select @bind="@CurrRecord.CodGroup" class="form-select">
|
||||
@* <option value="">--- Sel. Gruppo ---</option> *@
|
||||
@foreach (var item in ListItemGroup)
|
||||
{
|
||||
<option value="@item.CodGroup">@item.Description</option>
|
||||
}
|
||||
</select>
|
||||
<label class="small bg-opacity-50">Gruppo</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-1">
|
||||
<div class="form-floating">
|
||||
<select @bind="@CurrRecord.ItemType" class="form-select">
|
||||
@foreach (var sType in Enum.GetValues(typeof(EgwCoreLib.Lux.Core.Enums.ItemClassType)))
|
||||
{
|
||||
<option value="@sType">@sType</option>
|
||||
}
|
||||
</select>
|
||||
<label class="small bg-opacity-50">Tipo</label>
|
||||
</div>
|
||||
</div><div class="col-md-1">
|
||||
<div class="form-floating">
|
||||
<div class="form-control ">
|
||||
<div class="form-check form-switch">
|
||||
<input class="form-check-input" type="checkbox" checked="@CurrRecord.IsService">
|
||||
</div>
|
||||
</div>
|
||||
<label class="small bg-opacity-50">Serv</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-2">
|
||||
<div class="form-floating">
|
||||
<input type="text" class="form-control" @bind="@CurrRecord.ExtItemCode">
|
||||
<label class="small bg-opacity-50">ItemCode</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<div class="form-floating">
|
||||
<input type="text" class="form-control" @bind="@CurrRecord.SupplCode">
|
||||
<label class="small bg-opacity-50">Suppl.Code</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-2">
|
||||
<div class="form-floating">
|
||||
<input type="number" class="form-control text-end" @bind="@CurrRecord.Cost">
|
||||
<label class="small bg-opacity-50">Costo</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-1">
|
||||
<div class="form-floating">
|
||||
<input type="number" class="form-control text-end" @bind="@CurrRecord.Margin">
|
||||
<label class="small bg-opacity-50">Margine</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="form-floating">
|
||||
<input type="text" class="form-control" @bind="@CurrRecord.Description">
|
||||
<label class="small bg-opacity-50">Descrizione</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-1">
|
||||
<div class="form-floating">
|
||||
<input type="number" class="form-control text-end" @bind="@CurrRecord.QtyMin">
|
||||
<label class="small bg-opacity-50">Qty min</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-1">
|
||||
<div class="form-floating">
|
||||
<input type="number" class="form-control text-end" @bind="@CurrRecord.QtyMax">
|
||||
<label class="small bg-opacity-50">Qty MAX</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-1">
|
||||
<div class="form-floating">
|
||||
<input type="text" class="form-control text-end" @bind="@CurrRecord.UM">
|
||||
<label class="small bg-opacity-50">UM</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<div class="row g-1 py-1">
|
||||
<div class="col-md-6">
|
||||
<button class="btn btn-lg btn-success w-100" @onclick="DoSave">Save</button>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<button class="btn btn-lg btn-warning w-100" @onclick="DoCancel">Cancel</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
@@ -0,0 +1,39 @@
|
||||
using EgwCoreLib.Lux.Data.DbModel;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
|
||||
namespace Lux.UI.Components.Compo
|
||||
{
|
||||
public partial class ItemEdit
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
[Parameter]
|
||||
public ItemModel? CurrRecord { get; set; } = null;
|
||||
|
||||
[Parameter]
|
||||
public EventCallback<bool> EC_Close { get; set; }
|
||||
|
||||
[Parameter]
|
||||
public EventCallback<ItemModel> EC_Updated { get; set; }
|
||||
|
||||
[Parameter]
|
||||
public List<ItemGroupModel> ListItemGroup { get; set; } = null!;
|
||||
|
||||
#endregion Public Properties
|
||||
|
||||
#region Private Methods
|
||||
|
||||
private async Task DoCancel()
|
||||
{
|
||||
await EC_Close.InvokeAsync(true);
|
||||
}
|
||||
|
||||
private async Task DoSave()
|
||||
{
|
||||
// richiede di effettuare salvataggio record...
|
||||
await EC_Updated.InvokeAsync(CurrRecord);
|
||||
}
|
||||
|
||||
#endregion Private Methods
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,102 @@
|
||||
@if (isLoading || ListRecords == null)
|
||||
{
|
||||
<LoadingData></LoadingData>
|
||||
}
|
||||
else if (totalCount == 0)
|
||||
{
|
||||
<div class="alert alert-info text-center display-4">Nessun record trovato</div>
|
||||
}
|
||||
else
|
||||
{
|
||||
if (editRecord != null)
|
||||
{
|
||||
<ItemEdit CurrRecord="editRecord" ListItemGroup="ListItemGroup" EC_Updated="DoSave" EC_Close="DoCancel"></ItemEdit>
|
||||
}
|
||||
<table class="table table-sm table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>
|
||||
<button class="btn btn-sm btn-primary" title="Reset selezione" @onclick="DoReset"><i class="fa-solid fa-arrow-rotate-right"></i></button>
|
||||
</th>
|
||||
<th>ID</th>
|
||||
<th>Gruppo</th>
|
||||
<th>Tipo</th>
|
||||
<th>Serv</th>
|
||||
<th>Codice</th>
|
||||
<th>ItemCode</th>
|
||||
<th>Suppl.Code</th>
|
||||
<th>Descrizione</th>
|
||||
<th class="text-end">Costo</th>
|
||||
<th class="text-end">Margine</th>
|
||||
<th class="text-end">Qty Range</th>
|
||||
<th class="text-end">UM</th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach (var item in ListRecords)
|
||||
{
|
||||
<tr>
|
||||
<td class="text-start text-nowrap">
|
||||
<button class="btn btn-sm btn-primary" @onclick="() => DoSelect(item)"><i class="fa-solid fa-magnifying-glass"></i></button>
|
||||
<button class="btn btn-sm btn-info" @onclick="() => DoEdit(item)"><i class="fa-solid fa-pencil"></i></button>
|
||||
</td>
|
||||
<td>@item.ItemID</td>
|
||||
<td>
|
||||
@if (item.ItemGroupNav != null)
|
||||
{
|
||||
@item.ItemGroupNav.Description
|
||||
}
|
||||
else
|
||||
{
|
||||
@item.CodGroup
|
||||
}
|
||||
</td>
|
||||
<td>@item.ItemType</td>
|
||||
<td>@item.IsService</td>
|
||||
<td>@item.ItemCode</td>
|
||||
<td>@item.ExtItemCode</td>
|
||||
<td>@item.SupplCode</td>
|
||||
<td>@item.Description</td>
|
||||
<td class="text-end text-nowrap">
|
||||
@if (!item.IsOkCost)
|
||||
{
|
||||
<span class="text-danger me-2" title="Manca importo prodotto"><i class="fa-solid fa-triangle-exclamation"></i></span>
|
||||
}
|
||||
@item.Cost.ToString("C3")
|
||||
</td>
|
||||
<td class="text-end">@item.Margin.ToString("P1")</td>
|
||||
<td class="text-end text-nowrap">
|
||||
@if (!item.IsOkQty)
|
||||
{
|
||||
<span class="text-warning me-2" title="Range Qty non corretto"><i class="fa-solid fa-triangle-exclamation"></i></span>
|
||||
}
|
||||
<span>@item.QtyMin.ToString("F1") ↔ @item.QtyMax.ToString("F1")</span>
|
||||
</td>
|
||||
<td class="text-end">@item.UM</td>
|
||||
<td>
|
||||
@if (item.ItemType != Enums.ItemClassType.Bom)
|
||||
{
|
||||
<button class="btn btn-sm btn-danger" @onclick="() => DoDelete(item)"><i class="fa-solid fa-trash-can"></i></button>
|
||||
}
|
||||
else
|
||||
{
|
||||
<button class="btn btn-sm btn-secondary disabled"><i class="fa-solid fa-trash-can"></i></button>
|
||||
|
||||
}
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<td colspan="15">
|
||||
<EgwCoreLib.Razor.DataPager currPage="@currPage" PageSize="@numRecord" totalCount="@totalCount" numPageChanged="SavePage" numRecordChanged="SaveNumRec"></EgwCoreLib.Razor.DataPager>
|
||||
</td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,212 @@
|
||||
using EgwCoreLib.Lux.Core;
|
||||
using EgwCoreLib.Lux.Data.DbModel;
|
||||
using EgwCoreLib.Lux.Data.Services;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using Microsoft.JSInterop;
|
||||
|
||||
namespace Lux.UI.Components.Compo
|
||||
{
|
||||
public partial class ItemMan
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
[Parameter]
|
||||
public List<ItemGroupModel> ListItemGroup { get; set; } = null!;
|
||||
|
||||
[Parameter]
|
||||
public FiltSelect SelFilt { get; set; } = null!;
|
||||
|
||||
#endregion Public Properties
|
||||
|
||||
#region Public Classes
|
||||
|
||||
/// <summary>
|
||||
/// Filtro selezione items
|
||||
/// </summary>
|
||||
public class FiltSelect
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
public string SearchVal { get; set; } = "";
|
||||
public string SelCodGroup { get; set; } = "";
|
||||
public Enums.ItemClassType SelType { get; set; } = Enums.ItemClassType.ND;
|
||||
|
||||
#endregion Public Properties
|
||||
|
||||
#region Public Methods
|
||||
|
||||
public override bool Equals(object? obj)
|
||||
{
|
||||
if (obj == null)
|
||||
return false;
|
||||
if (!(obj is FiltSelect item))
|
||||
return false;
|
||||
|
||||
if (SelCodGroup != item.SelCodGroup)
|
||||
return false;
|
||||
|
||||
if (SelType != item.SelType)
|
||||
return false;
|
||||
|
||||
if (SearchVal != item.SearchVal)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public override int GetHashCode()
|
||||
{
|
||||
return base.GetHashCode();
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
}
|
||||
|
||||
#endregion Public Classes
|
||||
|
||||
#region Protected Fields
|
||||
|
||||
protected List<ItemModel> AllRecords = new List<ItemModel>();
|
||||
#if false
|
||||
protected List<ItemGroupModel> ListItemGroup = new List<ItemGroupModel>();
|
||||
#endif
|
||||
protected List<ItemModel> ListRecords = new List<ItemModel>();
|
||||
|
||||
#endregion Protected Fields
|
||||
|
||||
#region Protected Properties
|
||||
|
||||
[Inject]
|
||||
protected DataLayerServices DLService { get; set; } = null!;
|
||||
|
||||
[Inject]
|
||||
protected IJSRuntime JSRuntime { get; set; } = null!;
|
||||
|
||||
#endregion Protected Properties
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
/// <summary>
|
||||
/// impossta record x eliminazione
|
||||
/// </summary>
|
||||
/// <param name="selRec"></param>
|
||||
protected async Task DoDelete(ItemModel selRec)
|
||||
{
|
||||
if (!await JSRuntime.InvokeAsync<bool>("confirm", $"Sicuro di voler eliminare il record? Dettagli: {selRec.ItemID} | {selRec.CodGroup} | {selRec.ItemType} | {selRec.ExtItemCode}"))
|
||||
return;
|
||||
//// esegue eliminazione del record...
|
||||
//await DLService.ItemDeleteAsync(selRec);
|
||||
|
||||
editRecord = null;
|
||||
selRecord = null;
|
||||
await ReloadData();
|
||||
UpdateTable();
|
||||
}
|
||||
|
||||
protected void DoEdit(ItemModel curRec)
|
||||
{
|
||||
editRecord = curRec;
|
||||
}
|
||||
|
||||
protected void DoReset()
|
||||
{
|
||||
editRecord = null;
|
||||
}
|
||||
|
||||
protected void DoSelect(ItemModel curRec)
|
||||
{
|
||||
selRecord = curRec;
|
||||
}
|
||||
|
||||
protected override async Task OnParametersSetAsync()
|
||||
{
|
||||
if (!SelFilt.Equals(actFilt) || true)
|
||||
{
|
||||
actFilt = SelFilt;
|
||||
await ReloadData();
|
||||
UpdateTable();
|
||||
}
|
||||
}
|
||||
|
||||
protected void SaveNumRec(int newNum)
|
||||
{
|
||||
numRecord = newNum;
|
||||
UpdateTable();
|
||||
}
|
||||
|
||||
protected void SavePage(int newNum)
|
||||
{
|
||||
currPage = newNum;
|
||||
UpdateTable();
|
||||
}
|
||||
|
||||
#endregion Protected Methods
|
||||
|
||||
#region Private Fields
|
||||
|
||||
private FiltSelect actFilt = new FiltSelect();
|
||||
private int currPage = 1;
|
||||
private ItemModel? editRecord = null;
|
||||
private bool isLoading = false;
|
||||
private int numRecord = 10;
|
||||
private ItemModel? selRecord = null;
|
||||
private int totalCount = 0;
|
||||
|
||||
#endregion Private Fields
|
||||
|
||||
#region Private Methods
|
||||
|
||||
private async Task DoCancel()
|
||||
{
|
||||
await ResetEdit();
|
||||
UpdateTable();
|
||||
}
|
||||
|
||||
private async Task DoSave(ItemModel currRec)
|
||||
{
|
||||
// salvo
|
||||
await DLService.ItemUpsertAsync(currRec);
|
||||
await ResetEdit();
|
||||
UpdateTable();
|
||||
}
|
||||
|
||||
private async Task ReloadData()
|
||||
{
|
||||
isLoading = true;
|
||||
AllRecords = await DLService.ItemGetFiltAsync(actFilt.SelCodGroup, actFilt.SelType);
|
||||
// se ho ricerca testuale faccio filtro ulteriore...
|
||||
if (!string.IsNullOrEmpty(actFilt.SearchVal))
|
||||
{
|
||||
AllRecords = AllRecords
|
||||
.Where(x =>
|
||||
x.Description.Contains(actFilt.SearchVal, StringComparison.InvariantCultureIgnoreCase) ||
|
||||
x.ExtItemCode.Contains(actFilt.SearchVal, StringComparison.InvariantCultureIgnoreCase) ||
|
||||
x.SupplCode.Contains(actFilt.SearchVal, StringComparison.InvariantCultureIgnoreCase))
|
||||
.ToList();
|
||||
}
|
||||
totalCount = AllRecords.Count;
|
||||
}
|
||||
|
||||
private async Task ResetEdit()
|
||||
{
|
||||
// reset edit
|
||||
editRecord = null;
|
||||
await ReloadData();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Filtro e paginazione
|
||||
/// </summary>
|
||||
private void UpdateTable()
|
||||
{
|
||||
// fix paginazione
|
||||
ListRecords = AllRecords
|
||||
.Skip(numRecord * (currPage - 1))
|
||||
.Take(numRecord)
|
||||
.ToList();
|
||||
isLoading = false;
|
||||
}
|
||||
|
||||
#endregion Private Methods
|
||||
}
|
||||
}
|
||||
@@ -43,82 +43,6 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
@if (isLoading || ListRecords == null)
|
||||
{
|
||||
<LoadingData></LoadingData>
|
||||
}
|
||||
else if (totalCount == 0)
|
||||
{
|
||||
<div class="alert alert-info text-center display-4">Nessun record trovato</div>
|
||||
}
|
||||
else
|
||||
{
|
||||
<table class="table table-sm table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>
|
||||
<button class="btn btn-sm btn-primary" title="Reset selezione" @onclick="DoReset"><i class="fa-solid fa-arrow-rotate-right"></i></button>
|
||||
</th>
|
||||
<th>ID</th>
|
||||
<th>Gruppo</th>
|
||||
<th>Tipo</th>
|
||||
<th>Serv</th>
|
||||
<th>Codice</th>
|
||||
<th>ItemCode</th>
|
||||
<th>Suppl.Code</th>
|
||||
<th>Descrizione</th>
|
||||
<th class="text-end">Costo</th>
|
||||
<th class="text-end">Margine</th>
|
||||
<th class="text-end">Qty min</th>
|
||||
<th class="text-end">Qty Max</th>
|
||||
<th class="text-end">UM</th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach (var item in ListRecords)
|
||||
{
|
||||
<tr>
|
||||
<td>
|
||||
<button class="btn btn-sm btn-primary" @onclick="() => DoSelect(item)"><i class="fa-solid fa-magnifying-glass"></i></button>
|
||||
<button class="btn btn-sm btn-info" @onclick="() => DoEdit(item)"><i class="fa-solid fa-pencil"></i></button>
|
||||
</td>
|
||||
<td>@item.ItemID</td>
|
||||
<td>@item.CodGroup</td>
|
||||
<td>@item.ItemType</td>
|
||||
<td>@item.IsService</td>
|
||||
<td>@item.ItemCode</td>
|
||||
<td>@item.ExtItemCode</td>
|
||||
<td>@item.SupplCode</td>
|
||||
<td>@item.Description</td>
|
||||
<td>@item.Cost.ToString("C3")</td>
|
||||
<td>@item.Margin.ToString("P1")</td>
|
||||
<td>@item.QtyMin.ToString("F1")</td>
|
||||
<td>@item.QtyMax.ToString("F1")</td>
|
||||
<td>@item.UM</td>
|
||||
<td>
|
||||
@if (item.ItemType != Enums.ItemClassType.Bom)
|
||||
{
|
||||
<button class="btn btn-sm btn-danger" @onclick="() => DoDelete(item)"><i class="fa-solid fa-trash-can"></i></button>
|
||||
}
|
||||
else
|
||||
{
|
||||
<button class="btn btn-sm btn-secondary disabled"><i class="fa-solid fa-trash-can"></i></button>
|
||||
|
||||
}
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<td colspan="15">
|
||||
<EgwCoreLib.Razor.DataPager currPage="@currPage" PageSize="@numRecord" totalCount="@totalCount" numPageChanged="SavePage" numRecordChanged="SaveNumRec"></EgwCoreLib.Razor.DataPager>
|
||||
</td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
}
|
||||
<ItemMan SelFilt="CurrFilt" ListItemGroup="ListItemGroup"></ItemMan>
|
||||
</div>
|
||||
</div>
|
||||
@@ -1,5 +1,6 @@
|
||||
using EgwCoreLib.Lux.Data.DbModel;
|
||||
using EgwCoreLib.Lux.Data.Services;
|
||||
using Lux.UI.Components.Compo;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using Microsoft.JSInterop;
|
||||
|
||||
@@ -9,73 +10,55 @@ namespace Lux.UI.Components.Pages
|
||||
{
|
||||
#region Protected Fields
|
||||
|
||||
protected List<ItemModel> AllRecords = new List<ItemModel>();
|
||||
protected List<ItemGroupModel> ListItemGroup = new List<ItemGroupModel>();
|
||||
protected List<ItemModel> ListRecords = new List<ItemModel>();
|
||||
|
||||
#endregion Protected Fields
|
||||
|
||||
#region Protected Properties
|
||||
|
||||
protected ItemMan.FiltSelect CurrFilt { get; set; } = new ItemMan.FiltSelect();
|
||||
|
||||
[Inject]
|
||||
protected DataLayerServices DLService { get; set; } = null!;
|
||||
|
||||
[Inject]
|
||||
protected IJSRuntime JSRuntime { get; set; } = null!;
|
||||
|
||||
protected string SearchVal
|
||||
{
|
||||
get => searchVal;
|
||||
get => CurrFilt.SearchVal;
|
||||
set
|
||||
{
|
||||
if (searchVal != value)
|
||||
isLoading = true;
|
||||
CurrFilt.SearchVal = value;
|
||||
isLoading = false;
|
||||
if (CurrFilt.SearchVal != value)
|
||||
{
|
||||
searchVal = value;
|
||||
currPage = 1;
|
||||
var pUpd = Task.Run(async () =>
|
||||
{
|
||||
await ReloadData();
|
||||
UpdateTable();
|
||||
});
|
||||
pUpd.Wait();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected string SelCodGroup
|
||||
{
|
||||
get => selCodGroup;
|
||||
get => CurrFilt.SelCodGroup;
|
||||
set
|
||||
{
|
||||
if (selCodGroup != value)
|
||||
if (CurrFilt.SelCodGroup != value)
|
||||
{
|
||||
selCodGroup = value;
|
||||
currPage = 1;
|
||||
var pUpd = Task.Run(async () =>
|
||||
{
|
||||
await ReloadData();
|
||||
UpdateTable();
|
||||
});
|
||||
pUpd.Wait();
|
||||
isLoading = true;
|
||||
CurrFilt.SelCodGroup = value;
|
||||
isLoading = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected EgwCoreLib.Lux.Core.Enums.ItemClassType SelType
|
||||
{
|
||||
get => selType;
|
||||
get => CurrFilt.SelType;
|
||||
set
|
||||
{
|
||||
if (selType != value)
|
||||
if (CurrFilt.SelType != value)
|
||||
{
|
||||
selType = value;
|
||||
currPage = 1;
|
||||
var pUpd = Task.Run(async () =>
|
||||
{
|
||||
await ReloadData();
|
||||
UpdateTable();
|
||||
});
|
||||
pUpd.Wait();
|
||||
isLoading = true;
|
||||
CurrFilt.SelType = value;
|
||||
isLoading = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -86,7 +69,7 @@ namespace Lux.UI.Components.Pages
|
||||
|
||||
protected void DoAdd()
|
||||
{
|
||||
EditRecord = new ItemModel()
|
||||
editRecord = new ItemModel()
|
||||
{
|
||||
CodGroup = ListItemGroup.FirstOrDefault()?.CodGroup ?? "",
|
||||
ItemType = EgwCoreLib.Lux.Core.Enums.ItemClassType.ND,
|
||||
@@ -103,44 +86,14 @@ namespace Lux.UI.Components.Pages
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// impossta record x eliminazione
|
||||
/// </summary>
|
||||
/// <param name="selRec"></param>
|
||||
protected async Task DoDelete(ItemModel selRec)
|
||||
{
|
||||
if (!await JSRuntime.InvokeAsync<bool>("confirm", $"Sicuro di voler eliminare il record? Dettagli: {selRec.ItemID} | {selRec.CodGroup} | {selRec.ItemType} | {selRec.ExtItemCode}"))
|
||||
return;
|
||||
//// esegue eliminazione del record...
|
||||
//await DLService.ItemDeleteAsync(selRec);
|
||||
|
||||
EditRecord = null;
|
||||
SelRecord = null;
|
||||
await ReloadData();
|
||||
UpdateTable();
|
||||
}
|
||||
|
||||
protected void DoEdit(ItemModel curRec)
|
||||
{
|
||||
EditRecord = curRec;
|
||||
}
|
||||
|
||||
protected void DoReset()
|
||||
{
|
||||
EditRecord = null;
|
||||
}
|
||||
|
||||
protected void DoSelect(ItemModel curRec)
|
||||
{
|
||||
SelRecord = curRec;
|
||||
}
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
isLoading = true;
|
||||
await ReloadBaseData();
|
||||
#if false
|
||||
await ReloadData();
|
||||
UpdateTable();
|
||||
#endif
|
||||
}
|
||||
|
||||
protected void ResetSearch()
|
||||
@@ -148,31 +101,12 @@ namespace Lux.UI.Components.Pages
|
||||
SearchVal = "";
|
||||
}
|
||||
|
||||
protected void SaveNumRec(int newNum)
|
||||
{
|
||||
numRecord = newNum;
|
||||
UpdateTable();
|
||||
}
|
||||
|
||||
protected void SavePage(int newNum)
|
||||
{
|
||||
currPage = newNum;
|
||||
UpdateTable();
|
||||
}
|
||||
|
||||
#endregion Protected Methods
|
||||
|
||||
#region Private Fields
|
||||
|
||||
private int currPage = 1;
|
||||
private ItemModel? EditRecord = null;
|
||||
private ItemModel? editRecord = null;
|
||||
private bool isLoading = false;
|
||||
private int numRecord = 10;
|
||||
private string searchVal = "";
|
||||
private string selCodGroup = "";
|
||||
private ItemModel? SelRecord = null;
|
||||
private EgwCoreLib.Lux.Core.Enums.ItemClassType selType = EgwCoreLib.Lux.Core.Enums.ItemClassType.ND;
|
||||
private int totalCount = 0;
|
||||
|
||||
#endregion Private Fields
|
||||
|
||||
@@ -183,36 +117,6 @@ namespace Lux.UI.Components.Pages
|
||||
ListItemGroup = await DLService.ItemGroupGetAllAsync();
|
||||
}
|
||||
|
||||
private async Task ReloadData()
|
||||
{
|
||||
isLoading = true;
|
||||
AllRecords = await DLService.ItemGetFiltAsync(SelCodGroup, SelType);
|
||||
// se ho ricerca testuale faccio filtro ulteriore...
|
||||
if (!string.IsNullOrEmpty(SearchVal))
|
||||
{
|
||||
AllRecords = AllRecords
|
||||
.Where(x =>
|
||||
x.Description.Contains(searchVal, StringComparison.InvariantCultureIgnoreCase) ||
|
||||
x.ExtItemCode.Contains(searchVal, StringComparison.InvariantCultureIgnoreCase) ||
|
||||
x.SupplCode.Contains(searchVal, StringComparison.InvariantCultureIgnoreCase))
|
||||
.ToList();
|
||||
}
|
||||
totalCount = AllRecords.Count;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Filtro e paginazione
|
||||
/// </summary>
|
||||
private void UpdateTable()
|
||||
{
|
||||
// fix paginazione
|
||||
ListRecords = AllRecords
|
||||
.Skip(numRecord * (currPage - 1))
|
||||
.Take(numRecord)
|
||||
.ToList();
|
||||
isLoading = false;
|
||||
}
|
||||
|
||||
#endregion Private Methods
|
||||
}
|
||||
}
|
||||
@@ -5,7 +5,7 @@
|
||||
<Nullable>enable</Nullable>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<UserSecretsId>aspnet-Lux.UI-a758c101-a2f4-4e38-977d-1c4887dbbd50</UserSecretsId>
|
||||
<Version>0.9.2508.0910</Version>
|
||||
<Version>0.9.2509.0416</Version>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
@@ -17,7 +17,7 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Egw.Lux.WebWindowConfigurator" Version="2.7.8.809" />
|
||||
<PackageReference Include="Egw.Lux.WebWindowConfigurator" Version="2.7.9.415" />
|
||||
<PackageReference Include="EgwCoreLib.Razor" Version="1.5.2507.1815" />
|
||||
<PackageReference Include="EgwCoreLib.Utils" Version="1.5.2507.1815" />
|
||||
<PackageReference Include="EgwMultiEngineManager.Data" Version="2.7.8.5" />
|
||||
|
||||
@@ -10,6 +10,12 @@ Progetto per la realizzazione del "MES dei Falegnami"; che deve gestire il flus
|
||||
- [ ] Completare la documentazione
|
||||
- [ ] Setup repo agli sviluppatori
|
||||
- [ ] Definizione struttura progetti
|
||||
- [ ] gestione articoli e gruppi (legno/vetro/ferramenta/vernici) con sottocategorie
|
||||
- [ ] elenco tipi legno
|
||||
- [ ] elenco tipi vetro
|
||||
- [ ] gestione listini alternativi x fornitori diversi (es preso = costoso, economico ma a lungo periodo)
|
||||
- [ ] gli item BOM-ALT vanno definiti a aprtire da un item BOM da configuratore/calcolo engine
|
||||
- [ ] gestione ricalcolo preventivo da cambio materiale BOM mantenendo coerenza del BOM parent
|
||||
|
||||
## Elementi della soluzione - Entità gestite
|
||||
|
||||
|
||||
BIN
Binary file not shown.
@@ -1,6 +1,6 @@
|
||||
<body>
|
||||
<i>LUX - Web Windows MES</i>
|
||||
<h4>Versione: 0.9.2508.0910</h4>
|
||||
<h4>Versione: 0.9.2509.0416</h4>
|
||||
<br /> Note di rilascio:
|
||||
<ul>
|
||||
<li>
|
||||
|
||||
@@ -1 +1 @@
|
||||
0.9.2508.0910
|
||||
0.9.2509.0416
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<item>
|
||||
<version>0.9.2508.0910</version>
|
||||
<version>0.9.2509.0416</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