f53fc4c53f
- non modifica micro stati x mappe ingressi - fix grafici vari (minori)
197 lines
6.1 KiB
C#
197 lines
6.1 KiB
C#
using Microsoft.AspNetCore.Components;
|
|
using SMGen.Data;
|
|
using SMGen.Data.Data;
|
|
using SMGen.Data.Services;
|
|
|
|
namespace SMGen.Components
|
|
{
|
|
public partial class FilesList
|
|
{
|
|
protected FileLinesClass FileLines = new FileLinesClass();
|
|
|
|
[Parameter]
|
|
public bool doProcState { get; set; } = true;
|
|
|
|
[Parameter]
|
|
public bool calcEmptyState { get; set; } = false;
|
|
|
|
[Parameter]
|
|
public bool calcItSelf { get; set; } = false;
|
|
|
|
[Parameter]
|
|
public SelectSMIn2EvParams currFilter { get; set; } = null!;
|
|
|
|
//[Parameter]
|
|
//public Dictionary<string, bool> FilesStatus { get; set; } = new Dictionary<string, bool>();
|
|
public Dictionary<string, bool> FilesStatusTemp { get; set; } = new Dictionary<string, bool>();
|
|
|
|
[Parameter]
|
|
public bool hasBit { get; set; } = false;
|
|
[Parameter]
|
|
public bool is2Chk { get; set; } = false;
|
|
|
|
[Parameter]
|
|
public Core.Enum.ORDERTYPE orderType { get; set; } = Core.Enum.ORDERTYPE.stateEvent;
|
|
//[Parameter]
|
|
//public Dictionary<string, string> Files2Download { get; set; } = new Dictionary<string, string>();
|
|
|
|
[Parameter]
|
|
public int succFiles { get; set; } = 0;
|
|
[Parameter]
|
|
public EventCallback<bool> PagerResetReq { get; set; }
|
|
|
|
[Parameter]
|
|
public EventCallback<int> updateRecordCount { get; set; }
|
|
protected string currFileName { get; set; } = "";
|
|
|
|
protected List<string> currMsgs { get; set; } = new List<string>();
|
|
|
|
protected Dictionary<string, FilesClass> Files { get; set; } = new Dictionary<string, FilesClass>();
|
|
|
|
protected Dictionary<string, FilesClass> FilesTemp { get; set; } = new Dictionary<string, FilesClass>();
|
|
|
|
[Inject]
|
|
protected SMGDataService SMGDService { get; set; } = null!;
|
|
private int _totalCount { get; set; } = 0;
|
|
private int currPage
|
|
{
|
|
get => currFilter.CurrPage;
|
|
set => currFilter.CurrPage = value;
|
|
}
|
|
|
|
private int numRecord
|
|
{
|
|
get => currFilter.NumRec;
|
|
set => currFilter.NumRec = value;
|
|
}
|
|
|
|
private int totalCount
|
|
{
|
|
get => _totalCount;
|
|
set
|
|
{
|
|
if (_totalCount != value)
|
|
{
|
|
_totalCount = value;
|
|
updateRecordCount.InvokeAsync(value);
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
protected string lineCssState(string state)
|
|
{
|
|
string answ = "";
|
|
if (FileLines.statesOK.ContainsKey(state))
|
|
{
|
|
answ = "text-success";
|
|
}
|
|
else
|
|
{
|
|
answ = "text-danger";
|
|
}
|
|
|
|
return answ;
|
|
}
|
|
protected string lineCssEvent(string currEvent)
|
|
{
|
|
string answ = "";
|
|
if (FileLines.eventsOK.ContainsKey(currEvent))
|
|
{
|
|
answ = "text-success";
|
|
}
|
|
else
|
|
{
|
|
answ = "text-danger";
|
|
}
|
|
|
|
return answ;
|
|
}
|
|
protected string showDanger(FilesClass currFile)
|
|
{
|
|
string answ = "";
|
|
if (currFile.errorMsgs.Count() > 1)
|
|
{
|
|
answ = "fa-solid fa-triangle-exclamation";
|
|
}
|
|
return answ;
|
|
}
|
|
protected async Task doProc(FilesClass currFile)
|
|
{
|
|
await Task.Delay(1);
|
|
if (FileLines.statesOK.Count <= 0 && FileLines.eventsOK.Count <= 0 && FileLines.lines.Count <= 0)
|
|
{
|
|
FileLines = await SMGDService.DoCheckUnusedEvSt(currFile);
|
|
#if false
|
|
if (doProcState)
|
|
{
|
|
}
|
|
else
|
|
{
|
|
FileLines = await SMGDService.DoCheckUnusedEv(currFile);
|
|
}
|
|
#endif
|
|
}
|
|
else
|
|
{
|
|
FileLines = new FileLinesClass();
|
|
}
|
|
}
|
|
protected override async Task OnParametersSetAsync()
|
|
{
|
|
await ReloadData();
|
|
}
|
|
protected async Task Read_rule_file_transitions()
|
|
{
|
|
SMGDService.events2Add.Clear();
|
|
Files = await SMGDService.FilesGetAll();
|
|
foreach (var item in Files.OrderBy(x => x.Value.origFileName))
|
|
{
|
|
item.Value.calcRunning = true;
|
|
await InvokeAsync(() => StateHasChanged());
|
|
await Task.Delay(1);
|
|
// chiamo esecuzione 1:1...
|
|
if (hasBit)
|
|
{
|
|
await SMGDService.EvalIn2EvRuleFile(item.Value, true, doProcState);
|
|
}
|
|
else if (is2Chk)
|
|
{
|
|
await SMGDService.modFile(item.Value, true, doProcState);
|
|
}
|
|
else
|
|
{
|
|
await SMGDService.EvalIn2StateRuleFile(item.Value, false, calcItSelf, calcEmptyState, orderType, doProcState);
|
|
}
|
|
item.Value.calcRunning = false;
|
|
if (item.Value.isOk)
|
|
{
|
|
succFiles = succFiles + 1;
|
|
}
|
|
await InvokeAsync(() => StateHasChanged());
|
|
}
|
|
await Task.Delay(5);
|
|
//await SMGDService.AnagEventinInsert(SMGDService.events2Add);
|
|
//SMGDService.events2Add.Clear();
|
|
}
|
|
|
|
protected async Task ReloadData()
|
|
{
|
|
SMGDService.events2Add.Clear();
|
|
await Task.Delay(1);
|
|
FilesTemp = await SMGDService.FilesGetAll();
|
|
totalCount = FilesTemp.Count;
|
|
Files = FilesTemp.Skip(numRecord * (currPage - 1)).Take(numRecord).OrderBy(x => x.Value.origFileName).ToDictionary(x => x.Key, y => y.Value);
|
|
await InvokeAsync(() => StateHasChanged());
|
|
}
|
|
protected async Task setCurrMsg(FilesClass currFile)
|
|
{
|
|
await Task.Delay(1);
|
|
if (currFile.errorMsgs.Count > 0)
|
|
{
|
|
currMsgs = currFile.errorMsgs;
|
|
}
|
|
currFileName = currFile.origFileName;
|
|
}
|
|
}
|
|
} |