Bladeren bron

Added configuration setting to skip completing incomplete manufacturing packets when scanning barcodes
Added Equipment Maintenance dashboard to Equipment Ribbon Tab
Resetting BillLine PO Item now properly resets PurchaseOrderitem.BillLine.ID

frogsoftware 9 maanden geleden
bovenliggende
commit
4802315141

+ 10 - 0
prs.classes/Entities/Shipment/ShipmentSettings.cs

@@ -0,0 +1,10 @@
+using InABox.Configuration;
+using InABox.Core;
+
+namespace Comal.Classes
+{
+    public class ShipmentSettings : BaseObject, IGlobalConfigurationSettings
+    {
+        public bool CloseManufacturingPacketOnScan { get; set; } = true;
+    }
+}

+ 3 - 0
prs.desktop/MainWindow.xaml

@@ -661,6 +661,9 @@
                     <fluent:Button x:Name="EquipmentButton" Header="Equipment List"
                                    LargeIcon="pack://application:,,,/Resources/specifications.png"
                                    Click="Equipment_Checked" MinWidth="60" />
+                    <fluent:Button x:Name="EquipmentMaintenanceButton" Header="Planned Maintenance"
+                                   LargeIcon="pack://application:,,,/Resources/service.png"
+                                   Click="EquipmentMaintenance_Checked" MinWidth="60" />
                     <fluent:Button x:Name="EquipmentPlannerButton" Header="Equipment Planner"
                                    LargeIcon="pack://application:,,,/Resources/calendar.png"
                                    Click="EquipmentPlannerButton_Click" MinWidth="60" />

+ 7 - 0
prs.desktop/MainWindow.xaml.cs

@@ -2087,6 +2087,11 @@ public partial class MainWindow : IPanelHostControl
     {
         LoadWindow<EquipmentPanel>((Fluent.Button)sender);
     }
+    
+    private void EquipmentMaintenance_Checked(object sender, RoutedEventArgs e)
+    {
+        LoadWindow<EquipmentMaintenancePanel>((Fluent.Button)sender);
+    }
 
     #endregion
 
@@ -3582,4 +3587,6 @@ public partial class MainWindow : IPanelHostControl
 
 
     #endregion
+
+
 }

+ 38 - 0
prs.desktop/Panels/Equipment/EquipmentMaintenancePanel.cs

@@ -0,0 +1,38 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using InABox.Core;
+using InABox.Wpf;
+using PRSDesktop.Dashboards;
+using Comal.Classes;
+
+namespace PRSDesktop;
+
+public class EquipmentMaintenancePanel : EquipmentSchedulesDashboard, IPanel<Equipment>
+{
+    
+    public string SectionName => "EquipmentSchedules";
+    
+    public DataModel DataModel(Selection selection)
+    {
+        return new AutoDataModel<Equipment>(new Filter<Equipment>().All());
+    }
+
+    public event DataModelUpdateEvent? OnUpdateDataModel;
+    
+    public bool IsReady { get; set; }
+    
+    public void CreateToolbarButtons(IPanelHost host)
+    {
+    }
+
+    public Dictionary<string, object[]> Selected()
+    {
+        return new();
+    }
+
+    public void Heartbeat(TimeSpan time)
+    {
+        
+    }
+}

+ 9 - 0
prs.desktop/Panels/Shipments/ShippingPanel.xaml.cs

@@ -6,6 +6,7 @@ using System.Windows;
 using System.Windows.Controls;
 using Comal.Classes;
 using InABox.Clients;
+using InABox.Configuration;
 using InABox.Core;
 using InABox.DynamicGrid;
 using InABox.WPF;
@@ -17,6 +18,7 @@ using Motorola.Snapi.EventArguments;
 
 namespace PRSDesktop
 {
+    
     /// Notes for Motorola Barcode Scanners
     /// 1) Install Scanner Driver (CoreScanner)
     /// 2) Ensure Scanner is set to SNAPI-NoImaging
@@ -111,6 +113,13 @@ namespace PRSDesktop
 
         public void CreateToolbarButtons(IPanelHost host)
         {
+            host.CreateSetupAction(new PanelAction("Shipment Module Settings",null, (action) =>
+            {
+                var _settings = new GlobalConfiguration<ShipmentSettings>().Load();
+                var grid = new DynamicItemsListGrid<ShipmentSettings>();
+                if (grid.EditItems(new[] { _settings }))
+                    new GlobalConfiguration<ShipmentSettings>().Save(_settings);
+            }));
             //host.CreatePanelAction(new PanelAction() { Caption = "Mark As Delivered", OnExecute = MarkAsDelivered, Image = PRSDesktop.Resources.barcode });
         }
 

+ 1 - 1
prs.stores/BillLineStore.cs

@@ -23,7 +23,7 @@ namespace Comal.Stores
                 ).Rows.Select(x=>x.ToObject<PurchaseOrderItem>()).ToArray();
 
                 foreach (var item in items)
-                    item.BillLine.ID = entity.ID;
+                    item.BillLine.ID = entity.OrderItem.ID != Guid.Empty ? entity.ID : Guid.Empty;
                 Provider.Save(items);
 
             }

+ 24 - 15
prs.stores/DeliveryItemStore.cs

@@ -4,6 +4,8 @@ using InABox.Core;
 using System;
 using System;
 using System;
+using InABox.Configuration;
+using InABox.Database;
 
 namespace Comal.Stores
 {
@@ -27,22 +29,29 @@ namespace Comal.Stores
                 && entity.ShipmentLink.HasOriginalValue(x => x.ID)
             )
             {
-                var filter = new Filter<ManufacturingPacket>(x => x.ID).IsEqualTo(entity.ManufacturingPacketLink.ID);
-                filter.Ands.Add(new Filter<ManufacturingPacket>(x => x.Completed).IsEqualTo(DateTime.MinValue).Or(x => x.Archived)
-                    .IsEqualTo(DateTime.MinValue));
-                var row = Provider.Query(
-                    filter,
-                    Columns.None<ManufacturingPacket>().Add(x => x.ID, x => x.Completed, x => x.Archived)
-                ).Rows.FirstOrDefault();
-                if (row != null)
+                var _settings = new GlobalConfiguration<ShipmentSettings>("", new DbConfigurationProvider<GlobalSettings>(this.UserID))
+                    .Load(false);
+                if (_settings.CloseManufacturingPacketOnScan)
                 {
-                    var packet = row.ToObject<ManufacturingPacket>();
-                    if (packet.Completed.IsEmpty())
-                        packet.Completed = DateTime.Now;
-                    if (packet.Archived.IsEmpty())
-                        packet.Archived = DateTime.Now;
-                    Provider.Save(packet);
-                    AuditTrail(packet, new[] { "Closing/Archiving Packet due to Shipment Allocation" });
+                    var filter =
+                        new Filter<ManufacturingPacket>(x => x.ID).IsEqualTo(entity.ManufacturingPacketLink.ID);
+                    filter.Ands.Add(new Filter<ManufacturingPacket>(x => x.Completed).IsEqualTo(DateTime.MinValue)
+                        .Or(x => x.Archived)
+                        .IsEqualTo(DateTime.MinValue));
+                    var row = Provider.Query(
+                        filter,
+                        Columns.None<ManufacturingPacket>().Add(x => x.ID, x => x.Completed, x => x.Archived)
+                    ).Rows.FirstOrDefault();
+                    if (row != null)
+                    {
+                        var packet = row.ToObject<ManufacturingPacket>();
+                        if (packet.Completed.IsEmpty())
+                            packet.Completed = DateTime.Now;
+                        if (packet.Archived.IsEmpty())
+                            packet.Archived = DateTime.Now;
+                        Provider.Save(packet);
+                        AuditTrail(packet, new[] { "Closing/Archiving Packet due to Shipment Allocation" });
+                    }
                 }
             }
         }