CodeMaid cleanup x IobOpcUa
This commit is contained in:
@@ -12,7 +12,8 @@ namespace IOB_WIN_NEXT.IobOpc
|
||||
#region Public Constructors
|
||||
|
||||
/// <summary>
|
||||
/// Estende l'init della classe base, impiegando il pacchetto Nuget OPC-UA foundation con la gestione specifica per CMS/SCM (es. Eidos termoformatrice)
|
||||
/// Estende l'init della classe base, impiegando il pacchetto Nuget OPC-UA foundation con la
|
||||
/// gestione specifica per CMS/SCM (es. Eidos termoformatrice)
|
||||
/// https://github.com/OPCFoundation/UA-.NETStandard
|
||||
/// </summary>
|
||||
/// <param name="caller"></param>
|
||||
|
||||
@@ -12,7 +12,8 @@ namespace IOB_WIN_NEXT.IobOpc
|
||||
#region Public Constructors
|
||||
|
||||
/// <summary>
|
||||
/// Estende l'init della classe base, impiegando il pacchetto Nuget OPC-UA foundation con la gestione specifica per EWON (es Monti, Tenditalia)
|
||||
/// Estende l'init della classe base, impiegando il pacchetto Nuget OPC-UA foundation con la
|
||||
/// gestione specifica per EWON (es Monti, Tenditalia)
|
||||
/// https://github.com/OPCFoundation/UA-.NETStandard
|
||||
/// </summary>
|
||||
/// <param name="caller"></param>
|
||||
|
||||
@@ -8,7 +8,8 @@ namespace IOB_WIN_NEXT.IobOpc
|
||||
#region Public Constructors
|
||||
|
||||
/// <summary>
|
||||
/// Estende l'init della classe base, impiegando il pacchetto Nuget OPC-UA foundation con la gestione specifica per EWON (es Monti, Tenditalia)
|
||||
/// Estende l'init della classe base, impiegando il pacchetto Nuget OPC-UA foundation con la
|
||||
/// gestione specifica per EWON (es Monti, Tenditalia)
|
||||
/// https://github.com/OPCFoundation/UA-.NETStandard
|
||||
/// </summary>
|
||||
/// <param name="caller"></param>
|
||||
|
||||
@@ -10,7 +10,8 @@ namespace IOB_WIN_NEXT.IobOpc
|
||||
#region Public Constructors
|
||||
|
||||
/// <summary>
|
||||
/// Estende l'init della classe base, impiegando il pacchetto Nuget OPC-UA foundation con la gestione specifica per EWON (es Monti, Tenditalia)
|
||||
/// Estende l'init della classe base, impiegando il pacchetto Nuget OPC-UA foundation con la
|
||||
/// gestione specifica per EWON (es Monti, Tenditalia)
|
||||
/// https://github.com/OPCFoundation/UA-.NETStandard
|
||||
/// </summary>
|
||||
/// <param name="caller"></param>
|
||||
|
||||
@@ -11,7 +11,8 @@ namespace IOB_WIN_NEXT.IobOpc
|
||||
#region Public Constructors
|
||||
|
||||
/// <summary>
|
||||
/// Estende l'init della classe base, impiegando il pacchetto Nuget OPC-UA foundation con la gestione specifica per EWON (es Monti, Tenditalia)
|
||||
/// Estende l'init della classe base, impiegando il pacchetto Nuget OPC-UA foundation con la
|
||||
/// gestione specifica per EWON (es Monti, Tenditalia)
|
||||
/// https://github.com/OPCFoundation/UA-.NETStandard
|
||||
/// </summary>
|
||||
/// <param name="caller"></param>
|
||||
|
||||
@@ -9,22 +9,12 @@ namespace IOB_WIN_NEXT.IobOpc
|
||||
{
|
||||
public class OpcUaImas : OpcUa
|
||||
{
|
||||
#region Protected Fields
|
||||
|
||||
/// <summary>
|
||||
/// Modalità cambio ODL
|
||||
/// </summary>
|
||||
protected string CHANGE_ODL_MODE = "";
|
||||
|
||||
protected bool testDone = false;
|
||||
|
||||
#endregion Protected Fields
|
||||
|
||||
#region Public Constructors
|
||||
|
||||
/// <summary>
|
||||
/// Estende l'init della classe base, impiegando il pacchetto Nuget OPC-UA foundation con la
|
||||
/// gestione specifica per IMAS OPC-UA (es Jetco) https://github.com/OPCFoundation/UA-.NETStandard
|
||||
/// gestione specifica per IMAS OPC-UA (es Jetco)
|
||||
/// https://github.com/OPCFoundation/UA-.NETStandard
|
||||
/// </summary>
|
||||
/// <param name="caller"></param>
|
||||
/// <param name="IOBConf"></param>
|
||||
@@ -137,6 +127,17 @@ namespace IOB_WIN_NEXT.IobOpc
|
||||
|
||||
#endregion Public Methods
|
||||
|
||||
#region Protected Fields
|
||||
|
||||
/// <summary>
|
||||
/// Modalità cambio ODL
|
||||
/// </summary>
|
||||
protected string CHANGE_ODL_MODE = "";
|
||||
|
||||
protected bool testDone = false;
|
||||
|
||||
#endregion Protected Fields
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -13,7 +13,8 @@ namespace IOB_WIN_NEXT.IobOpc
|
||||
|
||||
/// <summary>
|
||||
/// Estende l'init della classe base, impiegando il pacchetto Nuget OPC-UA foundation con la
|
||||
/// gestione specifica per MBH OPC-UA (es OPC, Cimolai per Baglietto) https://github.com/OPCFoundation/UA-.NETStandard
|
||||
/// gestione specifica per MBH OPC-UA (es OPC, Cimolai per Baglietto)
|
||||
/// https://github.com/OPCFoundation/UA-.NETStandard
|
||||
/// </summary>
|
||||
/// <param name="caller"></param>
|
||||
/// <param name="IOBConf"></param>
|
||||
@@ -220,7 +221,6 @@ namespace IOB_WIN_NEXT.IobOpc
|
||||
|
||||
// se abilitata gestione ODL esegue eventuale chiusura
|
||||
|
||||
|
||||
// se abilitato watchdog...
|
||||
if (opcUaParams.WatchDog.IsEnabled)
|
||||
{
|
||||
|
||||
@@ -14,7 +14,8 @@ namespace IOB_WIN_NEXT.IobOpc
|
||||
|
||||
/// <summary>
|
||||
/// Estende l'init della classe base, impiegando il pacchetto Nuget OPC-UA foundation con la
|
||||
/// gestione specifica per MBH (es Cimolai, Baglietto) https://github.com/OPCFoundation/UA-.NETStandard
|
||||
/// gestione specifica per MBH (es Cimolai, Baglietto)
|
||||
/// https://github.com/OPCFoundation/UA-.NETStandard
|
||||
/// </summary>
|
||||
/// <param name="caller"></param>
|
||||
/// <param name="IOBConf"></param>
|
||||
@@ -62,8 +63,6 @@ namespace IOB_WIN_NEXT.IobOpc
|
||||
}
|
||||
}
|
||||
|
||||
protected bool EXEMODE_CHECK_BYPASS = false;
|
||||
|
||||
#endregion Public Constructors
|
||||
|
||||
#region Public Methods
|
||||
@@ -191,10 +190,16 @@ namespace IOB_WIN_NEXT.IobOpc
|
||||
|
||||
#region Protected Fields
|
||||
|
||||
protected bool EXEMODE_CHECK_BYPASS = false;
|
||||
protected int lastAct = 0;
|
||||
|
||||
protected bool lastIsInCorso = false;
|
||||
|
||||
/// <summary>
|
||||
/// Ultimo rum mode rilevato x decidere SE inviare variazione...
|
||||
/// </summary>
|
||||
protected int lastRunMode = -999;
|
||||
|
||||
protected int VETO_SEND_SNAPSHOT = 10;
|
||||
|
||||
protected DateTime vetoSnapshot = DateTime.Now;
|
||||
@@ -220,31 +225,6 @@ namespace IOB_WIN_NEXT.IobOpc
|
||||
|
||||
#region Protected Properties
|
||||
|
||||
/// <summary>
|
||||
/// Lavorazione in CORSO = da keyExeMode valore di PLC/DB231/InCorso
|
||||
/// </summary>
|
||||
protected bool isInCorso
|
||||
{
|
||||
get
|
||||
{
|
||||
bool answ = false;
|
||||
if (!string.IsNullOrEmpty(opcUaParams.keyExeMode))
|
||||
{
|
||||
string currExe = getDataItemValue(opcUaParams.keyExeMode);
|
||||
if (!string.IsNullOrEmpty(currExe))
|
||||
{
|
||||
bool.TryParse(currExe, out answ);
|
||||
}
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Ultimo rum mode rilevato x decidere SE inviare variazione...
|
||||
/// </summary>
|
||||
protected int lastRunMode = -999;
|
||||
|
||||
/// <summary>
|
||||
/// Attività corrente (INT) da keyRunMode valore di PLC/DB231/Attivita
|
||||
/// </summary>
|
||||
@@ -269,6 +249,26 @@ namespace IOB_WIN_NEXT.IobOpc
|
||||
|
||||
protected DateTime currTravelStateStart { get; set; } = DateTime.Today.AddYears(-1);
|
||||
|
||||
/// <summary>
|
||||
/// Lavorazione in CORSO = da keyExeMode valore di PLC/DB231/InCorso
|
||||
/// </summary>
|
||||
protected bool isInCorso
|
||||
{
|
||||
get
|
||||
{
|
||||
bool answ = false;
|
||||
if (!string.IsNullOrEmpty(opcUaParams.keyExeMode))
|
||||
{
|
||||
string currExe = getDataItemValue(opcUaParams.keyExeMode);
|
||||
if (!string.IsNullOrEmpty(currExe))
|
||||
{
|
||||
bool.TryParse(currExe, out answ);
|
||||
}
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Indica se abbia stato MANUAL x CIMOLAI
|
||||
/// </summary>
|
||||
|
||||
@@ -12,7 +12,8 @@ namespace IOB_WIN_NEXT.IobOpc
|
||||
#region Public Constructors
|
||||
|
||||
/// <summary>
|
||||
/// Estende l'init della classe base, impiegando il pacchetto Nuget OPC-UA foundation con la gestione specifica per Omron (es ICOEL)
|
||||
/// Estende l'init della classe base, impiegando il pacchetto Nuget OPC-UA foundation con la
|
||||
/// gestione specifica per Omron (es ICOEL)
|
||||
/// https://github.com/OPCFoundation/UA-.NETStandard
|
||||
/// </summary>
|
||||
/// <param name="caller"></param>
|
||||
|
||||
@@ -127,6 +127,76 @@ namespace IOB_WIN_NEXT.IobOpc
|
||||
#endregion Public Methods
|
||||
}
|
||||
|
||||
public class MesItemStatus
|
||||
{
|
||||
#region Public Constructors
|
||||
|
||||
public MesItemStatus(byte[] rawData)
|
||||
{
|
||||
Stato = (IcoelStatus)BitConverter.ToUInt16(rawData, 0);
|
||||
Velocita = BitConverter.ToUInt16(rawData, 2);
|
||||
Termico = !rawData.Skip(4).Take(1).FirstOrDefault().Equals(0);
|
||||
MagnetoTermico = !rawData.Skip(5).Take(1).FirstOrDefault().Equals(0);
|
||||
AvariaInverter = !rawData.Skip(6).Take(1).FirstOrDefault().Equals(0);
|
||||
}
|
||||
|
||||
#endregion Public Constructors
|
||||
|
||||
#region Public Properties
|
||||
|
||||
public bool AvariaInverter { get; set; } = false;
|
||||
public bool MagnetoTermico { get; set; } = false;
|
||||
public IcoelStatus Stato { get; set; } = 0;
|
||||
public bool Termico { get; set; } = false;
|
||||
public UInt16 Velocita { get; set; } = 0;
|
||||
|
||||
#endregion Public Properties
|
||||
|
||||
#region Public Methods
|
||||
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
// Object is not a GaugeModel instance
|
||||
if (!(obj is MesItemStatus item))
|
||||
return false;
|
||||
|
||||
if (Stato != item.Stato)
|
||||
return false;
|
||||
if (Velocita != item.Velocita)
|
||||
return false;
|
||||
if (Termico != item.Termico)
|
||||
return false;
|
||||
if (MagnetoTermico != item.MagnetoTermico)
|
||||
return false;
|
||||
if (AvariaInverter != item.AvariaInverter)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public override int GetHashCode()
|
||||
{
|
||||
return base.GetHashCode();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Converte un singolo item in un array di byte per scrittura su PLC S7
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public byte[] serialize()
|
||||
{
|
||||
byte[] answ = new byte[7];
|
||||
Buffer.BlockCopy(BitConverter.GetBytes((short)Stato), 0, answ, 0, 2);
|
||||
Buffer.BlockCopy(BitConverter.GetBytes(Velocita), 0, answ, 2, 2);
|
||||
Buffer.BlockCopy(BitConverter.GetBytes(Termico), 0, answ, 4, 1);
|
||||
Buffer.BlockCopy(BitConverter.GetBytes(MagnetoTermico), 0, answ, 5, 1);
|
||||
Buffer.BlockCopy(BitConverter.GetBytes(AvariaInverter), 0, answ, 6, 1);
|
||||
return answ;
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
}
|
||||
|
||||
public class OpcUaOmronIcoel : OpcUaOmron
|
||||
{
|
||||
#region Public Constructors
|
||||
@@ -533,76 +603,6 @@ namespace IOB_WIN_NEXT.IobOpc
|
||||
#endregion Protected Methods
|
||||
}
|
||||
|
||||
public class MesItemStatus
|
||||
{
|
||||
#region Public Constructors
|
||||
|
||||
public MesItemStatus(byte[] rawData)
|
||||
{
|
||||
Stato = (IcoelStatus)BitConverter.ToUInt16(rawData, 0);
|
||||
Velocita = BitConverter.ToUInt16(rawData, 2);
|
||||
Termico = !rawData.Skip(4).Take(1).FirstOrDefault().Equals(0);
|
||||
MagnetoTermico = !rawData.Skip(5).Take(1).FirstOrDefault().Equals(0);
|
||||
AvariaInverter = !rawData.Skip(6).Take(1).FirstOrDefault().Equals(0);
|
||||
}
|
||||
|
||||
#endregion Public Constructors
|
||||
|
||||
#region Public Properties
|
||||
|
||||
public bool AvariaInverter { get; set; } = false;
|
||||
public bool MagnetoTermico { get; set; } = false;
|
||||
public IcoelStatus Stato { get; set; } = 0;
|
||||
public bool Termico { get; set; } = false;
|
||||
public UInt16 Velocita { get; set; } = 0;
|
||||
|
||||
#endregion Public Properties
|
||||
|
||||
#region Public Methods
|
||||
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
// Object is not a GaugeModel instance
|
||||
if (!(obj is MesItemStatus item))
|
||||
return false;
|
||||
|
||||
if (Stato != item.Stato)
|
||||
return false;
|
||||
if (Velocita != item.Velocita)
|
||||
return false;
|
||||
if (Termico != item.Termico)
|
||||
return false;
|
||||
if (MagnetoTermico != item.MagnetoTermico)
|
||||
return false;
|
||||
if (AvariaInverter != item.AvariaInverter)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public override int GetHashCode()
|
||||
{
|
||||
return base.GetHashCode();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Converte un singolo item in un array di byte per scrittura su PLC S7
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public byte[] serialize()
|
||||
{
|
||||
byte[] answ = new byte[7];
|
||||
Buffer.BlockCopy(BitConverter.GetBytes((short)Stato), 0, answ, 0, 2);
|
||||
Buffer.BlockCopy(BitConverter.GetBytes(Velocita), 0, answ, 2, 2);
|
||||
Buffer.BlockCopy(BitConverter.GetBytes(Termico), 0, answ, 4, 1);
|
||||
Buffer.BlockCopy(BitConverter.GetBytes(MagnetoTermico), 0, answ, 5, 1);
|
||||
Buffer.BlockCopy(BitConverter.GetBytes(AvariaInverter), 0, answ, 6, 1);
|
||||
return answ;
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
}
|
||||
|
||||
public class PlantStatus
|
||||
{
|
||||
#region Public Constructors
|
||||
|
||||
@@ -13,7 +13,8 @@ namespace IOB_WIN_NEXT.IobOpc
|
||||
|
||||
/// <summary>
|
||||
/// Estende l'init della classe base, impiegando il pacchetto Nuget OPC-UA foundation con la
|
||||
/// gestione specifica per ULMA OPC-UA (es Giacovelli) https://github.com/OPCFoundation/UA-.NETStandard
|
||||
/// gestione specifica per ULMA OPC-UA (es Giacovelli)
|
||||
/// https://github.com/OPCFoundation/UA-.NETStandard
|
||||
/// </summary>
|
||||
/// <param name="caller"></param>
|
||||
/// <param name="IOBConf"></param>
|
||||
@@ -210,7 +211,6 @@ namespace IOB_WIN_NEXT.IobOpc
|
||||
|
||||
// se abilitata gestione ODL esegue eventuale chiusura
|
||||
|
||||
|
||||
// se abilitato watchdog...
|
||||
if (opcUaParams.WatchDog.IsEnabled)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user