using Newtonsoft.Json; using Newtonsoft.Json.Converters; using System; using System.Collections.Generic; namespace MapoSDK { #region oggetti per scambio dati IO - IOB public class fileEmbed { /// /// Array di file da inviare /// public List fileList { get; set; } = new List(); } /// /// Classe x definire un file (corto) inviato come Json tramite httpost /// public class smallFile { public string fileName { get; set; } = ""; public string content { get; set; } = ""; } /// /// Array elementi tipo KeyValuePair inviati come JSon che indicano lo stato LIVE dell'IOB /// public class liveIOB { public List> dataList { get; set; } } /// /// Array valori tipo flogData inviati come JSon /// public class flogJson { public List fluxData { get; set; } } /// /// Tracciato FluxLog in formato JSON valido /// public class flogData { /// /// nome del flusso /// public string flux { get; set; } = "ND"; /// /// Valore del dato di flusso registrato /// public string valore { get; set; } = "-"; /// /// DataOra evento /// public DateTime dtEve { get; set; } = DateTime.Now; /// /// DataOra corrente della trasmissione /// public DateTime dtCurr { get; set; } = DateTime.Now; /// /// Contatore incrementale x riordino invio (opzionale) /// public int cnt { get; set; } = 0; } /// /// Dati resoconto IOB /// public class IOB_data { public string name; public string IP; public IobType iType; public string typeCss; public bool CNC_Counter; } /// /// Struttura conf tipo dati /// public class dataConf { /// /// NOME parametro /// public string name { get; set; } = "none"; /// /// DESCRIZIONE parametro /// public string description { get; set; } = ""; /// /// Tipo di dato /// [JsonConverter(typeof(StringEnumConverter))] public plcDataType tipoMem { get; set; } = plcDataType.Int; /// /// Indice nell'area di memoria (da valore iniziale = 0) /// public int index { get; set; } = 0; /// /// Nome "assoluto" della posizione nell'area di memoria (anche diverso da indice) /// public string memAddr { get; set; } = ""; /// /// Size in byte /// public int size { get; set; } = 0; /// /// Fattore per eventuale divisione (es leggo 1234 --> 12,34 con factor=100) /// public int factor { get; set; } = 1; /// /// Valore parametro (come stringa, decimali con ",", default VUOTO), poi LETTO da PLC (o appena scritto) /// public string value { get; set; } = ""; /// /// Valore minimo ammesso (ove usato, es simulazione) /// public int minVal { get; set; } = 0; /// /// Valore massimo ammesso (ove usato, es simulazione) /// public int maxVal { get; set; } = 9999; } /// /// Classe gestione ITEM di un OBJ (machine) generico (read/write) /// public class objItem { /// /// UID univoco /// public string uid { get; set; } = ""; /// /// NOME item /// public string name { get; set; } = ""; /// /// Valore parametro (come stringa, decimali con ",", default VUOTO), sul CNC/PLC /// public string value { get; set; } = ""; /// /// DataOra ultima lettura /// public DateTime lastRead { get; set; } = DateTime.Now.AddHours(-1); /// /// Indica se sia abilitato in scrittura (WRITE) /// public bool writable { get; set; } = false; /// /// Indica il NUOVO valore richiesto x l'item /// public string reqValue { get; set; } = ""; /// /// DataOra ultima richiesta scrittura /// public DateTime lastRequest { get; set; } = DateTime.Now.AddDays(-1); /// /// Ultimo messaggio associato (conferma scrittura, errore, ...) /// public string lastMessage { get; set; } = ""; #if false /// /// Indica se il parametro sia stato salvato (value = newValue) oppure newValue NON impostato /// public bool saved { get { bool hasData = !string.IsNullOrWhiteSpace(value); bool areEqual = value == newValue; bool noWriteReq = string.IsNullOrWhiteSpace(newValue); return (areEqual || (hasData && noWriteReq)); } } #endif } /// /// Struttura conf tipo dati /// public class dataConfTSVC : dataConf { /// /// Tipo di funzione da applicare al dato /// [JsonConverter(typeof(StringEnumConverter))] public VC_func func { get; set; } = VC_func.MAX; /// /// Periodo campionamento /// public int period { get; set; } = 60; } /// /// Struttura conf memorie PLC (inizialmente SIEMENS) /// public class plcMemMap { /// /// Parametri ammessi per IOB x scrittura /// public Dictionary mMapWrite = new Dictionary(); /// /// Parametri ammessi per IOB x lettura /// public Dictionary mMapRead = new Dictionary(); } #endregion #if false /// /// Classe definizione parametri singolo ordine produzione /// public class OrdineProdArt { /// /// Codice univoco ordine /// public string OrdNum; /// /// Articolo associato ad ordine /// public Articolo ArtOrd; /// /// Quantità Articolo /// public int Qta; } /// /// Oggetto generico articolo /// public class Articolo { /// /// Codice articolo /// public string Codice; /// /// Descrizione Articolo /// public string Descrizione; } /// /// Classe definizione parametri ordine x KIT di articoli /// public class OrdineProdKit { /// /// Codice univoco ordine /// public string OrdNum; /// /// Codice KIT /// public string Codice; /// /// Vettore ordini articolo associati a KIT /// public List OrdiniArt; /// /// Quantità KIT /// public int Qta; } #endif }