Przeglądaj źródła

Tweaked ProductInstance handling

frogsoftware 1 rok temu
rodzic
commit
a088809fe4

+ 7 - 1
prs.classes/Entities/Product/Instance/ProductInstance.cs

@@ -5,8 +5,12 @@ using System.Text;
 
 namespace Comal.Classes
 {
-    public class ProductInstance : DimensionedEntity<ProductDimensions>, IRemotable, IPersistent, IProductInstance
+    public class ProductInstance : DimensionedEntity<ProductDimensions>, IRemotable, IPersistent, IProductInstance, ISequenceable
     {
+        
+        [NullEditor]
+        public long Sequence { get; set; }
+        
         [NullEditor]
         public ProductLink Product { get; set; }
 
@@ -21,5 +25,7 @@ namespace Comal.Classes
         [IntegerEditor]
         [EditorSequence(3)]
         public int MinimumStockLevel { get; set; }
+
+
     }
 }

+ 3 - 6
prs.classes/Entities/Product/Instance/ProductInstanceLink.cs

@@ -10,17 +10,14 @@ namespace Comal.Classes
         [LookupEditor(typeof(ProductInstance))]
         public override Guid ID { get; set; }
 
-        [EditorSequence(1)]
         [RequiredColumn]
         public ProductStyleLink Style { get; set; }
-
-        [EditorSequence(2)]
+        
         [RequiredColumn]
-        [DimensionsEditor(typeof(ProductDimensions))]
+        [NullEditor]
         public ProductDimensions Dimensions { get; set; }
 
-        [IntegerEditor]
-        [EditorSequence(3)]
+        [NullEditor]
         public int MinimumStockLevel { get; set; }
     }
 }

+ 30 - 1
prs.classes/Entities/Product/Instance/ProductInstanceLookups.cs

@@ -5,8 +5,34 @@ using System.Text;
 
 namespace Comal.Classes
 {
-    public class ProductInstanceLookups : ILookupDefinition<ProductInstance, Product>
+    public class ProductInstanceLookups : EntityLookup<ProductInstance>,  ILookupDefinition<ProductInstance, Product>
     {
+        
+        #region Default Lookups (should always be empty)
+        public override Filter<ProductInstance>? DefineFilter()
+        {
+            return new Filter<ProductInstance>().None();
+        }
+
+        public override SortOrder<ProductInstance> DefineSortOrder()
+        {
+            return new SortOrder<ProductInstance>(x => x.Sequence);
+        }
+
+        #endregion
+        
+        public override string FormatLookup(Dictionary<string, object?> values, IEnumerable<string> exclude)
+        {
+            List<object> result = new List<object>();
+            if (values.TryGetValue("Dimensions.UnitSize", out object size) && !String.IsNullOrWhiteSpace(size?.ToString()))
+                result.Add(size);
+            if (values.TryGetValue("Style.Description", out object description) && !String.IsNullOrWhiteSpace(description?.ToString()))
+                result.Add(description);
+            return String.Join(" ", result);
+        }
+        
+        #region Lookups for Products
+        
         public Filter<ProductInstance>? DefineFilter(Product[] items)
         {
             if (items.Length == 0)
@@ -25,5 +51,8 @@ namespace Comal.Classes
         }
 
         public Columns<Product> DefineFilterColumns() => new Columns<Product>(x => x.ID);
+        
+        #endregion
+
     }
 }

+ 1 - 1
prs.desktop/Panels/Jobs/JobScopes/JobScopeGrid.cs

@@ -19,7 +19,7 @@ namespace PRSDesktop
         {
             HiddenColumns.Add(x=>x.Job.DefaultScope.ID);
             HiddenColumns.Add(x=>x.Job.ID);
-            ActionColumns.Add(new DynamicImageColumn(IsDefaultImage, SelectDefaultAction) { Position = DynamicActionColumnPosition.Start });
+            ActionColumns.Add(new DynamicImageColumn(IsDefaultImage, SelectDefaultAction) { Position = DynamicActionColumnPosition.End });
         }
         
         protected override void DoReconfigure(FluentList<DynamicGridOption> options)

+ 10 - 1
prs.desktop/Panels/Products/Master List/ProductInstanceControl.cs

@@ -28,7 +28,16 @@ public class ProductInstanceControl : DynamicDataGrid<ProductInstance>, IProduct
 
         HiddenColumns.Add(x => x.Product.DefaultInstance.ID);
 
-        ActionColumns.Add(new DynamicImageColumn(IsDefaultImage, SelectDefaultAction) { Position = DynamicActionColumnPosition.Start });
+        ActionColumns.Add(new DynamicImageColumn(IsDefaultImage, SelectDefaultAction) { Position = DynamicActionColumnPosition.End });
+    }
+
+    protected override void DoReconfigure(FluentList<DynamicGridOption> options)
+    {
+        base.DoReconfigure(options);
+        options
+            .BeginUpdate()
+            .Add(DynamicGridOption.SelectColumns)
+            .EndUpdate();
     }
 
     protected override bool CanCreateItems()

+ 17 - 9
prs.desktop/Panels/Products/Master List/ProductsPanel.xaml

@@ -36,26 +36,34 @@
                     <dynamicgrid:DynamicTabItem x:Name="Holdings" Header="Holdings">
                         <Grid>
                             <Grid.RowDefinitions>
-                                <RowDefinition Height="*"/>
-                                <RowDefinition Height="Auto"/>
                                 <RowDefinition Height="Auto"/>
                                 <RowDefinition Height="*"/>
+                                <RowDefinition Height="Auto"/>                                
+                                <RowDefinition Height="3*"/>
                             </Grid.RowDefinitions>
-                            <local:ProductHoldingControl x:Name="ProductHoldings" UseWaitCursor="false"
-                                                         Grid.Row="0"/>
-                            <sf:SfGridSplitter Grid.Row="1" Height="4"
+                            <Border BorderBrush="Gray" BorderThickness="0.75" Background="WhiteSmoke" Height="25"
+                                    Grid.Row="0" Margin="0,2">
+                                <Label Content="Product Instances" HorizontalContentAlignment="Center"
+                                       VerticalContentAlignment="Center" />
+                            </Border>
+                            <local:ProductInstanceControl x:Name="ProductInstances" UseWaitCursor="False" Grid.Row="1"
+                                                          OnChanged="ProductInstances_OnChanged"/>
+                            
+                            <sf:SfGridSplitter Grid.Row="2" Height="4"
                                                HorizontalAlignment="Stretch"
                                                Background="Transparent"
                                                ResizeBehavior="PreviousAndNext"
                                                Template="{StaticResource HorizontalSplitter}"
                                                PreviewStyle="{StaticResource HorizontalSplitterPreview}"/>
+                            <DockPanel Grid.Row="3">
                             <Border BorderBrush="Gray" BorderThickness="0.75" Background="WhiteSmoke" Height="25"
-                                    Grid.Row="2" Margin="0,2">
-                                <Label Content="Product Instances" HorizontalContentAlignment="Center"
+                                    DockPanel.Dock="Top" Margin="0,2">
+                                <Label Content="Product Holdings" HorizontalContentAlignment="Center"
                                        VerticalContentAlignment="Center" />
                             </Border>
-                            <local:ProductInstanceControl x:Name="ProductInstances" UseWaitCursor="False" Grid.Row="3"
-                                                          OnChanged="ProductInstances_OnChanged"/>
+                            <local:ProductHoldingControl x:Name="ProductHoldings" UseWaitCursor="false"
+                                                         DockPanel.Dock="Top"/>
+                            </DockPanel>
                         </Grid>
                     </dynamicgrid:DynamicTabItem>
                     

+ 1 - 1
prs.desktop/prsdesktop.iss

@@ -5,7 +5,7 @@
 #pragma verboselevel 9
 
 #define MyAppName "PRS Desktop"
-#define MyAppVersion "7.47"
+#define MyAppVersion "7.48"
 #define MyAppPublisher "PRS Digital"
 #define MyAppURL "https://www.prs-software.com.au"
 #define MyAppExeName "PRSDesktop.exe"

+ 1 - 1
prs.server/PRSServer.iss

@@ -5,7 +5,7 @@
 #pragma verboselevel 9
 
 #define MyAppName "PRS Server"
-#define MyAppVersion "7.47"
+#define MyAppVersion "7.48"
 #define MyAppPublisher "PRS Digital"
 #define MyAppURL "https://www.prs-software.com.au"
 #define MyAppExeName "PRSServer.exe"