Ver código fonte

Fixed negative StockMovement handling in StockHolding "Relocate"

Kenric Nugteren 1 ano atrás
pai
commit
8608fcb0f8

+ 1 - 0
prs.classes/Entities/Stock/StockMovement/StockMovement.cs

@@ -79,6 +79,7 @@ namespace Comal.Classes
         [EntityRelationship(DeleteAction.SetNull)]
         public ProductStyleLink Style { get; set; }
         
+        // Allowed to be negative.
         [DoubleEditor(Summary = Summary.Sum)]
         [EditorSequence(4)]
         public double Received { get; set; }

+ 2 - 0
prs.desktop/Panels/Factory/FactoryPackGrid.cs

@@ -418,6 +418,8 @@ public class FactoryPackGrid : DynamicDataGrid<StockHolding>
             var requi = ffi.RequisitionItems.FirstOrDefault(x => x.ID == id);
             if (requi == null)
                 errors.Add("Please select an allocation!");
+            else if (ffi.Qty < 0)
+                errors.Add($"Qty must not be less than 0");
             else if (ffi.Qty > requi.Qty)
                 errors.Add($"Qty must not exceed {requi.Qty}");
         };

+ 4 - 15
prs.desktop/Panels/Products/Locations/StockHoldingGrid.cs

@@ -362,22 +362,11 @@ public class StockHoldingGrid : DynamicDataGrid<StockHolding>
             min.Date = mout.Date;
             min.Transaction = mout.Transaction;
 
-            if(qty.Value > 0)
-            {
-                mout.Issued = qty.Value;
-                mout.Type = StockMovementType.TransferOut;
-
-                min.Received = qty.Value;
-                min.Type = StockMovementType.TransferIn;
-            }
-            else
-            {
-                min.Issued = -qty.Value;
-                min.Type = StockMovementType.TransferOut;
+            mout.Issued = qty.Value;
+            mout.Type = StockMovementType.TransferOut;
 
-                mout.Received = -qty.Value;
-                mout.Type = StockMovementType.TransferIn;
-            }
+            min.Received = qty.Value;
+            min.Type = StockMovementType.TransferIn;
 
             modify(requi, mout, min);
 

+ 5 - 0
prs.desktop/Panels/Products/Locations/StockTransformWindow.xaml

@@ -73,6 +73,7 @@
             IsReadOnly="True"/>
         <syncfusion:DoubleTextBox
             Value="{Binding NewDimensions.Height, Mode=TwoWay}"
+            MinValue="0"
             Grid.Row="1"
             Grid.Column="2"
             Margin="5,5,0,0"
@@ -103,6 +104,7 @@
             IsReadOnly="True"/>
         <syncfusion:DoubleTextBox
             Value="{Binding NewDimensions.Width, Mode=TwoWay}"
+            MinValue="0"
             Grid.Row="2"
             Grid.Column="2"
             Margin="5,5,0,0"
@@ -133,6 +135,7 @@
             IsReadOnly="True"/>
         <syncfusion:DoubleTextBox
             Value="{Binding NewDimensions.Length, Mode=TwoWay}"
+            MinValue="0"
             Grid.Row="3"
             Grid.Column="2"
             Margin="5,5,0,0"
@@ -163,6 +166,7 @@
             IsReadOnly="True"/>
         <syncfusion:DoubleTextBox
             Value="{Binding NewDimensions.Quantity, Mode=TwoWay}"
+            MinValue="0"
             Grid.Row="4"
             Grid.Column="2"
             Margin="5,5,0,0"
@@ -193,6 +197,7 @@
             IsReadOnly="True"/>
         <syncfusion:DoubleTextBox
             Value="{Binding NewDimensions.Weight, Mode=TwoWay}"
+            MinValue="0"
             Grid.Row="5"
             Grid.Column="2"
             Margin="5,5,0,0"