Ejemplo n.º 1
0
        private async void Bvm_OnTap(BinViewModel bvm)
        {
            Select(bvm);
            if (bvm.IsContent)
            {
                bvm.LoadAnimation = true;
                try
                {
                    NAVFilter navfilter = new NAVFilter
                    {
                        LocationCodeFilter = LocationCode,
                        ZoneCodeFilter     = ZoneCode,
                        BinCodeFilter      = bvm.Code
                    };
                    List <BinContent> bincontent = await NAV.GetBinContentList(navfilter, ACD.Default).ConfigureAwait(true);

                    FillBinContent(bvm, bincontent);
                }
                catch (Exception e)
                {
                    System.Diagnostics.Debug.WriteLine(e.Message);
                }
                bvm.LoadAnimation = false;
            }
            SetSelectedBinContent();
            if (OnBinClick is Action <BinsViewModel> )
            {
                OnBinClick(this);
            }
        }
Ejemplo n.º 2
0
        private async Task SaveBinChanges(BinViewModel bmv, int index, int count)
        {
            try
            {
                string text1 = String.Format(AppResources.RackEditPage_SaveProcessBinText, No, index, count);
                LoadingText = text1;

                bmv.SaveFields();

                int binexist = await NAV.GetBinCount(LocationCode, "", "", bmv.Bin.Code, ACD.Default).ConfigureAwait(true);

                if (binexist > 0)
                {
                    bmv.Bin.PrevCode = bmv.Bin.Code;
                    await NAV.ModifyBin(bmv.Bin, ACD.Default).ConfigureAwait(true);
                }
                else
                {
                    await NAV.CreateBin(BinTemplateCode, bmv.Bin, ACD.Default).ConfigureAwait(true);
                }
            }
            catch (Exception e)
            {
                throw e;
            }
        }
Ejemplo n.º 3
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.º 4
0
        private void FillBinInfo(BinViewModel bvm, List <BinInfo> bininfo)
        {
            if ((NotDisposed) && (bininfo.Count > 0))
            {
                ObservableCollection <BinInfoViewModel> nlist = new ObservableCollection <BinInfoViewModel>();
                foreach (BinInfo bvm1 in bininfo)
                {
                    nlist.Add(new BinInfoViewModel(bvm1, Navigation));
                }
                BinInfo = nlist;

                //LoadImages
                foreach (BinInfoViewModel bivm in BinInfo)
                {
                    if (!string.IsNullOrEmpty(bivm.ImageURL))
                    {
                        try
                        {
                            bivm.ImageSource    = ImageSource.FromUri(new Uri(bivm.ImageURL));
                            bivm.ImageIsVisible = true;
                        }
                        catch (Exception exp)
                        {
                            System.Diagnostics.Debug.WriteLine(exp.Message);
                        }
                    }
                }
            }
        }
Ejemplo n.º 5
0
        private void ExistInSearch(BinViewModel bvm)
        {
            if (Global.SearchResponses is List <SearchResponse> )
            {
                if (Global.SearchResponses.Count > 0)
                {
                    bvm.ExcludeFromSearch = true;

                    List <SearchResponse> list = Global.SearchResponses.FindAll(
                        x =>
                        x.ZoneCode == ZoneCode &&
                        x.RackNo == RackNo &&
                        x.BinCode == bvm.Code);

                    if (list is List <SearchResponse> )
                    {
                        if (list.Count > 0)
                        {
                            bvm.ExcludeFromSearch = false;
                            SearchBinsQuantity++;
                        }
                    }
                }
            }
        }
Ejemplo n.º 6
0
        private async Task SaveBin(BinViewModel bmv)
        {
            try
            {
                bmv.SaveFields();
                LoadingText = AppResources.RackNewPage_LoadingProgressBin + " " + bmv.Bin.Code;

                int binexist = await NAV.GetBinCount(NewModel.LocationCode, "", "", bmv.Bin.Code, ACD.Default).ConfigureAwait(true);

                if (binexist > 0)
                {
                    LoadingText      = AppResources.RackNewPage_LoadingProgressModifyBin + " " + bmv.Bin.Code;
                    bmv.Bin.PrevCode = bmv.Bin.Code;
                    await NAV.ModifyBin(bmv.Bin, ACD.Default).ConfigureAwait(true);
                }
                else
                {
                    if (CreateNewBins)
                    {
                        LoadingText = AppResources.RackNewPage_LoadingProgressBin + " " + bmv.Bin.Code;
                        await NAV.CreateBin(NewModel.BinsViewModel.BinTemplate.Code, bmv.Bin, ACD.Default).ConfigureAwait(true);
                    }
                }
            }
            catch (Exception e)
            {
                throw e;
            }
        }
Ejemplo n.º 7
0
        public async void Renumbering()
        {
            if (CreateMode)
            {
                System.Globalization.CultureInfo ci = new System.Globalization.CultureInfo("en-us");

                for (int k = 1; k <= Depth; k++)
                {
                    int levelnumber = NumberingLevelBegin + Levels - 1;

                    if (ReversLevelNumbering)
                    {
                        levelnumber = numberinglevelbegin;
                    }

                    for (int i = 1; i <= Levels; i++)
                    {
                        int sectionnumber = numberingsectionbegin;

                        if (ReversSectionNumbering)
                        {
                            sectionnumber = numberingsectionbegin + Sections - 1;
                        }

                        for (int j = 1; j <= Sections; j++)
                        {
                            string number = No + racksectionseparator + sectionnumber.ToString("D2", ci) + sectionlevelseparator + levelnumber.ToString();

                            BinViewModel bvm = BinsViewModel.Find(j, i, k);
                            if (bvm is BinViewModel)
                            {
                                bvm.Code = number;
                            }

                            if (ReversSectionNumbering)
                            {
                                sectionnumber = sectionnumber - StepNumberingSection;
                            }
                            else
                            {
                                sectionnumber = sectionnumber + StepNumberingSection;
                            }
                        }
                        if (ReversLevelNumbering)
                        {
                            levelnumber = levelnumber + 1;
                        }
                        else
                        {
                            levelnumber = levelnumber - 1;
                        }
                    }
                }

                await BinsViewModel.CheckBins(ACD).ConfigureAwait(true);
            }
        }
Ejemplo n.º 8
0
 private void FillBinContent(BinViewModel bvm, List <BinContent> bincontent)
 {
     bvm.BinContent.Clear();
     foreach (BinContent bc in bincontent)
     {
         BinContentShortViewModel bcsvm = new BinContentShortViewModel(Navigation, bc);
         bvm.BinContent.Add(bcsvm);
     }
 }
Ejemplo n.º 9
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.º 10
0
        public void AfterSelect()
        {
            BinViewModel selectedbvm = BinViewModels.Find(x => x.IsSelected == true);

            IsSelectedBins = selectedbvm is BinViewModel;

            if (selectedbvm is BinViewModel)
            {
                SetTemplateBySelectedBin(selectedbvm);
            }
        }
Ejemplo n.º 11
0
 private void FillBinContent(BinViewModel bvm, List <BinContent> bincontent)
 {
     if ((!IsDisposed) && (bincontent.Count > 0))
     {
         bvm.BinContent.Clear();
         foreach (BinContent bc in bincontent)
         {
             BinContentShortViewModel bsvm = new BinContentShortViewModel(Navigation, bc);
             bvm.BinContent.Add(bsvm);
         }
     }
 }
Ejemplo n.º 12
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.º 13
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.º 14
0
 private void Select(BinViewModel bvm)
 {
     if (!MultiSelectBins)
     {
         List <BinViewModel> list = BinViewModels.FindAll(x => x.IsSelected == true);
         foreach (BinViewModel bvm1 in list)
         {
             if (bvm1 != bvm)
             {
                 bvm1.IsSelected = false;
             }
         }
     }
     bvm.IsSelected = !bvm.IsSelected;
     AfterSelect();
 }
Ejemplo n.º 15
0
 public void FillBinFromTemplate(BinViewModel bvm)
 {
     if (BinTemplate is BinTemplate)
     {
         bvm.LocationCode         = BinTemplate.LocationCode;
         bvm.BinType              = BinTemplate.BinTypeCode;
         bvm.Description          = BinTemplate.BinDescription;
         bvm.WarehouseClassCode   = BinTemplate.WarehouseClassCode;
         bvm.BlockMovement        = BinTemplate.BlockMovement;
         bvm.SpecialEquipmentCode = BinTemplate.SpecialEquipmentCode;
         bvm.BinRanking           = BinTemplate.BinRanking;
         bvm.MaximumCubage        = BinTemplate.MaximumCubage;
         bvm.MaximumWeight        = BinTemplate.MaximumWeight;
         bvm.Dedicated            = BinTemplate.Dedicated;
     }
 }
Ejemplo n.º 16
0
        public async Task LoadBins(AsyncCancelationDispatcher acd)
        {
            BinViewModelsDispose();
            try
            {
                LoadedBinsQuantity = 0;
                SearchBinsQuantity = 0;
                NAVFilter navfilter = new NAVFilter
                {
                    LocationCodeFilter = LocationCode,
                    ZoneCodeFilter     = ZoneCode,
                    RackCodeFilter     = RackNo
                };
                List <Bin> bins = await NAV.GetBinList(navfilter, ACD.Default).ConfigureAwait(true);

                if (!IsDisposed)
                {
                    if (bins.Count > 0)
                    {
                        LoadedBinsQuantity = bins.Count;
                        foreach (Bin bin in bins)
                        {
                            BinViewModel bvm = new BinViewModel(Navigation, bin);
                            bvm.IsContent = !bin.Empty;
                            bvm.Color     = Color.FromHex("#e2dacf");
                            bvm.OnTap    += Bvm_OnTap;

                            ExistInSearch(bvm);
                            ExistInUDS(bvm);

                            BinViewModels.Add(bvm);
                        }
                    }
                    MessagingCenter.Send <BinsViewModel>(this, "BinsIsLoaded");
                }
            }
            catch (OperationCanceledException e)
            {
                System.Diagnostics.Debug.WriteLine(e.Message);
                ErrorText = e.Message;
            }
            catch (Exception e)
            {
                System.Diagnostics.Debug.WriteLine(e.Message);
                ErrorText = e.Message;
            }
        }
Ejemplo n.º 17
0
 private void SetTemplateBySelectedBin(BinViewModel bvm)
 {
     FillTemplateIsEnabled        = false;
     TemplateCode                 = bvm.Code;
     TemplateMaximumWeight        = bvm.MaximumWeight;
     TemplateBlocked              = bvm.Blocked;
     TemplateBlockMovement        = bvm.BlockMovement;
     TemplateBinType              = bvm.BinType;
     TemplateBinRanking           = bvm.BinRanking;
     TemplateMaximumCubage        = bvm.MaximumCubage;
     TemplateMaximumWeight        = bvm.MaximumWeight;
     TemplateAdjustmentBin        = bvm.AdjustmentBin;
     TemplateWarehouseClassCode   = bvm.WarehouseClassCode;
     TemplateSpecialEquipmentCode = bvm.SpecialEquipmentCode;
     TemplateDefault              = bvm.Default;
     FillTemplateIsEnabled        = true;
 }
Ejemplo n.º 18
0
        public void CreateBin(int i, int j, int k)
        {
            Bin newbin = new Bin()
            {
                RackNo  = RackNo,
                Section = j,
                Level   = i,
                Depth   = k
            };
            BinViewModel bvm = new BinViewModel(Navigation, newbin);

            if (BinTemplate is BinTemplate)
            {
                FillBinFromTemplate(bvm);
            }
            bvm.OnTap += Bvm_OnTap;
            BinViewModels.Add(bvm);
        }
Ejemplo n.º 19
0
        public async Task CheckBin(BinViewModel bvm, AsyncCancelationDispatcher acd)
        {
            try
            {
                bvm.IsChecked = false;
                NAVFilter navfilter = new NAVFilter
                {
                    LocationCodeFilter = LocationCode,
                    BinCodeFilter      = bvm.Code
                };
                List <Bin> binsexist = await NAV.GetBinList(navfilter, acd.Default).ConfigureAwait(true);

                if ((NotDisposed) && (binsexist.Count > 0))
                {
                    bvm.IsExist = true;

                    Bin bin = binsexist.First();
                    bin.RackID      = bvm.RackID;
                    bin.Section     = bvm.Section;
                    bin.Level       = bvm.Level;
                    bin.Depth       = bvm.Depth;
                    bin.SectionSpan = bvm.SectionSpan;
                    bin.LevelSpan   = bvm.LevelSpan;
                    bin.DepthSpan   = bvm.DepthSpan;
                    bvm.FillFields(bin);
                }
                else
                {
                    bvm.IsExist = false;
                }
                bvm.IsChecked = true;
            }
            catch (OperationCanceledException e)
            {
                System.Diagnostics.Debug.WriteLine(e.Message);
                ErrorText = e.Message;
            }
            catch (Exception e)
            {
                System.Diagnostics.Debug.WriteLine(e.Message);
                ErrorText = e.Message;
            }
        }
Ejemplo n.º 20
0
        private void ExistInUDS(BinViewModel bvm)
        {
            if (LinkToRackViewModel is RackViewModel)
            {
                if (LinkToRackViewModel.UDSSelects.Count > 0)
                {
                    SubSchemeSelect sss = LinkToRackViewModel.UDSSelects.Find(
                        x => x.Section == bvm.Section &&
                        x.Level == bvm.Level &&
                        x.Depth == bvm.Depth);

                    if (sss is SubSchemeSelect)
                    {
                        bvm.Color                   = Color.FromHex(sss.HexColor);
                        bvm.SearchQuantity          = sss.Value;
                        bvm.IsSearchQuantityVisible = true;
                    }
                }
            }
        }
Ejemplo n.º 21
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.º 22
0
        private void SetNumber(BinViewModel bvm)
        {
            System.Globalization.CultureInfo ci = new System.Globalization.CultureInfo("en-us");

            int sectionname = NumberingSectionBegin + (bvm.Section - 1) * StepNumberingSection;

            if (ReversSectionNumbering)
            {
                sectionname = NumberingSectionBegin + (Sections - bvm.Section) * StepNumberingSection;;
            }

            int levelname = NumberingLevelBegin + (Levels - bvm.Level) * StepNumberingLevel;

            if (ReversLevelNumbering)
            {
                levelname = NumberingLevelBegin + (bvm.Level - 1) * StepNumberingLevel;;
            }

            string sectionlabel = sectionname.ToString("D" + NumberingSectionDigitsQuantity.ToString(), ci);
            string lavellabel   = levelname.ToString("D" + NumberingLevelDigitsQuantity.ToString(), ci);

            bvm.Code = NumberingPrefix + racksectionseparator + sectionlabel + sectionlevelseparator + lavellabel;
        }
Ejemplo n.º 23
0
        private async void Bvm_OnTap(BinViewModel bvm)
        {
            Select(bvm);

            if (!IsEditMode)
            {
                if (bvm.IsSelected)
                {
                    LastSelectedBinCode = bvm.Code;
                    MessagingCenter.Send(bvm, "BinsViewModel.BinSelected");

                    if (bvm.IsContent)
                    {
                        bvm.LoadAnimation = true;
                        try
                        {
                            NAVFilter navfilter = new NAVFilter
                            {
                                LocationCodeFilter = LocationCode,
                                ZoneCodeFilter     = ZoneCode,
                                BinCodeFilter      = bvm.Code
                            };

                            List <BinContent> bincontent = await NAV.GetBinContentList(navfilter, ACD.Default).ConfigureAwait(true);

                            if ((NotDisposed) && (bincontent.Count > 0))
                            {
                                FillBinContent(bvm, bincontent);
                            }

                            List <BinInfo> bininfo = await NAV.GetBinInfo(bvm.LocationCode, bvm.Code, ACD.Default).ConfigureAwait(true);

                            if (NotDisposed)
                            {
                                FillBinInfo(bvm, bininfo);
                            }
                        }
                        catch (Exception e)
                        {
                            System.Diagnostics.Debug.WriteLine(e.Message);
                        }
                        bvm.LoadAnimation = false;
                    }
                }

                SetSelectedBinContent();
            }

            EditedBinCodeIsEnabled = false;
            List <BinViewModel> list = BinViewModels.FindAll(x => x.IsSelected == true);

            if (list is List <BinViewModel> )
            {
                EditedBinCodeIsEnabled = list.Count == 1;
            }

            if (OnBinClick is Action <BinsViewModel> )
            {
                OnBinClick(this);
            }
        }
Ejemplo n.º 24
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.º 25
0
 private void DeleteBin(BinViewModel bvm)
 {
     bvm.OnTap -= Bvm_OnTap;
     BinViewModels.Remove(bvm);
 }