소스 검색

Linked Dimensions to product for stagingsetoutcomponent. Improved refresh for staging panel

Kenric Nugteren 1 년 전
부모
커밋
03490b16b9

+ 2 - 0
prs.classes/EnclosedEntities/Dimensions/DimensionedEntity.cs

@@ -1,4 +1,6 @@
 using InABox.Core;
+using System;
+using System.Linq.Expressions;
 
 namespace Comal.Classes
 {

+ 20 - 0
prs.classes/Entities/Staging/Component/StagingSetoutComponent.cs

@@ -1,6 +1,7 @@
 using InABox.Core;
 using Newtonsoft.Json.Linq;
 using System;
+using System.Collections;
 using System.Collections.Generic;
 using System.Linq;
 using System.Text;
@@ -36,6 +37,25 @@ namespace Comal.Classes
         static StagingSetoutComponent()
         {
             LinkedProperties.Register<StagingSetoutComponent, ProductLink, string>(x => x.Product, x => x.Name, x => x.Description);
+            LinkedProperties.Register<StagingSetoutComponent, ProductLink, string>(x => x.Product, x => x.Name, x => x.Description);
+
+            LinkedProperties.Register<StagingSetoutComponent, ProductDimensionUnitLink, Guid>(x => x.Product.Dimensions.Unit, x => x.ID, x => x.Dimensions.Unit.ID);
+            LinkedProperties.Register<StagingSetoutComponent, ProductDimensionUnitLink, String>(x => x.Product.Dimensions.Unit, x => x.Code, x => x.Dimensions.Unit.Code);
+            LinkedProperties.Register<StagingSetoutComponent, ProductDimensionUnitLink, String>(x => x.Product.Dimensions.Unit, x => x.Description, x => x.Dimensions.Unit.Description);
+            LinkedProperties.Register<StagingSetoutComponent, ProductDimensionUnitLink, bool>(x => x.Product.Dimensions.Unit, x => x.HasLength, x => x.Dimensions.Unit.HasLength);
+            LinkedProperties.Register<StagingSetoutComponent, ProductDimensionUnitLink, bool>(x => x.Product.Dimensions.Unit, x => x.HasHeight, x => x.Dimensions.Unit.HasHeight);
+            LinkedProperties.Register<StagingSetoutComponent, ProductDimensionUnitLink, bool>(x => x.Product.Dimensions.Unit, x => x.HasQuantity, x => x.Dimensions.Unit.HasQuantity);
+            LinkedProperties.Register<StagingSetoutComponent, ProductDimensionUnitLink, bool>(x => x.Product.Dimensions.Unit, x => x.HasWeight, x => x.Dimensions.Unit.HasWeight);
+            LinkedProperties.Register<StagingSetoutComponent, ProductDimensionUnitLink, bool>(x => x.Product.Dimensions.Unit, x => x.HasWidth, x => x.Dimensions.Unit.HasWidth);
+            LinkedProperties.Register<StagingSetoutComponent, ProductDimensionUnitLink, String>(x => x.Product.Dimensions.Unit, x => x.Formula, x => x.Dimensions.Unit.Formula);
+            LinkedProperties.Register<StagingSetoutComponent, ProductDimensionUnitLink, String>(x => x.Product.Dimensions.Unit, x => x.Format, x => x.Dimensions.Unit.Format);
+            LinkedProperties.Register<StagingSetoutComponent, ProductDimensions, double>(x => x.Product.Dimensions, x => x.Height, x => x.Dimensions.Height);
+            LinkedProperties.Register<StagingSetoutComponent, ProductDimensions, double>(x => x.Product.Dimensions, x => x.Length, x => x.Dimensions.Length);
+            LinkedProperties.Register<StagingSetoutComponent, ProductDimensions, double>(x => x.Product.Dimensions, x => x.Quantity, x => x.Dimensions.Quantity);
+            LinkedProperties.Register<StagingSetoutComponent, ProductDimensions, double>(x => x.Product.Dimensions, x => x.Weight, x => x.Dimensions.Weight);
+            LinkedProperties.Register<StagingSetoutComponent, ProductDimensions, double>(x => x.Product.Dimensions, x => x.Width, x => x.Dimensions.Width);
+            LinkedProperties.Register<StagingSetoutComponent, ProductDimensions, double>(x => x.Product.Dimensions, x => x.Value, x => x.Dimensions.Value);
+            LinkedProperties.Register<StagingSetoutComponent, ProductDimensions, String>(x => x.Product.Dimensions, x => x.UnitSize, x => x.Dimensions.UnitSize);
         }
 
         protected override void Init()

+ 2 - 1
prs.desktop/Panels/Staging/StagingPanel.xaml

@@ -29,7 +29,8 @@
                     OnCustomiseSetouts="stagingSetoutGrid_OnCustomiseSetouts" 
                     OnParseComponentFile="stagingSetoutGrid_OnParseComponentFile"
                     OnDoubleClick="StagingSetoutGrid_OnOnDoubleClick"
-                    OnSelectItem="StagingSetoutGrid_OnSelectItem"/>
+                    OnSelectItem="StagingSetoutGrid_OnSelectItem"
+                    AfterRefresh="stagingSetoutGrid_AfterRefresh"/>
             </Grid>
         </dynamicgrid:DynamicSplitPanel.Master>
         

+ 5 - 2
prs.desktop/Panels/Staging/StagingPanel.xaml.cs

@@ -853,11 +853,13 @@ public class Module
         public void Refresh()
         {
             //stagingSetoutGrid.ScanFiles(_settings.SetoutsFolder);
+            stagingSetoutGrid.SelectedRows = Array.Empty<CoreRow>();
             stagingSetoutGrid.Refresh(false, true);
-            Document = null;
+            /*Document = null;
 
+            selectedSetout = null;
             ManufacturingPacketList.Setout = null;
-            SetoutComponentGrid.StagingSetout = null;
+            SetoutComponentGrid.StagingSetout = null;*/
             CalculateTime();
         }
 
@@ -1177,5 +1179,6 @@ public class Module
                 MessageBox.Show($"Error opening {componentFileName}: {e.Message}");
             }
         }
+
     }
 }