Merge tag 'TaskExecMan06' into develop
PROG: Completata review x gestioen delete/archive/revisioni/esclusione file temp
This commit is contained in:
@@ -10,6 +10,7 @@ using System.Threading.Tasks;
|
||||
using MP.FileData.DatabaseModels;
|
||||
using Newtonsoft.Json;
|
||||
using MP.FileData.DTO;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
namespace MP.FileData.Controllers
|
||||
{
|
||||
@@ -121,25 +122,10 @@ namespace MP.FileData.Controllers
|
||||
{
|
||||
Log.Info($"CheckFileArchived S00 | macchina: {idxMacchina} | path: {path} | pattern: {searchPattern} | # ExcludedFileExt: {currRule.ExcludedFileExt.Count()}");
|
||||
int checkDone = 0;
|
||||
DirectoryInfo dirInfo = new DirectoryInfo(path);
|
||||
FileInfo[] fileListRaw = dirInfo.GetFiles(searchPattern, SearchOption.AllDirectories);
|
||||
List<FileInfo> fileList = new List<FileInfo>();
|
||||
DateTime adesso = DateTime.Now;
|
||||
// se ho un limite x giorni indietor x modifiche --> limito!
|
||||
if (numDayPre > 0)
|
||||
{
|
||||
foreach (var item in fileListRaw)
|
||||
{
|
||||
if (adesso.Subtract(item.LastWriteTime).TotalDays <= numDayPre)
|
||||
{
|
||||
fileList.Add(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
fileList = fileListRaw.ToList();
|
||||
}
|
||||
// leggo i files rispettando regole e filtri vari
|
||||
fileList = GetFiltFileFromDisk(path, numDayPre, searchPattern, currRule, fileList);
|
||||
|
||||
Log.Debug($"CheckFileArchived S01 | file trovati: {fileList.Count()}");
|
||||
List<FileInfo> fileNew = new List<FileInfo>();
|
||||
List<FileModel> fileChecked = new List<FileModel>();
|
||||
@@ -271,6 +257,61 @@ namespace MP.FileData.Controllers
|
||||
// chiudo
|
||||
return checkDone;
|
||||
}
|
||||
/// <summary>
|
||||
/// Recupera file dal disco saltando eventuali math di esclusione e/o filtro date/nome file
|
||||
/// </summary>
|
||||
/// <param name="path"></param>
|
||||
/// <param name="numDayPre"></param>
|
||||
/// <param name="searchPattern"></param>
|
||||
/// <param name="currRule"></param>
|
||||
/// <param name="fileList"></param>
|
||||
/// <returns></returns>
|
||||
private static List<FileInfo> GetFiltFileFromDisk(string path, int numDayPre, string searchPattern, SearchRules currRule, List<FileInfo> fileList)
|
||||
{
|
||||
DirectoryInfo dirInfo = new DirectoryInfo(path);
|
||||
var fileListRaw = dirInfo.GetFiles(searchPattern, SearchOption.AllDirectories).ToList();
|
||||
List<FileInfo> file2Rem = new List<FileInfo>();
|
||||
// se richiesto filtro i files esclusi da regexp li calcolo...
|
||||
if (currRule.ExclFileEnabled)
|
||||
{
|
||||
foreach (var item in fileListRaw)
|
||||
{
|
||||
string pattern = currRule.ExclFileRegExPattern;
|
||||
// uso regexp
|
||||
MatchCollection hasMatch = Regex.Matches(item.Name, pattern);
|
||||
if (hasMatch.Count > 0)
|
||||
{
|
||||
file2Rem.Add(item);
|
||||
}
|
||||
}
|
||||
// quindi li rimuovo da elenco raw...
|
||||
if (file2Rem.Count > 0)
|
||||
{
|
||||
foreach (var f2d in file2Rem)
|
||||
{
|
||||
fileListRaw.Remove(f2d);
|
||||
}
|
||||
}
|
||||
}
|
||||
DateTime adesso = DateTime.Now;
|
||||
// se ho un limite x giorni indietro x modifiche --> limito!
|
||||
if (numDayPre > 0)
|
||||
{
|
||||
foreach (var item in fileListRaw)
|
||||
{
|
||||
if (adesso.Subtract(item.LastWriteTime).TotalDays <= numDayPre)
|
||||
{
|
||||
fileList.Add(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
fileList = fileListRaw.ToList();
|
||||
}
|
||||
|
||||
return fileList;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Effettua la comparazione tra i file in archivio ed i file attuali e segna info LastCheck
|
||||
@@ -1010,7 +1051,7 @@ namespace MP.FileData.Controllers
|
||||
foreach (var item in missFiles)
|
||||
{
|
||||
// salvo update file
|
||||
item.DiskStatus = FileState.Deleted;
|
||||
item.DiskStatus = FileState.Missing;
|
||||
item.LastCheck = adesso;
|
||||
localDbCtx.Entry(item).State = EntityState.Modified;
|
||||
}
|
||||
@@ -1163,7 +1204,7 @@ namespace MP.FileData.Controllers
|
||||
.Count();
|
||||
|
||||
item.NumMissing = activeRecords
|
||||
.Where(x => x.DiskStatus == FileState.Deleted)
|
||||
.Where(x => x.DiskStatus == FileState.Missing)
|
||||
.Count();
|
||||
|
||||
item.NoTags = activeRecords
|
||||
|
||||
+1
-1
@@ -13,7 +13,7 @@ namespace MP.FileData
|
||||
{
|
||||
ND = 0,
|
||||
Changed,
|
||||
Deleted,
|
||||
Missing,
|
||||
Ok
|
||||
}
|
||||
}
|
||||
@@ -93,6 +93,16 @@ namespace MP.FileData
|
||||
/// </summary>
|
||||
public List<string> Tag2Collect { get; set; } = new List<string>();
|
||||
|
||||
/// <summary>
|
||||
/// Configurazione opzionale x escludere files da regexp su filename
|
||||
/// </summary>
|
||||
public bool ExclFileEnabled { get; set; } = false;
|
||||
|
||||
/// <summary>
|
||||
/// Pattern in formato RegExp x esclusione file da nome
|
||||
/// </summary>
|
||||
public string ExclFileRegExPattern { get; set; } = "";
|
||||
|
||||
#endregion Public Properties
|
||||
}
|
||||
}
|
||||
@@ -163,7 +163,6 @@ namespace MP.Prog.Components
|
||||
// recupero elenco macchine
|
||||
percLoading += 100 / numMacchine;
|
||||
numChecks = await FDService.UpdateMachineArchive(idxMacchina, numDays, true, false, "", false);
|
||||
//numChecks = await FDService.UpdateMachineArchive(idxMacchina, numDays, true, false, MServ.UserName, false);
|
||||
await Task.Delay(1);
|
||||
setupMessages.Add($"{idxMacchina}: {numChecks} files");
|
||||
await InvokeAsync(StateHasChanged);
|
||||
|
||||
@@ -64,13 +64,7 @@
|
||||
else
|
||||
{
|
||||
<div class="px-0">
|
||||
<div class="row">
|
||||
<div class="col-6">
|
||||
<button type="button" class="btn btn-success w-100" value="" @onclick="ExportArchive">Sostituisci da Archivio <i class="fas fa-file-download"></i></button>
|
||||
</div>
|
||||
<div class="col-6">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
|
||||
@@ -132,7 +132,7 @@ namespace MP.Prog.Components
|
||||
answ += " text-bg-warning";
|
||||
break;
|
||||
|
||||
case FileState.Deleted:
|
||||
case FileState.Missing:
|
||||
answ += " text-bg-danger";
|
||||
break;
|
||||
|
||||
|
||||
+29
-27
@@ -1,29 +1,31 @@
|
||||
{
|
||||
"ExcludedTags": [
|
||||
"M4",
|
||||
"M5",
|
||||
"M4+A",
|
||||
"M4+B",
|
||||
"M5+A",
|
||||
"M5+B"
|
||||
],
|
||||
"ExcludedFileExt": [
|
||||
".xls",
|
||||
".xls#",
|
||||
".xlsx"
|
||||
],
|
||||
"FileNameExtReplace": {
|
||||
".P-2": ""
|
||||
},
|
||||
"MaxChar2Search": 100,
|
||||
"Mode": 0,
|
||||
"Name": "Tag da Commento Filename",
|
||||
"OutExcludeFileName": true,
|
||||
"OutReplace": {
|
||||
"(": " ",
|
||||
")": " "
|
||||
},
|
||||
"RegExPattern": "\\b{{fileName}}.{0,2}\\([\\w\\d\\s./\\-=]+\\)",
|
||||
"RegExRepFileName": true,
|
||||
"ReplaceCR": true
|
||||
"ExcludedTags": [
|
||||
"M4",
|
||||
"M5",
|
||||
"M4+A",
|
||||
"M4+B",
|
||||
"M5+A",
|
||||
"M5+B"
|
||||
],
|
||||
"ExcludedFileExt": [
|
||||
".xls",
|
||||
".xls#",
|
||||
".xlsx"
|
||||
],
|
||||
"FileNameExtReplace": {
|
||||
".P-2": ""
|
||||
},
|
||||
"MaxChar2Search": 100,
|
||||
"Mode": 0,
|
||||
"Name": "Tag da Commento Filename",
|
||||
"OutExcludeFileName": true,
|
||||
"OutReplace": {
|
||||
"(": " ",
|
||||
")": " "
|
||||
},
|
||||
"RegExPattern": "\\b{{fileName}}.{0,2}\\([\\w\\d\\s./\\-=]+\\)",
|
||||
"RegExRepFileName": true,
|
||||
"ReplaceCR": true,
|
||||
"ExclFileEnabled": true,
|
||||
"ExclFileRegExPattern": "^~\\$"
|
||||
}
|
||||
+23
-21
@@ -1,23 +1,25 @@
|
||||
{
|
||||
"ExcludedTags": [],
|
||||
"ExcludedFileExt": [
|
||||
".xls",
|
||||
".xls#",
|
||||
".xlsx"
|
||||
],
|
||||
"FileNameExtReplace": {
|
||||
".P-2": ""
|
||||
},
|
||||
"MaxChar2Search": 1,
|
||||
"Mode": 1,
|
||||
"Name": "Tag da Directory + Filename",
|
||||
"OutExcludeFileName": false,
|
||||
"OutReplace": {
|
||||
".WPD": "",
|
||||
".MPF": "",
|
||||
".SPF": ""
|
||||
},
|
||||
"RegExPattern": "",
|
||||
"RegExRepFileName": true,
|
||||
"ReplaceCR": false
|
||||
"ExcludedTags": [],
|
||||
"ExcludedFileExt": [
|
||||
".xls",
|
||||
".xls#",
|
||||
".xlsx"
|
||||
],
|
||||
"FileNameExtReplace": {
|
||||
".P-2": ""
|
||||
},
|
||||
"MaxChar2Search": 1,
|
||||
"Mode": 1,
|
||||
"Name": "Tag da Directory + Filename",
|
||||
"OutExcludeFileName": false,
|
||||
"OutReplace": {
|
||||
".WPD": "",
|
||||
".MPF": "",
|
||||
".SPF": ""
|
||||
},
|
||||
"RegExPattern": "",
|
||||
"RegExRepFileName": true,
|
||||
"ReplaceCR": false,
|
||||
"ExclFileEnabled": true,
|
||||
"ExclFileRegExPattern": "^~\\$"
|
||||
}
|
||||
+35
-33
@@ -1,35 +1,37 @@
|
||||
{
|
||||
"ExcludedTags": [
|
||||
"M4",
|
||||
"M5",
|
||||
"M4+A",
|
||||
"M4+B",
|
||||
"M5+A",
|
||||
"M5+B",
|
||||
"M6+A",
|
||||
"M6+B",
|
||||
"+A"
|
||||
],
|
||||
"ExcludedFileExt": [
|
||||
".xls",
|
||||
".xls#",
|
||||
".xlsx"
|
||||
],
|
||||
"FileNameExtReplace": {
|
||||
".P-2": "",
|
||||
".tim": ""
|
||||
},
|
||||
"MaxChar2Search": 100,
|
||||
"Mode": 0,
|
||||
"Name": "Tag da Commento Filename Tornoss TISIS",
|
||||
"OutExcludeFileName": true,
|
||||
"OutReplace": {
|
||||
"(": " ",
|
||||
")": " ",
|
||||
"<": " ",
|
||||
">": " "
|
||||
},
|
||||
"RegExPattern": "\\b{{fileName}}.{0,2}\\([\\<\\w\\d\\s./\\-=\\+\\>]+\\)",
|
||||
"RegExRepFileName": true,
|
||||
"ReplaceCR": true
|
||||
"ExcludedTags": [
|
||||
"M4",
|
||||
"M5",
|
||||
"M4+A",
|
||||
"M4+B",
|
||||
"M5+A",
|
||||
"M5+B",
|
||||
"M6+A",
|
||||
"M6+B",
|
||||
"+A"
|
||||
],
|
||||
"ExcludedFileExt": [
|
||||
".xls",
|
||||
".xls#",
|
||||
".xlsx"
|
||||
],
|
||||
"FileNameExtReplace": {
|
||||
".P-2": "",
|
||||
".tim": ""
|
||||
},
|
||||
"MaxChar2Search": 100,
|
||||
"Mode": 0,
|
||||
"Name": "Tag da Commento Filename Tornoss TISIS",
|
||||
"OutExcludeFileName": true,
|
||||
"OutReplace": {
|
||||
"(": " ",
|
||||
")": " ",
|
||||
"<": " ",
|
||||
">": " "
|
||||
},
|
||||
"RegExPattern": "\\b{{fileName}}.{0,2}\\([\\<\\w\\d\\s./\\-=\\+\\>]+\\)",
|
||||
"RegExRepFileName": true,
|
||||
"ReplaceCR": true,
|
||||
"ExclFileEnabled": true,
|
||||
"ExclFileRegExPattern": "^~\\$"
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"ExcludedTags": [ ],
|
||||
"ExcludedTags": [],
|
||||
"ExcludedFileExt": [
|
||||
".bak",
|
||||
".bck"
|
||||
@@ -33,5 +33,7 @@
|
||||
"IP=",
|
||||
"AUTO_CHANGE_ODL=",
|
||||
"AUTO_SNAPSHOT_DOSSIER="
|
||||
]
|
||||
],
|
||||
"ExclFileEnabled": true,
|
||||
"ExclFileRegExPattern": "^~\\$"
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"ExcludedTags": [ ],
|
||||
"ExcludedTags": [],
|
||||
"ExcludedFileExt": [
|
||||
".bak",
|
||||
".bck",
|
||||
@@ -39,5 +39,7 @@
|
||||
"\"QrJumpPath\":",
|
||||
"\"Environment\":",
|
||||
"\"appVers\":"
|
||||
]
|
||||
],
|
||||
"ExclFileEnabled": true,
|
||||
"ExclFileRegExPattern": "^~\\$"
|
||||
}
|
||||
@@ -152,11 +152,15 @@ namespace MP.Prog.Controllers
|
||||
// ciclo ogni file modificato
|
||||
foreach (var cFile in listChanged)
|
||||
{
|
||||
// approvo il file modificato con utente anonimo (auto-Approve)
|
||||
bool fatto = await FADService.FileModApprove(cFile, "");
|
||||
if (fatto)
|
||||
// se è modificato...
|
||||
if (cFile.DiskStatus == FileData.FileState.Changed)
|
||||
{
|
||||
answ.Add(cFile.Path);
|
||||
// approvo il file modificato con utente anonimo (auto-Approve)
|
||||
bool fatto = await FADService.FileModApprove(cFile, "");
|
||||
if (fatto)
|
||||
{
|
||||
answ.Add(cFile.Path);
|
||||
}
|
||||
}
|
||||
}
|
||||
return answ;
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<RootNamespace>MP.Prog</RootNamespace>
|
||||
<Version>6.16.2410.2909</Version>
|
||||
<Version>6.16.2410.2910</Version>
|
||||
<GenerateDocumentationFile>True</GenerateDocumentationFile>
|
||||
</PropertyGroup>
|
||||
|
||||
|
||||
@@ -134,6 +134,7 @@ namespace MP.Prog.Pages
|
||||
var numCheck = await FDService.UpdateMachineFilesArchive(CurrRec.IdxMacchina, FileIdList, false, false, "", false);
|
||||
|
||||
isLoading = true;
|
||||
currRecord = null;
|
||||
await ReloadData();
|
||||
isLoading = false;
|
||||
}
|
||||
@@ -678,7 +679,7 @@ namespace MP.Prog.Pages
|
||||
answ += " text-bg-warning";
|
||||
break;
|
||||
|
||||
case FileState.Deleted:
|
||||
case FileState.Missing:
|
||||
answ += " text-bg-danger";
|
||||
break;
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<body>
|
||||
<i>Modulo gestione Programmi MAPO</i>
|
||||
<h4>Versione: 6.16.2410.2909</h4>
|
||||
<h4>Versione: 6.16.2410.2910</h4>
|
||||
<br />
|
||||
Note di rilascio:
|
||||
<ul>
|
||||
|
||||
@@ -1 +1 @@
|
||||
6.16.2410.2909
|
||||
6.16.2410.2910
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<item>
|
||||
<version>6.16.2410.2909</version>
|
||||
<version>6.16.2410.2910</version>
|
||||
<url>https://nexus.steamware.net/repository/SWS/MP-PROG/stable/LAST/MP.Prog.zip</url>
|
||||
<changelog>https://nexus.steamware.net/repository/SWS/MP-PROG/stable/LAST/ChangeLog.html</changelog>
|
||||
<mandatory>false</mandatory>
|
||||
|
||||
Reference in New Issue
Block a user