Browse Source

PRS MOBILE - bug fixes to stocktake and transfer functions (dimensions issues)

Nick-PRSDigital@bitbucket.org 2 năm trước cách đây
mục cha
commit
9a001ba6d3

+ 1 - 2
prs.mobile/comal.timesheets.Android/Resources/Resource.designer.cs

@@ -14,7 +14,7 @@ namespace comal.timesheets.Droid
 {
 	
 	
-	[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Xamarin.Android.Build.Tasks", "13.1.0.5")]
+	[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Xamarin.Android.Build.Tasks", "13.0.0.73")]
 	public partial class Resource
 	{
 		
@@ -25,7 +25,6 @@ namespace comal.timesheets.Droid
 		
 		public static void UpdateIdValues()
 		{
-			global::InABox.Mobile.AppVersion.Android.Resource.String.library_name = global::comal.timesheets.Droid.Resource.String.library_name;
 			global::Lottie.Forms.Resource.Animation.abc_fade_in = global::comal.timesheets.Droid.Resource.Animation.abc_fade_in;
 			global::Lottie.Forms.Resource.Animation.abc_fade_out = global::comal.timesheets.Droid.Resource.Animation.abc_fade_out;
 			global::Lottie.Forms.Resource.Animation.abc_grow_fade_in_from_bottom = global::comal.timesheets.Droid.Resource.Animation.abc_grow_fade_in_from_bottom;

+ 5 - 5
prs.mobile/comal.timesheets/Warehousing/Products/ProductList.xaml.cs

@@ -233,13 +233,13 @@ namespace comal.timesheets
         private async void ProductList_Tapped(object sender, EventArgs e)
         {
             ProductShell product = productListView.SelectedItem as ProductShell;
-            SelectedProduct = new ProductShell();
+            SelectedProduct = product;
             if (addingProduct)
             {
-                SelectedProduct.ID = product.ID;
-                SelectedProduct.Code = product.Code;
-                SelectedProduct.Name = product.Name;
-                SelectedProduct.ImageID = product.ImageID;
+                //SelectedProduct.ID = product.ID;
+                //SelectedProduct.Code = product.Code;
+                //SelectedProduct.Name = product.Name;
+                //SelectedProduct.ImageID = product.ImageID;
                 OnProductSelected?.Invoke();
                 Navigation.PopAsync();
             }

+ 9 - 8
prs.mobile/comal.timesheets/Warehousing/StockLocationSelectionPage.xaml.cs

@@ -328,7 +328,8 @@ namespace comal.timesheets
                        x => x.Warehouse.Description, //4
                        x => x.Job.JobNumber, //5
                        x => x.Job.ID, //6
-                       x => x.Job.Name //7 
+                       x => x.Job.Name, //7
+                       x => x.Holdings
                    ));
                 foreach (CoreRow row in table.Rows)
                 {
@@ -352,6 +353,7 @@ namespace comal.timesheets
                         JobNumber = "Job: " + list[5].ToString(),
                         JobID = Guid.Parse(list[6].ToString()),
                         JobName = list[7].ToString(),
+                        NumberOfHoldings = "Holdings: " + row.Get<StockLocation, double>(x => x.Holdings)
                     };
 
                     stockLocations.Add(shell);
@@ -366,7 +368,7 @@ namespace comal.timesheets
 
             });
 
-            //TODO replace code that showed number of holdings
+
             //Task.Run(() =>
             //{
             //    CoreTable table = new Client<StockLocation>().Query(
@@ -377,12 +379,11 @@ namespace comal.timesheets
             //           ));
             //    foreach (CoreRow row in table.Rows)
             //    {
-            //        List<object> list = row.Values;
-            //        if (list[0].ToString() == null) list[0] = Guid.Empty; //0
-            //        if (list[1].ToString() == null) list[1] = 0; //1 
-
-            //        StockLocationShell shell = stockLocations.Find(x => x.ID.Equals(Guid.Parse(list[0].ToString())));
-            //        shell.NumberOfHoldings = "Holdings: " + list[1].ToString();
+            //        Guid id = row.Get<StockLocation, Guid>(x => x.ID);
+            //        double holdings = row.Get<StockLocation, double>(x => x.Holdings);
+            //        StockLocationShell shell = stockLocations.Find(x => x.ID == id);
+            //        if (shell != null)
+            //            shell.NumberOfHoldings = "Holdings: " + holdings;
             //    }
             //    foreach (StockLocationShell shell in currentList)
             //    {

+ 1 - 1
prs.mobile/comal.timesheets/Warehousing/Stocktake/StocktakePage.xaml

@@ -143,7 +143,7 @@
                                             <Label Grid.Row="2" Text="{Binding DisplayJob}"/>
                                             <Label Grid.Row="3" Text="{Binding DisplayFinish}"/>
                                             <Label Grid.Row="4" Text="{Binding DisplaySize}"/>
-                                            <Label Grid.Row="5" Text="{Binding DisplayQty}"/>
+                                            <Label Grid.Row="5" Text="{Binding DisplayUnits}"/>
                                             <Image Grid.Row="6" IsVisible="{Binding ImageVisible}" Source="{Binding ImageSource}"/>
                                         </Grid>
                                     </Frame>

+ 82 - 83
prs.mobile/comal.timesheets/Warehousing/Stocktake/StocktakePage.xaml.cs

@@ -281,18 +281,18 @@ namespace comal.timesheets
                 movement.Dimensions.Length = shell.DimensionsLength;
                 movement.Dimensions.Width = shell.DimensionsWidth;
                 movement.Dimensions.Height = shell.DimensionsHeight;
-                movement.Dimensions.Weight = shell.DimensionsWeight;               
+                movement.Dimensions.Weight = shell.DimensionsWeight;
                 movement.Dimensions.Unit.HasHeight = shell.DimensionsHasHeight;
                 movement.Dimensions.Unit.HasLength = shell.DimensionsHasLength;
                 movement.Dimensions.Unit.HasWidth = shell.DimensionsHasWidth;
                 movement.Dimensions.Unit.HasWeight = shell.DimensionsHasWeight;
                 movement.Dimensions.Unit.HasQuantity = shell.DimensionsHasQuantity;
-                movement.Dimensions.Unit.Formula = shell.DimensionsUnitFormula;
-                movement.Dimensions.Unit.Format = shell.DimensionsUnitFormat;
                 movement.Dimensions.Unit.Code = shell.DimensionsUnitCode;
                 movement.Dimensions.Unit.Description = shell.DimensionsUnitDescription;
-                movement.Dimensions.UnitSize = shell.DimensionsUnitSize;
                 movement.Dimensions.Value = shell.DimensionsValue;
+                movement.Dimensions.Unit.Formula = shell.DimensionsUnitFormula;
+                movement.Dimensions.Unit.Format = shell.DimensionsUnitFormat;
+                movement.Dimensions.UnitSize = shell.DimensionsUnitSize;
                 movement.Product.ID = shell.ProductID;
                 movement.Product.Code = shell.Code;
                 movement.Product.Name = shell.Name;
@@ -327,7 +327,7 @@ namespace comal.timesheets
                 //if style is changed, create a movement that issues everything from the original style
                 //in addition to the first movement created being changed to a receive of the entered qty in the new style
                 //no need to find the difference in Qty from the original. First movement qty issued should be 0
-                if (popup.Shell.StyleID != originalShell.StyleID & popup.Shell.ID != Guid.Empty)
+                if (popup.Shell.StyleID != originalShell.StyleID)
                 {
                     additionalmovement.Dimensions.Unit.ID = shell.DimensionsUnitID;
                     additionalmovement.Dimensions.Quantity = shell.DimensionsQuantity;
@@ -340,12 +340,12 @@ namespace comal.timesheets
                     additionalmovement.Dimensions.Unit.HasWidth = shell.DimensionsHasWidth;
                     additionalmovement.Dimensions.Unit.HasWeight = shell.DimensionsHasWeight;
                     additionalmovement.Dimensions.Unit.HasQuantity = shell.DimensionsHasQuantity;
-                    additionalmovement.Dimensions.Unit.Formula = shell.DimensionsUnitFormula;
-                    additionalmovement.Dimensions.Unit.Format = shell.DimensionsUnitFormat;
                     additionalmovement.Dimensions.Unit.Code = shell.DimensionsUnitCode;
                     additionalmovement.Dimensions.Unit.Description = shell.DimensionsUnitDescription;
-                    additionalmovement.Dimensions.UnitSize = shell.DimensionsUnitSize;
                     additionalmovement.Dimensions.Value = shell.DimensionsValue;
+                    additionalmovement.Dimensions.Unit.Formula = shell.DimensionsUnitFormula;
+                    additionalmovement.Dimensions.Unit.Format = shell.DimensionsUnitFormat;
+                    additionalmovement.Dimensions.UnitSize = shell.DimensionsUnitSize;
                     additionalmovement.Product.ID = shell.ProductID;
                     additionalmovement.Product.Code = shell.Code;
                     additionalmovement.Product.Name = shell.Name;
@@ -465,6 +465,15 @@ namespace comal.timesheets
                 DimensionsHeight = shell.DimensionsHeight,
                 DimensionsWeight = shell.DimensionsWeight,
                 DimensionsValue = shell.DimensionsValue,
+                DimensionsHasHeight = shell.DimensionsHasHeight,
+                DimensionsHasLength = shell.DimensionsHasLength,
+                DimensionsHasQuantity = shell.DimensionsHasQuantity,
+                DimensionsHasWidth = shell.DimensionsHasWidth,
+                DimensionsHasWeight = shell.DimensionsHasWeight,
+                DimensionsUnitCode = shell.DimensionsUnitCode,
+                DimensionsUnitDescription = shell.DimensionsUnitDescription,
+                DimensionsUnitFormat = shell.DimensionsUnitFormat,
+                DimensionsUnitFormula = shell.DimensionsUnitFormula,
                 DimensionsUnitSize = shell.DimensionsUnitSize,
                 Finish = shell.Finish,
                 Units = shell.Units,
@@ -543,27 +552,34 @@ namespace comal.timesheets
                    _filter,
                    new Columns<StockHolding>
                    (
-                       x => x.ID, //0
-                       x => x.Product.Code, //1
-                       x => x.Product.Name, //2
-                       x => x.Style.Description, //3
-                       x => x.Dimensions.UnitSize, //4
-                       x => x.Units, //5
-                       x => x.Location.ID, //6
-                       x => x.Job.ID, //7
-                       x => x.Job.Name, //8
-                       x => x.Job.JobNumber, //9
-                       x => x.Style.ID, //10
-                       x => x.Style.Code, //11
-                       x => x.Product.ID, //12
-                       x => x.Product.Image.ID, //13
-                       x => x.Dimensions.Unit.ID, //14
-                       x => x.Dimensions.Quantity, //15
-                       x => x.Dimensions.Length, //16
-                       x => x.Dimensions.Width, //17
-                       x => x.Dimensions.Height, //18
-                       x => x.Dimensions.Weight, //19
-                       x => x.Dimensions.Value //20
+                       x => x.ID,
+                       x => x.Product.Code,
+                       x => x.Product.Name,
+                       x => x.Style.Description,
+                       x => x.Units,
+                       x => x.Location.ID,
+                       x => x.Job.ID,
+                       x => x.Job.Name,
+                       x => x.Job.JobNumber,
+                       x => x.Style.ID,
+                       x => x.Style.Code,
+                       x => x.Product.ID,
+                       x => x.Product.Image.ID,
+                       x => x.Dimensions.UnitSize,
+                       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.Unit.HasQuantity,
+                       x => x.Dimensions.Unit.HasLength,
+                       x => x.Dimensions.Unit.HasWeight,
+                       x => x.Dimensions.Unit.HasWidth,
+                       x => x.Dimensions.Unit.HasHeight,
+                       x => x.Dimensions.Unit.Format,
+                       x => x.Dimensions.Unit.Formula
                        ),
                    null
                    );
@@ -571,66 +587,49 @@ namespace comal.timesheets
                 {
                     foreach (CoreRow row in table.Rows)
                     {
-                        List<object> list = row.Values;
-                        if (list[0] == null) { list[0] = Guid.Empty; } //0
-                        if (list[1] == null) { list[1] = ""; } //1
-                        if (list[2] == null) { list[2] = ""; } //2
-                        if (list[3] == null) { list[3] = ""; } //3
-                        if (list[4] == null) { list[4] = ""; } //4
-                        if (list[5] == null) { list[5] = 0.0; } //5
-                        if (list[6] == null) { list[6] = Guid.Empty; } //6
-                        if (list[7] == null) { list[7] = Guid.Empty; } //7
-                        if (list[8] == null) { list[8] = ""; } //8
-                        if (list[9] == null) { list[9] = ""; } //9
-                        if (list[10] == null) { list[10] = Guid.Empty; } //10
-                        if (list[11] == null) { list[11] = ""; } //11
-                        if (list[12] == null) { list[12] = Guid.Empty; } //12
-                        if (list[13] == null) { list[13] = Guid.Empty; } //13
-                        if (list[14] == null) { list[14] = Guid.Empty; } //14
-                        if (list[15] == null) { list[15] = 0.0; } //15
-                        if (list[16] == null) { list[16] = 0.0; } //16
-                        if (list[17] == null) { list[17] = 0.0; } //17
-                        if (list[18] == null) { list[18] = 0.0; } //18
-                        if (list[19] == null) { list[19] = 0.0; } //19
-                        if (list[20] == null) { list[20] = 0.0; } //20
-
                         StockHoldingShell shell = new StockHoldingShell();
 
-                        shell.ID = Guid.Parse(list[0].ToString());
-                        shell.Code = list[1].ToString();
-                        shell.Name = list[2].ToString();
-                        shell.Finish = list[3].ToString();
-                        shell.DisplayFinish = "Finish: " + list[3].ToString();
-                        shell.Units = double.Parse(list[5].ToString());
-                        shell.DisplaySize = "Size: " + list[4].ToString();
+                        shell.ID = row.Get<StockHolding, Guid>(x => x.Location.ID).ToString() 
+                        + row.Get<StockHolding, Guid>(x => x.Product.ID).ToString()
+                        + row.Get<StockHolding, Guid>(x => x.Job.ID).ToString()
+                        + row.Get<StockHolding, Guid>(x => x.Style.ID).ToString()
+                        + row.Get<StockHolding, string>(x => x.Dimensions.UnitSize);
+                        shell.Code = row.Get<StockHolding, string>(x => x.Product.Code);
+                        shell.Name = row.Get<StockHolding, string>(x => x.Product.Name);
+                        shell.Finish = row.Get<StockHolding, string>(x => x.Style.Description);
+                        shell.DisplayFinish = "Finish: " + shell.Finish;
+                        shell.Units = row.Get<StockHolding, double>(x => x.Units);
+                        shell.DimensionsUnitSize = row.Get<StockHolding, string>(x => x.Dimensions.UnitSize);
+                        shell.DisplaySize = "UOM: " + shell.DimensionsUnitSize;
                         shell.DisplayUnits = "Units: " + shell.Units;
-                        shell.JobID = Guid.Parse(list[7].ToString());
-                        shell.JobName = list[8].ToString();
-                        shell.JobNumber = list[9].ToString();
+                        shell.JobID = row.Get<StockHolding, Guid>(x => x.Job.ID);
+                        shell.JobName = row.Get<StockHolding, string>(x => x.Job.Name);
+                        shell.JobNumber = row.Get<StockHolding, string>(x => x.Job.JobNumber);
                         shell.DisplayJob = "Job: " + shell.JobNumber;
-                        shell.StyleID = Guid.Parse(list[10].ToString());
-                        shell.StyleCode = list[11].ToString();
-                        shell.ProductID = Guid.Parse(list[12].ToString());
-                        shell.ImageID = Guid.Parse(list[13].ToString());
-                        shell.DimensionsUnitID = Guid.Parse(list[14].ToString());
-                        shell.DimensionsQuantity = double.Parse(list[15].ToString());
-                        shell.DimensionsLength = double.Parse(list[16].ToString());
-                        shell.DimensionsWidth = double.Parse(list[17].ToString());
-                        shell.DimensionsHeight = double.Parse(list[18].ToString());
-                        shell.DimensionsWeight = double.Parse(list[19].ToString());
-                        shell.DimensionsValue = double.Parse(list[20].ToString());
-
-                        double units = 0.0;
-                        if (!shell.Code.Contains("FREIGHT"))
+                        shell.StyleID = row.Get<StockHolding, Guid>(x => x.Style.ID);
+                        shell.StyleCode = row.Get<StockHolding, string>(x => x.Style.Code);
+                        shell.ProductID = row.Get<StockHolding, Guid>(x => x.Product.ID);
+                        shell.ImageID = row.Get<StockHolding, Guid>(x => x.Product.Image.ID);
+                        shell.DimensionsUnitID = row.Get<StockHolding, Guid>(x => x.Dimensions.Unit.ID);
+                        shell.DimensionsQuantity = row.Get<StockHolding, double>(x => x.Dimensions.Quantity);
+                        shell.DimensionsLength = row.Get<StockHolding, double>(x => x.Dimensions.Length);
+                        shell.DimensionsWidth = row.Get<StockHolding, double>(x => x.Dimensions.Width);
+                        shell.DimensionsHeight = row.Get<StockHolding, double>(x => x.Dimensions.Height);
+                        shell.DimensionsWeight = row.Get<StockHolding, double>(x => x.Dimensions.Weight);
+                        shell.DimensionsValue = row.Get<StockHolding, double>(x => x.Dimensions.Value);
+                        shell.DimensionsHasHeight = row.Get<StockHolding, bool>(x => x.Dimensions.Unit.HasHeight);
+                        shell.DimensionsHasWeight = row.Get<StockHolding, bool>(x => x.Dimensions.Unit.HasWeight);
+                        shell.DimensionsHasLength = row.Get<StockHolding, bool>(x => x.Dimensions.Unit.HasLength);
+                        shell.DimensionsHasQuantity = row.Get<StockHolding, bool>(x => x.Dimensions.Unit.HasQuantity);
+                        shell.DimensionsHasWidth = row.Get<StockHolding, bool>(x => x.Dimensions.Unit.HasWidth);
+                        shell.DimensionsUnitFormat = row.Get<StockHolding, string>(x => x.Dimensions.Unit.Format);
+                        shell.DimensionsUnitFormula = row.Get<StockHolding, string>(x => x.Dimensions.Unit.Formula);
+
+                        if (!shell.Code.Contains("FREIGHT") && shell.Units != 0)
                         {
-                            if (double.TryParse(list[5].ToString(), out units))
-                            {
-                                if (units > 0)
-                                {
-                                    stockHoldingShells.Add(shell);
-                                }
-                            }
+                            stockHoldingShells.Add(shell);
                         }
+
                     }
                     LoadImages();
                     Device.BeginInvokeOnMainThread(() =>

+ 7 - 3
prs.mobile/comal.timesheets/Warehousing/Transfer/RecTrans.xaml.cs

@@ -585,7 +585,11 @@ namespace comal.timesheets
 
                         StockHoldingShell shell = new StockHoldingShell();
 
-                        shell.ID = Guid.Parse(list[0].ToString());
+                        shell.ID = row.Get<StockHolding, Guid>(x => x.Location.ID).ToString()
+                        + row.Get<StockHolding, Guid>(x => x.Product.ID).ToString()
+                        + row.Get<StockHolding, Guid>(x => x.Job.ID).ToString()
+                        + row.Get<StockHolding, Guid>(x => x.Style.ID).ToString()
+                        + row.Get<StockHolding, string>(x => x.Dimensions.UnitSize);
                         shell.Code = list[1].ToString();
                         shell.Name = list[2].ToString();
                         shell.Finish = list[3].ToString();
@@ -954,7 +958,7 @@ namespace comal.timesheets
 
     public class StockHoldingShell
     {
-        public Guid ID { get; set; }
+        public string ID { get; set; }
         public string Code { get; set; }
         public string Name { get; set; }
         public string DisplayFinish { get; set; }
@@ -993,7 +997,7 @@ namespace comal.timesheets
         public string DimensionsUnitDescription { get; set; }
         public StockHoldingShell()
         {
-            ID = Guid.Empty;
+            ID = "";
             Code = "";
             Name = "";
             DisplayFinish = "";

+ 2 - 0
prs.mobile/comal.timesheets/comal.timesheets.projitems

@@ -159,6 +159,8 @@
     <Compile Include="$(MSBuildThisFileDirectory)Assignments\DataModels\Lookups\AssignmentKanbanDataModel.cs" />
     <Compile Include="$(MSBuildThisFileDirectory)Assignments\DataModels\Lookups\AssignmentLookupDataModel.cs" />
     <Compile Include="$(MSBuildThisFileDirectory)Assignments\IAssignmentPage.cs" />
+    <Compile Include="$(MSBuildThisFileDirectory)CacheLoader.cs" />
+    <Compile Include="$(MSBuildThisFileDirectory)DigitalFormsHelper.cs" />
     <Compile Include="$(MSBuildThisFileDirectory)DigitalForms\CustomUserControls\DigitalFormsHeader.xaml.cs">
       <DependentUpon>DigitalFormsHeader.xaml</DependentUpon>
       <SubType>Code</SubType>