using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
namespace MapoSDK
{
///
/// nuovo stato ingressi e eventuale evento da inviare
///
public struct hwMachineState
{
#region Public Fields
public int IdxTipoEvento;
public int next_IdxMicroStato;
#endregion Public Fields
#region Public Methods
public static bool operator !=(hwMachineState left, hwMachineState right)
{
return !(left == right);
}
public static bool operator ==(hwMachineState left, hwMachineState right)
{
return left.Equals(right);
}
public override bool Equals(object obj)
{
if (!(obj is hwMachineState item))
return false;
if (IdxTipoEvento != item.IdxTipoEvento)
return false;
if (next_IdxMicroStato != item.next_IdxMicroStato)
return false;
return true;
}
public override int GetHashCode()
{
return base.GetHashCode();
}
#endregion Public Methods
}
///
/// Struttura gestione comandi di input
///
public struct inputComandoMapo
{
#region Public Fields
///
/// descrizione comando
///
public string descrComando;
///
/// idx evento associato al comando
///
public int idxTipoEvento;
///
/// input comando valido si/no
///
public bool isValid;
///
/// refresh stato macchina encessario si/no
///
public bool needStatusRefresh;
///
/// valore di output dal comando
///
public string outValue;
///
/// input precedente
///
public string precInput;
///
/// testo da mostrare all'utente
///
public string text2show;
///
/// lista del nome dei WebBrowserBox e delle relative url, nel formato {0}##{1} {0}=nome
/// WebBrowserBox (es. box01), {1}=url relativo (es. http://server/MoonPro/Produzione.aspx?idxMacchina=99)
///
public string[] wBrowsBoxUrls;
#endregion Public Fields
#region Public Methods
public static bool operator !=(inputComandoMapo left, inputComandoMapo right)
{
return !(left == right);
}
public static bool operator ==(inputComandoMapo left, inputComandoMapo right)
{
return left.Equals(right);
}
public override bool Equals(object obj)
{
if (!(obj is inputComandoMapo item))
return false;
if (descrComando != item.descrComando)
return false;
if (idxTipoEvento != item.idxTipoEvento)
return false;
if (isValid != item.isValid)
return false;
if (needStatusRefresh != item.needStatusRefresh)
return false;
if (outValue != item.outValue)
return false;
if (precInput != item.precInput)
return false;
if (text2show != item.text2show)
return false;
if (wBrowsBoxUrls != item.wBrowsBoxUrls)
return false;
return true;
}
public override int GetHashCode()
{
return base.GetHashCode();
}
#endregion Public Methods
}
///
/// Classe di base per trasferimento informazioni di tipo RawTransfer
///
public class BaseRawTransf
{
#region Public Constructors
///
/// Costruttore senza parametri
///
public BaseRawTransf()
{
this.dataRif = DateTime.Now;
this.mesContent = new JObject();
this.mesType = rawTransfType.ND;
}
///
/// Costruttore oggetto
///
///
///
///
public BaseRawTransf(DateTime dataRif, JObject mesContent, rawTransfType mesType)
{
this.dataRif = dataRif;
this.mesContent = mesContent;
this.mesType = mesType;
}
#endregion Public Constructors
#region Public Properties
///
/// Data-Ora riferimento (x ordinamento fifo)
///
public DateTime dataRif { get; set; } = DateTime.Now;
///
/// Messaggio in modalità raw/stringa
///
public JObject mesContent { get; set; } = new JObject();
///
/// Tipo di messaggio trasmesso
///
public rawTransfType mesType { get; set; } = rawTransfType.ND;
#endregion Public Properties
}
///
/// Classe x inviare messaggi di tipo esecuzione di una generica esecuzione
///
public class exeResult
{
#region Public Properties
///
/// Esito del risultato
///
[JsonConverter(typeof(StringEnumConverter))]
public esitoExec esito { get; set; } = esitoExec.undone;
///
/// Messaggio associato
///
public string message { get; set; } = "";
#endregion Public Properties
}
///
/// Dati resoconto IOB
///
public class IOB_data
{
#region Public Fields
public bool CNC_Counter;
public string IP;
public IobType iType;
public string name;
public string typeCss;
#endregion Public Fields
}
///
/// Rappresentazione dello stato corrente dell'IOB
///
public class IobWinCurrentState
{
#region Public Properties
///
/// Contatore IOB
///
public float counterIOB { get; set; } = 0;
///
/// Contatore Macchina
///
public float counterMAC { get; set; } = 0;
///
/// Ultimo stato noto dei parametri in memoria letti da PLC
///
public Dictionary currParams { get; set; } = null;
///
/// DataOra ultima comunicazione IN (con PLC)
///
public DateTime lastDataIn { get; set; } = DateTime.Now.AddYears(-1);
///
/// DataOra ultima comunicazione OUT (con MP Server)
///
public DateTime lastDataOut { get; set; } = DateTime.Now.AddYears(-1);
///
/// Lunghezza coda EVENTI in uscita
///
public int queueEvLen { get; set; } = 0;
///
/// Lunghezza coda FluxLog in uscita
///
public int queueFLogLen { get; set; } = 0;
///
/// Semaforo IN (IOB-PLC)
///
public Semaforo SemIn { get; set; } = Semaforo.ND;
///
/// Semaforo OUT (IOB-MPserver)
///
public Semaforo SemOut { get; set; } = Semaforo.ND;
#endregion Public Properties
}
///
/// Array elementi tipo KeyValuePair inviati come JSon che indicano lo stato LIVE dell'IOB
///
public class liveIOB
{
#region Public Properties
public List> dataList { get; set; }
#endregion Public Properties
}
///
/// Descrittore oggetto DataItem generico
///
public class machDataItem
{
#region Public Constructors
public machDataItem()
{ }
#endregion Public Constructors
#region Public Properties
///
/// Categoria oggetto
///
public DataItemCategory Category { get; set; }
///
/// Nome / descrizione
///
public string Name { get; set; }
///
/// Tipologia specifica
///
public string SubType { get; set; }
///
/// Tipologia principale
///
public string Type { get; set; }
///
/// Unità di misura
///
public string Units { get; set; }
///
/// ID generico
///
public string uuid { get; set; }
#endregion Public Properties
}
///
/// Configurazione delle macchine MTC
///
public class MtcSetup
{
#region Public Properties
///
/// Setup della macchina
///
public List dataItems { get; set; }
///
/// IdxMacchina cui ci riferiamo
///
public string idxMacchina { get; set; } = "";
#endregion Public Properties
}
///
/// Classe gestione ITEM di un OBJ (machine) generico (read/write)
///
public class objItem
{
#region Public Properties
///
/// DESCRIZIONE item
///
public string description { get; set; } = "-";
///
/// Ultimo messaggio associato (conferma scrittura, errore, ...)
///
public string lastMessage { get; set; } = "";
///
/// DataOra ultima lettura
///
public DateTime lastRead { get; set; } = DateTime.Now.AddMinutes(-5);
///
/// DataOra ultima richiesta scrittura
///
public DateTime lastRequest { get; set; } = DateTime.Now.AddMinutes(-5);
///
/// NOME item
///
public string name { get; set; } = ".";
///
/// Indica il NUOVO valore richiesto x l'item
///
public string reqValue { get; set; } = "";
///
/// UID univoco
///
public string uid { get; set; } = "";
///
/// Unità Misura parametro
///
public string UM { get; set; } = "#";
///
/// Valore MASSIMO (SE impostato)
///
public double valMax { get; set; }
///
/// Valore minimo (SE impostato)
///
public double valMin { get; set; }
///
/// Valore parametro (come stringa, decimali con ",", default VUOTO), sul CNC/PLC
///
public string value { get; set; } = "";
///
/// Indica se sia abilitato in scrittura (WRITE)
///
public bool writable { get; set; } = false;
///
/// Valore per determinare Display Ordinal (es pagina TAB / invio parametri)
///
public int displOrdinal { get; set; } = 0;
#endregion Public Properties
}
///
/// Struttura conf memorie PLC (inizialmente SIEMENS)
///
public class plcMemMap
{
#region Public Fields
///
/// Parametri ammessi per IOB x lettura
///
public Dictionary mMapRead = new Dictionary();
///
/// Parametri ammessi per IOB x scrittura
///
public Dictionary mMapWrite = new Dictionary();
#endregion Public Fields
}
///
/// Classe gesitone conteggi produzione
///
public class prodCounter
{
#region Public Properties
///
/// NUmero pezzi CONFERMATI
///
public int numPzConf { get; set; } = 0;
///
/// Numero pezzi ORDINATI
///
public int numPzOrd { get; set; } = 0;
///
/// Numero pezzi PRODOTTI
///
public int numPzProd { get; set; } = 0;
#endregion Public Properties
}
///
/// Array valori tipo BaseRawTransf inviati come JSon
///
public class rawTransfJsonPayload
{
#region Public Properties
public List rawTransfData { get; set; }
#endregion Public Properties
}
///
/// Tracciato RegGiacenze x insert da IOB
///
public class RegGiacenze
{
#region Public Properties
public DateTime DateRif { get; set; } = DateTime.Today;
public string ExtDoc { get; set; } = "";
public string IdentRG { get; set; } = "";
public int IdxODL { get; set; } = 0;
public string Notes { get; set; } = "";
public int NumPack { get; set; } = 0;
public string Product { get; set; } = "";
public double QtyTot { get; set; } = 0;
public string Supplier { get; set; } = "";
public string Variety { get; set; } = "";
#endregion Public Properties
}
public class StCheckOverride
{
#region Public Properties
public bool CanForce { get; set; } = false;
public string CodGruppo { get; set; } = "";
public string CodTipo { get; set; } = "";
public int IdxST { get; set; } = 0;
public int Num { get; set; } = 0;
public int Oggetto { get; set; } = 0;
#endregion Public Properties
}
}