| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using InABox.Core;
- using InABox.Clients;
- using Comal.Classes;
- using Xamarin.Forms;
- using Xamarin.Forms.Xaml;
- using XF.Material.Forms.UI.Dialogs;
- using Xamarin.Essentials;
- using System.IO;
- using InABox.Mobile;
- using LogType = InABox.Core.LogType;
- using PRSSecurity = InABox.Core.Security;
- namespace PRS.Mobile
- {
- [XamlCompilation(XamlCompilationOptions.Compile)]
- public partial class Receivals
- {
- #region Fields & Constructor, OnAppearing
- Guid POID = Guid.Empty;
- List<POItemShell> poItemShells = new List<POItemShell>();
- List<StockLocationShell> stockLocationShells = new List<StockLocationShell>();
- bool bOpening = false;
- List<Guid> holdingsToLookup = new List<Guid>();
- string deviceType = "";
- Guid supplierID = Guid.Empty;
- string PONumber = "";
- Guid consignmentID = Guid.Empty;
- string consignmentNumber = "";
- List<POItemShell> listReceived = new List<POItemShell>();
- public Receivals(Guid _poID, string _PONumber, Guid _supplierID)
- {
- InitializeComponent();
- NavigationPage.SetHasBackButton(this, false);
- POID = _poID;
- PONumber = _PONumber;
- poNumberLbl.Text = "PO: " + _PONumber;
- var idiom = DeviceInfo.Idiom;
- if (idiom.Equals(DeviceIdiom.Tablet))
- {
- deviceType = "Tablet";
- }
- LoadPOItems();
- supplierID = _supplierID;
- AddIncomingStores();
- }
- protected override void OnAppearing()
- {
- base.OnAppearing();
- bOpening = false;
- }
- #endregion
- #region User Interaction
- private async void Exit_Clicked(object sender, EventArgs e)
- {
- if (listReceived.Count > 0)
- {
- DisplayAlert("Alert", "Consignment has items received and must be saved with photos before exiting", "OK");
- }
- else
- Navigation.PopAsync();
- }
- private async void Save_Clicked(object sender, EventArgs e)
- {
- ConsignmentCompletionPage completionPage = new ConsignmentCompletionPage(listReceived, consignmentID, consignmentNumber);
- completionPage.OnConsignmentSaved += () =>
- {
- Navigation.PopAsync();
- };
- Navigation.PushAsync(completionPage);
- }
-
- private void ConsignmentList_Tapped(object sender, EventArgs e)
- {
- if (bOpening)
- return;
- if (!PRSSecurity.IsAllowed<CanReceiveConsignments>())
- {
- DisplayAlert("Not allowed", "Please check security setting: Receive Consignments", "OK");
- return;
- }
- bOpening = true;
- POItemShell poItemShell = poItemListView.SelectedItem as POItemShell;
- if (poItemShell.Nonstock == true)
- {
- ChooseQtyNonStockItem(poItemShell);
- }
- else
- {
- ChooseQtyStockItem(poItemShell);
- }
- }
- private async void ChooseQtyStockItem(POItemShell poItemShell)
- {
- ConsignmentDetailsPopup popup = new ConsignmentDetailsPopup(poItemShell, stockLocationShells);
- popup.OnConsignmentPopupAccepted += async () =>
- {
- using (await MaterialDialog.Instance.LoadingDialogAsync(message: "Loading"))
- {
- poItemShell.StockLocationID = popup._POItemShell.StockLocationID;
- poItemShell.StockLocationCode = popup._POItemShell.StockLocationCode;
- poItemShell.StockLocationDescription = popup._POItemShell.StockLocationDescription;
- poItemShell.ReceivedQty = popup._POItemShell.ReceivedQty;
- StockLocationShell location = stockLocationShells.Find(x => x.ID.Equals(poItemShell.StockLocationID));
- if (location == null)
- {
- var newLocation = App.Data.StockLocations.FirstOrDefault(x => x.ID == poItemShell.StockLocationID);
- if (newLocation != null)
- stockLocationShells.Add(newLocation);
- }
- ChooseSavePathwayAsync(poItemShell);
- }
- };
- Navigation.PushAsync(popup);
- bOpening = false;
- }
- private async void ChooseQtyNonStockItem(POItemShell poItemShell)
- {
- Device.BeginInvokeOnMainThread(async () =>
- {
- //if nonstock item - only rec qty, otherwise open popup page
- string chosenOption = await DisplayPromptAsync("Enter Received Quantity", "", initialValue: poItemShell.ExpectedQty.ToString(), keyboard: Keyboard.Numeric);
- if (!string.IsNullOrEmpty(chosenOption) || chosenOption != "Cancel")
- {
- try
- {
- double qty = double.Parse(chosenOption);
- poItemShell.ReceivedQty = qty;
- }
- catch
- {
- DisplayAlert("Error", "Invalid Qty", "OK");
- bOpening = false;
- return;
- }
- bOpening = false;
- ChooseSavePathwayAsync(poItemShell);
- }
- else
- bOpening = false;
- });
- }
- private void SearchEnt_Changed(object sender, EventArgs e)
- {
- if (string.IsNullOrWhiteSpace(searchEnt.Text))
- {
- poItemListView.ItemsSource = poItemShells;
- }
- else
- {
- poItemListView.ItemsSource = poItemShells.Where(x =>
- x.Description.Contains(searchEnt.Text) || x.Description.Contains(UpperCaseFirst(searchEnt.Text)) || x.Description.Contains(LowerCaseFirst(searchEnt.Text))
- || x.Description.Contains(searchEnt.Text.ToUpper()) || x.Description.Contains(searchEnt.Text.ToLower()) ||
- x.ExpectedQty.ToString().Contains(searchEnt.Text)
- );
- }
- }
- static String UpperCaseFirst(string s)
- {
- char[] a = s.ToCharArray();
- a[0] = char.ToUpper(a[0]);
- return new string(a);
- }
- static String LowerCaseFirst(string s)
- {
- char[] a = s.ToCharArray();
- a[0] = char.ToLower(a[0]);
- return new string(a);
- }
- #endregion
- #region Saving
- private async Task ChooseSavePathwayAsync(POItemShell poItemShell)
- {
- if (consignmentID == Guid.Empty)
- CreateNewConsignment();
- if (poItemShell.ReceivedQty == poItemShell.ExpectedQty)
- {
- SaveCorrectQuantityPOItem(poItemShell);
- }
- else if (poItemShell.ReceivedQty < poItemShell.ExpectedQty && poItemShell.ReceivedQty != 0)
- {
- SaveLesserQuantityPOItem(poItemShell);
- }
- else if (poItemShell.ReceivedQty > poItemShell.ExpectedQty)
- {
- SaveExtraQuantityPOItem(poItemShell);
- }
- }
- private async void SaveCorrectQuantityPOItem(POItemShell poItemShell)
- {
- await Task.Run(() =>
- {
- poItemShell.ReceivedQty = poItemShell.ExpectedQty;
- poItemShell.ReceivedDate = DateTime.Now;
- poItemShell.ConsignmentID = consignmentID;
- poItemShell.ConsignmentNumber = consignmentNumber;
- SavePOItem(poItemShell);
- int index = poItemShells.FindIndex(x => x.ID.Equals(poItemShell.ID));
- poItemShells.RemoveAt(index);
- RefreshLists(poItemShell);
- });
- }
- private void SavePOItem(POItemShell poItemShell)
- {
- Task.Run(() =>
- {
- listReceived.Add(poItemShell);
- PurchaseOrderItem purchaseOrderItem = new PurchaseOrderItem();
- purchaseOrderItem.Description = poItemShell.Description;
- purchaseOrderItem.ID = poItemShell.ID;
- purchaseOrderItem.Qty = poItemShell.ReceivedQty;
- purchaseOrderItem.ReceivedDate = DateTime.Now;
- purchaseOrderItem.Consignment.ID = consignmentID;
- purchaseOrderItem.PurchaseOrderLink.PONumber = poItemShell.PONumber;
- purchaseOrderItem.PurchaseOrderLink.ID = poItemShell.POID;
- purchaseOrderItem = CopyDetails(purchaseOrderItem, poItemShell);
- DoSavePOItem(purchaseOrderItem);
- });
- }
- private void DoSavePOItem(PurchaseOrderItem purchaseOrderItem)
- {
- try
- {
- new Client<PurchaseOrderItem>().Save(purchaseOrderItem, "Updated from mobile device");
- }
- catch (Exception ex)
- {
- InABox.Mobile.MobileLogging.Log(ex);
- DoSavePOItem(purchaseOrderItem);
- }
- }
- private void RefreshLists(POItemShell poItemShell)
- {
- Device.BeginInvokeOnMainThread(() =>
- {
- poItemListView.ItemsSource = null;
- poItemListView.ItemsSource = poItemShells;
- poItemCountLbl.Text = "Items Unreceived: " + poItemShells.Count;
- if (poItemShell.StockLocationID != Guid.Empty)
- {
- StockLocationShell location = stockLocationShells.Find(x => x.ID.Equals(poItemShell.StockLocationID));
- //location.PoItems.Add(poItemShell);
- //location.NumberOfReceivedItems = "Received items: " + location.PoItems.Count;
- locationsStackLayout.Children.Clear();
- foreach (StockLocationShell shell in stockLocationShells)
- {
- StockLocationViewCell viewcell = new StockLocationViewCell(shell);
- locationsStackLayout.Children.Add(viewcell);
- }
- }
- });
- }
- private async void SaveLesserQuantityPOItem(POItemShell poItemShell)
- {
- using (await MaterialDialog.Instance.LoadingDialogAsync(message: "Loading"))
- {
- try
- {
- string originalDescription = poItemShell.Description;
- int index = poItemShells.FindIndex(x => x.ID.Equals(poItemShell.ID));
- poItemShells.RemoveAt(index);
- //placeholder added while all the loading / saving happens - to be replaced later when new purchaseorderitem ID is returned
- POItemShell placeHolderShell = poItemShell.DuplicateNewShell(poItemShell);
- placeHolderShell.ExpectedQty = poItemShell.ExpectedQty - poItemShell.ReceivedQty;
- poItemShells.Insert(index, placeHolderShell);
- SavePOItem(poItemShell); //original POItem is saved
- CoreTable table = DoQueryPOItem(poItemShell);
- while (table == null)
- table = DoQueryPOItem(poItemShell);
- PurchaseOrderItem purchaseOrderItem = table.Rows.FirstOrDefault()?.ToObject<PurchaseOrderItem>();
- if (purchaseOrderItem == null)
- return;
- purchaseOrderItem.ID = Guid.Empty;
- purchaseOrderItem.Created = DateTime.Now;
- purchaseOrderItem.LastUpdate = DateTime.Now;
- purchaseOrderItem.OriginalValues.Remove("ID", out object obj);
- purchaseOrderItem.ReceivedDate = DateTime.MinValue;
- purchaseOrderItem.Qty = poItemShell.ExpectedQty - poItemShell.ReceivedQty;
- purchaseOrderItem.Description = originalDescription;
- purchaseOrderItem.Consignment.ID = Guid.Empty;
- purchaseOrderItem = CopyDetails(purchaseOrderItem, poItemShell);
- purchaseOrderItem = DoSavePurchaseOrderItem(purchaseOrderItem);
- //new purchase order is split from original with different quantity and no consignment linked, saved to database
- POItemShell newShell = poItemShell.DuplicateNewShell(poItemShell);
- newShell.ID = purchaseOrderItem.ID;
- newShell.Description = purchaseOrderItem.Description;
- newShell.ExpectedQty = purchaseOrderItem.Qty;
- newShell.ConsignmentID = Guid.Empty;
- newShell.ConsignmentNumber = "";
- //placeholder is replaced by new shell with correct ID
- poItemShells.RemoveAt(index);
- poItemShells.Insert(index, newShell);
- RefreshLists(poItemShell);
- }
- catch { }
- }
- }
- private PurchaseOrderItem DoSavePurchaseOrderItem(PurchaseOrderItem purchaseOrderItem)
- {
- try
- {
- new Client<PurchaseOrderItem>().Save(purchaseOrderItem, "Update from mobile device");
- return purchaseOrderItem;
- }
- catch (Exception ex)
- {
- InABox.Mobile.MobileLogging.Log(ex);
- return DoSavePurchaseOrderItem(purchaseOrderItem);
- }
- }
- private CoreTable DoQueryPOItem(POItemShell poItemShell)
- {
- try
- {
- return new Client<PurchaseOrderItem>().Query(new Filter<PurchaseOrderItem>(x => x.ID).IsEqualTo(poItemShell.ID),
- columns);
- }
- catch (Exception ex)
- {
- InABox.Mobile.MobileLogging.Log(ex);
- return null;
- }
- }
- private async void SaveExtraQuantityPOItem(POItemShell poItemShell)
- {
- await Task.Run(() =>
- {
- try
- {
- string originalDescription = poItemShell.Description;
- double originalExpectedQty = poItemShell.ExpectedQty;
- double originalReceivedQty = poItemShell.ReceivedQty;
- double extraSupplied = originalReceivedQty - originalExpectedQty;
- int index = poItemShells.FindIndex(x => x.ID.Equals(poItemShell.ID));
- poItemShells.RemoveAt(index);
- poItemShell.ReceivedDate = DateTime.Now;
- poItemShell.ConsignmentID = consignmentID;
- poItemShell.ConsignmentNumber = consignmentNumber;
- poItemShell.ReceivedQty = poItemShell.ExpectedQty;
- SavePOItem(poItemShell);
- RefreshLists(poItemShell);
- listReceived.Add(poItemShell);
- //for responsive view only
- POItemShell newShell = poItemShell.DuplicateNewShell(poItemShell);
- newShell.ReceivedQty = extraSupplied;
- newShell.ExpectedQty = extraSupplied;
- RefreshLists(newShell);
- listReceived.Add(newShell);
- CoreTable table = QuerySaveExtraQuantityPOItem(poItemShell);
- while (table == null)
- table = QuerySaveExtraQuantityPOItem(poItemShell);
- PurchaseOrderItem newPurchaseOrderItem = table.Rows.FirstOrDefault().ToObject<PurchaseOrderItem>();
- if (newPurchaseOrderItem == null)
- return;
- newPurchaseOrderItem.ReceivedDate = DateTime.Now;
- newPurchaseOrderItem.ID = Guid.Empty;
- newPurchaseOrderItem.Created = DateTime.Now;
- newPurchaseOrderItem.LastUpdate = DateTime.Now;
- newPurchaseOrderItem.OriginalValues.Remove("ID", out object obj);
- newPurchaseOrderItem.Qty = extraSupplied;
- newPurchaseOrderItem.Description = newShell.Description;
- newPurchaseOrderItem.Consignment.ID = consignmentID;
- newPurchaseOrderItem = CopyDetails(newPurchaseOrderItem, poItemShell);
- SavePOItem(newPurchaseOrderItem);
- //new purchase order is split from original with different quantity, and consignment linked, saved to database
- }
- catch
- { }
- });
- }
- private void SavePOItem(PurchaseOrderItem newPurchaseOrderItem)
- {
- try
- {
- new Client<PurchaseOrderItem>().Save(newPurchaseOrderItem, "Update from mobile device");
- }
- catch (Exception ex)
- {
- InABox.Mobile.MobileLogging.Log(ex);
- SavePOItem(newPurchaseOrderItem);
- }
- }
- private CoreTable QuerySaveExtraQuantityPOItem(POItemShell poItemShell)
- {
- try
- {
- return new Client<PurchaseOrderItem>().Query(new Filter<PurchaseOrderItem>(x => x.ID).IsEqualTo(poItemShell.ID)
- , columns);
- }
- catch (Exception ex)
- {
- InABox.Mobile.MobileLogging.Log(ex);
- return null;
- }
- }
- private PurchaseOrderItem CopyDetails(PurchaseOrderItem purchaseOrderItem, POItemShell poItemShell)
- {
- purchaseOrderItem.Product.ID = poItemShell.ProductID;
- purchaseOrderItem.Product.NonStock = poItemShell.Nonstock;
- purchaseOrderItem.Job.ID = poItemShell.JobID;
- purchaseOrderItem.Job.JobNumber = poItemShell.JobNumber;
- purchaseOrderItem.Job.Name = poItemShell.JobName;
- purchaseOrderItem.Style.ID = poItemShell.StyleID;
- purchaseOrderItem.Style.Code = poItemShell.StyleCode;
- purchaseOrderItem.Style.Description = poItemShell.StyleDescription;
- purchaseOrderItem.StockLocation.ID = poItemShell.StockLocationID;
- purchaseOrderItem.StockLocation.Description = poItemShell.StockLocationDescription;
- purchaseOrderItem.StockLocation.Code = poItemShell.StockLocationCode;
- purchaseOrderItem.Dimensions.Unit.ID = poItemShell.DimensionsUnitID;
- purchaseOrderItem.Dimensions.Quantity = poItemShell.DimensionsQuantity;
- purchaseOrderItem.Dimensions.Length = poItemShell.DimensionsLength;
- purchaseOrderItem.Dimensions.Width = poItemShell.DimensionsWidth;
- purchaseOrderItem.Dimensions.Height = poItemShell.DimensionsHeight;
- purchaseOrderItem.Dimensions.Weight = poItemShell.DimensionsWeight;
- purchaseOrderItem.Cost = poItemShell.Cost;
- purchaseOrderItem.Dimensions.Unit.HasHeight = poItemShell.DimensionsHasHeight;
- purchaseOrderItem.Dimensions.Unit.HasLength = poItemShell.DimensionsHasLength;
- purchaseOrderItem.Dimensions.Unit.HasWidth = poItemShell.DimensionsHasWidth;
- purchaseOrderItem.Dimensions.Unit.HasWeight = poItemShell.DimensionsHasWeight;
- purchaseOrderItem.Dimensions.Unit.HasQuantity = poItemShell.DimensionsHasQuantity;
- purchaseOrderItem.Dimensions.Unit.Formula = poItemShell.DimensionsUnitFormula;
- purchaseOrderItem.Dimensions.Unit.Format = poItemShell.DimensionsUnitFormat;
- purchaseOrderItem.Dimensions.Unit.Code = poItemShell.DimensionsUnitCode;
- purchaseOrderItem.Dimensions.Unit.Description = poItemShell.DimensionsUnitDescription;
- purchaseOrderItem.Dimensions.UnitSize = poItemShell.DimensionsUnitSize;
- purchaseOrderItem.Dimensions.Value = poItemShell.DimensionsValue;
- return purchaseOrderItem;
- }
- #region ChoosingLocations
- private async void ChooseReceivingLocationBtn_Clicked(object sender, EventArgs e)
- {
- string chosenOption = await DisplayActionSheet("Choose an Option", "Cancel", null, "New Location / Pack", "Existing Location / Pack");
- switch (chosenOption)
- {
- case "Cancel":
- return;
- break;
- case "New Location / Pack":
- ChooseNewLocation();
- break;
- case "Existing Location / Pack":
- ChooseReceivingLocation();
- break;
- default:
- return;
- break;
- }
- }
- private void ChooseNewLocation()
- {
- try
- {
- StockLocationShell location = new StockLocationShell();
- location.Active = true;
- // location.Warehouse.ID = Guid.Parse("b6249c4a-a834-4927-a42c-87a07895d6bd"); //EXTRUSIONS
- // location.Warehouse.Description = "Extrusions";
- // location.Warehouse.Code = "EXTRUSIONS";
- // location.Area.Warehouse.ID = Guid.Parse("b6249c4a-a834-4927-a42c-87a07895d6bd"); //EXTRUSIONS
- // location.Area.Warehouse.Description = "Extrusions";
- // location.Area.ID = Guid.Parse("fa02ecd8-e642-49aa-98b5-c04d7ea0f4eb"); //Rack FLOOR
- // location.Area.Description = "Rack FLOOR";
- // location.Area.Code = "FLOOR";
- StockLocationDetailsPage stockLocationDetailsPage = new StockLocationDetailsPage(location);
- stockLocationDetailsPage.Saved += (o, loc) =>
- {
- // if (String.IsNullOrWhiteSpace(loc.Code))
- // {
- // MaterialDialog.Instance.AlertAsync(message: "Code may not be blank!");
- // return false;
- // }
- //
- // if (String.IsNullOrWhiteSpace(loc.Description))
- // {
- // MaterialDialog.Instance.AlertAsync(message: "Description may not be blank!");
- // return false;
- // }
- //
- // if (loc.Area.ID == Guid.Empty)
- // {
- // MaterialDialog.Instance.AlertAsync(message: "Area may not be blank!");
- // return false;
- // }
- //
- // CoreTable others = QueryStockLocations(loc);
- // while (others == null)
- // others = QueryStockLocations(loc);
- //
- // if (others.Rows.Any())
- // {
- // MaterialDialog.Instance.AlertAsync(message: "Location Code already exists!");
- // return false;
- // }
- // try
- // {
- // loc = SaveStockLocation(loc);
- // StockLocationShell_Old shell = new StockLocationShell_Old();
- // shell.ID = loc.ID;
- // shell.Code = loc.Code;
- // shell.Description = loc.Description;
- // stockLocationShells.Add(shell);
- // Device.BeginInvokeOnMainThread(() =>
- // {
- // locationsStackLayout.Children.Clear();
- // foreach (StockLocationShell_Old shell2 in stockLocationShells)
- // {
- // StockLocationViewCell viewcell = new StockLocationViewCell(shell2);
- // viewcell.stockLocationShell.NumberOfReceivedItems = "Received items: " + shell2.PoItems.Count();
- // locationsStackLayout.Children.Add(viewcell);
- // }
- // });
- // }
- // catch (Exception err)
- // {
- // MaterialDialog.Instance.AlertAsync(message: "Unable to save Location\n" + err.Message);
- // return false;
- // }
- // return true;
- };
- Navigation.PushAsync(stockLocationDetailsPage);
- }
- catch { }
- }
- private StockLocation SaveStockLocation(StockLocation loc)
- {
- try
- {
- new Client<StockLocation>().Save(loc, "Created Location");
- return loc;
- }
- catch (Exception ex)
- {
- InABox.Mobile.MobileLogging.Log(ex);
- return SaveStockLocation(loc);
- }
- }
- private CoreTable QueryStockLocations(StockLocation loc)
- {
- try
- {
- return new Client<StockLocation>().Query(
- new Filter<StockLocation>(x => x.Code).IsEqualTo(loc.Code).And(x => x.ID).IsNotEqualTo(loc.ID),
- new Columns<StockLocation>(ColumnTypeFlags.None).Add(x => x.ID)
- );
- }
- catch (Exception ex)
- {
- InABox.Mobile.MobileLogging.Log(ex);
- return null;
- }
- }
- private void ChooseReceivingLocation()
- {
- if (bOpening)
- return;
- bOpening = true;
- StockLocationSelectionPage stockLocationSelectionPage = new StockLocationSelectionPage();
- stockLocationSelectionPage.OnLocationSelected += async (s, e) =>
- {
- using (await MaterialDialog.Instance.LoadingDialogAsync(message: "Loading"))
- {
- foreach (StockLocationShell shell in e.Locations)
- {
- if (!stockLocationShells.Any(x => x.ID == shell.ID))
- {
- //shell.Color = Color.Default;
- //shell.NumberOfReceivedItems = "Received items: " + shell.PoItems.Count();
- stockLocationShells.Add(shell);
- }
- }
- Device.BeginInvokeOnMainThread(() =>
- {
- locationsStackLayout.Children.Clear();
- foreach (StockLocationShell shell in stockLocationShells)
- {
- StockLocationViewCell viewcell = new StockLocationViewCell(shell);
- //viewcell.stockLocationShell.NumberOfReceivedItems = "Received items: " + shell.PoItems.Count();
- locationsStackLayout.Children.Add(viewcell);
- }
- });
- }
- };
- Navigation.PushAsync(stockLocationSelectionPage);
- }
- #endregion
- #endregion
- #region Loading
- private void AddIncomingStores()
- {
- Task.Run(() =>
- {
- try
- {
- CoreTable table = QueryIncomingStores();
- while (table == null)
- table = QueryIncomingStores();
- StockLocation location = table.Rows.FirstOrDefault().ToObject<StockLocation>();
- if (location == null)
- return;
- var newlocation = App.Data.StockLocations.FirstOrDefault(x => x.ID == location.ID);
- if (newlocation != null)
- stockLocationShells.Add(newlocation);
- // stockLocationShells.Add(new StockLocationShell
- // {
- // ID = location.ID,
- // Code = location.Code,
- // Description = location.Description,
- // NumberOfReceivedItems = "Received items: ",
- // });
- StockLocationViewCell viewcell = new StockLocationViewCell(stockLocationShells[0]);
- Device.BeginInvokeOnMainThread(() =>
- {
- locationsStackLayout.Children.Add(viewcell);
- });
- }
- catch { }
- });
- }
- private CoreTable QueryIncomingStores()
- {
- try
- {
- return new Client<StockLocation>().Query(
- new Filter<StockLocation>(x => x.ID).IsEqualTo(Guid.Parse("3ebb1fe3-21f4-4731-b80a-a28f814982ea")),
- new Columns<StockLocation>(ColumnTypeFlags.None).Add(x => x.ID, x => x.Code, x => x.Description));
- }
- catch (Exception ex)
- {
- InABox.Mobile.MobileLogging.Log(ex);
- return null;
- }
- }
- private void LoadPOItems()
- {
- Task.Run(() =>
- {
- try
- {
- CoreTable table = QueryLoadPOItems();
- while (table == null)
- table = QueryLoadPOItems();
- if (table.Rows.Any())
- {
- foreach (CoreRow row in table.Rows)
- {
- POItemShell item = new POItemShell()
- {
- ID = row.Get<PurchaseOrderItem, Guid>(x => x.ID),
- PONumber = row.Get<PurchaseOrderItem, string>(x => x.PurchaseOrderLink.PONumber),
- ConsignmentNumber = "Cons: " + row.Get<PurchaseOrderItem, string>(x => x.Consignment.Number),
- JobName = row.Get<PurchaseOrderItem, string>(x => x.Job.Name),
- JobNumber = row.Get<PurchaseOrderItem, string>(x => x.Job.JobNumber),
- Description = row.Get<PurchaseOrderItem, string>(x => x.Description),
- ConsignmentID = row.Get<PurchaseOrderItem, Guid>(x => x.Consignment.ID),
- POID = row.Get<PurchaseOrderItem, Guid>(x => x.PurchaseOrderLink.ID),
- ReceivedDate = row.Get<PurchaseOrderItem, DateTime>(x => x.ReceivedDate),
- JobID = row.Get<PurchaseOrderItem, Guid>(x => x.Job.ID),
- SupplierCode = row.Get<PurchaseOrderItem, string>(x => x.SupplierCode),
- ProductID = row.Get<PurchaseOrderItem, Guid>(x => x.Product.ID),
- Nonstock = row.Get<PurchaseOrderItem, bool>(x => x.Product.NonStock),
- StyleID = row.Get<PurchaseOrderItem, Guid>(x => x.Style.ID),
- StyleCode = row.Get<PurchaseOrderItem, string>(x => x.Style.Code),
- StyleDescription = row.Get<PurchaseOrderItem, string>(x => x.Style.Description),
- StockLocationID = row.Get<PurchaseOrderItem, Guid>(x => x.Product.DefaultLocation.ID),
- StockLocationDescription = row.Get<PurchaseOrderItem, string>(x => x.Product.DefaultLocation.Description),
- StockLocationCode = row.Get<PurchaseOrderItem, string>(x => x.Product.DefaultLocation.Code),
- DimensionsUnitID = row.Get<PurchaseOrderItem, Guid>(x => x.Dimensions.Unit.ID),
- DimensionsQuantity = row.Get<PurchaseOrderItem, double>(x => x.Dimensions.Quantity),
- DimensionsLength = row.Get<PurchaseOrderItem, double>(x => x.Dimensions.Length),
- DimensionsWidth = row.Get<PurchaseOrderItem, double>(x => x.Dimensions.Width),
- DimensionsHeight = row.Get<PurchaseOrderItem, double>(x => x.Dimensions.Height),
- DimensionsWeight = row.Get<PurchaseOrderItem, double>(x => x.Dimensions.Weight),
- DimensionsValue = row.Get<PurchaseOrderItem, double>(x => x.Dimensions.Value),
- DimensionsUnitSize = row.Get<PurchaseOrderItem, string>(x => x.Dimensions.UnitSize),
- Cost = row.Get<PurchaseOrderItem, double>(x => x.Cost),
- DimensionsHasHeight = row.Get<PurchaseOrderItem, bool>(x => x.Dimensions.Unit.HasHeight),
- DimensionsHasLength = row.Get<PurchaseOrderItem, bool>(x => x.Dimensions.Unit.HasLength),
- DimensionsHasWidth = row.Get<PurchaseOrderItem, bool>(x => x.Dimensions.Unit.HasWidth),
- DimensionsHasWeight = row.Get<PurchaseOrderItem, bool>(x => x.Dimensions.Unit.HasWeight),
- DimensionsHasQuantity = row.Get<PurchaseOrderItem, bool>(x => x.Dimensions.Unit.HasQuantity),
- DimensionsUnitFormula = row.Get<PurchaseOrderItem, string>(x => x.Dimensions.Unit.Formula),
- DimensionsUnitFormat = row.Get<PurchaseOrderItem, string>(x => x.Dimensions.Unit.Format),
- DimensionsUnitCode = row.Get<PurchaseOrderItem, string>(x => x.Dimensions.Unit.Code),
- DimensionsUnitDescription = row.Get<PurchaseOrderItem, string>(x => x.Dimensions.Unit.Description),
- ExpectedQty = row.Get<PurchaseOrderItem, double>(x => x.Qty),
- };
- if (string.IsNullOrWhiteSpace(item.DimensionsUnitSize) || item.DimensionsUnitID == Guid.Empty)
- item = TryFixPOItem(item, row);
- poItemShells.Add(item);
- }
- LoadImages();
- Device.BeginInvokeOnMainThread(() =>
- {
- poItemListView.ItemsSource = poItemShells;
- poItemCountLbl.Text = "Items Unreceived: " + poItemShells.Count;
- });
- }
- }
- catch (Exception ex)
- {
- Device.BeginInvokeOnMainThread(() => { DisplayAlert("Error loading Purchase Order items - please try again", ex.Message, "OK"); });
- }
- });
- }
- private CoreTable QueryLoadPOItems()
- {
- try
- {
- return new Client<PurchaseOrderItem>().Query(
- new Filter<PurchaseOrderItem>(x => x.PurchaseOrderLink.ID).IsEqualTo(POID).And(x => x.ReceivedDate).IsEqualTo(DateTime.MinValue),
- columns);
- }
- catch (Exception ex)
- {
- InABox.Mobile.MobileLogging.Log(ex);
- return null;
- }
- }
- private void LoadImages()
- {
- Task.Run(() =>
- {
- List<Guid> productIds = new List<Guid>();
- foreach (POItemShell shell in poItemShells)
- {
- productIds.Add(shell.ProductID);
- }
- List<Guid> imageIds = new List<Guid>();
- Dictionary<Guid, Guid> imageProductIds = new Dictionary<Guid, Guid>();
- CoreTable table = QueryProductImageIDs(productIds);
- while (table == null)
- table = QueryProductImageIDs(productIds);
- foreach (CoreRow row in table.Rows)
- {
- if (row.Get<Product, Guid>(x => x.Image.ID) != Guid.Empty)
- {
- imageProductIds.Add(row.Get<Product, Guid>(x => x.Image.ID), row.Get<Product, Guid>(x => x.ID));
- }
- }
- CoreTable table2 = QueryDocuments(imageProductIds);
- while (table2 == null)
- table2 = QueryDocuments(imageProductIds);
- foreach (CoreRow row in table2.Rows)
- {
- byte[] data = row.Get<Document, byte[]>(x => x.Data);
- Guid imageid = row.Get<Document, Guid>(x => x.ID);
- Guid productid = imageProductIds[imageid];
- var item = poItemShells.FirstOrDefault(x => x.ProductID == productid);
- ImageSource src = ImageSource.FromStream(() => new MemoryStream(data));
- item.ImageSource = src;
- item.ImageVisible = true;
- if (deviceType == "Tablet")
- item.LastRowHeight = 300;
- else
- item.LastRowHeight = 150;
- }
- Device.BeginInvokeOnMainThread(() =>
- {
- poItemListView.ItemsSource = null;
- poItemListView.ItemsSource = poItemShells;
- });
- });
- }
- private CoreTable QueryDocuments(Dictionary<Guid, Guid> imageProductIds)
- {
- try
- {
- return new Client<Document>().Query(
- new Filter<Document>(x => x.ID).InList(imageProductIds.Keys.ToArray()),
- new Columns<Document>(ColumnTypeFlags.None).Add(x => x.ID, x => x.Data));
- }
- catch (Exception ex)
- {
- InABox.Mobile.MobileLogging.Log(ex);
- return null;
- }
- }
- private CoreTable QueryProductImageIDs(List<Guid> productIds)
- {
- try
- {
- return new Client<Product>().Query(
- new Filter<Product>(x => x.ID).InList(productIds.ToArray()),
- new Columns<Product>(ColumnTypeFlags.None).Add(x => x.ID, x => x.Image.ID)
- );
- }
- catch (Exception ex)
- {
- InABox.Mobile.MobileLogging.Log(ex);
- return null;
- }
- }
- private async void CreateNewConsignment()
- {
- using (await MaterialDialog.Instance.LoadingDialogAsync(message: "Creating new consignment"))
- {
- try
- {
- Consignment newConsignment = new Consignment() { };
- string name = "Unknown Supplier";
- if (supplierID != Guid.Empty)
- {
- newConsignment.Supplier.ID = supplierID;
- CoreTable supplierNameTable = QuerySuppliers();
- while (supplierNameTable == null)
- supplierNameTable = QuerySuppliers();
- name = supplierNameTable.Rows.FirstOrDefault().Values[0].ToString();
- }
- newConsignment.Description = "Consignment for receival of items from " + name + ". Auto generated from mobile app by " + App.Data.Me.Name;
- CoreTable consignmentNumberTable = QueryConsignment1();
- while (consignmentNumberTable == null)
- consignmentNumberTable = QueryConsignment1();
- if (consignmentNumberTable.Rows.Any())
- {
- SetConsignmentNumber(newConsignment, consignmentNumberTable);
- }
- else
- {
- CoreTable consignmentNumberTable2 = QueryConsignment2();
- while (consignmentNumberTable2 == null)
- consignmentNumberTable2 = QueryConsignment2();
- if (consignmentNumberTable2.Rows.Any())
- {
- SetConsignmentNumber(newConsignment, consignmentNumberTable2);
- }
- else
- newConsignment.Number = "APP1" + " From PO: " + PONumber;
- }
- newConsignment = SaveConsignment(newConsignment);
- consignmentID = newConsignment.ID;
- Save.IsVisible = true;
- consignmentNumber = newConsignment.Number;
- consignmentNumberLbl.Text = "Consignment: " + newConsignment.Number;
- if (consignmentID == Guid.Empty)
- {
- DisplayAlert("Error", "Unable to create new consignment", "OK");
- Navigation.PopAsync();
- }
- }
- catch { }
- }
- }
- private Consignment SaveConsignment(Consignment newConsignment)
- {
- try
- {
- new Client<Consignment>().Save(newConsignment, "Updated from mobile device");
- return newConsignment;
- }
- catch (Exception ex)
- {
- InABox.Mobile.MobileLogging.Log(ex);
- return SaveConsignment(newConsignment);
- }
- }
- private CoreTable QuerySuppliers()
- {
- try
- {
- return new Client<Supplier>().Query(
- new Filter<Supplier>(x => x.ID).IsEqualTo(supplierID),
- new Columns<Supplier>(ColumnTypeFlags.None).Add(x => x.Name)
- );
- }
- catch (Exception ex)
- {
- InABox.Mobile.MobileLogging.Log(ex);
- return null;
- }
- }
- private CoreTable QueryConsignment1()
- {
- try
- {
- return new Client<Consignment>().Query(
- new Filter<Consignment>(x => x.Number).Contains("APP").And(x => x.Created).IsGreaterThan(DateTime.Today.AddDays(-60)),
- new Columns<Consignment>(ColumnTypeFlags.None).Add(x => x.Number, x => x.Created),
- new SortOrder<Consignment>(x => x.Created));
- }
- catch (Exception ex)
- {
- InABox.Mobile.MobileLogging.Log(ex);
- return null;
- }
- }
- private CoreTable QueryConsignment2()
- {
- try
- {
- return new Client<Consignment>().Query(
- new Filter<Consignment>(x => x.Number).Contains("APP"),
- new Columns<Consignment>(ColumnTypeFlags.None).Add(x => x.Number, x => x.Created),
- new SortOrder<Consignment>(x => x.Created));
- }
- catch (Exception ex)
- {
- InABox.Mobile.MobileLogging.Log(ex);
- return null;
- }
- }
- private Consignment SetConsignmentNumber(Consignment newConsignment, CoreTable table)
- {
- List<int> numbers = new List<int>();
- foreach (CoreRow row in table.Rows)
- {
- string number = row.Values[0].ToString();
- if (number.Contains(" From PO"))
- {
- int index = number.IndexOf(" From PO");
- string firstSubstring = number.Substring(0, index);
- string secondSubString = firstSubstring.Substring(3, firstSubstring.Length - 3);
- try
- {
- int i = int.Parse(secondSubString);
- numbers.Add(i);
- }
- catch { }
- }
- }
- numbers.Sort();
- int lastInt = numbers.Last();
- lastInt++;
- newConsignment.Number = "APP" + lastInt.ToString() + " From PO" + PONumber;
- return newConsignment;
- }
- Columns<PurchaseOrderItem> columns = new Columns<PurchaseOrderItem>(ColumnTypeFlags.None).Add(x => x.ID,
- x => x.PurchaseOrderLink.PONumber,
- x => x.Consignment.Number,
- x => x.Job.Name,
- x => x.Job.JobNumber,
- x => x.Description,
- x => x.Qty,
- x => x.Consignment.ID,
- x => x.PurchaseOrderLink.ID,
- x => x.ReceivedDate,
- x => x.Job.ID,
- x => x.SupplierCode,
- x => x.Product.ID,
- x => x.Product.NonStock,
- x => x.Style.ID,
- x => x.Style.Code,
- x => x.Style.Description,
- x => x.Product.Image.ID,
- x => x.Product.DefaultLocation.ID,
- x => x.Product.DefaultLocation.Description,
- x => x.Product.DefaultLocation.Code,
- x => x.Dimensions.Unit.ID,
- x => x.Dimensions.Quantity,
- x => x.Dimensions.Length,
- x => x.Dimensions.Width,
- x => x.Dimensions.Height,
- x => x.Dimensions.Weight,
- x => x.Dimensions.Value,
- x => x.Dimensions.UnitSize,
- x => x.Cost,
- x => x.Dimensions.Unit.HasHeight,
- x => x.Dimensions.Unit.HasLength,
- x => x.Dimensions.Unit.HasWidth,
- x => x.Dimensions.Unit.HasWeight,
- x => x.Dimensions.Unit.HasQuantity,
- x => x.Dimensions.Unit.Formula,
- x => x.Dimensions.Unit.Format,
- x => x.Dimensions.Unit.Code,
- x => x.Dimensions.Unit.Description,
- x => x.Product.Dimensions.UnitSize,
- x => x.Product.Dimensions.Unit.ID,
- x => x.Product.Dimensions.Quantity,
- x => x.Product.Dimensions.Length,
- x => x.Product.Dimensions.Width,
- x => x.Product.Dimensions.Weight,
- x => x.Product.Dimensions.Height,
- x => x.Product.Dimensions.Value,
- x => x.Product.Dimensions.Unit.HasHeight,
- x => x.Product.Dimensions.Unit.HasLength,
- x => x.Product.Dimensions.Unit.HasWeight,
- x => x.Product.Dimensions.Unit.HasWidth,
- x => x.Product.Dimensions.Unit.HasQuantity,
- x => x.Product.Dimensions.Unit.Format,
- x => x.Product.Dimensions.Unit.Formula,
- x => x.Product.Dimensions.Unit.Code,
- x => x.Product.Dimensions.Unit.Description
- );
- private POItemShell TryFixPOItem(POItemShell item, CoreRow row)
- {
- PurchaseOrderItem poItem = row.ToObject<PurchaseOrderItem>();
- poItem.Dimensions.Quantity = poItem.Product.Dimensions.Quantity;
- poItem.Dimensions.Length = poItem.Product.Dimensions.Length;
- poItem.Dimensions.Width = poItem.Product.Dimensions.Width;
- poItem.Dimensions.Height = poItem.Product.Dimensions.Height;
- poItem.Dimensions.Weight = poItem.Product.Dimensions.Weight;
- poItem.Dimensions.Unit.ID = poItem.Product.Dimensions.Unit.ID;
- poItem.Dimensions.Unit.HasHeight = poItem.Product.Dimensions.Unit.HasHeight;
- poItem.Dimensions.Unit.HasLength = poItem.Product.Dimensions.Unit.HasLength;
- poItem.Dimensions.Unit.HasWidth = poItem.Product.Dimensions.Unit.HasWidth;
- poItem.Dimensions.Unit.HasWeight = poItem.Product.Dimensions.Unit.HasWeight;
- poItem.Dimensions.Unit.HasQuantity = poItem.Product.Dimensions.Unit.HasQuantity;
- poItem.Dimensions.Unit.Formula = poItem.Product.Dimensions.Unit.Formula;
- poItem.Dimensions.Unit.Code = poItem.Product.Dimensions.Unit.Code;
- poItem.Dimensions.Unit.Description = poItem.Product.Dimensions.Unit.Description;
- poItem.Dimensions.UnitSize = poItem.Product.Dimensions.UnitSize;
- poItem.Dimensions.Value = poItem.Product.Dimensions.Value;
- Task.Run(() => { DoSavePurchaseOrderItem(poItem); });
- item.DimensionsQuantity = poItem.Dimensions.Quantity;
- item.DimensionsLength = poItem.Dimensions.Length;
- item.DimensionsWeight = poItem.Dimensions.Weight;
- item.DimensionsWidth = poItem.Dimensions.Width;
- item.DimensionsHeight = poItem.Dimensions.Height;
- item.DimensionsUnitID = poItem.Dimensions.Unit.ID;
- item.DimensionsHasHeight = poItem.Dimensions.Unit.HasHeight;
- item.DimensionsHasLength = poItem.Dimensions.Unit.HasLength;
- item.DimensionsHasWidth = poItem.Dimensions.Unit.HasWidth;
- item.DimensionsHasWeight = poItem.Dimensions.Unit.HasWeight;
- item.DimensionsHasQuantity = poItem.Dimensions.Unit.HasQuantity;
- item.DimensionsUnitFormula = poItem.Dimensions.Unit.Formula;
- item.DimensionsUnitFormat = poItem.Dimensions.Unit.Format;
- item.DimensionsUnitCode = poItem.Dimensions.Unit.Code;
- item.DimensionsUnitDescription = poItem.Dimensions.Unit.Description;
- item.DimensionsUnitSize = poItem.Dimensions.UnitSize;
- item.DimensionsValue = poItem.Dimensions.Value;
- return item;
- }
- }
- #endregion
- }
- #region Classes
- public class POItemShell
- {
- public Guid ID { get; set; }
- public string PONumber { get; set; }
- public string ConsignmentNumber { get; set; }
- public string Description { get; set; }
- public Guid ConsignmentID { get; set; }
- public Guid POID { get; set; }
- public double ExpectedQty { get; set; }
- public Color Color { get; set; }
- public double ReceivedQty { get; set; }
- public bool HasQAForm { get; set; }
- public bool IsReadyForQA { get; set; }
- public Color QATextColor { get; set; }
- public Color QABtnColor { get; set; }
- public Guid DigitalFormID { get; set; }
- public DateTime FormCompleted { get; set; }
- public DateTime ReceivedDate { get; set; }
- public string SupplierCode { get; set; }
- public Guid ProductID { get; set; }
- public bool Nonstock { get; set; }
- public Guid JobID { get; set; }
- public string JobName { get; set; }
- public string JobNumber { get; set; }
- public Guid StyleID { get; set; }
- public string StyleCode { get; set; }
- public string StyleDescription { get; set; }
- public Guid StockLocationID { get; set; }
- public string StockLocationDescription { get; set; }
- public string StockLocationCode { get; set; }
- public bool ImageVisible { get; set; }
- public ImageSource ImageSource { get; set; }
- public double LastRowHeight { get; set; }
- public double Cost { get; set; }
- public Guid DimensionsUnitID { get; set; }
- public double DimensionsQuantity { get; set; }
- public double DimensionsLength { get; set; }
- public double DimensionsWidth { get; set; }
- public double DimensionsHeight { get; set; }
- public double DimensionsWeight { get; set; }
- public double DimensionsValue { get; set; }
- public string DimensionsUnitSize { get; set; }
- public bool DimensionsHasHeight { get; set; }
- public bool DimensionsHasLength { get; set; }
- public bool DimensionsHasWidth { get; set; }
- public bool DimensionsHasWeight { get; set; }
- public bool DimensionsHasQuantity { get; set; }
- public string DimensionsUnitFormula { get; set; }
- public string DimensionsUnitFormat { get; set; }
- public string DimensionsUnitCode { get; set; }
- public string DimensionsUnitDescription { get; set; }
- public POItemShell()
- {
- ID = Guid.Empty;
- PONumber = string.Empty;
- ConsignmentNumber = string.Empty;
- JobID = Guid.Empty;
- JobName = string.Empty;
- JobNumber = string.Empty;
- Description = string.Empty;
- ConsignmentID = Guid.Empty;
- POID = Guid.Empty;
- ExpectedQty = 0;
- Color = Color.Default;
- ReceivedQty = 0;
- HasQAForm = false;
- IsReadyForQA = false;
- QATextColor = Color.LightGray;
- DigitalFormID = Guid.Empty;
- FormCompleted = DateTime.MinValue;
- ReceivedDate = DateTime.MinValue;
- SupplierCode = string.Empty;
- ProductID = Guid.Empty;
- Nonstock = false;
- StyleID = Guid.Empty;
- StyleCode = string.Empty;
- StyleDescription = string.Empty;
- StockLocationID = Guid.Empty;
- StockLocationCode = "";
- StockLocationDescription = "";
- ImageVisible = false;
- ImageSource = "";
- LastRowHeight = 0;
- DimensionsUnitID = Guid.Empty;
- DimensionsQuantity = 0;
- DimensionsLength = 0;
- DimensionsWidth = 0;
- DimensionsHeight = 0;
- DimensionsWeight = 0;
- DimensionsValue = 0;
- DimensionsUnitSize = "";
- Cost = 0.0;
- DimensionsHasHeight = false;
- DimensionsHasLength = false;
- DimensionsHasWidth = false;
- DimensionsHasWeight = false;
- DimensionsHasQuantity = false;
- DimensionsUnitFormula = "";
- DimensionsUnitFormat = "";
- DimensionsUnitCode = "";
- DimensionsUnitDescription = "";
- }
- public POItemShell DuplicateNewShell(POItemShell poitemshell)
- {
- POItemShell shell = new POItemShell
- {
- ID = poitemshell.ID,
- PONumber = poitemshell.PONumber,
- ConsignmentNumber = poitemshell.ConsignmentNumber,
- JobID = poitemshell.JobID,
- JobName = poitemshell.JobName,
- JobNumber = poitemshell.JobNumber,
- Description = poitemshell.Description,
- ConsignmentID = poitemshell.ConsignmentID,
- POID = poitemshell.POID,
- ExpectedQty = poitemshell.ExpectedQty,
- Color = poitemshell.Color,
- ReceivedQty = poitemshell.ReceivedQty,
- HasQAForm = poitemshell.HasQAForm,
- IsReadyForQA = poitemshell.IsReadyForQA,
- QATextColor = poitemshell.QATextColor,
- QABtnColor = poitemshell.QABtnColor,
- DigitalFormID = poitemshell.DigitalFormID,
- FormCompleted = poitemshell.FormCompleted,
- ReceivedDate = poitemshell.ReceivedDate,
- SupplierCode = poitemshell.SupplierCode,
- ProductID = poitemshell.ProductID,
- Nonstock = poitemshell.Nonstock,
- StyleID = poitemshell.StyleID,
- StyleCode = poitemshell.StyleCode,
- StyleDescription = poitemshell.StyleDescription,
- StockLocationID = poitemshell.StockLocationID,
- StockLocationCode = poitemshell.StockLocationCode,
- StockLocationDescription = poitemshell.StockLocationDescription,
- ImageVisible = poitemshell.ImageVisible,
- ImageSource = poitemshell.ImageSource,
- LastRowHeight = poitemshell.LastRowHeight,
- DimensionsUnitID = poitemshell.DimensionsUnitID,
- DimensionsQuantity = poitemshell.DimensionsQuantity,
- DimensionsLength = poitemshell.DimensionsLength,
- DimensionsWidth = poitemshell.DimensionsWidth,
- DimensionsHeight = poitemshell.DimensionsHeight,
- DimensionsWeight = poitemshell.DimensionsWeight,
- DimensionsValue = poitemshell.DimensionsValue,
- DimensionsUnitSize = poitemshell.DimensionsUnitSize,
- Cost = poitemshell.Cost,
- DimensionsHasHeight = poitemshell.DimensionsHasHeight,
- DimensionsHasLength = poitemshell.DimensionsHasLength,
- DimensionsHasWidth = poitemshell.DimensionsHasWidth,
- DimensionsHasWeight = poitemshell.DimensionsHasWeight,
- DimensionsHasQuantity = poitemshell.DimensionsHasQuantity,
- DimensionsUnitFormula = poitemshell.DimensionsUnitFormula,
- DimensionsUnitFormat = poitemshell.DimensionsUnitFormat,
- DimensionsUnitCode = poitemshell.DimensionsUnitCode,
- DimensionsUnitDescription = poitemshell.DimensionsUnitDescription
- };
- return shell;
- }
- }
- #endregion
|