Exemplo n.º 1
0
        public async void OnGetArticulo(string articulo)
        {
            IsRunning = true;
            Articulo artDb = await DataStore.GetArticuloAsync(articulo);

            Item.Bulto.Articulo = artDb;
            if (artDb == null)
            {
                await AlertHelper.ShowError($"El articulo {articulo} indicado no existe");

                ArticuloIsFocused = true;
            }
            else
            {
                if (string.IsNullOrEmpty(Item.Bulto.Lote))
                {
                    LoteIsFocused = true;
                }
                else
                {
                    CantidadIsFocused = true;
                }
            }

            IsRunning = false;
        }
Exemplo n.º 2
0
        public async void OnDelete()
        {
            bool ok = await AlertHelper.DisplayAlert("Deshacer", "¿Esta seguro que desea deshacer el consumo?", "Ejecutar", "Cancelar");



            if (ok)
            {
                IsRunning = true;

                try
                {
                    bool result = await DataStore.DeleteMovimientoAsync(Item.CodMov);

                    //model delete
                    await Navigation.PopAsync();
                }
                catch (System.Exception ex)
                {
                    await AlertHelper.ShowError(ex.Message);
                }
                finally
                {
                    IsRunning = false;
                }
            }
        }
Exemplo n.º 3
0
        public async Task <List <Bulto> > OnGetLotes(string lote)
        {
            IsRunning = true;

            var bultos = await DataStore.GetBultosByUbicacionAsync(Item.Ubicacion.Codigo, Item.Bulto.Articulo.Codigo, lote);

            List <Bulto> items = new List <Bulto>();

            foreach (var b in bultos)
            {
                items.Add(b);
            }


            if (items.Count == 0)
            {
                await AlertHelper.ShowError("El lote seleccionado no se encuentra en la ubicacion");

                LoteIsFocused = true;
            }
            else if (items.Count == 1)
            {
                Item.Bulto = items[0];
                //Item.Cantidad = Item.Bulto.Cantidad;
                CantidadIsFocused = true;
            }
            else
            {
                MessagingCenter.Send <IEnumerable <Bulto> >(bultos, App.EVENT_LAUNCH_BULTOS_PAGE);
            }


            IsRunning = false;
            return(items);
        }
Exemplo n.º 4
0
        public async Task <Of> GetOfAsync(string orden)
        {
            IsRunning = true;
            var ofs = await DataStore.GetOfAsync(orden);

            Item.Ofs = ofs;
            if (ofs == null)
            {
                await AlertHelper.ShowError("La orden seleccionada no existe");

                OrdenIsFocused = true;
            }
            else
            {
                if (ofs.Ubicacion == null)
                {
                    await AlertHelper.ShowError("Debe especificar una ubicación");

                    UbicacionIsFocused = true;
                }
                else
                {
                    Item.Ubicacion    = ofs.Ubicacion;
                    ArticuloIsFocused = true;
                }
            }

            IsRunning = false;
            return(ofs);
        }
Exemplo n.º 5
0
        public async void OnSubmit()
        {
            bool isLogged = await DataStore.LogonAsync(UserName, Password);

            if (!isLogged)
            {
                await AlertHelper.ShowError("Invalid Login, try again");
            }
            else
            {
                MessagingCenter.Send <object>(this, App.EVENT_LAUNCH_MAIN_PAGE);
            }
        }
Exemplo n.º 6
0
        public async void OnReubicar()
        {
            IsRunning = true;

            try
            {
                bool result = await DataStore.Reubicar(NewUbicacion, int.Parse(Item.Bulto.Codigo));

                Item = new Movimiento();
                //await Task.Delay(2000);
                UbicacionIsFocused = true;
            }
            catch (System.Exception ex)
            {
                await AlertHelper.ShowError(ex.Message);
            }
            finally
            {
                IsRunning = false;
            }
        }
Exemplo n.º 7
0
        public async void OnSubmit()
        {
            IsRunning = true;

            try
            {
                bool result = await DataStore.AddMovimientoAsync(Item);


                Item = new Movimiento();
                //await Task.Delay(2000);
                OrdenIsFocused = true;
            }
            catch (System.Exception ex)
            {
                await AlertHelper.ShowError(ex.Message);
            }
            finally
            {
                IsRunning = false;
            }
        }