diff --git a/IOB-UT-NEXT/Config/Base/CounterDto.cs b/IOB-UT-NEXT/Config/Base/CounterDto.cs
index f91fda64..f775982a 100644
--- a/IOB-UT-NEXT/Config/Base/CounterDto.cs
+++ b/IOB-UT-NEXT/Config/Base/CounterDto.cs
@@ -51,5 +51,10 @@ namespace IOB_UT_NEXT.Config.Base
///
public int SendPzcBlockMax { get; set; } = 100;
+ ///
+ /// Modalità set PzCount (contapezzi parziale) tra DIRECT / TASK
+ ///
+ public string SendPzCountMode { get; set; } = "";
+
}
}
diff --git a/IOB-UT-NEXT/Config/IobConfTree.cs b/IOB-UT-NEXT/Config/IobConfTree.cs
index 4f569638..6e0118ae 100644
--- a/IOB-UT-NEXT/Config/IobConfTree.cs
+++ b/IOB-UT-NEXT/Config/IobConfTree.cs
@@ -123,7 +123,7 @@ namespace IOB_UT_NEXT.Config
MaxErroriCheck = fIni.ReadInteger("OPTPAR", "MAX_ERR_CHECK", maxErrCheck),
MaxPingRetry = fIni.ReadInteger("OPTPAR", "MAX_PING_RETRY", 5),
MinDeltaSec = fIni.ReadInteger("IOB", "MinDeltaSec", 6),
- MultiIobList= fIni.ReadString("OPTPAR", "IOB_MULTI_CNAME", ""),
+ MultiIobList = fIni.ReadString("OPTPAR", "IOB_MULTI_CNAME", ""),
RelVers = $"{System.Reflection.Assembly.GetExecutingAssembly().GetName().Version}",
ResetAlarmOnStart = bool.Parse(fIni.ReadString("OPTPAR", "SEND_ALARM_RESET", "false")),
SenMachineConf = bool.Parse(fIni.ReadString("OPTPAR", "SEND_MACHINE_CONF", "true")),
@@ -346,6 +346,7 @@ namespace IOB_UT_NEXT.Config
newConfObj.Counters.ResetOnSetupStop = bool.Parse(fIni.ReadString("OPTPAR", "ENABLE_PZ_RESET_stopSetup", "false"));
newConfObj.Counters.SendPzcBlockMin = int.Parse(fIni.ReadString("OPTPAR", "MIN_SEND_PZC_BLOCK", "0"));
newConfObj.Counters.SendPzcBlockMax = int.Parse(fIni.ReadString("OPTPAR", "MAX_SEND_PZC_BLOCK", "100"));
+ newConfObj.Counters.SendPzCountMode = fIni.ReadString("OPTPAR", "SEND_PZCNT_MODE", "DIRECT");
exclOptPar.Add("ENABLE_SEND_PZC_BLOCK");
exclOptPar.Add("ENABLE_PZ_CNT");
@@ -355,6 +356,7 @@ namespace IOB_UT_NEXT.Config
exclOptPar.Add("ENABLE_PZ_RESET_stopSetup");
exclOptPar.Add("MIN_SEND_PZC_BLOCK");
exclOptPar.Add("MAX_SEND_PZC_BLOCK");
+ exclOptPar.Add("SEND_PZCNT_MODE");
// allarmi...
string jsonAlarms = fIni.ReadString("OPTPAR", "ALARM_CONF", "");
diff --git a/IOB-WIN-OPC-UA/IobOpc/OpcUaSiemens.cs b/IOB-WIN-OPC-UA/IobOpc/OpcUaSiemens.cs
index 9e5d4455..b71d2fa4 100644
--- a/IOB-WIN-OPC-UA/IobOpc/OpcUaSiemens.cs
+++ b/IOB-WIN-OPC-UA/IobOpc/OpcUaSiemens.cs
@@ -70,10 +70,18 @@ namespace IOB_WIN_OPC_UA.IobOpc
break;
case taskType.endProd:
+ forceDbSync = true;
+ // reset contapezzi inizio setup
+ if (IOBConfFull.Counters.ResetOnProdEnd)
+ {
+ addResetPzCount = true;
+ }
+ lgInfo($"Chiamato {tName} | addResetPzCount: {addResetPzCount}");
+ break;
case taskType.startSetup:
forceDbSync = true;
- // se richiesto reset aggiungo!
- if (IOBConfFull.OptPar.Count > 0 && getOptPar("ENABLE_PZ_RESET") == "TRUE")
+ // reset contapezzi inizio setup
+ if (IOBConfFull.Counters.ResetOnSetupStart)
{
addResetPzCount = true;
}
@@ -112,8 +120,7 @@ namespace IOB_WIN_OPC_UA.IobOpc
lgInfo("OpcUaSiemens.resetContapezziPLC 01");
bool answ = false;
// ...SE abilitato da conf IOB
- //if (IOBConfFull.OptPar.Count > 0 && getOptPar("ENABLE_PZ_RESET") == "TRUE")
- if(IOBConfFull.Counters.ResetOnSetupStart || IOBConfFull.Counters.ResetOnSetupStop || IOBConfFull.Counters.EnableSetPzCount || IOBConfFull.Counters.ResetOnProdEnd)
+ if (IOBConfFull.Counters.ResetOnSetupStart || IOBConfFull.Counters.ResetOnSetupStop || IOBConfFull.Counters.EnableSetPzCount || IOBConfFull.Counters.ResetOnProdEnd)
{
lgInfo("OpcUaSiemens.resetContapezziPLC 02");
// imposto un veto in lettura cmq x evitare problemi
@@ -152,7 +159,7 @@ namespace IOB_WIN_OPC_UA.IobOpc
}
else
{
- lgError("Impossibile effettuare RESET contapezzi, mancanza parametro OPT:ENABLE_PZ_RESET");
+ lgError("Impossibile effettuare RESET contapezzi, mancanza parametri IOBConfFull.Counters.*");
}
return answ;
}
@@ -168,17 +175,15 @@ namespace IOB_WIN_OPC_UA.IobOpc
if (memMap != null && memMap.mMapWrite.ContainsKey("forceSetPzCount"))
{
// modalità invio secondo richiesta
- string sendMode = getOptPar("SEND_PZCNT_MODE");
- if (sendMode == "TASK")
+ lgDebug($"OpcUaSiemens.setcontapezziPLC | {IOBConfFull.Counters.SendPzCountMode}");
+ if (IOBConfFull.Counters.SendPzCountMode == "TASK")
{
- lgDebug($"Generic.executeTasks | TASK");
Dictionary task2add = new Dictionary();
task2add.Add("forceSetPzCount", $"{newPzCount}");
executeTasks(task2add);
}
else
{
- lgDebug($"Generic.executeTasks | plcWriteParams");
// provare x Donati EMCO e Siemens Rama Tenditalia
var ListTempParams = new List();
// aggiungo reset caricamento
@@ -193,7 +198,7 @@ namespace IOB_WIN_OPC_UA.IobOpc
plcWriteParams(ref ListTempParams);
}
answ = true;
- lgInfo($"Eseguito scrittura OPC-UA su nodo setcontapezziPLC | sendMode: {sendMode}");
+ lgInfo($"Eseguito scrittura OPC-UA su nodo setcontapezziPLC | sendMode: {IOBConfFull.Counters.SendPzCountMode}");
}
else
{