Prechádzať zdrojové kódy

Fixed bug with not refreshing data after editing stagingsetout

Kenric Nugteren 1 rok pred
rodič
commit
1b8be6da46

+ 13 - 8
prs.desktop/Panels/Staging/StagingPanel.xaml.cs

@@ -281,8 +281,8 @@ public class Module
                     Progress.Show("Approving Setouts..");
                 }
             }
-            
-            if(selectedSetouts.Any(x => x.UnapprovedDocuments > 0))
+
+            if (selectedSetouts.Any(x => x.UnapprovedDocuments > 0))
             {
                 MessageBox.Show("Cannot process setouts with unapproved documents.");
                 Progress.Close();
@@ -302,10 +302,10 @@ public class Module
                 Progress.Close();
                 return;
             }
-            
-            if(selectedSetouts.Any(x => x.Packets == 0))
+
+            if (selectedSetouts.Any(x => x.Packets == 0))
             {
-                if(MessageBox.Show("Warning: some setouts do not have any manufacturing packets: are you sure you wish to proceed?", "Warning", MessageBoxButton.YesNoCancel) != MessageBoxResult.Yes)
+                if (MessageBox.Show("Warning: some setouts do not have any manufacturing packets: are you sure you wish to proceed?", "Warning", MessageBoxButton.YesNoCancel) != MessageBoxResult.Yes)
                 {
                     Progress.Close();
                     return;
@@ -314,7 +314,7 @@ public class Module
 
 
 
-            string message = "Result: " + Environment.NewLine;
+            string message = "";
 
             foreach (var item in selectedSetouts)
             {
@@ -331,8 +331,11 @@ public class Module
             new Client<StagingSetout>().Save(selectedSetouts, "Updated from staging screen");
             selectedSetout = null;
             Refresh();
-            
-            MessageBox.Show(message);
+
+            if (!message.IsNullOrWhiteSpace())
+            {
+                MessageBox.Show($"Result:\n{message}");
+            }
             MainPanel.View = DynamicSplitPanelView.Combined;
             NestedPanel.View = DynamicSplitPanelView.Master;
         }
@@ -745,6 +748,8 @@ public class Module
             if(!refreshing && (selectedSetouts.Count == newSetouts.Count
                 && !selectedSetouts.Any(x => !newSetouts.Any(y => x.ID == y.ID))))
             {
+                selectedSetouts = newSetouts;
+                selectedSetout = selectedSetouts.FirstOrDefault();
                 return;
             }