Merge remote-tracking branch 'origin/develop' into Feature/Giacovelli
This commit is contained in:
@@ -112,8 +112,8 @@
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>ExtLib\krcc.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="MapoSDK, Version=6.14.2206.2708, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\MapoSDK.6.14.2206.2708\lib\MapoSDK.dll</HintPath>
|
||||
<Reference Include="MapoSDK, Version=6.14.2206.2718, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\MapoSDK.6.14.2206.2718\lib\MapoSDK.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="MathNet.Numerics, Version=4.15.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\MathNet.Numerics.4.15.0\lib\net461\MathNet.Numerics.dll</HintPath>
|
||||
|
||||
@@ -1910,6 +1910,35 @@ namespace IOB_WIN_NEXT
|
||||
return valTransl;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Effettua conversione da valore bitmap ai valori configurati x allarme
|
||||
/// </summary>
|
||||
/// <param name="memConf">Configurazione banco allarmi</param>
|
||||
/// <param name="bState">BitState allarmi</param>
|
||||
/// <returns></returns>
|
||||
public string getAlarmState(BaseAlarmConf memConf, byte[] bState)
|
||||
{
|
||||
string valTransl = "";
|
||||
List<string> descAttivi = new List<string>();
|
||||
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;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Recupera eventuali allarmi CNC...
|
||||
/// </summary>
|
||||
|
||||
@@ -64,7 +64,96 @@ namespace IOB_WIN_NEXT
|
||||
*
|
||||
*---------------------------------------*/
|
||||
|
||||
return base.executeTasks(task2exe);
|
||||
// Verificare il protocollo: dovrebbe togliere SOLO i task eseguiti...
|
||||
Dictionary<string, string> taskDone = new Dictionary<string, string>();
|
||||
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;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -20,11 +20,6 @@ namespace IOB_WIN_NEXT
|
||||
|
||||
public class IobModbusTCP : IobGeneric
|
||||
{
|
||||
/// <summary>
|
||||
/// Valore da gestire come delta degli indirizzi configurati
|
||||
/// </summary>
|
||||
private int deltaBase { get; set; } = 0;
|
||||
|
||||
#region Public Constructors
|
||||
|
||||
/// Classe base con i metodi x ModBusTCP </summary> <param name="caller"></param> <param name="adpConf"></param>
|
||||
@@ -248,6 +243,25 @@ namespace IOB_WIN_NEXT
|
||||
outVal = new Dictionary<string, string>();
|
||||
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
|
||||
|
||||
/// <summary>
|
||||
/// Restituisce stato allarmi in formato byte[]
|
||||
/// </summary>
|
||||
/// <param name="item"></param>
|
||||
/// <returns></returns>
|
||||
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;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Decodifica il resto dell'area x i dati accessori (allarmi, ...)
|
||||
/// </summary>
|
||||
@@ -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
|
||||
|
||||
/// <summary>
|
||||
/// Valore da gestire come delta degli indirizzi configurati
|
||||
/// </summary>
|
||||
private int deltaBase { get; set; } = 0;
|
||||
|
||||
#endregion Private Properties
|
||||
|
||||
#region Private Methods
|
||||
|
||||
/// <summary>
|
||||
@@ -1074,7 +1147,6 @@ namespace IOB_WIN_NEXT
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case plcDataType.FloatCDAB:
|
||||
if (size == 4)
|
||||
{
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<package id="EgwProxy.MultiCncLib" version="3.6.2205.2319" targetFramework="net462" />
|
||||
<package id="EgwProxy.OsaiCncLib" version="3.6.2205.2015" targetFramework="net462" />
|
||||
<package id="EntityFramework" version="6.4.4" targetFramework="net462" />
|
||||
<package id="MapoSDK" version="6.14.2206.2708" targetFramework="net462" />
|
||||
<package id="MapoSDK" version="6.14.2206.2718" targetFramework="net462" />
|
||||
<package id="MathNet.Numerics" version="4.15.0" targetFramework="net462" />
|
||||
<package id="Microsoft.CodeAnalysis.NetAnalyzers" version="6.0.0" targetFramework="net462" developmentDependency="true" />
|
||||
<package id="Microsoft.VisualStudio.SlowCheetah" version="4.0.8" targetFramework="net462" developmentDependency="true" />
|
||||
|
||||
Reference in New Issue
Block a user