示例#1
0
        public async Task CheckBins(AsyncCancelationDispatcher acd)
        {
            List <BinViewModel> list = BinViewModels.ToList();

            foreach (BinViewModel bvm in list)
            {
                await CheckBin(bvm, acd).ConfigureAwait(true);
            }
        }
        public async Task CheckBins(AsyncCancelationDispatcher acd)
        {
            try
            {
                List <BinViewModel> list = BinViewModels.ToList();
                foreach (BinViewModel bvm in list)
                {
                    bvm.IsChecked = false;
                    NAVFilter navfilter = new NAVFilter
                    {
                        LocationCodeFilter = LocationCode,
                        BinCodeFilter      = bvm.Code
                    };
                    List <Bin> binsexist = await NAV.GetBinList(navfilter, ACD.Default).ConfigureAwait(true);

                    if (binsexist.Count > 0)
                    {
                        bvm.IsExist = true;
                        Bin bin = binsexist.First();

                        //Place in new rack
                        bin.RackNo      = bvm.RackNo;
                        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;
            }
        }