Ejemplo n.º 1
0
        public async Task LoadBinValues(AsyncCancelationDispatcher acd)
        {
            try
            {
                List <BinValues> binvalues = await NAV.GetBinValuesByRackID(RackID, acd.Default).ConfigureAwait(true);

                if (NotDisposed)
                {
                    foreach (BinValues bv in binvalues)
                    {
                        BinViewModel bvm = BinViewModels.Find(x => x.Code == bv.Code);
                        if (bvm is BinViewModel)
                        {
                            bvm.BottomRightValue = bv.RightValue;
                            bvm.BottomLeftValue  = bv.LeftValue;
                        }
                    }
                }
            }
            catch (OperationCanceledException e)
            {
                System.Diagnostics.Debug.WriteLine(e.Message);
                throw e;
            }
            catch (Exception e)
            {
                System.Diagnostics.Debug.WriteLine(e.Message);
                throw e;
            }
        }
Ejemplo n.º 2
0
        public async Task LoadBinImages(AsyncCancelationDispatcher acd)
        {
            try
            {
                List <BinImage> binimages = await NAV.GetBinImagesByRackID(RackID, acd.Default).ConfigureAwait(true);

                if (NotDisposed)
                {
                    foreach (BinImage bi in binimages)
                    {
                        if (!acd.Default.IsCancellationRequested)
                        {
                            BinViewModel bvm = BinViewModels.Find(x => x.Code == bi.BinCode);
                            if (bvm is BinViewModel)
                            {
                                try
                                {
                                    System.IO.Stream output = await ImageService.Instance.LoadUrl(bi.ImageURL)
                                                              .LoadingPlaceholder("icon.png")
                                                              .DownSample(100, 100)
                                                              .AsJPGStreamAsync();

                                    if (NotDisposed)
                                    {
                                        if (bvm.NotDisposed)
                                        {
                                            bvm.ImageSource       = ImageSource.FromStream(() => output);
                                            bvm.ImageSourceLoaded = true;
                                        }
                                    }
                                    else
                                    {
                                        break;
                                    }
                                }
                                catch (Exception e)
                                {
                                    System.Diagnostics.Debug.WriteLine("WCS:LI [" + bi.BinCode + "] " + e.Message);
                                }
                            }
                        }
                    }
                }
            }
            catch (OperationCanceledException e)
            {
                System.Diagnostics.Debug.WriteLine(e.Message);
                throw e;
            }
            catch (Exception e)
            {
                System.Diagnostics.Debug.WriteLine(e.Message);
                throw e;
            }
        }
Ejemplo n.º 3
0
        public void AfterSelect()
        {
            BinViewModel selectedbvm = BinViewModels.Find(x => x.IsSelected == true);

            IsSelectedBins = selectedbvm is BinViewModel;

            if (selectedbvm is BinViewModel)
            {
                SetTemplateBySelectedBin(selectedbvm);
            }
        }
Ejemplo n.º 4
0
        private void Select(BinViewModel bvm)
        {
            bvm.Selected = !bvm.Selected;

            BinViewModel selectedbvm = BinViewModels.Find(x => x.Selected == true);

            IsSelectedBins = selectedbvm is BinViewModel;

            if (selectedbvm is BinViewModel)
            {
                SetTemplateBySelectedBin(selectedbvm);
            }
        }
Ejemplo n.º 5
0
        public void CombineBins()
        {
            string combinedrackno1           = "";
            string locationcode1             = "";
            string rackno1                   = "";
            List <BinViewModel> selectedlist = BinViewModels.FindAll(x => x.Selected == true);

            if (selectedlist.Count > 1)
            {
                DefineBordersOfCombine(selectedlist);

                List <BinViewModel> fordelete =
                    BinViewModels.FindAll(x =>
                                          x.Section >= leftsection &&
                                          x.Section <= rightsection &&
                                          x.Level >= leftlevel &&
                                          x.Level <= rightlevel);

                BinViewModel firstbvm = BinViewModels.Find(x =>
                                                           x.Section >= leftsection &&
                                                           x.Level >= leftlevel);

                if (firstbvm is BinViewModel)
                {
                    combinedrackno1 = firstbvm.Code;
                    locationcode1   = firstbvm.LocationCode;
                    rackno1         = firstbvm.RackNo;
                }

                DeleteSelected(fordelete);

                Bin newbin = new Bin()
                {
                    LocationCode = locationcode1,
                    RackNo       = rackno1,
                    Code         = combinedrackno1,
                    Section      = leftsection,
                    Level        = leftlevel,
                    Depth        = 1,
                    SectionSpan  = rightsection - leftsection + 1,
                    LevelSpan    = rightlevel - leftlevel + 1,
                };

                BinViewModel bvm = new BinViewModel(Navigation, newbin);
                FillBinFromTemplate(bvm);
                bvm.OnTap += Bvm_OnTap;
                BinViewModels.Add(bvm);
            }
            UnSelect();
            MessagingCenter.Send(this, "Update");
        }
Ejemplo n.º 6
0
 public void FillEmptyPositions(int Sections, int Levels)
 {
     for (int i = 1; i <= Sections; i++)
     {
         for (int j = 1; j <= Levels; j++)
         {
             BinViewModel exist = BinViewModels.Find(x => x.Level == j && x.Section == i);
             if (exist is null)
             {
                 EmptySpaceViewModel existesvm = EmptySpacesViewModels.Find(x => x.Level == j && x.Section == i);
                 if (existesvm is null)
                 {
                     EmptySpaceViewModel esvm = new EmptySpaceViewModel(Navigation);
                     esvm.Section = i;
                     esvm.Level   = j;
                     esvm.Depth   = 1;
                     esvm.OnTap  += Esvm_OnTap;
                     EmptySpacesViewModels.Add(esvm);
                 }
             }
         }
     }
 }
Ejemplo n.º 7
0
 private BinViewModel GetFirstSelected()
 {
     return(BinViewModels.Find(x => x.Selected == true));
 }
Ejemplo n.º 8
0
        private async void Bvm_OnTap(BinViewModel bvm)
        {
            bvm.Selected = !bvm.Selected;

            BinViewModel selectedbvm = BinViewModels.Find(x => x.Selected == true);

            IsSelectedBins = selectedbvm is BinViewModel;

            if (selectedbvm is BinViewModel)
            {
                SetTemplateBySelectedBin(selectedbvm);
            }

            if (bvm.IsContent)
            {
                bvm.LoadAnimation = true;
                try
                {
                    List <BinContent> bincontent = await NAV.GetBinContentList(LocationCode, ZoneCode, bvm.Code, "", "", 1, int.MaxValue, ACD.Default).ConfigureAwait(true);

                    if ((!IsDisposed) && (bincontent.Count > 0))
                    {
                        bvm.BinContent.Clear();
                        foreach (BinContent bc in bincontent)
                        {
                            BinContentShortViewModel bsvm = new BinContentShortViewModel(Navigation, bc);
                            bvm.BinContent.Add(bsvm);
                        }
                    }
                }
                catch (OperationCanceledException e)
                {
                    System.Diagnostics.Debug.WriteLine("Cancel LoadBinContent", e.Message);
                }
                catch (Exception e)
                {
                    System.Diagnostics.Debug.WriteLine(e.Message);
                }
                bvm.LoadAnimation = false;
            }

            List <BinViewModel> list = BinViewModels.FindAll(x => x.Selected == true);

            if (list is List <BinViewModel> )
            {
                ObservableCollection <BinContentShortViewModel> nlist = new ObservableCollection <BinContentShortViewModel>();

                foreach (BinViewModel bvm1 in list)
                {
                    foreach (BinContentShortViewModel bcsvm in bvm1.BinContent)
                    {
                        nlist.Add(bcsvm);
                    }
                }

                SelectedBinContent     = nlist;
                EditedBinCodeIsEnabled = list.Count == 1;
            }
            else
            {
                EditedBinCodeIsEnabled = false;
            }

            if (OnBinClick is Action <BinsViewModel> )
            {
                OnBinClick(this);
            }
        }
Ejemplo n.º 9
0
 public BinViewModel Find(int j, int i, int k)
 {
     return(BinViewModels.Find(x => x.Bin.Section == j && x.Bin.Level == i && x.Bin.Depth == k));
 }