Update gestioen spezzoni

- fix calcolo qta
- fix display
- fix stored ricerca
This commit is contained in:
Samuele Locatelli
2024-08-02 09:10:25 +02:00
parent 5b1a067fc3
commit b0804c78e7
13 changed files with 69 additions and 31 deletions
@@ -704,8 +704,9 @@ namespace MagMan.Data.Tenant.Controllers
/// </summary>
/// <param name="connString">Stringa connessione (variabile x cliente)</param>
/// <param name="withChild">Se true allora include record child (Items)</param>
/// <param name="withRemn">Se true allora include record remnants (Items) nei conteggi qty</param>
/// <returns></returns>
public List<MaterialDTO> MaterialDtoGetAll(string connString, bool withChild)
public List<MaterialDTO> MaterialDtoGetAll(string connString, bool withChild, bool withRemn)
{
List<MaterialDTO> dbResult = new List<MaterialDTO>();
using (MagManContext dbCtx = new MagManContext(connString))
@@ -725,7 +726,7 @@ namespace MagMan.Data.Tenant.Controllers
LMm = x.LMm,
WMm = x.WMm,
SizeNum = x.RawItemList == null ? 0 : x.RawItemList.Where(x => x.IsActive).Count(),
QtyTot = x.RawItemList == null ? 0 : calcQty(x.IsBeam, x.RawItemList.Where(x => x.IsActive).ToList()),
QtyTot = x.RawItemList == null ? 0 : calcQty(x.IsBeam, x.RawItemList.Where(x => x.IsActive && (withRemn || !x.IsRemn)).ToList()),
MatDtmx = x.MatDtmx,
IsBeam = x.IsBeam,
IsWall = x.IsWall,
+6 -4
View File
@@ -679,16 +679,18 @@ namespace MagMan.Data.Tenant.Services
/// </summary>
/// <param name="nKey">Key di riferimento</param>
/// <param name="withChild">Se true allora include record child (Items)</param>
/// <param name="withRemn">Se true allora include record remnants (Items) nei conteggi qty</param>
/// <returns></returns>
public async Task<List<MaterialDTO>> MaterialDtoGetAll(int nKey, bool withChild)
public async Task<List<MaterialDTO>> MaterialDtoGetAll(int nKey, bool withChild, bool withRemn)
{
string source = "DB";
string cString = ConnString(nKey);
List<MaterialDTO>? dbResult = new List<MaterialDTO>();
try
{
string dType = withChild ? "MaterialsDtoFull" : "MaterialsDto";
string currKey = $"{Const.rKeyConfig}:{nKey}:{dType}";
string dType = withChild ? "MatDtoFull" : "MatDto";
string remn = withRemn ? "All" : "Buy";
string currKey = $"{Const.rKeyConfig}:{nKey}:{remn}:{dType}";
Stopwatch stopWatch = new Stopwatch();
stopWatch.Start();
string? rawData = await redisDb.StringGetAsync(currKey);
@@ -707,7 +709,7 @@ namespace MagMan.Data.Tenant.Services
}
else
{
dbResult = dbController.MaterialDtoGetAll(cString, withChild);
dbResult = dbController.MaterialDtoGetAll(cString, withChild, withRemn);
rawData = JsonConvert.SerializeObject(dbResult, JSSettings);
await redisDb.StringSetAsync(currKey, rawData, LongCache);
// per evitare loopback uso deserialize...
+2 -2
View File
@@ -73,11 +73,11 @@ namespace MagMan.UI.Components
protected async Task ReloadData()
{
// rileggo TUTTI i materiali
AllMaterials = await TService.MaterialDtoGetAll(KeyNum, false);
AllMaterials = await TService.MaterialDtoGetAll(KeyNum, false, false);
// proietto elenco alias ammissibili
ListAliasTarget = AllMaterials
.GroupBy(x => x.MatCode)
.Select(grp=> grp.First())
.Select(grp => grp.First())
.OrderBy(x => x.MatCode)
.Select(x => x.MatCode)
.ToList();
+6 -6
View File
@@ -25,6 +25,12 @@ namespace MagMan.UI.Components
[Inject]
protected MessageService AppMService { get; set; } = null!;
protected bool IsAcquisto
{
get => !(CurrRecord!.IsRemn);
set => CurrRecord!.IsRemn = !value;
}
[Inject]
protected TenantService TService { get; set; } = null!;
@@ -51,12 +57,6 @@ namespace MagMan.UI.Components
}
}
protected bool IsAcquisto
{
get => !(CurrRecord!.IsRemn);
set => CurrRecord!.IsRemn = !value;
}
#endregion Protected Methods
#region Private Properties
+8 -8
View File
@@ -55,10 +55,6 @@ namespace MagMan.UI.Components
{
get => onlyActive ? "Solo Attivi" : "Mostra Eliminati";
}
protected string remnMessage
{
get => "Mostra Spezzoni";// showRemn ? "Mostra Spezzoni" : "Solo Acquisto";
}
[Inject]
protected MessageService AppMService { get; set; } = null!;
@@ -86,6 +82,12 @@ namespace MagMan.UI.Components
}
}
}
protected string remnMessage
{
get => "Mostra Spezzoni";// showRemn ? "Mostra Spezzoni" : "Solo Acquisto";
}
protected bool ShowRemn
{
get => showRemn;
@@ -126,6 +128,7 @@ namespace MagMan.UI.Components
}
return answ;
}
protected async Task CreateNew()
{
string matNote = $"{MaterialSel.MatCode.Replace("_", " ")}";
@@ -262,12 +265,9 @@ namespace MagMan.UI.Components
private List<RawItemModel>? ListRecords = null;
private bool onlyActive = true;
private bool showRemn = false;
private int RawItemId = 0;
private List<RawItemModel>? SearchRecords = null;
private bool showRemn = false;
private bool sortAsc = true;
private string sortField = "";
+1 -1
View File
@@ -59,7 +59,7 @@ namespace MagMan.UI.Components
if (!IsEditRec)
{
// verifico SE esista già un materiale uguale x dimensioni / tipo...
var matList = await TService.MaterialDtoGetAll(KeyNum, false);
var matList = await TService.MaterialDtoGetAll(KeyNum, false, false);
if (CurrRecord != null)
{
var sameRec = matList
+11 -1
View File
@@ -2,7 +2,17 @@
<div class="card-header">
<div class="d-flex justify-content-between">
<div class="px-2">
<h3>Materiali</h3>
<div class="d-flex">
<div class="px-0">
<h3>Materiali</h3>
</div>
<div class="px-2">
<div class="form-check form-switch">
<input class="form-check-input" type="checkbox" role="switch" @bind="ShowRemn">
<label class="form-check-label">@remnMessage</label>
</div>
</div>
</div>
</div>
<div class="px-2">
<div class="d-flex">
+26 -1
View File
@@ -50,6 +50,30 @@ namespace MagMan.UI.Components
[Inject]
protected IJSRuntime JSRuntime { get; set; } = null!;
protected string remnMessage
{
get => showRemn ? "Acquisto + Spezzoni" : "Solo Acquisto";
//get => "Spezzoni";// showRemn ? "Mostra Spezzoni" : "Solo Acquisto";
}
protected bool ShowRemn
{
get => showRemn;
set
{
if (showRemn != value)
{
showRemn = value;
DoSelect(null);
var pUpd = Task.Run(async () =>
{
await ForceReload(true);
});
pUpd.Wait();
}
}
}
protected int totalCount { get; set; } = 0;
[Inject]
@@ -176,6 +200,7 @@ namespace MagMan.UI.Components
private List<MaterialDTO>? ListRecords = null;
private int MaterialId = 0;
private List<MaterialDTO>? SearchRecords = null;
private bool showRemn = false;
private bool sortAsc = true;
private string sortField = "";
@@ -247,7 +272,7 @@ namespace MagMan.UI.Components
{
isLoading = true;
ListRecords = null;
SearchRecords = await TService.MaterialDtoGetAll(KeyNum, false);
SearchRecords = await TService.MaterialDtoGetAll(KeyNum, false, showRemn);
// verifico se filtrare x beam/wall
if (FiltType > 0)
{
+2 -2
View File
@@ -61,10 +61,10 @@ namespace MagMan.UI.Controllers
/// <summary>
/// Elenco Materiali dato RestToken
/// GET api/Materials/00000000-0000-0000-0000-000000000000
/// </summary>
/// <param name="id">Rest Token cliente</param>
/// <returns></returns>
// GET api/Materials/00000000-0000-0000-0000-000000000000
[HttpGet("{id}")]
public async Task<List<MaterialDTO>> Get(string id)
{
@@ -72,7 +72,7 @@ namespace MagMan.UI.Controllers
// in primis recupero codice chiave da token...
int nKey = await MTAdmService.MainKeyByToken(id);
// ora recupero direttamente i materiali
ListDto = await TService.MaterialDtoGetAll(nKey, false);
ListDto = await TService.MaterialDtoGetAll(nKey, false, true);
return ListDto;
}
+1 -1
View File
@@ -2,7 +2,7 @@
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<Version>1.0.2408.0208</Version>
<Version>1.0.2408.0209</Version>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<EnableNETAnalyzers>true</EnableNETAnalyzers>
+1 -1
View File
@@ -1,6 +1,6 @@
<body>
<i>MagMan - Wood Warehouse Management System</i>
<h4>Versione: 1.0.2408.0208</h4>
<h4>Versione: 1.0.2408.0209</h4>
<br /> Note di rilascio:
<ul>
<li>
+1 -1
View File
@@ -1 +1 @@
1.0.2408.0208
1.0.2408.0209
+1 -1
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<item>
<version>1.0.2408.0208</version>
<version>1.0.2408.0209</version>
<url>http://nexus.steamware.net/repository/SWS/MagMan/stable/0/MagMan.UI.zip</url>
<changelog>http://nexus.steamware.net/repository/SWS/MagMan/stable/0/ChangeLog.html</changelog>
<mandatory>false</mandatory>