Fix selezione period e ODL x controlli

This commit is contained in:
Samuele Locatelli
2023-10-16 14:37:58 +02:00
parent 91324095c4
commit b2c9fac4ca
21 changed files with 303 additions and 41 deletions
+4 -1
View File
@@ -1,5 +1,6 @@
using global::Microsoft.AspNetCore.Components;
using Microsoft.JSInterop;
using MongoDB.Driver.Linq;
using MP.Data;
using MP.Data.DatabaseModels;
using MP.Data.Services;
@@ -97,7 +98,9 @@ namespace MP_TAB_SERV.Components
if (RecMSE != null)
{
IdxMaccSel = RecMSE.IdxMacchina;
CurrPeriodo = new Periodo(PeriodSet.ThisWeek);
DateTime fine = DateTime.Today.AddDays(1);
DateTime inizio = fine.AddDays(-8);
CurrPeriodo = new Periodo(inizio, fine);
await doUpdate();
}
var rawDest = config.GetValue<string>("AlarmDest");
+21 -1
View File
@@ -1,5 +1,25 @@
<EgwCoreLib.Razor.PeriodoSel CurrPeriodo="CurrPeriodo" E_PeriodoSel="SetPeriodo"></EgwCoreLib.Razor.PeriodoSel>
<MachSel RecMSE="RecMSE" E_MachSel="SetMacc"></MachSel>
<div class="row">
<div class="col-6">
<h2>Tipo Selezione</h2>
</div>
<div class="col-6">
<div class="form-check form-switch fs-3">
<input class="form-check-input" type="checkbox" @bind="@useOdl">
<label class="form-check-label">@selMessage</label>
</div>
</div>
</div>
@if (useOdl)
{
<MachineSelOdl IdxMacchina="@IdxMaccSel" E_OdlSel="SetOdl"></MachineSelOdl>
}
else
{
<EgwCoreLib.Razor.PeriodoSel CurrPeriodo="CurrPeriodo" E_PeriodoSel="SetPeriodo"></EgwCoreLib.Razor.PeriodoSel>
}
<ShowProcessing Message="Caricamento" IsProcessing="@isProcessing"></ShowProcessing>
<div class="card">
<div class="card-header bg-dark">
+20 -15
View File
@@ -27,7 +27,7 @@ namespace MP_TAB_SERV.Components
await Task.Delay(1);
if (!string.IsNullOrEmpty(IdxMaccSel))
{
ListComplete = await TabDServ.RegControlliFilt(IdxMaccSel, idxOdl, CurrPeriodo.Inizio, CurrPeriodo.Fine, false);
ListComplete = await TabDServ.RegControlliFilt(IdxMaccSel, IdxOdl, CurrPeriodo.Inizio, CurrPeriodo.Fine, false);
TotalCount = ListComplete.Count;
// esegue paginazione
UpdateTable();
@@ -38,18 +38,6 @@ namespace MP_TAB_SERV.Components
#endregion Public Methods
#region Protected Fields
protected int idxOdl = 0;
protected bool isProcessing = false;
protected string noteKo = "";
protected int NumRecPage = 10;
protected int PageNum = 1;
protected bool showNote = false;
protected int TotalCount = 0;
#endregion Protected Fields
#region Protected Properties
protected string ConfTitle
@@ -116,11 +104,21 @@ namespace MP_TAB_SERV.Components
protected async Task SetMacc(string selIdxMacc)
{
isProcessing = true;
await Task.Delay(10);
await Task.Delay(1);
IdxMaccSel = selIdxMacc;
await doUpdate();
isProcessing = false;
await Task.Delay(10);
await Task.Delay(1);
}
protected async Task SetOdl(int selIdxOdl)
{
isProcessing = true;
await Task.Delay(1);
IdxOdl = selIdxOdl;
await doUpdate();
isProcessing = false;
await Task.Delay(1);
}
protected async Task SetPeriodo(Periodo newPeriodo)
@@ -162,7 +160,13 @@ namespace MP_TAB_SERV.Components
#region Private Fields
private static Logger Log = LogManager.GetCurrentClassLogger();
private bool isProcessing = false;
private string noteKo = "";
private int NumRecPage = 10;
private int PageNum = 1;
private bool showInsert = false;
private bool showNote = false;
private int TotalCount = 0;
#endregion Private Fields
@@ -170,6 +174,7 @@ namespace MP_TAB_SERV.Components
private Periodo CurrPeriodo { get; set; } = new Periodo();
private string IdxMaccSel { get; set; } = "";
private int IdxOdl { get; set; } = 0;
#endregion Private Properties
}
@@ -0,0 +1,29 @@
<div class="row">
<div class="col-8 pe-0">
<div class="input-group">
<span class="input-group-text">Commessa / ODL</span>
<select class="form-select form-select-sm" @bind="@IdxOdlSel">
<option value="0">--- MOSTRA TUTTI ---</option>
@if (ListODL == null)
{
<option value="" disabled>No record found</option>
}
else
{
@foreach (var item in ListODL)
{
<option value="@item.value">@item.label</option>
}
}
</select>
</div>
</div>
<div class="col-4 ps-0">
<div class="input-group">
<span class="input-group-text"># ODL</span>
<input class="form-control text-end" @bind="@NumRec" />
</div>
</div>
</div>
@@ -0,0 +1,97 @@
using global::Microsoft.AspNetCore.Components;
using MP.Data.DatabaseModels;
using MP.Data.Services;
namespace MP_TAB_SERV.Components
{
public partial class MachineSelOdl
{
#region Public Properties
[Parameter]
public EventCallback<int> E_OdlSel { get; set; }
[Parameter]
public string IdxMacchina { get; set; } = "";
#endregion Public Properties
#region Protected Fields
protected bool isProcessing = false;
#endregion Protected Fields
#region Protected Properties
protected int IdxOdlSel
{
get => idxOdlSel;
set
{
if (idxOdlSel != value)
{
idxOdlSel = value;
E_OdlSel.InvokeAsync(value).ConfigureAwait(false);
}
}
}
private int idxOdlSel { get; set; } = 0;
protected List<vSelOdlModel> ListODL { get; set; } = new();
[Inject]
protected TabDataService TabDServ { get; set; } = null!;
#endregion Protected Properties
#region Protected Methods
protected override async Task OnParametersSetAsync()
{
await ReloadData();
}
#endregion Protected Methods
#region Private Properties
private int numRec { get; set; } = 10;
private int NumRec
{
get => numRec;
set
{
if (numRec != value)
{
numRec = value;
var pUpd = Task.Run(async () =>
{
await ReloadData();
await Task.Delay(1);
//await InvokeAsync(() => StateHasChanged());
});
pUpd.Wait();
}
}
}
#endregion Private Properties
#region Private Methods
private async Task ReloadData()
{
isProcessing = true;
await Task.Delay(1);
if (!string.IsNullOrEmpty(IdxMacchina))
{
ListODL = await TabDServ.VSOdlGetLastByMacc(IdxMacchina, NumRec);
}
isProcessing = false;
await Task.Delay(1);
}
#endregion Private Methods
}
}
+2 -3
View File
@@ -1,8 +1,7 @@
<h2>Piano Produzione - PODL</h2>
<div class="row">
<div class="col-6">
<h2>Piano Produzione - PODL</h2>
<MachSel RecMSE="RecMSE" E_MachSel="SetMacc"></MachSel>
</div>
<div class="col-6">
-2
View File
@@ -1,5 +1,3 @@
<h3>ScrapMan</h3>
@code {
}
+29
View File
@@ -0,0 +1,29 @@
using global::System;
using global::System.Collections.Generic;
using global::System.Linq;
using global::System.Threading.Tasks;
using global::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_TAB_SERV;
using MP_TAB_SERV.Shared;
using MP_TAB_SERV.Components;
using MP.Data;
using MP.Data.DatabaseModels;
using MP.Data.DTO;
using MP.Data.Services;
using Newtonsoft.Json;
using NLog;
namespace MP_TAB_SERV.Components
{
public partial class ScrapMan
{
}
}
+1 -1
View File
@@ -3,7 +3,7 @@
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<Nullable>enable</Nullable>
<Version>6.16.2310.1318</Version>
<Version>6.16.2310.1614</Version>
<ImplicitUsings>enable</ImplicitUsings>
<RootNamespace>MP_TAB_SERV</RootNamespace>
</PropertyGroup>
+1 -3
View File
@@ -6,8 +6,6 @@
}
else
{
<div>
<MachineBlock RecMSE="CurrMSE" FullMode="false"></MachineBlock>
</div>
<MachineBlock RecMSE="CurrMSE" FullMode="false"></MachineBlock>
<DeclarMan></DeclarMan>
}
+1 -3
View File
@@ -6,9 +6,7 @@
}
else
{
<div>
<MachineBlock RecMSE="CurrMSE" FullMode="false"></MachineBlock>
</div>
<MachineBlock RecMSE="CurrMSE" FullMode="false"></MachineBlock>
<ProdStat RecMSE="CurrMSE"></ProdStat>
<PrintMag RecMSE="CurrMSE"></PrintMag>
<ProdConfirm RecMSE="CurrMSE" E_newVal="RefreshMBlock"></ProdConfirm>
+1 -3
View File
@@ -6,8 +6,6 @@
}
else
{
<div>
<MachineBlock RecMSE="CurrMSE" FullMode="false"></MachineBlock>
</div>
<MachineBlock RecMSE="CurrMSE" FullMode="false"></MachineBlock>
<ProdPlanMan RecMSE="CurrMSE"></ProdPlanMan>
}
+2 -4
View File
@@ -6,8 +6,6 @@
}
else
{
<div>
<MachineBlock RecMSE="CurrMSE" FullMode="false"></MachineBlock>
</div>
<ProdStopMan></ProdStopMan>
<MachineBlock RecMSE="CurrMSE" FullMode="false"></MachineBlock>
<ScrapMan RecMSE="CurrMSE"></ScrapMan>
}
+4
View File
@@ -9,12 +9,16 @@
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<meta name="mobile-web-app-capable" content="yes" />
<meta name="description" content="MP TAB" />
<meta name="author" content="EgalWare" />
<base href="~/" />
<link rel="stylesheet" href="css/bootstrap/bootstrap.min.css" />
<link rel="stylesheet" href="lib/font-awesome/css/all.min.css" />
<link rel="stylesheet" href="lib/bootstrap/css/bootstrap.min.css" />
<link rel="stylesheet" href="css/font.min.css" />
<link rel="stylesheet" href="css/site.css" />
@* <link rel="shortcut icon" href="images/favicon.ico" /> *@
<link type="image/x-icon" href="images/favicon.ico" rel="shortcut icon" />
<link href="MP-TAB-SERV.styles.css" rel="stylesheet" />
<component type="typeof(HeadOutlet)" render-mode="Server" />
@* <component type="typeof(HeadOutlet)" render-mode="ServerPrerendered" /> *@
+1 -1
View File
@@ -1,6 +1,6 @@
<body>
<i>Modulo MAPOSPEC </i>
<h4>Versione: 6.16.2310.1318</h4>
<h4>Versione: 6.16.2310.1614</h4>
<br /> Note di rilascio:
<ul>
<li>
+1 -1
View File
@@ -1 +1 @@
6.16.2310.1318
6.16.2310.1614
+1 -1
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<item>
<version>6.16.2310.1318</version>
<version>6.16.2310.1614</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>
+23
View File
@@ -1042,6 +1042,29 @@ namespace MP.Data.Controllers
return answ;
}
/// <summary>
/// Elenco ultimi ODL x macchina
/// </summary>
/// <param name="idxMacchina">Macchina</param>
/// <param name="numRec"></param>
/// <returns></returns>
public List<vSelOdlModel> VSOdlGetLastByMacc(string idxMacchina, int numRec)
{
List<vSelOdlModel> dbResult = new List<vSelOdlModel>();
using (var dbCtx = new MoonProContext(_configuration))
{
var IdxMacc = new SqlParameter("@IdxMacchina", idxMacchina);
var NumRec = new SqlParameter("@numRec", numRec);
dbResult = dbCtx
.DbSetVSODL
.FromSqlRaw("EXEC stp_vsODL_getLastByMacc @IdxMacchina, @numRec", IdxMacc, NumRec)
.AsNoTracking()
.ToList();
}
return dbResult;
}
#endregion Public Methods
#region Private Fields
+19
View File
@@ -0,0 +1,19 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
#nullable disable
// <Auto-Generated>
// This is here so CodeMaid doesn't reorganize this document
// </Auto-Generated>
namespace MP.Data.DatabaseModels
{
public partial class vSelOdlModel
{
[Key]
public int value { get; set; } = 0;
public string label { get; set; } = "";
public DateTime conditio { get; set; } = DateTime.Now;
}
}
+10 -2
View File
@@ -84,12 +84,14 @@ namespace MP.Data
public virtual DbSet<ST_Template> DbSetStTemplate { get; set; }
public virtual DbSet<ST_TemplateRows> DbSetStTemplateRows { get; set; }
public virtual DbSet<vSelEventiBCodeModel> DbSetVSEB { get; set; }
public virtual DbSet<CommentiModel> DbSetCommenti { get; set; }
public virtual DbSet<FermiNonQualModel> DbSetFNQ { get; set; }
public virtual DbSet<vSelEventiBCodeModel> DbSetVSEB { get; set; }
public virtual DbSet<vSelOdlModel> DbSetVSODL { get; set; }
#endregion Public Properties
#region Private Methods
@@ -544,6 +546,12 @@ namespace MP.Data
{
entity.HasKey(e => new { e.IdxMacchina, e.InizioStato });
});
modelBuilder.Entity<vSelOdlModel>(entity =>
{
//entity.HasKey(e => e.value);
entity.ToView("v_selODL");
});
OnModelCreatingPartial(modelBuilder);
}
+36
View File
@@ -1163,6 +1163,42 @@ namespace MP.Data.Services
return result;
}
/// <summary>
/// Elenco ultimi ODL x macchina
/// </summary>
/// <param name="idxMacchina">Macchina</param>
/// <param name="numRec"></param>
/// <returns></returns>
public async Task<List<vSelOdlModel>> VSOdlGetLastByMacc(string idxMacchina, int numRec)
{
string source = "DB";
Stopwatch sw = new Stopwatch();
sw.Start();
List<vSelOdlModel>? result = new List<vSelOdlModel>();
// cerco in redis...
string currKey = $"{redisBaseKey}:VSODL:{idxMacchina}:{numRec}";
RedisValue rawData = await redisDb.StringGetAsync(currKey);
if (rawData.HasValue)
{
result = JsonConvert.DeserializeObject<List<vSelOdlModel>>($"{rawData}");
source = "REDIS";
}
else
{
result = await Task.FromResult(dbTabController.VSOdlGetLastByMacc(idxMacchina, numRec));
// serializzp e salvo...
rawData = JsonConvert.SerializeObject(result);
await redisDb.StringSetAsync(currKey, rawData, LongCache);
}
if (result == null)
{
result = new List<vSelOdlModel>();
}
sw.Stop();
Log.Debug($"VSOdlGetLastByMacc | {source} | {sw.Elapsed.TotalMilliseconds}ms");
return result;
}
#endregion Public Methods
#region Protected Fields