diff --git a/MP-TAB-SERV/MP-TAB-SERV.csproj b/MP-TAB-SERV/MP-TAB-SERV.csproj
index aeee70c9..442f9ce5 100644
--- a/MP-TAB-SERV/MP-TAB-SERV.csproj
+++ b/MP-TAB-SERV/MP-TAB-SERV.csproj
@@ -3,7 +3,7 @@
net6.0
enable
- 6.16.2310.1107
+ 6.16.2310.1108
enable
MP_TAB_SERV
diff --git a/MP-TAB-SERV/Pages/ProdStop.razor.cs b/MP-TAB-SERV/Pages/ProdStop.razor.cs
index 11dd336d..89638727 100644
--- a/MP-TAB-SERV/Pages/ProdStop.razor.cs
+++ b/MP-TAB-SERV/Pages/ProdStop.razor.cs
@@ -12,6 +12,7 @@ namespace MP_TAB_SERV.Pages
#region Protected Fields
protected int dltMinRealtime = 1;
+ protected bool isProcessing = false;
protected int minAnticipoRicalcolo = 1;
protected bool rdm_ChkOnly = false;
protected int rdm_nEvCheck = 1;
@@ -71,8 +72,6 @@ namespace MP_TAB_SERV.Pages
#region Protected Methods
- protected bool isProcessing = false;
-
///
/// Processo registrazione eventi
///
diff --git a/MP-TAB-SERV/Pages/WorkShift.razor b/MP-TAB-SERV/Pages/WorkShift.razor
index 23ce07d9..99a02e20 100644
--- a/MP-TAB-SERV/Pages/WorkShift.razor
+++ b/MP-TAB-SERV/Pages/WorkShift.razor
@@ -9,6 +9,51 @@ else
-
+
+
+
+
+
+
Stato Turni Attivi
+
+
+ Turno 1
+
+
+ Turno 2
+
+
+ Turno 3
+
+
+
+
+ Turno Aperto
+
+
+ Turno Chiuso
+
+
+
+
}
diff --git a/MP-TAB-SERV/Pages/WorkShift.razor.cs b/MP-TAB-SERV/Pages/WorkShift.razor.cs
index b2091453..605b1ee6 100644
--- a/MP-TAB-SERV/Pages/WorkShift.razor.cs
+++ b/MP-TAB-SERV/Pages/WorkShift.razor.cs
@@ -36,10 +36,58 @@ namespace MP_TAB_SERV.Pages
if (!string.IsNullOrEmpty(IdxMacc))
{
CurrMSE = await MsgServ.GetMachineMse(IdxMacc);
+ // recupero turni
+ currTurni = await TabServ.TurnoMacchinaGet(IdxMacc);
}
}
}
+ protected bool T1
+ {
+ get => currTurni.T1;
+ set
+ {
+ if (currTurni.T1 != value)
+ {
+ currTurni.T1 = value;
+ TabServ.TurnoMacchinaToggle(IdxMacc, 1);
+ }
+ }
+ }
+ protected bool T2
+ {
+ get => currTurni.T2;
+ set
+ {
+ if (currTurni.T2 != value)
+ {
+ currTurni.T2 = value;
+ TabServ.TurnoMacchinaToggle(IdxMacc, 2);
+ }
+ }
+ }
+ protected bool T3
+ {
+ get => currTurni.T3;
+ set
+ {
+ if (currTurni.T3 != value)
+ {
+ currTurni.T3 = value;
+ TabServ.TurnoMacchinaToggle(IdxMacc, 3);
+ }
+ }
+ }
+
+ protected string cssByState(bool isActive)
+ {
+ return isActive ? "bg-success text-warning" : "bg-secondary";
+ }
+
+ [Inject]
+ protected TabDataService TabServ { get; set; } = null!;
+ protected TurniMaccModel currTurni { get; set; } = new TurniMaccModel();
+
#endregion Private Methods
}
}
\ No newline at end of file
diff --git a/MP-TAB-SERV/Resources/ChangeLog.html b/MP-TAB-SERV/Resources/ChangeLog.html
index 35f33570..2a9317d6 100644
--- a/MP-TAB-SERV/Resources/ChangeLog.html
+++ b/MP-TAB-SERV/Resources/ChangeLog.html
@@ -1,6 +1,6 @@
Modulo MAPOSPEC
- Versione: 6.16.2310.1107
+ Versione: 6.16.2310.1108
Note di rilascio:
-
diff --git a/MP-TAB-SERV/Resources/VersNum.txt b/MP-TAB-SERV/Resources/VersNum.txt
index 90516723..03a13574 100644
--- a/MP-TAB-SERV/Resources/VersNum.txt
+++ b/MP-TAB-SERV/Resources/VersNum.txt
@@ -1 +1 @@
-6.16.2310.1107
+6.16.2310.1108
diff --git a/MP-TAB-SERV/Resources/manifest.xml b/MP-TAB-SERV/Resources/manifest.xml
index 346dcf3b..29c54e67 100644
--- a/MP-TAB-SERV/Resources/manifest.xml
+++ b/MP-TAB-SERV/Resources/manifest.xml
@@ -1,6 +1,6 @@
-
- 6.16.2310.1107
+ 6.16.2310.1108
https://nexus.steamware.net/repository/SWS/MP-TAB-SERV/stable/LAST/MP-TAB-SERV.zip
https://nexus.steamware.net/repository/SWS/MP-TAB-SERV/stable/LAST/ChangeLog.html
false
diff --git a/MP.Data/Controllers/MpTabController.cs b/MP.Data/Controllers/MpTabController.cs
index f4383ee3..d1edce79 100644
--- a/MP.Data/Controllers/MpTabController.cs
+++ b/MP.Data/Controllers/MpTabController.cs
@@ -298,6 +298,38 @@ namespace MP.Data.Controllers
return dbResult;
}
+ ///
+ /// Inserimento record in DDB
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public bool DDB_DoRecalc(string idxMacchina, DateTime inizio, int idxStatoStart, int nStepEventi, int nRecCheck, bool checkOnly)
+ {
+ bool fatto = false;
+ using (var dbCtx = new MoonProContext(_configuration))
+ {
+ var IdxMacchina = new SqlParameter("@IdxMacchina", idxMacchina);
+ var Inizio = new SqlParameter("@inizio", inizio);
+ var IdxStatoStart = new SqlParameter("@idxStatoStart", idxStatoStart);
+ var NStepEventi = new SqlParameter("@nStepEventi", nStepEventi);
+ var NRecCheck = new SqlParameter("@nRecCheck", nRecCheck);
+ var CheckOnly = new SqlParameter("@CheckOnly", checkOnly);
+
+ var result = dbCtx
+ .Database
+ .ExecuteSqlRaw("exec man.stp_ricalcolaDatiMacchinaFromDateFork @IdxMacchina, @inizio, @idxStatoStart, @nStepEventi, @nRecCheck, @CheckOnly", IdxMacchina, Inizio, IdxStatoStart, NStepEventi, NRecCheck, CheckOnly);
+
+ // indico eseguito!
+ fatto = result != 0;
+ }
+ return fatto;
+ }
+
///
/// Recupera record successivo da DDB
///
@@ -321,6 +353,7 @@ namespace MP.Data.Controllers
}
return dbResult;
}
+
///
/// Inserimento record in DDB
///
@@ -355,38 +388,6 @@ namespace MP.Data.Controllers
return fatto;
}
- ///
- /// Inserimento record in DDB
- ///
- ///
- ///
- ///
- ///
- ///
- ///
- ///
- public bool DDB_DoRecalc(string idxMacchina, DateTime inizio, int idxStatoStart, int nStepEventi, int nRecCheck, bool checkOnly)
- {
- bool fatto = false;
- using (var dbCtx = new MoonProContext(_configuration))
- {
- var IdxMacchina = new SqlParameter("@IdxMacchina", idxMacchina);
- var Inizio = new SqlParameter("@inizio", inizio);
- var IdxStatoStart = new SqlParameter("@idxStatoStart", idxStatoStart);
- var NStepEventi = new SqlParameter("@nStepEventi", nStepEventi);
- var NRecCheck = new SqlParameter("@nRecCheck", nRecCheck);
- var CheckOnly = new SqlParameter("@CheckOnly", checkOnly);
-
- var result = dbCtx
- .Database
- .ExecuteSqlRaw("exec man.stp_ricalcolaDatiMacchinaFromDateFork @IdxMacchina, @inizio, @idxStatoStart, @nStepEventi, @nRecCheck, @CheckOnly", IdxMacchina, Inizio, IdxStatoStart, NStepEventi, NRecCheck, CheckOnly);
-
- // indico eseguito!
- fatto = result != 0;
- }
- return fatto;
- }
-
//stp_DDB_getNextByMacchinaFrom
public void Dispose()
@@ -827,6 +828,68 @@ namespace MP.Data.Controllers
return dbResult;
}
+ ///
+ /// Elenco turni macchina (all)
+ ///
+ ///
+ ///
+ public TurniMaccModel TurnoMacchinaGet(string idxMacchina)
+ {
+ TurniMaccModel dbResult = new TurniMaccModel();
+ using (var dbCtx = new MoonProContext(_configuration))
+ {
+ var IdxMacchina = new SqlParameter("@IdxMacchina", idxMacchina);
+ dbResult = dbCtx
+ .DbSetTurniMacc
+ .FromSqlRaw("exec dbo.stp_turniMacchineByIdxMacc @IdxMacchina", IdxMacchina)
+ .AsNoTracking()
+ .AsEnumerable()
+ .FirstOrDefault();
+ }
+ return dbResult;
+ }
+
+ ///
+ /// Elenco turni macchina (all)
+ ///
+ ///
+ public List TurnoMacchinaGetAll()
+ {
+ List dbResult = new List();
+ using (var dbCtx = new MoonProContext(_configuration))
+ {
+ dbResult = dbCtx
+ .DbSetTurniMacc
+ .AsNoTracking()
+ .ToList();
+ }
+ return dbResult;
+ }
+
+ ///
+ /// Toggle turno macchina (da numero)
+ ///
+ ///
+ ///
+ ///
+ public bool TurnoMacchinaToggle(string idxMacchina, int numTurno)
+ {
+ bool answ = false;
+ using (var dbCtx = new MoonProContext(_configuration))
+ {
+ var IdxMacchina = new SqlParameter("@IdxMacchina", idxMacchina);
+ var NumTurno = new SqlParameter("@numTurno", numTurno);
+
+ var result = dbCtx
+ .Database
+ .ExecuteSqlRaw("exec dbo.stp_turniMacchineUpdateTurno @IdxMacchina, @numTurno", IdxMacchina, NumTurno);
+
+ // indico eseguito!
+ answ = result > 0;
+ }
+ return answ;
+ }
+
#endregion Public Methods
#region Private Fields
diff --git a/MP.Data/DatabaseModels/TurniMaccModel.cs b/MP.Data/DatabaseModels/TurniMaccModel.cs
new file mode 100644
index 00000000..50bc1619
--- /dev/null
+++ b/MP.Data/DatabaseModels/TurniMaccModel.cs
@@ -0,0 +1,32 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations;
+using System.ComponentModel.DataAnnotations.Schema;
+
+
+#nullable disable
+//
+// This is here so CodeMaid doesn't reorganize this document
+//
+namespace MP.Data.DatabaseModels
+{
+ [Table("TurniMacchina")]
+ public partial class TurniMaccModel
+ {
+ #region Public Properties
+
+ [Key, MaxLength(50)]
+ public string IdxMacchina { get; set; } = "NA";
+ public bool T1 { get; set; } = false;
+ public bool T2 { get; set; } = false;
+ public bool T3 { get; set; } = false;
+
+ ///
+ /// Navigazione oggetto Machine
+ ///
+ [ForeignKey("IdxMacchina")]
+ public virtual Macchine MachineNav { get; set; } = null!;
+
+ #endregion Public Properties
+ }
+}
\ No newline at end of file
diff --git a/MP.Data/MoonProContext.cs b/MP.Data/MoonProContext.cs
index 7a0453ee..237e0da4 100644
--- a/MP.Data/MoonProContext.cs
+++ b/MP.Data/MoonProContext.cs
@@ -70,6 +70,7 @@ namespace MP.Data
public virtual DbSet DbSetMicroStatoMacc { get; set; }
public virtual DbSet DbSetStatoMacc { get; set; }
public virtual DbSet DbSetStatoProd { get; set; }
+ public virtual DbSet DbSetTurniMacc { get; set; }
public virtual DbSet DbSetStAct { get; set; }
public virtual DbSet DbSetStActRow { get; set; }
diff --git a/MP.Data/Services/TabDataService.cs b/MP.Data/Services/TabDataService.cs
index 3186a935..1e453257 100644
--- a/MP.Data/Services/TabDataService.cs
+++ b/MP.Data/Services/TabDataService.cs
@@ -291,16 +291,6 @@ namespace MP.Data.Services
return result;
}
- ///
- /// Recupera record successivo da DDB
- ///
- ///
- ///
- ///
- public DiarioDiBordoModel DDB_getNext(string idxMacchina, DateTime inizioStato)
- {
- return dbTabController.DDB_getNext(idxMacchina, inizioStato);
- }
///
/// Inserimento record in DDB
///
@@ -318,6 +308,17 @@ namespace MP.Data.Services
return answ;
}
+ ///
+ /// Recupera record successivo da DDB
+ ///
+ ///
+ ///
+ ///
+ public DiarioDiBordoModel DDB_getNext(string idxMacchina, DateTime inizioStato)
+ {
+ return dbTabController.DDB_getNext(idxMacchina, inizioStato);
+ }
+
public void Dispose()
{
// Clear database controller
@@ -820,6 +821,88 @@ namespace MP.Data.Services
return result;
}
+ ///
+ /// Turno macchina
+ ///
+ ///
+ public async Task TurnoMacchinaGet(string idxMacchina)
+ {
+ string source = "DB";
+ Stopwatch sw = new Stopwatch();
+ sw.Start();
+ TurniMaccModel? result = new TurniMaccModel();
+ // cerco in redis...
+ string currKey = $"{redisBaseKey}:TurniMacc:{idxMacchina}";
+ RedisValue rawData = await redisDb.StringGetAsync(currKey);
+ //if (!string.IsNullOrEmpty($"{rawData}"))
+ if (rawData.HasValue)
+ {
+ result = JsonConvert.DeserializeObject($"{rawData}");
+ source = "REDIS";
+ }
+ else
+ {
+ result = await Task.FromResult(dbTabController.TurnoMacchinaGet(idxMacchina));
+ // serializzp e salvo...
+ rawData = JsonConvert.SerializeObject(result);
+ await redisDb.StringSetAsync(currKey, rawData, LongCache);
+ }
+ if (result == null)
+ {
+ result = new TurniMaccModel();
+ }
+ sw.Stop();
+ Log.Debug($"TurnoMacchinaGet | {source} | {sw.Elapsed.TotalMilliseconds}ms");
+ return result;
+ }
+
+ ///
+ /// Elenco turni macchina (all)
+ ///
+ ///
+ public async Task
> TurnoMacchinaGetAll()
+ {
+ string source = "DB";
+ Stopwatch sw = new Stopwatch();
+ sw.Start();
+ List? result = new List();
+ // cerco in redis...
+ string currKey = $"{redisBaseKey}:TurniMacc:All";
+ RedisValue rawData = await redisDb.StringGetAsync(currKey);
+ if (rawData.HasValue)
+ {
+ result = JsonConvert.DeserializeObject>($"{rawData}");
+ source = "REDIS";
+ }
+ else
+ {
+ result = await Task.FromResult(dbTabController.TurnoMacchinaGetAll());
+ // serializzp e salvo...
+ rawData = JsonConvert.SerializeObject(result);
+ await redisDb.StringSetAsync(currKey, rawData, LongCache);
+ }
+ if (result == null)
+ {
+ result = new List();
+ }
+ sw.Stop();
+ Log.Debug($"TurnoMacchinaGetAll | {source} | {sw.Elapsed.TotalMilliseconds}ms");
+ return result;
+ }
+
+ ///
+ /// Toggle stato turno
+ ///
+ ///
+ ///
+ ///
+ public bool TurnoMacchinaToggle(string idxMacchina, int numTurno)
+ {
+ bool answ=dbTabController.TurnoMacchinaToggle(idxMacchina, numTurno);
+ FlushCache("TurniMacc").ConfigureAwait(false);
+ return answ;
+ }
+
///
/// Intera vista v_MSFD
///
@@ -834,7 +917,6 @@ namespace MP.Data.Services
// cerco in redis...
string currKey = $"{redisBaseKey}:MSFD:ALL";
RedisValue rawData = await redisDb.StringGetAsync(currKey);
- //if (!string.IsNullOrEmpty($"{rawData}"))
if (rawData.HasValue)
{
result = JsonConvert.DeserializeObject>($"{rawData}");