diff --git a/IOB-WIN-NEXT/IOB-WIN-NEXT.csproj b/IOB-WIN-NEXT/IOB-WIN-NEXT.csproj
index d2fd3503..13fa0a4f 100644
--- a/IOB-WIN-NEXT/IOB-WIN-NEXT.csproj
+++ b/IOB-WIN-NEXT/IOB-WIN-NEXT.csproj
@@ -112,8 +112,8 @@
False
ExtLib\krcc.dll
-
- ..\packages\MapoSDK.6.14.2206.2708\lib\MapoSDK.dll
+
+ ..\packages\MapoSDK.6.14.2206.2718\lib\MapoSDK.dll
..\packages\MathNet.Numerics.4.15.0\lib\net461\MathNet.Numerics.dll
diff --git a/IOB-WIN-NEXT/IobGeneric.cs b/IOB-WIN-NEXT/IobGeneric.cs
index f4668f2a..d62bd989 100644
--- a/IOB-WIN-NEXT/IobGeneric.cs
+++ b/IOB-WIN-NEXT/IobGeneric.cs
@@ -1910,6 +1910,35 @@ namespace IOB_WIN_NEXT
return valTransl;
}
+ ///
+ /// Effettua conversione da valore bitmap ai valori configurati x allarme
+ ///
+ /// Configurazione banco allarmi
+ /// BitState allarmi
+ ///
+ public string getAlarmState(BaseAlarmConf memConf, byte[] bState)
+ {
+ string valTransl = "";
+ List descAttivi = new List();
+ BitArray bitAttivi = new BitArray(bState);
+ bool[] bitStati = new bool[bitAttivi.Count];
+ bitAttivi.CopyTo(bitStati, 0);
+ // cerco bit attivi
+ int idx = 0;
+ foreach (var item in bitStati)
+ {
+ if (item && memConf.messages.Count > idx)
+ {
+ string currState = memConf.messages[idx];
+ descAttivi.Add(currState);
+ }
+ idx++;
+ }
+ // combino string
+ valTransl = string.Join(",", descAttivi);
+ return valTransl;
+ }
+
///
/// Recupera eventuali allarmi CNC...
///
diff --git a/IOB-WIN-NEXT/IobIcoelSoap.cs b/IOB-WIN-NEXT/IobIcoelSoap.cs
index 19e35d1b..b308ff50 100644
--- a/IOB-WIN-NEXT/IobIcoelSoap.cs
+++ b/IOB-WIN-NEXT/IobIcoelSoap.cs
@@ -64,7 +64,96 @@ namespace IOB_WIN_NEXT
*
*---------------------------------------*/
- return base.executeTasks(task2exe);
+ // Verificare il protocollo: dovrebbe togliere SOLO i task eseguiti...
+ Dictionary taskDone = new Dictionary();
+ if (task2exe != null)
+ {
+ // controllo se memMap != null...
+ if (memMap != null)
+ {
+ bool taskOk = false;
+ string taskVal = "";
+ // cerco task specifici: se ho startSetup --> imposto bit DBB701.DBB0.4
+ foreach (var item in task2exe)
+ {
+ taskOk = false;
+ taskVal = "";
+ // converto richiesta in enum...
+ taskType tName = taskType.nihil;
+ Enum.TryParse(item.Key, out tName);
+ // controllo sulla KEY...
+ switch (tName)
+ {
+ case taskType.setSupplier:
+
+ // loggo i parametri ricevuti da popolare
+ lgInfo($"Chiamata setSupplier --> params payload: {item.Value}");
+ // recupero batch corrente x preselezionare i dati guid layout/varietà...
+ var currBatch = IcoelSizer.GetCurrentBatch();
+ // recupero GUID x variety e layout di default
+ var varGuid = currBatch[1].VarietyId;
+ var layGuid = currBatch[1].LayoutId;
+ // predispongo grower di default
+ GrowerInfo GrowerData = new GrowerInfo();
+ // le info sono una stringa separata da valore | di GrowerCode|GrowerName|varietyGuid|LayoutGuid;
+ string[] reqParams = item.Value.Split('|');
+ // se ho dati sistemo grower...
+ if (reqParams.Length >= 2)
+ {
+ GrowerData.GrowerCode = reqParams[0];
+ GrowerData.GrowerName = reqParams[1];
+ lgInfo($"Set grower data | GrowerCode: {GrowerData.GrowerCode} | GrowerName: {GrowerData.GrowerName}");
+ }
+ if (reqParams.Length >= 3)
+ {
+ Guid.TryParse(reqParams[2], out varGuid);
+ lgInfo($"Set Variety data | VarGUID: {varGuid}");
+ }
+ if (reqParams.Length >= 4)
+ {
+ Guid.TryParse(reqParams[3], out layGuid);
+ lgInfo($"Set Layout data | LayGUID: {layGuid}");
+ }
+
+ // invio richiesta!!!
+ IcoelSizer.EnqueueBatch(GrowerData, varGuid, layGuid);
+ lgInfo($"Request sent!");
+
+
+
+ taskVal = $"REQUEST SET SUPPLIER | EnqueueBatch | GrowCode: {GrowerData.GrowerCode} | GrowName: {GrowerData.GrowerName} | Var: {varGuid} | Lay: {layGuid} ";
+ // se restituiscce "" faccio altra prova...
+ if (string.IsNullOrEmpty(taskVal))
+ {
+ // i parametri me li aspetto come stringa composta paramName|paramvalue
+ if (item.Value.Contains("|"))
+ {
+ string[] paramsJob = item.Value.Split('|');
+ taskVal = $"REQUEST SET PARAMETERS: {paramsJob[0]} --> {paramsJob[1]}";
+ }
+ else
+ {
+ taskVal = $"WRONG REQUEST FOR SET PARAMETERS: {item.Value} doesnt contain pipe for splitting key/value";
+ }
+ }
+ break;
+
+ default:
+ taskVal = $"taskReq: {tName} | key: {item.Key} | val: {item.Value} | SKIPPED | NO EXEC";
+ lgInfo($"Chiamata senza processing: taskOk: {taskOk} | taskVal: {taskVal}");
+ break;
+ }
+ // aggiungo task!
+ taskDone.Add(item.Key, taskVal);
+ }
+ }
+ else
+ {
+ lgError($"Attenzione! memMap è nullo, non posso eseguire task2exe!");
+ }
+ }
+
+ return taskDone;
}
///
diff --git a/IOB-WIN-NEXT/IobModbusTCP.cs b/IOB-WIN-NEXT/IobModbusTCP.cs
index e811c1cd..12f10664 100644
--- a/IOB-WIN-NEXT/IobModbusTCP.cs
+++ b/IOB-WIN-NEXT/IobModbusTCP.cs
@@ -20,11 +20,6 @@ namespace IOB_WIN_NEXT
public class IobModbusTCP : IobGeneric
{
- ///
- /// Valore da gestire come delta degli indirizzi configurati
- ///
- private int deltaBase { get; set; } = 0;
-
#region Public Constructors
/// Classe base con i metodi x ModBusTCP
@@ -248,6 +243,25 @@ namespace IOB_WIN_NEXT
outVal = new Dictionary();
tryConnect();
}
+ // ora aggiungo (se ci fossero) gli allarmi...
+ if (alarmMaps != null && alarmMaps.Count > 0)
+ {
+ if (hasAlarms)
+ {
+ foreach (var item in alarmMaps)
+ {
+ var currState = currAlarmsState(item);
+ // calcolo vettore stringa degli allarmi...
+ string bankVal = getAlarmState(item, currState);
+ // se !=null --> accodo
+ if (!string.IsNullOrEmpty(bankVal))
+ {
+ // accodo al dictionary our
+ outVal.Add(item.description, bankVal);
+ }
+ }
+ }
+ }
}
}
else
@@ -665,6 +679,56 @@ namespace IOB_WIN_NEXT
#region Protected Methods
+ ///
+ /// Restituisce stato allarmi in formato byte[]
+ ///
+ ///
+ ///
+ protected byte[] currAlarmsState(BaseAlarmConf item)
+ {
+ byte[] answ = new byte[item.size];
+ int currStatus = 0;
+ int[] listInt = new int[2];
+ // banchi in array Int16 --> scompongo
+ for (int i = 0; i < item.size / 2; i++)
+ {
+ // verifico se usare LUT
+ bool useLUT = memSetR != null && memSetR.Count > 0;
+ if (useLUT)
+ {
+ int lutAddress = 40000 + item.index;
+ if (HoldingRegisterLUT.ContainsKey(lutAddress))
+ {
+ try
+ {
+ listInt = HoldingRegisterLUT[lutAddress];
+ }
+ catch (Exception exc)
+ {
+ lgError($"Errore in lettura da HoldingRegisterLUT per indirizzo {lutAddress} | item {item.memAddr}{Environment.NewLine}{exc}");
+ }
+ }
+ }
+ else
+ {
+ listInt = readInputReg(item.index, item.size);
+ }
+ currStatus = ModbusClient.ConvertRegistersToInt(listInt);
+
+ // aggiornamento blink counters dato nuovo valore
+ item.checkBlinkCounter(i, (uint)currStatus);
+
+ // calcolo indice errori
+ if ((uint)(item.alarmsMask[i] & currStatus) > 0)
+ {
+ var currByte = BitConverter.GetBytes(currStatus);
+ // salvo nell'array di byte
+ Buffer.BlockCopy(currByte, 0, answ, i * 2, 2);
+ }
+ }
+ return answ;
+ }
+
///
/// Decodifica il resto dell'area x i dati accessori (allarmi, ...)
///
@@ -823,7 +887,7 @@ namespace IOB_WIN_NEXT
parametri.memSizeWrite = fIni.ReadInteger("MEMORY", "SIZE_WRITE", 0);
parametri.holdRegBaseAddr = fIni.ReadInteger("MEMORY", "HR_BASE_ADDR", 40001);
// valore delta base
- deltaBase= fIni.ReadInteger("MEMORY", "DELTA_BASE", 0);
+ deltaBase = fIni.ReadInteger("MEMORY", "DELTA_BASE", 0);
// salvo vettori memoria...
lgInfoStartup("Set RawInput dimensions...");
RawInput = new byte[parametri.memSizeRead];
@@ -1047,6 +1111,15 @@ namespace IOB_WIN_NEXT
#endregion Private Fields
+ #region Private Properties
+
+ ///
+ /// Valore da gestire come delta degli indirizzi configurati
+ ///
+ private int deltaBase { get; set; } = 0;
+
+ #endregion Private Properties
+
#region Private Methods
///
@@ -1074,7 +1147,6 @@ namespace IOB_WIN_NEXT
}
break;
-
case plcDataType.FloatCDAB:
if (size == 4)
{
diff --git a/IOB-WIN-NEXT/packages.config b/IOB-WIN-NEXT/packages.config
index 91402c2a..19c265f4 100644
--- a/IOB-WIN-NEXT/packages.config
+++ b/IOB-WIN-NEXT/packages.config
@@ -6,7 +6,7 @@
-
+