Update pag fixODL
This commit is contained in:
@@ -8,14 +8,65 @@
|
||||
</div>
|
||||
<div class="col-12">
|
||||
<h4>Ultimi ODL lavorati:</h4>
|
||||
...tabella...
|
||||
<table class="table table-dark table-sm table-striped">
|
||||
<thead>
|
||||
<tr class="text-start1">
|
||||
<th>ODL / Articolo</th>
|
||||
<th class="text-end"># Pezzi</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach (var item in ListPaged)
|
||||
{
|
||||
<tr>
|
||||
<td>
|
||||
<div class="d-flex justify-content-between fw-bold">
|
||||
<div class="px-1">
|
||||
@item.IdxOdl
|
||||
</div>
|
||||
<div class="px-1">
|
||||
@item.CodArticolo
|
||||
</div>
|
||||
</div>
|
||||
<div class="d-flex justify-content-between small">
|
||||
<div class="px-1">
|
||||
@($"{item.DataInizio:yyyy.MM.dd HH:mm:ss}")
|
||||
</div>
|
||||
<div class="px-1">
|
||||
<i class="fa-solid fa-arrow-right"></i>
|
||||
</div>
|
||||
<div class="px-1">
|
||||
@($"{item.DataFine:yyyy.MM.dd HH:mm:ss}")
|
||||
</div>
|
||||
</div>
|
||||
@if (!string.IsNullOrEmpty(item.Note))
|
||||
{
|
||||
<div class="small text-secondary">
|
||||
@item.Note
|
||||
</div>
|
||||
}
|
||||
</td>
|
||||
<td class="text-end">
|
||||
<div>
|
||||
@item.NumPezzi.ToString("N0")
|
||||
</div>
|
||||
<div class="small">
|
||||
TC: @item.Tcassegnato.ToString("N2") | pz/pallet: @item.PzPallet
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
<EgwCoreLib.Razor.DataPager currPage="@PageNum" PageSize="@NumRecPage" totalCount="@TotalCount" numPageChanged="SavePage" numRecordChanged="SaveNumRec"></EgwCoreLib.Razor.DataPager>
|
||||
|
||||
</div>
|
||||
<div class="col-8">
|
||||
<div class="input-group input-group-lg">
|
||||
<input type="text" class="form-control w-25" placeholder="Cerca" aria-label="Cerca">
|
||||
<select class="form-select w-50" @bind="IdxOdlSel">
|
||||
@* <option disabled>Selezionare P.ODL</option> *@
|
||||
@foreach (var item in ListODL)
|
||||
@foreach (var item in ListSelODL)
|
||||
{
|
||||
<option value="@item.value">@item.label</option>
|
||||
}
|
||||
@@ -29,7 +80,10 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-4">
|
||||
<button calss="btn btn-lg btn-warning"><i class="fa-solid fa-plus"></i> Imposta ODL</button>
|
||||
@if (IdxOdlSel > 0)
|
||||
{
|
||||
<button class="btn btn-lg btn-warning w-100" @onclick="() => setupOdl()"><i class="fa-solid fa-plus"></i> Imposta ODL</button>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
|
||||
@@ -9,13 +9,13 @@ namespace MP_TAB_SERV.Components
|
||||
#region Public Properties
|
||||
|
||||
[Parameter]
|
||||
public string IdxMaccPar { get; set; } = "";
|
||||
public string IdxMaccCurr { get; set; } = "";
|
||||
|
||||
#endregion Public Properties
|
||||
|
||||
#region Protected Properties
|
||||
|
||||
protected List<vSelOdlModel> ListODL { get; set; } = new List<vSelOdlModel>();
|
||||
private List<vSelOdlModel> ListSelODL { get; set; } = new List<vSelOdlModel>();
|
||||
|
||||
protected bool ShowAll
|
||||
{
|
||||
@@ -25,6 +25,7 @@ namespace MP_TAB_SERV.Components
|
||||
if (showAll != value)
|
||||
{
|
||||
showAll = value;
|
||||
IdxOdlSel = 0;
|
||||
var pUpd = Task.Run(async () =>
|
||||
{
|
||||
await ReloadData();
|
||||
@@ -72,29 +73,56 @@ namespace MP_TAB_SERV.Components
|
||||
|
||||
private async Task ReloadData()
|
||||
{
|
||||
if (!string.IsNullOrEmpty(IdxMaccPar))
|
||||
if (!string.IsNullOrEmpty(IdxMaccCurr))
|
||||
{
|
||||
ListODL = await TabDServ.VSOdlGetUnused(IdxMaccPar, ShowAll, numDayOdl);
|
||||
ListSelODL = await TabDServ.VSOdlGetUnused(IdxMaccCurr, ShowAll, numDayOdl);
|
||||
DateTime dateTo = DateTime.Today.AddDays(1);
|
||||
DateTime dateFrom = dateTo.AddMonths(-1);
|
||||
ListComplete = await TabDServ.OdlListByMacc(IdxMaccCurr, dateFrom, dateTo);
|
||||
TotalCount = ListComplete.Count;
|
||||
// esegue paginazione
|
||||
UpdateTable();
|
||||
}
|
||||
}
|
||||
protected int IdxOdlSel
|
||||
protected void UpdateTable()
|
||||
{
|
||||
get => idxOdlSel;
|
||||
set
|
||||
// esegue paginazione
|
||||
if (TotalCount > NumRecPage)
|
||||
{
|
||||
if (idxOdlSel != value)
|
||||
{
|
||||
idxOdlSel = value;
|
||||
//var pUpd = Task.Run(async () =>
|
||||
//{
|
||||
// await ReloadData(true);
|
||||
//});
|
||||
//pUpd.Wait();
|
||||
}
|
||||
ListPaged = ListComplete.Skip((PageNum - 1) * NumRecPage).Take(NumRecPage).ToList();
|
||||
}
|
||||
else
|
||||
{
|
||||
ListPaged = ListComplete;
|
||||
}
|
||||
}
|
||||
protected void SaveNumRec(int newNum)
|
||||
{
|
||||
NumRecPage = newNum;
|
||||
UpdateTable();
|
||||
}
|
||||
|
||||
private int idxOdlSel { get; set; } = 0;
|
||||
protected void SavePage(int newNum)
|
||||
{
|
||||
PageNum = newNum;
|
||||
UpdateTable();
|
||||
}
|
||||
|
||||
protected async Task setupOdl()
|
||||
{
|
||||
await Task.Delay(1);
|
||||
}
|
||||
|
||||
|
||||
protected List<ODLModel> ListComplete { get; set; } = new List<ODLModel>();
|
||||
|
||||
protected List<ODLModel> ListPaged { get; set; } = new List<ODLModel>();
|
||||
protected int NumRecPage = 5;
|
||||
protected int PageNum = 1;
|
||||
protected int TotalCount = 0;
|
||||
|
||||
|
||||
private int IdxOdlSel { get; set; } = 0;
|
||||
#endregion Private Methods
|
||||
}
|
||||
}
|
||||
@@ -12,7 +12,7 @@
|
||||
@if (!odlOk)
|
||||
{
|
||||
<div class="col-12">
|
||||
<FixOdl IdxMaccPar="@IdxMaccParent"></FixOdl>
|
||||
<FixOdl IdxMaccCurr="@IdxMaccParent"></FixOdl>
|
||||
</div>
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<Version>6.16.2311.616</Version>
|
||||
<Version>6.16.2311.618</Version>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<RootNamespace>MP_TAB_SERV</RootNamespace>
|
||||
</PropertyGroup>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<body>
|
||||
<i>Modulo MAPOSPEC </i>
|
||||
<h4>Versione: 6.16.2311.616</h4>
|
||||
<h4>Versione: 6.16.2311.618</h4>
|
||||
<br /> Note di rilascio:
|
||||
<ul>
|
||||
<li>
|
||||
|
||||
@@ -1 +1 @@
|
||||
6.16.2311.616
|
||||
6.16.2311.618
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<item>
|
||||
<version>6.16.2311.616</version>
|
||||
<version>6.16.2311.618</version>
|
||||
<url>https://nexus.steamware.net/repository/SWS/MP-TAB-SERV/stable/LAST/MP-TAB-SERV.zip</url>
|
||||
<changelog>https://nexus.steamware.net/repository/SWS/MP-TAB-SERV/stable/LAST/ChangeLog.html</changelog>
|
||||
<mandatory>false</mandatory>
|
||||
|
||||
@@ -737,6 +737,37 @@ namespace MP.Data.Controllers
|
||||
return fatto;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Elenco ODL data macchina e periodo
|
||||
/// </summary>
|
||||
/// <param name="idxMacchina"></param>
|
||||
/// <param name="dtStart"></param>
|
||||
/// <param name="dtEnd"></param>
|
||||
/// <returns></returns>
|
||||
public List<ODLModel> OdlListByMacc(string idxMacchina, DateTime dtStart, DateTime dtEnd)
|
||||
{
|
||||
List<ODLModel> dbResult = new List<ODLModel>();
|
||||
using (var dbCtx = new MoonProContext(_configuration))
|
||||
{
|
||||
try
|
||||
{
|
||||
var IdxMacchina = new SqlParameter("@IdxMacchina", idxMacchina);
|
||||
var DataFrom = new SqlParameter("@dataFrom", dtStart);
|
||||
var DataTo = new SqlParameter("@dataTo", dtEnd);
|
||||
dbResult = dbCtx
|
||||
.DbSetODL
|
||||
.FromSqlRaw("EXEC stp_ODL_getByMacchinaPeriodo @IdxMacchina, @dataFrom, @dataTo", IdxMacchina, DataFrom, DataTo)
|
||||
.AsNoTracking()
|
||||
.ToList();
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Log.Error($"Eccezione durante ListOdlAll{Environment.NewLine}{exc}");
|
||||
}
|
||||
}
|
||||
return dbResult;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Stato prod macchina
|
||||
/// </summary>
|
||||
|
||||
@@ -1990,6 +1990,45 @@ namespace MP.Data.Services
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Elenco ODL data macchina e periodo
|
||||
/// </summary>
|
||||
/// <param name="idxMacchina"></param>
|
||||
/// <param name="dtStart"></param>
|
||||
/// <param name="dtEnd"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<List<ODLModel>> OdlListByMacc(string idxMacchina, DateTime dtStart, DateTime dtEnd)
|
||||
{
|
||||
string source = "DB";
|
||||
Stopwatch sw = new Stopwatch();
|
||||
sw.Start();
|
||||
List<ODLModel>? result = new List<ODLModel>();
|
||||
// cerco in redis...
|
||||
string currKey = $"{redisBaseKey}:ODL:{idxMacchina}:{dtStart:yyyyMMdd-HHmmss}:{dtEnd:yyyyMMdd-HHmmss}";
|
||||
RedisValue rawData = await redisDb.StringGetAsync(currKey);
|
||||
if (rawData.HasValue)
|
||||
{
|
||||
result = JsonConvert.DeserializeObject<List<ODLModel>>($"{rawData}");
|
||||
source = "REDIS";
|
||||
}
|
||||
else
|
||||
{
|
||||
result = await Task.FromResult(dbTabController.OdlListByMacc(idxMacchina, dtStart, dtEnd));
|
||||
// riordino
|
||||
result = result.OrderByDescending(x => x.DataInizio).ToList();
|
||||
// serializzp e salvo...
|
||||
rawData = JsonConvert.SerializeObject(result);
|
||||
await redisDb.StringSetAsync(currKey, rawData, UltraLongCache);
|
||||
}
|
||||
if (result == null)
|
||||
{
|
||||
result = new List<ODLModel>();
|
||||
}
|
||||
sw.Stop();
|
||||
Log.Debug($"OdlListByMacc | {source} | {sw.Elapsed.TotalMilliseconds}ms");
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Elenco ultimi ODL x macchina
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user