Inizio bozza gestione schedulazione task
This commit is contained in:
@@ -4,7 +4,9 @@ using Microsoft.Extensions.Configuration;
|
||||
using NLog;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing.Drawing2D;
|
||||
using System.Linq;
|
||||
using static MP.Data.Objects.Enums;
|
||||
|
||||
namespace MP.Data.Controllers
|
||||
{
|
||||
@@ -224,17 +226,6 @@ namespace MP.Data.Controllers
|
||||
List<DatabaseModels.OdlEnergyModel> dbResult = new List<DatabaseModels.OdlEnergyModel>();
|
||||
using (var dbCtx = new MoonPro_STATSContext(_configuration))
|
||||
{
|
||||
//dbResult = dbCtx
|
||||
// .DbSetOdlEnergy
|
||||
// .Where(x =>
|
||||
// (string.IsNullOrEmpty(IdxMacchina) || x.IdxMacchina == IdxMacchina)
|
||||
// && ((x.DataInizio >= DtStart && x.DataInizio <= DtEnd) || (x.DataFine >= DtStart && x.DataFine <= DtEnd) || (x.DataFine == null && x.DataInizio <= DtStart))
|
||||
// && (IdxODL == 0 || x.IdxOdl == IdxODL)
|
||||
// && (KeyRichiesta == "*" || x.KeyRichiesta == KeyRichiesta)
|
||||
// && (CodArticolo == "*" || x.CodArticolo == CodArticolo)
|
||||
// )
|
||||
// .ToList();
|
||||
|
||||
var dataFrom = new SqlParameter("@dataFrom", DtStart);
|
||||
var dataTo = new SqlParameter("@dataTo", DtEnd);
|
||||
var idxMacchina = new SqlParameter("@idxMacchina", IdxMacchina);
|
||||
@@ -250,6 +241,48 @@ namespace MP.Data.Controllers
|
||||
return dbResult;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Ricerca task dato tipo e
|
||||
/// </summary>
|
||||
/// <param name="TType"></param>
|
||||
/// <returns></returns>
|
||||
public List<DatabaseModels.TaskListModel> TaskListGetAll(Task2ExeType TType)
|
||||
{
|
||||
List<DatabaseModels.TaskListModel> dbResult = new List<DatabaseModels.TaskListModel>();
|
||||
using (var dbCtx = new MoonPro_STATSContext(_configuration))
|
||||
{
|
||||
|
||||
dbResult = dbCtx
|
||||
.DbSetTaskList
|
||||
.Where(x => (TType == Task2ExeType.ND || x.TType == TType))
|
||||
.ToList();
|
||||
}
|
||||
return dbResult;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Ricerca task dato tipo + num max (desc)
|
||||
/// </summary>
|
||||
/// <param name="TaskId">TaskId da cui deriva</param>
|
||||
/// <returns></returns>
|
||||
public List<DatabaseModels.TaskExecModel> TaskExeGetFilt(int TaskId, int maxRec)
|
||||
{
|
||||
List<DatabaseModels.TaskExecModel> dbResult = new List<DatabaseModels.TaskExecModel>();
|
||||
using (var dbCtx = new MoonPro_STATSContext(_configuration))
|
||||
{
|
||||
|
||||
dbResult = dbCtx
|
||||
.DbSetTaskExe
|
||||
.Include(x => x.TaskListNav)
|
||||
.Where(x => (x.TaskId == TaskId))
|
||||
.OrderByDescending(x => x.DtStart)
|
||||
.Take(maxRec)
|
||||
.ToList();
|
||||
}
|
||||
return dbResult;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Elenco tabella ODL da filtro
|
||||
/// </summary>
|
||||
|
||||
@@ -0,0 +1,64 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using static MP.Data.Objects.Enums;
|
||||
|
||||
#nullable disable
|
||||
// <Auto-Generated>
|
||||
// This is here so CodeMaid doesn't reorganize this document
|
||||
// </Auto-Generated>
|
||||
namespace MP.Data.DatabaseModels
|
||||
{
|
||||
[Table("TaskExec")]
|
||||
public partial class TaskExecModel
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
[Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||
public int TaskExecId { get; set; } = 0;
|
||||
|
||||
/// <summary>
|
||||
/// task Id di riferimento
|
||||
/// </summary>
|
||||
public int TaskId { get; set; } = 0;
|
||||
|
||||
/// <summary>
|
||||
/// DataOra inizio
|
||||
/// </summary>
|
||||
public DateTime DtStart { get; set; } = DateTime.Now;
|
||||
|
||||
/// <summary>
|
||||
/// DataOra fine
|
||||
/// </summary>
|
||||
public DateTime DtEnd { get; set; } = DateTime.Now.AddDays(-1);
|
||||
|
||||
/// <summary>
|
||||
/// Durata ultima esecuzione in secondi
|
||||
/// </summary>
|
||||
[NotMapped]
|
||||
public double Duration
|
||||
{
|
||||
get => DtEnd.Subtract(DtStart).TotalSeconds;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Esito in Errore
|
||||
/// </summary>
|
||||
public bool IsError { get; set; } = false;
|
||||
|
||||
/// <summary>
|
||||
/// Ultimo risultato registrato
|
||||
/// </summary>
|
||||
public string Result { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// Navigazione oggetto TaskList
|
||||
/// </summary>
|
||||
[ForeignKey("TaskId")]
|
||||
public virtual TaskListModel TaskListNav { get; set; } = null!;
|
||||
|
||||
|
||||
#endregion Public Properties
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using static MP.Data.Objects.Enums;
|
||||
|
||||
#nullable disable
|
||||
// <Auto-Generated>
|
||||
// This is here so CodeMaid doesn't reorganize this document
|
||||
// </Auto-Generated>
|
||||
namespace MP.Data.DatabaseModels
|
||||
{
|
||||
[Table("TaskList")]
|
||||
public partial class TaskListModel
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
[Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||
public int TaskId { get; set; } = 0;
|
||||
|
||||
/// <summary>
|
||||
/// Nome Task
|
||||
/// </summary>
|
||||
public string Name { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// Descrizione Task
|
||||
/// </summary>
|
||||
public string Descript { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// Tipo Task
|
||||
/// </summary>
|
||||
public Task2ExeType TType { get; set; } = Task2ExeType.ND;
|
||||
|
||||
/// <summary>
|
||||
/// Comando da invocare
|
||||
/// </summary>
|
||||
public string Command { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// Elenco argomenti (json)
|
||||
/// </summary>
|
||||
public string Args { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// Frequenza esecuzione da enum
|
||||
/// </summary>
|
||||
public TaskFreqType Freq { get; set; } = TaskFreqType.ND;
|
||||
|
||||
/// <summary>
|
||||
/// Cadenza esecuzione
|
||||
/// </summary>
|
||||
public int Cad { get; set; } = 1;
|
||||
|
||||
/// <summary>
|
||||
/// DataOra ultima esecuzione
|
||||
/// </summary>
|
||||
public DateTime DtLastExec { get; set; } = DateTime.Today.AddYears(-10);
|
||||
/// <summary>
|
||||
/// DataOra ultima esecuzione
|
||||
/// </summary>
|
||||
public DateTime DtNextExec { get; set; } = DateTime.Today.AddYears(-9);
|
||||
|
||||
/// <summary>
|
||||
/// Durata ultima esecuzione in secondi
|
||||
/// </summary>
|
||||
public double LastDuration { get; set; } = 0;
|
||||
|
||||
/// <summary>
|
||||
/// Ultimo risultato registrato
|
||||
/// </summary>
|
||||
public string LastResult { get; set; } = "";
|
||||
|
||||
#endregion Public Properties
|
||||
}
|
||||
}
|
||||
@@ -46,6 +46,8 @@ namespace MP.Data
|
||||
public virtual DbSet<TurniOee> DbSetTurniOee { get; set; }
|
||||
public virtual DbSet<UserActionLog> DbSetUserLog { get; set; }
|
||||
public virtual DbSet<OdlEnergyModel> DbSetOdlEnergy { get; set; }
|
||||
public virtual DbSet<TaskListModel> DbSetTaskList { get; set; }
|
||||
public virtual DbSet<TaskExecModel> DbSetTaskExe { get; set; }
|
||||
|
||||
#endregion Public Properties
|
||||
|
||||
|
||||
@@ -250,6 +250,74 @@ namespace MP.Data.Objects
|
||||
SS
|
||||
}
|
||||
|
||||
//[JsonConverter(typeof(StringEnumConverter))]
|
||||
public enum Task2ExeType
|
||||
{
|
||||
/// <summary>
|
||||
/// Tipo indefinito / ALL
|
||||
/// </summary>
|
||||
ND,
|
||||
|
||||
/// <summary>
|
||||
/// Chiamata exe esterno
|
||||
/// </summary>
|
||||
Exe,
|
||||
|
||||
/// <summary>
|
||||
/// Chiamata a SQL Command
|
||||
/// </summary>
|
||||
SqlCommand,
|
||||
|
||||
/// <summary>
|
||||
/// Chiamata a SQL Stored Procedure
|
||||
/// </summary>
|
||||
SqlStored
|
||||
}
|
||||
|
||||
//[JsonConverter(typeof(StringEnumConverter))]
|
||||
public enum TaskFreqType
|
||||
{
|
||||
/// <summary>
|
||||
/// Tipo indefinito / ALL
|
||||
/// </summary>
|
||||
ND,
|
||||
|
||||
/// <summary>
|
||||
/// Secondi
|
||||
/// </summary>
|
||||
Sec,
|
||||
|
||||
/// <summary>
|
||||
/// Minuti
|
||||
/// </summary>
|
||||
Min,
|
||||
|
||||
/// <summary>
|
||||
/// Ore
|
||||
/// </summary>
|
||||
Hour,
|
||||
|
||||
/// <summary>
|
||||
/// Giorni
|
||||
/// </summary>
|
||||
Day,
|
||||
|
||||
/// <summary>
|
||||
/// Settimane
|
||||
/// </summary>
|
||||
Week,
|
||||
|
||||
/// <summary>
|
||||
/// Mesi
|
||||
/// </summary>
|
||||
Month,
|
||||
|
||||
/// <summary>
|
||||
/// Anni
|
||||
/// </summary>
|
||||
Year
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Elenco task ammessi (x IOB-WIN da eseguire...)
|
||||
/// </summary>
|
||||
|
||||
+1
-1
@@ -11,7 +11,7 @@ using StackExchange.Redis;
|
||||
var builder = WebApplication.CreateBuilder(args);
|
||||
|
||||
/*--------------------
|
||||
* Note migrazione startup.cs -_> program.cs:
|
||||
* 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
|
||||
|
||||
@@ -0,0 +1,59 @@
|
||||
@if (CurrRecord != null)
|
||||
{
|
||||
<div class="d-flex justify-content-between">
|
||||
<div class="px-2">
|
||||
<h2>Edit Rec</h2>
|
||||
</div>
|
||||
<div class="px-2">
|
||||
<button class="btn btn-sm btn-success" @onclick="()=>doSave()" title="Save"><i class="far fa-save"></i></button>
|
||||
<button class="btn btn-sm btn-secondary" @onclick="()=>doCancel()" title="Cancel"><i class="fas fa-undo"></i></button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="row g-1">
|
||||
<div class="col-md-3">
|
||||
<div class="form-floating">
|
||||
<input type="text" class="form-control" @bind="@CurrRecord.Name">
|
||||
<label class="small">Nome Task</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="form-floating">
|
||||
<input type="text" class="form-control" @bind="@CurrRecord.Descript">
|
||||
<label class="small">Descrizione Task</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-2">
|
||||
<div class="form-floating">
|
||||
<input type="text" class="form-control" @bind="@CurrRecord.Freq">
|
||||
<label class="small">Frequenza</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-1">
|
||||
<div class="form-floating">
|
||||
<input type="number" class="form-control" @bind="@CurrRecord.Cad">
|
||||
<label class="small">Cadenza</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row g-1">
|
||||
<div class="col-md-4">
|
||||
<div class="form-floating">
|
||||
<input type="text" class="form-control" @bind="@CurrRecord.Command">
|
||||
<label class="small">Comando</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<div class="form-floating">
|
||||
<input type="text" class="form-control" @bind="@CurrRecord.Args">
|
||||
<label class="small">Parametri</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-4 pt-2">
|
||||
<button class="btn btn-success w-100" @onclick="() => doSave()"><i class="fa-solid fa-floppy-disk"></i> Save</button>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
using DnsClient.Protocol;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using MP.Data.DatabaseModels;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace MP.Stats.Components
|
||||
{
|
||||
public partial class TaskEdit
|
||||
{
|
||||
|
||||
[Parameter]
|
||||
public TaskListModel? CurrRecord { get; set; } = null;
|
||||
|
||||
[Parameter]
|
||||
public EventCallback<bool> EC_update { get; set; }
|
||||
|
||||
protected async Task doCancel()
|
||||
{
|
||||
await EC_update.InvokeAsync(false);
|
||||
}
|
||||
protected async Task doSave()
|
||||
{
|
||||
bool fatto = false;
|
||||
#if false
|
||||
await Task.Delay(1);
|
||||
if (CurrRecord != null)
|
||||
{
|
||||
fatto = await MTService.CustomerUpdate(CurrRecord);
|
||||
}
|
||||
#endif
|
||||
await EC_update.InvokeAsync(fatto);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -9,6 +9,7 @@ using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using static MP.Data.Objects.Enums;
|
||||
|
||||
namespace MP.Stats.Data
|
||||
{
|
||||
@@ -168,7 +169,7 @@ namespace MP.Stats.Data
|
||||
{
|
||||
List<AutocompleteModel> answ = new List<AutocompleteModel>();
|
||||
answ.Add(new AutocompleteModel { LabelField = "--- TUTTE ---", ValueField = "*" });
|
||||
answ.AddRange(dbController.ActionsGetAll().Select(x => new AutocompleteModel { LabelField = $"{x.Descrizione}", ValueField = x.Azione}).ToList());
|
||||
answ.AddRange(dbController.ActionsGetAll().Select(x => new AutocompleteModel { LabelField = $"{x.Descrizione}", ValueField = x.Azione }).ToList());
|
||||
return Task.FromResult(answ);
|
||||
}
|
||||
|
||||
@@ -200,9 +201,11 @@ namespace MP.Stats.Data
|
||||
answ.Add(new AutocompleteModel { LabelField = "--- TUTTE ---", ValueField = "*" });
|
||||
answ.AddRange(dbController
|
||||
.MacchineGetAll()
|
||||
.Select(x => new AutocompleteModel {
|
||||
LabelField = $"{x.IdxMacchina} | {x.Nome} {x.Descrizione} ",
|
||||
ValueField = x.IdxMacchina })
|
||||
.Select(x => new AutocompleteModel
|
||||
{
|
||||
LabelField = $"{x.IdxMacchina} | {x.Nome} {x.Descrizione} ",
|
||||
ValueField = x.IdxMacchina
|
||||
})
|
||||
.ToList());
|
||||
return Task.FromResult(answ);
|
||||
}
|
||||
@@ -310,10 +313,14 @@ namespace MP.Stats.Data
|
||||
}
|
||||
return await Task.FromResult(numRec);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Statistiche ODL
|
||||
/// </summary>
|
||||
/// <param name="CurrFilter"></param>
|
||||
/// <param name="searchVal"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<List<MP.Data.DatabaseModels.OdlEnergyModel>> StatOdlEnergyGetAll(SelectData CurrFilter, string searchVal = "")
|
||||
{
|
||||
//return Task.FromResult(dbController.StatOdlGetAll(numRecord, searchVal));
|
||||
List<MP.Data.DatabaseModels.OdlEnergyModel> dbResult = new List<MP.Data.DatabaseModels.OdlEnergyModel>();
|
||||
string cacheKey = getCacheKey("MP:STATS:ODL_ENERGY", CurrFilter);
|
||||
string rawData;
|
||||
@@ -333,15 +340,19 @@ namespace MP.Stats.Data
|
||||
await distributedCache.SetAsync(cacheKey, redisDataList, cacheOpt);
|
||||
stopWatch.Stop();
|
||||
TimeSpan ts = stopWatch.Elapsed;
|
||||
_logger.LogTrace($"Effettuata lettura da DB + caching per ODL: {ts.TotalMilliseconds} ms");
|
||||
_logger.LogTrace($"Effettuata lettura da DB + caching per ODL_Energy: {ts.TotalMilliseconds} ms");
|
||||
}
|
||||
return await Task.FromResult(dbResult);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Statistiche Energia x ODL
|
||||
/// </summary>
|
||||
/// <param name="CurrFilter"></param>
|
||||
/// <param name="searchVal"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<List<MP.Data.DatabaseModels.StatsODL>> StatOdlGetAll(SelectData CurrFilter, string searchVal = "")
|
||||
{
|
||||
//return Task.FromResult(dbController.StatOdlGetAll(numRecord, searchVal));
|
||||
List<MP.Data.DatabaseModels.StatsODL> dbResult = new List<MP.Data.DatabaseModels.StatsODL>();
|
||||
string cacheKey = getCacheKey("MP:STATS:ODL", CurrFilter);
|
||||
string rawData;
|
||||
@@ -366,6 +377,47 @@ namespace MP.Stats.Data
|
||||
return await Task.FromResult(dbResult);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Elenco TaskList gestiti
|
||||
/// </summary>
|
||||
/// <param name="CurrFilter"></param>
|
||||
/// <param name="searchVal"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<List<MP.Data.DatabaseModels.TaskListModel>> TaskListAll(Task2ExeType TType, string searchVal = "")
|
||||
{
|
||||
List<MP.Data.DatabaseModels.TaskListModel> dbResult = new List<MP.Data.DatabaseModels.TaskListModel>();
|
||||
string cacheKey = $"MP:STATS:TaskList:{TType}";
|
||||
string rawData;
|
||||
var redisDataList = await distributedCache.GetAsync(cacheKey);
|
||||
if (redisDataList != null)
|
||||
{
|
||||
rawData = Encoding.UTF8.GetString(redisDataList);
|
||||
dbResult = JsonConvert.DeserializeObject<List<MP.Data.DatabaseModels.TaskListModel>>(rawData);
|
||||
}
|
||||
else
|
||||
{
|
||||
Stopwatch stopWatch = new Stopwatch();
|
||||
stopWatch.Start();
|
||||
dbResult = dbController.TaskListGetAll(TType);
|
||||
rawData = JsonConvert.SerializeObject(dbResult);
|
||||
redisDataList = Encoding.UTF8.GetBytes(rawData);
|
||||
await distributedCache.SetAsync(cacheKey, redisDataList, cacheOpt);
|
||||
stopWatch.Stop();
|
||||
TimeSpan ts = stopWatch.Elapsed;
|
||||
_logger.LogTrace($"Effettuata lettura da DB + caching per TaskList: {ts.TotalMilliseconds} ms");
|
||||
}
|
||||
// se necessario filtro..
|
||||
if (!string.IsNullOrEmpty(searchVal))
|
||||
{
|
||||
dbResult = dbResult
|
||||
.Where(x => x.Name.Contains(searchVal, StringComparison.InvariantCultureIgnoreCase)
|
||||
|| x.Descript.Contains(searchVal, StringComparison.InvariantCultureIgnoreCase))
|
||||
.ToList();
|
||||
}
|
||||
return await Task.FromResult(dbResult);
|
||||
}
|
||||
|
||||
public async Task<List<MP.Data.DatabaseModels.ResScarti>> StatScartiGetAll(SelectData CurrFilter, string searchVal = "")
|
||||
{
|
||||
//return Task.FromResult(dbController.StatScartiGetAll(DataStart, DataEnd, IdxMacchina, IdxODL, KeyRichiesta, CodArticolo).ToArray());
|
||||
@@ -444,7 +496,7 @@ namespace MP.Stats.Data
|
||||
// se richiesto filtro azioni effettuo ora selezione...
|
||||
if (CurrFilter.Azione != "*")
|
||||
{
|
||||
dbResult= dbResult.Where(x => x.Azione == CurrFilter.Azione).ToList();
|
||||
dbResult = dbResult.Where(x => x.Azione == CurrFilter.Azione).ToList();
|
||||
}
|
||||
rawData = JsonConvert.SerializeObject(dbResult);
|
||||
redisDataList = Encoding.UTF8.GetBytes(rawData);
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<RootNamespace>MP.Stats</RootNamespace>
|
||||
<UserSecretsId>826e877c-ba70-4253-84cb-d0b1cafd4440</UserSecretsId>
|
||||
<Version>6.16.2403.2811</Version>
|
||||
<Version>6.16.2403.2811</Version>
|
||||
<Version>6.16.2403.2817</Version>
|
||||
<Version>6.16.2403.2817</Version>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -22,7 +22,7 @@ namespace MP.Stats.Pages
|
||||
|
||||
#region Protected Fields
|
||||
|
||||
protected string fileName = "ODL.csv";
|
||||
protected string fileName = "ODL_Energy.csv";
|
||||
|
||||
#endregion Protected Fields
|
||||
|
||||
|
||||
@@ -2,7 +2,22 @@
|
||||
|
||||
<div class="card">
|
||||
<div class="card-header table-primary p-1">
|
||||
<SelectionFilter SelFilter="currFilter" filterChanged="DoFilter" filterReset="ResetFilter"></SelectionFilter>
|
||||
<div class="d-flex justify-content-between">
|
||||
<div class="px-2">
|
||||
<b>TaskList</b>
|
||||
</div>
|
||||
<div class="px-2">
|
||||
<select class="form-select" @bind="@TypeSel">
|
||||
@foreach (var option in Enum.GetValues(typeof(MP.Data.Objects.Enums.Task2ExeType)))
|
||||
{
|
||||
<option value="@option">
|
||||
@option
|
||||
</option>
|
||||
}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<MP.Stats.Components.TaskEdit CurrRecord="@currRecord" EC_update="forceUpdate"></MP.Stats.Components.TaskEdit>
|
||||
</div>
|
||||
<div class="card-body py-0 px-1">
|
||||
@if (ListRecords == null)
|
||||
@@ -20,58 +35,59 @@
|
||||
<table class="table table-sm table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Macchina</th>
|
||||
<th>Commessa/ODL</th>
|
||||
<th>Articolo</th>
|
||||
<th>Inizio</th>
|
||||
<th>Fine</th>
|
||||
<th class="text-right">Unit</th>
|
||||
<th class="text-right">Energy</th>
|
||||
<th class="text-right">Gas</th>
|
||||
<th class="text-right">P1</th>
|
||||
<th class="text-right">P2</th>
|
||||
<th class="text-right">P3</th>
|
||||
<th>
|
||||
<button class="btn btn-sm btn-info" @onclick="doReset" title="Reset"><i class="fas fa-sync"></i></button>
|
||||
</th>
|
||||
<th>#</th>
|
||||
<th>Task</th>
|
||||
<th>Tipo</th>
|
||||
<th>Command</th>
|
||||
<th>Schedulazione</th>
|
||||
<th class="text-right">Last</th>
|
||||
<th class="text-right">Next</th>
|
||||
<th class="text-right">Result</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach (var record in ListRecords)
|
||||
{
|
||||
<tr class="@checkSelect(@record.IdxOdl)">
|
||||
<td>@record.IdxMacchina</td>
|
||||
<tr class="@checkSelect(@record.TaskId)">
|
||||
<td>
|
||||
<div>@record.KeyRichiesta</div>
|
||||
<div class="small">@record.IdxOdl</div>
|
||||
</td>
|
||||
<td>
|
||||
@record.CodArticolo
|
||||
<div class="small">@record.DescArticolo</div>
|
||||
</td>
|
||||
<td>@record.DataInizio</td>
|
||||
<td>@record.DataFine</td>
|
||||
<td class="text-right">@(record.NumPezziEv + 200) m</td>
|
||||
<td class="text-right">
|
||||
@{
|
||||
double currSim = simVal(record.NumPezzi, record.NumPezziEv + 200);
|
||||
double currSimGas = simVal(record.NumPezzi, record.NumPezziEv + 200);
|
||||
@if (currRecord == null)
|
||||
{
|
||||
<button class="btn btn-sm btn-primary me-1" @onclick="()=>doEdit(record)" title="Edit"><i class="fas fa-pencil-alt"></i></button>
|
||||
}
|
||||
<div>
|
||||
@currSim.ToString("N2") kWh
|
||||
</div>
|
||||
<small>
|
||||
@righDiv(currSim, record.NumPezziEv + 200).ToString("N1") kWh/m
|
||||
</small>
|
||||
else
|
||||
{
|
||||
@* <button class="btn btn-sm btn-success" @onclick="()=>doSave()" title="Save"><i class="far fa-save"></i></button> *@
|
||||
<button class="btn btn-sm btn-secondary" @onclick="()=>doCancel()" title="Cancel"><i class="fas fa-undo"></i></button>
|
||||
}
|
||||
</td>
|
||||
<td>@record.TaskId</td>
|
||||
<td>
|
||||
<div>@record.Name</div>
|
||||
<div class="small">@record.Descript</div>
|
||||
</td>
|
||||
<td>
|
||||
@record.TType
|
||||
</td>
|
||||
<td>
|
||||
<div>@record.Command</div>
|
||||
<div class="small">@record.Args</div>
|
||||
</td>
|
||||
<td>@record.Freq × @record.Cad</td>
|
||||
<td class="text-right">
|
||||
<div>@($"{record.DtLastExec:yyyy-MM-dd}")</div>
|
||||
<div class="small">@($"{record.DtLastExec:ddd HH:mm:ss}")</div>
|
||||
</td>
|
||||
<td class="text-right">
|
||||
<div>
|
||||
@currSim.ToString("N2") m<sup>3</sup>
|
||||
</div>
|
||||
<small>
|
||||
@righDiv(currSim, record.NumPezziEv + 200).ToString("N1") m<sup>3</sup>/m
|
||||
</small>
|
||||
<div>@($"{record.DtNextExec:yyyy-MM-dd}")</div>
|
||||
<div class="small">@($"{record.DtNextExec:ddd HH:mm:ss}")</div>
|
||||
</td>
|
||||
<td class="text-right">
|
||||
<div>@record.LastDuration sec</div>
|
||||
<div class="small">@record.LastResult</div>
|
||||
</td>
|
||||
<td class="text-right">@($"{currSim:N1}")</td>
|
||||
<td class="text-right">@($"{currSimGas:N1}")</td>
|
||||
<td class="text-right">@($"{currSim + currSimGas:N1}")</td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
@@ -81,6 +97,6 @@
|
||||
}
|
||||
</div>
|
||||
<div class="card-footer py-1">
|
||||
<DataPager PageSize="numRecord" currPage="currPage" numRecordChanged="ForceReload" numPageChanged="ForceReloadPage" exportEnabled="true" exportRequested="ExportCsv" fileName="@fileName" totalCount="totalCount" showLoading="isLoading" />
|
||||
<DataPager PageSize="numRecord" currPage="currPage" numRecordChanged="ForceReload" numPageChanged="ForceReloadPage" exportEnabled="false" exportRequested="ExportCsv" fileName="@fileName" totalCount="totalCount" showLoading="isLoading" />
|
||||
</div>
|
||||
</div>
|
||||
@@ -6,6 +6,9 @@ using System.IO;
|
||||
using System.Threading.Tasks;
|
||||
using System;
|
||||
using System.Linq;
|
||||
using StackExchange.Redis;
|
||||
using MP.Data.DatabaseModels;
|
||||
using static MP.Data.Objects.Enums;
|
||||
|
||||
namespace MP.Stats.Pages
|
||||
{
|
||||
@@ -13,14 +16,14 @@ namespace MP.Stats.Pages
|
||||
{
|
||||
#region Public Methods
|
||||
|
||||
public string checkSelect(int IdxODL)
|
||||
public string checkSelect(int TaskId)
|
||||
{
|
||||
string answ = "";
|
||||
if (currRecord != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
answ = (currRecord.IdxOdl == IdxODL) ? "table-info" : "";
|
||||
answ = (currRecord.TaskId == TaskId) ? "table-info" : "";
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
@@ -46,7 +49,7 @@ namespace MP.Stats.Pages
|
||||
|
||||
#region Protected Fields
|
||||
|
||||
protected string fileName = "ODL.csv";
|
||||
protected string fileName = "TaskList.csv";
|
||||
|
||||
#endregion Protected Fields
|
||||
|
||||
@@ -156,10 +159,10 @@ namespace MP.Stats.Pages
|
||||
|
||||
#region Private Fields
|
||||
|
||||
private MP.Data.DatabaseModels.StatsODL currRecord = null;
|
||||
private TaskListModel currRecord = null;
|
||||
|
||||
private List<MP.Data.DatabaseModels.StatsODL> ListRecords;
|
||||
private List<MP.Data.DatabaseModels.StatsODL> SearchRecords;
|
||||
private List<TaskListModel> ListRecords;
|
||||
private List<TaskListModel> SearchRecords;
|
||||
|
||||
#endregion Private Fields
|
||||
|
||||
@@ -196,6 +199,50 @@ namespace MP.Stats.Pages
|
||||
await Task.Run(() => File.Delete(fullPath));
|
||||
}
|
||||
|
||||
protected async Task doSave()
|
||||
{
|
||||
if (currRecord != null)
|
||||
{
|
||||
#if false
|
||||
bool done = false;
|
||||
// salvo verificando status...
|
||||
if (currOrder.OrderStatus == 10 || currOrder.OrderStatus == 10000)
|
||||
{
|
||||
done = await WDService.OrderUpdateDescript(currOrder.OrderId, currOrder.OrderExtCode, currOrder.OrderDescript);
|
||||
}
|
||||
else
|
||||
{
|
||||
done = await WDService.OrderUpdatePromDate(currOrder.OrderId, currOrder.DateProm);
|
||||
}
|
||||
// resetto info
|
||||
currOrder = null;
|
||||
isEdit = false;
|
||||
await WDService.OrdersFlushCache();
|
||||
#endif
|
||||
await ReloadData();
|
||||
}
|
||||
}
|
||||
protected async Task doCancel()
|
||||
{
|
||||
currRecord = null;
|
||||
await ReloadData();
|
||||
}
|
||||
protected async Task doReset()
|
||||
{
|
||||
currRecord = null;
|
||||
await ReloadData();
|
||||
}
|
||||
|
||||
protected async Task forceUpdate(bool doForce)
|
||||
{
|
||||
currRecord = null;
|
||||
await ReloadData();
|
||||
}
|
||||
protected async Task doEdit(TaskListModel selRec)
|
||||
{
|
||||
currRecord = selRec;
|
||||
await ReloadData();
|
||||
}
|
||||
private async Task ExportCsv()
|
||||
{
|
||||
isLoading = true;
|
||||
@@ -206,10 +253,29 @@ namespace MP.Stats.Pages
|
||||
|
||||
private async Task ReloadData()
|
||||
{
|
||||
SearchRecords = await StatService.StatOdlGetAll(currFilter, MessageService.SearchVal);
|
||||
SearchRecords = await StatService.TaskListAll(TypeSel, "");
|
||||
ListRecords = SearchRecords.Skip(numRecord * (currPage - 1)).Take(numRecord).ToList();
|
||||
}
|
||||
|
||||
protected Task2ExeType TypeSel
|
||||
{
|
||||
get => typeSel;
|
||||
set
|
||||
{
|
||||
if (typeSel != value)
|
||||
{
|
||||
typeSel = value;
|
||||
var pUpd = Task.Run(async () =>
|
||||
{
|
||||
await ReloadData();
|
||||
//await InvokeAsync(StateHasChanged);
|
||||
});
|
||||
pUpd.Wait();
|
||||
}
|
||||
}
|
||||
}
|
||||
private Task2ExeType typeSel { get; set; } = Task2ExeType.ND;
|
||||
|
||||
#endregion Private Methods
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
<body>
|
||||
<i>Modulo statistiche MAPO</i>
|
||||
<h4>Versione: 6.16.2403.2811</h4>
|
||||
<h4>Versione: 6.16.2403.2817</h4>
|
||||
<br />
|
||||
Note di rilascio:
|
||||
<ul>
|
||||
|
||||
@@ -1 +1 @@
|
||||
6.16.2403.2811
|
||||
6.16.2403.2817
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<item>
|
||||
<version>6.16.2403.2811</version>
|
||||
<version>6.16.2403.2817</version>
|
||||
<url>https://nexus.steamware.net/repository/SWS/MP-STATS/stable/LAST/MP.Stats.zip</url>
|
||||
<changelog>https://nexus.steamware.net/repository/SWS/MP-STATS/stable/LAST/ChangeLog.html</changelog>
|
||||
<mandatory>false</mandatory>
|
||||
|
||||
@@ -47,11 +47,11 @@
|
||||
<span class="oi oi-warning" aria-hidden="true" title="Registro Scarti"></span> Registro Scarti
|
||||
</NavLink>
|
||||
</li>
|
||||
@* <li class="nav-item px-3">
|
||||
<li class="nav-item px-3">
|
||||
<NavLink class="nav-link" href="TaskScheduler">
|
||||
<span class="oi oi-clock" aria-hidden="true"></span> Task Scheduler
|
||||
</NavLink>
|
||||
</li> *@
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user