
using DevExpress.XtraReports.UI;
using DxBlazorApplication2.AS400Kommunikation;

namespace DxBlazorApplication2.Data.Produktion
{
    /// <summary>
    ///  Störung
    /// </summary>
    public class CockpitItem
    {
        /// <summary>
        /// Firma
        /// </summary>
        public double WWFIRM { get; set; }
        /// <summary>
        /// Werk
        /// </summary>
        public double WWWERK { get; set; }
        /// <summary>
        /// Auftragsnummer
        /// </summary>
        public double WWPANR { get; set; }
        /// <summary>
        /// Artikelnummer
        /// </summary>
        public string WWARNR { get; set; }
        /// <summary>
        /// Artikelbezeichnung
        /// </summary>
        public string WWARBZ { get; set; }
        /// <summary>
        /// Menge Plan
        /// </summary>
        public double WWMGPL { get; set; }
        /// <summary>
        /// Menge Ist
        /// </summary>
        public double WWMGIS { get; set; }
        /// <summary>
        /// Gewicht Plan
        /// </summary>
        public double WWGWPL { get; set; }
        /// <summary>
        /// Gewicht Ist
        /// </summary>
        public double WWGWIS { get; set; }
        /// <summary>
        /// Produktionsdatum
        /// </summary>
        public DateTime WWPRDT { get; set; }
        /// <summary>
        /// Kalenderdatum
        /// </summary>
        public DateTime WWKLDT { get; set; }
        /// <summary>
        /// Zeit von
        /// </summary>
        public DateTime WWTIMV { get; set; }
        /// <summary>
        /// Zeit bis
        /// </summary>
        public DateTime WWTIMB { get; set; }
        /// <summary>
        /// Linie
        /// </summary>
        public string WWLINI { get; set; }
        /// <summary>
        /// Schicht (1=Früh, 2=Spät, 3=Nacht)
        /// </summary>
        public string WWSCHI { get; set; }
        /// <summary>
        /// Charge
        /// </summary>
        public string WWCHAR { get; set; }
        /// <summary>
        /// Produktnummer
        /// </summary>
        public string WWPDNR { get; set; }
        /// <summary>
        /// MHD
        /// </summary>
        public DateTime WWMHD { get; set; }
        /// <summary>
        /// Letzte Buchung
        /// </summary>
        public DateTime WWBUDT { get; set; }

        /// <summary>
        /// Störung aktiv
        /// </summary>
        public bool StörungAktiv { get; set; }

        public CockpitItem(string linie)
        {
            WWLINI = linie;
        }

        public void Load(PSDLItem item)
        {
            if (item.PDBUDT > WWBUDT)
            {
                WWPANR = item.PDPANR;
                WWARNR = item.PDARNR;
                WWARBZ = item.PDARBZ;
                WWMGPL = item.PDMGPL;
                WWMGIS = item.PDMGIS;
                WWGWPL = item.PDGWPL;
                WWGWIS = item.PDGWIS;
                WWPRDT = item.PDPRDT;
                WWKLDT = item.PDKLDT;
                WWTIMV = item.PDTIMV;
                WWTIMB = item.PDTIMB;
                WWLINI = item.PDLINI;
                WWSCHI = item.PDSCHI;
                WWCHAR = item.PDCHAR;
                WWPDNR = item.PDPDNR;
                WWMHD = item.PDMHD;
                WWBUDT = item.PDBUDT;
            }
        }

        public void Load(BDSTItem item)
        {
            if (item.BTTIMB == DateTime.MinValue && !item.Deleted)
                StörungAktiv = true;
            else
                StörungAktiv = false;
        }
    }
}
