Exemple #1
0
        public CylinderPalletAnalysis CreateNewCylinderPalletAnalysisUI()
        {
            FormNewAnalysisCylinder form = new FormNewAnalysisCylinder(this);

            form.Cylinders   = Cylinders.ToArray();
            form.Pallets     = Pallets.ToArray();
            form.Interlayers = Interlayers.ToArray();

            if (DialogResult.OK == form.ShowDialog())
            {
                // build constraint set
                CylinderPalletConstraintSet constraintSet = new CylinderPalletConstraintSet();
                // interlayer period
                constraintSet.HasInterlayer         = form.HasInterlayer;
                constraintSet.InterlayerPeriod      = form.InterlayerPeriod;
                constraintSet.HasInterlayerAntiSlip = form.HasInterlayerAntiSlip;
                // stop criterion
                constraintSet.UseMaximumPalletHeight  = form.UseMaximumPalletHeight;
                constraintSet.MaximumPalletHeight     = form.MaximumPalletHeight;
                constraintSet.UseMaximumPalletWeight  = form.UseMaximumPalletWeight;
                constraintSet.MaximumPalletWeight     = form.MaximumPalletWeight;
                constraintSet.UseMaximumNumberOfItems = form.UseMaximumNumberOfItems;
                constraintSet.MaximumNumberOfItems    = form.MaximumNumberOfItems;

                return(CreateNewCylinderPalletAnalysis(form.AnalysisName, form.AnalysisDescription
                                                       , form.SelectedCylinder, form.SelectedPallet
                                                       , form.SelectedInterlayer, form.SelectedInterlayerAntiSlip
                                                       , constraintSet
                                                       , new CylinderSolver()));
            }
            return(null);
        }
Exemple #2
0
 public override void Dar(ManejoPallets receptor)
 {
     if (HasPallets() && receptor.Recibir(Pallets[0]))
     {
         Pallets.RemoveAt(0);
     }
 }
Exemple #3
0
        public HCylinderPalletAnalysis CreateNewHCylinderPalletAnalysisUI()
        {
            FormNewAnalysisHCylinder form = new FormNewAnalysisHCylinder(this);

            form.Cylinders = Cylinders.ToArray();
            form.Pallets   = Pallets.ToArray();

            if (DialogResult.OK == form.ShowDialog())
            {
                // build constraint set
                HCylinderPalletConstraintSet constraintSet = new HCylinderPalletConstraintSet();
                // stop criterion
                constraintSet.MaximumPalletHeight     = form.MaximumPalletHeight;
                constraintSet.UseMaximumPalletHeight  = form.UseMaximumPalletHeight;
                constraintSet.MaximumPalletWeight     = form.MaximumPalletWeight;
                constraintSet.UseMaximumPalletWeight  = form.UseMaximumPalletWeight;
                constraintSet.MaximumNumberOfItems    = form.MaximumNumberOfItems;
                constraintSet.UseMaximumNumberOfItems = form.UseMaximumNumberOfItems;
                constraintSet.SetAllowedPatterns(form.AllowPatternDefault, form.AllowPatternStaggered, form.AllowPatternColumn);
                constraintSet.RowSpacing = form.RowSpacing;

                return(CreateNewHCylinderPalletAnalysis(
                           form.AnalysisName, form.AnalysisDescription,
                           form.SelectedCylinder, form.SelectedPallet,
                           constraintSet,
                           new HCylinderSolver()));
            }
            return(null);
        }
        public void EditHCylinderPalletAnalysis(HCylinderPalletAnalysis analysis)
        {
            bool recomputeRequired        = false;
            FormNewAnalysisHCylinder form = new FormNewAnalysisHCylinder(this, analysis);

            form.Cylinders = Cylinders.ToArray();
            form.Pallets   = Pallets.ToArray();

            if (recomputeRequired = (DialogResult.OK == form.ShowDialog()))
            {
                analysis.CylinderProperties = form.SelectedCylinder;
                analysis.PalletProperties   = form.SelectedPallet;
                // analysis name / description
                analysis.ID.SetNameDesc(form.AnalysisName, form.AnalysisDescription);
                // constraint set
                HCylinderPalletConstraintSet constraintSet = analysis.ConstraintSet;
                // overhang / underhang
                constraintSet.OverhangX = form.OverhangX;
                constraintSet.OverhangY = form.OverhangY;
                // stop criterions
                constraintSet.MaximumPalletHeight     = form.MaximumPalletHeight;
                constraintSet.UseMaximumPalletHeight  = form.UseMaximumPalletHeight;
                constraintSet.MaximumPalletWeight     = form.MaximumPalletWeight;
                constraintSet.UseMaximumPalletWeight  = form.UseMaximumPalletWeight;
                constraintSet.MaximumNumberOfItems    = form.MaximumNumberOfItems;
                constraintSet.UseMaximumNumberOfItems = form.UseMaximumNumberOfItems;
                // allowed patterns
                constraintSet.SetAllowedPatterns(form.AllowPatternDefault, form.AllowPatternStaggered, form.AllowPatternColumn);
                constraintSet.RowSpacing = form.RowSpacing;
            }
            if (recomputeRequired)
            {
                analysis.OnEndUpdate(null);
            }
        }
Exemple #5
0
        public virtual int _GetUniqueIdentifier()
        {
            var hashCode = 399326290;

            hashCode = hashCode * -1521134295 + (Id?.GetHashCode() ?? 0);
            hashCode = hashCode * -1521134295 + (Pallets?.GetHashCode() ?? 0);
            hashCode = hashCode * -1521134295 + (Items?.GetHashCode() ?? 0);
            hashCode = hashCode * -1521134295 + (Weight?.GetHashCode() ?? 0);
            return(hashCode);
        }
Exemple #6
0
 public override void Dar(ManejoPallets receptor)
 {
     if (Tenencia())
     {
         if (receptor.Recibir(Pallets[0]))
         {
             Pallets.RemoveAt(0);
         }
     }
 }
Exemple #7
0
 public override void Dar(ManejoPallets receptor)
 {
     if (Tenencia())
     {
         if (Controlador.GetPalletEnMov() == null)
         {
             if (receptor.Recibir(Pallets[0]))
             {
                 CintaReceptora.Encender();
                 Controlador.SalidaPallet(Pallets[0]);
                 Pallets[0].GetComponent <Renderer>().enabled = true;
                 Pallets.RemoveAt(0);
                 Contenido.Sacar();
                 ApagarAnim();
             }
         }
     }
 }
Exemple #8
0
        public void EditPackPalletAnalsyis(PackPalletAnalysis analysis)
        {
            // do we need to recompute analysis
            bool recomputeRequired = false;

            FormNewAnalysisPackPallet form = new FormNewAnalysisPackPallet(this, analysis);

            form.Packs       = ListByType(typeof(PackProperties)).ToArray();
            form.Pallets     = Pallets.ToArray();
            form.Interlayers = ListByType(typeof(InterlayerProperties)).ToArray();

            if (recomputeRequired = (DialogResult.OK == form.ShowDialog()))
            {
                // analysis name / description
                analysis.Name        = form.ItemName;
                analysis.Description = form.ItemDescription;
                // analysis pack / pallet /interlayer
                analysis.PackProperties       = form.PackProperties;
                analysis.PalletProperties     = form.PalletProperties;
                analysis.InterlayerProperties = form.InterlayerProperties;
                // constraint set
                PackPalletConstraintSet constraintSet = analysis.ConstraintSet;
                constraintSet.OverhangX           = form.OverhangX;
                constraintSet.OverhangY           = form.OverhangY;
                constraintSet.MinOverhangX        = form.MinimumOverhangX;
                constraintSet.MinOverhangY        = form.MinimumOverhangY;
                constraintSet.MinimumSpace        = form.MinimumSpace;
                constraintSet.MaximumSpaceAllowed = form.MaximumSpace;
                constraintSet.LayerSwapPeriod     = form.LayerSwapPeriod;
                constraintSet.InterlayerPeriod    = form.InterlayerPeriod;
                constraintSet.HasFirstInterlayer  = form.HasFirstInterlayer;
                // stop criterions
                constraintSet.MaximumPalletHeight = form.MaximumPalletHeight;
                constraintSet.MaximumPalletWeight = form.MaximumPalletWeight;
            }
            if (recomputeRequired)
            {
                analysis.OnEndUpdate(null);
                if (analysis.Solutions.Count < 1)
                {
                    MessageBox.Show(Properties.Resources.ID_ANALYSISHASNOSOLUTION, Application.ProductName, MessageBoxButtons.OK);
                }
            }
        }
 public IActionResult GetPaletByCodigo(Pallets Codigo)
 {
     try
     {
         var pallet = _dataContext.Palets.Where(x => x.CodigoPalet == Codigo.CodigoPalet).FirstOrDefault();
         if (pallet != null)
         {
             pallet.UsuarioLectura = Codigo.UsuarioLectura;
             pallet.LecturaPalet   = DateTime.UtcNow;
             _dataContext.SaveChanges();
         }
         var Palets = (from TransportGuides in _dataContext.TransportGuides
                       join DetailTransportGuide in _dataContext.DetailTransportGuide on TransportGuides.ID equals DetailTransportGuide.TransportGuide.ID
                       join Pallets in _dataContext.Palets on DetailTransportGuide.ID equals Pallets.DetailTransportGuide.ID
                       where Pallets.CodigoPalet == Codigo.CodigoPalet
                       select new
         {
             IdPallet = Pallets.ID,
             Finca = TransportGuides.Finca.FincaName,
             TerminalDestino = TransportGuides.Puerto.PuertoName,
             Poma = TransportGuides.Numero,
             Fruta = DetailTransportGuide.Fruta.FrutaName,
             Buque = TransportGuides.Buque.BuqueName,
             Llegada = TransportGuides.LlegadaCamion,
             Salida = TransportGuides.SalidaFinca,
             Estimado = TransportGuides.Estimado,
             LlegadaTerminal = TransportGuides.LlegadaTerminal,
             Cajas = TransportGuides.Recibido,
             Exportador = TransportGuides.Exportador.ExportadorName,
             Destino = TransportGuides.Destino.DestinoName,
             Carga = Pallets.Carga,
             CodigoDeBarras = Pallets.CodigoPalet,
             CajasPalet = Pallets.NumeroCajas,
             Pallets.Perfilar,
             CaraPallet = Pallets.CaraPalet,
             IdTransportGuide = TransportGuides.ID
         }).FirstOrDefault();
         return(Ok(new { Data = Palets, Success = true }));
     }
     catch (Exception ex)
     {
         return(BadRequest(new { Data = ex.ToString(), Success = false }));
     }
 }
Exemple #10
0
        private void InitPalletes(SizeF palletSize, SizeF cartridgeSize, float cartridgeMargin)
        {
            PointF palletesTopLeft = new PointF(cartridgeMargin, cartridgeMargin);

            Pallets.Fill((r, c) =>
            {
                if (r == 1 && c == 1)
                {
                    return(null);
                }
                return(new PalletSlot()
                {
                    Pallet = null,
                    Size = palletSize,
                    TopLeft = palletesTopLeft.Add(
                        new PointF(c * (palletSize.Width + PalletesSeparation), r * (palletSize.Height + PalletesSeparation)))
                });
            });
        }
Exemple #11
0
        public void EditCylinderPalletAnalysis(CylinderPalletAnalysis analysis)
        {
            bool recomputeRequired       = false;
            FormNewAnalysisCylinder form = new FormNewAnalysisCylinder(this, analysis);

            form.Cylinders   = Cylinders.ToArray();
            form.Pallets     = Pallets.ToArray();
            form.Interlayers = Interlayers.ToArray();

            if (recomputeRequired = (DialogResult.OK == form.ShowDialog()))
            {
                analysis.CylinderProperties           = form.SelectedCylinder;
                analysis.PalletProperties             = form.SelectedPallet;
                analysis.InterlayerProperties         = form.SelectedInterlayer;
                analysis.InterlayerPropertiesAntiSlip = form.SelectedInterlayerAntiSlip;
                // analysis name / description
                analysis.Name        = form.AnalysisName;
                analysis.Description = form.AnalysisDescription;
                // constraint set
                CylinderPalletConstraintSet constraintSet = analysis.ConstraintSet;
                // interlayers
                constraintSet.HasInterlayer         = form.HasInterlayer;
                constraintSet.InterlayerPeriod      = form.InterlayerPeriod;
                constraintSet.HasInterlayerAntiSlip = form.HasInterlayerAntiSlip;
                // overhang / underhang
                constraintSet.OverhangX = form.OverhangX;
                constraintSet.OverhangY = form.OverhangY;
                // stop criterions
                constraintSet.UseMaximumPalletHeight        = form.UseMaximumPalletHeight;
                constraintSet.MaximumPalletHeight           = form.MaximumPalletHeight;
                constraintSet.UseMaximumPalletWeight        = form.UseMaximumPalletWeight;
                constraintSet.MaximumPalletWeight           = form.MaximumPalletWeight;
                constraintSet.UseMaximumNumberOfItems       = form.UseMaximumNumberOfItems;
                constraintSet.MaximumNumberOfItems          = form.MaximumNumberOfItems;
                constraintSet.UseMaximumLoadOnLowerCylinder = form.UseMaximumLoadOnLowerCylinder;
                constraintSet.MaximumLoadOnLowerCylinder    = form.MaximumLoadOnLowerCylinder;
            }
            if (recomputeRequired)
            {
                analysis.OnEndUpdate(null);
            }
        }
Exemple #12
0
 //------------------------------------------------------------//
 public override void Dar(ManejoPallets receptor)
 {
     if (HasPallets())
     {
         if (unloadController.GetPalletEnMov() == null)
         {
             if (receptor.Recibir(Pallets[0]))
             {
                 //enciende la cinta y el indicador
                 //cambia la textura de cuantos pallet le queda
                 CintaReceptora.Encender();
                 unloadController.SalidaPallet(Pallets[0]);
                 Pallets[0].GetComponent <Renderer>().enabled = true;
                 Pallets.RemoveAt(0);
                 Contenido.Sacar();
                 ApagarAnim();
             }
         }
     }
 }
Exemple #13
0
    //------------------------------------------------------------//

    public override void Dar(ManejoPallets receptor)
    {
        if (Tenencia())
        {
            if (Controlador.GetPalletEnMov() == null)
            {
                if (receptor.Recibir(Pallets[0]))
                {
                    //enciende la cinta y el indicador
                    //cambia la textura de cuantos pallet le queda
                    CintaReceptora.Encender();
                    Controlador.SalidaPallet(Pallets[0]);
                    Pallets[0].GetComponent <Renderer>().enabled = true;
                    Pallets.RemoveAt(0);
                    Contenido.Sacar();
                    ApagarAnim();
                    //Debug.Log("pallet entregado a Mano de Estanteria");
                }
            }
        }
    }
Exemple #14
0
        //Control events
        void Control_DoubleClick(object sender, EventArgs e)
        {
            for (int i = 0; i < palletsTemp.Count; i++)
            {
                if (palletsTemp[i].P == ((Panel)sender))
                {
                    OI_Clear();

                    //load in
                    OI_inhoud.Text       = palletsTemp[i].Inhoud;
                    OI_Gewicht.Text      = palletsTemp[i].Gewicht.ToString();
                    OI_Hoeveelheid.Value = palletsTemp[i].Hoeveelheid;
                    OI_Notitie.Text      = palletsTemp[i].Notitie;
                    editing = true;
                    Statecheck();

                    //set current edit item so we are able to delete it
                    currentedit = palletsTemp[i];
                }
            }
        }
Exemple #15
0
        /// <summary>
        /// Constructor for the Application object.
        /// </summary>
        public App()
        {
            // Global handler for uncaught exceptions.
            UnhandledException += Application_UnhandledException;

            // Standard XAML initialization
            InitializeComponent();

            // Phone-specific initialization
            InitializePhoneApplication();

            // Language display initialization
            InitializeLanguage();

            // Show graphics profiling information while debugging.
            if (Debugger.IsAttached)
            {
                // Display the current frame rate counters.
                Application.Current.Host.Settings.EnableFrameRateCounter = true;

                // Show the areas of the app that are being redrawn in each frame.
                //Application.Current.Host.Settings.EnableRedrawRegions = true;

                // Enable non-production analysis visualization mode,
                // which shows areas of a page that are handed off to GPU with a colored overlay.
                //Application.Current.Host.Settings.EnableCacheVisualization = true;

                // Prevent the screen from turning off while under the debugger by disabling
                // the application's idle detection.
                // Caution:- Use this under debug mode only. Application that disables user idle detection will continue to run
                // and consume battery power when the user is not using the phone.
                PhoneApplicationService.Current.UserIdleDetectionMode = IdleDetectionMode.Disabled;
            }

            FlowersLocalResources = new FlowersAccentResource();

            Pallets = new Pallets();
        }
Exemple #16
0
        /// <summary>
        /// Creates a new bundle analysis
        /// </summary>
        /// <returns>created bundle analysis</returns>
        public CasePalletAnalysis CreateNewBundlePalletAnalysisUI()
        {
            FormNewAnalysisBundle form = new FormNewAnalysisBundle(this, null);

            form.Boxes   = Bundles.ToArray();
            form.Pallets = Pallets.ToArray();
            if (DialogResult.OK == form.ShowDialog())
            {
                // build constraintSet
                BundlePalletConstraintSet constraintSet = new BundlePalletConstraintSet();
                // overhang / underhang
                constraintSet.OverhangX = form.OverhangX;
                constraintSet.OverhangY = form.OverhangY;
                // allowed patterns
                foreach (string s in form.AllowedPatterns)
                {
                    constraintSet.SetAllowedPattern(s);
                }
                // allow aligned / alternate layer
                constraintSet.AllowAlternateLayers = form.AllowAlternateLayers;
                constraintSet.AllowAlignedLayers   = form.AllowAlignedLayers;
                // stop criterion
                constraintSet.UseMaximumHeight        = form.UseMaximumPalletHeight;
                constraintSet.UseMaximumNumberOfCases = form.UseMaximumNumberOfBoxes;
                constraintSet.UseMaximumPalletWeight  = form.UseMaximumPalletWeight;
                constraintSet.MaximumHeight           = form.MaximumPalletHeight;
                constraintSet.MaximumNumberOfItems    = form.MaximumNumberOfBoxes;
                constraintSet.MaximumPalletWeight     = form.MaximumPalletWeight;

                return(CreateNewCasePalletAnalysis(form.ItemName, form.ItemDescription,
                                                   form.SelectedBundle, form.SelectedPallet, null, null,
                                                   null, null, null,
                                                   constraintSet,
                                                   new CasePalletSolver()));
            }
            return(null);
        }
Exemple #17
0
    public override void Dar(ManejoPallets receptor)
    {
        //Debug.Log(gameObject.name+ " / Dar()");
        switch (receptor.tag)
        {
        case "Mano":
            if (Tenencia())
            {
                //Debug.Log(gameObject.name+ " / Dar()"+" / Tenencia=true");
                if (receptor.name == "Right Hand")
                {
                    if (receptor.Recibir(Pallets[0]))
                    {
                        //Debug.Log(gameObject.name+ " / Dar()"+" / Tenencia=true"+" / receptor.Recibir(Pallets[0])=true");
                        Pallets.RemoveAt(0);
                        //Debug.Log("pallet entregado a Mano de Mano");
                    }
                }
            }
            break;

        case "Cinta":
            if (Tenencia())
            {
                if (receptor.Recibir(Pallets[0]))
                {
                    Pallets.RemoveAt(0);
                    //Debug.Log("pallet entregado a Cinta de Mano");
                }
            }
            break;

        case "Estante":
            break;
        }
    }
Exemple #18
0
        public async Task <string> CreateMasivo(List <CreatePomas> Pomas)
        {
            ExportadorController exportadorController = new ExportadorController(_dataContext);
            PuertoController     puertoController     = new PuertoController(_dataContext);
            BuqueController      buqueController      = new BuqueController(_dataContext);
            DestinoController    destinoController    = new DestinoController(_dataContext);
            FrutasController     frutasController     = new FrutasController(_dataContext);
            FincaController      fincaController      = new FincaController(_dataContext);
            PaletController      paletController      = new PaletController(_dataContext);
            List <Vehiculos>     ListPoma             = new List <Vehiculos>();

            foreach (var Poma in Pomas)
            {
                try
                {
                    Vehiculos Vehiculo = new Vehiculos();
                    Vehiculos V        = new Vehiculos();
                    V.Placa  = Poma.Placa;
                    Vehiculo = await this.Create(V);

                    Fincas Finca = new Fincas();
                    Fincas F     = new Fincas();
                    F.Codigo    = Poma.Finca.Codigo;
                    F.FincaName = Poma.Finca.FincaName;
                    Finca       = await fincaController.Create(F);


                    Puertos Puerto = new Puertos();
                    Puertos PU     = new Puertos();
                    PU.Codigo     = Poma.Puerto.Codigo;
                    PU.PuertoName = Poma.Puerto.PuertoName;
                    Puerto        = await puertoController.Create(PU);

                    Destinos Destino = new Destinos();
                    Destinos D       = new Destinos();
                    D.Codigo      = Poma.Destino.Codigo;
                    D.DestinoName = Poma.Destino.DestinoName;
                    Destino       = await destinoController.Create(D);

                    Buques Buque = new Buques();
                    Buques B     = new Buques();
                    B.Codigo    = Poma.Buque.Codigo;
                    B.BuqueName = Poma.Buque.BuqueName;
                    Buque       = await buqueController.Create(B);

                    Exportadores Exportador = new Exportadores();
                    Exportadores E          = new Exportadores();
                    E.Codigo         = Poma.Exportador.Codigo;
                    E.ExportadorName = Poma.Exportador.ExportadorName;
                    Exportador       = await exportadorController.Create(E);

                    TransportGuide TransportGuide = new TransportGuide();
                    TransportGuide.Vehiculo        = Vehiculo;
                    TransportGuide.Numero          = Poma.Numero;
                    TransportGuide.Estado          = (int)EstadosPoma.NoChequeado;
                    TransportGuide.FechaRegistro   = DateTime.UtcNow;
                    TransportGuide.Recibido        = false;
                    TransportGuide.LlegadaCamion   = Poma.LlegadaCamion.ToUniversalTime();
                    TransportGuide.SalidaFinca     = Poma.SalidaFinca.ToUniversalTime();
                    TransportGuide.Estimado        = Poma.Estimado.ToUniversalTime();
                    TransportGuide.LlegadaTerminal = null;
                    TransportGuide.Finca           = Finca;
                    TransportGuide.Puerto          = Puerto;
                    TransportGuide.Buque           = Buque;
                    TransportGuide.Destino         = Destino;
                    TransportGuide.Exportador      = Exportador;

                    bool           EditTG = false;
                    TransportGuide valTG  = this.ExistTransportGuide(Poma.Numero);
                    if (valTG == null)
                    {
                        _dataContext.TransportGuides.Add(TransportGuide);
                        await _dataContext.SaveChangesAsync();
                    }
                    else
                    {
                        var currentDate = DateTime.UtcNow.ToLocalTime();
                        var StartDate   = new DateTime(currentDate.Year, currentDate.Month, currentDate.Day, 3, 0, 0);
                        var EndDate     = StartDate.AddDays(1);
                        EndDate = new DateTime(EndDate.Year, EndDate.Month, EndDate.Day, 2, 59, 0);
                        if (currentDate < StartDate)
                        {
                            StartDate = StartDate.AddDays(-1);
                            EndDate   = EndDate.AddDays(-1);
                        }
                        if ((valTG.FechaRegistro >= StartDate && valTG.FechaRegistro <= EndDate) && valTG.Estado == 0)
                        {
                            EditTG = true;
                        }
                        else
                        {
                            return("La poma ya existe");
                        }
                    }

                    foreach (var detail in Poma.DetailPoma)
                    {
                        Frutas Fruta = new Frutas();
                        Frutas FR    = new Frutas();
                        FR.Codigo    = detail.Frutas.Codigo;
                        FR.FrutaName = detail.Frutas.FrutaName;
                        Fruta        = await frutasController.Create(FR);

                        DetailTransportGuide valDTG   = null;
                        DetailTransportGuide DetailTG = new DetailTransportGuide();
                        DetailTG.Fruta = Fruta;
                        if (EditTG)
                        {
                            valDTG = this.ExistDetailTransportGuide(valTG.ID, Fruta.ID);
                            if (valDTG == null)
                            {
                                DetailTG.TransportGuide = valTG;
                                _dataContext.DetailTransportGuide.Add(DetailTG);
                                await _dataContext.SaveChangesAsync();
                            }
                        }
                        else
                        {
                            DetailTG.TransportGuide = TransportGuide;
                            _dataContext.DetailTransportGuide.Add(DetailTG);
                            await _dataContext.SaveChangesAsync();
                        }

                        foreach (var palet in detail.Palets)
                        {
                            Pallets Palet = new Pallets();
                            Palet.CodigoPalet       = palet.CodigoPalet;
                            Palet.UsuarioLectura    = "";
                            Palet.LecturaPalet      = DateTime.UtcNow;
                            Palet.UsuarioInspeccion = "";
                            Palet.InspeccionPalet   = DateTime.UtcNow;
                            Palet.CaraPalet         = palet.CaraPalet;
                            Palet.NumeroCajas       = palet.NumeroCajas;
                            Palet.Carga             = palet.Carga;
                            Palet.Tipo     = palet.Tipo;
                            Palet.Perfilar = false;
                            if (EditTG)
                            {
                                if (valDTG == null)
                                {
                                    Palet.DetailTransportGuide = DetailTG;
                                }
                                else
                                {
                                    Palet.DetailTransportGuide = valDTG;
                                }
                            }
                            else
                            {
                                Palet.DetailTransportGuide = DetailTG;
                            }
                            _dataContext.Palets.Add(Palet);
                        }
                    }
                }
                catch (Exception ex)
                {
                    continue;
                }
            }

            await _dataContext.SaveChangesAsync();

            try
            {
                await _NotificationHubContext.Clients.All.BroadcastMessage(Get());
            }
            catch (Exception ex)
            {
                return(ex.Message);
            }
            return("Ejecutado correctamente");
        }
Exemple #19
0
        /// <summary>
        /// Edit specified pallet analysis
        /// </summary>
        /// <param name="analysis"></param>
        public void EditCasePalletAnalysis(CasePalletAnalysis analysis)
        {
            // do we need to recompute analysis
            bool recomputeRequired = false;

            if (analysis.IsBoxAnalysis)
            {
                FormNewAnalysisLegacy form = new FormNewAnalysisLegacy(this, analysis);
                form.Cases         = Cases.ToArray();
                form.Pallets       = Pallets.ToArray();
                form.Interlayers   = Interlayers.ToArray();
                form.PalletCorners = ListByType(typeof(PalletCornerProperties)).ToArray();
                form.PalletCaps    = ListByType(typeof(PalletCapProperties)).ToArray();
                form.PalletFilms   = ListByType(typeof(PalletFilmProperties)).ToArray();

                if (recomputeRequired = (DialogResult.OK == form.ShowDialog()))
                {
                    // analysis name / description
                    analysis.Name        = form.AnalysisName;
                    analysis.Description = form.AnalysisDescription;
                    // box / palet / interlayer
                    analysis.BProperties                  = form.SelectedBox;
                    analysis.PalletProperties             = form.SelectedPallet;
                    analysis.InterlayerProperties         = form.SelectedInterlayer;
                    analysis.InterlayerPropertiesAntiSlip = form.SelectedInterlayerAntiSlip;
                    // build constraint set
                    CasePalletConstraintSet constraintSet = analysis.ConstraintSet as CasePalletConstraintSet;
                    // overhang / underhang
                    constraintSet.OverhangX = form.OverhangX;
                    constraintSet.OverhangY = form.OverhangY;
                    // allowed axes
                    constraintSet.SetAllowedOrthoAxis(HalfAxis.HAxis.AXIS_X_N, form.AllowVerticalX);
                    constraintSet.SetAllowedOrthoAxis(HalfAxis.HAxis.AXIS_X_P, form.AllowVerticalX);
                    constraintSet.SetAllowedOrthoAxis(HalfAxis.HAxis.AXIS_Y_N, form.AllowVerticalY);
                    constraintSet.SetAllowedOrthoAxis(HalfAxis.HAxis.AXIS_Y_P, form.AllowVerticalY);
                    constraintSet.SetAllowedOrthoAxis(HalfAxis.HAxis.AXIS_Z_N, form.AllowVerticalZ);
                    constraintSet.SetAllowedOrthoAxis(HalfAxis.HAxis.AXIS_Z_P, form.AllowVerticalZ);
                    // allowed dir change
                    constraintSet.AllowTwoLayerOrientations       = form.AllowTwoLayerOrientations;
                    constraintSet.AllowLastLayerOrientationChange = form.AllowLastLayerOrientationChange;
                    // allowed patterns
                    constraintSet.ClearAllowedPatterns();
                    foreach (string s in form.AllowedPatterns)
                    {
                        constraintSet.SetAllowedPattern(s);
                    }
                    // allow alternate layer
                    constraintSet.AllowAlternateLayers = form.AllowAlternateLayers;
                    constraintSet.AllowAlignedLayers   = form.AllowAlignedLayers;
                    // interlayers
                    constraintSet.HasInterlayer         = form.HasInterlayers;
                    constraintSet.InterlayerPeriod      = form.InterlayerPeriod;
                    constraintSet.HasInterlayerAntiSlip = form.HasInterlayerAntiSlip;
                    // pallet corner
                    analysis.PalletCornerProperties = form.SelectedPalletCorners;
                    // pallet cap
                    analysis.PalletCapProperties = form.SelectedPalletCap;
                    // pallet film
                    analysis.PalletFilmProperties = form.SelectedPalletFilm;
                    // stop criterion
                    constraintSet.UseMaximumHeight        = form.UseMaximumPalletHeight;
                    constraintSet.UseMaximumNumberOfCases = form.UseMaximumNumberOfBoxes;
                    constraintSet.UseMaximumPalletWeight  = form.UseMaximumPalletWeight;
                    constraintSet.UseMaximumWeightOnBox   = form.UseMaximumLoadOnBox;
                    constraintSet.MaximumHeight           = form.MaximumPalletHeight;
                    constraintSet.MaximumNumberOfItems    = form.MaximumNumberOfBoxes;
                    constraintSet.MaximumPalletWeight     = form.MaximumPalletWeight;
                    constraintSet.MaximumWeightOnBox      = form.MaximumLoadOnBox;
                    // number of solution kept
                    constraintSet.UseNumberOfSolutionsKept = Properties.Settings.Default.KeepBestSolutions;
                    if (constraintSet.UseNumberOfSolutionsKept)
                    {
                        constraintSet.NumberOfSolutionsKept = Properties.Settings.Default.NoSolutionsToKeep;
                    }
                    // pallet film turns
                    constraintSet.PalletFilmTurns = form.PalletFilmTurns;
                }
            }
            else if (analysis.IsBundleAnalysis)
            {
                FormNewAnalysisBundle form = new FormNewAnalysisBundle(this, analysis);
                form.Boxes   = Bundles.ToArray();
                form.Pallets = Pallets.ToArray();

                if (recomputeRequired = (DialogResult.OK == form.ShowDialog()))
                {
                    // analysis name / description
                    analysis.Name        = form.ItemName;
                    analysis.Description = form.ItemDescription;
                    // analysis bundle / pallet
                    analysis.BProperties      = form.SelectedBundle;
                    analysis.PalletProperties = form.SelectedPallet;
                    // build constraintSet
                    BundlePalletConstraintSet constraintSet = analysis.ConstraintSet as BundlePalletConstraintSet;
                    // overhang / underhang
                    constraintSet.OverhangX = form.OverhangX;
                    constraintSet.OverhangY = form.OverhangY;
                    // allowed patterns
                    constraintSet.ClearAllowedPatterns();
                    foreach (string s in form.AllowedPatterns)
                    {
                        constraintSet.SetAllowedPattern(s);
                    }
                    // allow aligned / alternate layer
                    constraintSet.AllowAlternateLayers = form.AllowAlternateLayers;
                    constraintSet.AllowAlignedLayers   = form.AllowAlignedLayers;
                    // stop criterions
                    constraintSet.UseMaximumHeight        = form.UseMaximumPalletHeight;
                    constraintSet.UseMaximumNumberOfCases = form.UseMaximumNumberOfBoxes;
                    constraintSet.UseMaximumPalletWeight  = form.UseMaximumPalletWeight;
                    constraintSet.MaximumHeight           = form.MaximumPalletHeight;
                    constraintSet.MaximumNumberOfItems    = form.MaximumNumberOfBoxes;
                    constraintSet.MaximumPalletWeight     = form.MaximumPalletWeight;
                }
            }
            if (recomputeRequired)
            {
                analysis.OnEndUpdate(null);
            }
        }
Exemple #20
0
        /// <summary>
        /// Creates a new palet analysis
        /// </summary>
        /// <returns>created palet analysis</returns>
        public CasePalletAnalysis CreateNewCasePalletAnalysisUI()
        {
            if (!CanCreateCasePalletAnalysis)
            {
                return(null);
            }

            FormNewAnalysis form = new FormNewAnalysis(this);

            form.Cases         = Cases.ToArray();
            form.Pallets       = Pallets.ToArray();
            form.Interlayers   = Interlayers.ToArray();
            form.PalletCorners = ListByType(typeof(PalletCornerProperties)).ToArray();
            form.PalletCaps    = ListByType(typeof(PalletCapProperties)).ToArray();
            form.PalletFilms   = ListByType(typeof(PalletFilmProperties)).ToArray();

            if (DialogResult.OK == form.ShowDialog())
            {
                // build constraint set
                CasePalletConstraintSet constraintSet = new CasePalletConstraintSet();
                // overhang / underhang
                constraintSet.OverhangX = form.OverhangX;
                constraintSet.OverhangY = form.OverhangY;
                // allowed axes
                constraintSet.SetAllowedOrthoAxis(HalfAxis.HAxis.AXIS_X_N, form.AllowVerticalX);
                constraintSet.SetAllowedOrthoAxis(HalfAxis.HAxis.AXIS_X_P, form.AllowVerticalX);
                constraintSet.SetAllowedOrthoAxis(HalfAxis.HAxis.AXIS_Y_N, form.AllowVerticalY);
                constraintSet.SetAllowedOrthoAxis(HalfAxis.HAxis.AXIS_Y_P, form.AllowVerticalY);
                constraintSet.SetAllowedOrthoAxis(HalfAxis.HAxis.AXIS_Z_N, form.AllowVerticalZ);
                constraintSet.SetAllowedOrthoAxis(HalfAxis.HAxis.AXIS_Z_P, form.AllowVerticalZ);
                // allowed patterns
                constraintSet.ClearAllowedPatterns();
                foreach (string s in form.AllowedPatterns)
                {
                    constraintSet.SetAllowedPattern(s);
                }
                // allow alternate layer
                constraintSet.AllowAlternateLayers = form.AllowAlternateLayers;
                constraintSet.AllowAlignedLayers   = form.AllowAlignedLayers;
                // interlayers
                constraintSet.HasInterlayer         = form.HasInterlayers;
                constraintSet.InterlayerPeriod      = form.InterlayerPeriod;
                constraintSet.HasInterlayerAntiSlip = form.HasInterlayerAntiSlip;
                // stop criterion
                constraintSet.UseMaximumHeight        = form.UseMaximumPalletHeight;
                constraintSet.UseMaximumNumberOfCases = form.UseMaximumNumberOfBoxes;
                constraintSet.UseMaximumPalletWeight  = form.UseMaximumPalletWeight;
                constraintSet.UseMaximumWeightOnBox   = form.UseMaximumLoadOnBox;
                constraintSet.MaximumHeight           = form.MaximumPalletHeight;
                constraintSet.MaximumNumberOfItems    = form.MaximumNumberOfBoxes;
                constraintSet.MaximumPalletWeight     = form.MaximumPalletWeight;
                constraintSet.MaximumWeightOnBox      = form.MaximumLoadOnBox;
                // number of solution kept
                constraintSet.UseNumberOfSolutionsKept = Properties.Settings.Default.KeepBestSolutions;
                if (constraintSet.UseNumberOfSolutionsKept)
                {
                    constraintSet.NumberOfSolutionsKept = Properties.Settings.Default.NoSolutionsToKeep;
                }
                // number of pallet film turns
                constraintSet.PalletFilmTurns = form.PalletFilmTurns;

                return(CreateNewCasePalletAnalysis(
                           form.AnalysisName, form.AnalysisDescription,
                           form.SelectedBox, form.SelectedPallet,
                           form.SelectedInterlayer, form.SelectedInterlayerAntiSlip,
                           form.SelectedPalletCorners, form.SelectedPalletCap, form.SelectedPalletFilm,
                           constraintSet,
                           new CasePalletSolver()));
            }
            return(null);
        }