Fix iniziale omron e stab con rete dati ballerina

This commit is contained in:
Samuele E. locatelli
2019-11-27 12:48:29 +01:00
parent f0ec6f540b
commit ff6968ecb4
2 changed files with 35 additions and 7 deletions
+12 -1
View File
@@ -832,7 +832,7 @@ namespace IOB_WIN
protected string getParamws2write()
{
string answ = "";
if (checkServerAlive)
if (checkServerAlive || true)
{
string url2call = $"{urlGetParams2Write}";
if (verboseLog)
@@ -840,6 +840,11 @@ namespace IOB_WIN
lgInfo("chiamata URL " + url2call);
}
answ = utils.callUrlNow(url2call);
// se vuoto faccio seconda prova...
if(answ=="")
{
answ = utils.callUrlNow(url2call);
}
}
return answ;
}
@@ -1451,6 +1456,7 @@ namespace IOB_WIN
answ += $" | Parameter {item.uid} --> {item.reqValue}";
// sistemo valori
item.value = item.reqValue;
lgInfo($"Effettuato update parametro: actVal = {item.value} | reqVal = {item.reqValue}");
item.reqValue = "";
// salvo in lista da ritrasmettere
updatedPar.Add(item);
@@ -2496,6 +2502,11 @@ namespace IOB_WIN
string ipAdrr = cIobConf.serverData.MPIP.Replace("http://", "").Replace("https://", "");
IPAddress.TryParse(ipAdrr, out address);
reply = pingSender.Send(address, pingServerMsTimeout);
// se ho timeout riprovo...
if(reply.Status== IPStatus.TimedOut)
{
reply = pingSender.Send(address, pingServerMsTimeout);
}
answ = reply.Status;
return answ;
}
+23 -6
View File
@@ -129,6 +129,9 @@ namespace IOB_WIN
pzCountDelay = utils.CRI("pzCountDelay");
lastPzCountSend = DateTime.Now;
lastWarnODL = DateTime.Now;
// imposto i parametri PLC
setParamPlc();
}
/// <summary>
/// Processo i task richiesti e li elimino dalla coda 1:1
@@ -264,7 +267,9 @@ namespace IOB_WIN
parentForm.commPlcActive = true;
short esitoLink = doConnect();
lgInfo($"szStatusConnection OMRON, esitoLink: {esitoLink}");
parentForm.commPlcActive = false;
parentForm.commPlcActive = false;
// imposto i parametri...
setParamPlc();
connectionOk = true;
// refresh stato allarmi!!!
if (connectionOk)
@@ -707,26 +712,38 @@ namespace IOB_WIN
{
// controllo i parametri... ne gestisco 4...
foreach (var item in updatedPar)
{
{
lgInfo($"Richiesti processing plcWriteParams per {item.name} | valore richiesto {item.reqValue} | valore attuale {item.value}");
string readBackVal = "";
switch (item.uid)
{
case "kgRich":
int.TryParse(item.reqValue, out valInt);
int.TryParse(item.value, out valInt);
pesoRichiesto = valInt;
readBackVal = pesoRichiesto.ToString();
break;
case "kgLotto":
int.TryParse(item.reqValue, out valInt);
int.TryParse(item.value, out valInt);
quantitaLotto = valInt;
readBackVal = quantitaLotto.ToString();
break;
case "portata":
int.TryParse(item.reqValue, out valInt);
int.TryParse(item.value, out valInt);
portata = valInt;
readBackVal = portata.ToString();
break;
case "setComm":
commessa = item.reqValue;
commessa = item.value;
readBackVal = commessa;
break;
default:
break;
}
// SE non corrispondessero LOGGO ERRORE...
readBackVal.Replace("\0", "");
if (item.value != readBackVal)
{
lgError($"Errore in plcWriteParams: uid {item.uid} | Wrote {item.value} | ReadBack {readBackVal}");
}
}
}