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

Improved Performance of ManufacturingTemplate dashboard
Added Digital Forms menu to Calendar Screens
Added Roles Page to Digital Forms Screen

Frank van den Bos 2 роки тому
батько
коміт
b2d623a3bf

+ 6 - 0
prs.classes/Entities/Assignment/AssignmentLink.cs

@@ -13,6 +13,12 @@ namespace Comal.Classes
         /// </summary>
         [NullEditor]
         public override Guid ID { get; set; }
+        
+        /// <summary>
+        ///     The Number of the linked assignment
+        /// </summary>
+        [IntegerEditor(Editable = Editable.Hidden)]
+        public int Number { get; set; }
 
         /// <summary>
         ///     The date of the assignment

+ 1 - 0
prs.classes/Entities/Assignment/AssignmentLookups.cs

@@ -10,6 +10,7 @@ namespace Comal.Classes
         {
             return new Columns<Assignment>(
                 x => x.ID,
+                x => x.Number,
                 x => x.Date,
                 x => x.EmployeeLink.Name,
                 x => x.Booked.Start,

+ 1 - 1
prs.classes/Entities/Role/RoleForm.cs

@@ -5,7 +5,7 @@ using InABox.Core;
 
 namespace Comal.Classes
 {
-    public class RoleForm : Entity, IRemotable, IPersistent, IManyToMany<Role, DigitalForm>, ILicense<CoreLicense>
+    public class RoleForm : Entity, IRemotable, IPersistent, IManyToMany<Role, DigitalForm>, ILicense<CoreLicense>, IManyToMany<DigitalForm, Role>
     {
         public RoleLink Role { get; set; }
         public DigitalFormLink Form { get; set; }

+ 10 - 0
prs.desktop/Components/Calendar/Calendar.xaml.cs

@@ -1240,6 +1240,16 @@ namespace PRSDesktop
                 e.ContextMenu.Items.Add(new Separator());
                 CreateMenu(e.ContextMenu, CalendarMenuName.Fill, "Fill Available Time", FillAssignment, appointment.Model);
                 e.ContextMenu.Items.Add(new Separator());
+                
+                var digitalForms = new MenuItem { Header = "Digital Forms" };
+                DynamicGridUtils.PopulateFormMenu<AssignmentForm, Assignment, AssignmentLink>(
+                    digitalForms,
+                    appointment.Model.ID,
+                    () => new Client<Assignment>().Load(new Filter<Assignment>(x => x.ID).IsEqualTo(appointment.Model.ID)).First(),
+                    false);
+
+                e.ContextMenu.Items.Add(digitalForms);
+                e.ContextMenu.Items.Add(new Separator());
                 CreateMenu(e.ContextMenu, CalendarMenuName.Delete, "Delete Assignment", DeleteAssignment, appointment.Model);
                 e.ContextMenu.Items.Add(new Separator());
                 CreateMenu<object>(e.ContextMenu, CalendarMenuName.ZoomIn, "Zoom In", (data) => ZoomIn(), appointment.Model);

+ 18 - 14
prs.desktop/Dashboards/Manufacturing/ManufacturingTemplateAnalysis.xaml.cs

@@ -71,21 +71,20 @@ namespace PRSDesktop
 
         public void Refresh()
         {
-            using (new WaitCursor())
+            Progress.ShowModal("Loading Data", (progress) =>
             {
-                Progress.Show("Loading Data");
-
                 data.Rows.Clear();
+                MultiQuery query = new MultiQuery();
 
-                templates = new Client<ManufacturingTemplate>().Query(
+                query.Add(
                     new Filter<ManufacturingTemplate>(x => x.ID).IsNotEqualTo(Guid.Empty).TextSearch(_search, x => x.Code, x => x.Name),
                     new Columns<ManufacturingTemplate>(x => x.ID)
                         .Add(x => x.Name)
                         .Add(x => x.Code),
                     new SortOrder<ManufacturingTemplate>(x => x.Code)
-                ).ToObjects<ManufacturingTemplate>().ToArray();
+                );
 
-                var packets = new Client<ManufacturingPacket>().Query(
+                query.Add(
                     new Filter<ManufacturingPacket>(x => x.Completed).IsGreaterThanOrEqualTo(_from).And(x => x.Completed).IsLessThan(_to.AddDays(1)),
                     new Columns<ManufacturingPacket>
                     (
@@ -93,9 +92,9 @@ namespace PRSDesktop
                         x => x.ManufacturingTemplateLink.ID,
                         x => x.Quantity
                     )
-                ).ToObjects<ManufacturingPacket>();
+                );
 
-                var history = new Client<ManufacturingHistory>().Query(
+                query.Add(
                     new Filter<ManufacturingHistory>(x => x.Packet.Completed).IsGreaterThanOrEqualTo(_from).And(x => x.Packet.Completed)
                         .IsLessThan(_to.AddDays(1)),
                     new Columns<ManufacturingHistory>
@@ -105,13 +104,19 @@ namespace PRSDesktop
                         x => x.QADuration,
                         x => x.WorkDuration
                     )
-                ).ToObjects<ManufacturingHistory>()
+                );
+
+                query.Query();
+                templates = query.Get<ManufacturingTemplate>().ToObjects<ManufacturingTemplate>().ToArray();
+                var packets = query.Get<ManufacturingPacket>().ToObjects<ManufacturingPacket>();
+                ;
+                var history = query.Get<ManufacturingHistory>().ToObjects<ManufacturingHistory>()
                     .GroupBy(x => x.Packet.ID)
                     .ToDictionary(x => x.Key, x => x.ToList());
 
                 foreach (var template in templates)
                 {
-                    Progress.SetMessage(string.Format("Processing {0}: {1}", template.Code, template.Name));
+                    progress.Report(string.Format("Processing {0}: {1}", template.Code, template.Name));
 
                     var templateStageSections = (stages.GetValueOrDefault(template.ID) ?? Enumerable.Empty<ManufacturingTemplateStage>())
                         .Select(x => x.Section.ID).Where(x => sections.Any(y => x == y.ID));
@@ -136,8 +141,8 @@ namespace PRSDesktop
                             if (history.TryGetValue(p.ID, out var histories))
                             {
                                 foreach (var section in templateStageSections)
-                                    foreach (var hist in histories.Where(x => x.Section.ID == section))
-                                        times[section] += hist.QADuration.Ticks + hist.WorkDuration.Ticks;
+                                foreach (var hist in histories.Where(x => x.Section.ID == section))
+                                    times[section] += hist.QADuration.Ticks + hist.WorkDuration.Ticks;
                             }
                         }
                     }
@@ -166,8 +171,7 @@ namespace PRSDesktop
                         data.Rows.Add(values.ToArray());
                 }
 
-                Progress.Close();
-            }
+            });
         }
 
         public Dictionary<string, object[]> Selected()