Merge branch 'Release/Spec_FermiRepa_02'

This commit is contained in:
Samuele Locatelli
2026-03-20 15:36:13 +01:00
25 changed files with 932 additions and 173 deletions
+2 -2
View File
@@ -1,7 +1,7 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.0.32126.317
# Visual Studio Version 18
VisualStudioVersion = 18.3.11520.95 d18.3
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MP.Data", "MP.Data\MP.Data.csproj", "{10BA8450-301D-49C7-8E1E-21B7469C225C}"
EndProject
+6 -3
View File
@@ -1,7 +1,7 @@
using global::Microsoft.AspNetCore.Components;
using Microsoft.JSInterop;
using MP.Data;
using MP.Core.Objects;
using MP.Data;
using MP.Data.DbModels;
using MP.Data.Services;
using NLog;
@@ -589,7 +589,6 @@ namespace MP_TAB3.Components
/***************************************************
* comprende gestione machineSlave x fix ODL master --> slave
*
***************************************************/
// preparo gestione progress display
@@ -824,6 +823,10 @@ namespace MP_TAB3.Components
await checkConfProd();
}
/// <summary>
/// Chiusura produzione ODL corrente
/// </summary>
/// <returns></returns>
protected async Task ProdEnd()
{
if (!await JSRuntime.InvokeAsync<bool>("confirm", $"Confermi fine produzione?"))
@@ -1729,7 +1732,7 @@ namespace MP_TAB3.Components
private async Task processaEvento(string idxMaccCurr, int idxEvento, string userMsg, int idxODL, DateTime adesso)
{
inputComandoMapo inCmd;
inputComandoMapo inCmd2;
inputComandoMapo inCmd2;
var rigaStato = TabDServ.StatoMacchina(idxMaccCurr);
// processo evento...
EventListModel newRec = new EventListModel()
+1 -1
View File
@@ -3,7 +3,7 @@
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable>
<Version>6.16.2602.2607</Version>
<Version>6.16.2603.411</Version>
<ImplicitUsings>enable</ImplicitUsings>
<RootNamespace>MP_TAB3</RootNamespace>
</PropertyGroup>
+1 -1
View File
@@ -1,6 +1,6 @@
<body>
<i>Modulo MAPOSPEC </i>
<h4>Versione: 6.16.2602.2607</h4>
<h4>Versione: 6.16.2603.411</h4>
<br /> Note di rilascio:
<ul>
<li>
+1 -1
View File
@@ -1 +1 @@
6.16.2602.2607
6.16.2603.411
+1 -1
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<item>
<version>6.16.2602.2607</version>
<version>6.16.2603.411</version>
<url>https://nexus.steamware.net/repository/SWS/MP-TAB3/stable/LAST/MP-TAB3.zip</url>
<changelog>https://nexus.steamware.net/repository/SWS/MP-TAB3/stable/LAST/ChangeLog.html</changelog>
<mandatory>false</mandatory>
+125
View File
@@ -0,0 +1,125 @@
namespace MP.Core.DTO
{
public class EventDto
{
public string CodTipo { get; set; } = "";
/// <summary>
/// Idx univoco evento
/// </summary>
public int IdxEv { get; set; } = 0;
#if false
public int IdxDipendente { get; set; } = 0;
public string CognomeNome { get; set; } = "";
public bool Conf { get; set; } = false;
public bool IsCompany { get; set; } = false;
#endif
public string Abbrev { get; set; } = "";
public string Titolo { get; set; } = "";
public string Descrizione { get; set; } = "";
public string Tooltip { get; set; } = "";
public DateTime DtStart { get; set; } = DateTime.Today.AddHours(9);
public DateTime DtEnd { get; set; } = DateTime.Today.AddHours(17);
public string Note { get; set; } = "";
public bool IsDraggable { get; set; } = false;
public bool IsExpired { get; set; } = false;
public bool IsPlanned { get; set; } = true;
public EventDto Clone()
{
return new EventDto()
{
CodTipo = this.CodTipo,
IdxEv = this.IdxEv,
#if false
IdxDipendente = this.IdxDipendente,
CognomeNome = this.CognomeNome,
Conf = this.Conf,
IsCompany = this.IsCompany,
#endif
Abbrev = this.Abbrev,
Titolo = this.Titolo,
Descrizione = this.Descrizione,
Tooltip = this.Tooltip,
DtStart = this.DtStart,
DtEnd = this.DtEnd,
Note = this.Note,
IsDraggable = this.IsDraggable,
IsPlanned = this.IsPlanned,
IsExpired = this.IsExpired
};
}
public string Durata
{
get
{
string answ = "-";
var durata = DtEnd.Subtract(DtStart);
if (CodTipo == "FER")
{
answ = $"{durata.TotalDays + 1:N0}gg";
}
else
{
answ = $"{durata.TotalHours:N1}h";
}
return answ;
}
}
public static string DateForm(string Tipo, DateTime DtEvent)
{
return (Tipo == "PERM" || Tipo == "104") ? $"{DtEvent:HH:mm}" : $"{DtEvent:ddd yyyy-MM-dd}";
}
public string Color
{
get => calcColor(CodTipo, IsPlanned, IsExpired);
}
public string? ForeColor
{
get => calcText(CodTipo, IsPlanned, IsExpired);
}
private string calcColor(string codTipo, bool isPlanned, bool isExpired)
{
string answ = "#EDEDED";
switch (codTipo)
{
case "Saomad":
answ = isExpired ? "#CDE0CD" : isPlanned ? "#11DD44" : "#D0F5DD";
break;
case "Essetre":
answ = isExpired ? "#AB9898" : isPlanned ? "#AD1919" : "#CD6767";
break;
default:
answ = isExpired ? "#EEDD11" : isPlanned ? "#11CD44" : "#AAFFCD";
break;
}
return answ;
}
private string calcText(string codTipo, bool isPlanned, bool isExpired)
{
string answ = "#EDEDED";
switch (codTipo)
{
case "Saomad":
answ = isExpired ? "#000000" : isPlanned ? "#000000" : "#555555";
break;
case "Essetre":
answ = isExpired ? "#000000" : isPlanned ? "#EEFF69" : "#D3E817";
break;
default:
answ = isExpired ? "#000000" : isPlanned ? "#FFFFFF" : "#000000";
break;
}
return answ;
}
}
}
@@ -0,0 +1,107 @@
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Configuration;
using MP.Core.DTO;
using MP.Data.DbModels.Sched;
using NLog;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace MP.Data.Controllers
{
public class MpSchedulerController : IDisposable
{
#region Public Constructors
public MpSchedulerController(IConfiguration configuration)
{
_configuration = configuration;
Log.Info("Avviata classe MpSchedulerController");
}
#endregion Public Constructors
#region Public Methods
public void Dispose()
{
}
public async Task<Dictionary<string, List<EventDto>>> PlannerGetEvents()
{
Dictionary<string, List<EventDto>> result = new Dictionary<string, List<EventDto>>();
using (var dbCtx = new MP_SchedContext(_configuration))
{
var RawData = await dbCtx
.DbSetPromOut
//.AsNoTracking()
.OrderBy(x => x.IdxPromessa)
.ToListAsync();
DateTime oggi = DateTime.Today;
result = RawData
.GroupBy(p => p.IdxMacchina)
.ToDictionary(
g => g.Key,
g => g.Select(p => new EventDto
{
IdxEv = p.IdxPromessa,
Abbrev = p.CodPODL,
Titolo = p.CodPODL,
DtEnd = p.DueDate ?? oggi.AddMonths(2),
DtStart = (p.DueDate ?? oggi.AddMonths(2)).AddDays(-3)
}).ToList()
);
}
return result;
}
/// <summary>
/// Elenco PromesseIN
/// </summary>
/// <returns></returns>
public List<PromesseInModel> PromInGetAll()
{
List<PromesseInModel> dbResult = new List<PromesseInModel>();
using (var dbCtx = new MP_SchedContext(_configuration))
{
dbResult = dbCtx
.DbSetPromIn
//.AsNoTracking()
.OrderBy(x => x.IdxPromessa)
.ToList();
}
return dbResult;
}
/// <summary>
/// Elenco PromesseIN
/// </summary>
/// <returns></returns>
public List<PromesseOutModel> ProOutGetAll()
{
List<PromesseOutModel> dbResult = new List<PromesseOutModel>();
using (var dbCtx = new MP_SchedContext(_configuration))
{
dbResult = dbCtx
.DbSetPromOut
//.AsNoTracking()
.OrderBy(x => x.IdxPromessa)
.ToList();
}
return dbResult;
}
#endregion Public Methods
#region Private Fields
private static IConfiguration _configuration;
private static NLog.Logger Log = LogManager.GetCurrentClassLogger();
#endregion Private Fields
}
}
+31 -2
View File
@@ -746,11 +746,11 @@ namespace MP.Data.Controllers
using (var dbCtx = new MoonProContext(_configuration))
{
var IdxMacc = new SqlParameter("@IdxMacchina", idxMacchina);
var DataElab = new SqlParameter("@DataElab", dtCurr);
var DataElab = new SqlParameter("@pDataOra", dtCurr);
var dbResult = await dbCtx
.Database
.ExecuteSqlRawAsync("EXEC stp_IM_ElaboraInsManuali @IdxMacchina, @DataElab", IdxMacc, DataElab);
.ExecuteSqlRawAsync("EXEC stp_IM_ElaboraInsManuali @IdxMacchina, @pDataOra", IdxMacc, DataElab);
fatto = dbResult > 0;
}
@@ -2056,6 +2056,35 @@ namespace MP.Data.Controllers
return answ;
}
/// <summary>
/// Esegue il ripristino stato precedente x una macchina che abbia una dichiarazione manuale (es Pausa pranzo) da cui "uscire"
/// </summary>
/// <param name="idxMacchina"></param>
/// <param name="dtCurr"></param>
/// <param name="valore"></param>
/// <param name="idxStato"></param>
/// <param name="matrOpr"></param>
/// <returns></returns>
public async Task<bool> RipristinaStatoPrec(string idxMacchina, DateTime dtCurr, string valore, int idxStato = 0, int matrOpr = 0)
{
bool fatto = false;
using (var dbCtx = new MoonProContext(_configuration))
{
var pIdxMacc = new SqlParameter("@IdxMacchina", idxMacchina);
var pDataOra = new SqlParameter("@DataOra", dtCurr);
var pIdxStato = new SqlParameter("@IdxStato", idxStato);
var pMatrOpr = new SqlParameter("@MatrOpr", matrOpr);
var pValueEv = new SqlParameter("@ValueEv", valore);
var dbResult = await dbCtx
.Database
.ExecuteSqlRawAsync("EXEC stp_DDB_RipristinaStato @IdxMacchina, @DataOra, @IdxStato, @MatrOpr, @ValueEv", pIdxMacc, pDataOra, pIdxStato, pMatrOpr, pValueEv);
fatto = dbResult > 0;
}
return fatto;
}
public bool SetDerogaSt(StCheckOverride deroga)
{
bool fatto = false;
+78
View File
@@ -0,0 +1,78 @@
using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
#nullable disable
// <Auto-Generated>
// This is here so CodeMaid doesn't reorganize this document
// </Auto-Generated>
namespace MP.Data.DbModels.Sched
{
[Table("PromesseIN")]
public partial class PromesseInModel
{
#region Public Properties
[Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int IdxPromessa { get; set; }
[MaxLength(50)]
public string KeyRichiesta { get; set; }
[MaxLength(50)]
public string KeyBCode { get; set; }
public bool Attivabile { get; set; } = false;
public int IdxOdl { get; set; } = 0;
[MaxLength(50)]
public string CodArticolo { get; set; } = "";
[MaxLength(50)]
public string CodGruppo { get; set; } = "";
[MaxLength(50)]
public string IdxMacchina { get; set; }
public int NumPezzi { get; set; } = 1;
public decimal Tcassegnato { get; set; } = 1;
public DateTime? DueDate { get; set; }
public int Priorita { get; set; } = 1;
public int PzPallet { get; set; } = 1;
[MaxLength(2500)]
public string Note { get; set; } = "";
[MaxLength(50)]
public string CodCli { get; set; } = "";
//public DateTime InsertDate { get; set; } = DateTime.Now;
//[MaxLength(500)]
//public string Recipe { get; set; } = "";
[MaxLength(250)]
public string NoteRichiesta { get; set; } = "";
public bool flgPromDirty { get; set; } = false;
public DateTime? DateAllOdlClose { get; set; }
[NotMapped]
public string CodFase
{
get
{
string answ = "*";
var allData = KeyRichiesta.Split('_');
if (allData.Length > 0)
{
answ = allData[0];
}
return answ;
}
}
/// <summary>
/// Navigazione oggetto Machine
/// </summary>
[ForeignKey("IdxMacchina")]
public virtual MacchineModel MachineNav { get; set; } = null!;
/// <summary>
/// Navigazione oggetto Articolo
/// </summary>
[ForeignKey("CodArticolo")]
public virtual AnagArticoliModel ArticoloNav { get; set; } = null!;
#endregion Public Properties
}
}
@@ -0,0 +1,78 @@
using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
#nullable disable
// <Auto-Generated>
// This is here so CodeMaid doesn't reorganize this document
// </Auto-Generated>
namespace MP.Data.DbModels.Sched
{
[Table("PromesseOUT")]
public partial class PromesseOutModel
{
#region Public Properties
[Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int IdxPromessa { get; set; }
[MaxLength(50)]
public string KeyRichiesta { get; set; }
[MaxLength(50)]
public string KeyBCode { get; set; }
public bool Attivabile { get; set; } = false;
public int IdxOdl { get; set; } = 0;
[MaxLength(50)]
public string CodArticolo { get; set; } = "";
[MaxLength(50)]
public string CodGruppo { get; set; } = "";
[MaxLength(50)]
public string IdxMacchina { get; set; }
public int NumPezzi { get; set; } = 1;
public decimal Tcassegnato { get; set; } = 1;
public DateTime? DueDate { get; set; }
public int Priorita { get; set; } = 1;
public int PzPallet { get; set; } = 1;
[MaxLength(2500)]
public string Note { get; set; } = "";
[MaxLength(50)]
public string CodCli { get; set; } = "";
//public DateTime InsertDate { get; set; } = DateTime.Now;
//[MaxLength(500)]
//public string Recipe { get; set; } = "";
[NotMapped]
public string CodFase
{
get
{
string answ = "*";
var allData = KeyRichiesta.Split('_');
if (allData.Length > 0)
{
answ = allData[0];
}
return answ;
}
}
[NotMapped]
public string CodPODL
{
get => $"PODL{IdxPromessa:00000000}";
}
/// <summary>
/// Navigazione oggetto Machine
/// </summary>
[ForeignKey("IdxMacchina")]
public virtual MacchineModel MachineNav { get; set; } = null!;
/// <summary>
/// Navigazione oggetto Articolo
/// </summary>
[ForeignKey("CodArticolo")]
public virtual AnagArticoliModel ArticoloNav { get; set; } = null!;
#endregion Public Properties
}
}
+94
View File
@@ -0,0 +1,94 @@
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Configuration;
using MP.Data.DbModels.Sched;
using NLog;
#nullable disable
// <Auto-Generated>
// This is here so CodeMaid doesn't reorganize this document
// </Auto-Generated>
namespace MP.Data
{
public partial class MP_SchedContext : DbContext
{
#region Private Fields
private static NLog.Logger Log = LogManager.GetCurrentClassLogger();
private IConfiguration _configuration;
#endregion Private Fields
#region Public Constructors
public MP_SchedContext(IConfiguration configuration)
{
_configuration = configuration;
}
public MP_SchedContext(DbContextOptions<MP_SchedContext> options) : base(options)
{
}
#endregion Public Constructors
#region Public Properties
public virtual DbSet<PromesseInModel> DbSetPromIn { get; set; }
public virtual DbSet<PromesseOutModel> DbSetPromOut { 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.Sched");
optionsBuilder.UseSqlServer(connString);
}
}
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
modelBuilder.HasAnnotation("Relational:Collation", "SQL_Latin1_General_CP1_CI_AS");
//modelBuilder.Entity<ConfigModel>(entity =>
//{
// entity.HasKey(e => e.Chiave);
// entity.ToTable("Config");
// entity.Property(e => e.Chiave)
// .HasMaxLength(50)
// .HasColumnName("chiave");
// entity.Property(e => e.Note).HasColumnName("note");
// entity.Property(e => e.Valore).HasColumnName("valore");
// entity.Property(e => e.ValoreStd)
// .HasColumnName("valoreStd")
// .HasComment("Valore di default/riferimento per la variabile");
//});
//modelBuilder.Entity<VocabolarioModel>(entity =>
//{
// entity.HasKey(e => new { e.Lingua, e.Lemma });
//});
OnModelCreatingPartial(modelBuilder);
}
#endregion Protected Methods
}
}
+90
View File
@@ -0,0 +1,90 @@
using Microsoft.Extensions.Configuration;
using MP.Core.DTO;
using StackExchange.Redis;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
namespace MP.Data.Services
{
public class SchedulerDataService : BaseServ
{
/// <summary>
/// Init servizio TAB
/// </summary>
/// <param name="configuration"></param>
public SchedulerDataService(IConfiguration configuration, IConnectionMultiplexer redConn) : base(configuration, redConn)
{
_configuration = configuration;
// // conf DB
// ConnStr = _configuration.GetConnectionString("MP.All");
// if (string.IsNullOrEmpty(ConnStr))
// {
// Log.Error("ConnString empty!");
// }
// else
// {
// StringBuilder sb = new StringBuilder();
// dbTabController = new Controllers.MpTabController(configuration);
// sb.AppendLine($"TabDataService | MpTabController OK");
// dbIocController = new Controllers.MpIocController(configuration);
// sb.AppendLine($"TabDataService | MpIocController OK");
// dbInveController = new Controllers.MpInveController(configuration);
// sb.AppendLine($"TabDataService | MpInveController OK");
// Log.Info(sb.ToString());
// // sistemo i parametri x redHas...
// CodModulo = _configuration.GetValue<string>("SpecialConf:CodModulo");
// CodModuloParam = _configuration.GetValue<string>("SpecialConf:CodModuloParam");
//#if false
// MpIoNS = _configuration.GetValue<string>("ServerConf:MpIoNS");
//#endif
// var cstringArray = ConnStr.Split(";");
// foreach (var item in cstringArray)
// {
// var cData = item.Trim().Split("=");
// if (cData.Length == 2)
// {
// if (!connStrParams.ContainsKey(cData[0]))
// {
// connStrParams.Add(cData[0], cData[1]);
// }
// }
// }
// // sistemo
// DataSource = connStrParams["Server"];
// DataBase = connStrParams["Database"];
// }
}
public async Task<Dictionary<string, List<EventDto>>?> PlannerGetEvents(DateTime dtInizio, DateTime dtFine)
{
Dictionary<string, List<EventDto>>? result = null;
await Task.Delay(200);
return result;
//using var activity = StartActivity();
//string source = "DB";
//Dictionary<string, List<EventDto>>? result = null;
//// cerco in redis...
//string currKey = $"{redisBaseKey}:PlannerData:{dtStart:yyyyMMdd}:{dtEnd:yyyyMMdd}";
//RedisValue rawData = await redisDb.StringGetAsync(currKey);
////if (!string.IsNullOrEmpty($"{rawData}"))
//if (rawData.HasValue && rawData.Length() > 2)
//{
// result = JsonConvert.DeserializeObject<Dictionary<string, List<EventDto>>>($"{rawData}");
// source = "REDIS";
//}
//else
//{
// result = dataSimController.PlannerGetEvents(dtStart, dtEnd);
// // serializzo e salvo...
// rawData = JsonConvert.SerializeObject(result);
// await redisDb.StringSetAsync(currKey, rawData, LongCache);
//}
//activity?.SetTag("data.source", source);
//LogTrace($"{source} | trace: {activity?.TraceId} | {activity?.Duration.TotalMilliseconds}ms");
//return result;
}
}
}
+30 -2
View File
@@ -9,7 +9,6 @@ using NLog;
using StackExchange.Redis;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Data;
using System.Diagnostics;
using System.Globalization;
@@ -3034,6 +3033,35 @@ namespace MP.Data.Services
return answ;
}
/// <summary>
/// Esegue il ripristino stato precedente x una macchina che abbia una dichiarazione manuale (es Pausa pranzo) da cui "uscire"
/// </summary>
/// <param name="idxMacchina"></param>
/// <param name="dtCurr"></param>
/// <param name="valore"></param>
/// <param name="idxStato"></param>
/// <param name="matrOpr"></param>
/// <returns></returns>
public async Task<bool> RipristinaStatoPrec(string idxMacchina, DateTime dtCurr, string valore, int idxStato = 0, int matrOpr = 0)
{
bool inserito = false;
try
{
// inserisco evento
inserito = await dbTabController.RipristinaStatoPrec(idxMacchina, dtCurr, valore, idxStato, matrOpr);
// reset cache eventi/commenti
await FlushCache("EvList");
await FlushCache("Commenti");
}
catch (Exception exc)
{
string logMsg = $"Eccezione in fase di RipristinaStatoPrec | macchina: {idxMacchina} | dtCurr: {dtCurr} | valore: {valore} | idxStato {idxStato} | matrOpr {matrOpr}{Environment.NewLine}{exc}";
Log.Error(logMsg);
}
return inserito;
}
/// <summary>
/// Processa registrazione di un counter x una data macchina IOB
/// </summary>
@@ -3989,7 +4017,7 @@ namespace MP.Data.Services
}
answ = true;
}
}
}
#endif
// notifico update ai client in ascolto x reset cache
NotifyReloadRequest($"FlushRedisCache | {pat2Flush}");
+1 -1
View File
@@ -49,7 +49,7 @@
{
<tr class="@CheckSelect(record)">
<td>
@if (CurrList.Contains(record.IdxMacchina))
@if (currList.Contains(record.IdxMacchina))
{
<button class="btn btn-outline-primary border-0 py-0" @onclick="() => ToggleSel(record.IdxMacchina)"><i class="fa-solid fa-toggle-on"></i></button>
}
+112 -108
View File
@@ -8,6 +8,9 @@ namespace MP.SPEC.Components.Fermate
{
#region Public Properties
[Parameter]
public bool ResetSelection { get; set; }
[Parameter]
public EventCallback<bool> EC_ReqRefresh { get; set; }
@@ -19,32 +22,70 @@ namespace MP.SPEC.Components.Fermate
#endregion Public Properties
#region Protected Properties
#region Protected Methods
/// <summary>
/// Elenco selezione corrente
/// </summary>
protected List<string> CurrList { get; set; } = new List<string>();
protected override async Task OnAfterRenderAsync(bool firstRender)
{
await ReloadUserPref();
}
protected override async Task OnInitializedAsync()
{
await ReloadUserPref();
}
protected override void OnParametersSet()
{
if (ResetSelection)
{
currList = new();
}
isLoading = true;
totalCount = ListMSE.Count();
ReloadData();
}
#endregion Protected Methods
#region Private Fields
private bool AllSelected = false;
private List<string> currList = new List<string>();
private int currPage = 1;
private bool isLoading = false;
private List<MappaStatoExplModel> ListRecords = new();
private int numRecord = 10;
private int totalCount = 0;
#endregion Private Fields
#region Private Properties
[Inject]
protected ILocalStorageService localStorage { get; set; } = null!;
private ILocalStorageService localStorage { get; set; } = null!;
/// <summary>
/// Conteggio elementi selezionati
/// </summary>
protected int numSel
private int numSel
{
get => CurrList.Count();
get => currList.Count();
}
#endregion Protected Properties
#endregion Private Properties
#region Protected Methods
#region Private Methods
protected string CheckSelect(MappaStatoExplModel currRec)
private string CheckSelect(MappaStatoExplModel currRec)
{
string answ = "";
if (CurrList.Contains(currRec.IdxMacchina))
if (currList.Contains(currRec.IdxMacchina))
{
answ = "table-info";
}
@@ -54,7 +95,7 @@ namespace MP.SPEC.Components.Fermate
/// <summary>
/// CSS Class bordo da stato macchina
/// </summary>
protected string cssClassBorder(string semaforo)
private string cssClassBorder(string semaforo)
{
string answ = "";
if (!string.IsNullOrEmpty(semaforo))
@@ -89,109 +130,15 @@ namespace MP.SPEC.Components.Fermate
return answ;
}
protected override async Task OnAfterRenderAsync(bool firstRender)
{
await ReloadUserPref();
}
protected override async Task OnInitializedAsync()
{
await ReloadUserPref();
}
protected override void OnParametersSet()
{
isLoading = true;
totalCount = ListMSE.Count();
ReloadData();
}
/// <summary>
/// Richiesta update
/// </summary>
/// <returns></returns>
protected async Task RaiseRefresh()
private async Task RaiseRefresh()
{
await EC_ReqRefresh.InvokeAsync(true);
}
protected async Task SetNumRec(int newNum)
{
numRecord = newNum;
await localStorage.SetItemAsync(varName("numRec"), newNum);
currPage = 1;
ReloadData();
}
protected async Task SetPage(int newNum)
{
currPage = newNum;
ReloadData();
}
/// <summary>
/// Esegue toggle selezione fino a numMax in aggiunta e rimuovendo tutti se era true
/// </summary>
protected async Task ToggleAllSel()
{
AllSelected = !AllSelected;
if (AllSelected)
{
if (ListRecords != null)
{
foreach (var record in ListRecords)
{
if (!CurrList.Contains(record.IdxMacchina))
{
CurrList.Add(record.IdxMacchina);
}
}
}
}
else
{
CurrList.Clear();
}
await Task.Delay(1);
await EC_Selected.InvokeAsync(CurrList);
}
protected async Task ToggleSel(string newVal)
{
if (!CurrList.Contains(newVal))
{
CurrList.Add(newVal);
}
else
{
CurrList.Remove(newVal);
}
// riordino
CurrList = CurrList.OrderBy(x => x).ToList();
// invio selezione!
await EC_Selected.InvokeAsync(CurrList);
}
#endregion Protected Methods
#region Private Fields
private bool AllSelected = false;
private int currPage = 1;
private bool isLoading = false;
private List<MappaStatoExplModel> ListRecords = new();
private int numRecord = 10;
private int totalCount = 0;
#endregion Private Fields
#region Private Methods
private void ReloadData()
{
if (ListMSE != null)
@@ -215,6 +162,63 @@ namespace MP.SPEC.Components.Fermate
numRecord = await localStorage.GetItemAsync<int>(varName("numRec"), 10);
}
private async Task SetNumRec(int newNum)
{
numRecord = newNum;
await localStorage.SetItemAsync(varName("numRec"), newNum);
currPage = 1;
ReloadData();
}
private async Task SetPage(int newNum)
{
currPage = newNum;
ReloadData();
}
/// <summary>
/// Esegue toggle selezione fino a numMax in aggiunta e rimuovendo tutti se era true
/// </summary>
private async Task ToggleAllSel()
{
AllSelected = !AllSelected;
if (AllSelected)
{
if (ListRecords != null)
{
foreach (var record in ListRecords)
{
if (!currList.Contains(record.IdxMacchina))
{
currList.Add(record.IdxMacchina);
}
}
}
}
else
{
currList.Clear();
}
await Task.Delay(1);
await EC_Selected.InvokeAsync(currList);
}
private async Task ToggleSel(string newVal)
{
if (!currList.Contains(newVal))
{
currList.Add(newVal);
}
else
{
currList.Remove(newVal);
}
// riordino
currList = currList.OrderBy(x => x).ToList();
// invio selezione!
await EC_Selected.InvokeAsync(currList);
}
private string varName(string key)
{
return $"ListMacc_{key}";
+1 -1
View File
@@ -5,7 +5,7 @@
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<RootNamespace>MP.SPEC</RootNamespace>
<Version>6.16.2602.2612</Version>
<Version>6.16.2603.2015</Version>
<UserSecretsId>1800a78a-6ff1-40f9-b490-87fb8bfc1394</UserSecretsId>
<SatelliteResourceLanguages>en</SatelliteResourceLanguages>
</PropertyGroup>
+17
View File
@@ -0,0 +1,17 @@
@page "/ProdPlanner"
<div class="card shadow">
<div class="card-header">
<div class="d-flex justify-content-between">
<div class="px-0">
<h3>Production Planner</h3>
</div>
<div class="px-0">
<PeriodoSel E_PeriodoSel="SetPeriodo" CurrPeriodo="PeriodoSel"></PeriodoSel>
</div>
</div>
</div>
<div class="card-body">
<CalendarPlanner EvDtoList="ListEventi"></CalendarPlanner>
</div>
</div>
+63
View File
@@ -0,0 +1,63 @@
using Microsoft.AspNetCore.Components;
using MP.Core.DTO;
using MP.Data.Services;
namespace MP.SPEC.Pages
{
public partial class ProdPlanner
{
#region Protected Properties
[Inject]
protected SchedulerDataService SDService { get; set; } = null!;
#endregion Protected Properties
#region Private Fields
/// <summary>
/// Periodo selezionato attuale
/// </summary>
private EgwCoreLib.Utils.DtUtils.Periodo PeriodoSel = new EgwCoreLib.Utils.DtUtils.Periodo(EgwCoreLib.Utils.DtUtils.PeriodSet.ThisYear);
#endregion Private Fields
#region Private Properties
private List<EventDto> ListEventi { get; set; } = new();
#endregion Private Properties
#region Private Methods
/// <summary>
/// Legge i dati dei record completi
/// </summary>
private async Task ReloadData()
{
var rawData = await SDService.PlannerGetEvents(PeriodoSel.Inizio, PeriodoSel.Fine);
if (rawData != null && rawData.Count > 0)
{
ListEventi.Clear();
// x ora copio i vari blocchi...
foreach (var item in rawData)
{
ListEventi.AddRange(item.Value);
}
}
}
/// <summary>
/// Imposta periodo da filtro
/// </summary>
/// <param name="newPeriod"></param>
/// <returns></returns>
private async Task SetPeriodo(EgwCoreLib.Utils.DtUtils.Periodo newPeriod)
{
PeriodoSel = newPeriod;
await ReloadData();
}
#endregion Private Methods
}
}
+3 -1
View File
@@ -24,11 +24,13 @@
{
<div class="row">
<div class="col-5">
<ListMacc ListMSE="CurrMSE" EC_Selected="CheckSelection" EC_ReqRefresh="DoReload"></ListMacc>
<ListMacc ListMSE="CurrMSE" ResetSelection="forceResetSel" EC_Selected="CheckSelection" EC_ReqRefresh="DoReload"></ListMacc>
</div>
<div class="col-7">
@if (showFermate)
{
<button class="btn btn-lg btn-primary" title="Ripristina stato precedente (se è stato registrata una dichiarazione manuale)" @onclick="DoRestorePrevious"><i class="fa-solid fa-clock-rotate-left"></i> Ripristina Stato Precedente</button>
<hr />
<ListFerm ListaFermate="SearchFermate" EC_EventSelected="EventRecord"></ListFerm>
}
else
+86 -46
View File
@@ -4,17 +4,24 @@ using MP.Core.DTO;
using MP.Data;
using MP.Data.DbModels;
using MP.Data.Services;
using MP.SPEC.Components.Reparti;
using MP.SPEC.Data;
using Newtonsoft.Json;
using NLog.LayoutRenderers;
using static MP.Core.Objects.Enums;
using static MP.Data.Services.ExecStatsCollector;
namespace MP.SPEC.Pages
{
public partial class RepStop: IDisposable
public partial class RepStop : IDisposable
{
#region Public Methods
public void Dispose()
{
TDFeeder.pauseTimers();
TDFeeder.dataPipe.EA_NewMessage -= DataPipe_EA_NewMessage;
}
#endregion Public Methods
#region Protected Properties
[Inject]
@@ -23,12 +30,18 @@ namespace MP.SPEC.Pages
[Inject]
protected MpDataService MDService { get; set; } = null!;
[Inject]
protected MsgServiceSpec MService { get; set; } = null!;
[Inject]
protected SharedMemService SMServ { get; set; } = null!;
[Inject]
protected TabDataService TabDServ { get; set; } = null!;
[Inject]
protected TabDataFeeder TDFeeder { get; set; } = null!;
#endregion Protected Properties
#region Protected Methods
@@ -40,43 +53,6 @@ namespace MP.SPEC.Pages
TDFeeder.resumeTimers();
}
[Inject]
protected TabDataFeeder TDFeeder { get; set; } = null!;
public void Dispose()
{
TDFeeder.pauseTimers();
TDFeeder.dataPipe.EA_NewMessage -= DataPipe_EA_NewMessage;
}
/// <summary>
/// Ricevuto nuovi dati da mostrare!
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void DataPipe_EA_NewMessage(object? sender, EventArgs e)
{
PubSubEventArgs currArgs = (PubSubEventArgs)e;
// conversione on-the-fly List<string> --> allarmi
if (!string.IsNullOrEmpty(currArgs.newMessage))
{
try
{
List<MappaStatoExplModel>? dataList = JsonConvert.DeserializeObject<List<MappaStatoExplModel>>(currArgs.newMessage);
if (dataList != null)
{
InvokeAsync(() => SaveData(dataList));
}
}
catch
{ }
}
InvokeAsync(() =>
{
StateHasChanged();
});
}
protected async Task SaveData(List<MappaStatoExplModel> newList)
{
// salvo valori ricevuti
@@ -108,6 +84,34 @@ namespace MP.SPEC.Pages
showFermate = listSelezione.Count > 0;
}
/// <summary>
/// Ricevuto nuovi dati da mostrare!
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void DataPipe_EA_NewMessage(object? sender, EventArgs e)
{
PubSubEventArgs currArgs = (PubSubEventArgs)e;
// conversione on-the-fly List<string> --> allarmi
if (!string.IsNullOrEmpty(currArgs.newMessage))
{
try
{
List<MappaStatoExplModel>? dataList = JsonConvert.DeserializeObject<List<MappaStatoExplModel>>(currArgs.newMessage);
if (dataList != null)
{
InvokeAsync(() => SaveData(dataList));
}
}
catch
{ }
}
InvokeAsync(() =>
{
StateHasChanged();
});
}
private async Task DoReload(bool forceReload)
{
isLoading = true;
@@ -116,9 +120,40 @@ namespace MP.SPEC.Pages
isLoading = false;
}
/// <summary>
/// Gestione ritorno a stato precedente, tramite stored
/// </summary>
/// <returns></returns>
private async Task DoRestorePrevious()
{
if (!await JSRuntime.InvokeAsync<bool>("confirm", $"Hai {CurrMachSel.Count} impianti selezionati.{Environment.NewLine}Confermi di voler registrare il ritorno all'ultimo stato precedente le dichiarazioni manuali?{Environment.NewLine}La procedura verificherà l'applicabilità per ogni impianto selezionato."))
return;
[Inject]
protected MsgServiceSpec MService { get; set; } = null!;
isLoading = true;
await InvokeAsync(StateHasChanged);
// se conferma ciclo x ogni macchina e registro
foreach (var idxMacc in CurrMachSel)
{
DateTime adesso = DateTime.Now.Floor(TimeSpan.FromSeconds(1));
var rigaStato = MDService.StatoMacchina(idxMacc);
string valData = $"SPEC | {MService.DomainName}\\{MService.UserName}";
// chiamo stored
await TabDServ.RipristinaStatoPrec(idxMacc, adesso, valData, rigaStato.IdxStato, 0);
// resetta il microstato in modo da ricevere successive info HW
await TabDServ.resetMicrostatoMacchina(idxMacc);
}
forceResetSel = true;
var ListMSE = await MDService.MseGetAll(true);
CurrMachSel = new();
await Task.Delay(250);
await ReloadData();
forceResetSel = false;
CheckSelection(new());
isLoading = false;
}
/// <summary>
/// Gestione selezione evento da registrare x le macchine selezionate
@@ -142,7 +177,7 @@ namespace MP.SPEC.Pages
{
var rigaStato = MDService.StatoMacchina(idxMacc);
// mpreparo info utente x Value...
// preparo info utente x Value...
string valData = $"SPEC | {MService.DomainName}\\{MService.UserName}";
// processo evento...
DateTime adesso = DateTime.Now.Floor(TimeSpan.FromSeconds(1));
@@ -153,7 +188,7 @@ namespace MP.SPEC.Pages
IdxTipo = selEv.IdxEv,
CodArticolo = rigaStato.CodArticolo,
Value = valData,
MatrOpr = 0,
MatrOpr = 0,
pallet = rigaStato.pallet
};
// FORZO con metodo TAB
@@ -161,14 +196,19 @@ namespace MP.SPEC.Pages
// resetta il microstato in modo da ricevere successive info HW
await TabDServ.resetMicrostatoMacchina(idxMacc);
}
forceResetSel = true;
var ListMSE = await MDService.MseGetAll(true);
CurrMachSel = new();
await Task.Delay(250);
await ReloadData();
forceResetSel = false;
CheckSelection(new());
isLoading = false;
}
}
private bool forceResetSel = false;
private async Task ReloadData()
{
CurrMSE = await MDService.MseGetAll(false);
+1 -1
View File
@@ -1,6 +1,6 @@
<body>
<i>Modulo MAPOSPEC </i>
<h4>Versione: 6.16.2602.2612</h4>
<h4>Versione: 6.16.2603.2015</h4>
<br /> Note di rilascio:
<ul>
<li>
+1 -1
View File
@@ -1 +1 @@
6.16.2602.2612
6.16.2603.2015
+1 -1
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<item>
<version>6.16.2602.2612</version>
<version>6.16.2603.2015</version>
<url>https://nexus.steamware.net/repository/SWS/MP-SPEC/stable/LAST/MP.SPEC.zip</url>
<changelog>https://nexus.steamware.net/repository/SWS/MP-SPEC/stable/LAST/ChangeLog.html</changelog>
<mandatory>false</mandatory>
+1
View File
@@ -59,6 +59,7 @@
"MP.Inve": "Server=SQL2016DEV;Database=MoonPro_MAG; User ID=sa;Password=keyhammer16; integrated security=False; MultipleActiveResultSets=True; App=MP.SPEC;",
"MP.Land": "Server=SQL2016DEV;Database=MoonPro; User ID=sa;Password=keyhammer16; integrated security=False; MultipleActiveResultSets=True; App=MP.SPEC;",
"MP.Land.Auth": "Server=SQL2016DEV;Database=MoonPro_Anagrafica; User ID=sa;Password=keyhammer16; integrated security=False; MultipleActiveResultSets=True; App=MP.SPEC;",
"MP.Sched": "Server=SQL2016DEV;Database=MoonPro_ES3; User ID=sa;Password=keyhammer16; integrated security=False; MultipleActiveResultSets=True; App=MP.SPEC;",
"Redis": "redis.ufficio:26379,serviceName=devel,DefaultDatabase=5,connectTimeout=5000,syncTimeout=5000,asyncTimeout=5000,abortConnect=false,ssl=false,allowAdmin=true",
"RedisAdmin": "redis.ufficio:26379,serviceName=devel,DefaultDatabase=5,connectTimeout=5000,syncTimeout=5000,asyncTimeout=5000,abortConnect=false,ssl=false,allowAdmin=true",
"mdbConnString": "mongodb://W2019-MONGODB:27017"