|
@@ -15,6 +15,8 @@ using System.ComponentModel;
|
|
|
using InABox.Scripting;
|
|
|
using System.Reflection;
|
|
|
using System.Collections.Immutable;
|
|
|
+using FastReport.Data;
|
|
|
+using Microsoft.Xaml.Behaviors.Core;
|
|
|
|
|
|
namespace PRSDesktop
|
|
|
{
|
|
@@ -82,6 +84,8 @@ public class Module
|
|
|
/// </summary>
|
|
|
private List<StagingSetout> selectedSetouts = new();
|
|
|
|
|
|
+ private CoreTable? _templateGroups = null;
|
|
|
+
|
|
|
#region Script Stuff
|
|
|
|
|
|
private MethodInfo? _customiseSetoutsMethod;
|
|
@@ -136,7 +140,9 @@ public class Module
|
|
|
public void Setup()
|
|
|
{
|
|
|
_settings = new GlobalConfiguration<StagingPanellSettings>().Load();
|
|
|
-
|
|
|
+
|
|
|
+ _templateGroups = new Client<ManufacturingTemplateGroup>().Query();
|
|
|
+
|
|
|
MarkUpButton.Visibility = Security.IsAllowed<CanMarkUpSetouts>() ? Visibility.Visible : Visibility.Hidden;
|
|
|
RejectButton.Visibility = Security.IsAllowed<CanApproveSetouts>() ? Visibility.Visible : Visibility.Hidden;
|
|
|
ApproveButton.Visibility = Security.IsAllowed<CanApproveSetouts>() ? Visibility.Visible : Visibility.Hidden;
|
|
@@ -641,7 +647,28 @@ public class Module
|
|
|
|
|
|
public void CreateToolbarButtons(IPanelHost host)
|
|
|
{
|
|
|
- host.CreateSetupAction(new PanelAction() { Caption = "Setouts Configuration", Image = PRSDesktop.Resources.specifications, OnExecute = ConfigSettingsClick });
|
|
|
+ host.CreateSetupAction(
|
|
|
+ new PanelAction()
|
|
|
+ {
|
|
|
+ Caption = "Setouts Configuration",
|
|
|
+ Image = PRSDesktop.Resources.specifications,
|
|
|
+ OnExecute = ConfigSettingsClick
|
|
|
+ }
|
|
|
+ );
|
|
|
+
|
|
|
+ host.CreateSetupAction(
|
|
|
+ new PanelAction()
|
|
|
+ {
|
|
|
+ Caption = "Template Products",
|
|
|
+ Image = PRSDesktop.Resources.specifications,
|
|
|
+ OnExecute =
|
|
|
+ action =>
|
|
|
+ {
|
|
|
+ var list = new MasterList(typeof(ManufacturingTemplateGroupProducts));
|
|
|
+ list.ShowDialog();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ );
|
|
|
}
|
|
|
|
|
|
private void ConfigSettingsClick(PanelAction obj)
|
|
@@ -727,10 +754,45 @@ public class Module
|
|
|
|
|
|
private void AddPacketButton_Click(object sender, RoutedEventArgs e)
|
|
|
{
|
|
|
- ManufacturingPacketList.Add();
|
|
|
- stagingSetoutGrid.Refresh(false, true);
|
|
|
- }
|
|
|
+ if (_templateGroups.Rows.Any())
|
|
|
+ {
|
|
|
+ ContextMenu menu = new ContextMenu();
|
|
|
+ foreach (var row in _templateGroups.Rows)
|
|
|
+ {
|
|
|
+ MenuItem item = new MenuItem()
|
|
|
+ {
|
|
|
+ Header =
|
|
|
+ $"{row.Get<ManufacturingTemplateGroup, String>(x => x.Code)}: {row.Get<ManufacturingTemplateGroup, String>(x => x.Description)}",
|
|
|
+ Command = new ActionCommand((obj) =>
|
|
|
+ {
|
|
|
+ ManufacturingPacketList.Add(row.ToObject<ManufacturingTemplateGroup>());
|
|
|
+ stagingSetoutGrid.Refresh(false, true);
|
|
|
+ })
|
|
|
+ };
|
|
|
+ menu.Items.Add(item);
|
|
|
+ }
|
|
|
|
|
|
+ menu.Items.Add(new Separator());
|
|
|
+ MenuItem misc = new MenuItem()
|
|
|
+ {
|
|
|
+ Header = "Miscellaneous Item",
|
|
|
+ Command = new ActionCommand((obj) =>
|
|
|
+ {
|
|
|
+ ManufacturingPacketList.Add(null);
|
|
|
+ stagingSetoutGrid.Refresh(false, true);
|
|
|
+ })
|
|
|
+ };
|
|
|
+ menu.Items.Add(misc);
|
|
|
+ menu.IsOpen = true;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ ManufacturingPacketList.Add(null);
|
|
|
+ stagingSetoutGrid.Refresh(false, true);
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
private void CollapsePacketsButton_Click(object sender, RoutedEventArgs e)
|
|
|
{
|
|
|
if (ManufacturingPacketList.Collapsed())
|
|
@@ -765,5 +827,6 @@ public class Module
|
|
|
});
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
}
|
|
|
}
|