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 amcchina x cui si effettua richeista
///
[JsonConverter(typeof(StringEnumConverter))]
public mType MachineType { get; set; }
///
/// Tipo di ordine richiesto
///
[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; }
///
/// 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;
}
///
/// 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;
///
/// 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;
}
///
/// 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; }
public List CartList { get; set; }
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 TAKC / 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 delal lavorazione
///
public class WorkData
{
///
/// 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;
}
}
}
///
/// 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 i BUNK da lavorare
///
public class ProdBunk
{
///
/// Identificativo univoco stack
///
public int BunkId { get; set; }
///
/// Stato dello Stack di pannelli
///
public CStatus Status { get; set; }
///
/// Codice dataMAtrix dello stack
///
public string DataMatrix { get; set; }
///
/// Data inizio processing dello Stack
///
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
}