- update x mostrare interventi in scadenza

- aggiunta stored x recuperare interventi da parent schedulato
This commit is contained in:
Samuele E. Locatelli
2022-06-11 16:20:32 +02:00
parent fcbd718a17
commit f6f7b18186
24 changed files with 145 additions and 100 deletions
+1 -1
View File
@@ -5,7 +5,7 @@
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<Version>1.12206.1112</Version>
<Version>1.12206.1116</Version>
</PropertyGroup>
<ItemGroup>
+1 -1
View File
@@ -1,6 +1,6 @@
<body>
<i>MAPO-MONO</i>
<h4>Version: 1.12206.1112</h4>
<h4>Version: 1.12206.1116</h4>
<br /> Release Note:
<ul>
<li>
+1 -1
View File
@@ -1 +1 @@
1.12206.1112
1.12206.1116
+1 -1
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<item>
<version>1.12206.1112</version>
<version>1.12206.1116</version>
<url>http://nexus.steamware.net/repository/SWS/MP.MONO.ADAPTER/stable/LAST/MP.Mon.zip</url>
<changelog>http://nexus.steamware.net/repository/SWS/MP.MONO.ADAPTER/stable/LAST/ChangeLog.html</changelog>
<mandatory>false</mandatory>
+1 -1
View File
@@ -6,7 +6,7 @@
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<Platforms>AnyCPU;x86;x64</Platforms>
<Version>1.12206.1112</Version>
<Version>1.12206.1116</Version>
</PropertyGroup>
<ItemGroup>
+1 -1
View File
@@ -1,6 +1,6 @@
<body>
<i>MAPO-MONO</i>
<h4>Version: 1.12206.1112</h4>
<h4>Version: 1.12206.1116</h4>
<br /> Release Note:
<ul>
<li>
+1 -1
View File
@@ -1 +1 @@
1.12206.1112
1.12206.1116
+1 -1
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<item>
<version>1.12206.1112</version>
<version>1.12206.1116</version>
<url>http://nexus.steamware.net/repository/SWS/MP.MONO.ANALYZER/stable/LAST/MP.Mon.zip</url>
<changelog>http://nexus.steamware.net/repository/SWS/MP.MONO.ANALYZER/stable/LAST/ChangeLog.html</changelog>
<mandatory>false</mandatory>
+1 -1
View File
@@ -6,7 +6,7 @@
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<Platforms>AnyCPU;x86;x64</Platforms>
<Version>1.12206.1112</Version>
<Version>1.12206.1116</Version>
</PropertyGroup>
<ItemGroup>
+1 -1
View File
@@ -1,6 +1,6 @@
<body>
<i>MAPO-MONO</i>
<h4>Version: 1.12206.1112</h4>
<h4>Version: 1.12206.1116</h4>
<br /> Release Note:
<ul>
<li>
+1 -1
View File
@@ -1 +1 @@
1.12206.1112
1.12206.1116
+1 -1
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<item>
<version>1.12206.1112</version>
<version>1.12206.1116</version>
<url>http://nexus.steamware.net/repository/SWS/MP.MONO.DECODER/stable/LAST/MP.Mon.zip</url>
<changelog>http://nexus.steamware.net/repository/SWS/MP.MONO.DECODER/stable/LAST/ChangeLog.html</changelog>
<mandatory>false</mandatory>
+48 -13
View File
@@ -7,6 +7,12 @@ namespace MP.MONO.Data.Controllers
{
public class MpDbController : IDisposable
{
#region Private Fields
private static NLog.Logger Log = LogManager.GetCurrentClassLogger();
#endregion Private Fields
#region Public Constructors
public MpDbController()
@@ -438,15 +444,14 @@ namespace MP.MONO.Data.Controllers
}
/// <summary>
/// Recupero elenco Task Schedulati (ultimi dato "skip")
/// Recupero elenco Task Schedulati dati Macchina ed intervento "master"
/// </summary>
/// <param name="MachineId">Macchina selezionata</param>
/// <param name="maxRemain">Finestra di ore per cui msotrare interventi che scadono solo in questa</param>
/// <param name="skipRec"></param>
/// <param name="numRec"></param>
/// <param name="showCompleted"></param>
/// <param name="PMTaskId">ID del PMTask parent</param>
/// <param name="skipRec">Num record da saltare</param>
/// <param name="numRec">num rec da recuperare</param>
/// <returns></returns>
public List<ScheduledMaintModel> SchedMaintTaskGetFilt(int MachineId, int skipRec, int numRec, bool showCompleted)
public List<ScheduledMaintModel> SchedMaintTaskGetByPMTask(int MachineId, int PMTaskId, int skipRec, int numRec)
{
List<ScheduledMaintModel> dbResult = new List<ScheduledMaintModel>();
using (MapoMonoContext localDbCtx = new MapoMonoContext())
@@ -456,7 +461,43 @@ namespace MP.MONO.Data.Controllers
dbResult = localDbCtx
.DbSetSMTask
.Include(i => i.CounterNav)
.Where(x => x.PMTaskeNav.MachineId == MachineId && (x.DtExecution == DateTime.MinValue || showCompleted))
.Where(x => x.PMTaskeNav.MachineId == MachineId && x.PMTaskId == PMTaskId)
.Include(m => m.PMTaskeNav.MachGroupNav)
.Include(m => m.CounterNav)
.Include(m => m.PMTaskeNav.MachineNav)
.Include(m => m.PMTaskeNav.TopicNav)
.Include(m => m.PMTaskeNav.UserTeamNav)
.OrderBy(x => x.PMTaskeNav.ExtIdx)
.Skip(skipRec)
.Take(numRec)
.ToList();
}
catch (Exception exc)
{
Log.Error($"Eccezione durante SchedMaintTaskGetByPMTask{Environment.NewLine}{exc}");
}
}
return dbResult;
}
/// <summary>
/// Recupero elenco Task Schedulati (ultimi dato "skip")
/// </summary>
/// <param name="MachineId">Macchina selezionata</param>
/// <param name="skipRec">Num record da saltare</param>
/// <param name="numRec">num rec da recuperare</param>
/// <returns></returns>
public List<ScheduledMaintModel> SchedMaintTaskGetFilt(int MachineId, int skipRec, int numRec)
{
List<ScheduledMaintModel> dbResult = new List<ScheduledMaintModel>();
using (MapoMonoContext localDbCtx = new MapoMonoContext())
{
try
{
dbResult = localDbCtx
.DbSetSMTask
.Include(i => i.CounterNav)
.Where(x => x.PMTaskeNav.MachineId == MachineId && x.DtExecution == DateTime.MinValue)
.Include(m => m.PMTaskeNav.MachGroupNav)
.Include(m => m.CounterNav)
.Include(m => m.PMTaskeNav.MachineNav)
@@ -512,11 +553,5 @@ namespace MP.MONO.Data.Controllers
}
#endregion Public Methods
#region Private Fields
private static NLog.Logger Log = LogManager.GetCurrentClassLogger();
#endregion Private Fields
}
}
+1 -1
View File
@@ -6,7 +6,7 @@
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<Platforms>AnyCPU;x86;x64</Platforms>
<Version>1.12206.1112</Version>
<Version>1.12206.1116</Version>
</PropertyGroup>
<ItemGroup>
+1 -1
View File
@@ -1,6 +1,6 @@
<body>
<i>MAPO-MONO</i>
<h4>Version: 1.12206.1112</h4>
<h4>Version: 1.12206.1116</h4>
<br /> Release Note:
<ul>
<li>
+1 -1
View File
@@ -1 +1 @@
1.12206.1112
1.12206.1116
+1 -1
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<item>
<version>1.12206.1112</version>
<version>1.12206.1116</version>
<url>http://nexus.steamware.net/repository/SWS/MP.MONO.SIM/stable/LAST/MP.Mon.zip</url>
<changelog>http://nexus.steamware.net/repository/SWS/MP.MONO.SIM/stable/LAST/ChangeLog.html</changelog>
<mandatory>false</mandatory>
+2 -4
View File
@@ -13,10 +13,10 @@
<h5>Scheduled Maintenance's Task</h5>
</div>
<div class="p-2">
<div class="form-check form-check-sm form-switch" title="Show Closed">
@*<div class="form-check form-check-sm form-switch" title="Show Closed">
<input class="form-check-input" type="checkbox" id="filClosed" name="filtShowCompleted" value="@showCompleted" unchecked @onclick="() => ToggleCompleted()">
<label class="form-check-label" for="filClosed">Show Completed</label>
</div>
</div>*@
</div>
<div class="px-2">
<div class="input-group">
@@ -30,8 +30,6 @@
<button class="btn btn-primary" @onclick="() => RegenTask()">Reschedule <i class="bi bi-tools"></i></button>
</div>
</div>
@*<div class="px-2">
</div>*@
</div>
</div>
<div class="card-body">
+25 -42
View File
@@ -4,19 +4,9 @@ namespace MP.MONO.UI.Components
{
public partial class SchedMaintTask
{
#region Protected Methods
protected override async Task OnInitializedAsync()
{
await ReloadData();
}
#endregion Protected Methods
#region Private Fields
private int _MaxRecord = 2000;
private bool _showCompleted = false;
private int _MaxRecord = 1000;
/// <summary>
/// Valore limite (in ore) per permettere di chiudere un intervento
@@ -45,6 +35,9 @@ namespace MP.MONO.UI.Components
#region Private Properties
private int _currPage { get; set; } = 1;
private int _limitDayPeriod { get; set; } = 7;
private int _numRecord { get; set; } = 10;
private int currPage
@@ -62,11 +55,12 @@ namespace MP.MONO.UI.Components
}
private int currSMTaskId { get; set; } = 0;
private DateTime execDate { get; set; } = DateTime.Today.AddHours(DateTime.Now.Hour);
private string execName { get; set; } = "";
private bool isLoading { get; set; } = false;
private int _limitDayPeriod { get; set; } = 7;
private DateTime execDate { get; set; } = DateTime.Today.AddHours(DateTime.Now.Hour);
private string execName { get; set; } = "";
private bool isLoading { get; set; } = false;
private int LimitDayPeriod
{
@@ -76,17 +70,13 @@ namespace MP.MONO.UI.Components
if (_limitDayPeriod != value)
{
_limitDayPeriod = value;
currPage = 1;
var pUpd = Task.Run(async () => await ReloadData());
pUpd.Wait();
}
}
}
private int maxRemainHour
{
get => LimitDayPeriod * 24;
}
private int MaxRecord
{
get
@@ -104,6 +94,11 @@ namespace MP.MONO.UI.Components
}
}
private int maxRemainHour
{
get => LimitDayPeriod * 24;
}
private string modalShow
{
get => showTaskConf ? "show" : "hide";
@@ -123,20 +118,6 @@ namespace MP.MONO.UI.Components
}
}
private bool showCompleted
{
get
{
return _showCompleted;
}
set
{
_showCompleted = value;
var pUpd = Task.Run(async () => await ReloadData());
pUpd.Wait();
}
}
private bool showTaskConf { get; set; } = false;
private int totalCount
@@ -154,6 +135,15 @@ namespace MP.MONO.UI.Components
#endregion Private Properties
#region Protected Methods
protected override async Task OnInitializedAsync()
{
await ReloadData();
}
#endregion Protected Methods
#region Private Methods
private async Task ConfirmDone()
@@ -190,7 +180,7 @@ namespace MP.MONO.UI.Components
isLoading = true;
ListRecords = null;
await Task.Delay(1);
SearchRecords = await MMDataService.SchedMaintTaskGetFilt(MachineId, maxRemainHour, 0, MaxRecord, showCompleted);
SearchRecords = await MMDataService.SchedMaintTaskGetFilt(MachineId, maxRemainHour, 0, MaxRecord);
ListRecords = SearchRecords.Skip(numRecord * (currPage - 1)).Take(numRecord).ToList();
await Task.Delay(1);
await Task.Delay(1);
@@ -203,13 +193,6 @@ namespace MP.MONO.UI.Components
currSMTaskId = SMTaskId;
}
private async Task ToggleCompleted()
{
await Task.Delay(1);
showCompleted = !showCompleted;
await Task.Delay(1);
}
#endregion Private Methods
}
}
+50 -21
View File
@@ -22,6 +22,27 @@ namespace MP.MONO.UI.Data
#endregion Public Fields
#region Private Fields
private static IConfiguration _configuration = null!;
private static ILogger<CurrentDataService> _logger = null!;
private static NLog.Logger Log = LogManager.GetCurrentClassLogger();
/// <summary>
/// Oggetto per connessione a REDIS
/// </summary>
private ConnectionMultiplexer redisConn = null!;
//ISubscriber sub = redis.GetSubscriber();
/// <summary>
/// Oggetto DB redis da impiegare x chiamate R/W
/// </summary>
private IDatabase redisDb = null!;
#endregion Private Fields
#region Public Constructors
public CurrentDataService(IConfiguration configuration, ILogger<CurrentDataService> logger, IConnectionMultiplexer redisConn)
@@ -334,12 +355,39 @@ namespace MP.MONO.UI.Data
return await Task.FromResult(answ);
}
public async Task<List<ScheduledMaintModel>> SchedMaintTaskGetFilt(int machineId, int maxRemain, int skipRec, int numRec, bool showCompleted)
/// <summary>
/// Recupero elenco Task Schedulati dati Macchina ed intervento "master"
/// </summary>
/// <param name="MachineId">Macchina selezionata</param>
/// <param name="PMTaskId">ID del PMTask parent</param>
/// <param name="skipRec">Num record da saltare</param>
/// <param name="numRec">num rec da recuperare</param>
/// <returns></returns>
public async Task<List<ScheduledMaintModel>> SchedMaintTaskGetByPMTask(int MachineId, int PMTaskId, int skipRec, int numRec)
{
Stopwatch stopWatch = new Stopwatch();
stopWatch.Start();
// ricerca sul DB "raw"
List<ScheduledMaintModel>? rawResult = dbController.SchedMaintTaskGetFilt(machineId, skipRec, numRec, showCompleted);
List<ScheduledMaintModel>? dbResult = dbController.SchedMaintTaskGetByPMTask(MachineId, PMTaskId, skipRec, numRec);
stopWatch.Stop();
TimeSpan ts = stopWatch.Elapsed;
Log.Trace($"Effettuata lettura da DB SchedMaintTaskGetByPMTask: {ts.TotalMilliseconds} ms");
return await Task.FromResult(dbResult);
}
/// <summary>
/// Recupero elenco Task Schedulati (ultimi dato "skip")
/// </summary>
/// <param name="MachineId">Macchina selezionata</param>
/// <param name="skipRec">Num record da saltare</param>
/// <param name="numRec">num rec da recuperare</param>
/// <returns></returns>
public async Task<List<ScheduledMaintModel>> SchedMaintTaskGetFilt(int machineId, int maxRemain, int skipRec, int numRec)
{
Stopwatch stopWatch = new Stopwatch();
stopWatch.Start();
// ricerca sul DB "raw"
List<ScheduledMaintModel>? rawResult = dbController.SchedMaintTaskGetFilt(machineId, skipRec, numRec);
// filtro ulteriormente ora...
var dbResult = rawResult.Where(x => x.CountRemainVal <= maxRemain || maxRemain == 0).ToList();
stopWatch.Stop();
@@ -376,24 +424,5 @@ namespace MP.MONO.UI.Data
}
#endregion Public Methods
#region Private Fields
private static IConfiguration _configuration = null!;
private static ILogger<CurrentDataService> _logger = null!;
private static NLog.Logger Log = LogManager.GetCurrentClassLogger();
/// <summary>
/// Oggetto per connessione a REDIS
/// </summary>
private ConnectionMultiplexer redisConn = null!;
//ISubscriber sub = redis.GetSubscriber();
/// <summary>
/// Oggetto DB redis da impiegare x chiamate R/W
/// </summary>
private IDatabase redisDb = null!;
#endregion Private Fields
}
}
+1 -1
View File
@@ -5,7 +5,7 @@
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<Platforms>AnyCPU;x86;x64</Platforms>
<Version>1.12206.1112</Version>
<Version>1.12206.1116</Version>
</PropertyGroup>
<ItemGroup>
+1 -1
View File
@@ -1,6 +1,6 @@
<body>
<i>MAPO-MONO</i>
<h4>Version: 1.12206.1112</h4>
<h4>Version: 1.12206.1116</h4>
<br /> Release Note:
<ul>
<li>
+1 -1
View File
@@ -1 +1 @@
1.12206.1112
1.12206.1116
+1 -1
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<item>
<version>1.12206.1112</version>
<version>1.12206.1116</version>
<url>http://nexus.steamware.net/repository/SWS/MP.MONO.UI/stable/LAST/MP.Mon.zip</url>
<changelog>http://nexus.steamware.net/repository/SWS/MP.MONO.UI/stable/LAST/ChangeLog.html</changelog>
<mandatory>false</mandatory>