Browse Source

PRS MOBILE - refactor of Store Requis (implemented picked date, various bug fixes for dimensions and holdings changes)

Nick-PRSDigital@bitbucket.org 2 years ago
parent
commit
4bc23ff20f

+ 61 - 8
prs.mobile/comal.timesheets/StoreRequis/RequiItems.cs

@@ -1,8 +1,10 @@
 using comal.timesheets.CustomControls;
 using Comal.Classes;
+using InABox.Clients;
+using InABox.Core;
 using System;
 using System.Collections.Generic;
-using System.Text;
+using System.Linq;
 
 namespace comal.timesheets
 {
@@ -13,11 +15,12 @@ namespace comal.timesheets
         public static List<HoldingsCacheShell> holdingsCache { get; set; }
         public static bool HoldingsLoaded { get; set; }
 
-        public class HoldingsCacheShell
+
+        [DoNotPersist]
+        public class HoldingsCacheShell : Entity
         {
-            public Guid ID { get; set; }
-            public Guid ProductID { get; set; }
             public Guid LocationID { get; set; }
+            public Guid ProductID { get; set; }
             public string LocationName { get; set; }
             public string Units { get; set; }
             public Guid JobID { get; set; }
@@ -26,22 +29,72 @@ namespace comal.timesheets
             public Guid StyleID { get; set; }
             public string StyleCode { get; set; }
             public string StyleDescription { get; set; }
-            public string DimensionsUnitSize { get; set; }
+            public StockDimensions Dimensions { get; set; }
 
             public HoldingsCacheShell()
             {
-                ID = Guid.Empty;
-                ProductID = Guid.Empty;
                 LocationID = Guid.Empty;
+                ProductID = Guid.Empty;
                 LocationName = "";
                 Units = "";
-                DimensionsUnitSize = "";
                 JobID = Guid.Empty;
                 JobNumber = "";
                 JobName = "";
                 StyleID = Guid.Empty;
                 StyleCode = "";
                 StyleDescription = "";
+                Dimensions = new StockDimensions(() => this);
+            }
+
+            /// <summary>
+            /// For Display Purposes, and save loading time until Dimensions are needed
+            /// </summary>
+            public void UpdateDimensionsAndLocationName()
+            {
+                if (ProductID != Guid.Empty)
+                {
+                    CoreTable table = new Client<Product>().Query(new Filter<Product>(x => x.ID).IsEqualTo(ProductID),
+                        new Columns<Product>(
+                            x => x.Dimensions.Unit.ID,
+                            x => x.Dimensions.Unit.HasQuantity,
+                            x => x.Dimensions.Unit.HasLength,
+                            x => x.Dimensions.Unit.HasHeight,
+                            x => x.Dimensions.Unit.HasWeight,
+                            x => x.Dimensions.Unit.HasWidth,
+                            x => x.Dimensions.Quantity,
+                            x => x.Dimensions.Length,
+                            x => x.Dimensions.Height,
+                            x => x.Dimensions.Weight,
+                            x => x.Dimensions.Width,
+                            x => x.Dimensions.Unit.Format,
+                            x => x.Dimensions.Unit.Formula,
+                            x => x.Dimensions.UnitSize
+                            ));
+                    Product product = table.Rows.FirstOrDefault().ToObject<Product>();
+
+                    Dimensions.Unit.ID = product.Dimensions.Unit.ID;
+                    Dimensions.Unit.HasQuantity = product.Dimensions.Unit.HasQuantity;
+                    Dimensions.Unit.HasLength = product.Dimensions.Unit.HasLength;
+                    Dimensions.Unit.HasHeight = product.Dimensions.Unit.HasHeight;
+                    Dimensions.Unit.HasWeight = product.Dimensions.Unit.HasWeight;
+                    Dimensions.Unit.HasWidth = product.Dimensions.Unit.HasWidth;
+
+                    Dimensions.Quantity = product.Dimensions.Quantity;
+                    Dimensions.Length = product.Dimensions.Length;
+                    Dimensions.Height = product.Dimensions.Height;
+                    Dimensions.Weight = product.Dimensions.Weight;
+                    Dimensions.Width = product.Dimensions.Width;
+
+                    Dimensions.Unit.Format = product.Dimensions.Unit.Format;
+                    Dimensions.Unit.Formula = product.Dimensions.Unit.Formula;
+
+                    Dimensions.UnitSize = product.Dimensions.UnitSize;
+                }
+
+                LocationName = LocationName + " (Units: " + Units + ")" +
+                            Environment.NewLine + "Style: " + StyleDescription
+                            + Environment.NewLine + "Job: " + JobNumber
+                            + Environment.NewLine + "Size: " + Dimensions.UnitSize;
             }
         }
 

+ 34 - 11
prs.mobile/comal.timesheets/StoreRequis/StoreRequiConfirmationPage.xaml.cs

@@ -448,7 +448,7 @@ namespace comal.timesheets.StoreRequis
             new Client<Requisition>().Save(requisition, "Saved requi on mobile device");
         }
 
-        private async void SaveItems()
+        private void SaveItems()
         {
             Task.Run(() =>
             {
@@ -470,24 +470,47 @@ namespace comal.timesheets.StoreRequis
                 }
             });
             List<RequisitionItem> toSave = new List<RequisitionItem>();
-            foreach (StoreRequiItemShell itemShell in requiItems)
+            foreach (StoreRequiItemShell requiItemShell in requiItems)
             {
                 RequisitionItem item = new RequisitionItem();
                 item.RequisitionLink.ID = requisition.ID;
-                item.ID = itemShell.ID;
-                item.Product.ID = itemShell.ProductID;
-                item.Product.Code = itemShell.ProductCode;
-                item.Product.Name = itemShell.ProductName;
-                item.Location.ID = itemShell.HoldingID;
-                item.Quantity = itemShell.Quantity;
-                item.Description = item.Product.Name;
-                item.Code = item.Product.Code;
+                item.ID = requiItemShell.ID;
+                item.Product.ID = requiItemShell.ProductID;
+                item.Product.Code = requiItemShell.ProductCode;
+                item.Product.Name = requiItemShell.ProductName;
+                item.Location.ID = requiItemShell.LocationID;
+                item.Quantity = requiItemShell.Quantity;
+                item.Description = requiItemShell.ProductName;
+                item.Code = requiItemShell.ProductCode;
+                item.Job.ID = requiItemShell.JobID;
+                item.Style.ID = requiItemShell.StyleID;            
+
+                item.Picked = item.Picked == DateTime.MinValue ? DateTime.Now : item.Picked;
+
+                item.Dimensions.Unit.ID = requiItemShell.Dimensions.Unit.ID;
+                item.Dimensions.Unit.HasQuantity = requiItemShell.Dimensions.Unit.HasQuantity;
+                item.Dimensions.Unit.HasLength = requiItemShell.Dimensions.Unit.HasLength;
+                item.Dimensions.Unit.HasHeight = requiItemShell.Dimensions.Unit.HasHeight;
+                item.Dimensions.Unit.HasWeight = requiItemShell.Dimensions.Unit.HasWeight;
+                item.Dimensions.Unit.HasWidth = requiItemShell.Dimensions.Unit.HasWidth;
+
+                item.Dimensions.Quantity = requiItemShell.Dimensions.Quantity;
+                item.Dimensions.Length = requiItemShell.Dimensions.Length;
+                item.Dimensions.Height = requiItemShell.Dimensions.Height;
+                item.Dimensions.Weight = requiItemShell.Dimensions.Weight;
+                item.Dimensions.Width = requiItemShell.Dimensions.Width;
+
+                item.Dimensions.Unit.Format = requiItemShell.Dimensions.Unit.Format;
+                item.Dimensions.Unit.Formula = requiItemShell.Dimensions.Unit.Formula;
+
+                item.Dimensions.UnitSize = requiItemShell.Dimensions.UnitSize;
+
                 toSave.Add(item);
             }
             new Client<RequisitionItem>().Save(toSave, "Saved requi on mobile device");
         }
 
-        private async void SavePhotos()
+        private void SavePhotos()
         {
             Task.Run(() =>
             {

+ 67 - 53
prs.mobile/comal.timesheets/StoreRequis/StoreRequiList.xaml.cs

@@ -8,6 +8,7 @@ using InABox.Clients;
 using InABox.Core;
 using Xamarin.Forms;
 using Xamarin.Forms.Xaml;
+using ZXing.PDF417.Internal;
 using static comal.timesheets.RequiItems;
 
 namespace comal.timesheets.StoreRequis
@@ -115,63 +116,78 @@ namespace comal.timesheets.StoreRequis
                 CoreTable table = new Client<StockHolding>().Query(
                         new Filter<StockHolding>(x => x.Qty).IsGreaterThan(0),
                         new Columns<StockHolding>(
-                            x => x.ID, //0
-                            x => x.Product.ID, //1
-                            x => x.Location.ID, //2
-                            x => x.Location.Description, //3
-                            x => x.Units, //4
-                            x => x.Dimensions.UnitSize, //5
-                            x => x.Job.ID, //6
-                            x => x.Job.JobNumber, //7
-                            x => x.Job.Name, //8
-                            x => x.Style.ID, //9
-                            x => x.Style.Code, //10
-                            x => x.Style.Description //11
+                            x => x.ID,
+                            x => x.Product.ID,
+                            x => x.Location.ID,
+                            x => x.Location.Description,
+                            x => x.Units,
+                            x => x.Job.ID,
+                            x => x.Job.JobNumber,
+                            x => x.Job.Name,
+                            x => x.Style.ID,
+                            x => x.Style.Code,
+                            x => x.Style.Description,
+                            x => x.Dimensions.Unit.ID,
+                            x => x.Dimensions.Unit.HasQuantity,
+                            x => x.Dimensions.Unit.HasLength,
+                            x => x.Dimensions.Unit.HasHeight,
+                            x => x.Dimensions.Unit.HasWeight,
+                            x => x.Dimensions.Unit.HasWidth,
+                            x => x.Dimensions.Quantity,
+                            x => x.Dimensions.Length,
+                            x => x.Dimensions.Height,
+                            x => x.Dimensions.Weight,
+                            x => x.Dimensions.Width,
+                            x => x.Dimensions.Unit.Format,
+                            x => x.Dimensions.Unit.Formula,
+                            x => x.Dimensions.UnitSize
                             )
                         );
                 foreach (CoreRow row in table.Rows)
                 {
-                    List<object> list = row.Values;
-                    if (list[4] == null) { list[4] = 0.0; } //4
-                    double dble = 0.0;
-                    if (double.TryParse(list[4].ToString(), out dble))
+                    if (row.Get<StockHolding, double>(x => x.Units) == 0.0)
+                        continue;
+
+                    HoldingsCacheShell holding = new HoldingsCacheShell()
                     {
-                        if (dble != 0.0 && dble > 0) //filtering out zero quantities
-                        {
-                            if (list[0] == null) { list[0] = Guid.Empty; } //0
-                            if (list[1] == null) { list[1] = Guid.Empty; } //1
-                            if (list[2] == null) { list[2] = Guid.Empty; } //2
-                            if (list[3] == null) { list[3] = ""; } //3
-                            if (list[5] == null) { list[5] = ""; } //5
-                            if (list[6] == null) { list[6] = Guid.Empty; } //6
-                            if (list[7] == null) { list[7] = ""; } //7
-                            if (list[8] == null) { list[8] = ""; } //8
-                            if (list[9] == null) { list[9] = Guid.Empty; } //9
-                            if (list[10] == null) { list[10] = ""; } //10
-                            if (list[11] == null) { list[11] = ""; } //11
-
-                            HoldingsCacheShell holdingsCacheShell = new HoldingsCacheShell()
-                            {
-                                ID = Guid.Parse(list[0].ToString()),
-                                ProductID = Guid.Parse(list[1].ToString()),
-                                LocationID = Guid.Parse(list[2].ToString()),
-                                LocationName = list[3].ToString(),
-                                Units = double.Parse(list[4].ToString()).ToString(),
-                                DimensionsUnitSize = list[5].ToString(),
-                                JobID = Guid.Parse(list[6].ToString()),
-                                JobNumber = list[7].ToString(),
-                                JobName = list[8].ToString(),
-                                StyleID = Guid.Parse(list[9].ToString()),
-                                StyleCode = list[10].ToString(),
-                                StyleDescription = list[11].ToString(),
-                            };
-                            if (holdingsCacheShell.Units != "0")
-                            {
-                                holdingsCache.Add(holdingsCacheShell);
-                            }
-                        }
-                    }
+                        ProductID = row.Get<StockHolding, Guid>(x => x.Product.ID),
+                        LocationID = row.Get<StockHolding, Guid>(x => x.Location.ID),
+                        LocationName = row.Get<StockHolding, string>(x => x.Location.Description),
+                        Units = row.Get<StockHolding, double>(x => x.Units).ToString(),
+                        JobID = row.Get<StockHolding, Guid>(x => x.Job.ID),
+                        JobNumber = row.Get<StockHolding, string>(x => x.Job.JobNumber),
+                        JobName = row.Get<StockHolding, string>(x => x.Job.Name),
+                        StyleID = row.Get<StockHolding, Guid>(x => x.Style.ID),
+                        StyleCode = row.Get<StockHolding, string>(x => x.Style.Code),
+                        StyleDescription = row.Get<StockHolding, string>(x => x.Style.Description)
+                    };
+
+                    holding.Dimensions.Unit.ID = row.Get<StockHolding, Guid>(x => x.Dimensions.Unit.ID);
+                    holding.Dimensions.Unit.HasQuantity = row.Get<StockHolding, bool>(x => x.Dimensions.Unit.HasQuantity);
+                    holding.Dimensions.Unit.HasLength = row.Get<StockHolding, bool>(x => x.Dimensions.Unit.HasLength);
+                    holding.Dimensions.Unit.HasHeight = row.Get<StockHolding, bool>(x => x.Dimensions.Unit.HasHeight);
+                    holding.Dimensions.Unit.HasWeight = row.Get<StockHolding, bool>(x => x.Dimensions.Unit.HasWeight);
+                    holding.Dimensions.Unit.HasWidth = row.Get<StockHolding, bool>(x => x.Dimensions.Unit.HasWidth);
+
+                    holding.Dimensions.Quantity = row.Get<StockHolding, double>(x => x.Dimensions.Quantity);
+                    holding.Dimensions.Length = row.Get<StockHolding, double>(x => x.Dimensions.Length);
+                    holding.Dimensions.Height = row.Get<StockHolding, double>(x => x.Dimensions.Height);
+                    holding.Dimensions.Weight = row.Get<StockHolding, double>(x => x.Dimensions.Weight);
+                    holding.Dimensions.Width = row.Get<StockHolding, double>(x => x.Dimensions.Width);
+
+                    holding.Dimensions.Unit.Format = row.Get<StockHolding, string>(x => x.Dimensions.Unit.Format);
+                    holding.Dimensions.Unit.Formula = row.Get<StockHolding, string>(x => x.Dimensions.Unit.Formula);
+
+                    holding.Dimensions.UnitSize = row.Get<StockHolding, string>(x => x.Dimensions.UnitSize);
+
+                    holding.LocationName = holding.LocationName + " (Units: " + holding.Units + ")" +
+                           Environment.NewLine + "Style: " + holding.StyleDescription
+                           + Environment.NewLine + "Job: " + holding.JobNumber
+                           + Environment.NewLine + "Size: " + holding.Dimensions.UnitSize;
+
+                    holdingsCache.Add(holding);
                 }
+;
                 RequiItems.HoldingsLoaded = true;
             });
         }
@@ -198,7 +214,5 @@ namespace comal.timesheets.StoreRequis
             Job = "";
             Request = "";
         }
-
-
     }
 }

+ 2 - 2
prs.mobile/comal.timesheets/StoreRequis/StoreRequiScannerPage.xaml

@@ -104,8 +104,8 @@
                                 Margin="0,5,0,0">
                         <ListView.ItemTemplate>
                             <DataTemplate>
-                                <ViewCell>
-                                    <Frame Padding="3" BorderColor="{Binding BorderColor}" Margin="5" CornerRadius="10" HasShadow="False">
+                                <ViewCell Tapped="RequiItem_Tapped">
+                                    <Frame Padding="3" BorderColor="{Binding BorderColor}" Margin="5" CornerRadius="10" HasShadow="False" BackgroundColor="{Binding Colour}">
                                         <Grid>
                                             <Grid.RowDefinitions>
                                                 <RowDefinition Height="auto"/>

+ 125 - 82
prs.mobile/comal.timesheets/StoreRequis/StoreRequiScannerPage.xaml.cs

@@ -6,15 +6,14 @@ using System.Threading.Tasks;
 using Xamarin.Essentials;
 using Xamarin.Forms;
 using Xamarin.Forms.Xaml;
-using comal.timesheets.CustomControls;
 using Comal.Classes;
 using InABox.Core;
 using InABox.Clients;
 using System.Threading;
 using static comal.timesheets.RequiItems;
 using XF.Material.Forms.UI.Dialogs;
-using Plugin.SimpleAudioPlayer;
 using comal.timesheets.StoreRequis;
+using ZXing.PDF417.Internal;
 
 namespace comal.timesheets
 {
@@ -22,7 +21,7 @@ namespace comal.timesheets
     public partial class StoreRequiScannerPage : ContentPage
     {
         #region Fields / Constructor
-        public delegate bool OnScanEvent(object sender, String barcode);
+        public delegate bool OnScanEvent(object sender, string barcode);
         public event OnScanEvent OnScan;
         List<StoreRequiItemShell> shells = new List<StoreRequiItemShell>();
         List<StoreRequiItemShell> oldShells = new List<StoreRequiItemShell>();
@@ -133,38 +132,31 @@ namespace comal.timesheets
                    (
                    new Filter<RequisitionItem>(x => x.RequisitionLink.ID).IsEqualTo(requisition.ID),
                    new Columns<RequisitionItem>(
-                       x => x.ID, //0
-                       x => x.Product.ID, //1 
-                       x => x.Product.Name, //2
-                       x => x.Product.Code, //3
-                       x => x.Quantity, //4
-                       x => x.Location.ID, //5
-                       x => x.Location.Description //6
+                       x => x.ID,
+                       x => x.Product.ID,
+                       x => x.Product.Name,
+                       x => x.Product.Code,
+                       x => x.Quantity,
+                       x => x.Location.ID,
+                       x => x.Location.Description,
+                       x => x.Picked
                        )
                    );
                 if (table.Rows.Any())
                 {
-                    Device.BeginInvokeOnMainThread(() =>{ saveBtn.IsVisible = true; });
-                        foreach (CoreRow row in table.Rows)
+                    Device.BeginInvokeOnMainThread(() => { saveBtn.IsVisible = true; });
+                    foreach (CoreRow row in table.Rows)
                     {
-                        List<object> list = row.Values;
-                        if (list[0] == null) { list[0] = Guid.Empty; }
-                        if (list[1] == null) { list[1] = Guid.Empty; }
-                        if (list[2] == null) { list[2] = ""; }
-                        if (list[3] == null) { list[3] = ""; }
-                        if (list[4] == null) { list[4] = 0.0; }
-                        if (list[5] == null) { list[5] = Guid.Empty; }
-                        if (list[6] == null) { list[6] = ""; }
-
                         StoreRequiItemShell shell = new StoreRequiItemShell()
                         {
-                            ID = Guid.Parse(list[0].ToString()),
-                            ProductID = Guid.Parse(list[1].ToString()),
-                            ProductName = list[2].ToString(),
-                            ProductCode = list[3].ToString(),
-                            Quantity = double.Parse(list[4].ToString()),
-                            HoldingID = Guid.Parse(list[5].ToString()),
-                            LocationName = list[6].ToString(),
+                            ID = row.Get<RequisitionItem, Guid>(x => x.ID),
+                            ProductID = row.Get<RequisitionItem, Guid>(x => x.Product.ID),
+                            ProductName = row.Get<RequisitionItem, string>(x => x.Product.Name),
+                            ProductCode = row.Get<RequisitionItem, string>(x => x.Product.Code),
+                            Quantity = row.Get<RequisitionItem, double>(x => x.Quantity),
+                            LocationID = row.Get<RequisitionItem, Guid>(x => x.Location.ID),
+                            LocationName = row.Get<RequisitionItem, string>(x => x.Location.Description),
+                            Picked = row.Get<RequisitionItem, DateTime>(x => x.Picked),
                         };
                         shells.Add(shell);
                         oldShells.Add(shell);
@@ -289,7 +281,7 @@ namespace comal.timesheets
             return tuple;
         }
 
-        private async void LoadProduct(Tuple<string, double> processedResultQtyTuple, string rawResult)
+        private void LoadProduct(Tuple<string, double> processedResultQtyTuple, string rawResult)
         {
             Device.BeginInvokeOnMainThread(async () =>
             {
@@ -297,38 +289,28 @@ namespace comal.timesheets
                 ProductShell product = GlobalVariables.ProductShells.Find(x => x.Code.Equals(processedResultQtyTuple.Item1));
 
                 string itemLocation = "";
-                Guid holdingID = Guid.Empty;
+                Guid locationID = Guid.Empty;
 
                 //lookup holding for product in holdings cache
                 try
                 {
                     List<HoldingsCacheShell> list = holdingsCache.Where(x => x.ProductID.Equals(product.ID)).ToList();
-                    if (list.Count == 1) //one stockholding - auto choose shelf
-                    {
-                        HoldingsCacheShell holding = list.First();
-                        itemLocation = holding.LocationName;
-                        holdingID = holding.ID;
-                    }
-                    else if (list.Count > 1)  //more than one stockholding - choose shelf
+                    if (list.Count == 1) //one stockholding - auto choose holding
+                        AddShell(list.First(), product, rawResult, processedResultQtyTuple);
+                    
+                    else if (list.Count > 1)  //more than one stockholding - user choose shelf
                     {
-                        loading = true;
-                        Dictionary<string, Guid> holdingIDLocations = new Dictionary<string, Guid>();
+                        Dictionary<string, Guid> holdingLocationIDs = new Dictionary<string, Guid>();
                         foreach (HoldingsCacheShell holding in list)
                         {
-                            if (!holdingIDLocations.ContainsKey(holding.LocationName + " (Units: " + holding.Units + ")"))
-                            {
-                                holdingIDLocations.Add(holding.LocationName + " (Units: " + holding.Units + ")" + 
-                                    Environment.NewLine + "Style: " + holding.StyleDescription
-                                    + Environment.NewLine + "Job: " + holding.JobNumber
-                                    + Environment.NewLine + "Size: " + holding.DimensionsUnitSize, holding.ID);
-                            }
+                            if (!holdingLocationIDs.ContainsKey(holding.LocationName))
+                                holdingLocationIDs.Add(holding.LocationName, holding.LocationID);
                         }
-                        List<string> options = holdingIDLocations.Keys.ToList();
+                        List<string> options = holdingLocationIDs.Keys.ToList();
                         ListSelectionPage page = new ListSelectionPage(options);
-                        page.OnSimpleListTapped += (s) => 
+                        page.OnSimpleListTapped += (locationName) =>
                         {
-                            itemLocation = s;
-                            holdingID = holdingIDLocations[s];
+                            AddShell(list.Find(x => x.LocationName == locationName),product, rawResult, processedResultQtyTuple);
                         };
                         Navigation.PushAsync(page);
                     }
@@ -338,6 +320,7 @@ namespace comal.timesheets
                         loading = false;
                         return;
                     }
+                    loading = false;
                 }
                 catch (Exception e)
                 {
@@ -345,38 +328,61 @@ namespace comal.timesheets
                     loading = false;
                     return;
                 }
+            });
+        }
 
-                StoreRequiItemShell shell = new StoreRequiItemShell
-                {
-                    ProductID = product.ID,
-                    ProductName = product.Name,
-                    ProductCode = product.Code,
-                    Quantity = 1,
-                    HoldingID = holdingID,
-                    LocationName = itemLocation,
-                };
-                shells.Add(shell);
+        private void AddShell(HoldingsCacheShell holding, ProductShell product, string rawResult, Tuple<string, double> processedResultQtyTuple)
+        {
+            StoreRequiItemShell shell = new StoreRequiItemShell
+            {
+                ProductID = product.ID,
+                ProductName = product.Name,
+                ProductCode = product.Code,
+                Quantity = 1,
+                LocationID = holding.LocationID,
+                LocationName = holding.LocationName,
+                StyleID = holding.StyleID,
+                JobID = holding.StyleID
+            };
+            shell.Dimensions.Unit.ID = holding.Dimensions.Unit.ID;
+            shell.Dimensions.Unit.HasQuantity = holding.Dimensions.Unit.HasQuantity;
+            shell.Dimensions.Unit.HasLength = holding.Dimensions.Unit.HasLength;
+            shell.Dimensions.Unit.HasHeight = holding.Dimensions.Unit.HasHeight;
+            shell.Dimensions.Unit.HasWeight = holding.Dimensions.Unit.HasWeight;
+            shell.Dimensions.Unit.HasWidth = holding.Dimensions.Unit.HasWidth;
 
-                itemRowScannerRawResultPairs.Add(shell, rawResult);
-                itemRowScannerProcessedResultPairs.Add(shell, processedResultQtyTuple.Item1);
+            shell.Dimensions.Quantity = holding.Dimensions.Quantity;
+            shell.Dimensions.Length = holding.Dimensions.Length;
+            shell.Dimensions.Height = holding.Dimensions.Height;
+            shell.Dimensions.Weight = holding.Dimensions.Weight;
+            shell.Dimensions.Width = holding.Dimensions.Width;
 
-                requiItemListView.ItemsSource = null;
-                requiItemListView.ItemsSource = shells;
+            shell.Dimensions.Unit.Format = holding.Dimensions.Unit.Format;
+            shell.Dimensions.Unit.Formula = holding.Dimensions.Unit.Formula;
 
-                countLbl.IsVisible = true;
+            shell.Dimensions.UnitSize = holding.Dimensions.UnitSize;
 
-                if (containsNotes)
-                {
-                    countLbl.Text = "Number of items: " + (shells.Count - 1);
-                }
-                else
-                {
-                    countLbl.Text = "Number of items: " + shells.Count;
-                }
+            shells.Add(shell);
 
-                saveBtn.IsVisible = true;
-                loading = false;
-            });
+            itemRowScannerRawResultPairs.Add(shell, rawResult);
+            itemRowScannerProcessedResultPairs.Add(shell, processedResultQtyTuple.Item1);
+
+            requiItemListView.ItemsSource = null;
+            requiItemListView.ItemsSource = shells;
+
+            countLbl.IsVisible = true;
+
+            if (containsNotes)
+            {
+                countLbl.Text = "Number of items: " + (shells.Count - 1);
+            }
+            else
+            {
+                countLbl.Text = "Number of items: " + shells.Count;
+            }
+
+            saveBtn.IsVisible = true;
+            loading = false;
         }
         #endregion
 
@@ -420,7 +426,7 @@ namespace comal.timesheets
                         default:
                             return;
                     }
-                }               
+                }
             }
             else
                 Navigation.PopAsync();
@@ -434,6 +440,32 @@ namespace comal.timesheets
             Navigation.PushAsync(page);
         }
 
+        private async void RequiItem_Tapped(object sender, EventArgs e)
+        {
+            var shell = requiItemListView.SelectedItem as StoreRequiItemShell;
+            if (shell == null) return;
+
+            await RequiItemTappedAsync(shell);
+        }
+
+        private async Task RequiItemTappedAsync(StoreRequiItemShell shell)
+        {
+            string pickstatus = shell.Picked == DateTime.MinValue ? "not picked" : "picked (" + shell.Picked.ToString("dd MMM yy") + ")";
+            string options = shell.Picked == DateTime.MinValue ? ". Mark as Picked?" : ". Remove Picked status?";
+
+            string chosenOption = await DisplayActionSheet("Line is " + pickstatus + options, "Cancel", null, "Yes", "No");
+
+            if (chosenOption != "Yes")
+                return;
+
+            shell.Picked = shell.Picked == DateTime.MinValue ? DateTime.Today : DateTime.MinValue;
+            shell.Colour = shell.Picked == DateTime.MinValue ? Color.Default : Color.FromHex("#8fbc8f");
+
+            requiItemListView.ItemsSource = null;
+            requiItemListView.ItemsSource = shells;
+        }
+
+
         void ReduceQtyBtn_Clicked(object sender, EventArgs e)
         {
             var shell = ((TappedEventArgs)e).Parameter as StoreRequiItemShell;
@@ -472,7 +504,8 @@ namespace comal.timesheets
         void IncreaseQtyBtn_Clicked(object sender, EventArgs e)
         {
             var shell = ((TappedEventArgs)e).Parameter as StoreRequiItemShell;
-            if (shell == null) return;
+            if (shell == null)
+                return;
 
             shell.Quantity++;
             requiItemListView.ItemsSource = null;
@@ -504,19 +537,24 @@ namespace comal.timesheets
         #endregion
     }
 
-    public class StoreRequiItemShell
+    [DoNotPersist]
+    public class StoreRequiItemShell : Entity
     {
-        public Guid ID { get; set; }
         public Guid ProductID { get; set; }
         public string ProductCode { get; set; }
         public string ProductName { get; set; }
         public string LocationName { get; set; }
         public double Quantity { get; set; }
-        public Guid HoldingID { get; set; }
+        public Guid LocationID { get; set; }
         public Color BorderColor { get; set; }
         public bool IsNotes { get; set; }
         public bool IsNotNotes { get; set; }
         public string Summary { get; set; }
+        public DateTime Picked { get; set; }
+        public Color Colour { get; set; }
+        public Guid JobID { get; set; }
+        public Guid StyleID { get; set; }
+        public StockDimensions Dimensions { get; set; }
         public StoreRequiItemShell()
         {
             ProductID = Guid.Empty;
@@ -525,10 +563,15 @@ namespace comal.timesheets
             LocationName = "";
             Quantity = 0;
             ID = Guid.Empty;
-            HoldingID = Guid.Empty;
+            LocationID = Guid.Empty;
             BorderColor = Color.FromHex("#15C7C1");
             IsNotes = false;
             IsNotNotes = true;
+            Picked = DateTime.MinValue;
+            Colour = Color.Default;
+            JobID = Guid.Empty;
+            StyleID = Guid.Empty;
+            Dimensions = new StockDimensions(() => this);
         }
     }
 }

+ 2 - 2
prs.mobile/comal.timesheets/StoreRequis/StoreRequisMainPage.xaml.cs

@@ -212,7 +212,7 @@ namespace comal.timesheets.StoreRequis
                         {
                             HoldingsCacheShell holding = list.First();
                             itemLocation = holding.LocationName;
-                            holdingID = holding.ID;
+                            holdingID = holding.LocationID;
                         }
                         else if (list.Count > 1)  //more than one stockholding - choose shelf
                         {
@@ -222,7 +222,7 @@ namespace comal.timesheets.StoreRequis
                             {
                                 if (!holdingIDLocations.ContainsKey(holding.LocationName + " (Qty: " + holding.Units + ")"))
                                 {
-                                    holdingIDLocations.Add(holding.LocationName + " (Qty: " + holding.Units + ")", holding.ID);
+                                    holdingIDLocations.Add(holding.LocationName + " (Qty: " + holding.Units + ")", holding.LocationID);
                                 }
                             }
                             string[] array = holdingIDLocations.Keys.ToArray();