Update comportamento reconnect x ping + log fix
This commit is contained in:
@@ -743,16 +743,16 @@ namespace IOB_WIN_NEXT
|
||||
// se != null --> uso address...
|
||||
if (address != null)
|
||||
{
|
||||
reply = pingSender.Send(address, 100);
|
||||
reply = pingSender.Send(address, pingMsTimeout);
|
||||
}
|
||||
else
|
||||
{
|
||||
reply = pingSender.Send(cIobConf.cncIpAddr, 100);
|
||||
reply = pingSender.Send(cIobConf.cncIpAddr, pingMsTimeout);
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
reply = pingSender.Send(IPAddress.Loopback, 100);
|
||||
reply = pingSender.Send(IPAddress.Loopback, pingMsTimeout);
|
||||
}
|
||||
answ = reply.Status;
|
||||
}
|
||||
@@ -2706,7 +2706,6 @@ namespace IOB_WIN_NEXT
|
||||
}
|
||||
}
|
||||
// richiamo scrittura parametri su PLC
|
||||
lgInfo("Chiamate processMemWriteRequests --> plcWriteParams");
|
||||
plcWriteParams(updatedPar);
|
||||
// invio su cloud parametri!
|
||||
string rawData = JsonConvert.SerializeObject(updatedPar);
|
||||
@@ -4239,9 +4238,10 @@ namespace IOB_WIN_NEXT
|
||||
Dictionary<string, string> taskDone = new Dictionary<string, string>();
|
||||
if (task2exe != null)
|
||||
{
|
||||
lgInfo($"Task2Exe: trovati {task2exe.Count} task da eseguire, procedo");
|
||||
lgInfo($"Task2Exe S01: trovati {task2exe.Count} task da eseguire, procedo");
|
||||
// chiamo procedura esecutiva (diversa x ogni IOB)
|
||||
taskDone = executeTasks(task2exe);
|
||||
lgInfo($"Task2Exe S02: eseguiti {taskDone.Count} task");
|
||||
// loggo tutti i task done...
|
||||
foreach (var item in taskDone)
|
||||
{
|
||||
|
||||
+11
-12
@@ -437,10 +437,9 @@ namespace IOB_WIN_NEXT
|
||||
// faccio preliminarmente upsertKey...
|
||||
upsertKey(currMem.name, currMem.value);
|
||||
serObj = JsonConvert.SerializeObject(item, Formatting.Indented);
|
||||
lgInfo($"Inizio processing plcWriteParams per {currMem.name} | valore richiesto {currMem.value}");
|
||||
lgInfo($"---------------{Environment.NewLine}UPDATED PARAM:{Environment.NewLine}{serObj}{Environment.NewLine}---------------");
|
||||
lgInfo($"Inizio processing plcWriteParams per {currMem.name} | valore richiesto {currMem.value}{Environment.NewLine}---------------UPDATED PARAM---------------{Environment.NewLine}{serObj}{Environment.NewLine}---------------");
|
||||
serObj = JsonConvert.SerializeObject(currMem, Formatting.Indented);
|
||||
lgInfo($"---------------{Environment.NewLine}MEMORY CONTENT:{Environment.NewLine}{serObj}{Environment.NewLine}---------------");
|
||||
lgInfo($"---------------MEMORY CONTENT---------------{Environment.NewLine}{serObj}{Environment.NewLine}---------------");
|
||||
switch (currMem.tipoMem)
|
||||
{
|
||||
case plcDataType.Boolean:
|
||||
@@ -482,7 +481,7 @@ namespace IOB_WIN_NEXT
|
||||
default:
|
||||
break;
|
||||
}
|
||||
lgInfo($"---------------{Environment.NewLine}MemBlock data:{Environment.NewLine}{BitConverter.ToString(MemBlock)}{Environment.NewLine}---------------");
|
||||
lgInfo($"---------------MemBlock data---------------{Environment.NewLine}{BitConverter.ToString(MemBlock)}{Environment.NewLine}--------------- END data ---------------");
|
||||
if (!string.IsNullOrEmpty(memAddrWrite))
|
||||
{
|
||||
// scrivo su siemens
|
||||
@@ -654,7 +653,7 @@ namespace IOB_WIN_NEXT
|
||||
// se passa il ping faccio il resto...
|
||||
if (pingStatus != IPStatus.Success)
|
||||
{
|
||||
lgError(string.Format("Errore in testCncConn: reply Status per {0}: {1}", parametri.ipAdrr, pingStatus));
|
||||
lgError($"Errore in testCncConn: reply Status | IP: {parametri.ipAdrr} | {pingStatus} | T.Out: {parametri.pingMsTimeout}ms");
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1138,8 +1137,8 @@ namespace IOB_WIN_NEXT
|
||||
switch (errorCode)
|
||||
{
|
||||
case ErrorCode.NoError:
|
||||
maybeLogWrite(memAddrWrite, $"S7WriteBB-01 Effettuata correttamente scrittura su PLC: MEMORIA {memAddrWrite} | numByte: {Value.Length} | BIN: {Value.ValToBinString()}");
|
||||
answ = true;
|
||||
maybeLogWrite(memAddrWrite, $"S7WriteBB-01 Effettuata correttamente scrittura su PLC: MEMORIA {memAddrWrite} | numByte: {Value.Length} | ValOriginale: {Value}");
|
||||
break;
|
||||
|
||||
case ErrorCode.WrongCPU_Type:
|
||||
@@ -1442,7 +1441,6 @@ namespace IOB_WIN_NEXT
|
||||
Buffer.BlockCopy(stringPar, 0, MemBlock, startPos, shiftStrByte);
|
||||
}
|
||||
Buffer.BlockCopy(strByte, 0, MemBlock, startPos + shiftStrByte, byteLen);
|
||||
lgInfo($"saveStringOnMemBlock: Final MemBlock{Environment.NewLine}{BitConverter.ToString(MemBlock)}");
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
@@ -1582,21 +1580,22 @@ namespace IOB_WIN_NEXT
|
||||
// se passa il ping faccio il resto...
|
||||
if (testPingMachine == IPStatus.Success)
|
||||
{
|
||||
string szStatusConnection = "";
|
||||
string szStatusConnection = "ND";
|
||||
try
|
||||
{
|
||||
// ora provo connessione...
|
||||
parentForm.commPlcActive = true;
|
||||
currPLC.Open();
|
||||
szStatusConnection = "OPEN";
|
||||
parentForm.commPlcActive = false;
|
||||
lgInfo("szStatusConnection: " + szStatusConnection);
|
||||
connectionOk = true;
|
||||
lgInfo($"StatusConnection: {szStatusConnection}");
|
||||
// refresh stato allarmi!!!
|
||||
if (connectionOk)
|
||||
{
|
||||
if (adpRunning)
|
||||
{
|
||||
lgInfo("Connessione OK");
|
||||
lgInfo($"Connessione OK: {connectionOk} | adpRunning: {adpRunning}");
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -1606,7 +1605,7 @@ namespace IOB_WIN_NEXT
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
lgFatal(string.Format("Errore in TryConnect adapter SIEMENS: {0}{1}{2}", szStatusConnection, Environment.NewLine, exc));
|
||||
lgFatal($"Errore in TryConnect adapter SIEMENS | szStatusConnection {szStatusConnection}{Environment.NewLine}{exc}");
|
||||
connectionOk = false;
|
||||
needRefresh = true;
|
||||
}
|
||||
@@ -1617,7 +1616,7 @@ namespace IOB_WIN_NEXT
|
||||
connectionOk = false;
|
||||
if (doLog)
|
||||
{
|
||||
lgInfo(string.Format("Attenzione: SIEMENS controllo PING fallito per IP {0}", cIobConf.cncIpAddr));
|
||||
lgInfo($"Attenzione: SIEMENS controllo PING fallito per IP {cIobConf.cncIpAddr}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -229,7 +229,7 @@ namespace IOB_WIN_NEXT
|
||||
|
||||
case taskType.setParameter:
|
||||
// richiedo da URL i parametri WRITE da popolare
|
||||
lgInfo("Chiamata processMemWriteRequests");
|
||||
lgInfo("setParameter --> processMemWriteRequests");
|
||||
taskVal = processMemWriteRequests();
|
||||
// se restituiscce "" faccio altra prova...
|
||||
if (string.IsNullOrEmpty(taskVal))
|
||||
@@ -251,6 +251,8 @@ namespace IOB_WIN_NEXT
|
||||
taskVal = "SKIPPED | NO EXEC";
|
||||
break;
|
||||
}
|
||||
|
||||
lgInfo($"executeTask: {tName} | {taskVal}");
|
||||
// aggiungo task!
|
||||
taskDone.Add(item.Key, taskVal);
|
||||
if (!string.IsNullOrEmpty(memAddrWrite))
|
||||
@@ -262,6 +264,7 @@ namespace IOB_WIN_NEXT
|
||||
{
|
||||
// aggiorno valore memoria...
|
||||
memMap.mMapWrite[item.Key].value = item.Value;
|
||||
lgInfo($"Eseguita con successo S7WriteBB per executeTasks: {item.Key} | {item.Value}");
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user