Просмотр исходного кода

Added "Show ISsues" checkbox to summary grid

Kenric Nugteren 2 лет назад
Родитель
Сommit
388dc3e99d

+ 14 - 7
prs.desktop/Panels/Jobs/JobSummaryGrid.cs

@@ -1,4 +1,5 @@
-using Comal.Classes;
+using com.sun.corba.se.spi.orbutil.threadpool;
+using Comal.Classes;
 using InABox.Clients;
 using InABox.Core;
 using InABox.DynamicGrid;
@@ -20,6 +21,8 @@ namespace PRSDesktop
 
         public bool IncludeReserves { get; set; }
 
+        public bool ShowIssues { get; set; }
+
         public Job Job { get; set; }
 
         public JobPanelSettings Settings { get; set; }
@@ -577,19 +580,23 @@ namespace PRSDesktop
                     row.Get<JobMaterial, double>(x => x.ReservedStock) != 0.0F ||
                     row.Get<JobMaterial, double>(x => x.OnOrder) != 0.0F
                 );
+            if (ShowIssues)
+            {
+                result = result && (
+                    row.Get<JobMaterial, double>(x => x.JobShortage) > 0.0F ||
+                    row.Get<JobMaterial, double>(x => x.FreeStockShortage) > 0.0F);
+            }
             return result;
         }
 
-        private String _jobshortage = CoreUtils.GetFullPropertyName<JobMaterial, double>(x => x.JobShortage, ".");
-        private String _stockshortage = CoreUtils.GetFullPropertyName<JobMaterial, double>(x => x.FreeStockShortage, ".");
+        private Column<JobMaterial> _jobshortage = new Column<JobMaterial>(x => x.JobShortage);
+        private Column<JobMaterial> _stockshortage = new Column<JobMaterial>(x => x.FreeStockShortage);
 
         protected override Brush? GetCellBackground(CoreRow row, string columnname)
         {
-
-
-            if (String.Equals(columnname, _jobshortage))
+            if (_jobshortage.IsEqualTo(columnname))
                 return row.Get<JobMaterial, double>(x => x.JobShortage) > 0.0F ? new SolidColorBrush(Colors.LightSalmon) { Opacity = 0.5 } : null;
-            if (String.Equals(columnname, _stockshortage))
+            if (_stockshortage.IsEqualTo(columnname))
                 return row.Get<JobMaterial, double>(x => x.FreeStockShortage) > 0.0F ? new SolidColorBrush(Colors.LightSalmon) { Opacity = 0.5 } : null;
             return null;
         }

+ 10 - 0
prs.desktop/Panels/Jobs/JobSummaryPanel.xaml

@@ -36,6 +36,16 @@
                     VerticalContentAlignment="Center" 
                     Style="{StaticResource TextAlignLeft}"
                     Checked="ReservedStock_OnChecked" Unchecked="ReservedStock_OnChecked"/>
+                <CheckBox 
+                    x:Name="IssuesCheckBox" 
+                    Content="Show Issues" 
+                    IsThreeState="False" 
+                    IsChecked="False" 
+                    DockPanel.Dock="Right" 
+                    VerticalContentAlignment="Center" 
+                    Style="{StaticResource TextAlignLeft}"
+                    Margin="0,0,5,0"
+                    Checked="IssuesCheckBox_Checked" Unchecked="IssuesCheckBox_Checked"/>
                 <Label Content="" DockPanel.Dock="Left"/>
             </DockPanel>
         </Border>

+ 6 - 0
prs.desktop/Panels/Jobs/JobSummaryPanel.xaml.cs

@@ -69,5 +69,11 @@ namespace PRSDesktop
             Summary.IncludeReserves = ReservedStock.IsChecked == true;
             Summary.Refresh(false, true);
         }
+
+        private void IssuesCheckBox_Checked(object sender, RoutedEventArgs e)
+        {
+            Summary.ShowIssues = IssuesCheckBox.IsChecked == true;
+            Summary.Refresh(false, true);
+        }
     }
 }