Compare commits
122 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| aa7a082660 | |||
| 82aa3ea691 | |||
| 7d7913a188 | |||
| 72f579f151 | |||
| e640d1db6e | |||
| 93b7c26d6e | |||
| a1e86c1050 | |||
| 78ce9a21d1 | |||
| 7b83faa930 | |||
| 21403fea33 | |||
| bc06e8250b | |||
| 330441982b | |||
| 9aec1075cf | |||
| ef5eda696a | |||
| ba207bf1ae | |||
| 9a1661ccaf | |||
| 4b9f2ec620 | |||
| 4d8f9e87f0 | |||
| 848e26ef85 | |||
| 40a00d61fc | |||
| fab26f2491 | |||
| 7f5dd9fc42 | |||
| 4edde43c11 | |||
| 2298ccbbcc | |||
| cee62a7089 | |||
| 4279db5c6d | |||
| 5b96e67111 | |||
| 371f40b6a3 | |||
| 99813791f7 | |||
| 8512e76f41 | |||
| 86a4b7fa36 | |||
| 0b56093fd4 | |||
| e3e9225ad2 | |||
| c3391dbede | |||
| 7c8ee74ec7 | |||
| 9908327a12 | |||
| 98119d4818 | |||
| ed2c694abd | |||
| c70ce33f26 | |||
| 03eb82c7b2 | |||
| 7655e340eb | |||
| 443a56cc07 | |||
| 06390295d2 | |||
| a3f5855b4a | |||
| bd14fc0502 | |||
| 6525d7e803 | |||
| 140566d81b | |||
| af0624b9c4 | |||
| 74856d9831 | |||
| bf654f54e6 | |||
| 8fbfea1f62 | |||
| b8dc7dffc4 | |||
| 2c3feaa4f3 | |||
| dbb4fbf9e2 | |||
| d13a1b7833 | |||
| 76c49d1eea | |||
| 3f1a3aa2ce | |||
| bbec081cae | |||
| 29fd417499 | |||
| 5380c996ac | |||
| 4e61028323 | |||
| 4f7ac21f41 | |||
| 55187eda96 | |||
| d6f7a55a05 | |||
| c71d7291a2 | |||
| 79c73db726 | |||
| 2608395e5b | |||
| c9c57208bf | |||
| af314cd578 | |||
| 788bd6d730 | |||
| e1eb5c6cdf | |||
| 1bf5cfc0be | |||
| 491365e8df | |||
| 40b16d2e83 | |||
| 39cf45869c | |||
| ea930b308d | |||
| b07c610edd | |||
| 185e27f31d | |||
| 6a44e7b0c9 | |||
| eb11533338 | |||
| 8b91210115 | |||
| 9f9f44f604 | |||
| dee4b63ca4 | |||
| bb19bb02c4 | |||
| fd69a196d2 | |||
| dcfaa6257a | |||
| 1271b44b15 | |||
| 132f5966dd | |||
| 02c46c99db | |||
| 485808e8d4 | |||
| d78c2d3173 | |||
| 2a1602c5b9 | |||
| a096f6a13e | |||
| 1cae70c244 | |||
| 18ee183b05 | |||
| d88c4cc2bd | |||
| 67922520b8 | |||
| c5b5b54586 | |||
| ae3864a614 | |||
| f878f1c496 | |||
| d453c1d944 | |||
| 921bf52659 | |||
| e948ae31af | |||
| b344180da2 | |||
| 4b885d780c | |||
| 01e181a4fc | |||
| 56f342a488 | |||
| ed72bdfa24 | |||
| 5e6924f0fe | |||
| cae7e50cbd | |||
| e769227bb3 | |||
| 60f757965e | |||
| 603ed3782f | |||
| 71177e04c7 | |||
| 1a211ebca5 | |||
| 591b66b52d | |||
| 96f4bb3b4c | |||
| f1c295993c | |||
| a293ce825e | |||
| e3b67ee6c0 | |||
| 0c5e41826e | |||
| 0d4e1aed88 |
@@ -0,0 +1,4 @@
|
||||
[*.cs]
|
||||
|
||||
# CS8765: Nullability of type of parameter doesn't match overridden member (possibly because of nullability attributes).
|
||||
dotnet_diagnostic.CS8765.severity = none
|
||||
Binary file not shown.
+36
@@ -0,0 +1,36 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 17
|
||||
VisualStudioVersion = 17.0.32126.317
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MP.Data", "MP.Data\MP.Data.csproj", "{10BA8450-301D-49C7-8E1E-21B7469C225C}"
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{1B6A7550-F6C9-468E-B3B4-C30FF6FE8933}"
|
||||
ProjectSection(SolutionItems) = preProject
|
||||
.editorconfig = .editorconfig
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MP.INVE", "MP.INVE\MP.INVE.csproj", "{FD5B477E-96A4-42F6-B2E8-7FC221C9971C}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{10BA8450-301D-49C7-8E1E-21B7469C225C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{10BA8450-301D-49C7-8E1E-21B7469C225C}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{10BA8450-301D-49C7-8E1E-21B7469C225C}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{10BA8450-301D-49C7-8E1E-21B7469C225C}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{FD5B477E-96A4-42F6-B2E8-7FC221C9971C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{FD5B477E-96A4-42F6-B2E8-7FC221C9971C}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{FD5B477E-96A4-42F6-B2E8-7FC221C9971C}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{FD5B477E-96A4-42F6-B2E8-7FC221C9971C}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {632D11D1-088B-4795-97E5-048534002558}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
@@ -7,6 +7,11 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MP.Data", "MP.Data\MP.Data.
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MP.SPEC", "MP.SPEC\MP.SPEC.csproj", "{C777A098-6F91-45AF-A85E-0AD08CBCAC52}"
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{1B6A7550-F6C9-468E-B3B4-C30FF6FE8933}"
|
||||
ProjectSection(SolutionItems) = preProject
|
||||
.editorconfig = .editorconfig
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
|
||||
@@ -0,0 +1,145 @@
|
||||
using Microsoft.Data.SqlClient;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using MP.Data.DatabaseModels;
|
||||
using NLog;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace MP.Data.Controllers
|
||||
{
|
||||
public class MpInveController : IDisposable
|
||||
{
|
||||
#region Public Constructors
|
||||
|
||||
public MpInveController(IConfiguration configuration)
|
||||
{
|
||||
_configuration = configuration;
|
||||
Log.Info("Avviata classe MpInveController");
|
||||
}
|
||||
|
||||
#endregion Public Constructors
|
||||
|
||||
#region Public Methods
|
||||
|
||||
/// <summary>
|
||||
/// Elenco Inventari CORRENTI (=aperti, senza data fine)
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public List<InventorySessionModel> InventSessCurrList()
|
||||
{
|
||||
List<InventorySessionModel> dbResult = new List<InventorySessionModel>();
|
||||
using (var dbCtx = new MoonPro_InveContext(_configuration))
|
||||
{
|
||||
dbResult = dbCtx
|
||||
.DbInveSess
|
||||
.Where(x => x.DtEnd == null)
|
||||
.AsNoTracking()
|
||||
.OrderByDescending(x => x.DtStart)
|
||||
.ToList();
|
||||
}
|
||||
return dbResult;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Elenco Inventari tipo Azienda (TUTTI, chiusi e paerti) filtrati x data
|
||||
/// </summary>
|
||||
/// <param name="FromDate"></param>
|
||||
/// <param name="ToDate"></param>
|
||||
/// <returns></returns>
|
||||
public List<InventorySessionModel> InventSessHistList(DateTime FromDate, DateTime ToDate)
|
||||
{
|
||||
List<InventorySessionModel> dbResult = new List<InventorySessionModel>();
|
||||
using (var dbCtx = new MoonPro_InveContext(_configuration))
|
||||
{
|
||||
dbResult = dbCtx
|
||||
.DbInveSess
|
||||
.Where(x => x.DtStart >= FromDate && x.DtStart <= ToDate)
|
||||
.AsNoTracking()
|
||||
.OrderByDescending(x => x.DtStart)
|
||||
.ToList();
|
||||
}
|
||||
return dbResult;
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
_configuration = null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Elenco Scansioni dato Id sessione inventario
|
||||
/// </summary>
|
||||
/// <param name="InveSessId"></param>
|
||||
/// <returns></returns>
|
||||
public List<ScanDataModel> ScanBySession(int InveSessId)
|
||||
{
|
||||
List<ScanDataModel> dbResult = new List<ScanDataModel>();
|
||||
using (var dbCtx = new MoonPro_InveContext(_configuration))
|
||||
{
|
||||
dbResult = dbCtx
|
||||
.DbScanData
|
||||
.Where(x => x.InveSessID==InveSessId)
|
||||
.AsNoTracking()
|
||||
.OrderByDescending(x => x.DtScan)
|
||||
.ToList();
|
||||
}
|
||||
return dbResult;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Elenco operatori
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public List<AnagOperatoriModel> ElencoOperatori()
|
||||
{
|
||||
List<AnagOperatoriModel> dbResult = new List<AnagOperatoriModel>();
|
||||
using (var dbCtx = new MoonProContext(_configuration))
|
||||
{
|
||||
dbResult = dbCtx
|
||||
.DbOperatori
|
||||
.Where(s=>s.MatrOpr>0)
|
||||
.AsNoTracking()
|
||||
.OrderBy(x => x.MatrOpr)
|
||||
.ToList();
|
||||
}
|
||||
return dbResult;
|
||||
}
|
||||
/// <summary>
|
||||
/// login operatore con controllo matricola + authkey
|
||||
/// </summary>
|
||||
/// /// <param name="MatrOpr"></param>
|
||||
/// /// <param name="authKey"></param>
|
||||
/// <returns></returns>
|
||||
public bool LoginOperatore(int MatrOpr, string authKey)
|
||||
{
|
||||
List<AnagOperatoriModel> dbResult = new List<AnagOperatoriModel>();
|
||||
bool result = false;
|
||||
using (var dbCtx = new MoonProContext(_configuration))
|
||||
{
|
||||
dbResult = dbCtx
|
||||
.DbOperatori
|
||||
.Where(s => (s.MatrOpr > 0) && (s.MatrOpr == MatrOpr) && (s.authKey == authKey))
|
||||
.AsNoTracking()
|
||||
.OrderBy(x => x.MatrOpr)
|
||||
.ToList();
|
||||
}
|
||||
if (dbResult.Count == 1)
|
||||
{
|
||||
result = true;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
#endregion Public Methods
|
||||
|
||||
#region Private Fields
|
||||
|
||||
private static IConfiguration _configuration;
|
||||
|
||||
private static NLog.Logger Log = LogManager.GetCurrentClassLogger();
|
||||
|
||||
#endregion Private Fields
|
||||
}
|
||||
}
|
||||
@@ -110,7 +110,7 @@ namespace MP.Data.Controllers
|
||||
dbResult = dbCtx
|
||||
.DbSetDossiers
|
||||
.AsNoTracking()
|
||||
.Select(i => i.OdlNav.CodArticolo)
|
||||
.Select(i => i.CodArticolo)
|
||||
.Distinct()
|
||||
.ToList();
|
||||
}
|
||||
@@ -183,11 +183,11 @@ namespace MP.Data.Controllers
|
||||
{
|
||||
dbResult = dbCtx
|
||||
.DbSetArticoli
|
||||
.AsNoTracking()
|
||||
.Where(x => (x.Azienda == azienda || azienda == "*") && (x.CodArticolo.Contains(searchVal) || x.DescArticolo.Contains(searchVal) || x.Disegno.Contains(searchVal) || string.IsNullOrEmpty(searchVal)))
|
||||
.OrderBy(x => x.CodArticolo)
|
||||
.Take(numRecord)
|
||||
.ToList();
|
||||
.AsNoTracking()
|
||||
.Where(x => (x.Azienda == azienda || azienda == "*") && (x.CodArticolo.Contains(searchVal) || x.DescArticolo.Contains(searchVal) || x.Disegno.Contains(searchVal) || string.IsNullOrEmpty(searchVal)))
|
||||
.OrderBy(x => x.CodArticolo)
|
||||
.Take(numRecord)
|
||||
.ToList();
|
||||
}
|
||||
return dbResult;
|
||||
}
|
||||
@@ -295,6 +295,7 @@ namespace MP.Data.Controllers
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
_configuration = null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -302,7 +303,7 @@ namespace MP.Data.Controllers
|
||||
/// </summary>
|
||||
/// <param name="currRec">record dossier da eliminare</param>
|
||||
/// <returns></returns>
|
||||
public async Task<bool> DossiersDeleteRecord(Dossiers currRec)
|
||||
public async Task<bool> DossiersDeleteRecord(DossierModel currRec)
|
||||
{
|
||||
bool answ = false;
|
||||
using (var dbCtx = new MoonProContext(_configuration))
|
||||
@@ -336,24 +337,50 @@ namespace MP.Data.Controllers
|
||||
/// <param name="DtStart">Data minima per estrazione records</param>
|
||||
/// <param name="DtEnd">Data Massima per estrazione records</param>
|
||||
/// <returns></returns>
|
||||
public List<Dossiers> DossiersGetLastFilt(string IdxMacchina, string CodArticolo, DateTime DtStart, DateTime DtEnd)
|
||||
public List<DossierModel> DossiersGetLastFilt(string IdxMacchina, string CodArticolo, DateTime DtStart, DateTime DtEnd)
|
||||
{
|
||||
List<Dossiers> dbResult = new List<Dossiers>();
|
||||
List<DossierModel> dbResult = new List<DossierModel>();
|
||||
using (var dbCtx = new MoonProContext(_configuration))
|
||||
{
|
||||
dbResult = dbCtx
|
||||
.DbSetDossiers
|
||||
.AsNoTracking()
|
||||
.Where(x => (IdxMacchina == "*" || x.IdxMacchina == IdxMacchina) && (CodArticolo == "*" || x.OdlNav.CodArticolo == CodArticolo) && (x.DtRif >= DtStart && x.DtRif <= DtEnd))
|
||||
.Where(x => (IdxMacchina == "*" || x.IdxMacchina == IdxMacchina) && (CodArticolo == "*" || x.CodArticolo == CodArticolo) && (x.DtRif >= DtStart && x.DtRif <= DtEnd))
|
||||
.Include(m => m.MachineNav)
|
||||
.Include(o => o.OdlNav)
|
||||
.Include(a => a.OdlNav.ArticoloNav)
|
||||
//.Include(o => o.OdlNav)
|
||||
.Include(a => a.ArticoloNav)
|
||||
.OrderByDescending(x => x.DtRif)
|
||||
.ToList();
|
||||
}
|
||||
return dbResult;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// insert di un record Dossier
|
||||
/// </summary>
|
||||
/// <param name="editRec">record dossier da modificare</param>
|
||||
/// <returns></returns>
|
||||
public async Task<bool> DossiersInsert(DossierModel newRec)
|
||||
{
|
||||
bool fatto = false;
|
||||
using (var dbCtx = new MoonProContext(_configuration))
|
||||
{
|
||||
try
|
||||
{
|
||||
dbCtx
|
||||
.DbSetDossiers
|
||||
.Add(newRec);
|
||||
await dbCtx.SaveChangesAsync();
|
||||
fatto = true;
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Log.Error($"Eccezione durante DossiersInsert{Environment.NewLine}{exc}");
|
||||
}
|
||||
}
|
||||
return fatto;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Effettua salvataggio snapshot parametri (con stored) + svuota eventuale cache redis
|
||||
/// </summary>
|
||||
@@ -401,11 +428,11 @@ namespace MP.Data.Controllers
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Update ddel campo VALORE di un dossier (che contiene json flux log serializzati)
|
||||
/// Update del campo VALORE di un dossier (che contiene json flux log serializzati)
|
||||
/// </summary>
|
||||
/// <param name="editRec">record dossier da modificare</param>
|
||||
/// <returns></returns>
|
||||
public async Task<bool> DossiersUpdateValore(Dossiers editRec)
|
||||
public async Task<bool> DossiersUpdateValore(DossierModel editRec)
|
||||
{
|
||||
bool fatto = false;
|
||||
using (var dbCtx = new MoonProContext(_configuration))
|
||||
@@ -476,12 +503,13 @@ namespace MP.Data.Controllers
|
||||
/// <summary>
|
||||
/// Elenco ultimi n record flux log dato macchina e flusso (ordinato x data registrazione)
|
||||
/// </summary>
|
||||
/// <param name="DtMax">Data massima (recupera eventi antecedenti)</param>
|
||||
/// <param name="DtMax">Data massima x eventi</param>
|
||||
/// <param name="DtMin">Data minima x eventi</param>
|
||||
/// <param name="IdxMacchina">* = tutte, altrimenti solo x una data macchina</param>
|
||||
/// <param name="CodFlux">*=tutti, altrimenti solo selezionato</param>
|
||||
/// <param name="MaxRec">numero massimo record da restituire</param>
|
||||
/// <returns></returns>
|
||||
public List<FluxLog> FluxLogGetLastFilt(DateTime DtMax, string IdxMacchina, string CodFlux, int MaxRec)
|
||||
public List<FluxLog> FluxLogGetLastFilt(DateTime DtMax, DateTime DtMin, string IdxMacchina, string CodFlux, int MaxRec)
|
||||
{
|
||||
List<FluxLog> dbResult = new List<FluxLog>();
|
||||
using (var dbCtx = new MoonProContext(_configuration))
|
||||
@@ -489,7 +517,7 @@ namespace MP.Data.Controllers
|
||||
dbResult = dbCtx
|
||||
.DbSetFluxLog
|
||||
.AsNoTracking()
|
||||
.Where(x => (x.dtEvento <= DtMax) && (IdxMacchina == "*" || x.IdxMacchina == IdxMacchina) && (CodFlux == "*" || x.CodFlux == CodFlux))
|
||||
.Where(x => (x.dtEvento >= DtMin && x.dtEvento <= DtMax) && (IdxMacchina == "*" || x.IdxMacchina == IdxMacchina) && (CodFlux == "*" || x.CodFlux == CodFlux))
|
||||
.OrderByDescending(x => x.dtEvento)
|
||||
.Take(MaxRec)
|
||||
.ToList();
|
||||
@@ -555,7 +583,7 @@ namespace MP.Data.Controllers
|
||||
.AsNoTracking()
|
||||
.Include(m => m.MachineNav)
|
||||
.Include(a => a.ArticoloNav)
|
||||
.OrderBy(x => x.InsertDate)
|
||||
.OrderByDescending(x => x.InsertDate)
|
||||
.ToList();
|
||||
}
|
||||
return dbResult;
|
||||
@@ -744,7 +772,7 @@ namespace MP.Data.Controllers
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Recupero Odl CORRENTI
|
||||
/// Recupero Odl CORRENTI
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public List<ODLModel> OdlGetCurrent()
|
||||
@@ -832,6 +860,31 @@ namespace MP.Data.Controllers
|
||||
await Task.Delay(1);
|
||||
return dbResult;
|
||||
}
|
||||
/// <summary>
|
||||
/// Recupero PODL da IdxOdl
|
||||
/// </summary>
|
||||
/// <param name="idxPODL"></param>
|
||||
/// <returns></returns>
|
||||
public PODLModel PODL_getByOdl(int idxODL)
|
||||
{
|
||||
PODLModel dbResult = new PODLModel();
|
||||
using (var dbCtx = new MoonProContext(_configuration))
|
||||
{
|
||||
try
|
||||
{
|
||||
dbResult = dbCtx
|
||||
.DbSetPODL
|
||||
.AsNoTracking()
|
||||
.Where(x => x.IdxOdl == idxODL)
|
||||
.FirstOrDefault();
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Log.Error($"Eccezione durante PODL_getByOdl{Environment.NewLine}{exc}");
|
||||
}
|
||||
}
|
||||
return dbResult;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Avvio setup ODL da PODL
|
||||
@@ -1001,6 +1054,24 @@ namespace MP.Data.Controllers
|
||||
return dbResult;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Elenco Vocabolario (completo)
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public List<VocabolarioModel> VocabolarioGetAll()
|
||||
{
|
||||
List<VocabolarioModel> dbResult = new List<VocabolarioModel>();
|
||||
using (var dbCtx = new MoonProContext(_configuration))
|
||||
{
|
||||
dbResult = dbCtx
|
||||
.DbSetVocabolario
|
||||
.AsNoTracking()
|
||||
.OrderBy(x => x.Lemma)
|
||||
.ToList();
|
||||
}
|
||||
return dbResult;
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
|
||||
#region Private Fields
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace MP.Data.DatabaseModels
|
||||
{
|
||||
// <Auto-Generated>
|
||||
// This is here so CodeMaid doesn't reorganize this document
|
||||
// </Auto-Generated>
|
||||
[Table("AnagraficaOperatori")]
|
||||
public class AnagOperatoriModel
|
||||
{
|
||||
[Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||
public int MatrOpr { get; set; }
|
||||
public string Cognome { get; set; } = "";
|
||||
public string Nome { get; set; } = "";
|
||||
public bool isAdmin { get; set; } = false;
|
||||
public string authKey { get; set; }
|
||||
public string CodOprExt { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -10,7 +10,7 @@ using System.ComponentModel.DataAnnotations.Schema;
|
||||
namespace MP.Data.DatabaseModels
|
||||
{
|
||||
[Table("Dossiers")]
|
||||
public partial class Dossiers
|
||||
public partial class DossierModel
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
@@ -31,7 +31,8 @@ namespace MP.Data.DatabaseModels
|
||||
|
||||
public string Valore { get; set; } = "";
|
||||
|
||||
|
||||
[MaxLength(50)]
|
||||
public string KeyRichiesta { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// Navigazione oggetto Machine
|
||||
@@ -45,6 +46,12 @@ namespace MP.Data.DatabaseModels
|
||||
[ForeignKey("IdxODL")]
|
||||
public virtual ODLModel OdlNav { get; set; } = null!;
|
||||
|
||||
/// <summary>
|
||||
/// Navigazione oggetto Articolo
|
||||
/// </summary>
|
||||
[ForeignKey("CodArticolo")]
|
||||
public virtual AnagArticoli ArticoloNav { get; set; } = null!;
|
||||
|
||||
#endregion Public Properties
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
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("InveSess")]
|
||||
public class InventorySessionModel
|
||||
{
|
||||
[Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||
public int InveSessID { get; set; }
|
||||
public string Description { get; set; } = "";
|
||||
public string UserCrea { get; set; } = "";
|
||||
public DateTime DtStart { get; set; } = DateTime.Now;
|
||||
public DateTime? DtEnd { get; set; } = null;
|
||||
public bool Transferred { get; set; } = false;
|
||||
|
||||
[NotMapped]
|
||||
public bool IsCurrent
|
||||
{
|
||||
get => (DtEnd == null);
|
||||
}
|
||||
[NotMapped]
|
||||
public bool IsValid
|
||||
{
|
||||
get => ((DtEnd != null && DtEnd > DtStart));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
|
||||
#nullable disable
|
||||
@@ -8,14 +10,22 @@ using System.Collections.Generic;
|
||||
// </Auto-Generated>
|
||||
namespace MP.Data.DatabaseModels
|
||||
{
|
||||
[Table("Macchine")]
|
||||
public partial class Macchine
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
public string CodMacchina { get; set; }
|
||||
public string Descrizione { get; set; }
|
||||
[Key]
|
||||
public string IdxMacchina { get; set; }
|
||||
public string Nome { get; set; }
|
||||
public string CodMacchina { get; set; } = "";
|
||||
public string Descrizione { get; set; } = "";
|
||||
public string Nome { get; set; } = "";
|
||||
public string Note { get; set; } = "";
|
||||
public string url { get; set; } = "";
|
||||
public string locazione { get; set; } = "";
|
||||
public string css { get; set; } = "";
|
||||
public int RowNum { get; set; } = 0;
|
||||
public int ColNum { get; set; } = 0;
|
||||
|
||||
#endregion Public Properties
|
||||
}
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
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("InveScanData")]
|
||||
public class ScanDataModel
|
||||
{
|
||||
[Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||
public int ScanID { get; set; }
|
||||
public DateTime DtScan { get; set; } = DateTime.Now;
|
||||
public string UserScan { get; set; } = "";
|
||||
public string ScanValue { get; set; } = "";
|
||||
public bool IsForced { get; set; } = false;
|
||||
public string CodArticolo { get; set; } = "";
|
||||
public string Lotto { get; set; } = "";
|
||||
public string RifExt { get; set; } = "";
|
||||
public decimal Qty { get; set; } = 0;
|
||||
public string Note { get; set; } = "";
|
||||
public bool IsKnown { get; set; } = false;
|
||||
public bool IsUnique { get; set; } = false;
|
||||
public int InveSessID { get; set; } = 0;
|
||||
|
||||
/// <summary>
|
||||
/// Navigazione oggetto Inventory Session
|
||||
/// </summary>
|
||||
[ForeignKey("InveSessID")]
|
||||
public virtual InventorySessionModel InveSessNav { get; set; } = null!;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
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
|
||||
{
|
||||
[Table("Vocabolario")]
|
||||
public partial class VocabolarioModel
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
public string Lingua { get; set; }
|
||||
public string Lemma { get; set; }
|
||||
public string Traduzione { get; set; }
|
||||
|
||||
#endregion Public Properties
|
||||
}
|
||||
}
|
||||
@@ -11,6 +11,10 @@
|
||||
<Compile Remove="DatabaseModels\TurniParetoOdl.cs" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Include="..\.editorconfig" Link=".editorconfig" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="6.0.9" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="6.0.9" />
|
||||
|
||||
@@ -69,7 +69,7 @@ namespace MP.Data
|
||||
|
||||
private bool enableLog = false;
|
||||
private IConnectionMultiplexer redis;
|
||||
private IDatabase? redisDb;
|
||||
private IDatabase redisDb;
|
||||
|
||||
#endregion Private Fields
|
||||
|
||||
@@ -90,7 +90,7 @@ namespace MP.Data
|
||||
//Subscribe to the channel named messages
|
||||
sub.Subscribe(_channel, (channel, message) =>
|
||||
{
|
||||
Log.Trace($"ch {channel} | {message}");
|
||||
Log.Trace($"req setup ch {channel} | {message}");
|
||||
// messaggio
|
||||
PubSubEventArgs mea = new PubSubEventArgs(message);
|
||||
// se qualcuno ascolta sollevo evento nuovo valore...
|
||||
|
||||
@@ -0,0 +1,120 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using MP.Data;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Metadata;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace MP.Data.Migrations
|
||||
{
|
||||
[DbContext(typeof(MoonPro_InveContext))]
|
||||
[Migration("20221111155708_InitialCreate")]
|
||||
partial class InitialCreate
|
||||
{
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.UseCollation("SQL_Latin1_General_CP1_CI_AS")
|
||||
.HasAnnotation("ProductVersion", "6.0.9")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 128);
|
||||
|
||||
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder, 1L, 1);
|
||||
|
||||
modelBuilder.Entity("MP.Data.DatabaseModels.InventorySessionModel", b =>
|
||||
{
|
||||
b.Property<int>("InveSessID")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("InveSessID"), 1L, 1);
|
||||
|
||||
b.Property<string>("Description")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<DateTime?>("DtEnd")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<DateTime>("DtStart")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<bool>("Transferred")
|
||||
.HasColumnType("bit");
|
||||
|
||||
b.Property<string>("UserCrea")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.HasKey("InveSessID");
|
||||
|
||||
b.ToTable("InveSess");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("MP.Data.DatabaseModels.ScanDataModel", b =>
|
||||
{
|
||||
b.Property<int>("ScanID")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ScanID"), 1L, 1);
|
||||
|
||||
b.Property<string>("CodArticolo")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<DateTime>("DtScan")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<int>("InveSessID")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<bool>("IsForced")
|
||||
.HasColumnType("bit");
|
||||
|
||||
b.Property<bool>("IsKnown")
|
||||
.HasColumnType("bit");
|
||||
|
||||
b.Property<bool>("IsUnique")
|
||||
.HasColumnType("bit");
|
||||
|
||||
b.Property<string>("Lotto")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Note")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<decimal>("Qty")
|
||||
.HasColumnType("decimal(18,2)");
|
||||
|
||||
b.Property<string>("RifExt")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("ScanValue")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("UserScan")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.HasKey("ScanID");
|
||||
|
||||
b.HasIndex("InveSessID");
|
||||
|
||||
b.ToTable("InveScanData");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("MP.Data.DatabaseModels.ScanDataModel", b =>
|
||||
{
|
||||
b.HasOne("MP.Data.DatabaseModels.InventorySessionModel", "InveSessNav")
|
||||
.WithMany()
|
||||
.HasForeignKey("InveSessID")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("InveSessNav");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace MP.Data.Migrations
|
||||
{
|
||||
public partial class InitialCreate : Migration
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateTable(
|
||||
name: "InveSess",
|
||||
columns: table => new
|
||||
{
|
||||
InveSessID = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
Description = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
||||
UserCrea = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
||||
DtStart = table.Column<DateTime>(type: "datetime2", nullable: false),
|
||||
DtEnd = table.Column<DateTime>(type: "datetime2", nullable: true),
|
||||
Transferred = table.Column<bool>(type: "bit", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_InveSess", x => x.InveSessID);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "InveScanData",
|
||||
columns: table => new
|
||||
{
|
||||
ScanID = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
DtScan = table.Column<DateTime>(type: "datetime2", nullable: false),
|
||||
UserScan = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
||||
ScanValue = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
||||
IsForced = table.Column<bool>(type: "bit", nullable: false),
|
||||
CodArticolo = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
||||
Lotto = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
||||
RifExt = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
||||
Qty = table.Column<decimal>(type: "decimal(18,6)", nullable: false),
|
||||
Note = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
||||
IsKnown = table.Column<bool>(type: "bit", nullable: false),
|
||||
IsUnique = table.Column<bool>(type: "bit", nullable: false),
|
||||
InveSessID = table.Column<int>(type: "int", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_InveScanData", x => x.ScanID);
|
||||
table.ForeignKey(
|
||||
name: "FK_InveScanData_InveSess_InveSessID",
|
||||
column: x => x.InveSessID,
|
||||
principalTable: "InveSess",
|
||||
principalColumn: "InveSessID",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_InveScanData_InveSessID",
|
||||
table: "InveScanData",
|
||||
column: "InveSessID");
|
||||
}
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "InveScanData");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "InveSess");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,118 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using MP.Data;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Metadata;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace MP.Data.Migrations
|
||||
{
|
||||
[DbContext(typeof(MoonPro_InveContext))]
|
||||
partial class MoonPro_InveContextModelSnapshot : ModelSnapshot
|
||||
{
|
||||
protected override void BuildModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.UseCollation("SQL_Latin1_General_CP1_CI_AS")
|
||||
.HasAnnotation("ProductVersion", "6.0.9")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 128);
|
||||
|
||||
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder, 1L, 1);
|
||||
|
||||
modelBuilder.Entity("MP.Data.DatabaseModels.InventorySessionModel", b =>
|
||||
{
|
||||
b.Property<int>("InveSessID")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("InveSessID"), 1L, 1);
|
||||
|
||||
b.Property<string>("Description")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<DateTime?>("DtEnd")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<DateTime>("DtStart")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<bool>("Transferred")
|
||||
.HasColumnType("bit");
|
||||
|
||||
b.Property<string>("UserCrea")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.HasKey("InveSessID");
|
||||
|
||||
b.ToTable("InveSess");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("MP.Data.DatabaseModels.ScanDataModel", b =>
|
||||
{
|
||||
b.Property<int>("ScanID")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ScanID"), 1L, 1);
|
||||
|
||||
b.Property<string>("CodArticolo")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<DateTime>("DtScan")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<int>("InveSessID")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<bool>("IsForced")
|
||||
.HasColumnType("bit");
|
||||
|
||||
b.Property<bool>("IsKnown")
|
||||
.HasColumnType("bit");
|
||||
|
||||
b.Property<bool>("IsUnique")
|
||||
.HasColumnType("bit");
|
||||
|
||||
b.Property<string>("Lotto")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Note")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<decimal>("Qty")
|
||||
.HasColumnType("decimal(18,2)");
|
||||
|
||||
b.Property<string>("RifExt")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("ScanValue")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("UserScan")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.HasKey("ScanID");
|
||||
|
||||
b.HasIndex("InveSessID");
|
||||
|
||||
b.ToTable("InveScanData");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("MP.Data.DatabaseModels.ScanDataModel", b =>
|
||||
{
|
||||
b.HasOne("MP.Data.DatabaseModels.InventorySessionModel", "InveSessNav")
|
||||
.WithMany()
|
||||
.HasForeignKey("InveSessID")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("InveSessNav");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -47,10 +47,12 @@ namespace MP.Data
|
||||
public virtual DbSet<ODLModel> DbSetODL { get; set; }
|
||||
public virtual DbSet<PODLModel> DbSetPODL { get; set; }
|
||||
public virtual DbSet<FluxLog> DbSetFluxLog { get; set; }
|
||||
public virtual DbSet<Dossiers> DbSetDossiers { get; set; }
|
||||
public virtual DbSet<DossierModel> DbSetDossiers { get; set; }
|
||||
public virtual DbSet<StatODLModel> DbSetStatOdl { get; set; }
|
||||
public virtual DbSet<StatoProdModel> DbSetStatoProd { get; set; }
|
||||
public virtual DbSet<EventListModel> DbSetEvList { get; set; }
|
||||
public virtual DbSet<VocabolarioModel> DbSetVocabolario { get; set; }
|
||||
public virtual DbSet<AnagOperatoriModel> DbOperatori { get; set; }
|
||||
|
||||
#endregion Public Properties
|
||||
|
||||
@@ -303,7 +305,12 @@ namespace MP.Data
|
||||
|
||||
modelBuilder.Entity<EventListModel>(entity =>
|
||||
{
|
||||
entity.HasKey(e => new { e.IdxMacchina, e.InizioStato, e.IdxTipo});
|
||||
entity.HasKey(e => new { e.IdxMacchina, e.InizioStato, e.IdxTipo });
|
||||
|
||||
});
|
||||
modelBuilder.Entity<VocabolarioModel>(entity =>
|
||||
{
|
||||
entity.HasKey(e => new { e.Lingua, e.Lemma });
|
||||
|
||||
});
|
||||
|
||||
|
||||
@@ -0,0 +1,86 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Metadata;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using MP.Data.DatabaseModels;
|
||||
using NLog;
|
||||
|
||||
#nullable disable
|
||||
// <Auto-Generated>
|
||||
// This is here so CodeMaid doesn't reorganize this document
|
||||
// </Auto-Generated>
|
||||
namespace MP.Data
|
||||
{
|
||||
public partial class MoonPro_InveContext : DbContext
|
||||
{
|
||||
#region Private Fields
|
||||
|
||||
private static NLog.Logger Log = LogManager.GetCurrentClassLogger();
|
||||
|
||||
private IConfiguration _configuration;
|
||||
|
||||
#endregion Private Fields
|
||||
|
||||
#region Public Constructors
|
||||
|
||||
/// <summary>
|
||||
/// Indispensabile x prima generazione migrations EFCore
|
||||
/// </summary>
|
||||
|
||||
[Obsolete("This constructor should never be used directly, and is only needed to generate entityframework stuff. Connection string can be adapted as pleased.")]
|
||||
public MoonPro_InveContext()
|
||||
{
|
||||
}
|
||||
|
||||
public MoonPro_InveContext(IConfiguration configuration)
|
||||
{
|
||||
_configuration = configuration;
|
||||
}
|
||||
|
||||
public MoonPro_InveContext(DbContextOptions<MoonPro_InveContext> options) : base(options)
|
||||
{
|
||||
}
|
||||
|
||||
#endregion Public Constructors
|
||||
|
||||
#region Public Properties
|
||||
|
||||
public virtual DbSet<InventorySessionModel> DbInveSess { get; set; }
|
||||
public virtual DbSet<ScanDataModel> DbScanData { get; set; }
|
||||
|
||||
#endregion Public Properties
|
||||
|
||||
#region Private Methods
|
||||
|
||||
partial void OnModelCreatingPartial(ModelBuilder modelBuilder);
|
||||
|
||||
#endregion Private Methods
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
|
||||
{
|
||||
if (!optionsBuilder.IsConfigured)
|
||||
{
|
||||
string connString = _configuration.GetConnectionString("Mp.Inve");
|
||||
if (!string.IsNullOrEmpty(connString))
|
||||
{
|
||||
optionsBuilder.UseSqlServer(connString);
|
||||
}
|
||||
else
|
||||
{
|
||||
optionsBuilder.UseSqlServer("Server=SQL2016DEV;Database=MoonPro_MAG;Trusted_Connection=True;");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
||||
{
|
||||
modelBuilder.HasAnnotation("Relational:Collation", "SQL_Latin1_General_CP1_CI_AS");
|
||||
|
||||
OnModelCreatingPartial(modelBuilder);
|
||||
}
|
||||
|
||||
#endregion Protected Methods
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
<CascadingAuthenticationState>
|
||||
<Router AppAssembly="@typeof(App).Assembly">
|
||||
<Found Context="routeData">
|
||||
<AuthorizeRouteView RouteData="@routeData" DefaultLayout="@typeof(MainLayout)" />
|
||||
<FocusOnNavigate RouteData="@routeData" Selector="h1" />
|
||||
</Found>
|
||||
<NotFound>
|
||||
<PageTitle>Not found</PageTitle>
|
||||
<LayoutView Layout="@typeof(MainLayout)">
|
||||
<p role="alert">Sorry, there's nothing at this address.</p>
|
||||
</LayoutView>
|
||||
</NotFound>
|
||||
</Router>
|
||||
</CascadingAuthenticationState>
|
||||
@@ -0,0 +1 @@
|
||||
<canvas id="@Id"></canvas>
|
||||
@@ -0,0 +1,59 @@
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using Microsoft.JSInterop;
|
||||
using MP.Data;
|
||||
using MP.INVE.Data;
|
||||
using static System.Net.Mime.MediaTypeNames;
|
||||
|
||||
namespace MP.INVE.Components.Chart
|
||||
{
|
||||
public partial class Doughnut
|
||||
{
|
||||
[Inject]
|
||||
private IJSRuntime JSRuntime { get; set; } = null!;
|
||||
|
||||
|
||||
public enum ChartType
|
||||
{
|
||||
Pie,
|
||||
Bar,
|
||||
Doughnut
|
||||
}
|
||||
|
||||
//[Parameter]
|
||||
public string Id { get; set; } = "myChart";
|
||||
|
||||
[Parameter]
|
||||
public ChartType Type { get; set; }
|
||||
|
||||
[Parameter]
|
||||
public double[] Data { get; set; } = null!;
|
||||
[Parameter]
|
||||
public List<DoughnutStyling> BackgroundColor { get; set; } = null!;
|
||||
|
||||
[Parameter]
|
||||
public string[] Labels { get; set; } = null!;
|
||||
|
||||
protected override async Task OnAfterRenderAsync(bool firstRender)
|
||||
{
|
||||
var config = new
|
||||
{
|
||||
Type = Type.ToString().ToLower(),
|
||||
Options = new
|
||||
{
|
||||
Responsive = true,
|
||||
},
|
||||
Data = new
|
||||
{
|
||||
Datasets = new[]
|
||||
{
|
||||
new { Data = Data, BackgroundColor = BackgroundColor.Select(x=>x.color), borderColor = BackgroundColor.Select(x=>x.border), borderWidth= 0, offset= 1, borderRadius = 0
|
||||
}
|
||||
},
|
||||
Labels = Labels
|
||||
}
|
||||
};
|
||||
|
||||
await JSRuntime.InvokeVoidAsync("setup", Id, config);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
<canvas id="@Id"></canvas>
|
||||
@@ -0,0 +1,162 @@
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using Microsoft.JSInterop;
|
||||
using MP.Data;
|
||||
|
||||
namespace MP.INVE.Components.Chart
|
||||
{
|
||||
public partial class Line
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
[Parameter]
|
||||
public double AspRatio { get; set; } = 0;
|
||||
|
||||
[Parameter]
|
||||
public List<string> backColor { get; set; } = new List<string>();
|
||||
|
||||
[Parameter]
|
||||
public string ChartId
|
||||
{
|
||||
get
|
||||
{
|
||||
return Id;
|
||||
}
|
||||
set
|
||||
{
|
||||
Id = value;
|
||||
}
|
||||
}
|
||||
|
||||
[Parameter]
|
||||
public List<chartJsData.chartJsTSerie> DataTS
|
||||
{
|
||||
get
|
||||
{
|
||||
return _DataTS;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
_DataTS = value;
|
||||
//var pUpd = Task.Run(async () => await renderChart());
|
||||
//pUpd.Wait();
|
||||
}
|
||||
}
|
||||
|
||||
[Parameter]
|
||||
public List<string> Labels { get; set; } = new List<string>();
|
||||
|
||||
[Parameter]
|
||||
public List<string> lineColor { get; set; } = new List<string>();
|
||||
|
||||
[Parameter]
|
||||
public int lTens { get; set; } = 0;
|
||||
|
||||
[Parameter]
|
||||
public string MaxValue { get; set; } = "0";
|
||||
|
||||
[Parameter]
|
||||
public string MinValue { get; set; } = "0";
|
||||
|
||||
[Parameter]
|
||||
public List<string> pointColor { get; set; } = new List<string>();
|
||||
|
||||
[Parameter]
|
||||
public string Title { get; set; } = "Demo Line";
|
||||
|
||||
#endregion Public Properties
|
||||
|
||||
#region Protected Properties
|
||||
|
||||
protected string Id { get; set; } = "CurrId";
|
||||
|
||||
#endregion Protected Properties
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
/// <summary>
|
||||
/// Inizializzazione rendering componente
|
||||
///
|
||||
/// partendo da qui: https://www.williamleme.com/posts/2020/003-chartjs-blazor/
|
||||
/// https://www.puresourcecode.com/dotnet/blazor/using-chart-js-with-blazor/ https://www.tutorialsteacher.com/csharp/csharp-anonymous-type
|
||||
/// </summary>
|
||||
/// <param name="firstRender"></param>
|
||||
/// <returns></returns>
|
||||
protected override async Task OnAfterRenderAsync(bool firstRender)
|
||||
{
|
||||
await renderChart();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Inizializzazione rendering componente
|
||||
///
|
||||
/// partendo da qui: https://www.williamleme.com/posts/2020/003-chartjs-blazor/
|
||||
/// https://www.puresourcecode.com/dotnet/blazor/using-chart-js-with-blazor/ https://www.tutorialsteacher.com/csharp/csharp-anonymous-type
|
||||
/// </summary>
|
||||
/// <param name="firstRender"></param>
|
||||
/// <returns></returns>
|
||||
protected async Task renderChart()
|
||||
{
|
||||
// creazione di un oggetto anonymous type con tutte le opzioni da passare a chart.js
|
||||
var config = new
|
||||
{
|
||||
type = "line",
|
||||
options = new
|
||||
{
|
||||
responsive = true,
|
||||
scales = new
|
||||
{
|
||||
yAxes = new
|
||||
{
|
||||
display = true,
|
||||
position = "right",
|
||||
ticks = new
|
||||
{
|
||||
maxTicksLimit = 10
|
||||
},
|
||||
suggestedMin = MinValue != MaxValue ? MinValue : "auto",
|
||||
suggestedMax = MinValue != MaxValue ? MaxValue : "auto"
|
||||
},
|
||||
xAxes = new
|
||||
{
|
||||
type = "time",
|
||||
distribution = "linear",
|
||||
}
|
||||
},
|
||||
plugins = new
|
||||
{
|
||||
legend = new
|
||||
{
|
||||
display = false
|
||||
},
|
||||
},
|
||||
Animation = false,
|
||||
AspectRatio = AspRatio == 0 ? "auto" : $"{AspRatio}"
|
||||
},
|
||||
data = new
|
||||
{
|
||||
labels = Labels,
|
||||
datasets = new[]{new
|
||||
{
|
||||
data = DataTS, pointBorderColor = backColor, borderColor = lineColor, backgroundColor = backColor, fill = true, PointRadius = 2, BorderWidth = 1, lineTension = lTens, stepped = false, label = Title
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
;
|
||||
await JSRuntime.InvokeVoidAsync("setup", Id, config);
|
||||
}
|
||||
|
||||
#endregion Protected Methods
|
||||
|
||||
#region Private Properties
|
||||
|
||||
private List<chartJsData.chartJsTSerie> _DataTS { get; set; } = null!;
|
||||
|
||||
[Inject]
|
||||
private IJSRuntime JSRuntime { get; set; } = null!;
|
||||
|
||||
#endregion Private Properties
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
<div class="row text-light">
|
||||
<div class="col-5 pe-0 text-left">
|
||||
<b>Mapo INVE @(DateTime.Today.Year)</b> | <span class="small">v.@version</span>
|
||||
</div>
|
||||
<div class="col-7 ps-0 text-end">
|
||||
<span class="small">@($"{DateTime.Now:HH:mm:ss}")</span> | <a class="text-light" href="https://www.egalware.com/" target="_blank"><img class="img-fluid" width="16" src="images/LogoEgw.png" /> Egalware </a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -0,0 +1,56 @@
|
||||
using NLog;
|
||||
|
||||
namespace MP.INVE.Components
|
||||
{
|
||||
public partial class CmpFooter
|
||||
{
|
||||
#region Public Methods
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
aTimer.Elapsed -= ElapsedTimer;
|
||||
aTimer.Stop();
|
||||
aTimer.Dispose();
|
||||
}
|
||||
|
||||
public void ElapsedTimer(object? source, System.Timers.ElapsedEventArgs e)
|
||||
{
|
||||
var pUpd = Task.Run(async () =>
|
||||
{
|
||||
await Task.Delay(1);
|
||||
await InvokeAsync(() => StateHasChanged());
|
||||
});
|
||||
pUpd.Wait();
|
||||
}
|
||||
|
||||
public void StartTimer()
|
||||
{
|
||||
int tOutPeriod = 5000;
|
||||
//int.TryParse(Configuration["ReloadStatusTimer"], out tOutPeriod);
|
||||
aTimer = new System.Timers.Timer(tOutPeriod);
|
||||
aTimer.Elapsed += ElapsedTimer;
|
||||
aTimer.Enabled = true;
|
||||
aTimer.Start();
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
protected override void OnInitialized()
|
||||
{
|
||||
var rawVers = typeof(Program).Assembly.GetName().Version; ;
|
||||
version = rawVers != null ? rawVers : new Version("0.0.0.0");
|
||||
}
|
||||
|
||||
#endregion Protected Methods
|
||||
|
||||
#region Private Fields
|
||||
|
||||
private static System.Timers.Timer aTimer = null!;
|
||||
private static NLog.Logger Log = LogManager.GetCurrentClassLogger();
|
||||
private Version version = null!;
|
||||
|
||||
#endregion Private Fields
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
@using MP.INVE.Components
|
||||
@using MP.INVE.Data
|
||||
@using System.Security.Claims
|
||||
@using Microsoft.AspNetCore.Components.Authorization
|
||||
|
||||
@inject AuthenticationStateProvider AuthenticationStateProvider
|
||||
|
||||
<div class="d-flex w-100 justify-content-between">
|
||||
<div class="px-2">
|
||||
<i class="fas fa-user-alt"></i> <b>@userName</b>
|
||||
</div>
|
||||
<div class="pe-2">
|
||||
<button class="btn btn-primary" @onclick="() => flushCache()" title="Forza Refresh Dati correnti"> Force Reload </button>
|
||||
</div>
|
||||
@* <div class="px-2 flex-grow-1 text-end">
|
||||
<span class="text-secondary">@TipoSearch</span>
|
||||
</div>
|
||||
<div class="px-2 text-end">
|
||||
@if (ShowSearch)
|
||||
{
|
||||
<SearchMod></SearchMod>
|
||||
}
|
||||
</div>*@
|
||||
</div>
|
||||
|
||||
|
||||
@@ -0,0 +1,77 @@
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using Microsoft.AspNetCore.Components.Authorization;
|
||||
using Microsoft.JSInterop;
|
||||
using MP.INVE.Data;
|
||||
|
||||
namespace MP.INVE.Components
|
||||
{
|
||||
public partial class CmpTop
|
||||
{
|
||||
#region Public Methods
|
||||
|
||||
public async Task flushCache()
|
||||
{
|
||||
await Task.Delay(1);
|
||||
await Task.Delay(1);
|
||||
// rimando a pagina corrente
|
||||
NavManager.NavigateTo(NavManager.Uri, true);
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
|
||||
#region Protected Properties
|
||||
|
||||
[Inject]
|
||||
protected IJSRuntime JSRuntime { get; set; } = null!;
|
||||
|
||||
#endregion Protected Properties
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
await forceReload();
|
||||
}
|
||||
|
||||
#endregion Protected Methods
|
||||
|
||||
#region Private Fields
|
||||
|
||||
private string userName = "";
|
||||
|
||||
#endregion Private Fields
|
||||
|
||||
#region Private Properties
|
||||
|
||||
[Inject]
|
||||
private NavigationManager NavManager { get; set; } = null!;
|
||||
|
||||
|
||||
|
||||
#endregion Private Properties
|
||||
|
||||
#region Private Methods
|
||||
|
||||
private async Task forceReload()
|
||||
{
|
||||
var authState = await AuthenticationStateProvider.GetAuthenticationStateAsync();
|
||||
var user = authState.User;
|
||||
if (user.Identity != null && user.Identity.IsAuthenticated)
|
||||
{
|
||||
userName = $"{user.Identity.Name}";
|
||||
}
|
||||
else
|
||||
{
|
||||
userName = "N.A.";
|
||||
}
|
||||
}
|
||||
|
||||
private async void MService_EA_ShowSearch()
|
||||
{
|
||||
await Task.Delay(1);
|
||||
await InvokeAsync(() => StateHasChanged());
|
||||
}
|
||||
|
||||
#endregion Private Methods
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
<div class="row">
|
||||
<div class="col-12 col-lg-8 text-left">
|
||||
<div class="row">
|
||||
<div class="col-12 small">
|
||||
@if (totalCount > 0)
|
||||
{
|
||||
<ul class="pagination pagination-sm mb-1">
|
||||
<li class="page-item"><button class="page-link" @onclick="() => PaginationItemClick(1)"><i class="fas fa-angle-double-left"></i></button></li>
|
||||
<li class="page-item"><button class="page-link" @onclick="() => PaginationItemClick(prevBlock)"><i class="fas fa-angle-left"></i></button></li>
|
||||
@for (int i = @startPage; i <= endPage; ++i)
|
||||
{
|
||||
var pageNum = i;
|
||||
<li class="page-item @cssActive(pageNum)"><button class="page-link" @onclick="() => PaginationItemClick(pageNum)">@pageNum</button></li>
|
||||
}
|
||||
<li class="page-item"><button class="page-link" @onclick="() => PaginationItemClick(nextBlock)"><i class="fas fa-angle-right"></i></button></li>
|
||||
<li class="page-item"><button class="page-link" @onclick="() => PaginationItemClick(LastPage)"><i class="fas fa-angle-double-right"></i></button></li>
|
||||
</ul>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-12 small">
|
||||
@if (showLoading)
|
||||
{
|
||||
<div class="progress" style="height: 10px;">
|
||||
<div class="progress-bar progress-bar-striped progress-bar-animated" style="width:@percLoading%;"></div>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-12 col-lg-4">
|
||||
<div class="d-flex">
|
||||
<div class="p-1 flex-fill">
|
||||
@if (!showLoading)
|
||||
{
|
||||
<span>@totalCount records</span>
|
||||
}
|
||||
</div>
|
||||
<div class="p-1 small">
|
||||
@if (totalCount > 0)
|
||||
{
|
||||
<div class="input-group input-group-sm">
|
||||
<select @bind="@PageSize" class="form-select form-select-sm text-end">
|
||||
<option value="5">5</option>
|
||||
<option value="10">10</option>
|
||||
<option value="25">25</option>
|
||||
<option value="50">50</option>
|
||||
<option value="100">100</option>
|
||||
</select>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,198 @@
|
||||
using Microsoft.AspNetCore.Components;
|
||||
|
||||
namespace MP.INVE.Components
|
||||
{
|
||||
public partial class DataPager : ComponentBase
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
[Parameter]
|
||||
public int currPage
|
||||
{
|
||||
get
|
||||
{
|
||||
return _numPage;
|
||||
}
|
||||
set
|
||||
{
|
||||
bool doReport = !_numPage.Equals(value);
|
||||
if (doReport)
|
||||
{
|
||||
_numPage = value;
|
||||
reportChangePage();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[Parameter]
|
||||
public EventCallback<int> numPageChanged { get; set; }
|
||||
|
||||
[Parameter]
|
||||
public EventCallback<int> numRecordChanged { get; set; }
|
||||
|
||||
[Parameter]
|
||||
public int PageSize
|
||||
{
|
||||
get
|
||||
{
|
||||
return _numRecord;
|
||||
}
|
||||
set
|
||||
{
|
||||
bool doReport = !_numRecord.Equals(value);
|
||||
if (doReport)
|
||||
{
|
||||
_numRecord = value;
|
||||
reportChange();
|
||||
resetCurrPage();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[Parameter]
|
||||
public bool showLoading
|
||||
{
|
||||
get
|
||||
{
|
||||
return _showLoading;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (value)
|
||||
{
|
||||
Random random = new Random();
|
||||
percLoading = random.Next(30, 90);
|
||||
}
|
||||
else
|
||||
{
|
||||
percLoading = 5;
|
||||
}
|
||||
_showLoading = value;
|
||||
}
|
||||
}
|
||||
|
||||
[Parameter]
|
||||
public int totalCount { get; set; } = 0;
|
||||
|
||||
#endregion Public Properties
|
||||
|
||||
#region Public Methods
|
||||
|
||||
public void resetCurrPage()
|
||||
{
|
||||
//await Task.Delay(1);
|
||||
currPage = 1;
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
|
||||
#region Protected Fields
|
||||
|
||||
protected bool _showLoading = false;
|
||||
|
||||
#endregion Protected Fields
|
||||
|
||||
#region Protected Properties
|
||||
|
||||
protected int _numPage { get; set; } = 1;
|
||||
|
||||
protected int _numRecord { get; set; } = 10;
|
||||
|
||||
protected int percLoading { get; set; } = 0;
|
||||
|
||||
#endregion Protected Properties
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
protected string cssActive(int numPage)
|
||||
{
|
||||
string answ = "";
|
||||
if (numPage == currPage)
|
||||
{
|
||||
answ = "active";
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
await Task.Run(() => showLoading = false);
|
||||
}
|
||||
|
||||
protected void PaginationItemClick(int page)
|
||||
{
|
||||
currPage = page;
|
||||
}
|
||||
|
||||
#endregion Protected Methods
|
||||
|
||||
#region Private Properties
|
||||
|
||||
private int endPage
|
||||
{
|
||||
get
|
||||
{
|
||||
int answ = (int)(currPage / numPages) * numPages + numPages;
|
||||
answ = answ < LastPage ? answ : LastPage;
|
||||
return answ;
|
||||
}
|
||||
}
|
||||
|
||||
private int LastPage
|
||||
{
|
||||
get
|
||||
{
|
||||
return Math.Max((int)Math.Ceiling(totalCount / (double)PageSize), 1);
|
||||
}
|
||||
}
|
||||
|
||||
private int nextBlock
|
||||
{
|
||||
get
|
||||
{
|
||||
int answ = currPage + numPages;
|
||||
answ = answ < LastPage ? answ : LastPage;
|
||||
return answ;
|
||||
}
|
||||
}
|
||||
|
||||
private int numPages { get; set; } = 10;
|
||||
|
||||
private int prevBlock
|
||||
{
|
||||
get
|
||||
{
|
||||
int answ = currPage - numPages;
|
||||
answ = answ > 0 ? answ : 1;
|
||||
return answ;
|
||||
}
|
||||
}
|
||||
|
||||
// calcola un set 1 .. numPages centrato sulla pagina corrente...
|
||||
private int startPage
|
||||
{
|
||||
get
|
||||
{
|
||||
int answ = (int)(currPage / numPages) * numPages;
|
||||
answ = answ > 0 ? answ : 1;
|
||||
return answ;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Private Properties
|
||||
|
||||
#region Private Methods
|
||||
|
||||
private void reportChange()
|
||||
{
|
||||
numRecordChanged.InvokeAsync(PageSize);
|
||||
}
|
||||
|
||||
private void reportChangePage()
|
||||
{
|
||||
numPageChanged.InvokeAsync(currPage);
|
||||
}
|
||||
|
||||
#endregion Private Methods
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,84 @@
|
||||
<div class="d-flex justify-content-end">
|
||||
<div class="d-flex justify-content-between pt-2">
|
||||
@if (filtActive)
|
||||
{
|
||||
<div class=" rounded small d-flex justify-content-between" title="Filtri attivi">
|
||||
@*<i class="fas fa-exclamation text-warning"></i>*@
|
||||
@if (selMacchina != "*")
|
||||
{
|
||||
<button class="btn btn-outline-primary btn-sm mx-2" @onclick="()=>resetMacchina()" title="Rimuovi Filtro Impianto"><i class="fa-solid fa-hard-drive"></i>   <i class="fa-solid fa-xmark text-warning"></i></button>
|
||||
}
|
||||
@if (selArticolo != "*")
|
||||
{
|
||||
<button class="btn btn-outline-primary btn-sm mx-2" @onclick="()=>resetArticolo()" title="Rimuovi Filtro Articolo"><i class="fa-solid fa-sliders"></i>   <i class="fa-solid fa-xmark text-warning"></i></button>
|
||||
}
|
||||
</div>
|
||||
}
|
||||
<div class="p-2">
|
||||
<a class="" data-bs-toggle="offcanvas" data-bs-target="#paramsFilterExample" aria-controls="paramsFilterExample">
|
||||
<i class="fa-solid fa-bars text-dark"></i>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="offcanvas offcanvas-end" tabindex="-1" id="paramsFilterExample" aria-labelledby="paramsFilterExampleLabel">
|
||||
<div class="offcanvas-header">
|
||||
<h3 class="offcanvas-title" id="paramsFilterExampleLabel"><b>FILTRI</b></h3>
|
||||
<button type="button" class="btn-close text-reset" data-bs-dismiss="offcanvas" aria-label="Close"></button>
|
||||
</div>
|
||||
<div class="offcanvas-body">
|
||||
<div>
|
||||
Seleziona i filtri per:
|
||||
</div>
|
||||
<div class="small mt-2">
|
||||
<label class="px-2" for="dtMin" title="Selezionare inizio periodo">Articolo</label>
|
||||
</div>
|
||||
<div class="input-group px-2">
|
||||
<label class="input-group-text" for="macchina" title="Selezionare l'articolo"><i class="fa-solid fa-file"></i></label>
|
||||
<select @bind="@selArticolo" class="form-select" id="macchina" title="Selezionare la macchina">
|
||||
<option value="*">--- Tutti ---</option>
|
||||
@if (ListArticoli != null)
|
||||
{
|
||||
foreach (var item in ListArticoli)
|
||||
{
|
||||
<option value="@item">@item</option>
|
||||
}
|
||||
}
|
||||
</select>
|
||||
</div>
|
||||
<div class="small mt-2">
|
||||
<label class="px-2" for="dtMin" title="Selezionare inizio periodo">Macchina</label>
|
||||
</div>
|
||||
<div class="input-group px-2">
|
||||
<label class="input-group-text" for="macchina" title="Selezionare la macchina"><i class="fa-solid fa-hard-drive"></i></label>
|
||||
<select @bind="@selMacchina" class="form-select" id="macchina" title="Selezionare la macchina">
|
||||
<option value="*">--- Tutti ---</option>
|
||||
@if (ListMacchine != null)
|
||||
{
|
||||
foreach (var item in ListMacchine)
|
||||
{
|
||||
<option value="@item">@item</option>
|
||||
}
|
||||
}
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="small mt-2">
|
||||
<label class="px-2" for="dtMin" title="Selezionare inizio periodo">Inizio Periodo</label>
|
||||
</div>
|
||||
<div class="px-2 input-group">
|
||||
<label class="input-group-text" for="dtMin" title="Selezionare inizio periodo"><i class="fa-regular fa-calendar-minus"></i></label>
|
||||
<input class="form-control" @bind="@selDtMin" id="dtMin" type="datetime-local" title="Data minima eventi da visualizzare">
|
||||
</div>
|
||||
<div class="small mt-2">
|
||||
<label class="px-2" for="dtMax" title="Selezionare fine periodo">Fine Periodo</label>
|
||||
</div>
|
||||
<div class="px-2 input-group">
|
||||
<label class="input-group-text" for="dtMax" title="Selezionare fine periodo"><i class="fa-regular fa-calendar-plus"></i></label>
|
||||
<input class="form-control" @bind="@selDtMax" id="dtMax" type="datetime-local" title="Selezionare fine periodo">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,173 @@
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using MP.INVE.Data;
|
||||
|
||||
namespace MP.INVE.Components
|
||||
{
|
||||
public partial class DossiersFilter
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
[Parameter]
|
||||
public EventCallback<SelectDossierParams> FilterChanged { get; set; }
|
||||
|
||||
[Parameter]
|
||||
public SelectDossierParams SelFilterDossier { get; set; } = null!;
|
||||
|
||||
#endregion Public Properties
|
||||
|
||||
#region Protected Properties
|
||||
|
||||
[Inject]
|
||||
protected MpDataService MDService { get; set; } = null!;
|
||||
|
||||
protected string selArticolo
|
||||
{
|
||||
get
|
||||
{
|
||||
return SelFilterDossier.CodArticolo;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (!SelFilterDossier.CodArticolo.Equals(value))
|
||||
{
|
||||
SelFilterDossier.CurrPage = 1;
|
||||
SelFilterDossier.CodArticolo = value;
|
||||
StateHasChanged();
|
||||
Task.Delay(1);
|
||||
reportChange();
|
||||
}
|
||||
}
|
||||
}
|
||||
private bool filtActive
|
||||
{
|
||||
get => selMacchina != "*" || selArticolo != "*";
|
||||
}
|
||||
protected void resetMacchina()
|
||||
{
|
||||
selMacchina = "*";
|
||||
}
|
||||
protected void resetArticolo()
|
||||
{
|
||||
selArticolo = "*";
|
||||
}
|
||||
protected DateTime selDtMax
|
||||
{
|
||||
get
|
||||
{
|
||||
return SelFilterDossier.DtEnd;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (!SelFilterDossier.DtEnd.Equals(value))
|
||||
{
|
||||
SelFilterDossier.DtEnd = value;
|
||||
reportChange();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected DateTime selDtMin
|
||||
{
|
||||
get
|
||||
{
|
||||
return SelFilterDossier.DtStart;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (!SelFilterDossier.DtStart.Equals(value))
|
||||
{
|
||||
SelFilterDossier.DtStart = value;
|
||||
reportChange();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected string selMacchina
|
||||
{
|
||||
get
|
||||
{
|
||||
return SelFilterDossier.IdxMacchina;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (!SelFilterDossier.IdxMacchina.Equals(value))
|
||||
{
|
||||
SelFilterDossier.CurrPage = 1;
|
||||
SelFilterDossier.IdxMacchina = value;
|
||||
StateHasChanged();
|
||||
Task.Delay(1);
|
||||
reportChange();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected int selMaxRecord
|
||||
{
|
||||
get
|
||||
{
|
||||
return SelFilterDossier.MaxRecord;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (!SelFilterDossier.MaxRecord.Equals(value))
|
||||
{
|
||||
SelFilterDossier.MaxRecord = value;
|
||||
reportChange();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected bool showParam { get; set; } = false;
|
||||
|
||||
#endregion Protected Properties
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
SelFilterDossier = new SelectDossierParams();
|
||||
DateTime dtEnd = SelFilterDossier.DtEnd;
|
||||
DateTime dtStart = dtEnd.Subtract(SelFilterDossier.DtStart).TotalDays < 15 ? SelFilterDossier.DtStart : dtEnd.AddDays(-14);
|
||||
ListMacchine = await MDService.MacchineWithFlux(dtStart, dtEnd);
|
||||
ListArticoli = await MDService.ArticleWithDossier();
|
||||
await FilterChanged.InvokeAsync(SelFilterDossier);
|
||||
}
|
||||
|
||||
protected void toggleParams()
|
||||
{
|
||||
showEditPar = !showEditPar;
|
||||
}
|
||||
|
||||
#endregion Protected Methods
|
||||
|
||||
#region Private Fields
|
||||
|
||||
private List<string>? ListArticoli = null;
|
||||
private List<string>? ListMacchine = null;
|
||||
|
||||
#endregion Private Fields
|
||||
|
||||
#region Private Properties
|
||||
|
||||
private bool showEditPar { get; set; } = false;
|
||||
|
||||
#endregion Private Properties
|
||||
|
||||
#region Private Methods
|
||||
|
||||
private void reportChange()
|
||||
{
|
||||
FilterChanged.InvokeAsync(SelFilterDossier);
|
||||
}
|
||||
|
||||
private void toggleShowParams()
|
||||
{
|
||||
showParam = !showParam;
|
||||
}
|
||||
|
||||
#endregion Private Methods
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,339 @@
|
||||
@using MP.INVE.Components
|
||||
@using MP.INVE.Data
|
||||
|
||||
|
||||
|
||||
|
||||
@if (ListRecords == null)
|
||||
{
|
||||
<LoadingData></LoadingData>
|
||||
}
|
||||
else if (totalCount == 0)
|
||||
{
|
||||
<div class="alert alert-warning text-center display-4">Nessun record trovato</div>
|
||||
}
|
||||
else
|
||||
{
|
||||
<!-- INIZIO: MODIFICA FLUSSO -->
|
||||
@if (currFluxLogDto != null)
|
||||
{
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="card mb-5">
|
||||
<div class="card-header bg-primary text-light d-flex justify-content-between">
|
||||
<div>
|
||||
Modifica Parametro
|
||||
</div>
|
||||
<div>
|
||||
@if (isEditing)
|
||||
{
|
||||
<span class="text-light">PENDING CHANGES...</span>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div class="row">
|
||||
<div class="col-3 pe-0">
|
||||
<div class="input-group input-group-sm">
|
||||
<span class="input-group-text" id="inputGroup-sizing-sm">MACCHINA</span>
|
||||
<input type="text" class="form-control" disabled aria-label="Art search" aria-describedby="inputGroup-sizing-sm" @bind-value="@currFluxLogDto.IdxMacchina">
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-3 pe-0">
|
||||
<div class="input-group input-group-sm">
|
||||
<span class="input-group-text" id="inputGroup-sizing-sm">DATA</span>
|
||||
<input type="text" class="form-control" disabled aria-label="Art search" aria-describedby="inputGroup-sizing-sm" @bind-value="@currFluxLogDto.dtEvento">
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-3 pe-0">
|
||||
<div class="input-group input-group-sm">
|
||||
<span class="input-group-text" id="inputGroup-sizing-sm">DATA TYPE</span>
|
||||
<input type="text" class="form-control" disabled aria-label="Art search" aria-describedby="inputGroup-sizing-sm" @bind-value="@currFluxLogDto.CodFlux">
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-3 pe-0">
|
||||
<div class="input-group input-group-sm">
|
||||
<span class="input-group-text" id="inputGroup-sizing-sm">VALORE</span>
|
||||
<input type="text" class="form-control" aria-label="Art search" aria-describedby="inputGroup-sizing-sm" @bind-value="@currFluxLogDto.ValoreEdit" @onclick="()=> enableEditing()">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row pt-4" style="visibility: @css()">
|
||||
<div class="col-3 pe-0">
|
||||
</div>
|
||||
<div class="col-3 pe-0">
|
||||
</div>
|
||||
<div class="col-3 pe-0">
|
||||
<div class="d-grid gap-2">
|
||||
<button @onclick="() => cancel()" class="btn btn-warning">Annulla <i class="bi bi-x-circle"></i></button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-3 pe-0">
|
||||
<div class="d-grid gap-2">
|
||||
<button @onclick="() => update(currFluxLogDto)" class="btn btn-success">Save <i class="bi bi-save"></i></button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
|
||||
<!-- FINE: MODIFICA FLUSSO -->
|
||||
<!-- INIZIO: NUOVO DOSSIER -->
|
||||
@if (currRecordClone != null)
|
||||
{
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="card mb-5">
|
||||
<div class="card-header bg-primary text-light d-flex justify-content-between">
|
||||
<div>
|
||||
Nuovo Dossier
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<!--INIZIO PRIMA RIGA-->
|
||||
<div class="row">
|
||||
<div class="col-4 pe-0">
|
||||
<div class="input-group input-group-sm">
|
||||
<span class="input-group-text" id="inputGroup-sizing-sm">MACCHINA</span>
|
||||
<select @bind="@currRecordClone.IdxMacchina" class="form-select" id="macchina" title="Selezionare la macchina" @onclick="()=> enableEditing()">
|
||||
@if (ListMacchine != null)
|
||||
{
|
||||
foreach (var item in ListMacchine)
|
||||
{
|
||||
@if (item.IdxMacchina == currRecordClone.IdxMacchina)
|
||||
{
|
||||
|
||||
<option value="@item.IdxMacchina" selected>@item.IdxMacchina | @item.Descrizione</option>
|
||||
}
|
||||
else
|
||||
{
|
||||
<option value="@item.IdxMacchina">@item.IdxMacchina | @item.Descrizione</option>
|
||||
}
|
||||
}
|
||||
}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-4 pe-0">
|
||||
<div class="input-group input-group-sm">
|
||||
<span class="input-group-text" id="inputGroup-sizing-sm">FASE</span>
|
||||
<select class="form-select" @bind="@currRecordClone.KeyRichiesta" @onclick="()=> enableEditing()" title="Selezionare la fase">
|
||||
@if (ListStati != null)
|
||||
{
|
||||
foreach (var item in ListStati)
|
||||
{
|
||||
@if (item.value == currRecordClone.KeyRichiesta)
|
||||
{
|
||||
<option value="@item.value" selected>@item.label</option>
|
||||
}
|
||||
else
|
||||
{
|
||||
<option value="@item.value">@item.label</option>
|
||||
}
|
||||
}
|
||||
}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-4 pe-0">
|
||||
<div class="input-group input-group-sm">
|
||||
<span class="input-group-text" id="inputGroup-sizing-sm" @onclick="()=> enableEditing()">ARTICOLI</span>
|
||||
|
||||
<select @bind="@currRecordClone.CodArticolo" class="form-select" id="macchina" title="Selezionare l'articolo">
|
||||
@if (ListArticoli != null)
|
||||
{
|
||||
foreach (var item in ListArticoli)
|
||||
{
|
||||
@if (item.CodArticolo == currRecordClone.CodArticolo)
|
||||
{
|
||||
<option value="@item.CodArticolo" selected>@item.CodArticolo | @item.DescArticolo</option>
|
||||
}
|
||||
else
|
||||
{
|
||||
<option value="@item.CodArticolo">@item.CodArticolo | @item.DescArticolo</option>
|
||||
}
|
||||
}
|
||||
}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!--FINE PRIMA RIGA-->
|
||||
|
||||
|
||||
<div class="row pt-4">
|
||||
<div class="col-3 pe-0">
|
||||
</div>
|
||||
<div class="col-3 pe-0">
|
||||
</div>
|
||||
<div class="col-3 pe-0">
|
||||
<div class="d-grid gap-2">
|
||||
<button @onclick="() => cancelNewDoss()" class="btn btn-warning">Annulla <i class="bi bi-x-circle"></i></button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-3 pe-0">
|
||||
<div class="d-grid gap-2">
|
||||
<button @onclick="() => newDossier(currRecordClone)" class="btn btn-success">Save <i class="bi bi-save"></i></button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
|
||||
|
||||
<!-- FINE: NUOVO DOSSIER -->
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="row">
|
||||
<div class="d-flex justify justify-content-between">
|
||||
<table class="table table-sm table-striped small">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>
|
||||
<div class="text-nowrap">
|
||||
|
||||
@if (currRecord != null)
|
||||
{
|
||||
<button @onclick="() => closeTableFlux()" class="btn btn-primary btn-sm"><i class="bi bi-arrow-counterclockwise"></i></button>
|
||||
<button @onclick="()=> cloneRecord(currRecord)" class="btn btn-info btn-sm" title="Duplica Record"><i class="bi bi-clipboard-check"></i></button>
|
||||
}
|
||||
</div>
|
||||
</th>
|
||||
<th><i class="fa-solid fa-file"></i> Articolo</th>
|
||||
<th><i class="fa-solid fa-screwdriver-wrench"></i> Fase</th>
|
||||
<th><i class="fa-solid fa-hard-drive"></i> Macchina</th>
|
||||
<th><i class="fa-regular fa-calendar-days"></i> Data Snap</th>
|
||||
<th><i class="fa-solid fa-sliders"></i> ODL</th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach (var record in ListRecords)
|
||||
{
|
||||
<tr class="@checkSelect(@record)">
|
||||
<td>
|
||||
@if (isEditing == false)
|
||||
{
|
||||
<!--SEL RECORD PER VISUALIZZAZIONE FLUSSI-->
|
||||
<button class="btn btn-primary btn-sm" @onclick="() => selRecord(record)"><i class="fa-solid fa-magnifying-glass"></i></button>
|
||||
<!--SEL RECORD PER CLONA DOSSIER-->
|
||||
@*<button @onclick="()=> cloneRecord(record)" class="btn btn-info btn-sm" title="Duplica Record"><i class="bi bi-clipboard-check"></i></button>*@
|
||||
}
|
||||
else
|
||||
{
|
||||
<button class="btn btn-secondary btn-sm disabled"><i class="fa-solid fa-magnifying-glass"></i></button>
|
||||
}
|
||||
</td>
|
||||
<td>
|
||||
@record.CodArticolo
|
||||
<div class="small textConsensed text-secondary">@record.ArticoloNav.DescArticolo</div>
|
||||
</td>
|
||||
<td>
|
||||
@tradFase(record.KeyRichiesta)
|
||||
</td>
|
||||
<td>
|
||||
@record.IdxMacchina
|
||||
@*<div class="small textConsensed text-secondary">@record.MachineNav.Descrizione</div>*@
|
||||
</td>
|
||||
<td>
|
||||
@record.DtRif
|
||||
</td>
|
||||
<td>
|
||||
@record.IdxODL
|
||||
</td>
|
||||
<td>
|
||||
@if (isEditing == false)
|
||||
{
|
||||
|
||||
<button @onclick="() => deleteRecord(record)" class="btn btn-danger btn-sm"><i class="bi bi-trash-fill"></i></button>
|
||||
}
|
||||
else
|
||||
{
|
||||
<button class="btn btn-secondary btn-sm disabled"><i class="bi bi-trash-fill"></i></button>
|
||||
|
||||
}
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
@if (!visualizzaFlux)
|
||||
{
|
||||
if (listaFlux == null)
|
||||
{
|
||||
<div class="alert alert-warning text-center display-4">Nessun record trovato</div>
|
||||
}
|
||||
else
|
||||
{
|
||||
<div class="table selBlock p-2">
|
||||
<table class="table table-light table-sm table-striped small mb-0">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>
|
||||
<button class="btn btn-info" @onclick="() => closeTableFlux()"><i class="fa-solid fa-xmark"></i></button>
|
||||
</th>
|
||||
<th><i class="fa-solid fa-hard-drive"></i> Macchina</th>
|
||||
<th><i class="fa-regular fa-calendar-days"></i> Data</th>
|
||||
<th><i class="fa-solid fa-sliders"></i> Data Type</th>
|
||||
<th style="text-align: right;">
|
||||
<span class="col-11"> Valore </span>
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach (var record in listaFlux)
|
||||
{
|
||||
<tr class="@checkSelPar(@record)">
|
||||
<td>
|
||||
<button @onclick="() => editRecord(record)" class="btn btn-primary btn-sm" title="Modifica Record"><i class="bi bi-pencil-square"></i></button>
|
||||
</td>
|
||||
<td>
|
||||
@record.IdxMacchina
|
||||
</td>
|
||||
<td>
|
||||
@record.dtEvento
|
||||
</td>
|
||||
<td>
|
||||
@traduci(record.CodFlux)
|
||||
<div class="small textConsensed text-secondary" title="Valore Registrato">@record.CodFlux</div>
|
||||
</td>
|
||||
<td style="text-align: right;">
|
||||
@if (record.ValoreEdit != record.Valore)
|
||||
{
|
||||
<div title="Valore Modificato"><span class="small text-dark"></span><b>@record.ValoreEdit</b></div>
|
||||
<div class="small text-secondary" title="Valore Registrato">(<i>@record.Valore</i>)</div>
|
||||
}
|
||||
else
|
||||
{
|
||||
<div><span class="small text-dark"></span>@record.ValoreEdit</div>
|
||||
}
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
}
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,459 @@
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using Microsoft.JSInterop;
|
||||
using MP.Data.DatabaseModels;
|
||||
using MP.Data.DTO;
|
||||
using MP.INVE.Data;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace MP.INVE.Components
|
||||
{
|
||||
public partial class ListDossiers : IDisposable
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
[Parameter]
|
||||
public EventCallback<DossierModel> RecordSel { get; set; }
|
||||
|
||||
[Parameter]
|
||||
public EventCallback<FluxLogDTO> RecordSelFlux { get; set; }
|
||||
|
||||
[Parameter]
|
||||
public SelectDossierParams SelFilter { get; set; } = null!;
|
||||
|
||||
[Parameter]
|
||||
public EventCallback<int> TotRecordChanged { get; set; }
|
||||
|
||||
#endregion Public Properties
|
||||
|
||||
#region Public Methods
|
||||
|
||||
public string checkSelect(DossierModel recordSel)
|
||||
{
|
||||
string answ = "";
|
||||
if (currRecord != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
answ = (currRecord.IdxMacchina == recordSel.IdxMacchina && currRecord.DtRif == recordSel.DtRif) ? "table-info" : "";
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
public string checkSelPar(FluxLogDTO recordSel)
|
||||
{
|
||||
string answ = "";
|
||||
if (currFluxLogDto != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
answ = (currFluxLogDto.CodFlux == recordSel.CodFlux && currFluxLogDto.dtEvento == recordSel.dtEvento) ? "table-info" : "";
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
currRecord = null;
|
||||
SearchRecords = null;
|
||||
ListRecords = null;
|
||||
GC.Collect();
|
||||
}
|
||||
|
||||
public async Task flushCache()
|
||||
{
|
||||
await Task.Delay(1);
|
||||
await MDService.FlushRedisCache();
|
||||
await Task.Delay(1);
|
||||
// rimando a pagina corrente
|
||||
NavManager.NavigateTo(NavManager.Uri, true);
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
|
||||
#region Protected Properties
|
||||
|
||||
[Inject]
|
||||
protected IJSRuntime JSRuntime { get; set; } = null!;
|
||||
|
||||
[Inject]
|
||||
protected MpDataService MDService { get; set; } = null!;
|
||||
|
||||
#endregion Protected Properties
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
protected async Task cancel()
|
||||
{
|
||||
var alert = await JSRuntime.InvokeAsync<bool>("confirm", "Confermi di voler annullare TUTTE le modifiche? i dati saranno ricaricati.");
|
||||
if (alert)
|
||||
{
|
||||
currFluxLogDto = null;
|
||||
isEditing = false;
|
||||
await Task.Delay(1);
|
||||
if (currRecord != null)
|
||||
{
|
||||
listaFlux = MDService.getFluxLog(currRecord.Valore);
|
||||
}
|
||||
StateHasChanged();
|
||||
}
|
||||
}
|
||||
|
||||
protected async Task cancelNewDoss()
|
||||
{
|
||||
var alert = await JSRuntime.InvokeAsync<bool>("confirm", "Confermi di voler annullare l'aggiunta di un nuovo dossier? i dati saranno ricaricati.");
|
||||
if (alert)
|
||||
{
|
||||
currRecordClone = null;
|
||||
isEditing = false;
|
||||
await Task.Delay(1);
|
||||
StateHasChanged();
|
||||
}
|
||||
}
|
||||
|
||||
protected async Task cloneRecord(DossierModel selRec)
|
||||
{
|
||||
// creo record duplicato...
|
||||
DossierModel newRec = new DossierModel()
|
||||
{
|
||||
//IdxDossier = 0,
|
||||
DataType = selRec.DataType,
|
||||
KeyRichiesta = selRec.KeyRichiesta,
|
||||
DtRif = DateTime.Now,
|
||||
IdxMacchina = selRec.IdxMacchina,
|
||||
CodArticolo = selRec.CodArticolo,
|
||||
IdxODL = 0,
|
||||
Valore = selRec.Valore
|
||||
};
|
||||
currRecordClone = newRec;
|
||||
await Task.Delay(1);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Eliminazione record selezionato (previa conferma)
|
||||
/// </summary>
|
||||
/// <param name="selRec"></param>
|
||||
/// <returns></returns>
|
||||
protected async Task deleteRecord(DossierModel selRec)
|
||||
{
|
||||
if (!await JSRuntime.InvokeAsync<bool>("confirm", "Eliminazione Dossier: sei sicuro di voler procedere?"))
|
||||
return;
|
||||
await Task.Delay(1);
|
||||
var done = await MDService.DossiersDeleteRecord(selRec);
|
||||
currRecord = null;
|
||||
await reloadData(true);
|
||||
visualizzaFlux = true;
|
||||
await Task.Delay(1);
|
||||
}
|
||||
|
||||
protected async Task editRecord(FluxLogDTO selRec)
|
||||
{
|
||||
currFluxLogDto = selRec;
|
||||
// indico record selezionato
|
||||
await RecordSelFlux.InvokeAsync(selRec);
|
||||
}
|
||||
|
||||
protected async Task newDossier(DossierModel selRec)
|
||||
{
|
||||
var alert = await JSRuntime.InvokeAsync<bool>("confirm", "Confermi di voler creare un nuovo Dossier per l'impianto/articolo selezionato?");
|
||||
|
||||
if (alert)
|
||||
{
|
||||
await Task.Delay(1);
|
||||
if (currRecordClone != null)
|
||||
{
|
||||
// serializzo valore x flux log...
|
||||
|
||||
DossierFluxLogDTO? valoreDeserializzato = JsonConvert.DeserializeObject<DossierFluxLogDTO>(selRec.Valore);
|
||||
if (valoreDeserializzato != null)
|
||||
{
|
||||
listaFlux = valoreDeserializzato
|
||||
.ODL
|
||||
.OrderBy(x => x.CodFlux)
|
||||
.ToList();
|
||||
}
|
||||
|
||||
if (listaFlux != null)
|
||||
{
|
||||
foreach (var item in listaFlux)
|
||||
{
|
||||
item.IdxMacchina = selRec.IdxMacchina;
|
||||
item.Valore = "0";
|
||||
item.ValoreEdit = "0";
|
||||
item.dtEvento = DateTime.Now;
|
||||
}
|
||||
}
|
||||
|
||||
DossierFluxLogDTO updatedResult = new DossierFluxLogDTO() { ODL = listaFlux };
|
||||
string newVal = JsonConvert.SerializeObject(updatedResult);
|
||||
// preparo x insert
|
||||
currRecordClone.DtRif = DateTime.Now;
|
||||
currRecordClone.IdxMacchina = selRec.IdxMacchina;
|
||||
currRecordClone.CodArticolo = selRec.CodArticolo;
|
||||
currRecordClone.KeyRichiesta = selRec.KeyRichiesta;
|
||||
currRecordClone.Valore = newVal;
|
||||
// METODO PER INSERT DOSSIER + FLUX
|
||||
await MDService.DossiersInsert(currRecordClone);
|
||||
//await reloadData(true);
|
||||
currRecordClone = null;
|
||||
isEditing = false;
|
||||
await Task.Delay(1);
|
||||
await flushCache();
|
||||
}
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
currRecordClone = null;
|
||||
await Task.Delay(1);
|
||||
NavManager.NavigateTo(NavManager.Uri, true);
|
||||
}
|
||||
}
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
ListGruppiFase = await MDService.ElencoGruppiFase();
|
||||
ListStati = await MDService.AnagStatiComm();
|
||||
ListArticoli = await MDService.ArticoliGetSearch(100000, "BAGLIETTO", "");
|
||||
ListMacchine = await MDService.MacchineGetAll();
|
||||
await reloadData(true);
|
||||
}
|
||||
|
||||
protected override async Task OnParametersSetAsync()
|
||||
{
|
||||
if (!lastFilter.Equals(SelFilter))
|
||||
{
|
||||
lastFilter = SelFilter.clone();
|
||||
await reloadData(true);
|
||||
}
|
||||
}
|
||||
|
||||
protected async void OnSeachUpdated()
|
||||
{
|
||||
await InvokeAsync(() =>
|
||||
{
|
||||
currPage = 1;
|
||||
StateHasChanged();
|
||||
});
|
||||
}
|
||||
|
||||
protected async Task selRecord(DossierModel selRec)
|
||||
{
|
||||
currRecord = selRec;
|
||||
await RecordSel.InvokeAsync(selRec);
|
||||
listaFlux = MDService.getFluxLog(selRec.Valore);
|
||||
await toggleTableFlux();
|
||||
}
|
||||
|
||||
protected async Task update(FluxLogDTO selRec)
|
||||
{
|
||||
var alert = await JSRuntime.InvokeAsync<bool>("confirm", "Confermi di voler salvare TUTTE le modifiche? queste saranno parte del dossier inviato all'impianto");
|
||||
|
||||
if (alert)
|
||||
{
|
||||
await Task.Delay(1);
|
||||
if (currRecord != null)
|
||||
{
|
||||
// serializzo valore x flux log...
|
||||
DossierFluxLogDTO updatedResult = new DossierFluxLogDTO() { ODL = listaFlux };
|
||||
string newVal = JsonConvert.SerializeObject(updatedResult);
|
||||
currRecord.Valore = newVal;
|
||||
// METODO PER UPDATE FLUX
|
||||
await MDService.DossiersUpdateValore(currRecord);
|
||||
currFluxLogDto = null;
|
||||
isEditing = false;
|
||||
await Task.Delay(1);
|
||||
StateHasChanged();
|
||||
}
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
currFluxLogDto = null;
|
||||
await Task.Delay(1);
|
||||
// rimando a pagina corrente
|
||||
NavManager.NavigateTo(NavManager.Uri, true);
|
||||
}
|
||||
}
|
||||
|
||||
protected async Task UpdateData()
|
||||
{
|
||||
currRecord = null;
|
||||
await reloadData(true);
|
||||
}
|
||||
|
||||
#endregion Protected Methods
|
||||
|
||||
#region Private Fields
|
||||
|
||||
private int _totalCount = 0;
|
||||
|
||||
private FluxLogDTO? currFluxLogDto = null;
|
||||
|
||||
private DossierModel? currRecord = null;
|
||||
|
||||
private DossierModel? currRecordClone = null;
|
||||
|
||||
private List<AnagArticoli>? ListArticoli;
|
||||
private List<AnagGruppi>? ListGruppiFase;
|
||||
|
||||
private List<Macchine>? ListMacchine;
|
||||
private List<DossierModel>? ListRecords;
|
||||
|
||||
private List<ListValues>? ListStati;
|
||||
|
||||
private List<DossierModel>? SearchRecords;
|
||||
|
||||
#endregion Private Fields
|
||||
|
||||
#region Private Properties
|
||||
|
||||
private int currPage
|
||||
{
|
||||
get => SelFilter.CurrPage;
|
||||
set => SelFilter.CurrPage = value;
|
||||
}
|
||||
|
||||
private bool isEditing
|
||||
{
|
||||
get => SelFilter.isEditing;
|
||||
set => SelFilter.isEditing = value;
|
||||
}
|
||||
|
||||
private bool isLoading { get; set; } = false;
|
||||
|
||||
private SelectDossierParams lastFilter { get; set; } = new SelectDossierParams() { CurrPage = -1 };
|
||||
|
||||
private List<FluxLogDTO>? listaFlux { get; set; } = null;
|
||||
|
||||
private int MaxRecord
|
||||
{
|
||||
get => SelFilter.MaxRecord;
|
||||
}
|
||||
|
||||
[Inject]
|
||||
private NavigationManager NavManager { get; set; } = null!;
|
||||
|
||||
private int numRecord
|
||||
{
|
||||
get => SelFilter.NumRec;
|
||||
set => SelFilter.NumRec = value;
|
||||
}
|
||||
|
||||
private string SelArticolo
|
||||
{
|
||||
get => SelFilter.CodArticolo;
|
||||
}
|
||||
|
||||
private DateTime SelDtEnd
|
||||
{
|
||||
get => SelFilter.DtEnd;
|
||||
}
|
||||
|
||||
private DateTime SelDtStart
|
||||
{
|
||||
get => SelFilter.DtStart;
|
||||
}
|
||||
|
||||
private string SelMacchina
|
||||
{
|
||||
get => SelFilter.IdxMacchina;
|
||||
}
|
||||
|
||||
private int totalCount
|
||||
{
|
||||
get => _totalCount;
|
||||
set
|
||||
{
|
||||
if (_totalCount != value)
|
||||
{
|
||||
_totalCount = value;
|
||||
TotRecordChanged.InvokeAsync(value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private bool visualizzaFlux { get; set; } = true;
|
||||
|
||||
#endregion Private Properties
|
||||
|
||||
#region Private Methods
|
||||
|
||||
private async Task closeTableFlux()
|
||||
{
|
||||
currFluxLogDto = null;
|
||||
currRecord = null;
|
||||
currRecordClone = null;
|
||||
visualizzaFlux = true;
|
||||
isEditing = false;
|
||||
await RecordSelFlux.InvokeAsync(currFluxLogDto);
|
||||
await Task.Delay(1);
|
||||
}
|
||||
|
||||
private string css()
|
||||
{
|
||||
string answ = "";
|
||||
if (isEditing)
|
||||
{
|
||||
answ = "visible";
|
||||
}
|
||||
else
|
||||
{
|
||||
answ = "hidden";
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
private void enableEditing()
|
||||
{
|
||||
isEditing = true;
|
||||
}
|
||||
|
||||
private async Task reloadData(bool setChanged)
|
||||
{
|
||||
isLoading = true;
|
||||
SearchRecords = await MDService.DossiersGetLastFilt(SelMacchina, SelArticolo, SelDtStart, SelDtEnd);
|
||||
totalCount = SearchRecords.Count;
|
||||
ListRecords = SearchRecords.Skip(numRecord * (currPage - 1)).Take(numRecord).ToList();
|
||||
await Task.Delay(1);
|
||||
if (setChanged)
|
||||
{
|
||||
await InvokeAsync(() => StateHasChanged());
|
||||
}
|
||||
isLoading = false;
|
||||
}
|
||||
|
||||
private async Task toggleTableFlux()
|
||||
{
|
||||
visualizzaFlux = false;
|
||||
await Task.Delay(1);
|
||||
}
|
||||
|
||||
private string tradFase(string codFase)
|
||||
{
|
||||
string answ = codFase;
|
||||
if (ListStati != null && ListStati.Count > 0)
|
||||
{
|
||||
var recSel = ListStati.FirstOrDefault(x => x.value == codFase);
|
||||
if (recSel != null)
|
||||
{
|
||||
answ = recSel.label;
|
||||
}
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
private string traduci(string lemma)
|
||||
{
|
||||
var answ = MDService.Traduci(lemma, "IT");
|
||||
return answ;
|
||||
}
|
||||
|
||||
#endregion Private Methods
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,269 @@
|
||||
@using MP.INVE.Components
|
||||
@using MP.INVE.Data
|
||||
|
||||
@if (ListRecords == null)
|
||||
{
|
||||
<LoadingData></LoadingData>
|
||||
}
|
||||
else if (totalCount == 0)
|
||||
{
|
||||
<div class="alert alert-warning text-center display-4">Nessun record trovato</div>
|
||||
}
|
||||
else
|
||||
{
|
||||
<div class="row">
|
||||
@if (currRecord != null && !showStats && isCurrOdl)
|
||||
{
|
||||
<div class="col-6 col-lg-8">
|
||||
<button @onclick="() => forceSyncDb()" class="btn btn-success btn-sm btn-">Forza sync dati ODL <i class="bi bi-fast-forward-circle"></i></button>
|
||||
</div>
|
||||
<div class="col-6 col-lg-4 text-end">
|
||||
<button @onclick="() => chiudiOdl()" class="btn btn-danger btn-sm btn-">Registra chiusura ODL <i class="far fa-stop-circle"></i></button>
|
||||
</div>
|
||||
}
|
||||
<div class="col-12">
|
||||
<table class="table table-sm table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>
|
||||
@if (currRecord != null)
|
||||
{
|
||||
<button @onclick="() => resetSel()" class="btn btn-primary btn-sm"><i class="bi bi-arrow-counterclockwise"></i></button>
|
||||
}
|
||||
</th>
|
||||
<th>Cod</th>
|
||||
<th><i class="fa-solid fa-file"></i> Articolo</th>
|
||||
<th><i class="fa-solid fa-screwdriver-wrench"></i> Fase</th>
|
||||
<th><i class="fa-solid fa-hard-drive"></i> Macchina</th>
|
||||
<th><i class="fa-solid fa-circle-info"></i> Info ciclo</th>
|
||||
<th><i class="fa-solid fa-calendar-day"></i> Periodo</th>
|
||||
<th title="Durata in ore:min"><i class="fa-solid fa-clock"></i> Durata</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach (var record in ListRecords)
|
||||
{
|
||||
<tr class="@checkSelect(@record.IdxOdl)">
|
||||
<td>
|
||||
@if (isCurrOdl)
|
||||
{
|
||||
<button class="btn btn-primary btn-sm" @onclick="() => selRecord(record)"><i class="fa-solid fa-magnifying-glass"></i></button>
|
||||
}
|
||||
else
|
||||
{
|
||||
<button class="btn btn-secondary btn-sm disabled"><i class="fa-solid fa-magnifying-glass"></i></button>
|
||||
}
|
||||
</td>
|
||||
<td>
|
||||
<div class="small"><b>ODL</b> @($"{record.IdxOdl:000000}")</div>
|
||||
<div class="small"><b>PODL</b> @($"{getPodl(record.IdxOdl):000000}")</div>
|
||||
</td>
|
||||
<td>
|
||||
@record.CodArticolo
|
||||
<div class="small textConsensed text-secondary">@record.ArticoloNav.DescArticolo</div>
|
||||
</td>
|
||||
<td>
|
||||
<div>
|
||||
@tradFase(record.KeyRichiesta)
|
||||
</div>
|
||||
@if (record.Note != "")
|
||||
{
|
||||
<div class="small textConsensed text-secondary badge text-bg-light border border-secondary rounded">
|
||||
<b class="text-dark"></b> <span class="text-wrap text-start"> @record.Note </span>
|
||||
</div>
|
||||
}
|
||||
</td>
|
||||
|
||||
<td>
|
||||
@record.IdxMacchina
|
||||
<div class="small textConsensed text-secondary">@record.MachineNav.Descrizione</div>
|
||||
</td>
|
||||
<td>
|
||||
<div class="small textConsensed"><b>N° pezzi:</b> @record.NumPezzi</div>
|
||||
<div class="small textConsensed"><b>T. Ciclo:</b> @record.Tcassegnato.ToString("N3")</div>
|
||||
|
||||
</td>
|
||||
<td>
|
||||
<div class="small d-flex justify-content-between">
|
||||
<div>
|
||||
<div><b>@($"{@record.DataInizio:yyyy/MM/dd}")</b></div>
|
||||
<div>@($"{@record.DataInizio:ddd HH:mm:ss}")</div>
|
||||
</div>
|
||||
<div class="p-0">
|
||||
<i class="fa-solid fa-angles-right"></i>
|
||||
</div>
|
||||
<div>
|
||||
@if (@record.DataFine != null)
|
||||
{
|
||||
<div><b>@($"{@record.DataFine:yyyy/MM/dd}")</b></div>
|
||||
<div>@($"{@record.DataFine:ddd HH:mm:ss}")</div>
|
||||
}
|
||||
else
|
||||
{
|
||||
<div class="text-secondary">
|
||||
<div><b>@($"{DateTime.Now:yyyy/MM/dd}")</b></div>
|
||||
<div>@($"{DateTime.Now:ddd HH:mm:ss}")</div>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<div>
|
||||
<b>@record.DurataMinuti</b>
|
||||
</div>
|
||||
<div>
|
||||
<button class="btn btn-sm btn-primary py-0" type="button" @onclick="() => selectStatRecord(record)" data-bs-toggle="modal" data-bs-target="#myModal" title="Mostra statistiche"><i class="fa-solid fa-chart-pie"></i></button>
|
||||
</div>
|
||||
<!-- Modal -->
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
<div class="modal fade" id="myModal" tabindex="-1" aria-labelledby="staticBackdropLabel" aria-hidden="true">
|
||||
<div class="modal-dialog modal-dialog-centered modal-xl">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header bg-primary col-12">
|
||||
@if (statRecord != null)
|
||||
{
|
||||
<div class="col-3">
|
||||
<div class="modal-title fs-2" id="staticBackdropLabel"><b>ODL @($"{statRecord.IdxOdl:000000}")</b></div>
|
||||
<div class="small text-light">PODL @($"{getPodl(statRecord.IdxOdl):000000}")</div>
|
||||
</div>
|
||||
<div class="col-6 fs-5">
|
||||
<b>@statRecord.CodArticolo</b>
|
||||
<div class="small textConsensed text-light">@statRecord.ArticoloNav.DescArticolo</div>
|
||||
</div>
|
||||
<div class="col-2 fs-5">
|
||||
<b>@statRecord.IdxMacchina</b>
|
||||
<div class="small textConsensed text-light">@statRecord.MachineNav.Descrizione</div>
|
||||
</div>
|
||||
}
|
||||
<div class="col-1 text-end">
|
||||
<button type="button" class="btn btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-body col-12">
|
||||
@if (statRecord != null && showStats)
|
||||
{
|
||||
<div class="d-flex justify-content-between">
|
||||
<div class="col-8">
|
||||
<div>
|
||||
<table class="table">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td style="width: 270px">
|
||||
<div class="small textConsensed"><b>N° pezzi:</b> @statRecord.NumPezzi</div>
|
||||
<div class="small textConsensed"><b>T. Ciclo:</b> @statRecord.Tcassegnato.ToString("N3")</div>
|
||||
</td>
|
||||
<td style="width: 300px">
|
||||
<div class="small d-flex justify-content-between">
|
||||
<div>
|
||||
<div><b>@($"{@statRecord.DataInizio:yyyy/MM/dd}")</b></div>
|
||||
<div>@($"{@statRecord.DataInizio:ddd HH:mm:ss}")</div>
|
||||
</div>
|
||||
<div class="p-0">
|
||||
<i class="fa-solid fa-angles-right"></i>
|
||||
</div>
|
||||
<div>
|
||||
@if (@statRecord.DataFine != null)
|
||||
{
|
||||
<div><b>@($"{@statRecord.DataFine:yyyy/MM/dd}")</b></div>
|
||||
<div>@($"{@statRecord.DataFine:ddd HH:mm:ss}")</div>
|
||||
}
|
||||
else
|
||||
{
|
||||
<div class="text-secondary">
|
||||
<div><b>@($"{DateTime.Now:yyyy/MM/dd}")</b></div>
|
||||
<div>@($"{DateTime.Now:ddd HH:mm:ss}")</div>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div>
|
||||
<table class="table">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<div>
|
||||
@tradFase(statRecord.KeyRichiesta)
|
||||
</div>
|
||||
@if (statRecord.Note != "")
|
||||
{
|
||||
<div class="small textConsensed text-secondary badge text-bg-light border border-secondary rounded">
|
||||
<b class="text-dark"></b> <span class="text-wrap text-start"> @statRecord.Note </span>
|
||||
</div>
|
||||
}
|
||||
</td>
|
||||
<td>
|
||||
<div class="input-group input-group-sm">
|
||||
<div class="input-group-text">
|
||||
<span class="me-1 @leftStringCSS">Tutti gli Stati</span>
|
||||
<span class="form-check form-check-sm form-switch py-1" title="Mostra/Nascondi macchina spenta">
|
||||
<input class="form-check-input" type="checkbox" id="switchSpenta" @onchange="() => toggleSpenta()" value="@hideSpenta">
|
||||
</span>
|
||||
<span class="@rightStringCSS">Nascondi Spenta</span>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div>
|
||||
@if (statRecord != null)
|
||||
{
|
||||
@if (ListOdlStatsAct != null)
|
||||
{
|
||||
@foreach (var stat in ListOdlStatsAct)
|
||||
{
|
||||
<div class="p-1">
|
||||
<div class="d-flex justify-content-between">
|
||||
<div class="text-uppercase">
|
||||
@stat.Descrizione
|
||||
</div>
|
||||
<div>
|
||||
<b>@(formDurata(stat.TotDurata))</b>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="progress">
|
||||
<div class="progress-bar @colorChanger(@stat.Css)" role="progressbar" aria-valuenow="0" aria-valuemin="0" style="width: @Math.Round(calcolaPerc(stat.TotDurata),0)%; background-color:@pbStyle(@stat.Css);" aria-valuemax="100">@($"{calcolaPerc(stat.TotDurata):N1}%")</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-4 dcContainer">
|
||||
@if (statRecord != null && ListOdlStats != null)
|
||||
{
|
||||
<div class="dcBox">
|
||||
<ODLPlot SelectedOdl="@statRecord.IdxOdl" hideSpenta="@hideSpenta"></ODLPlot>
|
||||
</div>
|
||||
<div class="dcBox dcOverlay d-flex">
|
||||
<div class="align-self-center text-center w-100">
|
||||
<b class="fs-3">@durataFilt</b>
|
||||
@*<b class="fs-3">@statRecord.DurataMinuti</b>*@
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
|
||||
@@ -0,0 +1,448 @@
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using Microsoft.JSInterop;
|
||||
using MP.Data.DatabaseModels;
|
||||
using MP.INVE.Data;
|
||||
using MP.INVE.Services;
|
||||
using NLog;
|
||||
|
||||
namespace MP.INVE.Components
|
||||
{
|
||||
public partial class ListODL : IDisposable
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
[Parameter]
|
||||
public SelectOdlParams currFilter { get; set; } = null!;
|
||||
|
||||
[Parameter]
|
||||
public EventCallback<bool> PagerResetReq { get; set; }
|
||||
|
||||
[Parameter]
|
||||
public EventCallback<int> updateRecordCount { get; set; }
|
||||
|
||||
#endregion Public Properties
|
||||
|
||||
#region Public Methods
|
||||
|
||||
public string checkSelect(int IdxOdl)
|
||||
{
|
||||
string answ = "";
|
||||
if (currRecord != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
answ = (currRecord.IdxOdl == IdxOdl) ? "table-info" : "";
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
currRecord = null;
|
||||
SearchRecords = null;
|
||||
ListRecords = null;
|
||||
ListStati = null;
|
||||
ListOdlStats = null;
|
||||
ListOdlStatsNetto = null;
|
||||
statRecord = null;
|
||||
GC.Collect();
|
||||
}
|
||||
|
||||
public string formDurata(double durataMin)
|
||||
{
|
||||
return MP.Data.Utils.FormDurata(durataMin);
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
|
||||
#region Protected Properties
|
||||
|
||||
[Inject]
|
||||
protected IJSRuntime JSRuntime { get; set; } = null!;
|
||||
|
||||
[Inject]
|
||||
protected MpDataService MDService { get; set; } = null!;
|
||||
|
||||
[Inject]
|
||||
protected IOApiService MpIoApiCall { get; set; } = null!;
|
||||
|
||||
#endregion Protected Properties
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
/// <summary>
|
||||
/// Registra chiusura ODL alla data indicata
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
protected async Task chiudiOdl()
|
||||
{
|
||||
if (!await JSRuntime.InvokeAsync<bool>("confirm", "Sei sicuro di voler chiudere l'ODL corrente?"))
|
||||
return;
|
||||
|
||||
if (currRecord != null)
|
||||
{
|
||||
// effettua chiusura sul DB
|
||||
await MDService.ODLClose(currRecord.IdxOdl, currRecord.IdxMacchina, 0, true);
|
||||
Log.Info($"Effettuata chiusura ODL {currRecord.IdxOdl}");
|
||||
// ricarica...
|
||||
await selRecord(null);
|
||||
}
|
||||
await reloadData();
|
||||
}
|
||||
|
||||
protected string colorChanger(string colorCSS)
|
||||
{
|
||||
string answ = "";
|
||||
if (colorCSS == "yellow")
|
||||
{
|
||||
answ = "text-dark";
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Richiesta invio sync all'IOB-WIN
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
protected async Task forceSyncDb()
|
||||
{
|
||||
if (!await JSRuntime.InvokeAsync<bool>("confirm", "Sei sicuro di voler reinviare i dati (Articoli, PODL) all'impianto?"))
|
||||
return;
|
||||
|
||||
if (currRecord != null)
|
||||
{
|
||||
await callSyncDb(currRecord.IdxMacchina);
|
||||
Log.Info($"Richiesto forceSyncDb per idxMacc {currRecord.IdxMacchina}");
|
||||
// ricarica...
|
||||
await selRecord(null);
|
||||
}
|
||||
await reloadData();
|
||||
}
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
ListStati = await MDService.AnagStatiComm();
|
||||
}
|
||||
|
||||
protected override async Task OnParametersSetAsync()
|
||||
{
|
||||
await reloadData();
|
||||
}
|
||||
|
||||
protected async void OnSeachUpdated()
|
||||
{
|
||||
await InvokeAsync(() =>
|
||||
{
|
||||
PagerResetReq.InvokeAsync(true);
|
||||
Task task = UpdateData();
|
||||
StateHasChanged();
|
||||
});
|
||||
}
|
||||
|
||||
protected async Task resetSel()
|
||||
{
|
||||
await selRecord(null);
|
||||
await reloadData();
|
||||
}
|
||||
|
||||
protected async Task selectStatRecord(ODLModel? currRec)
|
||||
{
|
||||
showStats = true;
|
||||
await Task.Delay(1);
|
||||
statRecord = currRec;
|
||||
if (currRec != null)
|
||||
{
|
||||
await reloadStatsData(currRec);
|
||||
}
|
||||
else
|
||||
{
|
||||
showStats = false;
|
||||
ListOdlStats = null;
|
||||
}
|
||||
}
|
||||
|
||||
protected async Task selRecord(ODLModel? currRec)
|
||||
{
|
||||
await Task.Delay(1);
|
||||
selDtFine = DateTime.Now;
|
||||
currRecord = currRec;
|
||||
showStats = false;
|
||||
ListOdlStats = null;
|
||||
ListOdlStatsNetto = null;
|
||||
}
|
||||
|
||||
protected async Task toggleSpenta()
|
||||
{
|
||||
hideSpenta = !hideSpenta;
|
||||
await Task.Delay(1);
|
||||
if (statRecord != null)
|
||||
{
|
||||
await reloadStatsData(statRecord);
|
||||
}
|
||||
}
|
||||
|
||||
protected async Task UpdateData()
|
||||
{
|
||||
await selRecord(null);
|
||||
await reloadData();
|
||||
}
|
||||
|
||||
#endregion Protected Methods
|
||||
|
||||
#region Private Fields
|
||||
|
||||
private static Logger Log = LogManager.GetCurrentClassLogger();
|
||||
|
||||
private ODLModel? currRecord = null;
|
||||
|
||||
private List<StatODLModel>? ListOdlStats;
|
||||
|
||||
private List<StatODLModel>? ListOdlStatsNetto;
|
||||
|
||||
private List<ODLModel>? ListRecords;
|
||||
|
||||
private List<ListValues>? ListStati;
|
||||
|
||||
private List<ODLModel>? SearchRecords;
|
||||
|
||||
private ODLModel? statRecord = null;
|
||||
|
||||
#endregion Private Fields
|
||||
|
||||
#region Private Properties
|
||||
|
||||
private int _totalCount { get; set; } = 0;
|
||||
|
||||
private int currPage
|
||||
{
|
||||
get => currFilter.CurrPage;
|
||||
set => currFilter.CurrPage = value;
|
||||
}
|
||||
|
||||
private string durataFilt
|
||||
{
|
||||
get
|
||||
{
|
||||
string answ = "ND";
|
||||
if (statRecord != null)
|
||||
{
|
||||
if (hideSpenta)
|
||||
{
|
||||
if (ListOdlStatsNetto != null)
|
||||
{
|
||||
var tsDurata = TimeSpan.FromMinutes(ListOdlStatsNetto.Sum(x => x.TotDurata));
|
||||
if (tsDurata.TotalDays < 1)
|
||||
{
|
||||
answ = $"{tsDurata.Hours:00}h {tsDurata.Minutes:00}'";
|
||||
}
|
||||
else
|
||||
{
|
||||
answ = $"{tsDurata.Days}gg {tsDurata.Hours:00}h";
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
answ = statRecord.DurataMinuti;
|
||||
}
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
}
|
||||
|
||||
protected int getPodl(int idxOdl)
|
||||
{
|
||||
int answ = 0;
|
||||
var pOdlData = MDService.PODL_getByOdl(idxOdl);
|
||||
if (pOdlData != null)
|
||||
{
|
||||
answ = pOdlData.IdxPromessa;
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
private bool hideSpenta { get; set; } = false;
|
||||
|
||||
/// <summary>
|
||||
/// Indica se si tratti di ODL correnti
|
||||
/// </summary>
|
||||
private bool isCurrOdl
|
||||
{
|
||||
get => currFilter.IsActive;
|
||||
}
|
||||
|
||||
private bool isLoading { get; set; } = false;
|
||||
|
||||
private string leftStringCSS
|
||||
{
|
||||
get => hideSpenta ? "text-secondary" : "text-dark fw-bold";
|
||||
}
|
||||
|
||||
private List<StatODLModel>? ListOdlStatsAct
|
||||
{
|
||||
get
|
||||
{
|
||||
List<StatODLModel>? answ = new List<StatODLModel>();
|
||||
if (hideSpenta)
|
||||
{
|
||||
answ = ListOdlStatsNetto;
|
||||
}
|
||||
else
|
||||
{
|
||||
answ = ListOdlStats;
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
}
|
||||
|
||||
private int numRecord
|
||||
{
|
||||
get => currFilter.NumRec;
|
||||
set => currFilter.NumRec = value;
|
||||
}
|
||||
|
||||
private string rightStringCSS
|
||||
{
|
||||
get => hideSpenta ? "text-dark fw-bold" : "text-secondary";
|
||||
}
|
||||
|
||||
private DateTime selDtFine { get; set; } = DateTime.Now;
|
||||
|
||||
private bool showStats { get; set; } = false;
|
||||
|
||||
private int totalCount
|
||||
{
|
||||
get => _totalCount;
|
||||
set
|
||||
{
|
||||
if (_totalCount != value)
|
||||
{
|
||||
_totalCount = value;
|
||||
updateRecordCount.InvokeAsync(value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Private Properties
|
||||
|
||||
#region Private Methods
|
||||
|
||||
/// <summary>
|
||||
/// Chiama metodo x chiedere sync DB
|
||||
/// </summary>
|
||||
/// <param name="selRec"></param>
|
||||
/// <returns></returns>
|
||||
private async Task addTask2Exe(string idxMacc, string taskName, string taskVal)
|
||||
{
|
||||
// compongo URL e chiamo
|
||||
string restUrl = $"IOB/addTask2Exe/{idxMacc}?taskName={taskName}&taskVal={taskVal}";
|
||||
try
|
||||
{
|
||||
var response = await MpIoApiCall.callMpIoUrlGet(restUrl);
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Log.Error($"Errore durante chiamata: {Environment.NewLine}{exc}");
|
||||
}
|
||||
}
|
||||
|
||||
private double calcolaPerc(double durata)
|
||||
{
|
||||
double answ = 0;
|
||||
|
||||
double tot = 0;
|
||||
if (ListOdlStatsAct != null)
|
||||
{
|
||||
tot = ListOdlStatsAct.Sum(x => x.TotDurata);
|
||||
|
||||
double perc = (durata / tot) * 100;
|
||||
if (perc > 1)
|
||||
{
|
||||
answ = Math.Round(perc, 2);
|
||||
}
|
||||
else
|
||||
{
|
||||
answ = Math.Round(perc, 4);
|
||||
}
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Chiama metodo x chiedere sync DB
|
||||
/// </summary>
|
||||
/// <param name="IdxMacc"></param>
|
||||
/// <returns></returns>
|
||||
private async Task callSyncDb(string IdxMacc)
|
||||
{
|
||||
// chiamo aggiunta task SyncDb...
|
||||
await addTask2Exe(IdxMacc, "syncDbData", "");
|
||||
}
|
||||
|
||||
private string pbStyle(string css)
|
||||
{
|
||||
string answ = "";
|
||||
if (ListOdlStats != null)
|
||||
{
|
||||
if (css == "yellow")
|
||||
{
|
||||
answ = "orange";
|
||||
}
|
||||
else if (css == "blue")
|
||||
{
|
||||
answ = "#2874A6";
|
||||
}
|
||||
else
|
||||
{
|
||||
answ = css;
|
||||
}
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
private async Task reloadData()
|
||||
{
|
||||
isLoading = true;
|
||||
SearchRecords = await MDService.ListODLFilt(currFilter.IsActive, currFilter.SearchVal, currFilter.CodStato, currFilter.IdxMacchina, currFilter.DtStart, currFilter.DtEnd);
|
||||
totalCount = SearchRecords.Count;
|
||||
ListRecords = SearchRecords.Skip(numRecord * (currPage - 1)).Take(numRecord).ToList();
|
||||
await Task.Delay(1);
|
||||
await InvokeAsync(() => StateHasChanged());
|
||||
isLoading = false;
|
||||
}
|
||||
|
||||
private async Task reloadStatsData(ODLModel? currRec)
|
||||
{
|
||||
showStats = true;
|
||||
if (currRec != null)
|
||||
{
|
||||
ListOdlStats = await MDService.StatOdl(currRec.IdxOdl);
|
||||
ListOdlStatsNetto = ListOdlStats.Where(x => x.Semaforo != "sGr").ToList();
|
||||
}
|
||||
else
|
||||
{
|
||||
ListOdlStats = null;
|
||||
ListOdlStatsNetto = null;
|
||||
}
|
||||
}
|
||||
|
||||
private string tradFase(string codFase)
|
||||
{
|
||||
string answ = codFase;
|
||||
if (ListStati != null && ListStati.Count > 0)
|
||||
{
|
||||
var recSel = ListStati.FirstOrDefault(x => x.value == codFase);
|
||||
if (recSel != null)
|
||||
{
|
||||
answ = recSel.label;
|
||||
}
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
#endregion Private Methods
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
@using MP.INVE.Components
|
||||
@using MP.INVE.Data
|
||||
|
||||
@if (ListRecords == null)
|
||||
{
|
||||
<LoadingData></LoadingData>
|
||||
}
|
||||
else if (totalCount == 0)
|
||||
{
|
||||
<div class="alert alert-warning text-center display-4">Nessun record trovato</div>
|
||||
}
|
||||
else
|
||||
{
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<table class="table table-sm table-striped small">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>
|
||||
@if (currRecord != null)
|
||||
{
|
||||
<button @onclick="() => resetSel()" class="btn btn-primary btn-sm"><i class="bi bi-arrow-counterclockwise"></i></button>
|
||||
}
|
||||
</th>
|
||||
<th><i class="fa-regular fa-calendar-days"></i> Data</th>
|
||||
<th><i class="fa-solid fa-hard-drive"></i> Macchina</th>
|
||||
<th><i class="fa-solid fa-sliders"></i> Parametro</th>
|
||||
<th><i class="fa-solid fa-sliders"></i> Nome</th>
|
||||
<th style="text-align: right">Valore</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach (var record in ListRecords)
|
||||
{
|
||||
<tr class="@checkSelect(@record)">
|
||||
<td>
|
||||
<button @onclick="() => selRecord(record)" class="btn btn-primary btn-sm"><i class="bi bi-search"></i></button>
|
||||
</td>
|
||||
<td>
|
||||
@record.dtEvento
|
||||
</td>
|
||||
<td>
|
||||
@record.IdxMacchina
|
||||
</td>
|
||||
<td>
|
||||
@record.CodFlux
|
||||
</td>
|
||||
<td>
|
||||
@traduci(record.CodFlux)
|
||||
</td>
|
||||
<td style="text-align: right">
|
||||
<b>@record.Valore</b>
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,268 @@
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using Microsoft.JSInterop;
|
||||
using MP.Data.DatabaseModels;
|
||||
using MP.INVE.Data;
|
||||
using System.Diagnostics;
|
||||
using MP.Data;
|
||||
|
||||
namespace MP.INVE.Components
|
||||
{
|
||||
public partial class ListPARAMS : IDisposable
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
[Parameter]
|
||||
public EventCallback<bool> PagerResetReq { get; set; }
|
||||
|
||||
[Parameter]
|
||||
public EventCallback<FluxLog> RecordSel { get; set; }
|
||||
|
||||
[Parameter]
|
||||
public SelectFluxParams SelFilter { get; set; } = null!;
|
||||
|
||||
[Parameter]
|
||||
public EventCallback<int> TotRecordChanged { get; set; }
|
||||
|
||||
#endregion Public Properties
|
||||
|
||||
#region Public Methods
|
||||
private SelectFluxParams lastFilter { get; set; } = new SelectFluxParams() { CurrPage = -1 };
|
||||
public string checkSelect(FluxLog selRecord)
|
||||
{
|
||||
string answ = "";
|
||||
if (currRecord != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
answ = (currRecord.IdxMacchina == selRecord.IdxMacchina && currRecord.dtEvento == selRecord.dtEvento && currRecord.CodFlux == selRecord.CodFlux) ? "table-info" : "";
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
protected override async Task OnParametersSetAsync()
|
||||
{
|
||||
await Task.Delay(1);
|
||||
// se sono cambiati --> rileggo...
|
||||
if (!lastFilter.Equals(SelFilter))
|
||||
{
|
||||
lastFilter = SelFilter.clone();
|
||||
await reloadData(true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public SelectFluxParams? LastFilter = null;
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
aTimer.Elapsed -= ElapsedTimer;
|
||||
aTimer.Stop();
|
||||
aTimer.Dispose();
|
||||
currRecord = null;
|
||||
SearchRecords = null;
|
||||
ListRecords = null;
|
||||
GC.Collect();
|
||||
}
|
||||
|
||||
public void ElapsedTimer(object? source, System.Timers.ElapsedEventArgs e)
|
||||
{
|
||||
if (!isLoading && LiveUpdate)
|
||||
{
|
||||
aTimer.Stop();
|
||||
// inizio misura esecuzione
|
||||
Stopwatch stopWatch = new Stopwatch();
|
||||
stopWatch.Start();
|
||||
var pUpd = Task.Run(async () =>
|
||||
{
|
||||
await Task.Delay(1);
|
||||
await InvokeAsync(() => reloadData(true));
|
||||
});
|
||||
pUpd.Wait();
|
||||
// misuro tempo esecuzione
|
||||
stopWatch.Stop();
|
||||
TimeSpan ts = stopWatch.Elapsed;
|
||||
int deltaTime = RefreshPeriod - (int)ts.TotalMilliseconds;
|
||||
aTimer.Interval = deltaTime > 100 ? deltaTime : 100;
|
||||
aTimer.Start();
|
||||
}
|
||||
}
|
||||
|
||||
public async Task reloadData(bool setChanged)
|
||||
{
|
||||
isLoading = true;
|
||||
DateTime dataFrom = DateTime.Today.AddMonths(-1);
|
||||
DateTime dataTo = DateTime.Now.AddMinutes(5);
|
||||
if (SelFilter != null && SelFilter.dtMin != null)
|
||||
{
|
||||
dataFrom = (DateTime)SelFilter.dtMin;
|
||||
}
|
||||
if (SelDtMax != null)
|
||||
{
|
||||
dataTo = (DateTime)SelDtMax;
|
||||
}
|
||||
|
||||
SearchRecords = await MDService.FluxLogGetLastFilt(dataTo, dataFrom, SelMacchina, SelFlux, MaxRecord);
|
||||
totalCount = SearchRecords.Count;
|
||||
ListRecords = SearchRecords.Skip(numRecord * (currPage - 1)).Take(numRecord).ToList();
|
||||
await Task.Delay(1);
|
||||
if (setChanged)
|
||||
{
|
||||
await InvokeAsync(() => StateHasChanged());
|
||||
}
|
||||
isLoading = false;
|
||||
}
|
||||
|
||||
public void StartTimer()
|
||||
{
|
||||
aTimer = new System.Timers.Timer(RefreshPeriod);
|
||||
aTimer.Elapsed += ElapsedTimer;
|
||||
aTimer.Enabled = true;
|
||||
aTimer.Start();
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
|
||||
#region Protected Properties
|
||||
|
||||
[Inject]
|
||||
protected IJSRuntime JSRuntime { get; set; } = null!;
|
||||
|
||||
[Inject]
|
||||
protected MpDataService MDService { get; set; } = null!;
|
||||
|
||||
protected int RefreshPeriod
|
||||
{
|
||||
get => SelFilter.TempoAgg;
|
||||
}
|
||||
|
||||
#endregion Protected Properties
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
protected override void OnInitialized()
|
||||
{
|
||||
StartTimer();
|
||||
}
|
||||
|
||||
|
||||
//protected int RefreshPeriod { get; set; } = 5000;
|
||||
protected async void OnSeachUpdated()
|
||||
{
|
||||
await InvokeAsync(() =>
|
||||
{
|
||||
PagerResetReq.InvokeAsync(false);
|
||||
//currPage = 1;
|
||||
Task task = UpdateData();
|
||||
StateHasChanged();
|
||||
});
|
||||
}
|
||||
|
||||
protected async Task resetSel()
|
||||
{
|
||||
currRecord = null;
|
||||
await RecordSel.InvokeAsync(null);
|
||||
}
|
||||
|
||||
protected async Task selRecord(FluxLog selRec)
|
||||
{
|
||||
currRecord = selRec;
|
||||
SelFilter.IdxMacchina = selRec.IdxMacchina;
|
||||
SelDtMax = selRec.dtEvento;
|
||||
// imposto pag 1 filtro
|
||||
SelFilter.CurrPage = 1;
|
||||
//selDtMin = RoundDatetime(5).AddHours(-25);
|
||||
await reloadData(false);
|
||||
await RecordSel.InvokeAsync(selRec);
|
||||
await PagerResetReq.InvokeAsync(true);
|
||||
}
|
||||
|
||||
protected async Task UpdateData()
|
||||
{
|
||||
currRecord = null;
|
||||
await reloadData(true);
|
||||
}
|
||||
|
||||
#endregion Protected Methods
|
||||
|
||||
|
||||
private string traduci(string lemma)
|
||||
{
|
||||
var answ = MDService.Traduci(lemma, "IT");
|
||||
return answ;
|
||||
}
|
||||
|
||||
#region Private Fields
|
||||
|
||||
private static System.Timers.Timer aTimer = null!;
|
||||
|
||||
private int _totalCount = 0;
|
||||
private FluxLog? currRecord = null;
|
||||
private List<FluxLog>? ListRecords;
|
||||
private List<FluxLog>? SearchRecords;
|
||||
|
||||
#endregion Private Fields
|
||||
|
||||
#region Private Properties
|
||||
|
||||
private int currPage
|
||||
{
|
||||
get => SelFilter.CurrPage;
|
||||
set => SelFilter.CurrPage = value;
|
||||
}
|
||||
|
||||
private bool isLoading { get; set; } = false;
|
||||
|
||||
private bool LiveUpdate
|
||||
{
|
||||
get => SelFilter.LiveUpdate;
|
||||
}
|
||||
|
||||
private int MaxRecord
|
||||
{
|
||||
get => SelFilter.MaxRecord;
|
||||
}
|
||||
|
||||
private int numRecord
|
||||
{
|
||||
get => SelFilter.NumRec;
|
||||
set => SelFilter.NumRec = value;
|
||||
}
|
||||
|
||||
private string SelFlux
|
||||
{
|
||||
get => SelFilter.CodFlux;
|
||||
}
|
||||
|
||||
private string SelMacchina
|
||||
{
|
||||
get => SelFilter.IdxMacchina;
|
||||
}
|
||||
private DateTime? SelDtMax
|
||||
{
|
||||
get => SelFilter.dtMax;
|
||||
set => SelFilter.dtMax = value;
|
||||
}
|
||||
|
||||
private int totalCount
|
||||
{
|
||||
get => _totalCount;
|
||||
set
|
||||
{
|
||||
if (_totalCount != value)
|
||||
{
|
||||
_totalCount = value;
|
||||
TotRecordChanged.InvokeAsync(value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Private Properties
|
||||
|
||||
#region Private Methods
|
||||
|
||||
#endregion Private Methods
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,105 @@
|
||||
@using MP.INVE.Components
|
||||
@using MP.INVE.Data
|
||||
|
||||
@if (ListRecords == null || isLoading)
|
||||
{
|
||||
<LoadingData></LoadingData>
|
||||
}
|
||||
else if (totalCount == 0)
|
||||
{
|
||||
<div class="alert alert-warning text-center display-4">Nessun record trovato</div>
|
||||
}
|
||||
else
|
||||
{
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<table class="table table-sm table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>
|
||||
@if (currRecord != null)
|
||||
{
|
||||
<button @onclick="() => resetSel()" class="btn btn-primary btn-sm"><i class="bi bi-arrow-counterclockwise"></i></button>
|
||||
}
|
||||
</th>
|
||||
<th>Cod</th>
|
||||
<th><i class="fa-solid fa-file"></i> Articolo</th>
|
||||
<th><i class="fa-solid fa-screwdriver-wrench"></i> Fase</th>
|
||||
<th><i class="fa-solid fa-hard-drive"></i> Macchina</th>
|
||||
<th><i class="fa-solid fa-circle-info"></i> Info ciclo</th>
|
||||
@*<th><i class="fa-solid fa-pen-to-square"></i> Note</th>*@
|
||||
<th title="Attivabile"><i class="fa-regular fa-square-check"></i> Att</th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach (var record in ListRecords)
|
||||
{
|
||||
<tr class="@checkSelect(@record)">
|
||||
<td class="text-nowrap">
|
||||
<button @onclick="() => selRecord(record)" class="btn btn-primary btn-sm" title="Modifica Record"><i class="bi bi-pencil-square"></i></button>
|
||||
<button @onclick="() => cloneRecord(record)" class="btn btn-info btn-sm" title="Duplica Record"><i class="bi bi-clipboard-check"></i></button>
|
||||
@if (canStartOdl(record.IdxMacchina))
|
||||
{
|
||||
<button @onclick="() => startOdl(record)" class="btn btn-success btn-sm mx-1" title="Avvia PODL">
|
||||
<i class="far fa-play-circle"></i>
|
||||
</button>
|
||||
}
|
||||
else
|
||||
{
|
||||
<button class="btn btn-secondary btn-sm disabled mx-1" title="ODL ancora in corso">
|
||||
<i class="far fa-play-circle"></i>
|
||||
</button>
|
||||
}
|
||||
</td>
|
||||
<td>
|
||||
<div class="small"><b>PODL</b> @($"{record.IdxPromessa:000000}")</div>
|
||||
</td>
|
||||
<td>
|
||||
@record.CodArticolo
|
||||
<div class="small textConsensed text-secondary">@record.ArticoloNav.DescArticolo</div>
|
||||
</td>
|
||||
<td>
|
||||
<div>
|
||||
@tradFase(record.KeyRichiesta)
|
||||
</div>
|
||||
@if (record.Note != "")
|
||||
{
|
||||
<div class="small textConsensed text-secondary badge text-bg-light border border-primary rounded">
|
||||
<b class="text-dark">Note:</b> @record.Note
|
||||
</div>
|
||||
}
|
||||
</td>
|
||||
<td>
|
||||
@record.IdxMacchina
|
||||
<div class="small textConsensed text-secondary">@record.MachineNav.Descrizione</div>
|
||||
</td>
|
||||
<td>
|
||||
<div class="small textConsensed"><b>N° pezzi:</b> @record.NumPezzi</div>
|
||||
<div class="small textConsensed"><b>T. Ciclo:</b> @record.Tcassegnato.ToString("N3")</div>
|
||||
</td>
|
||||
@*<td>@record.Note</td>*@
|
||||
<td>
|
||||
@if (@record.Attivabile)
|
||||
{
|
||||
<i class="fa-regular fa-square-check text-success"></i>
|
||||
}
|
||||
else
|
||||
{
|
||||
<i class="fa-regular fa-square text-secondary"></i>
|
||||
}
|
||||
</td>
|
||||
<td>
|
||||
@if (POdlDelEnabled(record.IdxOdl))
|
||||
{
|
||||
<button @onclick="() => deleteRecord(record)" class="btn btn-danger btn-sm"><i class="bi bi-trash-fill"></i></button>
|
||||
}
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
|
||||
@@ -0,0 +1,412 @@
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using Microsoft.JSInterop;
|
||||
using MP.Data.DatabaseModels;
|
||||
using MP.INVE.Data;
|
||||
using MP.INVE.Services;
|
||||
using NLog;
|
||||
|
||||
namespace MP.INVE.Components
|
||||
{
|
||||
public partial class ListPODL : IDisposable
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
[Parameter]
|
||||
public SelectPOdlParams actFilter { get; set; } = new SelectPOdlParams();
|
||||
|
||||
[Parameter]
|
||||
public EventCallback<bool> PagerResetReq { get; set; }
|
||||
|
||||
[Parameter]
|
||||
public EventCallback<PODLModel> RecordSel { get; set; }
|
||||
|
||||
[Parameter]
|
||||
public EventCallback<int> updateRecordCount { get; set; }
|
||||
|
||||
#endregion Public Properties
|
||||
|
||||
#region Public Methods
|
||||
|
||||
public string checkSelect(PODLModel record)
|
||||
{
|
||||
string answ = "";
|
||||
if (currRecord != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
answ = ((currRecord.IdxMacchina == record.IdxMacchina) && (currRecord.CodArticolo == record.CodArticolo) && (currRecord.CodFase == record.CodFase)) ? "table-info" : "";
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
currRecord = null;
|
||||
SearchRecords = null;
|
||||
ListRecords = null;
|
||||
ListStati = null;
|
||||
GC.Collect();
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
|
||||
#region Protected Properties
|
||||
|
||||
[Inject]
|
||||
protected IJSRuntime JSRuntime { get; set; } = null!;
|
||||
|
||||
[Inject]
|
||||
protected MpDataService MDService { get; set; } = null!;
|
||||
|
||||
[Inject]
|
||||
protected IOApiService MpIoApiCall { get; set; } = null!;
|
||||
|
||||
#endregion Protected Properties
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
protected async Task cloneRecord(PODLModel selRec)
|
||||
{
|
||||
// creo record duplicato...
|
||||
PODLModel newRec = new PODLModel()
|
||||
{
|
||||
Attivabile = selRec.Attivabile,
|
||||
CodArticolo = selRec.CodArticolo,
|
||||
CodCli = selRec.CodCli,
|
||||
CodGruppo = selRec.CodGruppo,
|
||||
DueDate = selRec.DueDate,
|
||||
IdxMacchina = selRec.IdxMacchina,
|
||||
IdxOdl = selRec.IdxOdl,
|
||||
IdxPromessa = 0,
|
||||
InsertDate = selRec.InsertDate,
|
||||
KeyBCode = selRec.KeyBCode,
|
||||
KeyRichiesta = selRec.KeyRichiesta,
|
||||
Note = $"DUPLICATED - {selRec.Note}",
|
||||
NumPezzi = selRec.NumPezzi,
|
||||
Priorita = selRec.Priorita,
|
||||
PzPallet = selRec.PzPallet,
|
||||
Tcassegnato = selRec.Tcassegnato
|
||||
};
|
||||
currRecord = selRec;
|
||||
await RecordSel.InvokeAsync(newRec);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Eliminazione record selezionato (previa conferma)
|
||||
/// </summary>
|
||||
/// <param name="selRec"></param>
|
||||
/// <returns></returns>
|
||||
protected async Task deleteRecord(PODLModel selRec)
|
||||
{
|
||||
if (!await JSRuntime.InvokeAsync<bool>("confirm", "Eliminazione Record: sei sicuro di voler procedere?"))
|
||||
return;
|
||||
await Task.Delay(1);
|
||||
var done = await MDService.PODLDeleteRecord(selRec);
|
||||
await callSyncDb(selRec.IdxMacchina);
|
||||
currRecord = null;
|
||||
await reloadData();
|
||||
await Task.Delay(1);
|
||||
}
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
//await FilterChanged.InvokeAsync(actFilter);
|
||||
ListStati = await MDService.AnagStatiComm();
|
||||
}
|
||||
|
||||
protected override async Task OnParametersSetAsync()
|
||||
{
|
||||
if (!lastFilter.Equals(actFilter))
|
||||
{
|
||||
lastFilter = actFilter.clone();
|
||||
await reloadData();
|
||||
}
|
||||
}
|
||||
|
||||
protected async void OnSeachUpdated()
|
||||
{
|
||||
await InvokeAsync(() =>
|
||||
{
|
||||
PagerResetReq.InvokeAsync(true);
|
||||
//currPage = 1;
|
||||
Task task = UpdateData();
|
||||
StateHasChanged();
|
||||
});
|
||||
}
|
||||
|
||||
protected bool POdlDelEnabled(int idxOdl)
|
||||
{
|
||||
return idxOdl == 0;
|
||||
}
|
||||
|
||||
protected async Task resetSel()
|
||||
{
|
||||
currRecord = null;
|
||||
await RecordSel.InvokeAsync(null);
|
||||
}
|
||||
|
||||
protected async Task selRecord(PODLModel selRec)
|
||||
{
|
||||
currRecord = selRec;
|
||||
await RecordSel.InvokeAsync(selRec);
|
||||
}
|
||||
|
||||
protected async Task startOdl(PODLModel selRec)
|
||||
{
|
||||
if (!await JSRuntime.InvokeAsync<bool>("confirm", "Sei sicuro di voler avviare PODL selezionato?"))
|
||||
return;
|
||||
|
||||
if (selRec != null)
|
||||
{
|
||||
int idxEvento = 0;
|
||||
string evMess = "";
|
||||
// verifico ancora NON ci sia ODL corrente/aperto
|
||||
if (canStartOdl(selRec.IdxMacchina))
|
||||
{
|
||||
await callStartSetup(selRec.IdxMacchina);
|
||||
await Task.Delay(1);
|
||||
// chiamo stored stp_ODL_inizioSetupPromessa e recupero ODL corrente
|
||||
bool fatto = await MDService.POdlDoSetup(selRec);
|
||||
if (fatto)
|
||||
{
|
||||
var currPOdl = await MDService.PODL_getByKey(selRec.IdxPromessa);
|
||||
var newOdl = await MDService.OdlGetByKey(currPOdl.IdxOdl);
|
||||
|
||||
// registro evento...
|
||||
idxEvento = 2;
|
||||
evMess = $"Inizio Setup | PODL {selRec.IdxPromessa}";
|
||||
processaEvento(selRec.IdxMacchina, idxEvento, evMess, newOdl.IdxOdl, newOdl.CodArticolo);
|
||||
|
||||
// aspetto 1 sec
|
||||
await Task.Delay(1000);
|
||||
|
||||
// registro inizio produzione
|
||||
idxEvento = 2;
|
||||
evMess = $"Registrata inizio Produzione | PODL {selRec.IdxPromessa} | ODL {newOdl.IdxOdl} | ART {newOdl.CodArticolo}";
|
||||
processaEvento(selRec.IdxMacchina, idxEvento, evMess, newOdl.IdxOdl, newOdl.CodArticolo);
|
||||
|
||||
// chiamo task x IOB
|
||||
await callForceUpdate(selRec.IdxMacchina);
|
||||
await Task.Delay(1);
|
||||
await callForceUpdate(selRec.IdxMacchina);
|
||||
await Task.Delay(1);
|
||||
await callSyncDb(selRec.IdxMacchina);
|
||||
await Task.Delay(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected async Task UpdateData()
|
||||
{
|
||||
currRecord = null;
|
||||
await reloadData();
|
||||
}
|
||||
|
||||
#endregion Protected Methods
|
||||
|
||||
#region Private Fields
|
||||
|
||||
private static Logger Log = LogManager.GetCurrentClassLogger();
|
||||
private PODLModel? currRecord = null;
|
||||
private List<PODLModel>? ListRecords;
|
||||
private List<ListValues>? ListStati;
|
||||
|
||||
/// <summary>
|
||||
/// scadenza validità lista ODL correnti
|
||||
/// </summary>
|
||||
private DateTime odlCurrExp = DateTime.Now.AddMinutes(-1);
|
||||
|
||||
/// <summary>
|
||||
/// Elenco ODL correnti...
|
||||
/// </summary>
|
||||
private List<string> odlCurrList = new List<string>();
|
||||
|
||||
private List<PODLModel>? SearchRecords;
|
||||
|
||||
#endregion Private Fields
|
||||
|
||||
#region Private Properties
|
||||
|
||||
private int _totalCount { get; set; } = 0;
|
||||
|
||||
private int currPage
|
||||
{
|
||||
get => actFilter.CurrPage;
|
||||
set => actFilter.CurrPage = value;
|
||||
}
|
||||
|
||||
private bool isLoading { get; set; } = false;
|
||||
private SelectPOdlParams lastFilter { get; set; } = new SelectPOdlParams() { CurrPage = -1 };
|
||||
|
||||
private int numRecord
|
||||
{
|
||||
get => actFilter.NumRec;
|
||||
set => actFilter.NumRec = value;
|
||||
}
|
||||
|
||||
private string SearchVal
|
||||
{
|
||||
get => string.IsNullOrEmpty(actFilter.SearchVal) ? "*" : actFilter.SearchVal;
|
||||
}
|
||||
|
||||
private string StatoSel
|
||||
{
|
||||
get => actFilter.CodFase;
|
||||
set => actFilter.CodFase = value;
|
||||
}
|
||||
|
||||
private int totalCount
|
||||
{
|
||||
get => _totalCount;
|
||||
set
|
||||
{
|
||||
if (_totalCount != value)
|
||||
{
|
||||
_totalCount = value;
|
||||
updateRecordCount.InvokeAsync(value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Private Properties
|
||||
|
||||
#region Private Methods
|
||||
|
||||
/// <summary>
|
||||
/// Chiama metodo x chiedere sync DB
|
||||
/// </summary>
|
||||
/// <param name="selRec"></param>
|
||||
/// <returns></returns>
|
||||
private async Task addTask2Exe(string idxMacc, string taskName, string taskVal)
|
||||
{
|
||||
// compongo URL e chiamo
|
||||
string restUrl = $"IOB/addTask2Exe/{idxMacc}?taskName={taskName}&taskVal={taskVal}";
|
||||
try
|
||||
{
|
||||
var response = await MpIoApiCall.callMpIoUrlGet(restUrl);
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Log.Error($"Errore durante chiamata: {Environment.NewLine}{exc}");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Chiama metodo x chiedere force Update
|
||||
/// </summary>
|
||||
/// <param name="selRec"></param>
|
||||
/// <returns></returns>
|
||||
private async Task callForceUpdate(string IdxMacc)
|
||||
{
|
||||
// chiamo aggiunta task SyncDb...
|
||||
await addTask2Exe(IdxMacc, "ForceUpdate", $"SPEC|TS:{DateTime.Now:yyMMddHHmmss}");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Chiama metodo x indicare inizio setup
|
||||
/// </summary>
|
||||
/// <param name="selRec"></param>
|
||||
/// <returns></returns>
|
||||
private async Task callStartSetup(string IdxMacc)
|
||||
{
|
||||
// chiamo evento inizio setup
|
||||
await addTask2Exe(IdxMacc, "startSetup", $"SPEC|TS:{DateTime.Now:yyMMddHHmmss}");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Chiama metodo x chiedere sync DB
|
||||
/// </summary>
|
||||
/// <param name="IdxMacc"></param>
|
||||
/// <returns></returns>
|
||||
private async Task callSyncDb(string IdxMacc)
|
||||
{
|
||||
// chiamo aggiunta task SyncDb...
|
||||
await addTask2Exe(IdxMacc, "syncDbData", "");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// verifica se sia avviabile ODL x macchina
|
||||
/// </summary>
|
||||
/// <param name="idxMacchina"></param>
|
||||
/// <returns></returns>
|
||||
private bool canStartOdl(string idxMacchina)
|
||||
{
|
||||
// controllo se lista scaduta...
|
||||
bool answ = false;
|
||||
DateTime adesso = DateTime.Now;
|
||||
if (adesso > odlCurrExp || odlCurrList == null || odlCurrList.Count == 0)
|
||||
{
|
||||
odlCurrList = MDService.OdlGetCurrent();
|
||||
odlCurrExp = adesso.AddSeconds(2);
|
||||
}
|
||||
answ = !odlCurrList.Contains(idxMacchina);
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// processa evento richiesto
|
||||
/// </summary>
|
||||
/// <param name="idxMacc"></param>
|
||||
/// <param name="idxEvento"></param>
|
||||
/// <param name="userMsg"></param>
|
||||
/// <param name="idxODL"></param>
|
||||
private async void processaEvento(string idxMacc, int idxEvento, string userMsg, int idxODL, string codArticolo)
|
||||
{
|
||||
// se manca codart calcolo...
|
||||
if (string.IsNullOrEmpty(codArticolo))
|
||||
{
|
||||
var currOdl = await MDService.OdlGetByKey(idxODL);
|
||||
if (currOdl != null)
|
||||
{
|
||||
codArticolo = currOdl.CodArticolo;
|
||||
}
|
||||
}
|
||||
|
||||
// scrivo evento scriviRigaEventoBarcode
|
||||
EventListModel newRec = new EventListModel()
|
||||
{
|
||||
IdxMacchina = idxMacc,
|
||||
InizioStato = DateTime.Now,
|
||||
IdxTipo = idxEvento,
|
||||
CodArticolo = codArticolo,
|
||||
MatrOpr = 0,
|
||||
pallet = "",
|
||||
Value = userMsg
|
||||
};
|
||||
|
||||
await MDService.EvListInsert(newRec);
|
||||
}
|
||||
|
||||
private async Task reloadData()
|
||||
{
|
||||
isLoading = true;
|
||||
SearchRecords = await MDService.ListPODLFilt(SearchVal, StatoSel);
|
||||
totalCount = SearchRecords.Count;
|
||||
ListRecords = SearchRecords.Skip(numRecord * (currPage - 1)).Take(numRecord).ToList();
|
||||
await Task.Delay(1);
|
||||
await InvokeAsync(() => StateHasChanged());
|
||||
//await updateRecordCount.InvokeAsync(totalCount);
|
||||
isLoading = false;
|
||||
}
|
||||
|
||||
private string tradFase(string codFase)
|
||||
{
|
||||
string answ = codFase;
|
||||
if (ListStati != null && ListStati.Count > 0)
|
||||
{
|
||||
var recSel = ListStati.FirstOrDefault(x => x.value == codFase);
|
||||
if (recSel != null)
|
||||
{
|
||||
answ = recSel.label;
|
||||
}
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
#endregion Private Methods
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
<div class="row p-5 m-5 alert alert-primary">
|
||||
<div class="col-6 text-center mt-4 py-3 bg-light">
|
||||
<h1>MAPO INVE</h1>
|
||||
EgalWare MES suite <img class="logoImg img-fluid" src="images/logoCliente.png" width="64" />
|
||||
</div>
|
||||
<div class="col-6 text-center mt-4 py-3 bg-light">
|
||||
<h3>loading data</h3>
|
||||
<i class="fas fa-spinner fa-spin fa-4x"></i>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,6 @@
|
||||
<div class="row p-0 m-0">
|
||||
<div class="col-12 text-center py-2 mb-0 alert alert-primary">
|
||||
<b>loading data</b>
|
||||
<i class="fas fa-spinner fa-spin"></i>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,13 @@
|
||||
@if (@SelectedOdl != -1)
|
||||
{
|
||||
<div class="px-1 flex-fill">
|
||||
@if (isLoading)
|
||||
{
|
||||
<LoadingDataSmall></LoadingDataSmall>
|
||||
}
|
||||
else
|
||||
{
|
||||
<MP.INVE.Components.Chart.Doughnut Type="@Chart.Doughnut.ChartType.Doughnut" Data="@Data.ToArray()" BackgroundColor="@colors"></MP.INVE.Components.Chart.Doughnut>
|
||||
}
|
||||
</div>
|
||||
}
|
||||
@@ -0,0 +1,108 @@
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using MP.Data.DatabaseModels;
|
||||
using MP.INVE.Data;
|
||||
|
||||
namespace MP.INVE.Components
|
||||
{
|
||||
public partial class ODLPlot
|
||||
{
|
||||
#region Public Fields
|
||||
|
||||
public List<DoughnutStyling> colors = new List<DoughnutStyling>();
|
||||
|
||||
public List<double> Data = new List<double>();
|
||||
|
||||
public List<string> Labels = new List<string>();
|
||||
|
||||
#endregion Public Fields
|
||||
|
||||
#region Public Properties
|
||||
|
||||
[Parameter]
|
||||
public bool hideSpenta { get; set; }
|
||||
|
||||
public int OdlId
|
||||
{
|
||||
get => _selParam;
|
||||
}
|
||||
|
||||
[Parameter]
|
||||
public int SelectedOdl
|
||||
{
|
||||
get => _selParam;
|
||||
set => _selParam = value;
|
||||
}
|
||||
|
||||
#endregion Public Properties
|
||||
|
||||
#region Protected Properties
|
||||
|
||||
//protected DataLogFilter _SelFilter { get; set; } = new DataLogFilter();
|
||||
protected int _selParam { get; set; } = -1;
|
||||
|
||||
[Inject]
|
||||
protected MpDataService MDService { get; set; } = null!;
|
||||
|
||||
#endregion Protected Properties
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
isLoading = true;
|
||||
await Task.Delay(1);
|
||||
}
|
||||
|
||||
protected override async Task OnParametersSetAsync()
|
||||
{
|
||||
await ReloadData();
|
||||
await Task.Delay(1);
|
||||
}
|
||||
|
||||
protected async Task ReloadData()
|
||||
{
|
||||
Data.Clear();
|
||||
Labels.Clear();
|
||||
colors.Clear();
|
||||
ListRecords = await MDService.StatOdl(SelectedOdl);
|
||||
// se hideSpenta --> filtro stato 11 = spenta...
|
||||
if (hideSpenta)
|
||||
{
|
||||
ListRecords = ListRecords.Where(x => x.Semaforo != "sGr").ToList();
|
||||
}
|
||||
foreach (var record in ListRecords)
|
||||
{
|
||||
Data.Add(record.TotDurata);
|
||||
Labels.Add($"{record.Descrizione} - {record.TotDurata:N1}min");
|
||||
if (record.Css == "yellow")
|
||||
{
|
||||
colors.Add(new DoughnutStyling("orange", "ccc"));
|
||||
}
|
||||
else if (record.Css == "blue")
|
||||
{
|
||||
colors.Add(new DoughnutStyling("#2874A6", "ccc"));
|
||||
}
|
||||
else
|
||||
{
|
||||
colors.Add(new DoughnutStyling(record.Css, "ccc"));
|
||||
}
|
||||
}
|
||||
await Task.Delay(1);
|
||||
isLoading = false;
|
||||
}
|
||||
|
||||
#endregion Protected Methods
|
||||
|
||||
#region Private Fields
|
||||
|
||||
private List<StatODLModel>? ListRecords = null;
|
||||
|
||||
#endregion Private Fields
|
||||
|
||||
#region Private Properties
|
||||
|
||||
private bool isLoading { get; set; } = false;
|
||||
|
||||
#endregion Private Properties
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,144 @@
|
||||
<div class="d-flex justify-content-between">
|
||||
<div class="d-flex justify-content-between pt-1 mb-1">
|
||||
<div class="px-2">
|
||||
@if (!liveUpdate)
|
||||
{
|
||||
<button class="btn btn-secondary" type="button" @onclick="() => live()" title="Click per tornare a Valori Live">
|
||||
<small>@lastUpdate</small>
|
||||
</button>
|
||||
}
|
||||
else
|
||||
{
|
||||
<button class="btn btn-primary" type="button" @onclick="() => notLive()">
|
||||
<span class="spinner-grow spinner-grow-sm" role="status" aria-hidden="true"></span>
|
||||
Valori live
|
||||
</button>
|
||||
}
|
||||
</div>
|
||||
<div class="px-2">
|
||||
@if (selMacchina != "*")
|
||||
{
|
||||
<button class="btn btn-warning" type="button" @onclick="() => takeSnapshot()">
|
||||
<i class="fa-solid fa-camera"></i>
|
||||
@snapMode
|
||||
</button>
|
||||
}
|
||||
</div>
|
||||
<div class="px-2">
|
||||
@if (snapshotDone)
|
||||
{
|
||||
<button class="btn btn-success" type="button" @onclick="() => navDossier()">
|
||||
<div class="spinner-border spinner-border-sm" role="status">
|
||||
<span class="visually-hidden">Loading...</span>
|
||||
</div>
|
||||
<i class="fa-solid fa-camera"></i>
|
||||
Fatto! Mostra Dossier
|
||||
</button>
|
||||
}
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="d-flex justify-content-between pt-2">
|
||||
@if (filtActive)
|
||||
{
|
||||
@*<i class="fas fa-exclamation text-warning"></i>*@
|
||||
@if (selMacchina != "*")
|
||||
{
|
||||
<button class="btn btn-outline-primary btn-sm mx-2" @onclick="()=>resetMacchina()" title="Rimuovi Filtro Impianto"><i class="fa-solid fa-hard-drive"></i>   <i class="fa-solid fa-xmark text-warning"></i></button>
|
||||
}
|
||||
@if (selFlux != "*")
|
||||
{
|
||||
<button class="btn btn-outline-primary btn-sm mx-2" @onclick="()=>resetFase()" title="Rimuovi Filtro Parametro"><i class="fa-solid fa-sliders"></i>   <i class="fa-solid fa-xmark text-warning"></i></button>
|
||||
}
|
||||
|
||||
}
|
||||
<div class="p-2">
|
||||
<a class="" data-bs-toggle="offcanvas" data-bs-target="#paramsFilterExample" aria-controls="paramsFilterExample">
|
||||
<i class="fa-solid fa-bars text-dark"></i>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="offcanvas offcanvas-end" tabindex="-1" id="paramsFilterExample" aria-labelledby="paramsFilterExampleLabel">
|
||||
<div class="offcanvas-header">
|
||||
<h3 class="offcanvas-title" id="paramsFilterExampleLabel"><b>FILTRI</b></h3>
|
||||
<button type="button" class="btn-close text-reset" data-bs-dismiss="offcanvas" aria-label="Close"></button>
|
||||
</div>
|
||||
<div class="offcanvas-body">
|
||||
<div class="small">
|
||||
<label class="px-2" for="macchina" title="Selezionare impianto">Impianto</label>
|
||||
</div>
|
||||
<div class="px-2 input-group">
|
||||
<label class="input-group-text" for="macchina" title="Selezionare impianto"><i class="fa-solid fa-hard-drive"></i></label>
|
||||
<select @bind="@selMacchina" class="form-select" id="macchina" title="Selezionare impianto">
|
||||
<option value="*">--- Tutti ---</option>
|
||||
@if (ListMacchine != null)
|
||||
{
|
||||
foreach (var item in ListMacchine)
|
||||
{
|
||||
<option value="@item">@item</option>
|
||||
}
|
||||
}
|
||||
</select>
|
||||
</div>
|
||||
<div class="small mt-2">
|
||||
<label class="px-2" for="flusso" title="Selezionare il parametro">Parametro</label>
|
||||
</div>
|
||||
<div class="px-2 input-group">
|
||||
<label class="input-group-text" for="flusso" title="Selezionare il parametro"><i class="fa-solid fa-sliders"></i></label>
|
||||
<select @bind="@selFlux" class="form-select" id="flusso" title="Selezionare il parametro">
|
||||
<option value="*">--- Tutti ---</option>
|
||||
@if (ListFlux != null)
|
||||
{
|
||||
foreach (var item in ListFlux)
|
||||
{
|
||||
<option value="@item">@item</option>
|
||||
}
|
||||
}
|
||||
</select>
|
||||
</div>
|
||||
<div class="small mt-2">
|
||||
<label class="px-2" for="dtMin" title="Selezionare inizio periodo">Inizio Periodo</label>
|
||||
</div>
|
||||
<div class="px-2 input-group">
|
||||
<label class="input-group-text" for="dtMin" title="Selezionare inizio periodo"><i class="fa-regular fa-calendar-minus"></i></label>
|
||||
<input class="form-control" @bind="@selDtMin" id="dtMin" type="datetime-local" title="Data minima eventi da visualizzare">
|
||||
</div>
|
||||
<div class="small mt-2">
|
||||
<label class="px-2" for="dtMax" title="Selezionare fine periodo">Fine Periodo</label>
|
||||
</div>
|
||||
<div class="px-2 input-group">
|
||||
<label class="input-group-text" for="dtMax" title="Selezionare fine periodo"><i class="fa-regular fa-calendar-plus"></i></label>
|
||||
<input class="form-control" @bind="@selDtMax" id="dtMax" type="datetime-local" title="Selezionare fine periodo">
|
||||
</div>
|
||||
<div class="small mt-2">
|
||||
<label class="px-2" for="tempoAgg" title="Selezionare refresh rate (sec) periodo">Refresh rate (sec)</label>
|
||||
</div>
|
||||
<div class="px-2 input-group">
|
||||
<label class="input-group-text" for="tempoAgg" title="Selezionare refresh rate (sec)"><i class="fa-solid fa-clock"></i></label>
|
||||
<select @bind="@selTempoAgg" class="form-select" id="tempoAgg" title="Selezionare refresh rate (sec)" style="width: 3em;">
|
||||
<option value="2">2</option>
|
||||
<option value="5">5</option>
|
||||
<option value="10">10</option>
|
||||
<option value="30">30</option>
|
||||
<option value="60">60</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="small mt-2">
|
||||
<label class="px-2" for="maxRecord" title="Numero massimo record da mostrare">Max Record</label>
|
||||
</div>
|
||||
<div class="px-2 input-group">
|
||||
<label class="input-group-text" for="maxRecord" title="Numero massimo record da mostrare"><i class="fa-solid fa-list-ol"></i></label>
|
||||
<select @bind="@selMaxRecord" class="form-select" id="maxRecord" title="Numero massimo record da mostrare">
|
||||
<option value="50">50</option>
|
||||
<option value="100">100</option>
|
||||
<option value="250">250</option>
|
||||
<option value="500">500</option>
|
||||
<option value="1000">1000</option>
|
||||
<option value="2500">2500</option>
|
||||
<option value="5000">5000</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -0,0 +1,346 @@
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using MP.Data;
|
||||
using MP.INVE.Data;
|
||||
|
||||
namespace MP.INVE.Components
|
||||
{
|
||||
public partial class ParamsFilter : IDisposable
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
[Parameter]
|
||||
public EventCallback<SelectFluxParams> FilterChanged { get; set; }
|
||||
|
||||
[Parameter]
|
||||
public SelectFluxParams SelFilter { get; set; } = null!;
|
||||
|
||||
#endregion Public Properties
|
||||
|
||||
#region Public Methods
|
||||
|
||||
/// <summary>
|
||||
/// Inizializzazione con periodo e arrotondamento
|
||||
/// </summary>
|
||||
/// <param name="minRound"></param>
|
||||
/// <returns></returns>
|
||||
public static DateTime RoundDatetime(int minRound)
|
||||
{
|
||||
return Utils.InitDatetime(DateTime.Now, minRound);
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
aTimer.Elapsed -= ElapsedTimer;
|
||||
aTimer.Stop();
|
||||
aTimer.Dispose();
|
||||
}
|
||||
|
||||
public void ElapsedTimer(object? source, System.Timers.ElapsedEventArgs e)
|
||||
{
|
||||
snapshotDone = false;
|
||||
aTimer.Stop();
|
||||
aTimer.Enabled = false;
|
||||
//reportChange();
|
||||
var pUpd = Task.Run(async () =>
|
||||
{
|
||||
await Task.Delay(1);
|
||||
await InvokeAsync(() => StateHasChanged());
|
||||
});
|
||||
pUpd.Wait();
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
|
||||
#region Protected Properties
|
||||
|
||||
protected string lastUpdate
|
||||
{
|
||||
get => SelFilter.lastUpdate;
|
||||
set => SelFilter.lastUpdate = value;
|
||||
}
|
||||
|
||||
protected bool liveUpdate
|
||||
{
|
||||
get => SelFilter.LiveUpdate;
|
||||
set
|
||||
{
|
||||
if (!SelFilter.LiveUpdate.Equals(value))
|
||||
{
|
||||
SelFilter.LiveUpdate = value;
|
||||
if (!value)
|
||||
{
|
||||
SelFilter.CurrPage = 0;
|
||||
}
|
||||
reportChange();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[Inject]
|
||||
protected MpDataService MDService { get; set; } = null!;
|
||||
|
||||
protected string selFlux
|
||||
{
|
||||
get
|
||||
{
|
||||
return SelFilter.CodFlux;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (!SelFilter.CodFlux.Equals(value))
|
||||
{
|
||||
SelFilter.CurrPage = 1;
|
||||
SelFilter.CodFlux = value;
|
||||
StateHasChanged();
|
||||
Task.Delay(1);
|
||||
reportChange();
|
||||
}
|
||||
}
|
||||
}
|
||||
protected bool showParam { get; set; } = false;
|
||||
protected bool selDt { get; set; } = false;
|
||||
protected string selMacchina
|
||||
{
|
||||
get => SelFilter.IdxMacchina;
|
||||
set
|
||||
{
|
||||
if (!SelFilter.IdxMacchina.Equals(value))
|
||||
{
|
||||
SelFilter.CurrPage = 1;
|
||||
SelFilter.IdxMacchina = value;
|
||||
SelFilter.CodFlux = "*";
|
||||
ListFlux = MDService.ParametriGetFilt(selMacchina).Result;
|
||||
StateHasChanged();
|
||||
Task.Delay(1);
|
||||
reportChange();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected int selMaxRecord
|
||||
{
|
||||
get
|
||||
{
|
||||
return SelFilter.MaxRecord;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (!SelFilter.MaxRecord.Equals(value))
|
||||
{
|
||||
SelFilter.MaxRecord = value;
|
||||
reportChange();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected int selTempoAgg
|
||||
{
|
||||
get
|
||||
{
|
||||
return SelFilter.TempoAgg / 1000;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
int tempoMS = value * 1000;
|
||||
if (!SelFilter.TempoAgg.Equals(tempoMS))
|
||||
{
|
||||
SelFilter.TempoAgg = tempoMS;
|
||||
reportChange();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Protected Properties
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
protected async Task navDossier()
|
||||
{
|
||||
await Task.Delay(1);
|
||||
// rimando alla home
|
||||
NavManager.NavigateTo("DOSS", true);
|
||||
}
|
||||
|
||||
private bool filtActive
|
||||
{
|
||||
get => selMacchina != "*" || selFlux != "*";
|
||||
}
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
SelFilter = new SelectFluxParams();
|
||||
setDtSnap();
|
||||
DateTime dtStart = SelFilter.dtMin != null ? (DateTime)SelFilter.dtMin : DateTime.Now.AddMonths(-1);
|
||||
DateTime dtEnd = SelFilter.dtMax != null ? (DateTime)SelFilter.dtMax : DateTime.Today.AddDays(1);
|
||||
ListMacchine = await MDService.MacchineWithFlux(dtStart, dtEnd);
|
||||
ListFlux = await MDService.ParametriGetFilt(selMacchina);
|
||||
|
||||
var configData = await MDService.ConfigGetAll();
|
||||
var currRec = configData.FirstOrDefault(x => x.Chiave == "numOreAnticipoSnapshot");
|
||||
if (currRec != null)
|
||||
{
|
||||
var newInt = 40;
|
||||
int.TryParse(currRec.Valore, out newInt);
|
||||
numOreAnticipoSnapshot = newInt;
|
||||
}
|
||||
|
||||
await FilterChanged.InvokeAsync(SelFilter);
|
||||
}
|
||||
|
||||
protected void setDtSnap()
|
||||
{
|
||||
// copio il filtro
|
||||
var currFilt = SelFilter;
|
||||
// fermo update
|
||||
currFilt.LiveUpdate = true;
|
||||
currFilt.CurrPage = 0;
|
||||
currFilt.lastUpdate = $"{DateTime.Now:yyyy/MM/dd HH:mm:ss}";
|
||||
currFilt.dtMax = RoundDatetime(5);
|
||||
currFilt.dtSnapMin = RoundDatetime(5).AddHours(-numOreAnticipoSnapshot);
|
||||
SelFilter = currFilt;
|
||||
}
|
||||
|
||||
|
||||
protected void startTimer()
|
||||
{
|
||||
aTimer = new System.Timers.Timer(5000);
|
||||
aTimer.Elapsed += ElapsedTimer;
|
||||
aTimer.Enabled = true;
|
||||
aTimer.Start();
|
||||
}
|
||||
protected void resetMacchina()
|
||||
{
|
||||
selMacchina = "*";
|
||||
}
|
||||
protected void resetFase()
|
||||
{
|
||||
selFlux = "*";
|
||||
}
|
||||
|
||||
protected async Task takeSnapshot()
|
||||
{
|
||||
// fermo udpate
|
||||
liveUpdate = false;
|
||||
// se non ho data rif uso adesso...
|
||||
DateTime dtMax = selDtMax == null ? RoundDatetime(5) : (DateTime)selDtMax;
|
||||
DateTime dtMin = selDtSnapMin == null ? RoundDatetime(5).AddHours(-numOreAnticipoSnapshot) : (DateTime)selDtSnapMin;
|
||||
// aggiungo 15 sec
|
||||
dtMax = dtMax.AddSeconds(15);
|
||||
await MDService.DossiersTakeParamsSnapshotLast(selMacchina, dtMin, dtMax);
|
||||
lastUpdate = $"{DateTime.Now:yyyy/MM/dd HH:mm:ss}";
|
||||
// indico snapshot fatto
|
||||
snapshotDone = true;
|
||||
startTimer();
|
||||
}
|
||||
|
||||
protected void toggleParams()
|
||||
{
|
||||
showEditPar = !showEditPar;
|
||||
selDtMax = null;
|
||||
}
|
||||
|
||||
protected async Task notLive()
|
||||
{
|
||||
liveUpdate = false;
|
||||
await Task.Delay(1);
|
||||
if (!liveUpdate)
|
||||
{
|
||||
lastUpdate = $"{DateTime.Now:yyyy/MM/dd HH:mm:ss}";
|
||||
}
|
||||
}
|
||||
protected async Task live()
|
||||
{
|
||||
liveUpdate = true;
|
||||
await Task.Delay(1);
|
||||
}
|
||||
|
||||
#endregion Protected Methods
|
||||
|
||||
#region Private Fields
|
||||
|
||||
private static System.Timers.Timer aTimer = new System.Timers.Timer();
|
||||
private List<string>? ListFlux = null;
|
||||
private List<string>? ListMacchine = null;
|
||||
private int numOreAnticipoSnapshot { get; set; } = 50;
|
||||
private bool snapshotDone = false;
|
||||
|
||||
#endregion Private Fields
|
||||
|
||||
#region Private Properties
|
||||
|
||||
[Inject]
|
||||
private NavigationManager NavManager { get; set; } = null!;
|
||||
|
||||
private DateTime? selDtMax
|
||||
{
|
||||
get => SelFilter.dtMax;
|
||||
set
|
||||
{
|
||||
if (SelFilter.dtMax != value)
|
||||
{
|
||||
// copio il filtro
|
||||
var currFilt = SelFilter;
|
||||
// fermo update
|
||||
currFilt.LiveUpdate = (value == null);
|
||||
currFilt.CurrPage = 0;
|
||||
currFilt.lastUpdate = $"{DateTime.Now:yyyy/MM/dd HH:mm:ss}";
|
||||
currFilt.dtMax = value;
|
||||
SelFilter = currFilt;
|
||||
reportChange();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private DateTime? selDtMin
|
||||
{
|
||||
get => SelFilter.dtMin;
|
||||
set
|
||||
{
|
||||
if (SelFilter.dtMin != value)
|
||||
{
|
||||
// copio il filtro
|
||||
var currFilt = SelFilter;
|
||||
// fermo update
|
||||
currFilt.LiveUpdate = false;
|
||||
currFilt.CurrPage = 0;
|
||||
currFilt.lastUpdate = $"{DateTime.Now:yyyy/MM/dd HH:mm:ss}";
|
||||
currFilt.dtMin = value;
|
||||
SelFilter = currFilt;
|
||||
reportChange();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private DateTime? selDtSnapMin
|
||||
{
|
||||
get => SelFilter.dtSnapMin;
|
||||
set
|
||||
{
|
||||
if (SelFilter.dtSnapMin != value)
|
||||
{
|
||||
SelFilter.dtSnapMin = value;
|
||||
reportChange();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private bool showEditPar { get; set; } = false;
|
||||
|
||||
private string snapMode
|
||||
{
|
||||
get => SelFilter.dtRif == null ? "Realtime Rec" : $"Rec {SelFilter.dtRif:yyyy/MM/dd HH:mm:ss}";
|
||||
}
|
||||
|
||||
#endregion Private Properties
|
||||
|
||||
#region Private Methods
|
||||
|
||||
private void reportChange()
|
||||
{
|
||||
FilterChanged.InvokeAsync(SelFilter);
|
||||
}
|
||||
|
||||
#endregion Private Methods
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
@using MP.INVE.Components
|
||||
@using MP.INVE.Data
|
||||
|
||||
@inject MessageService AppMService
|
||||
|
||||
<div class="input-group input-group-sm" hidden>
|
||||
<input @bind-value="@searchVal" @bind-value:event="oninput" type="text" class="form-control" title="Campo Ricerca" placeholder="Ricerca [ALT-R]" accesskey="R" />
|
||||
<button @onclick="reset" class="btn btn-success input-group-text"><i class="fa-solid fa-rotate"></i></button>
|
||||
</div>
|
||||
|
||||
@code {
|
||||
|
||||
[Parameter]
|
||||
public EventCallback<string> searchUpdated { get; set; }
|
||||
|
||||
[Parameter]
|
||||
public string searchVal
|
||||
{
|
||||
get
|
||||
{
|
||||
return AppMService.SearchVal;
|
||||
}
|
||||
set
|
||||
{
|
||||
AppMService.SearchVal = value;
|
||||
reportChange();
|
||||
}
|
||||
}
|
||||
|
||||
protected override Task OnInitializedAsync()
|
||||
{
|
||||
AppMService.EA_SearchUpdated += OnSeachUpdated;
|
||||
return base.OnInitializedAsync();
|
||||
}
|
||||
|
||||
public async void OnSeachUpdated()
|
||||
{
|
||||
await InvokeAsync(() =>
|
||||
{
|
||||
StateHasChanged();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
private void reportChange()
|
||||
{
|
||||
searchUpdated.InvokeAsync(searchVal);
|
||||
}
|
||||
|
||||
private void reset()
|
||||
{
|
||||
searchVal = "";
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
<div class="input-group input-group-sm">
|
||||
<div class="input-group-text">
|
||||
<span class="me-1 @leftStringCSS">@leftString</span>
|
||||
<div class="form-check form-check-sm form-switch py-1" title="Parameter View Mode (RealTime / LogData)">
|
||||
<input class="form-check-input" type="checkbox" id="mySwitch" name="setupAlarms" checked @onclick="() => toggle()">
|
||||
</div>
|
||||
<span class="@rightStringCSS">@rightString</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,127 @@
|
||||
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.INVE;
|
||||
using MP.INVE.Shared;
|
||||
using MP.INVE.Components;
|
||||
using MP.INVE.Data;
|
||||
|
||||
namespace MP.INVE.Components
|
||||
{
|
||||
public partial class ToggleMode
|
||||
{
|
||||
[Parameter]
|
||||
public EventCallback<SelectGlobalToggle> FilterChanged { get; set; }
|
||||
|
||||
[Parameter]
|
||||
public SelectGlobalToggle SelFilter { get; set; } = new SelectGlobalToggle();
|
||||
|
||||
protected bool isActive
|
||||
{
|
||||
get => SelFilter.isActive;
|
||||
set
|
||||
{
|
||||
if (SelFilter.isActive != value)
|
||||
{
|
||||
SelFilter.isActive = value;
|
||||
reportChange();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected string leftString
|
||||
{
|
||||
get => SelFilter.leftString;
|
||||
set
|
||||
{
|
||||
if (SelFilter.leftString != value)
|
||||
{
|
||||
SelFilter.leftString = value;
|
||||
reportChange();
|
||||
}
|
||||
}
|
||||
}
|
||||
protected string leftStringCSS
|
||||
{
|
||||
get => SelFilter.leftStringCSS;
|
||||
set
|
||||
{
|
||||
if (SelFilter.leftStringCSS != value)
|
||||
{
|
||||
SelFilter.leftStringCSS = value;
|
||||
reportChange();
|
||||
}
|
||||
}
|
||||
}
|
||||
protected string rightString
|
||||
{
|
||||
get => SelFilter.rightString;
|
||||
set
|
||||
{
|
||||
if (SelFilter.rightString != value)
|
||||
{
|
||||
SelFilter.rightString = value;
|
||||
reportChange();
|
||||
}
|
||||
}
|
||||
}
|
||||
protected string rightStringCSS
|
||||
{
|
||||
get => SelFilter.rightStringCSS;
|
||||
set
|
||||
{
|
||||
if (SelFilter.rightStringCSS != value)
|
||||
{
|
||||
SelFilter.rightStringCSS = value;
|
||||
reportChange();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected void toggle()
|
||||
{
|
||||
var currFilt = SelFilter;
|
||||
currFilt.isActive = !currFilt.isActive;
|
||||
SelFilter = currFilt;
|
||||
if (isActive)
|
||||
{
|
||||
rightStringCSS = "fw-bold";
|
||||
leftStringCSS = "text-secondary";
|
||||
}
|
||||
else
|
||||
{
|
||||
leftStringCSS = "fw-bold";
|
||||
rightStringCSS = "text-secondary";
|
||||
}
|
||||
}
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
if (isActive)
|
||||
{
|
||||
rightStringCSS = "fw-bold";
|
||||
leftStringCSS = "text-secondary";
|
||||
}
|
||||
else
|
||||
{
|
||||
leftStringCSS = "fw-bold";
|
||||
rightStringCSS = "text-secondary";
|
||||
}
|
||||
await FilterChanged.InvokeAsync(SelFilter);
|
||||
}
|
||||
|
||||
private void reportChange()
|
||||
{
|
||||
FilterChanged.InvokeAsync(SelFilter);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
using System.Drawing;
|
||||
|
||||
namespace MP.INVE.Data
|
||||
{
|
||||
public class DoughnutStyling
|
||||
{
|
||||
public string color { get; set; }
|
||||
public string border { get; set; }
|
||||
|
||||
public DoughnutStyling(string color, string border)
|
||||
{
|
||||
this.color = color;
|
||||
this.border = border;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,166 @@
|
||||
namespace MP.INVE.Data
|
||||
{
|
||||
public class MessageService
|
||||
{
|
||||
#region Public Events
|
||||
|
||||
public event Action EA_PageUpdated = null!;
|
||||
|
||||
public event Action EA_SearchUpdated = null!;
|
||||
|
||||
public event Action EA_ShowSearch = null!;
|
||||
|
||||
public event Action EA_StatoSearch = null!;
|
||||
|
||||
#endregion Public Events
|
||||
|
||||
#region Public Properties
|
||||
|
||||
public int currPage
|
||||
{
|
||||
get => _currPage;
|
||||
set
|
||||
{
|
||||
if (_currPage != value)
|
||||
{
|
||||
_currPage = value;
|
||||
if (EA_PageUpdated != null)
|
||||
{
|
||||
EA_PageUpdated?.Invoke();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public int numRecord
|
||||
{
|
||||
get => _numRecord;
|
||||
set
|
||||
{
|
||||
if (_numRecord != value)
|
||||
{
|
||||
_numRecord = value;
|
||||
if (EA_PageUpdated != null)
|
||||
{
|
||||
EA_PageUpdated?.Invoke();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public string SearchVal
|
||||
{
|
||||
get => searchVal;
|
||||
set
|
||||
{
|
||||
//if (searchVal != value)
|
||||
//{
|
||||
searchVal = value;
|
||||
|
||||
if (EA_SearchUpdated != null)
|
||||
{
|
||||
EA_SearchUpdated?.Invoke();
|
||||
}
|
||||
//}
|
||||
}
|
||||
}
|
||||
|
||||
public bool ShowSearch
|
||||
{
|
||||
get => showSearch;
|
||||
set
|
||||
{
|
||||
if (showSearch != value)
|
||||
{
|
||||
showSearch = value;
|
||||
if (EA_ShowSearch != null)
|
||||
{
|
||||
EA_ShowSearch?.Invoke();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public string StateSel
|
||||
{
|
||||
get => stateSel;
|
||||
set
|
||||
{
|
||||
stateSel = value;
|
||||
|
||||
if (EA_StatoSearch != null)
|
||||
{
|
||||
EA_StatoSearch?.Invoke();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public string TipoSearch
|
||||
{
|
||||
get => tipoSearch;
|
||||
set
|
||||
{
|
||||
if (tipoSearch != value)
|
||||
{
|
||||
tipoSearch = value;
|
||||
if (EA_ShowSearch != null)
|
||||
{
|
||||
EA_ShowSearch?.Invoke();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public int totalCount
|
||||
{
|
||||
get => _totalCount;
|
||||
set
|
||||
{
|
||||
if (_totalCount != value)
|
||||
{
|
||||
_totalCount = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Public Properties
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
protected void reportPaging()
|
||||
{
|
||||
if (EA_PageUpdated != null)
|
||||
{
|
||||
EA_PageUpdated?.Invoke();
|
||||
}
|
||||
}
|
||||
|
||||
protected void reportSearch()
|
||||
{
|
||||
if (EA_SearchUpdated != null)
|
||||
{
|
||||
EA_SearchUpdated?.Invoke();
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Protected Methods
|
||||
|
||||
#region Private Fields
|
||||
|
||||
private string searchVal = "";
|
||||
private bool showSearch;
|
||||
private string stateSel = "*";
|
||||
private string tipoSearch = "";
|
||||
|
||||
#endregion Private Fields
|
||||
|
||||
#region Private Properties
|
||||
|
||||
private int _currPage { get; set; } = 1;
|
||||
|
||||
private int _numRecord { get; set; } = 10;
|
||||
private int _totalCount { get; set; } = 0;
|
||||
|
||||
#endregion Private Properties
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,146 @@
|
||||
using MP.Data;
|
||||
using MP.Data.Conf;
|
||||
using MP.Data.DatabaseModels;
|
||||
using MP.Data.DTO;
|
||||
using Newtonsoft.Json;
|
||||
using NLog;
|
||||
using StackExchange.Redis;
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace MP.INVE.Data
|
||||
{
|
||||
public class MiDataService : IDisposable
|
||||
{
|
||||
#region Public Constructors
|
||||
|
||||
public MiDataService(IConfiguration configuration, ILogger<MiDataService> logger)
|
||||
{
|
||||
_logger = logger;
|
||||
_logger.LogInformation("Starting MiDataService INIT");
|
||||
_configuration = configuration;
|
||||
|
||||
// setup compoenti REDIS
|
||||
redisConn = ConnectionMultiplexer.Connect(_configuration.GetConnectionString("Redis"));
|
||||
redisConnAdmin = ConnectionMultiplexer.Connect(_configuration.GetConnectionString("RedisAdmin"));
|
||||
redisDb = redisConn.GetDatabase();
|
||||
|
||||
// leggo cache lungo periodo
|
||||
int.TryParse(_configuration.GetValue<string>("ServerConf:redisLongTimeCache"), out redisLongTimeCache);
|
||||
|
||||
_logger.LogInformation("Redis INIT");
|
||||
|
||||
// conf DB
|
||||
string connStrData = _configuration.GetConnectionString("Mp.Data");
|
||||
string connStrInve = _configuration.GetConnectionString("Mp.Inve");
|
||||
if (string.IsNullOrEmpty(connStrData) || string.IsNullOrEmpty(connStrInve))
|
||||
{
|
||||
_logger.LogError($"DbController: ConnString empty! connStrData: {connStrData} | connStrInve: {connStrInve}");
|
||||
}
|
||||
else
|
||||
{
|
||||
dbController = new MP.Data.Controllers.MpInveController(configuration);
|
||||
_logger.LogInformation("DbController OK");
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Public Constructors
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
}
|
||||
|
||||
#region Public Properties
|
||||
|
||||
public static MP.Data.Controllers.MpInveController dbController { get; set; } = null!;
|
||||
|
||||
/// <summary>
|
||||
/// Dizionario dei tag configurati per IOB
|
||||
/// </summary>
|
||||
public Dictionary<string, List<TagData>> currTagConf { get; set; } = new Dictionary<string, List<TagData>>();
|
||||
|
||||
#endregion Public Properties
|
||||
|
||||
#region Public Methods
|
||||
|
||||
public List<AnagOperatoriModel> ElencoOperatori()
|
||||
{
|
||||
List<AnagOperatoriModel>? result = new List<AnagOperatoriModel>();
|
||||
result = dbController.ElencoOperatori();
|
||||
return result;
|
||||
}
|
||||
|
||||
public bool LoginOperatore(int MatrOpr, string authKey)
|
||||
{
|
||||
bool result = false;
|
||||
result = dbController.LoginOperatore(MatrOpr, authKey);
|
||||
return result;
|
||||
}
|
||||
|
||||
public List<InventorySessionModel> InventSessCurrList()
|
||||
{
|
||||
List<InventorySessionModel> result = new List<InventorySessionModel>();
|
||||
result = dbController.InventSessCurrList();
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
#endregion Public Methods
|
||||
|
||||
#region Protected Fields
|
||||
|
||||
protected Random rand = new Random();
|
||||
|
||||
#endregion Protected Fields
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
/// <summary>
|
||||
/// Restituisce un timeout dai minuti richiesti + tempo random 1..60 sec
|
||||
/// </summary>
|
||||
/// <param name="stdMinutes"></param>
|
||||
/// <returns></returns>
|
||||
protected TimeSpan getRandTOut(int stdMinutes)
|
||||
{
|
||||
double rndValue = (double)stdMinutes + (double)rand.Next(1, 60) / 60;
|
||||
return TimeSpan.FromMinutes(rndValue);
|
||||
}
|
||||
|
||||
#endregion Protected Methods
|
||||
|
||||
#region Private Fields
|
||||
|
||||
private static IConfiguration _configuration = null!;
|
||||
|
||||
private static ILogger<MiDataService> _logger = null!;
|
||||
|
||||
private static Logger Log = LogManager.GetCurrentClassLogger();
|
||||
|
||||
/// <summary>
|
||||
/// Oggetto vocabolario x uso continuo traduzione
|
||||
/// </summary>
|
||||
private List<VocabolarioModel> ObjVocabolario = new List<VocabolarioModel>();
|
||||
|
||||
/// <summary>
|
||||
/// Oggetto per connessione a REDIS
|
||||
/// </summary>
|
||||
private ConnectionMultiplexer redisConn = null!;
|
||||
|
||||
/// <summary>
|
||||
/// Oggetto per connessione a REDIS modalità admin (ex flux dati)
|
||||
/// </summary>
|
||||
private ConnectionMultiplexer redisConnAdmin = null!;
|
||||
|
||||
/// <summary>
|
||||
/// Oggetto DB redis da impiegare x chiamate R/W
|
||||
/// </summary>
|
||||
private IDatabase redisDb = null!;
|
||||
|
||||
private int redisLongTimeCache = 5;
|
||||
|
||||
#endregion Private Fields
|
||||
|
||||
#region Private Methods
|
||||
|
||||
#endregion Private Methods
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,74 @@
|
||||
namespace MP.INVE.Data
|
||||
{
|
||||
public class SelectArticoliParams
|
||||
{
|
||||
#region Public Constructors
|
||||
|
||||
public SelectArticoliParams()
|
||||
{ }
|
||||
|
||||
#endregion Public Constructors
|
||||
|
||||
#region Public Properties
|
||||
|
||||
|
||||
public int CurrPage { get; set; } = 1;
|
||||
|
||||
public string IdxMacchina { get; set; } = "*";
|
||||
public string Azienda { get; set; } = "*";
|
||||
|
||||
public int MaxRecord { get; set; } = 100;
|
||||
|
||||
public int NumRec { get; set; } = 10;
|
||||
|
||||
public int TotCount { get; set; } = 0;
|
||||
|
||||
#endregion Public Properties
|
||||
|
||||
#region Public Methods
|
||||
|
||||
public SelectArticoliParams clone()
|
||||
{
|
||||
SelectArticoliParams clonedData = new SelectArticoliParams()
|
||||
{
|
||||
CurrPage = this.CurrPage,
|
||||
IdxMacchina = this.IdxMacchina,
|
||||
Azienda = this.Azienda,
|
||||
MaxRecord = this.MaxRecord,
|
||||
NumRec = this.NumRec,
|
||||
TotCount = this.TotCount
|
||||
};
|
||||
return clonedData;
|
||||
}
|
||||
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
if (!(obj is SelectArticoliParams item))
|
||||
return false;
|
||||
|
||||
if (MaxRecord != item.MaxRecord)
|
||||
return false;
|
||||
|
||||
if (NumRec != item.NumRec)
|
||||
return false;
|
||||
|
||||
if (TotCount != item.TotCount)
|
||||
return false;
|
||||
|
||||
if (CurrPage != item.CurrPage)
|
||||
return false;
|
||||
|
||||
if (IdxMacchina != item.IdxMacchina)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public override int GetHashCode()
|
||||
{
|
||||
return base.GetHashCode();
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,86 @@
|
||||
using MP.Data;
|
||||
|
||||
namespace MP.INVE.Data
|
||||
{
|
||||
public class SelectDossierParams
|
||||
{
|
||||
#region Public Constructors
|
||||
|
||||
public SelectDossierParams()
|
||||
{ }
|
||||
|
||||
#endregion Public Constructors
|
||||
|
||||
#region Public Properties
|
||||
|
||||
public int CurrPage { get; set; } = 1;
|
||||
|
||||
public DateTime DtEnd { get; set; } = Utils.InitDatetime(DateTime.Now, 15);
|
||||
|
||||
public DateTime DtStart { get; set; } = Utils.InitDatetime(DateTime.Now, 15).AddDays(-730);
|
||||
|
||||
public string IdxMacchina { get; set; } = "*";
|
||||
|
||||
public string CodArticolo { get; set; } = "*";
|
||||
public int NumRec { get; set; } = 10;
|
||||
public int TotCount { get; set; } = 0;
|
||||
public int MaxRecord { get; set; } = 100;
|
||||
public bool isEditing { get; set; } = false;
|
||||
|
||||
#endregion Public Properties
|
||||
|
||||
#region Public Methods
|
||||
public SelectDossierParams clone()
|
||||
{
|
||||
SelectDossierParams clonedData = new SelectDossierParams()
|
||||
{
|
||||
DtEnd = this.DtEnd,
|
||||
DtStart = this.DtStart,
|
||||
CurrPage = this.CurrPage,
|
||||
IdxMacchina = this.IdxMacchina,
|
||||
CodArticolo = this.CodArticolo,
|
||||
MaxRecord = this.MaxRecord,
|
||||
NumRec = this.NumRec,
|
||||
TotCount = this.TotCount
|
||||
};
|
||||
return clonedData;
|
||||
}
|
||||
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
if (!(obj is SelectDossierParams item))
|
||||
return false;
|
||||
|
||||
if (IdxMacchina != item.IdxMacchina)
|
||||
return false;
|
||||
|
||||
if (CodArticolo != item.CodArticolo)
|
||||
return false;
|
||||
|
||||
if (MaxRecord != item.MaxRecord)
|
||||
return false;
|
||||
|
||||
if (TotCount != item.TotCount)
|
||||
return false;
|
||||
|
||||
if (NumRec != item.NumRec)
|
||||
return false;
|
||||
|
||||
if (DtEnd != item.DtEnd)
|
||||
return false;
|
||||
|
||||
if (CurrPage != item.CurrPage)
|
||||
return false;
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public override int GetHashCode()
|
||||
{
|
||||
return base.GetHashCode();
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,109 @@
|
||||
namespace MP.INVE.Data
|
||||
{
|
||||
public class SelectFluxParams
|
||||
{
|
||||
#region Public Constructors
|
||||
|
||||
public SelectFluxParams()
|
||||
{
|
||||
dtMin = DateTime.Today.AddMonths(-1);
|
||||
dtMax = DateTime.Today.AddDays(1);
|
||||
dtSnapMin = DateTime.Today.AddDays(-2);
|
||||
}
|
||||
|
||||
#endregion Public Constructors
|
||||
|
||||
#region Public Properties
|
||||
|
||||
public string CodFlux { get; set; } = "*";
|
||||
public int CurrPage { get; set; } = 1;
|
||||
public DateTime? dtRif { get; set; } = null;
|
||||
public DateTime? dtMax { get; set; } = null;
|
||||
public DateTime? dtMin { get; set; } = null;
|
||||
public DateTime? dtSnapMin { get; set; } = null;
|
||||
public string IdxMacchina { get; set; } = "*";
|
||||
public string lastUpdate { get; set; } = "-";
|
||||
public bool LiveUpdate { get; set; } = true;
|
||||
public int NumRec { get; set; } = 10;
|
||||
public int MaxRecord { get; set; } = 100;
|
||||
public int TempoAgg { get; set; } = 10000;
|
||||
public int TotCount { get; set; } = 0;
|
||||
|
||||
#endregion Public Properties
|
||||
|
||||
#region Public Methods
|
||||
public SelectFluxParams clone()
|
||||
{
|
||||
SelectFluxParams clonedData = new SelectFluxParams()
|
||||
{
|
||||
CodFlux = this.CodFlux,
|
||||
CurrPage = this.CurrPage,
|
||||
dtRif = this.dtRif,
|
||||
dtMax = this.dtMax,
|
||||
dtMin = this.dtMin,
|
||||
dtSnapMin = this.dtSnapMin,
|
||||
IdxMacchina = this.IdxMacchina,
|
||||
lastUpdate = this.lastUpdate,
|
||||
LiveUpdate = this.LiveUpdate,
|
||||
NumRec = this.NumRec,
|
||||
MaxRecord = this.MaxRecord,
|
||||
TotCount = this.TotCount,
|
||||
TempoAgg = this.TempoAgg
|
||||
};
|
||||
return clonedData;
|
||||
}
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
if (!(obj is SelectFluxParams item))
|
||||
return false;
|
||||
|
||||
if (IdxMacchina != item.IdxMacchina)
|
||||
return false;
|
||||
|
||||
if (dtMax != item.dtMax)
|
||||
return false;
|
||||
|
||||
if (dtMin != item.dtMin)
|
||||
return false;
|
||||
|
||||
if (dtRif != item.dtRif)
|
||||
return false;
|
||||
|
||||
if (dtSnapMin != item.dtSnapMin)
|
||||
return false;
|
||||
|
||||
if (CodFlux != item.CodFlux)
|
||||
return false;
|
||||
|
||||
if (LiveUpdate != item.LiveUpdate)
|
||||
return false;
|
||||
|
||||
if (MaxRecord != item.MaxRecord)
|
||||
return false;
|
||||
|
||||
if (TempoAgg != item.TempoAgg)
|
||||
return false;
|
||||
|
||||
if (NumRec != item.NumRec)
|
||||
return false;
|
||||
|
||||
if (TotCount != item.TotCount)
|
||||
return false;
|
||||
|
||||
if (CurrPage != item.CurrPage)
|
||||
return false;
|
||||
|
||||
if (lastUpdate != item.lastUpdate)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public override int GetHashCode()
|
||||
{
|
||||
return base.GetHashCode();
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
namespace MP.INVE.Data
|
||||
{
|
||||
public class SelectGlobalToggle
|
||||
{
|
||||
#region Public Constructors
|
||||
|
||||
public SelectGlobalToggle()
|
||||
{ }
|
||||
|
||||
#endregion Public Constructors
|
||||
|
||||
#region Public Properties
|
||||
|
||||
/// <summary>
|
||||
/// Bool: indica se il toggle è attivo
|
||||
/// </summary>
|
||||
public bool isActive { get; set; } = true;
|
||||
|
||||
/// <summary>
|
||||
/// string: stringa da mostrare a sinistra (disattivo onInitialize)
|
||||
/// </summary>
|
||||
public string leftString { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// string: stringa da mostrare a destra (attivo onInitialize)
|
||||
/// </summary>
|
||||
public string rightString { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// string: stile stringa da mostrare a sinistra (disattivo onInitialize)
|
||||
/// </summary>
|
||||
public string leftStringCSS { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// string: stile stringa da mostrare a destra (attivo onInitialize)
|
||||
/// </summary>
|
||||
public string rightStringCSS { get; set; } = "";
|
||||
|
||||
|
||||
#endregion Public Properties
|
||||
|
||||
#region Public Methods
|
||||
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
if (!(obj is SelectGlobalToggle item))
|
||||
return false;
|
||||
|
||||
if (isActive != item.isActive)
|
||||
return false;
|
||||
|
||||
if (leftString != item.leftString)
|
||||
return false;
|
||||
|
||||
if (rightString != item.rightString)
|
||||
return false;
|
||||
|
||||
if (leftStringCSS != item.leftStringCSS)
|
||||
return false;
|
||||
|
||||
if (rightStringCSS != item.rightStringCSS)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public override int GetHashCode()
|
||||
{
|
||||
return base.GetHashCode();
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
using MP.Data;
|
||||
|
||||
namespace MP.INVE.Data
|
||||
{
|
||||
public class SelectOdlParams
|
||||
{
|
||||
#region Public Constructors
|
||||
|
||||
public SelectOdlParams()
|
||||
{ }
|
||||
|
||||
#endregion Public Constructors
|
||||
|
||||
#region Public Properties
|
||||
|
||||
public string CodStato { get; set; } = "*";
|
||||
public string IdxMacchina { get; set; } = "*";
|
||||
public int CurrPage { get; set; } = 1;
|
||||
public int NumRec { get; set; } = 10;
|
||||
public int TotCount { get; set; } = 0;
|
||||
public DateTime DtEnd { get; set; } = Utils.InitDatetime(DateTime.Now, 5);
|
||||
public DateTime DtStart { get; set; } = Utils.InitDatetime(DateTime.Now, 5).AddDays(-10);
|
||||
public int MaxRecord { get; set; } = 100;
|
||||
public bool IsActive { get; set; } = true;
|
||||
public string SearchVal { get; set; } = "*";
|
||||
|
||||
#endregion Public Properties
|
||||
|
||||
#region Public Methods
|
||||
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
if (!(obj is SelectOdlParams item))
|
||||
return false;
|
||||
|
||||
if (IsActive != item.IsActive)
|
||||
return false;
|
||||
|
||||
if (CodStato != item.CodStato)
|
||||
return false;
|
||||
|
||||
if (IdxMacchina != item.IdxMacchina)
|
||||
return false;
|
||||
|
||||
if (MaxRecord != item.MaxRecord)
|
||||
return false;
|
||||
|
||||
if (NumRec != item.NumRec)
|
||||
return false;
|
||||
|
||||
if (DtStart != item.DtStart)
|
||||
return false;
|
||||
|
||||
if (DtEnd != item.DtEnd)
|
||||
return false;
|
||||
|
||||
if (CurrPage != item.CurrPage)
|
||||
return false;
|
||||
|
||||
if (SearchVal != item.SearchVal)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public override int GetHashCode()
|
||||
{
|
||||
return base.GetHashCode();
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
namespace MP.INVE.Data
|
||||
{
|
||||
public class SelectPOdlParams
|
||||
{
|
||||
#region Public Constructors
|
||||
|
||||
public SelectPOdlParams()
|
||||
{ }
|
||||
|
||||
#endregion Public Constructors
|
||||
|
||||
#region Public Properties
|
||||
|
||||
public string CodFase { get; set; } = "*";
|
||||
|
||||
public int CurrPage { get; set; } = 1;
|
||||
|
||||
public string IdxMacchina { get; set; } = "*";
|
||||
|
||||
public int MaxRecord { get; set; } = 100;
|
||||
|
||||
public int NumRec { get; set; } = 10;
|
||||
|
||||
public string SearchVal { get; set; } = "*";
|
||||
|
||||
public int TotCount { get; set; } = 0;
|
||||
|
||||
#endregion Public Properties
|
||||
|
||||
#region Public Methods
|
||||
|
||||
public SelectPOdlParams clone()
|
||||
{
|
||||
SelectPOdlParams clonedData = new SelectPOdlParams()
|
||||
{
|
||||
CodFase = this.CodFase,
|
||||
CurrPage = this.CurrPage,
|
||||
IdxMacchina = this.IdxMacchina,
|
||||
MaxRecord = this.MaxRecord,
|
||||
NumRec = this.NumRec,
|
||||
SearchVal = this.SearchVal,
|
||||
TotCount = this.TotCount
|
||||
};
|
||||
return clonedData;
|
||||
}
|
||||
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
if (!(obj is SelectPOdlParams item))
|
||||
return false;
|
||||
|
||||
if (CodFase != item.CodFase)
|
||||
return false;
|
||||
|
||||
if (MaxRecord != item.MaxRecord)
|
||||
return false;
|
||||
|
||||
if (NumRec != item.NumRec)
|
||||
return false;
|
||||
|
||||
if (TotCount != item.TotCount)
|
||||
return false;
|
||||
|
||||
if (CurrPage != item.CurrPage)
|
||||
return false;
|
||||
|
||||
if (IdxMacchina != item.IdxMacchina)
|
||||
return false;
|
||||
|
||||
if (SearchVal != item.SearchVal)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public override int GetHashCode()
|
||||
{
|
||||
return base.GetHashCode();
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<RootNamespace>MP.INVE</RootNamespace>
|
||||
<Version>6.16.2211.1510</Version>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Content Remove="compilerconfig.json" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Include="compilerconfig.json" />
|
||||
<None Include="wwwroot\lib\Chart.js\chart.esm.js" />
|
||||
<None Include="wwwroot\lib\Chart.js\chart.esm.min.js" />
|
||||
<None Include="wwwroot\lib\Chart.js\chart.js" />
|
||||
<None Include="wwwroot\lib\Chart.js\chart.min.js" />
|
||||
<None Include="wwwroot\lib\Chart.js\helpers.esm.js" />
|
||||
<None Include="wwwroot\lib\Chart.js\helpers.esm.min.js" />
|
||||
<None Include="wwwroot\lib\chartjs-adapter-luxon\chartjs-adapter-luxon.esm.js" />
|
||||
<None Include="wwwroot\lib\chartjs-adapter-luxon\chartjs-adapter-luxon.esm.min.js" />
|
||||
<None Include="wwwroot\lib\chartjs-adapter-luxon\chartjs-adapter-luxon.js" />
|
||||
<None Include="wwwroot\lib\chartjs-adapter-luxon\chartjs-adapter-luxon.min.js" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.AspNetCore.Authentication.Negotiate" Version="6.0.9" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\MP.Data\MP.Data.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Content Update="wwwroot\favicon.ico">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Update="logs\.placeholder">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="post-build.ps1">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
<Target Name="PostBuild" AfterTargets="PostBuildEvent">
|
||||
<Exec Command="powershell.exe -ExecutionPolicy Unrestricted -NoProfile -NonInteractive -File $(ProjectDir)\post-build.ps1 -ProjectDir $(ProjectDir) -ProjectPath $(ProjectPath)" />
|
||||
</Target>
|
||||
|
||||
</Project>
|
||||
@@ -0,0 +1,46 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.nlog-project.org/schemas/NLog.xsd NLog.xsd"
|
||||
autoReload="true"
|
||||
throwExceptions="false"
|
||||
internalLogLevel="Off" internalLogFile="c:\temp\nlog-internal.log">
|
||||
|
||||
<!-- optional, add some variables
|
||||
https://github.com/nlog/NLog/wiki/Configuration-file#variables
|
||||
-->
|
||||
<variable name="myvar" value="myvalue" />
|
||||
|
||||
<!--
|
||||
See https://github.com/nlog/nlog/wiki/Configuration-file
|
||||
for information on customizing logging rules and outputs.
|
||||
-->
|
||||
<targets>
|
||||
|
||||
<!--
|
||||
add your targets here
|
||||
See https://github.com/nlog/NLog/wiki/Targets for possible targets.
|
||||
See https://github.com/nlog/NLog/wiki/Layout-Renderers for the possible layout renderers.
|
||||
-->
|
||||
|
||||
<!--
|
||||
Write events to a file with the date in the filename.
|
||||
<target xsi:type="File" name="f" fileName="${basedir}/logs/${shortdate}.log"
|
||||
layout="${longdate} ${uppercase:${level}} ${message}" />
|
||||
-->
|
||||
<target xsi:type="File" name="fileTarget" fileName="${basedir}/logs/${shortdate}.log" layout="${longdate} | ${uppercase:${level}} | ${logger:shortName=false} | ${message}" />
|
||||
<target xsi:type="ColoredConsole" name="consoleTarget" layout="${longdate} | ${uppercase:${level}} | ${logger:shortName=true} | ${message}" />
|
||||
</targets>
|
||||
|
||||
<rules>
|
||||
<!-- add your logging rules here -->
|
||||
|
||||
<!--
|
||||
Write all events with minimal level of Debug (So Debug, Info, Warn, Error and Fatal, but not Trace) to "f"
|
||||
<logger name="*" minlevel="Debug" writeTo="f" />
|
||||
-->
|
||||
<logger name="*" minlevel="Trace" writeTo="consoleTarget" />
|
||||
<!--<logger name="Microsoft.*" maxlevel="Info" final="true" />-->
|
||||
<logger name="*" minlevel="Info" writeTo="fileTarget" />
|
||||
</rules>
|
||||
</nlog>
|
||||
@@ -0,0 +1,7 @@
|
||||
@page "/Acquisizione"
|
||||
|
||||
<h3>Acquisizione</h3>
|
||||
|
||||
@code {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,179 @@
|
||||
@page "/ART"
|
||||
|
||||
@using MP.INVE.Components
|
||||
@using MP.INVE.Data
|
||||
|
||||
<div class="card mb-5">
|
||||
<div class="card-header table-primary">
|
||||
<div class="d-flex justify-content-between">
|
||||
<div class="px-0">
|
||||
<div class="d-flex justify-content-between">
|
||||
<div class="px-2">
|
||||
<h3>Articoli </h3>
|
||||
</div>
|
||||
<div class="px-2">
|
||||
<button class="btn btn-success" @onclick="() => addNew()">Nuovo <i class="bi bi-plus-square"></i></button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="px-0 align-content-center">
|
||||
<div class="input-group input-group">
|
||||
<label class="input-group-text" for="maxRecord" title="Selezionare l'azienda da visualizzare"><i class="fa-solid fa-industry"></i></label>
|
||||
<select @bind="@selAzienda" class="form-select" title="Selezionare l'azienda da visualizzare">
|
||||
@if (ListAziende != null)
|
||||
{
|
||||
foreach (var item in ListAziende)
|
||||
{
|
||||
<option value="@item.CodGruppo">@item.DescrGruppo</option>
|
||||
}
|
||||
}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@if (currRecord != null)
|
||||
{
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="card mb-5">
|
||||
<div class="card-header bg-primary text-light">Modifica</div>
|
||||
<div class="card-body">
|
||||
|
||||
<div class="row">
|
||||
<div class="col-3">
|
||||
<div class="input-group">
|
||||
<span class="input-group-text">Codice</span>
|
||||
<input type="text" class="form-control" placeholder="Articolo" @bind-value="@currRecord.CodArticolo">
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-5">
|
||||
<div class="input-group">
|
||||
<span class="input-group-text">Disegno</span>
|
||||
<input type="text" class="form-control" placeholder="Disegno" @bind-value="@currRecord.Disegno">
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-4">
|
||||
<div class="input-group" title="Azienda">
|
||||
<span class="input-group-text">Azienda</span>
|
||||
<select @bind="@currRecord.Azienda" class="form-select text-end">
|
||||
@if (ListAziende != null)
|
||||
{
|
||||
foreach (var item in ListAziende.Where(x => x.CodGruppo != "*").ToList())
|
||||
{
|
||||
<option value="@item.CodGruppo">@item.DescrGruppo</option>
|
||||
}
|
||||
}
|
||||
</select>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row mt-2">
|
||||
<div class="col-3">
|
||||
<div class="input-group" title="Tipo">
|
||||
<span class="input-group-text">Tipo</span>
|
||||
<select @bind="@currRecord.Tipo" class="form-select text-end">
|
||||
@if (ListTipoArt != null)
|
||||
{
|
||||
foreach (var item in ListTipoArt)
|
||||
{
|
||||
<option value="@item.value">@item.label</option>
|
||||
}
|
||||
}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-5">
|
||||
<div class="input-group">
|
||||
<span class="input-group-text">Descrizione</span>
|
||||
<input type="text" class="form-control" placeholder="Descrizione Articolo" @bind-value="@currRecord.DescArticolo">
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-2">
|
||||
<div class="d-grid gap-2">
|
||||
<button class="btn btn-warning" @onclick="() => cancel()">Annulla <i class="bi bi-x-circle"></i></button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-2">
|
||||
<div class="d-grid gap-2">
|
||||
<button class="btn btn-success" @onclick="() => update(currRecord)">Salva <i class="bi bi-save"></i></button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@*<div class="card-footer">Footer</div>*@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
<div class="card-body">
|
||||
|
||||
@if (ListRecords == null)
|
||||
{
|
||||
<LoadingData></LoadingData>
|
||||
}
|
||||
else if (totalCount == 0)
|
||||
{
|
||||
<div class="alert alert-warning text-center display-4">Nessun record trovato</div>
|
||||
}
|
||||
else
|
||||
{
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<table class="table table-sm table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>
|
||||
@if (currRecord != null)
|
||||
{
|
||||
<button @onclick="() => resetSel()" class="btn btn-primary btn-sm"><i class="bi bi-arrow-counterclockwise"></i></button>
|
||||
}
|
||||
</th>
|
||||
<th><i class="fa-solid fa-file"></i> Articolo</th>
|
||||
<th><i class="fa-solid fa-compass-drafting"></i> Disegno</th>
|
||||
<th><i class="fa-solid fa-file-word"></i> Descrizione</th>
|
||||
<th><i class="fa-solid fa-rectangle-list"></i> Tipo</th>
|
||||
<th><i class="fa-solid fa-industry"></i> Azienda</th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach (var record in ListRecords)
|
||||
{
|
||||
<tr class="@checkSelect(@record.CodArticolo)">
|
||||
<td>
|
||||
<button @onclick="() => selRecord(record)" class="btn btn-primary btn-sm" title="Modifica Record"><i class="bi bi-pencil-square"></i></button>
|
||||
<button @onclick="() => cloneRecord(record)" class="btn btn-info btn-sm" title="Duplica Record"><i class="bi bi-clipboard-check"></i></button>
|
||||
</td>
|
||||
<td>
|
||||
<div>@record.CodArticolo</div>
|
||||
</td>
|
||||
<td>
|
||||
<div class="small">@record.Disegno</div>
|
||||
</td>
|
||||
<td>
|
||||
<div class="small">@record.DescArticolo</div>
|
||||
</td>
|
||||
<td>
|
||||
<div>@record.Tipo</div>
|
||||
</td>
|
||||
<td>@record.Azienda</td>
|
||||
<td>
|
||||
@if (ArticoloDelEnabled(record.CodArticolo))
|
||||
{
|
||||
<button @onclick="() => deleteRecord(record)" class="btn btn-danger btn-sm"><i class="bi bi-trash-fill"></i></button>
|
||||
}
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
<div class="card-footer py-1">
|
||||
<DataPager PageSize="numRecord" currPage="currPage" numRecordChanged="ForceReload" numPageChanged="ForceReloadPage" totalCount="totalCount" showLoading="isLoading" />
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,299 @@
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using Microsoft.JSInterop;
|
||||
using MP.Data.DatabaseModels;
|
||||
using MP.INVE.Data;
|
||||
|
||||
namespace MP.INVE.Pages
|
||||
{
|
||||
public partial class Articoli : ComponentBase, IDisposable
|
||||
{
|
||||
#region Public Methods
|
||||
|
||||
public string checkSelect(string CodArticolo)
|
||||
{
|
||||
string answ = "";
|
||||
if (currRecord != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
answ = (currRecord.CodArticolo == CodArticolo) ? "table-info" : "";
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
private SelectArticoliParams currFilter = new SelectArticoliParams();
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
currRecord = null;
|
||||
ListTipoArt = null;
|
||||
ListAziende = null;
|
||||
SearchRecords = null;
|
||||
ListRecords = null;
|
||||
GC.Collect();
|
||||
}
|
||||
|
||||
public async void OnSeachUpdated()
|
||||
{
|
||||
await InvokeAsync(() =>
|
||||
{
|
||||
currPage = 1;
|
||||
Task task = UpdateData();
|
||||
StateHasChanged();
|
||||
});
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
|
||||
#region Protected Properties
|
||||
|
||||
[Inject]
|
||||
protected IJSRuntime JSRuntime { get; set; } = null!;
|
||||
|
||||
[Inject]
|
||||
protected MpDataService MDService { get; set; } = null!;
|
||||
|
||||
[Inject]
|
||||
protected NavigationManager NavManager { get; set; } = null!;
|
||||
|
||||
protected int totalCount
|
||||
{
|
||||
get
|
||||
{
|
||||
int answ = 0;
|
||||
if (SearchRecords != null)
|
||||
{
|
||||
answ = SearchRecords.Count;
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Protected Properties
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
/// <summary>
|
||||
/// Crea nuovo record e va in editing...
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
protected async Task addNew()
|
||||
{
|
||||
currRecord = new AnagArticoli()
|
||||
{
|
||||
CodArticolo = $"_NEW_{DateTime.Now:yyyyMMdd.HHmmss}",
|
||||
DescArticolo = "Nuovo articolo",
|
||||
Azienda = selAzienda != "*" ? selAzienda : "MAPO",
|
||||
Disegno = "",
|
||||
Tipo = "ART"
|
||||
};
|
||||
await Task.Delay(1);
|
||||
}
|
||||
|
||||
protected async Task cancel()
|
||||
{
|
||||
currRecord = null;
|
||||
await reloadData();
|
||||
await Task.Delay(1);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Eliminazione record selezionato (previa conferma)
|
||||
/// </summary>
|
||||
/// <param name="selRec"></param>
|
||||
/// <returns></returns>
|
||||
protected async Task deleteRecord(AnagArticoli selRec)
|
||||
{
|
||||
if (!await JSRuntime.InvokeAsync<bool>("confirm", "Eliminazione Articolo: sei sicuro di voler procedere?"))
|
||||
return;
|
||||
await Task.Delay(1);
|
||||
var done = await MDService.ArticoliDeleteRecord(selRec);
|
||||
currRecord = null;
|
||||
await reloadData();
|
||||
await Task.Delay(1);
|
||||
}
|
||||
|
||||
protected void ForceReload(int newNum)
|
||||
{
|
||||
numRecord = newNum;
|
||||
}
|
||||
|
||||
protected void ForceReloadPage(int newNum)
|
||||
{
|
||||
currPage = newNum;
|
||||
}
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
numRecord = 10;
|
||||
configData = await MDService.ConfigGetAll();
|
||||
var currRec = configData.FirstOrDefault(x => x.Chiave == "AZIENDA");
|
||||
if (currRec != null)
|
||||
{
|
||||
selAzienda = currRec.Valore;
|
||||
}
|
||||
ListAziende = await MDService.ElencoAziende();
|
||||
ListTipoArt = await MDService.AnagTipoArtLV();
|
||||
}
|
||||
|
||||
protected override async Task OnParametersSetAsync()
|
||||
{
|
||||
await reloadData();
|
||||
}
|
||||
|
||||
protected void ResetData()
|
||||
{
|
||||
currRecord = null;
|
||||
}
|
||||
|
||||
protected async Task resetSel()
|
||||
{
|
||||
currRecord = null;
|
||||
await Task.Delay(1);
|
||||
}
|
||||
|
||||
protected async Task selRecord(AnagArticoli selRec)
|
||||
{
|
||||
currRecord = selRec;
|
||||
await Task.Delay(1);
|
||||
}
|
||||
protected async Task cloneRecord(AnagArticoli selRec)
|
||||
{
|
||||
// creo record duplicato...
|
||||
AnagArticoli newRec = new AnagArticoli()
|
||||
{
|
||||
Azienda = selRec.Azienda,
|
||||
CodArticolo = selRec.CodArticolo,
|
||||
DescArticolo = $"CLONE - {selRec.DescArticolo}",
|
||||
Disegno = selRec.Disegno,
|
||||
Tipo = selRec.Tipo
|
||||
};
|
||||
currRecord = newRec;
|
||||
await Task.Delay(1);
|
||||
}
|
||||
|
||||
|
||||
protected async Task update(AnagArticoli selRec)
|
||||
{
|
||||
if (!await JSRuntime.InvokeAsync<bool>("confirm", "Confermi di voler salvare le modifiche?"))
|
||||
return;
|
||||
await Task.Delay(1);
|
||||
var done = await MDService.ArticoliUpdateRecord(selRec);
|
||||
currRecord = null;
|
||||
await reloadData();
|
||||
await Task.Delay(1);
|
||||
}
|
||||
|
||||
protected async Task UpdateData()
|
||||
{
|
||||
currRecord = null;
|
||||
await reloadData();
|
||||
}
|
||||
|
||||
#endregion Protected Methods
|
||||
|
||||
#region Private Fields
|
||||
|
||||
private string _selAzienda = "*";
|
||||
private AnagArticoli? currRecord = null;
|
||||
private List<AnagGruppi>? ListAziende;
|
||||
private List<AnagArticoli>? ListRecords;
|
||||
private List<ListValues>? ListTipoArt;
|
||||
private List<AnagArticoli>? SearchRecords;
|
||||
|
||||
#endregion Private Fields
|
||||
|
||||
#region Private Properties
|
||||
|
||||
private int _currPage { get; set; } = 1;
|
||||
private int _numRecord { get; set; } = 10;
|
||||
private List<ConfigModel>? configData { get; set; } = null;
|
||||
|
||||
private int currPage
|
||||
{
|
||||
get => _currPage;
|
||||
set
|
||||
{
|
||||
if (_currPage != value)
|
||||
{
|
||||
_currPage = value;
|
||||
var pUpd = Task.Run(async () => await reloadData());
|
||||
pUpd.Wait();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private bool isLoading { get; set; } = false;
|
||||
|
||||
private int numRecord
|
||||
{
|
||||
get => _numRecord;
|
||||
set
|
||||
{
|
||||
if (_numRecord != value)
|
||||
{
|
||||
_numRecord = value;
|
||||
var pUpd = Task.Run(async () => await reloadData());
|
||||
pUpd.Wait();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private string selAzienda
|
||||
{
|
||||
get => _selAzienda;
|
||||
set
|
||||
{
|
||||
if (value != _selAzienda)
|
||||
{
|
||||
_selAzienda = value;
|
||||
var pUpd = Task.Run(async () =>
|
||||
{
|
||||
// svuoto cache redis...
|
||||
ConfigModel updRec = new ConfigModel()
|
||||
{
|
||||
Chiave = "AZIENDA",
|
||||
Valore = value
|
||||
};
|
||||
await MDService.ConfigUpdate(updRec);
|
||||
await MDService.ConfigResetCache();
|
||||
// ricarico
|
||||
await Task.Delay(1);
|
||||
await reloadData();
|
||||
});
|
||||
pUpd.Wait();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private bool ShowCharts { get; set; } = false;
|
||||
|
||||
#endregion Private Properties
|
||||
|
||||
#region Private Methods
|
||||
|
||||
/// <summary>
|
||||
/// Seleziona record x editing
|
||||
/// </summary>
|
||||
/// <param name="selRec"></param>
|
||||
/// <returns></returns>
|
||||
private bool ArticoloDelEnabled(string codArt)
|
||||
{
|
||||
bool answ = MDService.ArticoloDelEnabled(codArt);
|
||||
return answ;
|
||||
}
|
||||
|
||||
private async Task reloadData()
|
||||
{
|
||||
isLoading = true;
|
||||
SearchRecords = await MDService.ArticoliGetSearch(100000, selAzienda, "");
|
||||
ListRecords = SearchRecords.Skip(numRecord * (currPage - 1)).Take(numRecord).ToList();
|
||||
isLoading = false;
|
||||
}
|
||||
|
||||
#endregion Private Methods
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
@page "/Contacts"
|
||||
@using MP.INVE.Data
|
||||
|
||||
@inject MessageService AppMService
|
||||
|
||||
<div class="row mx-2">
|
||||
<div class="col-12 col-lg-8 offset-lg-2">
|
||||
<div class="card">
|
||||
<div class="card-header text-center">
|
||||
<div class="row">
|
||||
<div class="col-4"></div>
|
||||
<div class="col-4">
|
||||
<h2>@Titolo</h2>
|
||||
</div>
|
||||
<div class="col-4">
|
||||
<div class="badge rounded-pill bg-dark px-4 py-2">
|
||||
<div class="px-1">
|
||||
<a class="btn text-light text-decoration-none" href="https://www.egalware.com/" target="_blank">powered by EgalWare <img width="24" class="img-fluid" src="images/LogoEgw.png" /></a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div class="row">
|
||||
<div class="col-lg-3"></div>
|
||||
<div class="col-12 col-lg-6 py-3">
|
||||
<img src="images/LogoMapoFull.png" class="img-fluid" />
|
||||
</div>
|
||||
<div class="col-lg-3"></div>
|
||||
<div class="col-12">
|
||||
<h4 class="card-title">@Messaggio</h4>
|
||||
</div>
|
||||
<div class="col-sm-4">
|
||||
<h4>Sede Operativa</h4>
|
||||
<address>
|
||||
<strong>EgalWare s.r.l.</strong><br />
|
||||
via Nazionale, 93<br />
|
||||
24068 Seriate - BG<br />
|
||||
<abbr title="Phone">P:</abbr>
|
||||
035.290178<br />
|
||||
<abbr title="Phone">P:</abbr>
|
||||
035.460560
|
||||
</address>
|
||||
</div>
|
||||
<div class="col-sm-4">
|
||||
<h4>Sede Legale</h4>
|
||||
<address>
|
||||
<strong>EgalWare s.r.l.</strong><br />
|
||||
via Nazionale, 93<br />
|
||||
24068 Seriate - BG<br />
|
||||
<br />
|
||||
<abbr title="P.Iva">VAT:</abbr>03985390164
|
||||
</address>
|
||||
</div>
|
||||
<div class="col-sm-4">
|
||||
<h4>Supporto</h4>
|
||||
<address>
|
||||
<strong>Web:</strong><br />
|
||||
Accedi al supporto dal <a href="https://support.egalware.com/" target="_blank">nostro sito web</a><br />
|
||||
<br />
|
||||
<strong>Email:</strong><br />
|
||||
Scrivi un email a <a href="mailto:info@egalware.com">info at egalware.com</a>
|
||||
</address>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
namespace MP.INVE.Pages
|
||||
{
|
||||
public partial class Contacts : IDisposable
|
||||
{
|
||||
#region Public Methods
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
GC.Collect();
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
|
||||
#region Protected Fields
|
||||
|
||||
protected string Messaggio = "";
|
||||
protected string Titolo = "";
|
||||
|
||||
#endregion Protected Fields
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
protected override void OnInitialized()
|
||||
{
|
||||
Titolo = "MP INVE";
|
||||
Messaggio = "I nostri contattatti e siti di supporto";
|
||||
AppMService.ShowSearch = false;
|
||||
}
|
||||
|
||||
#endregion Protected Methods
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
@page "/DOSS"
|
||||
|
||||
<div class="card mb-5">
|
||||
<div class="card-header table-primary">
|
||||
<div class="d-flex">
|
||||
<div class="px-0 py-1">
|
||||
<h3><b>DOSSIERS</b></h3>
|
||||
</div>
|
||||
<div class="px-2 flex-fill">
|
||||
@if (isFiltering)
|
||||
{
|
||||
<LoadingDataSmall></LoadingDataSmall>
|
||||
<i>filtro x macchina / periodo</i>
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
<DossiersFilter FilterChanged="updateFilter"></DossiersFilter>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
@if (isLoading)
|
||||
{
|
||||
<LoadingData></LoadingData>
|
||||
}
|
||||
else
|
||||
{
|
||||
<ListDossiers SelFilter="@currFilter" RecordSel="@selRecordDoss" TotRecordChanged="updateTotal"></ListDossiers>
|
||||
}
|
||||
</div>
|
||||
<div class="card-footer py-1">
|
||||
<DataPager @ref="pagerODL" PageSize="numRecord" currPage="currPage" numRecordChanged="ForceReload" numPageChanged="ForceReloadPage" totalCount="totalCount" showLoading="isLoading" />
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,142 @@
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using Microsoft.JSInterop;
|
||||
using MP.Data.DatabaseModels;
|
||||
using MP.INVE.Components;
|
||||
using MP.INVE.Data;
|
||||
|
||||
namespace MP.INVE.Pages
|
||||
{
|
||||
public partial class DOSS
|
||||
{
|
||||
#region Protected Fields
|
||||
|
||||
protected DataPager? pagerODL = null!;
|
||||
|
||||
#endregion Protected Fields
|
||||
|
||||
#region Protected Properties
|
||||
|
||||
[Inject]
|
||||
protected IJSRuntime JSRuntime { get; set; } = null!;
|
||||
|
||||
[Inject]
|
||||
protected MpDataService MDService { get; set; } = null!;
|
||||
|
||||
#endregion Protected Properties
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
protected void ForceReload(int newNum)
|
||||
{
|
||||
numRecord = newNum;
|
||||
}
|
||||
|
||||
protected void ForceReloadPage(int newNum)
|
||||
{
|
||||
currPage = newNum;
|
||||
StateHasChanged();
|
||||
}
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
isLoading = true;
|
||||
isFiltering = true;
|
||||
// fix pagina
|
||||
await Task.Delay(1);
|
||||
var modFilter = currFilter;
|
||||
modFilter.CurrPage = 1;
|
||||
currFilter = modFilter;
|
||||
await Task.Delay(1);
|
||||
isFiltering = false;
|
||||
}
|
||||
|
||||
protected async Task selRecordDoss(DossierModel selDoss)
|
||||
{
|
||||
currRecordDoss = selDoss;
|
||||
await Task.Delay(1);
|
||||
}
|
||||
|
||||
protected void updateTotal(int newTotCount)
|
||||
{
|
||||
totalCount = newTotCount;
|
||||
}
|
||||
|
||||
protected void UpdateTotCount(int newTotCount)
|
||||
{
|
||||
totalCount = newTotCount;
|
||||
}
|
||||
|
||||
#endregion Protected Methods
|
||||
|
||||
#region Private Properties
|
||||
|
||||
private SelectDossierParams currFilter { get; set; } = new SelectDossierParams();
|
||||
|
||||
private int currPage
|
||||
{
|
||||
get => currFilter.CurrPage;
|
||||
set => currFilter.CurrPage = value;
|
||||
}
|
||||
|
||||
private DossierModel? currRecordDoss { get; set; } = null;
|
||||
|
||||
private bool isEditing
|
||||
{
|
||||
get => currFilter.isEditing;
|
||||
set => currFilter.isEditing = value;
|
||||
}
|
||||
|
||||
private bool isFiltering { get; set; } = false;
|
||||
|
||||
private bool isLoading { get; set; } = true;
|
||||
|
||||
private int numRecord
|
||||
{
|
||||
get => currFilter.NumRec;
|
||||
set => currFilter.NumRec = value;
|
||||
}
|
||||
|
||||
private int totalCount
|
||||
{
|
||||
get => currFilter.TotCount;
|
||||
set => currFilter.TotCount = value;
|
||||
}
|
||||
|
||||
#endregion Private Properties
|
||||
|
||||
#region Private Methods
|
||||
|
||||
private string css()
|
||||
{
|
||||
string answ = "";
|
||||
if (isEditing == false)
|
||||
{
|
||||
answ = "hidden";
|
||||
}
|
||||
else
|
||||
{
|
||||
answ = "visible";
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
private void enableEditing()
|
||||
{
|
||||
isEditing = true;
|
||||
}
|
||||
|
||||
private async Task updateFilter(SelectDossierParams newParams)
|
||||
{
|
||||
isFiltering = false;
|
||||
isLoading = true;
|
||||
await Task.Delay(1);
|
||||
currPage = 1;
|
||||
await Task.Delay(1);
|
||||
await InvokeAsync(() => StateHasChanged());
|
||||
currFilter = newParams;
|
||||
isLoading = false;
|
||||
}
|
||||
|
||||
#endregion Private Methods
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
@page
|
||||
@model MP.INVE.Pages.ErrorModel
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
|
||||
<title>Error</title>
|
||||
<link href="~/css/bootstrap/bootstrap.min.css" rel="stylesheet" />
|
||||
<link href="~/css/site.css" rel="stylesheet" asp-append-version="true" />
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div class="main">
|
||||
<div class="content px-4">
|
||||
<h1 class="text-danger">Error.</h1>
|
||||
<h2 class="text-danger">An error occurred while processing your request.</h2>
|
||||
|
||||
@if (Model.ShowRequestId)
|
||||
{
|
||||
<p>
|
||||
<strong>Request ID:</strong> <code>@Model.RequestId</code>
|
||||
</p>
|
||||
}
|
||||
|
||||
<h3>Development Mode</h3>
|
||||
<p>
|
||||
Swapping to the <strong>Development</strong> environment displays detailed information about the error that occurred.
|
||||
</p>
|
||||
<p>
|
||||
<strong>The Development environment shouldn't be enabled for deployed applications.</strong>
|
||||
It can result in displaying sensitive information from exceptions to end users.
|
||||
For local debugging, enable the <strong>Development</strong> environment by setting the <strong>ASPNETCORE_ENVIRONMENT</strong> environment variable to <strong>Development</strong>
|
||||
and restarting the app.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
@@ -0,0 +1,43 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.Mvc.RazorPages;
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace MP.INVE.Pages
|
||||
{
|
||||
[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
|
||||
[IgnoreAntiforgeryToken]
|
||||
public class ErrorModel : PageModel
|
||||
{
|
||||
#region Public Constructors
|
||||
|
||||
public ErrorModel(ILogger<ErrorModel> logger)
|
||||
{
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
#endregion Public Constructors
|
||||
|
||||
#region Public Properties
|
||||
|
||||
public string? RequestId { get; set; }
|
||||
|
||||
public bool ShowRequestId => !string.IsNullOrEmpty(RequestId);
|
||||
|
||||
#endregion Public Properties
|
||||
|
||||
#region Public Methods
|
||||
|
||||
public void OnGet()
|
||||
{
|
||||
RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier;
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
|
||||
#region Private Fields
|
||||
|
||||
private readonly ILogger<ErrorModel> _logger;
|
||||
|
||||
#endregion Private Fields
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
@page "/"
|
||||
|
||||
<PageTitle>Index</PageTitle>
|
||||
|
||||
<div class="card mb-5">
|
||||
<div class="card-header bg-dark text-light">
|
||||
<div class="d-flex justify-content-between">
|
||||
<div class="p-2">
|
||||
<img src="images/LogoMapo.png" class="image-fluid" height="64" />
|
||||
</div>
|
||||
<div class="p-2 align-content-center fs-1">
|
||||
<b>MAPO INVE</b>
|
||||
</div>
|
||||
<div class="p-2">
|
||||
<img src="images/LogoEgw.png" class="image-fluid" height="64" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="card-body text-center">
|
||||
<div class="shortcuts my-3 py-3">
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
@*@if (ElencoLink == null)
|
||||
{
|
||||
<LoadingData></LoadingData>
|
||||
}
|
||||
else if (ElencoLink.Count == 0)
|
||||
{
|
||||
<div class="alert alert-danger" role="alert">
|
||||
Nessun record trovato!
|
||||
</div>
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
foreach (var item in ElencoLink)
|
||||
{
|
||||
<a href="@item.NavigateUrl" class="shortcut">
|
||||
<i class="@item.icona shortcut-icon"></i>
|
||||
<span class="shortcut-label">@item.Testo</span>
|
||||
</a>
|
||||
}
|
||||
}*@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<dic class="card-footer bg-primary">
|
||||
<div class="d-flex text-white justify-content-between">
|
||||
<div class="px-2">
|
||||
<h1>EDILCHIMICA</h1>
|
||||
</div>
|
||||
<div class="px-2">
|
||||
<h3 class="my-2">MAPO MES Custom Pages</h3>
|
||||
</div>
|
||||
</div>
|
||||
</dic>
|
||||
</div>
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using MP.Data.DatabaseModels;
|
||||
using MP.INVE.Data;
|
||||
|
||||
namespace MP.INVE.Pages
|
||||
{
|
||||
public partial class Index
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
//public List<LinkMenu>? ElencoLink { get; set; }
|
||||
|
||||
#endregion Public Properties
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
//// nascondo ricerca
|
||||
//MessageService.ShowSearch = false;
|
||||
//// recupero elenco JQM
|
||||
////ElencoLink = await MDService.ElencoLink();
|
||||
//configData = await MDService.ConfigGetAll();
|
||||
//if (configData != null)
|
||||
//{
|
||||
// var currRec = configData.FirstOrDefault(x => x.Chiave == "AZIENDA");
|
||||
// if (currRec != null)
|
||||
// {
|
||||
// currAzienda = currRec.Valore;
|
||||
// }
|
||||
//}
|
||||
await Task.Delay(1);
|
||||
}
|
||||
|
||||
#endregion Protected Methods
|
||||
|
||||
#region Private Fields
|
||||
|
||||
private string currAzienda = "";
|
||||
|
||||
#endregion Private Fields
|
||||
|
||||
#region Private Properties
|
||||
|
||||
private List<ConfigModel>? configData { get; set; } = null;
|
||||
|
||||
#endregion Private Properties
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
@page "/Invio"
|
||||
|
||||
<h3>Invio</h3>
|
||||
|
||||
@code {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,122 @@
|
||||
@page "/ODL"
|
||||
|
||||
<div class="card mb-5">
|
||||
<div class="card-header table-primary ">
|
||||
<div class="d-flex justify-content-between col-12">
|
||||
<div class="px-1 col-4">
|
||||
<div>
|
||||
<h3><b>ODL</b></h3>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-4">
|
||||
<div class="input-group input-group-sm">
|
||||
<div class="input-group-text">
|
||||
<span class="me-1 @leftStringCSS">Completati</span>
|
||||
<span class="form-check form-check-sm form-switch py-1" title="ODL Chiusi / Correnti">
|
||||
<input class="form-check-input" type="checkbox" id="switchActive" @bind="@isActive">
|
||||
</span>
|
||||
<span class="@rightStringCSS">In Corso</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="d-flex justify-content-end">
|
||||
<div class="d-flex justify-content-between">
|
||||
@if (filtActive)
|
||||
{
|
||||
<div class=" rounded small d-flex justify-content-between" title="Filtri attivi">
|
||||
@*<i class="fas fa-exclamation text-warning"></i>*@
|
||||
@if (selMacchina != "*")
|
||||
{
|
||||
<button class="btn btn-outline-primary btn-sm mx-2" @onclick="()=>resetMacchina()" title="Rimuovi Filtro Impianto"><i class="fa-solid fa-hard-drive"></i>   <i class="fa-solid fa-xmark text-warning"></i></button>
|
||||
}
|
||||
@if (selStato != "*")
|
||||
{
|
||||
<button class="btn btn-outline-primary btn-sm mx-2" @onclick="()=>resetFase()" title="Rimuovi Filtro Parametro"><i class="fa-solid fa-sliders"></i>   <i class="fa-solid fa-xmark text-warning"></i></button>
|
||||
}
|
||||
</div>
|
||||
}
|
||||
<div class="p-2">
|
||||
<a class="pt-2 text-dark" data-bs-toggle="offcanvas" data-bs-target="#paramsFilterExample" aria-controls="paramsFilterExample" @onclick="setDtMax">
|
||||
<i class="fa-solid fa-bars"></i>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="offcanvas offcanvas-end" tabindex="-1" id="paramsFilterExample" aria-labelledby="paramsFilterExampleLabel">
|
||||
<div class="offcanvas-header">
|
||||
<h3 class="offcanvas-title" id="paramsFilterExampleLabel"><b>FILTRI</b></h3>
|
||||
<button type="button" class="btn-close text-reset" data-bs-dismiss="offcanvas" aria-label="Close"></button>
|
||||
</div>
|
||||
<div class="offcanvas-body">
|
||||
<div>
|
||||
<div>
|
||||
Seleziona i filtri per:
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
|
||||
<div class="small mt-2">
|
||||
<label class="px-2" for="fase" title="Selezionare inizio periodo">Fase</label>
|
||||
</div>
|
||||
<div class="input-group px-2">
|
||||
<label class="input-group-text" for="fase" title="Selezionare la fase da visualizzare"><i class="fa-solid fa-screwdriver-wrench"></i></label>
|
||||
<select @bind="@selStato" id="fase" class="form-select" title="Selezionare la fase da visualizzare">
|
||||
<option value="*">--- Tutti ---</option>
|
||||
@if (ListStati != null)
|
||||
{
|
||||
foreach (var item in ListStati)
|
||||
{
|
||||
<option value="@item.value">@item.label</option>
|
||||
}
|
||||
}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
|
||||
<div class="small mt-2">
|
||||
<label class="px-2" for="macchina" title="Selezionare inizio periodo">Macchina</label>
|
||||
</div>
|
||||
<div class="input-group px-2">
|
||||
<label class="input-group-text" for="macchina" title="Selezionare la macchina da visualizzare"><i class="fa-solid fa-hard-drive"></i></label>
|
||||
<select @bind="@selMacchina" id="macchina" class="form-select" title="Selezionare la macchina da visualizzare">
|
||||
<option value="*">--- Tutti ---</option>
|
||||
@if (ListMacchine != null)
|
||||
{
|
||||
foreach (var item in ListMacchine)
|
||||
{
|
||||
<option value="@item">@item</option>
|
||||
}
|
||||
}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
@if (!isActive)
|
||||
{
|
||||
<div class="small mt-2">
|
||||
<label class="px-2" for="dtMin" title="Selezionare inizio periodo">Inizio Periodo</label>
|
||||
</div>
|
||||
<div class="px-2 input-group">
|
||||
<label class="input-group-text" for="dtMin" title="Selezionare inizio periodo"><i class="fa-regular fa-calendar-minus"></i></label>
|
||||
<input class="form-control" @bind="@selDtStart" id="dtMin" type="datetime-local" title="Data minima eventi da visualizzare">
|
||||
</div>
|
||||
<div class="small mt-2">
|
||||
<label class="px-2" for="dtMax" title="Selezionare fine periodo">Fine Periodo</label>
|
||||
</div>
|
||||
<div class="px-2 input-group">
|
||||
<label class="input-group-text" for="dtMax" title="Selezionare fine periodo"><i class="fa-regular fa-calendar-plus"></i></label>
|
||||
<input class="form-control" @bind="@selDtEnd" id="dtMax" type="datetime-local" title="Selezionare fine periodo">
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<ListODL PagerResetReq="pgResetReq" updateRecordCount="UpdateTotCount" currFilter="@currFilter"></ListODL>
|
||||
</div>
|
||||
<div class="card-footer py-1">
|
||||
<DataPager @ref="pagerODL" PageSize="numRecord" currPage="currPage" numRecordChanged="ForceReload" numPageChanged="ForceReloadPage" totalCount="totalCount" showLoading="isLoading" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -0,0 +1,183 @@
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using Microsoft.JSInterop;
|
||||
using MP.INVE.Components;
|
||||
using MP.INVE.Data;
|
||||
|
||||
namespace MP.INVE.Pages
|
||||
{
|
||||
public partial class ODL
|
||||
{
|
||||
#region Public Methods
|
||||
|
||||
/// <summary>
|
||||
/// Inizializzazione con periodo e arrotondamento
|
||||
/// </summary>
|
||||
/// <param name="minRound"></param>
|
||||
/// <returns></returns>
|
||||
public static DateTime RoundDatetime(int minRound)
|
||||
{
|
||||
TimeSpan DayElapsed = DateTime.Now.Subtract(DateTime.Today);
|
||||
int minDay = (int)Math.Ceiling((double)(DayElapsed.TotalMinutes / minRound)) * minRound;
|
||||
DateTime endRounded = DateTime.Today.AddMinutes(minDay);
|
||||
return endRounded;
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
|
||||
#region Protected Fields
|
||||
|
||||
protected DataPager? pagerODL = null!;
|
||||
|
||||
#endregion Protected Fields
|
||||
|
||||
#region Protected Properties
|
||||
|
||||
protected bool isActive
|
||||
{
|
||||
get => currFilter.IsActive;
|
||||
set => currFilter.IsActive = value;
|
||||
}
|
||||
|
||||
[Inject]
|
||||
protected IJSRuntime JSRuntime { get; set; } = null!;
|
||||
|
||||
[Inject]
|
||||
protected MpDataService MDService { get; set; } = null!;
|
||||
|
||||
protected DateTime selDtEnd
|
||||
{
|
||||
get => currFilter.DtEnd;
|
||||
set
|
||||
{
|
||||
if (currFilter.DtEnd != value)
|
||||
{
|
||||
currFilter.DtEnd = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected DateTime selDtStart
|
||||
{
|
||||
get => currFilter.DtStart;
|
||||
set
|
||||
{
|
||||
if (currFilter.DtStart != value)
|
||||
{
|
||||
currFilter.DtStart = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Protected Properties
|
||||
|
||||
#region Protected Methods
|
||||
private bool filtActive
|
||||
{
|
||||
get => selMacchina != "*" || selStato != "*";
|
||||
}
|
||||
|
||||
protected void resetMacchina()
|
||||
{
|
||||
selMacchina = "*";
|
||||
}
|
||||
protected void resetFase()
|
||||
{
|
||||
selStato = "*";
|
||||
}
|
||||
protected void ForceReload(int newNum)
|
||||
{
|
||||
numRecord = newNum;
|
||||
}
|
||||
|
||||
protected void ForceReloadPage(int newNum)
|
||||
{
|
||||
currPage = newNum;
|
||||
}
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
ListStati = await MDService.AnagStatiComm();
|
||||
ListMacchine = await MDService.MacchineWithFlux(currFilter.DtStart, currFilter.DtEnd);
|
||||
}
|
||||
|
||||
protected async Task pgResetReq(bool doReset)
|
||||
{
|
||||
if (doReset)
|
||||
{
|
||||
await Task.Delay(1);
|
||||
if (pagerODL != null)
|
||||
{
|
||||
pagerODL.resetCurrPage();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected void setDtMax()
|
||||
{
|
||||
// copio il filtro
|
||||
currFilter.DtEnd = RoundDatetime(5);
|
||||
currFilter.DtStart = RoundDatetime(5).AddDays(-10);
|
||||
}
|
||||
|
||||
protected void UpdateTotCount(int newTotCount)
|
||||
{
|
||||
totalCount = newTotCount;
|
||||
}
|
||||
|
||||
#endregion Protected Methods
|
||||
|
||||
#region Private Fields
|
||||
|
||||
private List<MP.Data.DatabaseModels.ListValues>? ListStati;
|
||||
private List<string>? ListMacchine;
|
||||
|
||||
#endregion Private Fields
|
||||
|
||||
#region Private Properties
|
||||
|
||||
private SelectOdlParams currFilter { get; set; } = new SelectOdlParams();
|
||||
|
||||
private int currPage
|
||||
{
|
||||
get => currFilter.CurrPage;
|
||||
set => currFilter.CurrPage = value;
|
||||
}
|
||||
|
||||
private bool isLoading { get; set; } = false;
|
||||
|
||||
private string leftStringCSS
|
||||
{
|
||||
get => isActive ? "text-secondary" : "text-dark fw-bold";
|
||||
}
|
||||
|
||||
private int numRecord
|
||||
{
|
||||
get => currFilter.NumRec;
|
||||
set => currFilter.NumRec = value;
|
||||
}
|
||||
|
||||
private string rightStringCSS
|
||||
{
|
||||
get => isActive ? "text-dark fw-bold" : "text-secondary";
|
||||
}
|
||||
|
||||
private string selStato
|
||||
{
|
||||
get => currFilter.CodStato;
|
||||
set => currFilter.CodStato = value;
|
||||
}
|
||||
private string selMacchina
|
||||
{
|
||||
get => currFilter.IdxMacchina;
|
||||
set => currFilter.IdxMacchina = value;
|
||||
}
|
||||
|
||||
private int totalCount
|
||||
{
|
||||
get => currFilter.TotCount;
|
||||
set => currFilter.TotCount = value;
|
||||
}
|
||||
|
||||
#endregion Private Properties
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
@page "/OperatoreLogin"
|
||||
|
||||
<h3>OperatoreLogin</h3>
|
||||
|
||||
<div>
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Inserire auth key</label>
|
||||
<input class="form-control" type="password" @bind="@authKey" />
|
||||
</div>
|
||||
<div>
|
||||
<select class="form-select" aria-label="Default select example" @bind="@idOperatore">
|
||||
@if (elencoOperatori != null)
|
||||
{
|
||||
@foreach (var item in elencoOperatori)
|
||||
{
|
||||
<option value="@item.MatrOpr">@item.Nome</option>
|
||||
}
|
||||
}
|
||||
</select>
|
||||
</div>
|
||||
<div>
|
||||
<button class="btn btn-primary" @onclick="login">SUBMIT</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
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.INVE;
|
||||
using MP.INVE.Data;
|
||||
using MP.INVE.Shared;
|
||||
using MP.INVE.Components;
|
||||
using MP.Data.DatabaseModels;
|
||||
|
||||
namespace MP.INVE.Pages
|
||||
{
|
||||
public partial class OperatoreLogin
|
||||
{
|
||||
[Inject]
|
||||
private MiDataService MIDataservice { get; set; } = null!;
|
||||
[Inject]
|
||||
private NavigationManager NavManager { get; set; } = null!;
|
||||
|
||||
private int idOperatore { get; set; }
|
||||
private string authKey { get; set; }
|
||||
|
||||
private List<AnagOperatoriModel>? elencoOperatori;
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
//await FilterChanged.InvokeAsync(actFilter);
|
||||
await Task.Delay(1);
|
||||
elencoOperatori = MIDataservice.ElencoOperatori();
|
||||
}
|
||||
|
||||
private void login()
|
||||
{
|
||||
var ok = MIDataservice.LoginOperatore(idOperatore, authKey);
|
||||
|
||||
if (ok)
|
||||
{
|
||||
NavManager.NavigateTo("/Starter", true);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
@page "/PARAMS"
|
||||
|
||||
<div class="card mb-5">
|
||||
<div class="card-header table-primary">
|
||||
<div class="d-flex">
|
||||
<div class="px-0 py-1">
|
||||
<h3><b>PARAMETERS</b></h3>
|
||||
</div>
|
||||
<div class="px-2 flex-fill">
|
||||
@if (isFiltering)
|
||||
{
|
||||
<LoadingDataSmall></LoadingDataSmall>
|
||||
}
|
||||
else
|
||||
{
|
||||
<ParamsFilter FilterChanged="updateFilter"></ParamsFilter>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
@if (isLoading)
|
||||
{
|
||||
<LoadingData></LoadingData>
|
||||
}
|
||||
else
|
||||
{
|
||||
<ListPARAMS SelFilter="@currFilter" TotRecordChanged="@UpdateTotCount" RecordSel="@detailSel"></ListPARAMS>
|
||||
}
|
||||
</div>
|
||||
<div class="card-footer py-1">
|
||||
<DataPager @ref="pagerODL" PageSize="numRecord" currPage="currPage" numRecordChanged="ForceReload" numPageChanged="ForceReloadPage" totalCount="totalCount" showLoading="isLoading" />
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,148 @@
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using MP.Data.DatabaseModels;
|
||||
using MP.INVE.Components;
|
||||
using MP.INVE.Data;
|
||||
|
||||
namespace MP.INVE.Pages
|
||||
{
|
||||
public partial class PARAMS
|
||||
{
|
||||
#region Protected Fields
|
||||
|
||||
protected DataPager? pagerODL = null!;
|
||||
|
||||
#endregion Protected Fields
|
||||
|
||||
#region Protected Properties
|
||||
|
||||
|
||||
#endregion Protected Properties
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
protected void ForceReload(int newNum)
|
||||
{
|
||||
numRecord = newNum;
|
||||
}
|
||||
|
||||
protected void ForceReloadPage(int newNum)
|
||||
{
|
||||
currPage = newNum;
|
||||
DateTime adesso = DateTime.Now.AddSeconds(1);
|
||||
var updFilter = currFilter;
|
||||
//updFilter.LiveUpdate = (currPage == 1);
|
||||
updFilter.LiveUpdate = (currFilter.CurrPage == 1);
|
||||
updFilter.lastUpdate = updFilter.LiveUpdate ? "-" : $"{adesso:yyyy/MM/dd HH:mm:ss}";
|
||||
// salvo filtro
|
||||
currFilter = updFilter;
|
||||
StateHasChanged();
|
||||
}
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
isLoading = true;
|
||||
isFiltering = true;
|
||||
// fix pagina
|
||||
await Task.Delay(1);
|
||||
var modFilter = currFilter;
|
||||
modFilter.CurrPage = 1;
|
||||
modFilter.LiveUpdate = (currPage == 1);
|
||||
currFilter = modFilter;
|
||||
await Task.Delay(1);
|
||||
isFiltering = false;
|
||||
}
|
||||
|
||||
protected async Task pgResetReq(bool doReset)
|
||||
{
|
||||
if (doReset)
|
||||
{
|
||||
await Task.Delay(1);
|
||||
if (pagerODL != null)
|
||||
{
|
||||
pagerODL.resetCurrPage();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected void updateTotal(int newTotCount)
|
||||
{
|
||||
totalCount = newTotCount;
|
||||
}
|
||||
|
||||
|
||||
protected async Task detailSel(FluxLog newRec)
|
||||
{
|
||||
await Task.Delay(1);
|
||||
var updFilter = currFilter;
|
||||
DateTime adesso = DateTime.Now.AddSeconds(1);
|
||||
updFilter.LiveUpdate = (newRec == null);
|
||||
// sistemo la data di riferimento x eventuale snapshot nel passato
|
||||
updFilter.dtRif = newRec != null ? newRec.dtEvento : null;
|
||||
if (newRec != null)
|
||||
{
|
||||
updFilter.lastUpdate = updFilter.lastUpdate == "-" ? $"{adesso:yyyy/MM/dd HH:mm:ss}" : updFilter.lastUpdate;
|
||||
updFilter.IdxMacchina = newRec.IdxMacchina;
|
||||
//updFilter.CodFlux = newRec.CodFlux;
|
||||
}
|
||||
else
|
||||
{
|
||||
updFilter.lastUpdate = "-";
|
||||
}
|
||||
// salvo filtro
|
||||
currFilter = updFilter;
|
||||
}
|
||||
|
||||
#endregion Protected Methods
|
||||
|
||||
#region Private Properties
|
||||
|
||||
private SelectFluxParams currFilter { get; set; } = new SelectFluxParams();
|
||||
|
||||
private int currPage
|
||||
{
|
||||
get => currFilter.CurrPage;
|
||||
set => currFilter.CurrPage = value;
|
||||
}
|
||||
|
||||
private bool isFiltering { get; set; } = false;
|
||||
private bool isLoading { get; set; } = true;
|
||||
|
||||
private int numRecord
|
||||
{
|
||||
get => currFilter.NumRec;
|
||||
set => currFilter.NumRec = value;
|
||||
}
|
||||
|
||||
private int totalCount { get; set; } = 0;
|
||||
|
||||
#endregion Private Properties
|
||||
|
||||
#region Private Methods
|
||||
|
||||
private async Task updateFilter(SelectFluxParams newParams)
|
||||
{
|
||||
isFiltering = false;
|
||||
isLoading = true;
|
||||
await Task.Delay(1);
|
||||
currPage = 1;
|
||||
if (newParams.CurrPage == 0)
|
||||
{
|
||||
newParams.CurrPage = 1;
|
||||
//newParams.LiveUpdate = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
//newParams.LiveUpdate = (currPage == 1);
|
||||
}
|
||||
await Task.Delay(1);
|
||||
await InvokeAsync(() => StateHasChanged());
|
||||
currFilter = newParams;
|
||||
isLoading = false;
|
||||
}
|
||||
protected void UpdateTotCount(int newTotCount)
|
||||
{
|
||||
totalCount = newTotCount;
|
||||
}
|
||||
#endregion Private Methods
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,262 @@
|
||||
@page "/PODL"
|
||||
|
||||
|
||||
<div class="card mb-5">
|
||||
<div class="card-header table-primary">
|
||||
<div class="d-flex justify-content-between">
|
||||
<div class="col-6 col-lg-8">
|
||||
<div class="d-flex">
|
||||
<div class="px-2">
|
||||
<h3><b>P</b>romesse <b>ODL</b></h3>
|
||||
</div>
|
||||
<div class="px-2">
|
||||
@if (addEnabled)
|
||||
{
|
||||
<button class="btn btn-success" @onclick="() => reqNewPODL()">Nuovo PODL <i class="bi bi-plus-square"></i></button>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-6 col-lg-4">
|
||||
<div class="input-group input-group-sm">
|
||||
@*<label class="input-group-text" for="maxRecord" title="Selezionare l'azienda da visualizzare"><i class="fa-solid fa-industry"></i></label>
|
||||
<select @bind="@currAzienda" class="form-select" title="Selezionare l'azienda da visualizzare">
|
||||
@if (ListAziende != null)
|
||||
{
|
||||
foreach (var item in ListAziende)
|
||||
{
|
||||
<option value="@item.CodGruppo">@item.DescrGruppo</option>
|
||||
}
|
||||
}
|
||||
</select>*@
|
||||
<label class="input-group-text" for="maxRecord" title="Selezionare la fase da visualizzare"><i class="fa-solid fa-screwdriver-wrench"></i></label>
|
||||
<select @bind="@currFase" class="form-select" title="Selezionare la fase da visualizzare">
|
||||
<option value="*">--- Tutti ---</option>
|
||||
@if (ListStati != null)
|
||||
{
|
||||
|
||||
foreach (var item in ListStati)
|
||||
{
|
||||
<option value="@item.value">@item.label</option>
|
||||
}
|
||||
}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
@if (currRecord != null)
|
||||
{
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="card mb-5">
|
||||
<div class="card-header bg-primary text-light">Modifica PODL</div>
|
||||
<div class="card-body">
|
||||
<div class="row">
|
||||
<div class="col-6">
|
||||
<div class="row">
|
||||
<div class="col-3 pe-0">
|
||||
<div class="input-group input-group-sm">
|
||||
<span class="input-group-text" id="inputGroup-sizing-sm">Search</span>
|
||||
<input type="text" class="form-control" aria-label="Art search" aria-describedby="inputGroup-sizing-sm" @bind-value="@artSearch">
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-9 ps-0">
|
||||
<div class="input-group input-group-sm">
|
||||
<span class="input-group-text" id="inputGroup-sizing-sm">Articolo</span>
|
||||
<select @bind="@currRecord.CodArticolo" class="form-select">
|
||||
@if (ListArticoli != null)
|
||||
{
|
||||
foreach (var item in ListArticoli.Where(x => x.Azienda == currAzienda).ToList())
|
||||
{
|
||||
@if (item.CodArticolo == currRecordControlli.CodArticolo)
|
||||
{
|
||||
<option value="@item.CodArticolo" selected>@item.CodArticolo | @item.DescArticolo | @item.Disegno</option>
|
||||
}
|
||||
else
|
||||
{
|
||||
<option value="@item.CodArticolo">@item.CodArticolo | @item.DescArticolo | @item.Disegno</option>
|
||||
}
|
||||
}
|
||||
}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-3">
|
||||
<div class="input-group input-group-sm">
|
||||
<span class="input-group-text" id="inputGroup-sizing-sm"># pz</span>
|
||||
<input type="text" class="form-control" aria-label="Num Pezzi" aria-describedby="inputGroup-sizing-sm" @bind-value="@currRecord.NumPezzi">
|
||||
<span class="input-group-text" id="inputGroup-sizing-sm">T.Ciclo</span>
|
||||
<input type="text" class="form-control" aria-label="Tempo Ciclo" aria-describedby="inputGroup-sizing-sm" @bind-value="@currRecord.Tcassegnato">
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-3">
|
||||
<div class="input-group input-group-sm">
|
||||
<span class="input-group-text" id="inputGroup-sizing-sm">Fase</span>
|
||||
<select @bind="@currRecord.KeyRichiesta" class="form-select">
|
||||
@if (ListStati != null)
|
||||
{
|
||||
foreach (var item in ListStati)
|
||||
{
|
||||
@if (item.value == currRecordControlli.KeyRichiesta)
|
||||
{
|
||||
<option value="@item.value" selected>@item.label</option>
|
||||
}
|
||||
else
|
||||
{
|
||||
<option value="@item.value">@item.label</option>
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row mt-2">
|
||||
<div class="col-3">
|
||||
<div class="input-group input-group-sm">
|
||||
<div class="input-group input-group-sm">
|
||||
<span class="input-group-text" id="inputGroup-sizing-sm">Gruppo</span>
|
||||
<select @bind="@currRecord.CodGruppo" class="form-select">
|
||||
@if (ListGruppiFase != null)
|
||||
{
|
||||
foreach (var item in ListGruppiFase)
|
||||
{
|
||||
@if (item.CodGruppo == currRecordControlli.CodGruppo)
|
||||
{
|
||||
<option value="@item.CodGruppo" selected>@item.CodGruppo | @item.DescrGruppo</option>
|
||||
}
|
||||
else
|
||||
{
|
||||
<option value="@item.CodGruppo">@item.CodGruppo | @item.DescrGruppo</option>
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-3">
|
||||
<div class="input-group input-group-sm">
|
||||
<div class="input-group input-group-sm">
|
||||
<div class="input-group input-group-sm">
|
||||
<span class="input-group-text" id="inputGroup-sizing-sm">Macchina</span>
|
||||
<select @bind="@currRecord.IdxMacchina" class="form-select">
|
||||
@if (ListMacchine != null)
|
||||
{
|
||||
foreach (var item in ListMacchine)
|
||||
{
|
||||
if (item.IdxMacchina == currRecordControlli.IdxMacchina)
|
||||
{
|
||||
<option selected value="@item.IdxMacchina">@item.IdxMacchina | @item.Descrizione</option>
|
||||
}
|
||||
else
|
||||
{
|
||||
<option value="@item.IdxMacchina">@item.IdxMacchina | @item.Descrizione</option>
|
||||
}
|
||||
}
|
||||
}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-6">
|
||||
<div class="input-group input-group-sm">
|
||||
<span class="input-group-text" id="inputGroup-sizing-sm">Note</span>
|
||||
<input type="text" class="form-control" aria-label="Note" aria-describedby="inputGroup-sizing-sm" @bind-value="@currRecord.Note">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row mt-2">
|
||||
<div class="col-3">
|
||||
<div class="input-group input-group-sm d-flex justify-content-between">
|
||||
<div class="input-group-text" id="inputGroup-sizing-sm">
|
||||
<div class="pe-3" title="Attivabile">
|
||||
Attivabile
|
||||
</div>
|
||||
<div class="form-check form-check-sm form-switch py-1" title="Attivabile">
|
||||
<input class="form-check-input" type="checkbox" id="mySwitch" name="setupAlarms" title="Attivabile" @bind="@currRecord.Attivabile">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-3">
|
||||
</div>
|
||||
<div class="col-3">
|
||||
<div class="d-grid gap-2">
|
||||
<button class="btn btn-warning" @onclick="() => cancel()">Annulla <i class="bi bi-x-circle"></i></button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-3">
|
||||
<div class="d-grid gap-2">
|
||||
<button class="btn btn-success" @onclick="() => update(currRecord)">Salva <i class="bi bi-save"></i></button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
else if (addEnabled)
|
||||
{
|
||||
<div class="row">
|
||||
<div class="col-4">
|
||||
@*<button class="btn btn-success" @onclick="() => reqNewPODL()">@btnNewText <i class="bi bi-plus-square"></i></button>*@
|
||||
</div>
|
||||
@if (reqNew)
|
||||
{
|
||||
<div class="col-4">
|
||||
<div class="input-group input-group-sm">
|
||||
<span class="input-group-text" id="inputGroup-sizing-sm">Azienda</span>
|
||||
<select @bind="@currAzienda" class="form-select">
|
||||
@if (ListAziende != null)
|
||||
{
|
||||
foreach (var item in ListAziende.Where(x => x.CodGruppo != "*").ToList())
|
||||
{
|
||||
<option value="@item.CodGruppo">@item.DescrGruppo</option>
|
||||
}
|
||||
}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-4">
|
||||
<div class="input-group input-group-sm">
|
||||
<span class="input-group-text" id="inputGroup-sizing-sm">Search</span>
|
||||
<input type="text" class="form-control" aria-label="Art search" aria-describedby="inputGroup-sizing-sm" @bind-value="@artSearch">
|
||||
<span class="input-group-text" id="inputGroup-sizing-sm">Articolo</span>
|
||||
<select @bind="@currArticolo" class="form-select">
|
||||
@if (ListArticoli != null)
|
||||
{
|
||||
foreach (var item in ListArticoli.Where(x => x.Azienda == currAzienda).ToList())
|
||||
{
|
||||
<option value="@item.CodArticolo">@item.CodArticolo | @item.DescArticolo | @item.Disegno</option>
|
||||
}
|
||||
}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
}
|
||||
|
||||
</div>
|
||||
<div class="card-body">
|
||||
@if (isLoading)
|
||||
{
|
||||
<LoadingData></LoadingData>
|
||||
}
|
||||
else
|
||||
{
|
||||
<ListPODL PagerResetReq="pgResetReq" RecordSel="@selRecord" updateRecordCount="UpdateTotCount" actFilter="@currFilter"></ListPODL>
|
||||
}
|
||||
</div>
|
||||
<div class="card-footer py-1">
|
||||
<DataPager @ref="pagerODL" PageSize="numRecord" currPage="currPage" numRecordChanged="ForceReload" numPageChanged="ForceReloadPage" totalCount="totalCount" showLoading="@isLoading" />
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,350 @@
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using Microsoft.JSInterop;
|
||||
using MP.Data.DatabaseModels;
|
||||
using MP.INVE.Components;
|
||||
using MP.INVE.Data;
|
||||
using MP.INVE.Services;
|
||||
using NLog;
|
||||
|
||||
namespace MP.INVE.Pages
|
||||
{
|
||||
public partial class PODL
|
||||
{
|
||||
#region Protected Fields
|
||||
|
||||
protected DataPager pagerODL = null!;
|
||||
|
||||
protected bool reqNew = false;
|
||||
|
||||
#endregion Protected Fields
|
||||
|
||||
#region Protected Properties
|
||||
|
||||
[Inject]
|
||||
protected IJSRuntime JSRuntime { get; set; } = null!;
|
||||
|
||||
[Inject]
|
||||
protected MpDataService MDService { get; set; } = null!;
|
||||
|
||||
[Inject]
|
||||
protected IOApiService MpIoApiCall { get; set; } = null!;
|
||||
|
||||
[Inject]
|
||||
protected NavigationManager NavManager { get; set; } = null!;
|
||||
|
||||
#endregion Protected Properties
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
/// <summary>
|
||||
/// Crea nuovo record e va in editing...
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
protected async Task addNew()
|
||||
{
|
||||
currRecord = new PODLModel()
|
||||
{
|
||||
CodArticolo = $"_NEW_{DateTime.Now:yyyyMMdd.HHmmss}"
|
||||
};
|
||||
await Task.Delay(1);
|
||||
}
|
||||
|
||||
protected async Task cancel()
|
||||
{
|
||||
currRecord = null;
|
||||
await reloadData();
|
||||
await Task.Delay(1);
|
||||
}
|
||||
|
||||
protected void ForceReload(int newNum)
|
||||
{
|
||||
numRecord = newNum;
|
||||
}
|
||||
|
||||
protected void ForceReloadPage(int newNum)
|
||||
{
|
||||
currPage = newNum;
|
||||
}
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
ListAziende = await MDService.ElencoAziende();
|
||||
ListGruppiFase = await MDService.ElencoGruppiFase();
|
||||
ListMacchine = await MDService.MacchineGetAll();
|
||||
ListStati = await MDService.AnagStatiComm();
|
||||
SearchRecords = await MDService.ListPODLFilt("*", "*");
|
||||
// preselezione valori
|
||||
configData = await MDService.ConfigGetAll();
|
||||
var currRec = configData.FirstOrDefault(x => x.Chiave == "AZIENDA");
|
||||
if (currRec != null)
|
||||
{
|
||||
currAzienda = currRec.Valore;
|
||||
}
|
||||
// carico dati
|
||||
await reloadData();
|
||||
}
|
||||
|
||||
protected async Task pgResetReq(bool doReset)
|
||||
{
|
||||
if (doReset)
|
||||
{
|
||||
await Task.Delay(1);
|
||||
pagerODL.resetCurrPage();
|
||||
}
|
||||
}
|
||||
private List<PODLModel>? SearchRecords;
|
||||
|
||||
/// <summary>
|
||||
/// Crea nuovo record e va in editing...
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
protected async Task reqNewPODL()
|
||||
{
|
||||
// aggiungo record articolo
|
||||
if (SearchRecords != null)
|
||||
{
|
||||
currRecordControlli = SearchRecords.FirstOrDefault();
|
||||
}
|
||||
|
||||
//currArticolo = "";
|
||||
if (ListArticoli != null && ListArticoli.Count > 0)
|
||||
{
|
||||
var firstArt = ListArticoli.FirstOrDefault();
|
||||
currArticolo = firstArt != null ? firstArt.CodArticolo : "";
|
||||
}
|
||||
string codExt = $"{currFase}";
|
||||
string codGruppo = "";
|
||||
if (ListGruppiFase != null && ListGruppiFase.Count > 0)
|
||||
{
|
||||
var firstFase = ListGruppiFase.FirstOrDefault(x => x.CodGruppo.StartsWith(_currAzienda));
|
||||
if (firstFase != null)
|
||||
{
|
||||
codGruppo = firstFase.CodGruppo;
|
||||
}
|
||||
}
|
||||
string codMacc = "";
|
||||
if (ListMacchine != null && ListMacchine.Count > 0)
|
||||
{
|
||||
var firstMacc = ListMacchine.FirstOrDefault(x => x.Nome.Contains(currAzienda));
|
||||
if (firstMacc != null)
|
||||
{
|
||||
codMacc = firstMacc.IdxMacchina;
|
||||
}
|
||||
}
|
||||
currRecord = new PODLModel()
|
||||
{
|
||||
CodArticolo = currArticolo,
|
||||
KeyBCode = codExt,
|
||||
KeyRichiesta = codExt,
|
||||
CodGruppo = codGruppo,
|
||||
IdxMacchina = codMacc,
|
||||
NumPezzi = 1,
|
||||
DueDate = DateTime.Now.AddDays(30)
|
||||
};
|
||||
await Task.Delay(1);
|
||||
}
|
||||
|
||||
protected async Task selRecord(PODLModel selRec)
|
||||
{
|
||||
currRecord = selRec;
|
||||
await Task.Delay(1);
|
||||
}
|
||||
|
||||
protected async Task update(PODLModel selRec)
|
||||
{
|
||||
if (!await JSRuntime.InvokeAsync<bool>("confirm", "Confermi di voler salvare le modifiche?"))
|
||||
return;
|
||||
await Task.Delay(1);
|
||||
var done = await MDService.POdlUpdateRecord(selRec);
|
||||
await callSyncDb(selRec);
|
||||
currRecord = null;
|
||||
await reloadData();
|
||||
// forzo update parametri
|
||||
await Task.Delay(1);
|
||||
currFase = "*";
|
||||
await Task.Delay(1);
|
||||
}
|
||||
|
||||
protected void UpdateTotCount(int newTotCount)
|
||||
{
|
||||
totalCount = newTotCount;
|
||||
}
|
||||
|
||||
#endregion Protected Methods
|
||||
|
||||
#region Private Fields
|
||||
|
||||
private static Logger Log = LogManager.GetCurrentClassLogger();
|
||||
private PODLModel? _currRecord = null;
|
||||
private PODLModel? _currRecordControlli = null;
|
||||
private List<AnagArticoli>? ListArticoli;
|
||||
private List<AnagGruppi>? ListAziende;
|
||||
private List<AnagGruppi>? ListGruppiFase;
|
||||
private List<Macchine>? ListMacchine;
|
||||
private List<ListValues>? ListStati;
|
||||
|
||||
#endregion Private Fields
|
||||
|
||||
#region Private Properties
|
||||
|
||||
private string _artSearch { get; set; } = "";
|
||||
private string _currAzienda { get; set; } = "*";
|
||||
|
||||
private bool addEnabled
|
||||
{
|
||||
get => currFase != "*";
|
||||
}
|
||||
|
||||
private string artSearch
|
||||
{
|
||||
get => _artSearch;
|
||||
set
|
||||
{
|
||||
if (!_artSearch.Equals(value))
|
||||
{
|
||||
_artSearch = value;
|
||||
var pUpd = Task.Run(async () =>
|
||||
{
|
||||
await reloadData();
|
||||
});
|
||||
pUpd.Wait();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private bool selectFirst(string idxMacchina)
|
||||
{
|
||||
string firstMacchina = "";
|
||||
bool answ = false;
|
||||
if (ListMacchine != null)
|
||||
{
|
||||
var rawData = ListMacchine.Select(x => x.IdxMacchina).FirstOrDefault();
|
||||
firstMacchina = rawData != null ? rawData : "";
|
||||
}
|
||||
if (firstMacchina == idxMacchina)
|
||||
{
|
||||
answ = true;
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
private string btnNewText
|
||||
{
|
||||
get => currArticolo == "" ? "Sel Articolo" : "Nuovo PODL";
|
||||
}
|
||||
|
||||
private List<ConfigModel>? configData { get; set; } = null;
|
||||
private string currArticolo { get; set; } = "";
|
||||
|
||||
private string currAzienda
|
||||
{
|
||||
get => _currAzienda;
|
||||
set
|
||||
{
|
||||
if (!_currAzienda.Equals(value))
|
||||
{
|
||||
_currAzienda = value;
|
||||
var pUpd = Task.Run(async () =>
|
||||
{
|
||||
await reloadData();
|
||||
});
|
||||
pUpd.Wait();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private string currFase
|
||||
{
|
||||
get => currFilter.CodFase;
|
||||
set
|
||||
{
|
||||
if (!currFilter.CodFase.Equals(value))
|
||||
{
|
||||
currFilter.CodFase = value;
|
||||
currPage = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private SelectPOdlParams currFilter { get; set; } = new SelectPOdlParams();
|
||||
|
||||
private int currPage
|
||||
{
|
||||
get => currFilter.CurrPage;
|
||||
set => currFilter.CurrPage = value;
|
||||
}
|
||||
|
||||
private PODLModel? currRecord
|
||||
{
|
||||
get => _currRecord;
|
||||
set
|
||||
{
|
||||
_currRecord = value;
|
||||
artSearch = value == null ? "" : value.CodArticolo;
|
||||
}
|
||||
}
|
||||
private PODLModel? currRecordControlli
|
||||
{
|
||||
get => _currRecordControlli;
|
||||
set
|
||||
{
|
||||
_currRecordControlli = value;
|
||||
}
|
||||
}
|
||||
|
||||
private bool isLoading { get; set; } = false;
|
||||
|
||||
private int numRecord
|
||||
{
|
||||
get => currFilter.NumRec;
|
||||
set => currFilter.NumRec = value;
|
||||
}
|
||||
|
||||
private int totalCount
|
||||
{
|
||||
get => currFilter.TotCount;
|
||||
set => currFilter.TotCount = value;
|
||||
}
|
||||
|
||||
#endregion Private Properties
|
||||
|
||||
#region Private Methods
|
||||
|
||||
/// <summary>
|
||||
/// Chiama metodo x chiedere sync DB
|
||||
/// </summary>
|
||||
/// <param name="selRec"></param>
|
||||
/// <returns></returns>
|
||||
private async Task callSyncDb(PODLModel selRec)
|
||||
{
|
||||
// chiamo aggiunta task SyncDb...
|
||||
string idxMacc = selRec.IdxMacchina;
|
||||
string restUrl = $"IOB/addTask2Exe/{idxMacc}?taskName=syncDbData&taskVal=";
|
||||
try
|
||||
{
|
||||
var response = await MpIoApiCall.callMpIoUrlGet(restUrl);
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Log.Error($"Errore durante chiamata: {Environment.NewLine}{exc}");
|
||||
}
|
||||
}
|
||||
|
||||
private async Task reloadData()
|
||||
{
|
||||
isLoading = true;
|
||||
await Task.Delay(1);
|
||||
if (currAzienda != "*")
|
||||
{
|
||||
ListArticoli = await MDService.ArticoliGetSearch(100, currAzienda, artSearch);
|
||||
}
|
||||
else
|
||||
{
|
||||
ListArticoli = new List<AnagArticoli>();
|
||||
}
|
||||
isLoading = false;
|
||||
}
|
||||
|
||||
#endregion Private Methods
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
@page "/Session"
|
||||
|
||||
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<h3>Sessione</h3>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">Id</th>
|
||||
<th scope="col">Description</th>
|
||||
<th scope="col">Operatore</th>
|
||||
<th scope="col">Data inizio</th>
|
||||
<th scope="col">Data fine</th>
|
||||
<th scope="col">Trasferita</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@if (elencoSessioni != null)
|
||||
{
|
||||
@foreach (var item in elencoSessioni)
|
||||
{
|
||||
<tr>
|
||||
<td>
|
||||
@item.InveSessID
|
||||
</td>
|
||||
<td>
|
||||
@item.Description
|
||||
</td>
|
||||
<td>
|
||||
@item.UserCrea
|
||||
</td>
|
||||
<td>
|
||||
@item.DtStart
|
||||
</td>
|
||||
<td>
|
||||
@item.DtEnd
|
||||
</td>
|
||||
<td>
|
||||
@item.Transferred
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
}
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
</div>
|
||||
<div class="card-footer py-1">
|
||||
<DataPager />
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,36 @@
|
||||
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.INVE;
|
||||
using MP.INVE.Shared;
|
||||
using MP.INVE.Components;
|
||||
using MP.Data.DatabaseModels;
|
||||
using MP.INVE.Data;
|
||||
|
||||
namespace MP.INVE.Pages
|
||||
{
|
||||
public partial class Session
|
||||
{
|
||||
[Inject]
|
||||
private MiDataService MIDataservice { get; set; } = null!;
|
||||
|
||||
private List<InventorySessionModel>? elencoSessioni;
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
//await FilterChanged.InvokeAsync(actFilter);
|
||||
await Task.Delay(1);
|
||||
elencoSessioni = MIDataservice.InventSessCurrList();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
@page "/Starter"
|
||||
@inject IJSRuntime JSRuntime
|
||||
|
||||
<h3>Starter</h3>
|
||||
|
||||
<div class="card-body text-center">
|
||||
<div class="img-fluid" id="qrCodeImg_101"></div>
|
||||
</div>
|
||||
|
||||
@*<img src="https://qrcode.steamware.net//HOME/QR_site/JSON?val={'baseUrl':'https://iis02.egalware.com/MP/MAG/SMART/PLScanner?{0}','parameters':['MatrOpr=102']}" />*@
|
||||
|
||||
@code {
|
||||
[Inject]
|
||||
private IConfiguration Configuration { get; set; } = null!;
|
||||
|
||||
protected override async Task OnAfterRenderAsync(bool firstRender)
|
||||
{
|
||||
if (firstRender)
|
||||
{
|
||||
await JSRuntime.InvokeVoidAsync("clearContent", $"qrCodeImg_{101}");
|
||||
await JSRuntime.InvokeVoidAsync("displayQr", $"qrCodeImg_{101}", rawCode);
|
||||
}
|
||||
}
|
||||
|
||||
protected string BaseUrlTab
|
||||
{
|
||||
get => $"{Configuration["ServerConf:BaseUrl"]}";
|
||||
}
|
||||
|
||||
|
||||
protected string rawCode
|
||||
{
|
||||
get
|
||||
{
|
||||
string answ = "";
|
||||
answ = $"{BaseUrlTab}MatrOpr={101}&UserAuthKey={12345}";
|
||||
return answ;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
@page "/Test"
|
||||
|
||||
<h3>Test</h3>
|
||||
|
||||
<button class="btn btn-primary" type="button" data-bs-toggle="offcanvas" data-bs-target="#offcanvasExample" aria-controls="offcanvasExample">
|
||||
Button with data-bs-target
|
||||
</button>
|
||||
<div class="offcanvas offcanvas-start" tabindex="-1" id="offcanvasExample" aria-labelledby="offcanvasExampleLabel">
|
||||
<div class="offcanvas-header">
|
||||
<h5 class="offcanvas-title" id="offcanvasExampleLabel">Offcanvas</h5>
|
||||
<button type="button" class="btn-close text-reset" data-bs-dismiss="offcanvas" aria-label="Close"></button>
|
||||
</div>
|
||||
<div class="offcanvas-body">
|
||||
<div>
|
||||
Some text as placeholder. In real life you can have the elements you have chosen. Like, text, images, lists, etc.
|
||||
</div>
|
||||
<div class="dropdown mt-3">
|
||||
<button class="btn btn-secondary dropdown-toggle" type="button" id="dropdownMenuButton" data-bs-toggle="dropdown">
|
||||
Dropdown button
|
||||
</button>
|
||||
<ul class="dropdown-menu" aria-labelledby="dropdownMenuButton">
|
||||
<li><a class="dropdown-item" href="#">Action</a></li>
|
||||
<li><a class="dropdown-item" href="#">Another action</a></li>
|
||||
<li><a class="dropdown-item" href="#">Something else here</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@code {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
@page "/Utils"
|
||||
|
||||
@using MP.INVE.Components
|
||||
@using MP.INVE.Data
|
||||
|
||||
<h3>Utils</h3>
|
||||
|
||||
<div class="">
|
||||
<button class="btn btn-primary" @onclick="() => flushCache()"> Flush Cache </button>
|
||||
</div>
|
||||
@@ -0,0 +1,30 @@
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using MP.INVE.Data;
|
||||
|
||||
namespace MP.INVE.Pages
|
||||
{
|
||||
public partial class Utils
|
||||
{
|
||||
#region Public Methods
|
||||
|
||||
public async Task flushCache()
|
||||
{
|
||||
await Task.Delay(1);
|
||||
await MDService.FlushRedisCache();
|
||||
// rimando a home
|
||||
NavManager.NavigateTo("", true);
|
||||
}
|
||||
|
||||
[Inject]
|
||||
private NavigationManager NavManager { get; set; } = null!;
|
||||
|
||||
#endregion Public Methods
|
||||
|
||||
#region Protected Properties
|
||||
|
||||
[Inject]
|
||||
protected MpDataService MDService { get; set; } = null!;
|
||||
|
||||
#endregion Protected Properties
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
@page "/"
|
||||
@namespace MP.INVE.Pages
|
||||
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
|
||||
@{
|
||||
Layout = "_Layout";
|
||||
}
|
||||
|
||||
<component type="typeof(App)" render-mode="Server" />
|
||||
@@ -0,0 +1,66 @@
|
||||
@using Microsoft.AspNetCore.Components.Web
|
||||
@namespace MP.INVE.Pages
|
||||
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<meta name="google" content="notranslate">
|
||||
<base href="~/" />
|
||||
<link rel="stylesheet" href="lib/bootstrap/css/bootstrap.min.css" />
|
||||
<link rel="stylesheet" href="lib/bootstrap-icons/font/bootstrap-icons.min.css" />
|
||||
<link rel="stylesheet" href="css/site.min.css" />
|
||||
<link rel="stylesheet" href="lib/font-awesome/css/all.min.css" />
|
||||
<link href="MP.INVE.styles.css" rel="stylesheet" />
|
||||
<component type="typeof(HeadOutlet)" render-mode="ServerPrerendered" />
|
||||
</head>
|
||||
<body>
|
||||
@RenderBody()
|
||||
|
||||
<div id="blazor-error-ui">
|
||||
<environment include="Staging,Production">
|
||||
An error has occurred. This application may no longer respond until reloaded.
|
||||
</environment>
|
||||
<environment include="Development">
|
||||
An unhandled exception has occurred. See browser dev tools for details.
|
||||
</environment>
|
||||
<a href="" class="reload">Reload</a>
|
||||
<a class="dismiss">🗙</a>
|
||||
</div>
|
||||
|
||||
<script src="lib/bootstrap/js/bootstrap.bundle.min.js"></script>
|
||||
<script src="_framework/blazor.server.js" autostart="false"></script>
|
||||
<script src="lib/chartBoot.js"></script>
|
||||
<script src="lib/modalHandler.js"></script>
|
||||
<script src="lib/Chart.js/chart.js"></script>
|
||||
|
||||
@*Gestione autoriconnessione: https://github.com/dotnet/aspnetcore/issues/38305 (vedere anche https://docs.microsoft.com/it-it/aspnet/core/blazor/fundamentals/signalr?view=aspnetcore-6.0#modify-the-reconnection-handler-blazor-server)*@
|
||||
<script>
|
||||
Blazor.start({
|
||||
reconnectionOptions: {
|
||||
maxRetries: 300,
|
||||
retryIntervalMilliseconds: 2000
|
||||
}
|
||||
}).then(() => {
|
||||
Object.defineProperty(Blazor.defaultReconnectionHandler, '_reconnectionDisplay', {
|
||||
get() {
|
||||
return this.__reconnectionDisplay;
|
||||
},
|
||||
set(value) {
|
||||
this.__reconnectionDisplay = {
|
||||
show: () => value.show(),
|
||||
update: (d) => value.update(d),
|
||||
rejected: (d) => document.location.reload()
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
<script type="text/javascript" src="~/lib/qrcode.js"></script>
|
||||
<script type="text/javascript" src="~/lib/qrHelper.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,67 @@
|
||||
using Microsoft.AspNetCore.Authentication.Negotiate;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using Microsoft.AspNetCore.Components.Web;
|
||||
using MP.INVE.Components;
|
||||
using MP.INVE.Data;
|
||||
using MP.INVE.Services;
|
||||
using StackExchange.Redis;
|
||||
|
||||
var builder = WebApplication.CreateBuilder(args);
|
||||
|
||||
/*--------------------
|
||||
* Note migrazione startup.cs -_> program.cs:
|
||||
*
|
||||
* - https://stackoverflow.com/questions/69722872/asp-net-core-6-how-to-access-configuration-during-startup
|
||||
* - https://docs.microsoft.com/en-us/aspnet/core/migration/50-to-60?view=aspnetcore-5.0&tabs=visual-studio#where-do-i-put-state-that-was-stored-as-fields-in-my-program-or-startup-class
|
||||
*
|
||||
* */
|
||||
|
||||
ConfigurationManager configuration = builder.Configuration;
|
||||
|
||||
// REDIS setup
|
||||
string connStringRedis = configuration.GetConnectionString("Redis");
|
||||
string redisSrvAddr = connStringRedis.Substring(0, connStringRedis.IndexOf(":"));
|
||||
// avvio oggetto shared x redis...
|
||||
var redisMultiplexer = ConnectionMultiplexer.Connect(connStringRedis);
|
||||
// Add services to the container.
|
||||
builder.Services.AddAuthentication(NegotiateDefaults.AuthenticationScheme)
|
||||
.AddNegotiate();
|
||||
|
||||
builder.Services.AddAuthorization(options =>
|
||||
{
|
||||
// By default, all incoming requests will be authorized according to the default policy.
|
||||
options.FallbackPolicy = options.DefaultPolicy;
|
||||
});
|
||||
|
||||
builder.Services.AddRazorPages();
|
||||
builder.Services.AddServerSideBlazor();
|
||||
builder.Services.AddSingleton<IConnectionMultiplexer>(redisMultiplexer);
|
||||
builder.Services.AddSingleton<MiDataService>();
|
||||
builder.Services.AddScoped<MessageService>();
|
||||
|
||||
builder.Services.AddHttpClient();
|
||||
builder.Services.AddSingleton<IOApiService>();
|
||||
|
||||
var app = builder.Build();
|
||||
|
||||
// Configure the HTTP request pipeline.
|
||||
if (!app.Environment.IsDevelopment())
|
||||
{
|
||||
app.UseExceptionHandler("/Error");
|
||||
// The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
|
||||
app.UseHsts();
|
||||
}
|
||||
|
||||
app.UseHttpsRedirection();
|
||||
|
||||
app.UseStaticFiles();
|
||||
|
||||
app.UseRouting();
|
||||
|
||||
app.UseAuthentication();
|
||||
app.UseAuthorization();
|
||||
|
||||
app.MapBlazorHub();
|
||||
app.MapFallbackToPage("/_Host");
|
||||
|
||||
app.Run();
|
||||
@@ -0,0 +1,28 @@
|
||||
{
|
||||
"iisSettings": {
|
||||
"windowsAuthentication": true,
|
||||
"anonymousAuthentication": false,
|
||||
"iisExpress": {
|
||||
"applicationUrl": "http://localhost:46815",
|
||||
"sslPort": 44370
|
||||
}
|
||||
},
|
||||
"profiles": {
|
||||
"MP.INVE": {
|
||||
"commandName": "Project",
|
||||
"dotnetRunMessages": true,
|
||||
"launchBrowser": true,
|
||||
"applicationUrl": "https://localhost:7212;http://localhost:5212",
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
}
|
||||
},
|
||||
"IIS Express": {
|
||||
"commandName": "IISExpress",
|
||||
"launchBrowser": true,
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,191 @@
|
||||
# MP.INVE
|
||||
|
||||

|
||||
|
||||
- [MP.INVE](#mpinve)
|
||||
- [Schema generale](#schema-generale)
|
||||
- [Funzionalita](#funzionalita)
|
||||
- [Use cases](#use-cases)
|
||||
- [Inventario oggetti (A): Noti, Univoci](#inventario-oggetti-a-noti-univoci)
|
||||
- [Inventario oggetti (B): Noti, non univoci](#inventario-oggetti-b-noti-non-univoci)
|
||||
- [Inventario oggetti (C): Non noti](#inventario-oggetti-c-non-noti)
|
||||
- [Pagine](#pagine)
|
||||
- [Sessioni Inventario](#sessioni-inventario)
|
||||
- [Acquisizione](#acquisizione)
|
||||
- [Invio Inventari](#invio-inventari)
|
||||
- [Revisione Documento](#revisione-documento)
|
||||
|
||||
<div style="page-break-after: always; visibility: hidden"></div>
|
||||
|
||||
# Schema generale
|
||||
|
||||
Di seguito lo schema generale del pacchetto opzionale MP.INVE
|
||||
|
||||

|
||||
|
||||
<div style="page-break-after: always; visibility: hidden"></div>
|
||||
|
||||
## Funzionalita
|
||||
|
||||
La funzionalità principale del sw è quella di effettuare l'inventario (periodico) del magazzino e di conseguenza produrre un "point in time state reference" sulle giacenze (ovvero la fotografia di uno stato magazzino valido in un dato istante temporale).
|
||||
|
||||
Questo perchè ovviamente un magazzino è un oggetto live in cui i vari oggetti entrano/escono in modo continuo e quindi le gacenze cambiano secondo la registrazione di ogni movimento ingresso/uscita materiale.
|
||||
|
||||
In generale l'approccio desiderato è quello di
|
||||
* aprire una sessione di inventario:
|
||||
* definita da data-ora + nome
|
||||
* il nome ad esempio indica di quale magazzino si stia facendo l'inventario (per differenziare ad esempio grezzi, semilavorati, finiti, ...)
|
||||
* permettere ad 1+ devices di lavorare sulla sessione di inventario
|
||||
* collezionare una serie di letture di barcode / QRCode
|
||||
* generare una situazione finale di stato magazzino acquisito
|
||||
|
||||
Le funzionalità cambiano a seconda del tipo di oggetto letto, poiché avremo
|
||||
* (A) codici univoci assoluti
|
||||
* ad esempio sono i codici UDC generati da sistemi MAPO, dove ogni oggetto ha un codice univoco
|
||||
* permette di determinare con precisione
|
||||
* articolo
|
||||
* lotto
|
||||
* quantità
|
||||
* ...
|
||||
* è possibile discriminare l'operazione di lettura in modo assoluto (oggetto mai letto / oggetto già acquisito)
|
||||
* (B) codici NON univoci, verificabili da MAPO
|
||||
* si tratta ad esempio di codici lotto generati esternamente
|
||||
* lo stesso codice può essere associato a vari oggetti fisici (es un codice univoco di lotto materia prima, che è condiviso da n scatole recanti lo stesso identico codice)
|
||||
* eventualmente esistono informazioni di tipo aggregato relative al codice che permettono di avere
|
||||
* quantità globale
|
||||
* numero colli globale
|
||||
* stato globale (es approvato/non approvato)
|
||||
* esempio sono i lotti materia prima generati da un sistema ERP esterno quale ARCA (Edilchimica)
|
||||
* (C) codici NON verificabili da MAPO
|
||||
* si tratta ad esempio di codici lotto generati esternamente
|
||||
* questi valori NON sono verificabili su un database esterno (quindi non si sa se siano validi o meno)
|
||||
* non è dato sapere se siano univoci (un codice distinto per ogni collo) oppure condivisi (stesso codice su più colli)
|
||||
|
||||
<div style="page-break-after: always; visibility: hidden"></div>
|
||||
|
||||
## Use cases
|
||||
|
||||
I casi d'uso previsti sono i seguenti
|
||||
|
||||
### Inventario oggetti (A): Noti, Univoci
|
||||
|
||||
In questo caso si tratta di ogetti tipo (A), con codici univoci e certi, che permettono di sapere univocamente
|
||||
* se il codice sia già stato acquisito o meno
|
||||
* i dati corretti associati al codice (quantità, lotto, articolo)
|
||||
* Verifiche varie di coerenza (già spediti, Lotto\Articolo NULL, Pezzi a 0)
|
||||
* Invio di tutti i dati come "Forzati" in quanto sicuramente corretti.
|
||||
|
||||
Operativamente una volta letti questi codici i dati sono presentati all'operatore per conferma, non è prevista rettifica da parte dell'operatore (prevedere eventualmente modifica di quantità opzionale).
|
||||
|
||||
Questo significa che è possibile avere in uscita liste di giacenza
|
||||
* certe/certificabili
|
||||
* complete
|
||||
* senza "errori di doppia lettura"
|
||||
* con allocazione certa di lotti/articoli
|
||||
* con verifica coerenza informazioni
|
||||
|
||||
Sono esempio di questo tipo di giacenze
|
||||
* i finiti con etichette generate da MAPO.MAG
|
||||
* i semilavorati con etichette generate da MAPO.MAG
|
||||
|
||||
<div style="page-break-after: always; visibility: hidden"></div>
|
||||
|
||||
### Inventario oggetti (B): Noti, non univoci
|
||||
|
||||
In questo caso si tratta di ogetti tipo (B), con codici NON univoci ma verificabili, che permettono di sapere
|
||||
* i dati associati al codice (quantità totale, lotto, articolo, numero colli)
|
||||
|
||||
Però non è possibile sapere
|
||||
* la quantità effettiva per collo
|
||||
* se il codice sia stato acquisito più volte (per errore) o meno
|
||||
|
||||
Operativamente una volta letti questi codici dovrà svolgersi il seguente processo
|
||||
* verifica se il codice sia già stato letto e salvato in MAPO
|
||||
* verifica di eventuale quantità unitaria già confermata
|
||||
* in alternativa lettura da ERP del codice e riconoscimento, con proposta quantità/collo, articolo e lotto, poi salvata in MAPO
|
||||
* richiesta all'operatore di verifica che si tratti di prima lettura (per evitare doppie letture l'operatore dovrebbe marcare/siglare ogni collo con un simbolo/data/etichetta comprovante l'effettuata lettura inventario')
|
||||
|
||||
* presentazione all'operatore dei dati per conferma OBBLIGATORIA ad ogni lettura
|
||||
* Salvataggio, in caso di modifica dei valori proposti la prima volta, della "Forzatura"
|
||||
|
||||
Questo significa che è possibile avere in uscita liste di giacenza
|
||||
* con possibili "errori di doppia lettura"
|
||||
* con allocazione certa di lotti/articoli di quanto riconosciuto
|
||||
* con verifica coerenza informazioni dei codici riconosciuti
|
||||
|
||||
Sono esempio di questo tipo di giacenze
|
||||
* materie prime con etichette NON generate da MAPO.MAG
|
||||
* i semilavorati con etichette NON generate da MAPO.MAG
|
||||
* i finiti con etichette NON generate da MAPO.MAG
|
||||
|
||||
<div style="page-break-after: always; visibility: hidden"></div>
|
||||
|
||||
### Inventario oggetti (C): Non noti
|
||||
|
||||
In questo caso si tratta di ogetti tipo (C), con codici ignoti e non verificabili. Questo significa che non è possibile sapere
|
||||
* i dati di base associati al codice (quantità totale, lotto, articolo, numero colli)
|
||||
* se il codice sia stato acquisito più volte (per errore) o meno
|
||||
|
||||
Operativamente una volta letti questi codici dovrà svolgersi il seguente processo
|
||||
* verifica se il codice sia già stato letto e salvato in MAPO
|
||||
* verifica di eventuale quantità unitaria già confermata
|
||||
* in alternativa proposta quantità/collo, articolo e lotto a partire dall'ultimo valore letto di tipo (C), salvataggio successivo in MAPO del codice + dati specifici
|
||||
* richiesta all'operatore di verifica che si tratti di prima lettura (per evitare doppie letture l'operatore dovrebbe marcare/siglare ogni collo con un simbolo/data/etichetta comprovante l'effettuata lettura inventario')
|
||||
* presentazione all'operatore dei dati per conferma OBBLIGATORIA ad ogni lettura
|
||||
* Salvataggio, in caso di modifica dei valori proposti la prima volta, della "Forzatura"
|
||||
|
||||
Questo significa che è possibile avere in uscita liste di giacenza
|
||||
* con possibili "errori di doppia lettura"
|
||||
* SENZA informazione certa di lotti/articoli
|
||||
* SENZA verifica coerenza informazioni dei codici riconosciuti
|
||||
|
||||
Sono esempio di questo tipo di giacenze
|
||||
* etichette di fornitori esterni
|
||||
|
||||
<div style="page-break-after: always; visibility: hidden"></div>
|
||||
|
||||
## Pagine
|
||||
|
||||
### Sessioni Inventario
|
||||
|
||||
rif tab: **InveSess**
|
||||
|
||||
In questa pagina saranno visualizzate le sessioni di inventario, con le seguenti specifiche:
|
||||
* tabella record standard
|
||||
* filtro principale tra "in corso" e già chiuse
|
||||
* gestione filtri completa contestuale (con menù laterale)
|
||||
* possibilità di inserimento nuova sessione di inventario (con nome, descrizione, dataora avvio, magazzino)
|
||||
* possibilità di chiudere le sessioni aperte di inventario (non rendendo possibile ulteriore aggiunta di letture/giacenze)
|
||||
|
||||
### Acquisizione
|
||||
|
||||
rif tab: **InveScanData**
|
||||
|
||||
La pagina di acquisizione è quella principale tramite smart device, e ha le seguenti caratteristiche
|
||||
|
||||
* ottimizzata per smart-device / handheld device (es DataLogic Memor10, viewscreen da 320x480 pixels)
|
||||
* ottimizzata per input da barcode/qrcode continuo
|
||||
* con processo input simile ad altri applicativi (MP.MAG, CTRACK, GMW, ...)
|
||||
* con conferma button-based ove richiesta
|
||||
* con gestione colori esplicita (es green = OK, RED = error, YELLOW = richiesta conferma utente...)
|
||||
|
||||
il sistema dovrà processare ogni valore letto e nel minor tempo possibile capire quale caso d'uso sia in corso tra (A), (B) e (C) e di conseguenza proporre opzioni all'operatore
|
||||
|
||||
|
||||
### Invio Inventari
|
||||
|
||||
La pagina invio serve a prendere gli inventari acquisiti e inviarli al gestionale esterno tramite stored procedure ospitate sui db MoonPro_IS del cliente (e quindi con logiche diverse per ogni caso).
|
||||
|
||||
La conferma dell'utente sarà necessaria, da valutare se inserire uno stato inventario (in corso, chiuso, trasferito) per evitare doppio trasferimento e permettere un ri-trasferimento solo tramite sblocco admin da DB (=solo da parte di EgalWare).
|
||||
|
||||
Invio aggregato dei dati di
|
||||
* Magazzino (Codice Gestionale), Lotto, Articolo, quantità, Tipo Lettura (A,B,C), Flag Forzatura Lotto\Articolo
|
||||
|
||||
<div style="page-break-after: always; visibility: hidden"></div>
|
||||
|
||||
# Revisione Documento
|
||||
|
||||
| Date | Edit | Version | Note |
|
||||
|------------|----------------|:-------:|-----------------:|
|
||||
| 2022.11.10 | S.E. Locatelli | 0.1 | Initial draft |
|
||||
| 2022.11.10 | Gian / Zac | 0.2 | Second draft |
|
||||
Binary file not shown.
@@ -0,0 +1,25 @@
|
||||
<body>
|
||||
<i>Modulo MAPOINVE </i>
|
||||
<h4>Versione: {{CURRENT-REL}}</h4>
|
||||
<br /> Note di rilascio:
|
||||
<ul>
|
||||
<li>
|
||||
<b>Ultime modifiche:</b>
|
||||
<ul>{{LAST-CHANGES}}</ul>
|
||||
</li>
|
||||
<li>
|
||||
<b>v.6.15.* →</b>
|
||||
<ul>
|
||||
<li>Prima release dotnet6</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
<div>
|
||||
<div style="float: left;">
|
||||
<img src="logoSteamware.png" />
|
||||
</div>
|
||||
<div style="float: right;">
|
||||
<a href="https://www.steamware.net/IOT" target="_blank">© Steamware 2006-2022</a>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
@@ -0,0 +1,25 @@
|
||||
<body>
|
||||
<i>Modulo MAPOINVE </i>
|
||||
<h4>Versione: 6.16.2211.1510</h4>
|
||||
<br /> Note di rilascio:
|
||||
<ul>
|
||||
<li>
|
||||
<b>Ultime modifiche:</b>
|
||||
<ul>{{LAST-CHANGES}}</ul>
|
||||
</li>
|
||||
<li>
|
||||
<b>v.6.15.* →</b>
|
||||
<ul>
|
||||
<li>Prima release dotnet6</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
<div>
|
||||
<div style="float: left;">
|
||||
<img src="logoSteamware.png" />
|
||||
</div>
|
||||
<div style="float: right;">
|
||||
<a href="https://www.steamware.net/IOT" target="_blank">© Steamware 2006-2022</a>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
@@ -0,0 +1 @@
|
||||
6.16.2211.1510
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 3.3 KiB |
@@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<item>
|
||||
<version>1.0.0.0</version>
|
||||
<url>https://nexus.steamware.net/repository/SWS/{{DIRNAME}}/{{BRANCHNAME}}/{{PACKNAME}}.zip</url>
|
||||
<changelog>https://nexus.steamware.net/repository/SWS/{{DIRNAME}}/{{BRANCHNAME}}/ChangeLog.html</changelog>
|
||||
<mandatory>false</mandatory>
|
||||
</item>
|
||||
@@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<item>
|
||||
<version>6.16.2211.1510</version>
|
||||
<url>https://nexus.steamware.net/repository/SWS/MP-INVE/stable/LAST/MP.INVE.zip</url>
|
||||
<changelog>https://nexus.steamware.net/repository/SWS/MP-INVE/stable/LAST/ChangeLog.html</changelog>
|
||||
<mandatory>false</mandatory>
|
||||
</item>
|
||||
@@ -0,0 +1,63 @@
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using MP.INVE.Data;
|
||||
using NLog;
|
||||
using System.Text.Json;
|
||||
|
||||
namespace MP.INVE.Services
|
||||
{
|
||||
/// <summary>
|
||||
/// Classe per chiamare metodi da MP-IO
|
||||
///
|
||||
/// rif:
|
||||
/// https://www.ezzylearning.net/tutorial/making-http-requests-in-blazor-server-apps
|
||||
/// https://wellsb.com/csharp/aspnet/blazor-httpclientfactory-and-web-api/
|
||||
/// </summary>
|
||||
public class IOApiService
|
||||
{
|
||||
private readonly IHttpClientFactory _clientFactory;
|
||||
private static ILogger<MiDataService> _logger = null!;
|
||||
private static IConfiguration _configuration = null!;
|
||||
|
||||
|
||||
|
||||
private static Logger Log = LogManager.GetCurrentClassLogger();
|
||||
|
||||
private static string MpIoBaseUrl = "";
|
||||
|
||||
public IOApiService(IHttpClientFactory clientFactory, IConfiguration configuration, ILogger<MiDataService> logger)
|
||||
{
|
||||
_logger = logger;
|
||||
_logger.LogInformation("Starting IOApiService INIT");
|
||||
_configuration = configuration;
|
||||
_clientFactory = clientFactory;
|
||||
// conf url x chiamate REST
|
||||
MpIoBaseUrl = _configuration.GetValue<string>("ServerConf:MpIoBaseUrl");
|
||||
}
|
||||
/// <summary>
|
||||
/// Effettua chiamata ad MP-IO
|
||||
/// </summary>
|
||||
/// <param name="relUrl">URL metodo relativo alla base path di MP-IO</param>
|
||||
/// <returns></returns>
|
||||
public async Task<string> callMpIoUrlGet(string relUrl)
|
||||
{
|
||||
string result = "";
|
||||
var request = new HttpRequestMessage(HttpMethod.Get, $"{MpIoBaseUrl}{relUrl}");
|
||||
request.Headers.Add("Accept", "application/vnd.github.v3+json");
|
||||
var client = _clientFactory.CreateClient();
|
||||
Log.Info($"Richiesta call per {MpIoBaseUrl}{relUrl}");
|
||||
var response = await client.SendAsync(request);
|
||||
if (response.IsSuccessStatusCode)
|
||||
{
|
||||
var stringResponse = await response.Content.ReadAsStringAsync();
|
||||
result = stringResponse;
|
||||
Log.Info($"Richiesta call per {MpIoBaseUrl}{relUrl}");
|
||||
}
|
||||
else
|
||||
{
|
||||
result = "NO";
|
||||
Log.Error($"Errore in chaimata | code {response.StatusCode} | {response.Content}");
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user