Merge branch 'FeatureregGiacenzeStart' into develop

This commit is contained in:
zaccaria.majid
2022-11-29 13:13:10 +01:00
11 changed files with 246 additions and 6 deletions
+25
View File
@@ -329,6 +329,31 @@ namespace MP.Data.Controllers
return answ;
}
/// <summary>
/// Elenco giacenze
/// </summary>
/// <param name="currRec">record dossier da eliminare</param>
/// <returns></returns>
public List<AnagGiacenzeModel> ListGiacenze(int IdxOdl)
{
List<AnagGiacenzeModel> dbResult = new List<AnagGiacenzeModel>();
using (var dbCtx = new MoonPro_InveContext(_configuration))
{
try
{
dbResult = dbCtx
.DbGiacenzeData
.AsNoTracking()
.Where(x => x.IdxOdl == IdxOdl).ToList();
}
catch (Exception exc)
{
Log.Error($"Eccezione durante ListGiacenze{Environment.NewLine}{exc}");
}
}
return dbResult;
}
/// <summary>
/// Elenco ultimi n record DOssiers (che contengono ad esempio "salvataggi" di FLuxLog) dato
/// macchina (ordinato x data registrazione)
@@ -0,0 +1,31 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
// <Auto-Generated>
// This is here so CodeMaid doesn't reorganize this document
// </Auto-Generated>
namespace MP.Data.DatabaseModels
{
[Table("RegGiacenze")]
public class AnagGiacenzeModel
{
[Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int IdxRG { get; set; } = 0;
public int IdxOdl { get; set; } = 0;
public string IdentRG { get; set; } = "";
public string Product { get; set; } = "";
public string Variety { get; set; } = "";
public string Supplier { get; set; } = "";
public string ExtDoc { get; set; } = "";
public DateTime DateRif { get; set; }
public double QtyTot { get; set; } = 0;
public int NumPack { get; set; } = 0;
public string Notes { get; set; } = "";
}
}
+9
View File
@@ -45,11 +45,20 @@ namespace MP.Data
#region Public Properties
#region PER INVE
public virtual DbSet<AnagMagModel> DbAnagMag { get; set; }
public virtual DbSet<InventorySessionModel> DbInveSess { get; set; }
public virtual DbSet<ScanDataModel> DbScanData { get; set; }
public virtual DbSet<AnagUdcModel> DbUdcData { get; set; }
public virtual DbSet<AnagLottoModel> DbLottoData { get; set; }
#endregion PER INVE
#region PER SPEC
public virtual DbSet<AnagGiacenzeModel> DbGiacenzeData { get; set; }
#endregion PER SPEC
#endregion Public Properties
+11 -2
View File
@@ -245,13 +245,22 @@ else
</td>
<td>
@record.IdxMacchina
@*<div class="small textConsensed text-secondary">@record.MachineNav.Descrizione</div>*@
</td>
<td>
@record.DtRif
</td>
<td>
@record.IdxODL
<div>
<div>
@record.IdxODL
</div>
@if (record.IdxODL > 0)
{
<div>
<span class="badge bg-primary textConsensed"><a href="Giacenze?IdxOdl=@record.IdxODL" target="_blank" class="text-light text-decoration-none">APRI GIACENZE</a></span>
</div>
}
</div>
</td>
<td>
@if (isEditing == false)
+36
View File
@@ -734,6 +734,41 @@ namespace MP.SPEC.Data
Log.Debug($"ListPODLFilt | Read from {readType}: {ts.TotalMilliseconds}ms");
return result;
}
/// <summary>
/// Elenco PODL non avviati filtrati x articolo, KeyRich (che contiene stato)
/// </summary>
/// <param name="IdxOdl">Solo lanciati (1) o ancora disponibili (0)</param>
/// <returns></returns>
public async Task<List<AnagGiacenzeModel>> ListGiacenze(int IdxOdl)
{
List<AnagGiacenzeModel>? result = new List<AnagGiacenzeModel>();
Stopwatch stopWatch = new Stopwatch();
stopWatch.Start();
string readType = "DB";
string currKey = $"{redisGiacenzaList}:{IdxOdl}";
// cerco in redis dato valore sel macchina...
RedisValue rawData = redisDb.StringGet(currKey);
if (rawData.HasValue)
{
result = JsonConvert.DeserializeObject<List<AnagGiacenzeModel>>($"{rawData}");
readType = "REDIS";
}
else
{
result = await Task.FromResult(dbController.ListGiacenze(IdxOdl));
// serializzo e salvo...
rawData = JsonConvert.SerializeObject(result);
redisDb.StringSet(currKey, rawData, TimeSpan.FromSeconds(redisShortTimeCache));
}
if (result == null)
{
result = new List<AnagGiacenzeModel>();
}
stopWatch.Stop();
TimeSpan ts = stopWatch.Elapsed;
Log.Debug($"ListGiacenze | Read from {readType}: {ts.TotalMilliseconds}ms");
return result;
}
#if false
@@ -1264,6 +1299,7 @@ namespace MP.SPEC.Data
private const string redisPOdlByOdl = redisXdlData + ":POdlByOdl";
private const string redisPOdlByPOdl = redisXdlData + ":POdlByPOdl";
private const string redisPOdlList = redisXdlData + ":POdlList";
private const string redisGiacenzaList = redisBaseAddr + ":GiacenzaList";
private const string redisPOdlListNOOdl = redisXdlData + ":POdlListNOOdl";
private const string redisStatoCom = redisBaseAddr + "SPEC:Cache:StatoCom";
+1 -1
View File
@@ -5,7 +5,7 @@
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<RootNamespace>MP.SPEC</RootNamespace>
<Version>6.16.2211.2911</Version>
<Version>6.16.2211.2912</Version>
</PropertyGroup>
<ItemGroup>
+83
View File
@@ -0,0 +1,83 @@
@page "/Giacenze"
<div class="card">
<div class="card-header">
<h3>Giacenze</h3>
</div>
<div class="card-body">
<table class="table">
<thead>
<tr>
<th scope="col">IdxRG</th>
<th scope="col">IdxOdl</th>
<th scope="col">IdentRG</th>
<th scope="col">Product</th>
<th scope="col">Variety</th>
<th scope="col">Supplier</th>
<th scope="col">ExtDoc</th>
<th scope="col">DateRif</th>
<th scope="col">QtyTot</th>
<th scope="col">NumPack</th>
<th scope="col">Notes</th>
</tr>
</thead>
<tbody>
@if (elencoGiacenze != null)
{
@foreach (var item in elencoGiacenze)
{
<tr>
<td>
@item.IdxRG
</td>
<td>
@item.IdxOdl
</td>
<td>
@item.IdentRG
</td>
<td>
@item.Product
</td>
<td>
@item.Variety
</td>
<td>
@item.Supplier
</td>
<td>
@item.ExtDoc
</td>
<td>
@item.DateRif
</td>
<td>
@item.QtyTot
</td>
<td>
@item.NumPack
</td>
<td>
@item.Notes
</td>
</tr>
}
}
</tbody>
</table>
</div>
<div class="card-footer">
</div>
</div>
+47
View File
@@ -0,0 +1,47 @@
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 MP.SPEC;
using MP.SPEC.Shared;
using MP.SPEC.Components;
using MP.Data.DatabaseModels;
using MP.SPEC.Data;
using Microsoft.AspNetCore.WebUtilities;
namespace MP.SPEC.Pages
{
public partial class Giacenze
{
[Inject]
MpDataService MDService { get; set; } = null!;
[Inject]
NavigationManager NavManager { get; set; } = null!;
protected List<AnagGiacenzeModel>? elencoGiacenze;
protected int IdxOdl = 0;
protected override async Task OnInitializedAsync()
{
var uri = NavManager.ToAbsoluteUri(NavManager.Uri);
if (QueryHelpers.ParseQuery(uri.Query).TryGetValue("IdxOdl", out var _idxOdl))
{
IdxOdl = int.Parse(_idxOdl);
}
elencoGiacenze = await MDService.ListGiacenze(IdxOdl);
}
}
}
+1 -1
View File
@@ -1,6 +1,6 @@
<body>
<i>Modulo MAPOSPEC </i>
<h4>Versione: 6.16.2211.2911</h4>
<h4>Versione: 6.16.2211.2912</h4>
<br /> Note di rilascio:
<ul>
<li>
+1 -1
View File
@@ -1 +1 @@
6.16.2211.2911
6.16.2211.2912
+1 -1
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<item>
<version>6.16.2211.2911</version>
<version>6.16.2211.2912</version>
<url>https://nexus.steamware.net/repository/SWS/MP-SPEC/stable/LAST/MP.SPEC.zip</url>
<changelog>https://nexus.steamware.net/repository/SWS/MP-SPEC/stable/LAST/ChangeLog.html</changelog>
<mandatory>false</mandatory>