using Newtonsoft.Json; using Newtonsoft.Json.Converters; using System; using System.Collections.Generic; namespace NKC_SDK { #region classi per NESTING /// /// Classe che rappresenta la richiesta di AZIONI al NESTING /// public class commandRequest { /// /// ID del processo richiesto (generato in fase di import) /// public int BatchID { get; set; } /// /// Richiesta per il nesting: DoNesting / HaltNesting /// public string ActionRequested { get; set; } } /// /// Classe che rappresenta la richiesta di processing di NESTING da inserire in REDIS /// public class batchRequest { /// /// ID del processo richiesto (generato in fase di import) /// public int BatchId { get; set; } /// /// ID univoco dell'invio del TASK /// public string EnvNum { get; set; } = ""; /// /// tempo amssimo eprmesso x nesting (minuti) /// public int MaxTime { get; set; } /// /// Tipo di processing richiesto /// 1 = stima /// 2 = nesting /// public int ProcType { get; set; } /// /// Codice della macchina x cui si effettua richeista /// [JsonConverter(typeof(StringEnumConverter))] public mType MachineType { get; set; } /// /// Tipo di ordine richiesto /// // riportato a numero //[JsonConverter(typeof(StringEnumConverter))] public oType OrderType { get; set; } /// /// Elenco ordini richeisti da processare / nestare /// public List OrderList { get; set; } } /// /// Struttura Ordine passata a NESTING /// public class Order { /// /// ID Ordine (da DB) /// public int OrderId { get; set; } = 0; /// /// Cod ordine di NKC /// public string OrderCod { get; set; } /// /// Codice ordine esterno da cliente (HFA) /// public string OrderExtCode { get; set; } /// /// Plant di destinazione /// public string DestPlant { get; set; } /// /// Elenco dei KIT dell'ordine /// public List KitList { get; set; } } /// /// Oggetto KIT /// public class Kit { /// /// ID KIT (da DB) /// public int KitId { get; set; } = 0; /// /// Codice KIT da cod ordine ext /// public string KitExtCode { get; set; } = ""; /// /// Elenco Items da produrre x KIT /// public List PartList { get; set; } } /// /// Struttura Item passata a NESTING /// public class Part { /// /// Cod ITEM di NKC /// public int PartId { get; set; } = 0; /// /// Codice ITEM esterno da cliente (HFA) /// public string PartExtCode { get; set; } /// /// Codice Datamatrix dell'ITEM /// public string PartDtmx { get; set; } = ""; /// /// Quantità di Item per SINGOLO ordine /// public int PartQty { get; set; } /// /// ID del materiale dell'item /// public int MatId { get; set; } /// /// Path del disegno CAD dell'item da produrre x NESTING /// public string CadFilePath { get; set; } /// /// Parametri opzionali (es x risposta NESTING) /// public Dictionary OptParameters { get; set; } = null; } /// /// Descrizione di un ITEM in fase di scarico /// public class PartUnload : Part { /// /// Destinazione dell'item /// public ItemDest NextDest { get; set; } = ItemDest.Undef; /// /// Stato dell'item /// public ItemStatus Status { get; set; } = ItemStatus.Undef; /// /// Elenco di Secop opzionali (es T-NUT, RoundEdge) /// public List SecOp { get; set; } = new List(); } /// /// Classe Sheet x Nesting /// public class NestSheet { /// /// Identificativo univoco Sheet /// public String SheetId { get; set; } = ""; /// /// Indice dello sheet /// public int SheetIndex { get; set; } = 0; /// /// Materiale /// public int MatId { get; set; } /// /// Tempo STIMATO di taglio calcolato dal Nesting espresso in Secondi /// public double EstimatedWorktime { get; set; } = 0; /// /// Superficie WORK (lavorata/tagliata) del foglio lavorato (= somma area dei pezzi disposti) /// public double SurfaceWork { get; set; } = 0; /// /// Superficie totale del foglio lavorato (= materiale) /// public double SurfaceTotal { get; set; } = 1; /// /// Resa (OEE) dell'impiego del materiale /// public double SurfaceOEE { get { double answ = 0; try { answ = SurfaceWork / SurfaceTotal; } catch { } return answ; } } /// /// Programma x printing /// public string PrintProgram { get; set; } = ""; /// /// Programma x Machining /// public string MachiningProgram { get; set; } = ""; /// /// SVG del lavoro previsto /// public string Drawing { get; set; } = ""; /// /// Elenco Part da produrre x ordine /// public List PartList { get; set; } = null; /// /// Eventuale remnant /// public NestRemn Remnant { get; set; } } /// /// Dati di un foglio di Remnant /// public class NestRemn { /// /// Dimensione L del remnant /// public decimal L_mm { get; set; } = 0; /// /// Dimensione W del remnant /// public decimal W_mm { get; set; } = 0; } /// /// Struttura stack /// public class NestBunk { /// /// Identificativo univoco stack /// public String BunkId { get; set; } = ""; /// /// Indice del Bunk /// public int BunkIndex { get; set; } = 0; /// /// Num di fogli nello stack /// public int NumSheet { get { int answ = 0; if (SheetList != null) { answ = SheetList.Count; } return answ; } } /// /// Elenco Sheet previsti /// public List SheetList { get; set; } } /// /// Definizione classe x materiali /// public class Material { public int MatId { get; set; } = 0; public int MatExtCode { get; set; } = 0; public string MatDesc { get; set; } = ""; public DateTime ApprovDate { get; set; } = DateTime.Now; public string ApprovUser { get; set; } = ""; public decimal L_mm { get; set; } = 0; public decimal W_mm { get; set; } = 0; public decimal T_mm { get; set; } = 0; public string MatDtmx { get; set; } = ""; } /// /// Classe che rappresenta stato ordine ricevuto via REDIS da NESTING /// public class baseNestAnsw { /// /// ID univoco invio del TASK /// public string EnvNum { get; set; } = ""; /// /// Tipo di processing richiesto /// 1 = stima /// 2 = nesting /// public int ProcType { get; set; } = 0; /// /// Codice della amcchina x cui si effettua richiesta /// [JsonConverter(typeof(StringEnumConverter))] public mType MachineType { get; set; } = mType.Multiax; /// /// Tipo di ordine richiesto /// [JsonConverter(typeof(StringEnumConverter))] public oType OrderType { get; set; } = oType.BatchRequest; /// /// Status del processo di nesting /// public procStatus ProcessStatus { get; set; } = procStatus.waiting; /// /// Note libere del nesting /// public string ProcessNotes { get; set; } = ""; /// /// Tempo di processing del Nesting espresso in Secondi /// public double ProcessingRuntime { get; set; } = 0; /// /// Tempo STIMATO di taglio calcolato dal Nesting espresso in Secondi /// public double EstimatedWorktime { get; set; } = 0; /// /// Elenco errori riscontrati /// public List ErrorList { get; set; } = null; } /// /// Risposta NESTING x la STIMA iniziale /// public class nestReplyBatchInitial : orderStatus { /// /// Elenco Items da produrre x ordine /// public List PartList { get; set; } } /// /// Risposta NESTING x la STIMA iniziale /// public class nestReplyBatchFinal : orderStatus { /// /// Elenco Stack previsti /// public List BunkList { get; set; } /// /// Elenco Carts /// public List CartList { get; set; } /// /// Elenco Bin /// public List BinList { get; set; } } /// /// Dati di un Cart post nesting /// public class NestCart { /// /// Indice del CART nel TAKC / giorno /// public int CartIndex { get; set; } = 0; /// /// Elenco dei KIT dell'ordine /// public List KitList { get; set; } } /// /// Dati di un Cart post nesting /// public class NestBin { /// /// Indice del BIN nel TAKT / giorno /// public int BinIndex { get; set; } = 0; /// /// Elenco dei PART/ITEM dell'Ordine /// public List PartList { get; set; } } /// /// Classe che rappresenta stato ordine ricevuto via REDIS da NESTING /// public class orderStatus : baseNestAnsw { /// /// ID del processo di Nesting in corso (generato in fase di import) /// public int BatchID { get; set; } } public class nestReplyOffOrd : orderStatus { /// /// ID dell'ordine offlien da processare /// public string OffOrderID { get; set; } = ""; /// /// Num di fogli nello stack /// public int NumSheet { get { int answ = 0; if (SheetList != null) { answ = SheetList.Count; } return answ; } } /// /// Elenco Sheet previsti /// public List SheetList { get; set; } } /// /// Oggetto errore da poter rispondere con chiamate x stima/nesting /// public class ErrorRep { /// /// DataOra registrazione record /// public DateTime DtRif { get; set; } = DateTime.Now; /// /// Tipo di errore /// public string ErrType { get; set; } = "NA"; /// /// Chiave di riferimento PARENT per l'errore (es il codice del batch, dell'item) /// es: BatchId.OrderId.Row /// public string ParentUid { get; set; } = "A.B.C"; /// /// Chiave univoca per l'errore /// es: BatchId.OrderId.Row.PartId... /// public string Uid { get; set; } = "A.B.C.D"; /// /// Descrizione estesa (human readable) dell'errore /// public string Description { get; set; } = ""; } #endregion #region classi per PROD /// /// dati del materiale /// public class MaterialData { /// /// Identificativo univoco del materiale (DA ANAGRAFICA db) /// public int MaterialId { get; set; } /// /// Codice P/N del materiale (cliente) /// public string MaterialPN { get; set; } /// /// Codice P/N del materiale (cliente) /// public string MaterialDescription { get; set; } } /// /// Dati della lavorazione /// public class WorkData { /// /// Indica che la lavorazione è stata eseguita con successo (default = true) /// public bool Success { get; set; } /// /// Percorso del programma da eseguire /// public string ProgramPath { get; set; } /// /// Data inizio processing /// public DateTime? DtStart { get; set; } /// /// Data fine processing /// public DateTime? DtEnd { get; set; } /// /// Tempo di lavorazione in minuti decimali /// public double WorkTimeMin { get { double answ = 0; if (DtStart != null && DtEnd != null) { try { answ = ((DateTime)DtEnd).Subtract((DateTime)DtStart).TotalMinutes; } catch { } } return answ; } } } /// /// Estensione classe sheet comprensiva di BunkId /// public class ProdSheetExt : ProdSheet { /// /// Identificativo univoco BUNK / Stack /// public int BunkId { get; set; } /// /// INDICE del pannello (valido per BUNK) /// public int SheetIndex { get; set; } } /// /// Singolo Pannello IN LAVORAZIONE /// public class ProdSheet { /// /// Identificativo univoco pannello /// public int SheetId { get; set; } /// /// Materiale /// public MaterialData Material { get; set; } /// /// Stato del pannello /// public PStatus Status { get; set; } /// /// Tempi processo x fase printing /// public WorkData Printing { get; set; } /// /// Tempi processo x fase CNC /// public WorkData Machining { get; set; } /// /// Tempi processo x scarico /// public WorkData Unloading { get; set; } } /// /// Classe che rappresenta un insieme di Sheet da lavorare (contenuti in 1 o + bunk) /// public class SheetWorkList { /// /// Elenco dei pannelli (sheets) in lavorazione /// public List SheetList { get; set; } /// /// Numero di Sheets da lavorare /// public int NumSheets { get { int answ = 0; try { answ = SheetList.Count; } catch { } return answ; } } } /// /// Classe che rappresenta i BUNK da lavorare /// public class ProdBunk { /// /// Identificativo univoco BUNK / Stack /// public int BunkId { get; set; } /// /// Stato dello Stack di pannelli /// public CStatus Status { get; set; } /// /// Codice dataMatrix del BUNK /// public string DataMatrix { get; set; } /// /// Data inizio processing del BUNK /// public DateTime DtStart { get; set; } /// /// Data inizio processing dello Stack /// public DateTime DtEnd { get; set; } /// /// Elenco dei pannelli(sheets) dello Stack /// public List SheetList { get; set; } /// /// Numero di Sheets da lavorare /// public int NumSheets { get { int answ = 0; try { answ = SheetList.Count; } catch { } return answ; } } } /// /// Valori decodificati /// public class decodedData { /// /// Tipo codice decodificato /// public codeType codeType { get; set; } = codeType.UNK; /// /// Codice decodificato /// public string code { get; set; } = ""; /// /// Codice decodificato in formato INT /// public int codeInt { get; set; } = 0; /// /// Descrizione associata /// public string description { get; set; } = ""; /// /// Dato letto RAW /// public string rawData { get; set; } = ""; } #endregion }