diff --git a/IOB-WIN/IobFanuc.cs b/IOB-WIN/IobFanuc.cs
index 756dbf67..3696de6a 100644
--- a/IOB-WIN/IobFanuc.cs
+++ b/IOB-WIN/IobFanuc.cs
@@ -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
}
-
}
}
}
diff --git a/IOB-WIN/IobGeneric.cs b/IOB-WIN/IobGeneric.cs
index cf5ac728..02e2cafc 100644
--- a/IOB-WIN/IobGeneric.cs
+++ b/IOB-WIN/IobGeneric.cs
@@ -107,6 +107,10 @@ namespace IOB_WIN
/// Indica impianto IN SETUP (fino a quando SMETTE di esserlo...)
///
protected bool inSetup = false;
+ ///
+ /// Variabile booleana che indica se sia necessario fare refresh del contapezzi
+ ///
+ public bool needRefreshPzCount = true;
///
/// Indicazione VETO PING a server sino alla data-ora indicata
///
@@ -514,8 +518,7 @@ namespace IOB_WIN
protected Dictionary VarArray = new Dictionary();
#endregion
-
-
+
///
/// Form chiamante
///
@@ -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;
diff --git a/IOB-WIN/IobKawasaki.cs b/IOB-WIN/IobKawasaki.cs
index 67c2ee12..1656d316 100644
--- a/IOB-WIN/IobKawasaki.cs
+++ b/IOB-WIN/IobKawasaki.cs
@@ -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
diff --git a/IOB-WIN/IobOSAI.cs b/IOB-WIN/IobOSAI.cs
index 3410c25c..3d4ec93d 100644
--- a/IOB-WIN/IobOSAI.cs
+++ b/IOB-WIN/IobOSAI.cs
@@ -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
diff --git a/IOB-WIN/IobSiemensFape.cs b/IOB-WIN/IobSiemensFape.cs
index c11fafca..8372d1f7 100644
--- a/IOB-WIN/IobSiemensFape.cs
+++ b/IOB-WIN/IobSiemensFape.cs
@@ -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
diff --git a/IOB-WIN/IobSiemensTorri.cs b/IOB-WIN/IobSiemensTorri.cs
index 0fcb3f0f..922ea6ff 100644
--- a/IOB-WIN/IobSiemensTorri.cs
+++ b/IOB-WIN/IobSiemensTorri.cs
@@ -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
diff --git a/IOB-WIN/IobSimula.cs b/IOB-WIN/IobSimula.cs
index bdd7e7e6..782046b0 100644
--- a/IOB-WIN/IobSimula.cs
+++ b/IOB-WIN/IobSimula.cs
@@ -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)