Inizio modifiche x refresh forzato contapezzi

This commit is contained in:
Samuele E. Locatelli
2020-02-28 10:08:51 +01:00
parent c01484d217
commit 92d933adea
7 changed files with 25 additions and 36 deletions
+2 -17
View File
@@ -706,8 +706,9 @@ namespace IOB_WIN
// verifico se variato contapezzi...
if (lastCountCNC > contapezzi)
{
// salvo nuovo contapezzi (incremento di 1...)
// salvo nuovo contapezzi (incremento di 1...) + richiesta refresh conteggio
contapezzi++;
needRefreshPzCount = true;
// salvo in semaforo!
B_input += 1 << 2;
// registro contapezzi
@@ -793,23 +794,7 @@ namespace IOB_WIN
B_input += 1 << i;
}
}
#if false
// da rivedere x gestione contapezzi a bit...
// verifico se si tratta di un segnale contapezzo... nel qual caso conteggio ed invio...
if (currIobConf.optPar["PZCOUNT_MODE"].StartsWith("BIT"))
{
// salvo nuovo contapezzi (incremento di 1...)
contapezzi++;
// invio a server contapezzi (aggiornato)
utils.callUrl(urlSetPzCount + contapezzi.ToString());
lgInfo("Aggiornato contapezzi: {0}", contapezzi);
// resetto timer...
lastPzCountSend = DateTime.Now;
}
#endif
}
}
}
}
+11 -14
View File
@@ -107,6 +107,10 @@ namespace IOB_WIN
/// Indica impianto IN SETUP (fino a quando SMETTE di esserlo...)
/// </summary>
protected bool inSetup = false;
/// <summary>
/// Variabile booleana che indica se sia necessario fare refresh del contapezzi
/// </summary>
public bool needRefreshPzCount = true;
/// <summary>
/// Indicazione VETO PING a server sino alla data-ora indicata
/// </summary>
@@ -514,8 +518,7 @@ namespace IOB_WIN
protected Dictionary<string, EVData> VarArray = new Dictionary<string, EVData>();
#endregion
/// <summary>
/// Form chiamante
/// </summary>
@@ -1215,10 +1218,6 @@ namespace IOB_WIN
catch (Exception exc)
{
string errore = $"Adapter NOT STARTED!!!{Environment.NewLine}{exc}";
// !!!FARE !!!FIXME aggiungere metodo x status update...
#if false
parentForm.displayTaskAndLog(errore);
#endif
adpCommAct = false;
adpStartRun = DateTime.Now;
currDispData.newLiveLogData = errore;
@@ -1259,9 +1258,9 @@ namespace IOB_WIN
{
if (utils.CRB("enableContapezzi"))
{
// rilettura contapezzi da server... SE ABILITATA
lgInfo("Ciclo VLF: pzCntReload(false)");
pzCntReload(false);
// rilettura contapezzi da server...
lgInfo("Ciclo VLF: pzCntReload(true)");
pzCntReload(true);
// refresh associazione Macchina - IOB
sendM2IOB();
}
@@ -1428,7 +1427,7 @@ namespace IOB_WIN
// se ho contapezzi OLTRE limite...
while ((MPOnline) && (lastCountCNC > contapezzi + minSendPzCountBlock))
{
lgInfo($"Inizio svuotaCodaContapezzi --> lastCountCNC: {lastCountCNC} | contapezzi: {contapezzi}");
lgInfo($"Ciclo svuotaCodaContapezzi --> lastCountCNC: {lastCountCNC} | contapezzi: {contapezzi}");
pzCntReload(true);
// provo invio
trySendPzCountBlock();
@@ -1448,7 +1447,7 @@ namespace IOB_WIN
return;
}
// aspetto x dare tempo calcolo
Thread.Sleep(300);
Thread.Sleep(400);
}
}
@@ -3364,8 +3363,6 @@ namespace IOB_WIN
{
// errore salvataggio contapezzi
lgInfo($"trySendPzCountBlock: errore salvataggio contapezzi: contapezzi {contapezzi} | risposta: {retVal}");
// rileggo il counter pezzi da server
pzCntReload(true);
}
}
else
@@ -4214,7 +4211,7 @@ namespace IOB_WIN
// se oltre 1 min NON era online --> check pezzi!
if (DateTime.Now.Subtract(lastIobOnline).TotalMinutes > 1)
{
lgInfo($"sendDataBlock --> offline timeaout ({lastIobOnline}) --> pzCntReload(true)");
lgInfo($"sendDataBlock --> offline timeout ({lastIobOnline}) --> pzCntReload(true)");
pzCntReload(true);
}
lastIobOnline = DateTime.Now;
+2 -1
View File
@@ -912,8 +912,9 @@ namespace IOB_WIN
// verifico se variato contapezzi... e se passato ritardo minimo...
if (lastCountCNC > contapezzi)
{
// salvo nuovo contapezzi (incremento di 1...)
// salvo nuovo contapezzi (incremento di 1...) + richiesta refresh conteggio
contapezzi++;
needRefreshPzCount = true;
// salvo in semaforo!
B_input += (1 << 2);
// registro contapezzi
+2 -1
View File
@@ -381,8 +381,9 @@ namespace IOB_WIN
// verifico se variato contapezzi in area STD PAR6711... e se passato ritardo minimo...
if (lastCountCNC > contapezzi)
{
// salvo nuovo contapezzi (incremento di 1...)
// salvo nuovo contapezzi (incremento di 1...) + richiesta refresh conteggio
contapezzi++;
needRefreshPzCount = true;
// salvo in semaforo!
B_input += 1 << 2;
// registro contapezzi
+2 -1
View File
@@ -222,8 +222,9 @@ namespace IOB_WIN
// verifico se variato contapezzi... e se passato ritardo minimo...
if (lastCountCNC > contapezzi)
{
// salvo nuovo contapezzi (incremento di 1...)
// salvo nuovo contapezzi (incremento di 1...) + richiesta refresh conteggio
contapezzi++;
needRefreshPzCount = true;
// salvo in semaforo!
B_input += (1 << 2);
// registro contapezzi
+2 -1
View File
@@ -209,8 +209,9 @@ namespace IOB_WIN
}
if ((lastCountCNC > contapezzi))
{
// salvo nuovo contapezzi (incremento di 1...)
// salvo nuovo contapezzi (incremento di 1...) + richiesta refresh conteggio
contapezzi++;
needRefreshPzCount = true;
// salvo in semaforo!
B_input += 1 << 2;
// registro contapezzi
+4 -1
View File
@@ -310,7 +310,9 @@ namespace IOB_WIN
// segnalo BIT (1 pz)
B_input += (1 << 2);
sigPzCount = true;
// salvo nuovo contapezzi (incremento di 1...) + richiesta refresh conteggio
contapezzi++;
needRefreshPzCount = true;
// invio conferma contapezzi..
string retVal = utils.callUrl($"{urlSetPzCount}{contapezzi}");
// verifica salvataggio
@@ -422,8 +424,9 @@ namespace IOB_WIN
{
bit2 = setupSimPar("SIM_PZCNT");
sendContapezzi = true;
// registro contapezzi
// salvo nuovo contapezzi (incremento di 1...) + richiesta refresh conteggio
contapezzi++;
needRefreshPzCount = true;
lgInfo($"S01: Valori contatori: contapezzi macchina lastCountCNC: {lastCountCNC} | contapezzi: {contapezzi} - incremento contapezzi per bit2.duration <= 0");
}
if (sendContapezzi)