public async Task RunBinContentTap(BinContentShortViewModel bcsvm) { try { State = ModelState.Loading; LoadAnimation = true; NAVFilter navfilter = new NAVFilter { LocationCodeFilter = LocationCode, ZoneCodeFilter = ZoneCode, RackIDFilter = ID.ToString(), BinCodeFilter = bcsvm.BinCode, ItemNoFilter = bcsvm.ItemNo, DescriptionFilter = bcsvm.Description }; string response = await NAV.RunBCTap(navfilter, ACD.Default).ConfigureAwait(true); State = ModelState.Normal; } catch (Exception e) { System.Diagnostics.Debug.WriteLine(e.Message); State = ModelState.Error; ErrorText = e.Message; } finally { LoadAnimation = false; } }
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); } }
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; } }
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; } }
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; } }
public async Task RunUDF() { try { List <BinViewModel> list = BinsViewModel.BinViewModels.FindAll(x => x.IsSelected == true); if (list is List <BinViewModel> ) { State = ModelState.Loading; LoadAnimation = true; foreach (BinViewModel bvm in list) { LoadingText = bvm.Code; NAVFilter navfilter = new NAVFilter { LocationCodeFilter = bvm.LocationCode, ZoneCodeFilter = bvm.ZoneCode, RackIDFilter = bvm.RackID.ToString(), BinCodeFilter = bvm.Code }; string response = await NAV.RunFunction(udfvmselected.ID, navfilter, 0, ACD.Default).ConfigureAwait(true); } State = ModelState.Normal; } else { State = ModelState.Error; ErrorText = AppResources.RackCardPage_Error_BinDidNotSelect; } } catch (Exception e) { System.Diagnostics.Debug.WriteLine(e.Message); State = ModelState.Error; ErrorText = e.Message; } finally { LoadAnimation = false; } }
public async Task DeleteRack(object obj) { if (NotNetOrConnection) { return; } RackViewModel rvm = (RackViewModel)obj; string variant1 = String.Format(AppResources.RacksPlanViewModel_DeleteRack, rvm.No); string variant2 = String.Format(AppResources.RacksPlanViewModel_DeleteRack2, rvm.No); string variant3 = String.Format(AppResources.RacksPlanViewModel_DeleteRackAndBins, rvm.No); var action = await App.Current.MainPage.DisplayActionSheet( AppResources.RacksPlanViewModel_DeleteQuestion, AppResources.RacksPlanViewModel_DeleteCancel, null, variant1, variant2, variant3); if ((action != null) && (action != AppResources.RacksPlanViewModel_DeleteCancel)) { if (action == variant1) { try { await rvm.SaveToRackSchemeVisible(false); } catch (Exception e) { System.Diagnostics.Debug.WriteLine(e.Message); ErrorText = e.Message; State = ModelState.Error; } } if (action == variant2) { try { await NAV.DeleteRack(rvm.ID, ACD.Default).ConfigureAwait(true); } catch (Exception e) { System.Diagnostics.Debug.WriteLine(e.Message); ErrorText = e.Message; State = ModelState.Error; } } if (action == variant3) { try { State = ModelState.Loading; LoadAnimation = true; await NAV.DeleteRack(rvm.ID, ACD.Default).ConfigureAwait(true); NAVFilter navfilter = new NAVFilter { LocationCodeFilter = rvm.LocationCode, ZoneCodeFilter = rvm.ZoneCode, RackIDFilter = rvm.ID.ToString() }; string bindeleteerrors = ""; List <Bin> binsinrack = await NAV.GetBinList(navfilter, ACD.Default).ConfigureAwait(true); if (NotDisposed) { foreach (Bin bin in binsinrack) { try { LoadingText = bin.Code; await NAV.DeleteBin(bin.LocationCode, bin.Code, ACD.Default).ConfigureAwait(true); } catch (Exception exp) { bindeleteerrors += bin.Code + " : " + exp.InnerException.Message + Environment.NewLine + Environment.NewLine; } } } if (string.IsNullOrEmpty(bindeleteerrors)) { State = ModelState.Normal; } else { ErrorText = AppResources.RacksPlanViewModel_DeleteBinErrors + " " + Environment.NewLine + bindeleteerrors; State = ModelState.Error; } } catch (Exception e) { System.Diagnostics.Debug.WriteLine(e.Message); ErrorText = e.Message; State = ModelState.Error; } } await Load(); } }
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); } }