public async Task <PalletResponseModel> PostPalletAsync(PalletRequestModel inModel, string sessionId, string RequestType) { PalletResponseModel outModel = null; try { string url = string.Format(Configuration.PostPalletUrl, sessionId); string content = JsonConvert.SerializeObject(inModel); var value = await App.kegIDClient.ExecuteServiceCall <KegIDResponse>(url, HttpMethodType.Send, content, RequestType : RequestType); outModel = value.Response != null?App.kegIDClient.DeserializeObject <PalletResponseModel>(value.Response) : new PalletResponseModel(); if (outModel != null) { outModel.Response = new KegIDResponse { StatusCode = value.StatusCode }; } } catch (System.Exception) { } return(outModel); }
internal void LoadInfo(PalletResponseModel value) { try { PalletPrintModels = new Model.PrintPDF.Pallet { Barcode = value.Barcode, BuildDate = value.BuildDate.UtcDateTime.ToShortDateString(), PalletId = value.PalletId, Location = value.Location, Owner = value.Owner, StockLocation = value.StockLocation, Container = new Container { Nil = "" }, CreatedDate = DateTimeOffset.UtcNow.Date.ToShortDateString(), DateInfo = new DateInfo { }, TargetLocation = value.TargetLocation, PalletItems = new PalletItems { PalletItem = new List <Model.PrintPDF.PalletItem> { } }, SummaryItems = new SummaryItems { SummaryItem = new List <SummaryItem> { new SummaryItem { Combination = "test", Contents = "1/4 contents", Quantity = "1", Size = "1/2" } } } }; foreach (var item in value.PalletItems) { PalletPrintModels.PalletItems.PalletItem.Add(new Model.PrintPDF.PalletItem { Barcode = item.Barcode, Contents = ConstantManager.Contents, //ContentsKey = item.Contents, DateScanned = item.DateScanned.Date.ToShortDateString(), Keg = new Model.PrintPDF.Keg { Barcode = item?.Keg?.Barcode, Contents = "Future Factory", KegId = item?.Keg?.KegId, LocationId = item?.Keg?.LocationId, LocationName = item?.Keg?.LocationName, OwnerId = item?.Keg?.OwnerId, OwnerName = item?.Keg?.OwnerName, PalletId = item?.Keg?.PalletId, PalletName = item?.Keg?.PalletName, ReceivedDate = item?.Keg?.ReceivedDate.Date.ToShortDateString(), SizeName = item?.Keg?.SizeName, TypeName = item?.Keg?.TypeName }, PalletId = item.PalletId, IsActive = item.IsActive.ToString(), }); } ManifestId = value.Barcode; PartnerTypeName = value.StockLocation.PartnerTypeName; StockLocation = value.StockLocation.FullName; TargetLocation = value.StockLocation.FullName; ShippingDate = value.BuildDate.Date; ItemCount = value.PalletItems.Count; Barcodes = value.PalletItems.Select(selector: x => x.Barcode).ToList(); } catch (Exception ex) { Crashes.TrackError(ex); } }
private async void SubmitCommandRecieverAsync() { List <PalletItem> palletItems = new List <PalletItem>(); PalletItem pallet = null; PalletRequestModel palletRequestModel = null; var barCodeCollection = ConstantManager.Barcodes; PalletResponseModel palletResponseModel = null; try { Loader.StartLoading(); foreach (var item in barCodeCollection) { pallet = new PalletItem { Barcode = item.Barcode, ScanDate = DateTimeOffset.Now, }; foreach (var tag in ConstantManager.Tags) { pallet.Tags.Add(tag); } palletItems.Add(pallet); } palletRequestModel = new PalletRequestModel { Barcode = ManifestId.Split('-').LastOrDefault(), BuildDate = DateTimeOffset.Now, OwnerId = AppSettings.CompanyId, PalletId = _uuidManager.GetUuId(), ReferenceKey = "", StockLocation = StockLocation.PartnerId, StockLocationId = StockLocation.PartnerId, StockLocationName = StockLocation.FullName, }; foreach (var item in palletItems) { palletRequestModel.PalletItems.Add(item); } foreach (var item in ConstantManager.Tags) { palletRequestModel.Tags.Add(item); } palletResponseModel = new PalletResponseModel { Barcode = ManifestId.Split('-').LastOrDefault(), BuildDate = DateTimeOffset.Now, Container = null, CreatedDate = DateTimeOffset.Now, DataInfo = new Model.PrintPDF.DateInfo { }, Location = new Owner { }, Owner = new Owner { }, PalletId = palletRequestModel.PalletId, PalletItems = palletItems, ReferenceKey = string.Empty, StockLocation = new Owner { FullName = StockLocation.FullName, PartnerTypeName = StockLocation.PartnerTypeName }, TargetLocation = new Model.PrintPDF.TargetLocation { }, Tags = ConstantManager.Tags, }; var current = Connectivity.NetworkAccess; if (current == NetworkAccess.Internet) { var value = await _palletizeService.PostPalletAsync(palletRequestModel, AppSettings.SessionId, Configuration.NewPallet); } else { try { palletRequestModel.IsQueue = true; var RealmDb = Realm.GetInstance(RealmDbManager.GetRealmDbConfig()); RealmDb.Write(() => { RealmDb.Add(palletRequestModel, update: true); }); } catch (Exception ex) { Crashes.TrackError(ex); } } PrintPallet(); await _navigationService.NavigateAsync("PalletizeDetailView", new NavigationParameters { { "LoadInfo", palletResponseModel }, { "Contents", ConstantManager.Contents } }, animated : false); } catch (Exception ex) { Crashes.TrackError(ex); } finally { Loader.StopLoading(); palletItems = null; pallet = null; barCodeCollection = null; palletRequestModel = null; Cleanup(); } }