|
@@ -23,11 +23,21 @@ using System.ComponentModel;
|
|
|
using com.sun.org.apache.xalan.@internal.xsltc.cmdline.getopt;
|
|
|
using InABox.WPF;
|
|
|
using System.Windows.Media.Imaging;
|
|
|
+using InABox.Configuration;
|
|
|
+using NPOI.HSSF.Util;
|
|
|
|
|
|
namespace PRSDesktop
|
|
|
{
|
|
|
+
|
|
|
+ public class StagingSetoutGridSettings : IUserConfigurationSettings
|
|
|
+ {
|
|
|
+ public CoreFilterDefinition CurrentFilter { get; set; }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
public class StagingSetoutGrid : DynamicDataGrid<StagingSetout>
|
|
|
{
|
|
|
+
|
|
|
public class SetoutDocument
|
|
|
{
|
|
|
public Document Document { get; set; }
|
|
@@ -46,11 +56,19 @@ namespace PRSDesktop
|
|
|
setout = Setout;
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ private StagingSetoutGridSettings _settings;
|
|
|
+
|
|
|
public delegate void CustomiseSetoutsEvent(IReadOnlyList<SetoutDocument> setouts);
|
|
|
|
|
|
public event CustomiseSetoutsEvent? OnCustomiseSetouts;
|
|
|
|
|
|
+ private readonly BitmapImage locked = PRSDesktop.Resources.locked.AsBitmapImage();
|
|
|
+ private readonly BitmapImage docs = PRSDesktop.Resources.design.AsBitmapImage();
|
|
|
+ private readonly BitmapImage packets = PRSDesktop.Resources.factory.AsBitmapImage();
|
|
|
private readonly BitmapImage tick = PRSDesktop.Resources.tick.AsBitmapImage();
|
|
|
+ private readonly BitmapImage warning = PRSDesktop.Resources.warning.AsBitmapImage();
|
|
|
+ private readonly BitmapImage rejected = PRSDesktop.Resources.disabled.AsBitmapImage();
|
|
|
|
|
|
public StagingSetoutGrid()
|
|
|
{
|
|
@@ -61,66 +79,103 @@ namespace PRSDesktop
|
|
|
HiddenColumns.Add(x => x.Locked);
|
|
|
HiddenColumns.Add(x => x.SavePath);
|
|
|
HiddenColumns.Add(x => x.LockedBy.ID);
|
|
|
+ HiddenColumns.Add(x => x.LockedBy.Name);
|
|
|
HiddenColumns.Add(x => x.Packets);
|
|
|
HiddenColumns.Add(x => x.UnapprovedDocuments);
|
|
|
+ HiddenColumns.Add(x => x.UnprocessedPackets);
|
|
|
+ HiddenColumns.Add(x => x.Task.ID);
|
|
|
|
|
|
- ActionColumns.Add(new DynamicTickColumn<StagingSetout, int>(x => x.Packets, tick, tick, null)
|
|
|
+ ActionColumns.Add(new DynamicTickColumn<StagingSetout,Guid>(x=>x.LockedBy.ID,locked,locked,null)
|
|
|
{
|
|
|
- ToolTip = Packets_Tooltip
|
|
|
+ ToolTip = Locked_Tooltip,
|
|
|
+ Position = DynamicActionColumnPosition.Start
|
|
|
});
|
|
|
+
|
|
|
ActionColumns.Add(new DynamicImageColumn(UnapprovedImage)
|
|
|
{
|
|
|
- ToolTip = Unapproved_Tooltip
|
|
|
+ ToolTip = Unapproved_Tooltip,
|
|
|
+ Position = DynamicActionColumnPosition.End
|
|
|
});
|
|
|
|
|
|
+ ActionColumns.Add(new DynamicImageColumn(UnprocessedPackets)
|
|
|
+ {
|
|
|
+ ToolTip = Packets_Tooltip,
|
|
|
+ Position = DynamicActionColumnPosition.End
|
|
|
+ });
|
|
|
+
|
|
|
AddButton("Create Group", null, CreateGroup);
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
+
|
|
|
+ private FrameworkElement? Locked_Tooltip(DynamicActionColumn column, CoreRow? row)
|
|
|
+ {
|
|
|
+ if(row is null)
|
|
|
+ return column.TextToolTip("Is this Design Locked?");
|
|
|
+
|
|
|
+ var islocked = row.Get<StagingSetout, Guid>(x => x.LockedBy.ID);
|
|
|
+ if (islocked != Guid.Empty)
|
|
|
+ return column.TextToolTip($"This design is locked by {row.Get<StagingSetout, String>(x => x.LockedBy.Name)}");
|
|
|
+
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+
|
|
|
private FrameworkElement? Unapproved_Tooltip(DynamicActionColumn column, CoreRow? row)
|
|
|
{
|
|
|
if(row is null)
|
|
|
- {
|
|
|
- return column.TextToolTip("Approved Documents");
|
|
|
- }
|
|
|
+ return column.TextToolTip("Is this Design Approved?");
|
|
|
+
|
|
|
+ var task = row.Get<StagingSetout, Guid>(x => x.Task.ID);
|
|
|
+ if (task != Guid.Empty)
|
|
|
+ return column.TextToolTip("This design has been rejected.");
|
|
|
+
|
|
|
var unapproved = row.Get<StagingSetout, int>(x => x.UnapprovedDocuments);
|
|
|
- if(unapproved == 0)
|
|
|
- {
|
|
|
- return column.TextToolTip("This setout has no unapproved documents");
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- return column.TextToolTip($"This setout has {unapproved} documents");
|
|
|
- }
|
|
|
+ if (unapproved == 0)
|
|
|
+ return column.TextToolTip("This design has been approved.");
|
|
|
+
|
|
|
+ return column.TextToolTip($"This design requires checking and approval.");
|
|
|
}
|
|
|
|
|
|
private FrameworkElement? Packets_Tooltip(DynamicActionColumn column, CoreRow? row)
|
|
|
{
|
|
|
if (row is null)
|
|
|
- {
|
|
|
- return null;
|
|
|
- }
|
|
|
- var packets = row.Get<StagingSetout, int>(x => x.Packets);
|
|
|
- if (packets == 0)
|
|
|
- {
|
|
|
- return column.TextToolTip("This setout has no packets");
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- return column.TextToolTip($"This setout has {packets} packets");
|
|
|
- }
|
|
|
+ return column.TextToolTip("Manufacturing Packets Status");
|
|
|
+
|
|
|
+ var packetcount = row.Get<StagingSetout, int>(x => x.Packets);
|
|
|
+ if (packetcount == 0)
|
|
|
+ return column.TextToolTip("This design has no packets defined!");
|
|
|
+
|
|
|
+ var unprocessed = row.Get<StagingSetout, int>(x => x.UnprocessedPackets);
|
|
|
+ if (unprocessed > 0)
|
|
|
+ return column.TextToolTip($"This design has {unprocessed} unprocessed packet{(unprocessed > 1 ? "s" : "")}.");
|
|
|
+
|
|
|
+ return column.TextToolTip($"All packets for this design have been processed.");
|
|
|
}
|
|
|
|
|
|
private BitmapImage? UnapprovedImage(CoreRow? arg)
|
|
|
{
|
|
|
- if(arg is null)
|
|
|
- {
|
|
|
- return null;
|
|
|
- }
|
|
|
+ if (arg is null)
|
|
|
+ return docs;
|
|
|
+ if (arg.Get<StagingSetout, Guid>(x => x.Task.ID) != Guid.Empty)
|
|
|
+ return rejected;
|
|
|
if(arg.Get<StagingSetout, int>(x => x.UnapprovedDocuments) == 0)
|
|
|
- {
|
|
|
return tick;
|
|
|
- }
|
|
|
- return null;
|
|
|
+ return warning;
|
|
|
+ }
|
|
|
+
|
|
|
+ private BitmapImage? UnprocessedPackets(CoreRow? arg)
|
|
|
+ {
|
|
|
+ if (arg is null)
|
|
|
+ return packets;
|
|
|
+ if ((arg.Get<StagingSetout, int>(x => x.Packets) > 0) && (arg.Get<StagingSetout, int>(x => x.UnprocessedPackets) == 0))
|
|
|
+ return tick;
|
|
|
+ return warning;
|
|
|
+ }
|
|
|
+
|
|
|
+ protected override void Init()
|
|
|
+ {
|
|
|
+ base.Init();
|
|
|
+ _settings = new UserConfiguration<StagingSetoutGridSettings>().Load();
|
|
|
+ SelectFilter(_settings.CurrentFilter, false);
|
|
|
}
|
|
|
|
|
|
protected override void DoReconfigure(FluentList<DynamicGridOption> options)
|
|
@@ -192,7 +247,7 @@ namespace PRSDesktop
|
|
|
var file = ReadFile(x);
|
|
|
return new SetoutDocument(file, new StagingSetout
|
|
|
{
|
|
|
- Number = file.FileName
|
|
|
+ Number = Path.GetFileNameWithoutExtension(file.FileName)
|
|
|
});
|
|
|
}).ToList();
|
|
|
|
|
@@ -352,5 +407,11 @@ namespace PRSDesktop
|
|
|
criteria.Add(new Filter<StagingSetout>(x => x.Archived).IsEqualTo(DateTime.MinValue));
|
|
|
base.Reload(criteria, columns, ref sort, action);
|
|
|
}
|
|
|
+ protected override void FilterSelected(CoreFilterDefinition filter)
|
|
|
+ {
|
|
|
+ base.FilterSelected(filter);
|
|
|
+ _settings.CurrentFilter = filter;
|
|
|
+ new UserConfiguration<StagingSetoutGridSettings>().Save(_settings);
|
|
|
+ }
|
|
|
}
|
|
|
}
|