Update x testing deploy dati Lovato

This commit is contained in:
Samuele Locatelli
2024-05-31 16:56:02 +02:00
parent 53972d0480
commit fd9fa52d36
7 changed files with 57 additions and 48 deletions
+48 -41
View File
@@ -15,7 +15,10 @@ namespace DemoApp
static async Task Main(string[] args)
{
bool execTop = false;
// indica se eseguire step check syncro remota dati via REST
bool testSync = false;
// indica se eseguire step check syncro dati LOG da DB a REST remoti
bool testDbLog = true;
// num chiave
int keyNum = 470;
@@ -23,8 +26,9 @@ namespace DemoApp
// Indirizzo server (DEBUG)
string servAddr = "localhost:7207";
// token di auth
string commToken = "91f4fec6-7e9c-4130-9df2-702d729ccdd3";
// token di auth nostro
//string commToken = "e7a81d7a-6fb4-412e-b361-cac7dda517d6";
string commToken = "79840ba7-00c1-407f-8372-5b60238c04fa";
#else
// Indirizzo server (RELEASE)
string servAddr = "magman.egalware.com";
@@ -47,7 +51,7 @@ namespace DemoApp
string esito = servOk ? "OK" : "KO";
Console.WriteLine($"Esito controllo server: {esito}");
// se richiesto eseguo tutto sennò salto
if (execTop)
if (testSync)
{
Console.WriteLine("Premere un tasto per lettura archivio materiali");
@@ -198,47 +202,50 @@ namespace DemoApp
var resAliasSend = commLib.AliasSend(alias2send);
}
// carico dal DB primi 50 rec e li invio 10 alla volta...
LogMachineController lmc = new LogMachineController();
int num2send = 2000;
int batchSize = 100;
int numSent = 0;
MagmanController mContr = new MagmanController(servAddr, commToken);
// sistemo proj x sync online
var syncRes = mContr.ProjAllSyncro();
// sistemo dati mancanti...
lmc.TryFixProjCloudId();
var recList = lmc.GetUnsentAsc(num2send);
// ciclo!
while (numSent < num2send)
if (testDbLog)
{
var currList = recList
.Skip(numSent)
.Take(batchSize)
.ToList();
// converto il blocco
var listDto = currList
.Select(x => LogMachineController.ConvToItemDto(x))
.ToList();
// invio!
var res = await commLib.LogMachineSendAsync(listDto);
if (res)
// carico dal DB primi 2000 rec e li invio 100 alla volta...
LogMachineController lmc = new LogMachineController();
int num2send = 2000;
int batchSize = 100;
int numSent = 0;
MagmanController mContr = new MagmanController(servAddr, commToken);
// sistemo proj x sync online
var syncRes = mContr.ProjAllSyncro();
// sistemo dati mancanti...
lmc.TryFixProjCloudId();
var recList = lmc.GetUnsentAsc(num2send);
// ciclo!
while (numSent < num2send)
{
// registro dati inviati...
lmc.SetDtSent(currList);
Console.WriteLine($"Inviati {batchSize}rec | {numSent} --> {numSent + batchSize}");
numSent += batchSize;
}
else
{
Console.WriteLine($"Errore in invio logMacchina");
var currList = recList
.Skip(numSent)
.Take(batchSize)
.ToList();
// converto il blocco
var listDto = currList
.Select(x => LogMachineController.ConvToItemDto(x))
.ToList();
// invio!
var res = await commLib.LogMachineSendAsync(listDto);
if (res)
{
// registro dati inviati...
lmc.SetDtSent(currList);
Console.WriteLine($"Inviati {batchSize}rec | {numSent} --> {numSent + batchSize}");
numSent += batchSize;
}
else
{
Console.WriteLine($"Errore in invio logMacchina");
}
}
Console.WriteLine(sep);
Console.WriteLine();
}
Console.WriteLine(sep);
Console.WriteLine();
Console.WriteLine("Enter to close");
answ = Console.ReadLine();