Переглянути джерело

Fixing problems with splitting and editing POIAs.

Kenric Nugteren 9 місяців тому
батько
коміт
74e21c905a

+ 11 - 0
prs.classes/Entities/PurchaseOrder/PurchaseOrderItemAllocation.cs

@@ -46,6 +46,17 @@ namespace Comal.Classes
 
         [NullEditor]
         public bool Nominated { get; set; }
+
+        protected override void DoPropertyChanged(string name, object? before, object? after)
+        {
+            base.DoPropertyChanged(name, before, after);
+
+            if(name == $"{nameof(Job)}.{nameof(Job.ID)}")
+            {
+                JobRequisitionItem.ID = Guid.Empty;
+                JobRequisitionItem.Clear();
+            }
+        }
     }
 
     

+ 4 - 1
prs.desktop/Panels/PurchaseOrders/SupplierPurchaseOrderItemOneToMany.cs

@@ -239,7 +239,10 @@ public class SupplierPurchaseOrderItemOneToMany : DynamicOneToManyGrid<PurchaseO
                 allocation.Quantity = item.SplitQuantity;
 
                 // Save both allocations.
-                Allocations.Add(new(poi, allocation));
+                if(!Allocations.Any(x => x.Item2 == allocation))
+                {
+                    Allocations.Add(new(poi, allocation));
+                }
                 Allocations.Add(new(newLine, newAllocation));
             }
 

+ 1 - 0
prs.desktop/Panels/PurchaseOrders/SupplierPurchaseOrderItemSplitWindow.xaml.cs

@@ -76,6 +76,7 @@ public partial class SupplierPurchaseOrderItemSplitWindow : Window, INotifyPrope
     {
         var window = new SupplierPurchaseOrderItemSplitWindow();
         window.OldQuantity = quantity;
+        window.NewQuantity = Math.Floor(quantity / 2);
         window.Grid.Items = items;
         window.Grid.Refresh(true, true);
         if(window.ShowDialog() == true)