- abbozzato gestione completamento task

This commit is contained in:
Samuele Locatelli
2022-06-11 12:19:33 +02:00
parent 58c27bedd6
commit dcbcecc435
26 changed files with 236 additions and 66 deletions
+1 -1
View File
@@ -5,7 +5,7 @@
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<Version>1.12206.1111</Version>
<Version>1.12206.1112</Version>
</PropertyGroup>
<ItemGroup>
+1 -1
View File
@@ -1,6 +1,6 @@
<body>
<i>MAPO-MONO</i>
<h4>Version: 1.12206.1111</h4>
<h4>Version: 1.12206.1112</h4>
<br /> Release Note:
<ul>
<li>
+1 -1
View File
@@ -1 +1 @@
1.12206.1111
1.12206.1112
+1 -1
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<item>
<version>1.12206.1111</version>
<version>1.12206.1112</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.1111</Version>
<Version>1.12206.1112</Version>
</PropertyGroup>
<ItemGroup>
+1 -1
View File
@@ -1,6 +1,6 @@
<body>
<i>MAPO-MONO</i>
<h4>Version: 1.12206.1111</h4>
<h4>Version: 1.12206.1112</h4>
<br /> Release Note:
<ul>
<li>
+1 -1
View File
@@ -1 +1 @@
1.12206.1111
1.12206.1112
+1 -1
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<item>
<version>1.12206.1111</version>
<version>1.12206.1112</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.1111</Version>
<Version>1.12206.1112</Version>
</PropertyGroup>
<ItemGroup>
+1 -1
View File
@@ -1,6 +1,6 @@
<body>
<i>MAPO-MONO</i>
<h4>Version: 1.12206.1111</h4>
<h4>Version: 1.12206.1112</h4>
<br /> Release Note:
<ul>
<li>
+1 -1
View File
@@ -1 +1 @@
1.12206.1111
1.12206.1112
+1 -1
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<item>
<version>1.12206.1111</version>
<version>1.12206.1112</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>
+36 -3
View File
@@ -398,13 +398,46 @@ namespace MP.MONO.Data.Controllers
return dbResult;
}
/// <summary>
/// Registro esecuzione task schedualto
/// </summary>
/// <param name="MachineId"></param>
/// <param name="SMTaskId"></param>
/// <param name="ExecDT"></param>
/// <param name="ExecUser"></param>
/// <returns></returns>
public async Task<bool> SchedMaintTaskSetDone(int MachineId, int SMTaskId, DateTime ExecDT,string ExecUser)
{
bool answ = false;
using (MapoMonoContext localDbCtx = new MapoMonoContext())
{
try
{
var dbResult = localDbCtx
.DbSetSMTask
.Where(x => x.PMTaskeNav.MachineId == MachineId && x.SMTaskId == SMTaskId)
.FirstOrDefault();
if (dbResult != null)
{
dbResult.DtExecution = ExecDT;
dbResult.UserCode = ExecUser;
localDbCtx.SaveChanges();
answ = true;
}
}
catch (Exception exc)
{
Log.Error($"Eccezione durante SchedMaintTaskSetDone{Environment.NewLine}{exc}");
}
}
await Task.Delay(1);
return answ;
}
/// <summary>
/// genera elenco Task Schedulati missing da schema + attualmente presenti...
/// </summary>
/// <param name="MachineId"></param>
/// <param name="skipRec"></param>
/// <param name="numRec"></param>
/// <param name="showCompleted"></param>
/// <returns></returns>
public async Task<bool> SchedMaintTaskCreateMissing(int MachineId)
{
+1 -1
View File
@@ -6,7 +6,7 @@
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<Platforms>AnyCPU;x86;x64</Platforms>
<Version>1.12206.1111</Version>
<Version>1.12206.1112</Version>
</PropertyGroup>
<ItemGroup>
+1 -1
View File
@@ -1,6 +1,6 @@
<body>
<i>MAPO-MONO</i>
<h4>Version: 1.12206.1111</h4>
<h4>Version: 1.12206.1112</h4>
<br /> Release Note:
<ul>
<li>
+1 -1
View File
@@ -1 +1 @@
1.12206.1111
1.12206.1112
+1 -1
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<item>
<version>1.12206.1111</version>
<version>1.12206.1112</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>
+1 -38
View File
@@ -1,45 +1,8 @@
<div class="text-center">
<div class="text-center @textStyle">
<b>@currVal.ToString("N0")</b>
</div>
<div class="progress">
<div class="progress-bar @bgStyle" style="width:@(percWidth)%">@(percWidth)%</div>
</div>
@code {
protected string bgStyle
{
get
{
string answ = "bg-dark";
if (currVal <= redLim)
{
answ = "bg-danger";
}
else if (currVal <= yelLim)
{
answ = "bg-warning";
}
else
{
answ = "bg-success";
}
return answ;
}
}
[Parameter]
public double currVal { get; set; } = 50;
[Parameter]
public double maxVal { get; set; } = 100;
private int percWidth
{
get => (int)(100 * currVal / maxVal);
}
protected int redLim = 24 * 3;
protected int yelLim = 24 * 5;
}
+60
View File
@@ -0,0 +1,60 @@
using Microsoft.AspNetCore.Components;
namespace MP.MONO.UI.Components
{
public partial class ProgBar
{
#region Public Properties
[Parameter]
public double currVal { get; set; } = 50;
[Parameter]
public double maxVal { get; set; } = 100;
[Parameter]
public int redLim { get; set; } = 24 * 3;
[Parameter]
public int yelLim { get; set; } = 24 * 5;
#endregion Public Properties
#region Private Properties
private string bgStyle
{
get => $"bg-{currStyle}";
}
private string textStyle
{
get => $"text-{currStyle}";
}
private string currStyle
{
get
{
string answ = "dark";
if (currVal <= redLim)
{
answ = "danger";
}
else if (currVal <= yelLim)
{
answ = "warning";
}
else
{
answ = "success";
}
return answ;
}
}
private int percWidth { get => (int)(100 * currVal / maxVal); }
#endregion Private Properties
}
}
+56 -5
View File
@@ -20,9 +20,14 @@
</div>
<div class="px-2">
<div class="input-group">
<span class="input-group-text" title="Limit visualization to event expirying in the next hour period">Period</span>
<input type="text" class="form-control" placeholder="Expiry Hour Window">
<button class="btn btn-primary" @onclick="() => RegenTask()">Refresh <i class="bi bi-tools"></i></button>
<span class="input-group-text" title="Limit visualization to event expirying in the next hour period">Limit Period</span>
<select @bind="@LimitDayPeriod" class="form-select form-select text-end">
<option value="7">1 Week</option>
<option value="30">1 Month</option>
<option value="365">1 Year</option>
<option value="0">All (no limit)</option>
</select>
<button class="btn btn-primary" @onclick="() => RegenTask()">Reschedule <i class="bi bi-tools"></i></button>
</div>
</div>
@*<div class="px-2">
@@ -40,6 +45,49 @@
}
else
{
@if (showTaskConf)
{
<div class="modal" tabindex="-1" style="display:block; background-color: rgba(10,10,10,.8);" role="dialog">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header">
<h4>Maintenance Task Confirm</h4>
<button type="button" class="btn btn-warning" @onclick="() => ShowConfirm(0)" title="Close">
<i class="bi bi-x-square"></i>
</button>
</div>
<div class="modal-body">
<div class="row was-validated">
<div class="col-6">
<div class="input-group" title="Execution date">
<span class="input-group-text">Execution Date</span>
<input type="datetime-local" class="form-control" placeholder="Execution Date" @bind-value="@execDate" required>
<div class="valid-feedback">OK</div>
<div class="invalid-feedback">Execution date-time is required.</div>
</div>
</div>
<div class="col-6">
<div class="input-group" title="Executor name/code">
<span class="input-group-text">Executor Name</span>
<input type="text" class="form-control" placeholder="Username" @bind-value="@execName" required>
<div class="valid-feedback">OK</div>
<div class="invalid-feedback">Executor Username/code is required.</div>
</div>
</div>
</div>
<div class="d-flex justify-content-between">
<div class="py-2">
<button class="btn btn-success" @onclick="() => ConfirmDone()" title="Confirm Execution">Save <i class="bi bi-save"></i></button>
</div>
<div class="py-2">
<button class="btn btn-warning" @onclick="() => ShowConfirm(0)" title="Close Activity Record Panel">Cancel <i class="bi bi-x-square"></i></button>
</div>
</div>
</div>
</div>
</div>
</div>
}
<table class="table table-sm table-striped table-responsive-lg small">
<thead>
<tr>
@@ -62,12 +110,15 @@
<td>@record.DtCreation.ToString("yyyy-MM-dd HH:mm:ss")</td>
<td>@record.PMTaskeNav.TopicNav.Description</td>
<td>@record.PMTaskeNav.MachGroupNav.Description</td>
<td style="width: 8rem;"><ProgBar currVal="@record.CountRemainVal" maxVal="@record.ExpiryVal"></ProgBar></td>
<td style="width: 8rem;"><ProgBar currVal="@record.CountRemainVal" maxVal="@record.ExpiryVal" redLim="@redLim" yelLim="@yelLim"></ProgBar></td>
<td>@record.PMTaskeNav.UserTeamNav.Description</td>
<td>@record.CounterNav.Description</td>
<td>@record.PMTaskeNav.JobDescription</td>
<td>
@*..buttons...*@
@if (record.CountRemainVal <= yelLim)
{
<button class="btn btn-success" @onclick="() => ShowConfirm(record.SMTaskId)" title="Show Activity Record Panel"><i class="bi bi-check-square"></i></button>
}
</td>
</tr>
}
@@ -125,6 +125,38 @@ namespace MP.MONO.UI.Components
await ReloadData();
}
private bool showTaskConf { get; set; } = false;
private void ShowConfirm(int SMTaskId)
{
showTaskConf = !showTaskConf;
currSMTaskId = SMTaskId;
}
private DateTime execDate { get; set; } = DateTime.Today.AddHours(DateTime.Now.Hour);
private string execName { get; set; } = "";
private int currSMTaskId { get; set; } = 0;
private string modalShow
{
get => showTaskConf ? "show" : "hide";
}
private async Task ConfirmDone()
{
// se ho dataora ed esecutore...
if (!string.IsNullOrEmpty(execName) && currSMTaskId > 0)
{
// salvo!
bool fatto = await MMDataService.SchedMaintTaskSetDone(MachineId, currSMTaskId, execDate, execName);
// rigenero!
await RegenTask();
}
}
private async Task ReloadData()
{
isLoading = true;
@@ -144,6 +176,17 @@ namespace MP.MONO.UI.Components
await Task.Delay(1);
}
private int LimitDayPeriod { get; set; } = 7;
/// <summary>
/// Valore limite (in ore) per indicare come rosso una scadenza
/// </summary>
private int redLim = 24 * 2;
/// <summary>
/// Valore limite (in ore) per indicare come giallo una scadenza
/// </summary>
private int yelLim = 24 * 7;
#endregion Private Methods
}
}
+20
View File
@@ -345,6 +345,26 @@ namespace MP.MONO.UI.Data
return await Task.FromResult(dbResult);
}
/// <summary>
/// Registro esecuzione task schedualto
/// </summary>
/// <param name="MachineId"></param>
/// <param name="SMTaskId"></param>
/// <param name="ExecDT"></param>
/// <param name="ExecUser"></param>
/// <returns></returns>
public async Task<bool> SchedMaintTaskSetDone(int MachineId, int SMTaskId, DateTime ExecDT, string ExecUser)
{
Stopwatch stopWatch = new Stopwatch();
stopWatch.Start();
bool answ = await dbController.SchedMaintTaskSetDone(MachineId, SMTaskId, ExecDT, ExecUser);
stopWatch.Stop();
TimeSpan ts = stopWatch.Elapsed;
Log.Trace($"Effettuata chiamata a SchedMaintTaskSetDone: {ts.TotalMilliseconds} ms");
return await Task.FromResult(answ);
}
public async Task<bool> setAlarmSetup(List<BaseAlarmConf> alarmConf)
{
bool answ = false;
+1 -1
View File
@@ -5,7 +5,7 @@
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<Platforms>AnyCPU;x86;x64</Platforms>
<Version>1.12206.1111</Version>
<Version>1.12206.1112</Version>
</PropertyGroup>
<ItemGroup>
+1 -1
View File
@@ -1,6 +1,6 @@
<body>
<i>MAPO-MONO</i>
<h4>Version: 1.12206.1111</h4>
<h4>Version: 1.12206.1112</h4>
<br /> Release Note:
<ul>
<li>
+1 -1
View File
@@ -1 +1 @@
1.12206.1111
1.12206.1112
+1 -1
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<item>
<version>1.12206.1111</version>
<version>1.12206.1112</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>