Selaa lähdekoodia

Enabled built-in treatment PO on Reservation management screen

frogsoftware 9 kuukautta sitten
vanhempi
commit
ad59216d90

+ 5 - 5
prs.classes/Entities/Stock/StockHolding/StockHolding.cs

@@ -212,11 +212,11 @@ namespace Comal.Classes
                 && row1.Get<T1,Guid>(x=>x.Job.ID) == row2.Get<T2,Guid>(x => x.Job.ID)
                 && row1.Get<T1,Guid>(x=>x.Style.ID) == row2.Get<T2,Guid>(x => x.Style.ID)
                 && row1.Get<T1,Guid>(x=>x.Dimensions.Unit.ID) == row2.Get<T2,Guid>(x => x.Dimensions.Unit.ID)
-                && row1.Get<T1,double>(x=>x.Dimensions.Length).IsEffectivelyEqual(row2.Get<T1,double>(x=>x.Dimensions.Length))
-                && row1.Get<T1,double>(x=>x.Dimensions.Width).IsEffectivelyEqual(row2.Get<T1,double>(x=>x.Dimensions.Width))
-                && row1.Get<T1,double>(x=>x.Dimensions.Height).IsEffectivelyEqual(row2.Get<T1,double>(x=>x.Dimensions.Height))
-                && row1.Get<T1,double>(x=>x.Dimensions.Quantity).IsEffectivelyEqual(row2.Get<T1,double>(x=>x.Dimensions.Quantity))
-                && row1.Get<T1,double>(x=>x.Dimensions.Weight).IsEffectivelyEqual(row2.Get<T1,double>(x=>x.Dimensions.Weight));
+                && row1.Get<T1,double>(x=>x.Dimensions.Length).IsEffectivelyEqual(row2.Get<T2,double>(x=>x.Dimensions.Length))
+                && row1.Get<T1,double>(x=>x.Dimensions.Width).IsEffectivelyEqual(row2.Get<T2,double>(x=>x.Dimensions.Width))
+                && row1.Get<T1,double>(x=>x.Dimensions.Height).IsEffectivelyEqual(row2.Get<T2,double>(x=>x.Dimensions.Height))
+                && row1.Get<T1,double>(x=>x.Dimensions.Quantity).IsEffectivelyEqual(row2.Get<T2,double>(x=>x.Dimensions.Quantity))
+                && row1.Get<T1,double>(x=>x.Dimensions.Weight).IsEffectivelyEqual(row2.Get<T2,double>(x=>x.Dimensions.Weight));
         }
 
         public static void Recalculate(this StockHolding holding, IEnumerable<StockMovement> movements)

+ 5 - 0
prs.classes/SecurityDescriptors/Product_Descriptors.cs

@@ -22,4 +22,9 @@ namespace Comal.Classes
     public class CanViewProductDock : EnabledSecurityDescriptor<ProductManagementLicense, Product>
     {
     }
+    
+    [Caption("Create Treatment POs")]
+    public class CanCreateTreatmentPO : EnabledSecurityDescriptor<ProductManagementLicense, Product>
+    {
+    }
 }

+ 2 - 2
prs.desktop/Panels/Products/Locations/StockLocationPanel.xaml.cs

@@ -32,8 +32,8 @@ namespace PRSDesktop
         public void CreateToolbarButtons(IPanelHost host)
         {
             ProductSetupActions.Standard(host);
-            host.CreatePanelAction(new PanelAction
-                { Caption = "Treament PO", Image = PRSDesktop.Resources.purchase, OnExecute = DoCreatePurchaseOrder });
+            //host.CreatePanelAction(new PanelAction
+            //    { Caption = "Treament PO", Image = PRSDesktop.Resources.purchase, OnExecute = DoCreatePurchaseOrder });
             host.CreatePanelAction(new PanelAction
                 { Caption = "Recalculate Holdings", Image = PRSDesktop.Resources.certificate, OnExecute = DoRecalculate });
         }

+ 2 - 1
prs.desktop/Panels/Reservation Management/ReservationManagementPanel.xaml.cs

@@ -139,7 +139,8 @@ public partial class ReservationManagementPanel : UserControl, IPanel<JobRequisi
         ProductSetupActions.Standard(host);
         host.CreateSetupAction(new PanelAction() { Caption = "Reservation Management Settings", Image = PRSDesktop.Resources.specifications, OnExecute = ConfigSettingsClick });
 
-        // host.CreatePanelAction(new PanelAction("Treatment PO", PRSDesktop.Resources.purchase, TreatmentPO_Click));
+        if (Security.IsAllowed<CanCreateTreatmentPO>())
+          host.CreatePanelAction(new PanelAction("Treatment PO", PRSDesktop.Resources.purchase, TreatmentPO_Click));
 
         if(Mode == PanelMode.Purchase && SplitPanel.IsDetailVisible())
         {

+ 6 - 4
prs.desktop/Utils/StockUtils.cs

@@ -30,6 +30,7 @@ public static class StockUtils
             query.Add(
                 new Filter<StockHolding>(x => x.Location.ID).InList(locationIDs),
                 Columns.Required<StockHolding>().Add(x => x.ID)
+                    .Add(x => x.Location.ID)
                     .Add(x => x.Product.ID)
                     .Add(x => x.Job.ID)
                     .Add(x => x.Style.ID)
@@ -45,6 +46,7 @@ public static class StockUtils
             query.Add(
                 new Filter<StockMovement>(x => x.Location.ID).InList(locationIDs),
                 Columns.None<StockMovement>().Add(x => x.ID)
+                    .Add(x=>x.Location.ID)
                     .Add(x => x.Product.ID)
                     .Add(x => x.Job.ID)
                     .Add(x => x.Style.ID)
@@ -59,19 +61,19 @@ public static class StockUtils
             var toDelete = new List<StockHolding>();
             var movements = query.Get<StockMovement>();
 
+            double movementcount = (double)movements.Rows.Count;
             progress.Report("Processing");
             var updates = new List<StockHolding>();
-
-
+            
             while (movements.Rows.Any())
             {
-
+                double percent = ((movementcount - movements.Rows.Count) / movementcount) * 100.0;
+                progress.Report($"Processing ({percent:F2}% complete)");
                 var first = movements.Rows.First();
                 var selected = movements.Rows.Where(x => x.IsEqualTo<StockMovement, StockMovement>(first)).ToList();
 
                 var holdingrow = holdings.Rows.FirstOrDefault(x => x.IsEqualTo<StockHolding, StockMovement>(first));
                 StockHolding holding = null;
-                ;
                 if (holdingrow != null)
                 {
                     holdings.Rows.Remove(holdingrow);