|
@@ -17,44 +17,38 @@ using Syncfusion.UI.Xaml.Kanban;
|
|
|
|
|
|
namespace PRSDesktop
|
|
namespace PRSDesktop
|
|
{
|
|
{
|
|
|
|
+
|
|
public partial class ManufacturingPanel : UserControl, IPanel<ManufacturingPacket>
|
|
public partial class ManufacturingPanel : UserControl, IPanel<ManufacturingPacket>
|
|
{
|
|
{
|
|
- private readonly List<ManufacturingPanelColumn> _columns = new();
|
|
|
|
|
|
+ private readonly List<IManufacturingPanelColumn> _columns = new();
|
|
|
|
|
|
- private readonly BitmapImage barcode = PRSDesktop.Resources.barcode.AsBitmapImage();
|
|
|
|
|
|
+ #region Settings Fields
|
|
|
|
|
|
private bool bIncludeCompleted;
|
|
private bool bIncludeCompleted;
|
|
private bool bIncludeHeld;
|
|
private bool bIncludeHeld;
|
|
private bool bIncludeOrders;
|
|
private bool bIncludeOrders;
|
|
|
|
|
|
- private readonly DispatcherTimer columnsizer = new();
|
|
|
|
-
|
|
|
|
- private bool CompactView;
|
|
|
|
- private bool ConsolidatedView;
|
|
|
|
|
|
+ private ManufacturingViewType ViewType;
|
|
private Guid CurrentFactory = Guid.Empty;
|
|
private Guid CurrentFactory = Guid.Empty;
|
|
- public KanbanModel CurrentKanban = null;
|
|
|
|
- private readonly BitmapImage disabled = PRSDesktop.Resources.disabled.AsBitmapImage();
|
|
|
|
|
|
|
|
- private ManufacturingFactory[] Factories = { };
|
|
|
|
- private Document[] FactoryImages = { };
|
|
|
|
|
|
+ private bool SortByDueDate = true;
|
|
|
|
|
|
- private int iCombo;
|
|
|
|
- private CoreTable ITPs;
|
|
|
|
|
|
+ private ManufacturingSettings settings = new();
|
|
|
|
+
|
|
|
|
+ #endregion
|
|
|
|
+
|
|
|
|
+ private readonly DispatcherTimer columnsizer = new();
|
|
|
|
|
|
|
|
+ private Document[] FactoryImages = Array.Empty<Document>();
|
|
|
|
|
|
|
|
+ private int iCombo;
|
|
private bool JobChanging;
|
|
private bool JobChanging;
|
|
- private CoreTable Jobs;
|
|
|
|
- private readonly List<Tuple<Guid, DateTime, string>> OrderItems = new();
|
|
|
|
- private CoreTable packets;
|
|
|
|
- private ManufacturingSection[] Sections = { };
|
|
|
|
|
|
|
|
- private ManufacturingSettings settings = new();
|
|
|
|
|
|
+ private readonly ManufacturingPanelData Data = new();
|
|
|
|
|
|
- //ManufacturingTemplateStage[] TemplateStages = null;
|
|
|
|
|
|
+ private CoreTable packets;
|
|
|
|
|
|
- private bool SortByDueDate = true;
|
|
|
|
- private readonly BitmapImage speechbubble = PRSDesktop.Resources.speechbubble.AsBitmapImage();
|
|
|
|
- private ManufacturingTemplate[] Templates = { };
|
|
|
|
|
|
+ private Guid SelectedJob;
|
|
|
|
|
|
public ManufacturingPanel()
|
|
public ManufacturingPanel()
|
|
{
|
|
{
|
|
@@ -67,8 +61,6 @@ namespace PRSDesktop
|
|
|
|
|
|
//public List<String> CheckedKanbans = new List<string>();
|
|
//public List<String> CheckedKanbans = new List<string>();
|
|
|
|
|
|
- public ObservableCollection<ManufacturingKanban> Kanbans { get; set; }
|
|
|
|
-
|
|
|
|
public bool IsReady { get; set; }
|
|
public bool IsReady { get; set; }
|
|
|
|
|
|
public Dictionary<string, object[]> Selected()
|
|
public Dictionary<string, object[]> Selected()
|
|
@@ -112,14 +104,14 @@ namespace PRSDesktop
|
|
null
|
|
null
|
|
)
|
|
)
|
|
);
|
|
);
|
|
- Factories = tables[0].Rows.Select(x => x.ToObject<ManufacturingFactory>())
|
|
|
|
|
|
+ Data.Factories = tables[0].Rows.Select(x => x.ToObject<ManufacturingFactory>())
|
|
.ToArray(); //new Client<ManufacturingFactory>().Load(null, new SortOrder<ManufacturingFactory>(x=>x.Sequence));
|
|
.ToArray(); //new Client<ManufacturingFactory>().Load(null, new SortOrder<ManufacturingFactory>(x=>x.Sequence));
|
|
- Sections = tables[1].Rows.Select(x => x.ToObject<ManufacturingSection>())
|
|
|
|
|
|
+ Data.Sections = tables[1].Rows.Select(x => x.ToObject<ManufacturingSection>())
|
|
.ToArray(); //new Client<ManufacturingSection>().Load(null, new SortOrder<ManufacturingSection>(x=>x.Sequence));
|
|
.ToArray(); //new Client<ManufacturingSection>().Load(null, new SortOrder<ManufacturingSection>(x=>x.Sequence));
|
|
- Templates = tables[2].Rows.Select(x => x.ToObject<ManufacturingTemplate>())
|
|
|
|
|
|
+ Data.Templates = tables[2].Rows.Select(x => x.ToObject<ManufacturingTemplate>())
|
|
.ToArray(); //new Client<ManufacturingTemplate>().Load(null, new SortOrder<ManufacturingTemplate>(x=>x.Code));
|
|
.ToArray(); //new Client<ManufacturingTemplate>().Load(null, new SortOrder<ManufacturingTemplate>(x=>x.Code));
|
|
- Jobs = tables[3]; //.Rows.Select(x => x.ToObject<Job>()).ToArray();
|
|
|
|
- ITPs = tables[4]; //.Rows.Select(x => x.ToObject<JobITP>()).ToArray();
|
|
|
|
|
|
+ Data.Jobs = tables[3]; //.Rows.Select(x => x.ToObject<Job>()).ToArray();
|
|
|
|
+ Data.ITPs = tables[4]; //.Rows.Select(x => x.ToObject<JobITP>()).ToArray();
|
|
foreach (var orderrow in tables[5].Rows)
|
|
foreach (var orderrow in tables[5].Rows)
|
|
{
|
|
{
|
|
var id = orderrow.Get<PurchaseOrderItem, Guid>(x => x.ID);
|
|
var id = orderrow.Get<PurchaseOrderItem, Guid>(x => x.ID);
|
|
@@ -135,7 +127,7 @@ namespace PRSDesktop
|
|
|
|
|
|
var tag = receiveddate.IsEmpty() ? "ETA" : "RCVD";
|
|
var tag = receiveddate.IsEmpty() ? "ETA" : "RCVD";
|
|
|
|
|
|
- OrderItems.Add(new Tuple<Guid, DateTime, string>(
|
|
|
|
|
|
+ Data.OrderItems.Add(new Tuple<Guid, DateTime, string>(
|
|
id,
|
|
id,
|
|
receiveddate,
|
|
receiveddate,
|
|
string.Format("{0} ({1}) {2} {3:dd MMM yy} {4}",
|
|
string.Format("{0} ({1}) {2} {3:dd MMM yy} {4}",
|
|
@@ -149,8 +141,8 @@ namespace PRSDesktop
|
|
}
|
|
}
|
|
//OrderItems = tables[5]; //.Rows.Select(x => x.ToObject<PurchaseOrderItem>()).ToArray();
|
|
//OrderItems = tables[5]; //.Rows.Select(x => x.ToObject<PurchaseOrderItem>()).ToArray();
|
|
|
|
|
|
- Filter<Document> imageFilter = null;
|
|
|
|
- foreach (var Factory in Factories)
|
|
|
|
|
|
+ Filter<Document>? imageFilter = null;
|
|
|
|
+ foreach (var Factory in Data.Factories)
|
|
if (Factory.Thumbnail.IsValid())
|
|
if (Factory.Thumbnail.IsValid())
|
|
imageFilter = imageFilter == null
|
|
imageFilter = imageFilter == null
|
|
? new Filter<Document>(x => x.ID).IsEqualTo(Factory.Thumbnail.ID)
|
|
? new Filter<Document>(x => x.ID).IsEqualTo(Factory.Thumbnail.ID)
|
|
@@ -158,13 +150,14 @@ namespace PRSDesktop
|
|
FactoryImages = new Client<Document>().Load(imageFilter);
|
|
FactoryImages = new Client<Document>().Load(imageFilter);
|
|
|
|
|
|
var iFact = 1;
|
|
var iFact = 1;
|
|
- foreach (var Factory in Factories)
|
|
|
|
|
|
+ foreach (var Factory in Data.Factories)
|
|
{
|
|
{
|
|
var groups = new List<string>();
|
|
var groups = new List<string>();
|
|
if (!FactorySource.Any(x => x.Item1.Equals(Factory.Name)))
|
|
if (!FactorySource.Any(x => x.Item1.Equals(Factory.Name)))
|
|
{
|
|
{
|
|
var image = FactoryImages.FirstOrDefault(x => x.ID.Equals(Factory.Thumbnail.ID));
|
|
var image = FactoryImages.FirstOrDefault(x => x.ID.Equals(Factory.Thumbnail.ID));
|
|
- BitmapImage img = null;
|
|
|
|
|
|
+
|
|
|
|
+ BitmapImage img;
|
|
if (image != null && image.Data != null && image.Data.Length > 0)
|
|
if (image != null && image.Data != null && image.Data.Length > 0)
|
|
{
|
|
{
|
|
img = new BitmapImage();
|
|
img = new BitmapImage();
|
|
@@ -186,7 +179,7 @@ namespace PRSDesktop
|
|
FactoryListBox.SelectedIndex = iFact < FactorySource.Count ? iFact : 0;
|
|
FactoryListBox.SelectedIndex = iFact < FactorySource.Count ? iFact : 0;
|
|
|
|
|
|
SortBy.SelectedIndex = settings.SortByDueDate ? 1 : 0;
|
|
SortBy.SelectedIndex = settings.SortByDueDate ? 1 : 0;
|
|
- View.SelectedIndex = settings.CompactView ? 1 : 0;
|
|
|
|
|
|
+ View.SelectedIndex = (int)ViewType;
|
|
|
|
|
|
bIncludeHeld = settings.IncludeHeld;
|
|
bIncludeHeld = settings.IncludeHeld;
|
|
IncludeHeld.IsChecked = bIncludeHeld;
|
|
IncludeHeld.IsChecked = bIncludeHeld;
|
|
@@ -219,12 +212,13 @@ namespace PRSDesktop
|
|
// });
|
|
// });
|
|
|
|
|
|
var jobs = new Dictionary<Guid, string> { { CoreUtils.FullGuid, "All Jobs" } };
|
|
var jobs = new Dictionary<Guid, string> { { CoreUtils.FullGuid, "All Jobs" } };
|
|
- foreach (var row in Jobs.Rows)
|
|
|
|
|
|
+ foreach (var row in Data.Jobs.Rows)
|
|
jobs[row.Get<Job, Guid>(c => c.ID)] =
|
|
jobs[row.Get<Job, Guid>(c => c.ID)] =
|
|
string.Format("{0}: {1}", row.Get<Job, string>(c => c.JobNumber), row.Get<Job, string>(c => c.Name));
|
|
string.Format("{0}: {1}", row.Get<Job, string>(c => c.JobNumber), row.Get<Job, string>(c => c.Name));
|
|
JobChanging = true;
|
|
JobChanging = true;
|
|
Job.ItemsSource = jobs;
|
|
Job.ItemsSource = jobs;
|
|
Job.SelectedValue = CoreUtils.FullGuid;
|
|
Job.SelectedValue = CoreUtils.FullGuid;
|
|
|
|
+ SelectedJob = CoreUtils.FullGuid;
|
|
ITP.IsEnabled = false;
|
|
ITP.IsEnabled = false;
|
|
JobChanging = false;
|
|
JobChanging = false;
|
|
}
|
|
}
|
|
@@ -245,12 +239,12 @@ namespace PRSDesktop
|
|
foreach (var column in _columns)
|
|
foreach (var column in _columns)
|
|
{
|
|
{
|
|
var rows = selection == Selection.None
|
|
var rows = selection == Selection.None
|
|
- ? new CoreRow[] { }
|
|
|
|
|
|
+ ? Enumerable.Empty<ManufacturingPacket>()
|
|
: selection == Selection.Selected
|
|
: selection == Selection.Selected
|
|
- ? column.GetSelectedRows(Guid.Empty.ToString())
|
|
|
|
- : column.packets.Rows;
|
|
|
|
|
|
+ ? column.GetSelectedPackets()
|
|
|
|
+ : column.GetPackets();
|
|
|
|
|
|
- ids.AddRange(rows.Select(r => r.Get<ManufacturingPacket, Guid>(c => c.ID)));
|
|
|
|
|
|
+ ids.AddRange(rows.Select(r => r.ID));
|
|
}
|
|
}
|
|
|
|
|
|
return new ManufacturingPacketDataModel(new Filter<ManufacturingPacket>(x => x.ID).InList(ids.ToArray()));
|
|
return new ManufacturingPacketDataModel(new Filter<ManufacturingPacket>(x => x.ID).InList(ids.ToArray()));
|
|
@@ -274,7 +268,7 @@ namespace PRSDesktop
|
|
Application.Current.Dispatcher.Invoke(() => { Mouse.OverrideCursor = null; });
|
|
Application.Current.Dispatcher.Invoke(() => { Mouse.OverrideCursor = null; });
|
|
}
|
|
}
|
|
|
|
|
|
- public event DataModelUpdateEvent OnUpdateDataModel;
|
|
|
|
|
|
+ public event DataModelUpdateEvent? OnUpdateDataModel;
|
|
|
|
|
|
//private void ChangeDate_Click(object sender, RoutedEventArgs e)
|
|
//private void ChangeDate_Click(object sender, RoutedEventArgs e)
|
|
//{
|
|
//{
|
|
@@ -398,10 +392,14 @@ namespace PRSDesktop
|
|
|
|
|
|
private void Job_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
|
private void Job_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
|
{
|
|
{
|
|
|
|
+ var oldID = SelectedJob;
|
|
|
|
+ var newID = Job.SelectedValue != null ? (Guid)Job.SelectedValue : Guid.Empty;
|
|
|
|
+ SelectedJob = newID;
|
|
|
|
+
|
|
//Dictionary<Guid, String> Levels = new Dictionary<Guid, string>() { { CoreUtils.FullGuid, "All Levels" } };
|
|
//Dictionary<Guid, String> Levels = new Dictionary<Guid, string>() { { CoreUtils.FullGuid, "All Levels" } };
|
|
//Dictionary<Guid, String> Zones = new Dictionary<Guid, string>() { { CoreUtils.FullGuid, "All Zones" } };
|
|
//Dictionary<Guid, String> Zones = new Dictionary<Guid, string>() { { CoreUtils.FullGuid, "All Zones" } };
|
|
var itps = new Dictionary<Guid, string> { { CoreUtils.FullGuid, "All ITPs" } };
|
|
var itps = new Dictionary<Guid, string> { { CoreUtils.FullGuid, "All ITPs" } };
|
|
- if (Job.SelectedValue == null || (Guid)Job.SelectedValue == CoreUtils.FullGuid)
|
|
|
|
|
|
+ if (SelectedJob == Guid.Empty || SelectedJob == CoreUtils.FullGuid)
|
|
{
|
|
{
|
|
iCombo = 1;
|
|
iCombo = 1;
|
|
//Level.ItemsSource = Levels;
|
|
//Level.ItemsSource = Levels;
|
|
@@ -417,81 +415,32 @@ namespace PRSDesktop
|
|
ITP.IsEnabled = false;
|
|
ITP.IsEnabled = false;
|
|
|
|
|
|
iCombo = 0;
|
|
iCombo = 0;
|
|
- if (!JobChanging)
|
|
|
|
- ReloadPackets();
|
|
|
|
- return;
|
|
|
|
}
|
|
}
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ iCombo = 1;
|
|
|
|
|
|
- iCombo = 1;
|
|
|
|
-
|
|
|
|
- foreach (var row in ITPs.Rows.Where(r => r.Get<JobITP, Guid>(c => c.Job.ID).Equals(Job.SelectedValue)))
|
|
|
|
- itps[row.Get<JobITP, Guid>(c => c.Job.ID)] =
|
|
|
|
- string.Format("{0}: {1}", row.Get<JobITP, string>(c => c.Code), row.Get<JobITP, string>(c => c.Description));
|
|
|
|
-
|
|
|
|
- ITP.ItemsSource = itps;
|
|
|
|
- ITP.SelectedValue = CoreUtils.FullGuid;
|
|
|
|
- ITP.IsEnabled = true;
|
|
|
|
- iCombo--;
|
|
|
|
- if (iCombo == 0)
|
|
|
|
- ReloadPackets();
|
|
|
|
-
|
|
|
|
- //new Client<JobLevel>().Query(
|
|
|
|
- // new Filter<JobLevel>(x=>x.Job.ID).IsEqualTo((Guid)Job.SelectedValue),
|
|
|
|
- // LookupFactory.DefineColumns<JobLevel>(),
|
|
|
|
- // LookupFactory.DefineSort<JobLevel>(),
|
|
|
|
- // (table, error) =>
|
|
|
|
- // {
|
|
|
|
- // foreach (var row in table.Rows)
|
|
|
|
- // Levels[row.Get<JobLevel, Guid>(x => x.ID)] = String.Format("{0}: {1}", row.Get<JobLevel,String>(x=>x.Code), row.Get<JobLevel,String>(x=>x.Description));
|
|
|
|
- // Dispatcher.Invoke(() =>
|
|
|
|
- // {
|
|
|
|
- // Level.ItemsSource = Levels;
|
|
|
|
- // Level.SelectedValue = CoreUtils.FullGuid;
|
|
|
|
- // Level.IsEnabled = true;
|
|
|
|
-
|
|
|
|
- // iCombo--;
|
|
|
|
- // if (iCombo == 0)
|
|
|
|
- // ReloadPackets();
|
|
|
|
- // });
|
|
|
|
- // });
|
|
|
|
|
|
+ foreach (var row in Data.ITPs.Rows.Where(r => r.Get<JobITP, Guid>(c => c.Job.ID).Equals(SelectedJob)))
|
|
|
|
+ itps[row.Get<JobITP, Guid>(c => c.Job.ID)] =
|
|
|
|
+ string.Format("{0}: {1}", row.Get<JobITP, string>(c => c.Code), row.Get<JobITP, string>(c => c.Description));
|
|
|
|
|
|
- // new Client<JobZone>().Query(
|
|
|
|
- // new Filter<JobZone>(x => x.Job.ID).IsEqualTo((Guid)Job.SelectedValue),
|
|
|
|
- // LookupFactory.DefineColumns<JobZone>(),
|
|
|
|
- // LookupFactory.DefineSort<JobZone>(),
|
|
|
|
- // (table, error) =>
|
|
|
|
- // {
|
|
|
|
- // foreach (var row in table.Rows)
|
|
|
|
- // Zones[row.Get<JobZone, Guid>(x => x.ID)] = String.Format("{0}: {1}", row.Get<JobZone, String>(x => x.Code), row.Get<JobZone, String>(x => x.Description));
|
|
|
|
- // Dispatcher.Invoke(() =>
|
|
|
|
- // {
|
|
|
|
- // Zone.ItemsSource = Zones;
|
|
|
|
- // Zone.SelectedValue = CoreUtils.FullGuid;
|
|
|
|
- // Zone.IsEnabled = true;
|
|
|
|
- // iCombo--;
|
|
|
|
- // if (iCombo == 0)
|
|
|
|
- // ReloadPackets();
|
|
|
|
- // });
|
|
|
|
- // });
|
|
|
|
|
|
+ ITP.ItemsSource = itps;
|
|
|
|
+ ITP.SelectedValue = CoreUtils.FullGuid;
|
|
|
|
+ ITP.IsEnabled = true;
|
|
|
|
+ iCombo--;
|
|
|
|
+ }
|
|
|
|
|
|
- //new Client<JobITP>().Query(
|
|
|
|
- // new Filter<JobITP>(x => x.Job.ID).IsEqualTo((Guid)Job.SelectedValue),
|
|
|
|
- // LookupFactory.DefineColumns<JobITP>(),
|
|
|
|
- // LookupFactory.DefineSort<JobITP>(),
|
|
|
|
- // (table, error) =>
|
|
|
|
- // {
|
|
|
|
- // foreach (var row in table.Rows)
|
|
|
|
- // ITPs[row.Get<JobITP, Guid>(x => x.ID)] = String.Format("{0}: {1}", row.Get<JobITP, String>(x => x.Code), row.Get<JobITP, String>(x => x.Description));
|
|
|
|
- // Dispatcher.Invoke(() =>
|
|
|
|
- // {
|
|
|
|
- // ITP.ItemsSource = ITPs;
|
|
|
|
- // ITP.SelectedValue = CoreUtils.FullGuid;
|
|
|
|
- // ITP.IsEnabled = true;
|
|
|
|
- // iCombo--;
|
|
|
|
- // if (iCombo == 0)
|
|
|
|
- // ReloadPackets();
|
|
|
|
- // });
|
|
|
|
- // });
|
|
|
|
|
|
+ if (newID != CoreUtils.FullGuid && ViewType == ManufacturingViewType.Job)
|
|
|
|
+ {
|
|
|
|
+ View.SelectedIndex = (int)ManufacturingViewType.Full;
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ if (!JobChanging && iCombo == 0)
|
|
|
|
+ {
|
|
|
|
+ ReloadPackets();
|
|
|
|
+ }
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
private void Unit_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
|
private void Unit_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
|
@@ -501,17 +450,15 @@ namespace PRSDesktop
|
|
ReloadPackets();
|
|
ReloadPackets();
|
|
}
|
|
}
|
|
|
|
|
|
- private void CreateColumn(string title, Guid category)
|
|
|
|
|
|
+ private void AddColumn<TColumn>(string title, Guid category, TColumn column)
|
|
|
|
+ where TColumn : FrameworkElement, IManufacturingPanelColumn
|
|
{
|
|
{
|
|
- var column = new ManufacturingPanelColumn();
|
|
|
|
column.Margin = new Thickness(_columns.Any() ? 2 : 0, 0, 0, 0);
|
|
column.Margin = new Thickness(_columns.Any() ? 2 : 0, 0, 0, 0);
|
|
column.Title = title;
|
|
column.Title = title;
|
|
- column.CompactView = CompactView;
|
|
|
|
|
|
+ column.Data = Data;
|
|
column.Category = category;
|
|
column.Category = category;
|
|
|
|
+
|
|
column.SetValue(Grid.ColumnProperty, _columns.Count);
|
|
column.SetValue(Grid.ColumnProperty, _columns.Count);
|
|
- column.Templates = Templates;
|
|
|
|
- column.Factories = Factories;
|
|
|
|
- column.OnChanged += Column_OnChanged;
|
|
|
|
column.OnCollapsed += Column_OnCollapsed;
|
|
column.OnCollapsed += Column_OnCollapsed;
|
|
|
|
|
|
Columns.ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) });
|
|
Columns.ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) });
|
|
@@ -519,13 +466,39 @@ namespace PRSDesktop
|
|
_columns.Add(column);
|
|
_columns.Add(column);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ private void CreateColumn(string title, Guid category)
|
|
|
|
+ {
|
|
|
|
+ var job = SelectedJob;
|
|
|
|
+ if (ViewType == ManufacturingViewType.Job)
|
|
|
|
+ {
|
|
|
|
+ var column = new ManufacturingPanelJobColumn();
|
|
|
|
+ column.OnSelectJob += Column_OnSelectJob;
|
|
|
|
+ AddColumn(title, category, column);
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ var column = new ManufacturingPanelColumn();
|
|
|
|
+
|
|
|
|
+ column.CompactView = ViewType == ManufacturingViewType.Compact;
|
|
|
|
+ column.OnChanged += Column_OnChanged;
|
|
|
|
+
|
|
|
|
+ AddColumn(title, category, column);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private void Column_OnSelectJob(Guid jobID)
|
|
|
|
+ {
|
|
|
|
+ Job.SelectedValue = jobID;
|
|
|
|
+ }
|
|
|
|
+
|
|
private void Column_OnCollapsed(object sender, bool collapsed)
|
|
private void Column_OnCollapsed(object sender, bool collapsed)
|
|
{
|
|
{
|
|
- var index = _columns.IndexOf((ManufacturingPanelColumn)sender);
|
|
|
|
|
|
+ var index = _columns.IndexOf((IManufacturingPanelColumn)sender);
|
|
Columns.ColumnDefinitions[index].Width = new GridLength(1, collapsed ? GridUnitType.Auto : GridUnitType.Star);
|
|
Columns.ColumnDefinitions[index].Width = new GridLength(1, collapsed ? GridUnitType.Auto : GridUnitType.Star);
|
|
}
|
|
}
|
|
|
|
|
|
- private void Column_OnChanged(object sender, EventArgs e)
|
|
|
|
|
|
+ private void Column_OnChanged(object? sender, EventArgs e)
|
|
{
|
|
{
|
|
Refresh();
|
|
Refresh();
|
|
}
|
|
}
|
|
@@ -542,11 +515,11 @@ namespace PRSDesktop
|
|
//Kanban.Columns.Clear();
|
|
//Kanban.Columns.Clear();
|
|
//Kanban.Columns.Add(new KanbanColumn() { Title = "To be Issued", Categories = Guid.Empty.ToString() });
|
|
//Kanban.Columns.Add(new KanbanColumn() { Title = "To be Issued", Categories = Guid.Empty.ToString() });
|
|
|
|
|
|
- foreach (var Factory in Factories)
|
|
|
|
- if (CurrentFactory.Equals(Guid.Empty) || CurrentFactory.Equals(Factory.ID))
|
|
|
|
- foreach (var Section in Sections)
|
|
|
|
- if (Section.Factory.ID.Equals(Factory.ID) && !Section.Hidden)
|
|
|
|
- CreateColumn(Section.Factory.Name + ":" + Section.Name, Section.ID);
|
|
|
|
|
|
+ foreach (var factory in Data.Factories)
|
|
|
|
+ if (CurrentFactory.Equals(Guid.Empty) || CurrentFactory.Equals(factory.ID))
|
|
|
|
+ foreach (var section in Data.Sections)
|
|
|
|
+ if (section.Factory.ID.Equals(factory.ID) && !section.Hidden)
|
|
|
|
+ CreateColumn(section.Factory.Name + ":" + section.Name, section.ID);
|
|
//Kanban.Columns.Add(new KanbanColumn() { Title = Section.Factory.Name + ":" + Section.Name, Categories = Section.ID.ToString() });
|
|
//Kanban.Columns.Add(new KanbanColumn() { Title = Section.Factory.Name + ":" + Section.Name, Categories = Section.ID.ToString() });
|
|
if (bIncludeCompleted)
|
|
if (bIncludeCompleted)
|
|
CreateColumn("Completed", CoreUtils.FullGuid);
|
|
CreateColumn("Completed", CoreUtils.FullGuid);
|
|
@@ -609,17 +582,6 @@ namespace PRSDesktop
|
|
// CheckedKanbans.Add(task.ID);
|
|
// CheckedKanbans.Add(task.ID);
|
|
}
|
|
}
|
|
|
|
|
|
-
|
|
|
|
- private string GetColor(DateTime duedate, DateTime estdate)
|
|
|
|
- {
|
|
|
|
- var color = "LightGreen";
|
|
|
|
- if (duedate < estdate)
|
|
|
|
- color = "Salmon";
|
|
|
|
- else if (duedate < estdate.AddDays(7))
|
|
|
|
- color = "LightYellow";
|
|
|
|
- return color;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
private string GetQualityStatus(QualityStatus status)
|
|
private string GetQualityStatus(QualityStatus status)
|
|
{
|
|
{
|
|
if (status == QualityStatus.Passed)
|
|
if (status == QualityStatus.Passed)
|
|
@@ -635,29 +597,11 @@ namespace PRSDesktop
|
|
|
|
|
|
private void ReloadPackets()
|
|
private void ReloadPackets()
|
|
{
|
|
{
|
|
- Kanbans = new ObservableCollection<ManufacturingKanban>();
|
|
|
|
- var now = DateTime.Now;
|
|
|
|
- var elapsed = new TimeSpan(0);
|
|
|
|
-
|
|
|
|
- var CheckedKanbans = new List<string>();
|
|
|
|
- foreach (var column in _columns)
|
|
|
|
- CheckedKanbans.AddRange(column.GetSelectedKanbans("").Select(x => x.ID));
|
|
|
|
-
|
|
|
|
- var client = new Client<ManufacturingPacket>();
|
|
|
|
-
|
|
|
|
var filter = GenerateFilter();
|
|
var filter = GenerateFilter();
|
|
-
|
|
|
|
- //new CoreTable().LoadColumns(typeof(ManufacturingPacket));
|
|
|
|
-
|
|
|
|
var columns = GenerateColumns();
|
|
var columns = GenerateColumns();
|
|
|
|
|
|
- //var iprops = InABox.Core.DatabaseSchema.Properties(typeof(ManufacturingPacket)).Where(x => !x.Name.Equals("CustomAttributes") && !x.Name.Equals("Stages") && !x.Name.Equals("Time") && !x.Name.Equals("ActualTime") /* && !x.Name.Equals("TimeRemaining") */);
|
|
|
|
-
|
|
|
|
- //foreach (var iprop in iprops)
|
|
|
|
- // columns.Add(iprop.Name);
|
|
|
|
-
|
|
|
|
- now = DateTime.Now;
|
|
|
|
- packets = client.Query(
|
|
|
|
|
|
+ using var profiler = new Profiler(false);
|
|
|
|
+ packets = new Client<ManufacturingPacket>().Query(
|
|
filter,
|
|
filter,
|
|
columns,
|
|
columns,
|
|
SortBy.SelectedIndex == 0
|
|
SortBy.SelectedIndex == 0
|
|
@@ -665,230 +609,22 @@ namespace PRSDesktop
|
|
: new SortOrder<ManufacturingPacket>(x => x.DueDate).ThenBy(x => x.Priority, SortDirection.Descending)
|
|
: new SortOrder<ManufacturingPacket>(x => x.DueDate).ThenBy(x => x.Priority, SortDirection.Descending)
|
|
.ThenBy(x => x.SetoutLink.Number));
|
|
.ThenBy(x => x.SetoutLink.Number));
|
|
|
|
|
|
- elapsed = DateTime.Now - now;
|
|
|
|
Logger.Send(LogType.Information, ClientFactory.UserID,
|
|
Logger.Send(LogType.Information, ClientFactory.UserID,
|
|
- string.Format("Retrieved {0} packets in {1}ms", packets.Rows.Count, elapsed.TotalMilliseconds));
|
|
|
|
- now = DateTime.Now;
|
|
|
|
-
|
|
|
|
- foreach (var row in packets.Rows)
|
|
|
|
- {
|
|
|
|
- var bOK = true;
|
|
|
|
-
|
|
|
|
- var completed = row.Get<ManufacturingPacket, DateTime>(x => x.Completed);
|
|
|
|
-
|
|
|
|
- var onhold = row.Get<ManufacturingPacket, bool>(x => x.OnHold);
|
|
|
|
- var issues = row.Get<ManufacturingPacket, string>(x => x.Issues);
|
|
|
|
-
|
|
|
|
- var orderitemid = row.EntityLinkID<ManufacturingPacket, PurchaseOrderItemLink>(x => x.OrderItem) ?? Guid.Empty;
|
|
|
|
- var orderitem = orderitemid != Guid.Empty ? OrderItems.FirstOrDefault(x => x.Item1.Equals(orderitemid)) : null;
|
|
|
|
- //if (bOK && !bIncludeOrders)
|
|
|
|
- // bOK = (orderitem == null) || !orderitem.Item2.IsEmpty();
|
|
|
|
-
|
|
|
|
- //bool bSkipJobCheck = false;
|
|
|
|
- var itp = row.Get<ManufacturingPacket, Guid>(x => x.ITP.ID);
|
|
|
|
- //if (bOK && (ITP.SelectedValue != null) && !ITP.SelectedValue.Equals(CoreUtils.FullGuid))
|
|
|
|
- //{
|
|
|
|
- // bOK = itp == (Guid)ITP.SelectedValue;
|
|
|
|
- // bSkipJobCheck = true;
|
|
|
|
- //}
|
|
|
|
-
|
|
|
|
- var jobid = row.Get<ManufacturingPacket, Guid>(x => x.SetoutLink.JobLink.ID);
|
|
|
|
- //if (bOK && !bSkipJobCheck && (Job.SelectedValue != null) && !Job.SelectedValue.Equals(CoreUtils.FullGuid))
|
|
|
|
- // bOK = jobid ==(Guid)Job.SelectedValue;
|
|
|
|
-
|
|
|
|
- var sectionid = row.Get<ManufacturingPacket, Guid>(x => x.StageLink.SectionID);
|
|
|
|
- //if (bOK && !CurrentFactory.Equals(Guid.Empty))
|
|
|
|
- // bOK = Sections.Any(x => x.Factory.ID.Equals(CurrentFactory) && x.ID.Equals(sectionid));
|
|
|
|
-
|
|
|
|
- //if (CurrentFactory != Guid.Empty)
|
|
|
|
- //{
|
|
|
|
- // var templatefilter = new Filter<ManufacturingPacket>(x => x.ManufacturingTemplateLink.Factory.ID).IsEqualTo(CurrentFactory).Or(x => x.StageLink.ID).IsNotEqualTo(Guid.Empty);
|
|
|
|
- // filter.Ands.Add(templatefilter);
|
|
|
|
- //}
|
|
|
|
-
|
|
|
|
- var title = row.Get<ManufacturingPacket, string>(x => x.Title);
|
|
|
|
- var serial = row.Get<ManufacturingPacket, string>(x => x.Serial);
|
|
|
|
- var watermark = row.Get<ManufacturingPacket, string>(x => x.WaterMark);
|
|
|
|
- var location = row.Get<ManufacturingPacket, string>(x => x.Location);
|
|
|
|
-
|
|
|
|
- var setoutlocation = row.Get<ManufacturingPacket, string>(x => x.SetoutLink.Location);
|
|
|
|
- var setoutnumber = row.Get<ManufacturingPacket, string>(x => x.SetoutLink.Number);
|
|
|
|
- var setoutdescription = row.Get<ManufacturingPacket, string>(x => x.SetoutLink.Description);
|
|
|
|
-
|
|
|
|
- var templateid = row.Get<ManufacturingPacket, Guid>(x => x.ManufacturingTemplateLink.ID);
|
|
|
|
- var templatecode = Templates.FirstOrDefault(x => x.ID.Equals(templateid))?.Code;
|
|
|
|
-
|
|
|
|
- //if (bOK && !String.IsNullOrWhiteSpace(SearchBox.Text))
|
|
|
|
- //{
|
|
|
|
- // var search = SearchBox.Text.ToUpper();
|
|
|
|
- // bOK = title.ToUpper().Contains(search)
|
|
|
|
- // || serial.ToUpper().Contains(search)
|
|
|
|
- // || watermark.ToUpper().Contains(search)
|
|
|
|
- // || location.ToUpper().Contains(search)
|
|
|
|
- // || setoutlocation.ToUpper().Contains(search)
|
|
|
|
- // || setoutnumber.ToUpper().Contains(search)
|
|
|
|
- // || templatecode.ToUpper().Contains(search);
|
|
|
|
- //}
|
|
|
|
-
|
|
|
|
- if (bOK)
|
|
|
|
- {
|
|
|
|
- var id = row.Get<ManufacturingPacket, Guid>(x => x.ID);
|
|
|
|
- var priority = row.Get<ManufacturingPacket, bool>(x => x.Priority);
|
|
|
|
- var distributed = row.Get<ManufacturingPacket, bool>(x => x.Distributed);
|
|
|
|
-
|
|
|
|
- var barcodeqty = row.Get<ManufacturingPacket, int>(x => x.BarcodeQty);
|
|
|
|
- var quantity = row.Get<ManufacturingPacket, int>(x => x.Quantity);
|
|
|
|
- var estimateddate = row.Get<ManufacturingPacket, DateTime>(x => x.EstimatedDate);
|
|
|
|
- var created = row.Get<ManufacturingPacket, DateTime>(x => x.Created);
|
|
|
|
- var duedate = row.Get<ManufacturingPacket, DateTime>(x => x.DueDate);
|
|
|
|
- var barcodeprinted = row.Get<ManufacturingPacket, DateTime>(x => x.BarcodePrinted);
|
|
|
|
- var barcodetype = row.Get<ManufacturingPacket, BarcodeType>(x => x.BarcodeType);
|
|
|
|
-
|
|
|
|
- var stageid = row.Get<ManufacturingPacket, Guid>(x => x.StageLink.ID);
|
|
|
|
- var stageValid = Entity.IsEntityLinkValid<ManufacturingPacket, ManufacturingPacketStageLink>(x => x.StageLink, row);
|
|
|
|
- var station = row.Get<ManufacturingPacket, int>(x => x.StageLink.Station);
|
|
|
|
- var time = row.Get<ManufacturingPacket, TimeSpan>(x => x.StageLink.Time);
|
|
|
|
- var percentagecomplete = row.Get<ManufacturingPacket, double>(x => x.StageLink.PercentageComplete);
|
|
|
|
-
|
|
|
|
- var jobrow = Jobs.Rows.FirstOrDefault(r => r.Get<Job, Guid>(c => c.ID).Equals(jobid));
|
|
|
|
- var jobname = jobrow?.Get<Job, string>(c => c.Name);
|
|
|
|
- var jobnumber = jobrow?.Get<Job, string>(c => c.JobNumber);
|
|
|
|
-
|
|
|
|
- var model = new ManufacturingKanban();
|
|
|
|
-
|
|
|
|
- var flags = new List<string>();
|
|
|
|
- if (onhold)
|
|
|
|
- flags.Add("HOLD");
|
|
|
|
- if (priority)
|
|
|
|
- flags.Add("PRIORITY");
|
|
|
|
- if (distributed)
|
|
|
|
- flags.Add("DISTRIB");
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- model.ID = id.ToString();
|
|
|
|
-
|
|
|
|
- var sTitle = string.Format("{0}{1}", quantity != barcodeqty ? string.Format("{0} x ", quantity) : "",
|
|
|
|
- row.Get<ManufacturingPacket, string>(x => x.Title));
|
|
|
|
-
|
|
|
|
- model.Title = CompactView
|
|
|
|
- ? string.Format("{0} x {1} / {2} {3}",
|
|
|
|
- barcodeqty,
|
|
|
|
- setoutnumber,
|
|
|
|
- serial,
|
|
|
|
- sTitle
|
|
|
|
- )
|
|
|
|
- : string.Format("{0}: {1}",
|
|
|
|
- serial,
|
|
|
|
- sTitle
|
|
|
|
- );
|
|
|
|
-
|
|
|
|
- if (!string.IsNullOrWhiteSpace(watermark))
|
|
|
|
- model.Title = "[" + watermark + "] " + model.Title;
|
|
|
|
-
|
|
|
|
- model.Quantity = barcodeqty;
|
|
|
|
-
|
|
|
|
- model.JobName = string.Format("{0}: {1}", setoutnumber, jobname);
|
|
|
|
-
|
|
|
|
- model.CreatedDate = created;
|
|
|
|
-
|
|
|
|
- model.DueDate = duedate;
|
|
|
|
-
|
|
|
|
- model.Time = time;
|
|
|
|
- model.PercentageComplete = percentagecomplete;
|
|
|
|
-
|
|
|
|
- if (string.IsNullOrEmpty(location))
|
|
|
|
- location = setoutlocation;
|
|
|
|
-
|
|
|
|
- var descrip = new List<string>();
|
|
|
|
-
|
|
|
|
- //List<String> locdesc = new List<string>()
|
|
|
|
- //{
|
|
|
|
- // row.Get<ManufacturingPacket,String>(x=>x.Level.Code),
|
|
|
|
- // row.Get<ManufacturingPacket,String>(x=>x.Zone.Code),
|
|
|
|
- // location
|
|
|
|
- //};
|
|
|
|
- //descrip.Add(String.Join(" / ", locdesc.Where(x => !String.IsNullOrWhiteSpace(x))));
|
|
|
|
- descrip.Add(location);
|
|
|
|
-
|
|
|
|
- if (orderitem != null)
|
|
|
|
- descrip.Add(orderitem.Item3);
|
|
|
|
-
|
|
|
|
- model.Description = string.Join("\n", descrip);
|
|
|
|
-
|
|
|
|
- model.TemplateID = row.Get<ManufacturingPacket, Guid>(c => c.ManufacturingTemplateLink.ID);
|
|
|
|
|
|
+ string.Format("Retrieved {0} packets in {1}ms", packets.Rows.Count, profiler.Restart()));
|
|
|
|
|
|
- model.Image = !barcodeprinted.IsEmpty() ? barcode : barcodetype == BarcodeType.None ? disabled : null;
|
|
|
|
- model.Tags = new string[] { };
|
|
|
|
- model.Category = completed != DateTime.MinValue ? CoreUtils.FullGuid : sectionid;
|
|
|
|
|
|
+ var results = packets
|
|
|
|
+ .ToObjects<ManufacturingPacket>()
|
|
|
|
+ .GroupBy(x => x.StageLink.SectionID)
|
|
|
|
+ .ToDictionary(x => x.Key, x => x);
|
|
|
|
|
|
- if (priority)
|
|
|
|
- model.ColorKey = "Red";
|
|
|
|
- else if (onhold)
|
|
|
|
- model.ColorKey = "Silver";
|
|
|
|
- else
|
|
|
|
- model.ColorKey = GetColor(
|
|
|
|
- duedate.IsEmpty() ? DateTime.Today : duedate,
|
|
|
|
- estimateddate.IsEmpty() ? DateTime.Today : estimateddate
|
|
|
|
- );
|
|
|
|
- model.IssuesImage = string.IsNullOrWhiteSpace(issues)
|
|
|
|
- ? null
|
|
|
|
- : speechbubble;
|
|
|
|
- model.Issues = issues;
|
|
|
|
-
|
|
|
|
- if (orderitem != null)
|
|
|
|
- {
|
|
|
|
- var bOnOrder = orderitem.Item2.IsEmpty();
|
|
|
|
- model.OrderColor = bOnOrder ? "Plum" : "DarkOrchid";
|
|
|
|
- model.OrderStatus = bOnOrder ? "ON ORDER" : "RECEIVED";
|
|
|
|
- }
|
|
|
|
- else
|
|
|
|
- {
|
|
|
|
- model.OrderColor = model.ColorKey;
|
|
|
|
- model.OrderStatus = "";
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- model.Checked = CheckedKanbans.Contains(id.ToString());
|
|
|
|
-
|
|
|
|
- model.Flags = string.Join("\n", flags);
|
|
|
|
-
|
|
|
|
- model.Template = templatecode;
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- if (!stageValid || stageid.Equals(Guid.Empty) || stageid.Equals(CoreUtils.FullGuid))
|
|
|
|
- {
|
|
|
|
- model.Status = "";
|
|
|
|
- }
|
|
|
|
- else
|
|
|
|
- {
|
|
|
|
- if (station == 0)
|
|
|
|
- model.Status = "Not Started";
|
|
|
|
- else
|
|
|
|
- model.Status = string.Format("{0} ({1:F0}%)", station == -1 ? "Shared" : "Stn " + station, percentagecomplete);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- Kanbans.Add(model);
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- elapsed = DateTime.Now - now;
|
|
|
|
- Logger.Send(LogType.Information, ClientFactory.UserID, string.Format("Processed Kanbans in {0}ms", elapsed.TotalMilliseconds));
|
|
|
|
- now = DateTime.Now;
|
|
|
|
|
|
+ Logger.Send(LogType.Information, ClientFactory.UserID, string.Format("Processed Kanbans in {0}ms", profiler.Restart()));
|
|
|
|
|
|
foreach (var column in _columns)
|
|
foreach (var column in _columns)
|
|
{
|
|
{
|
|
- column.packets = packets;
|
|
|
|
- column.Kanbans = Kanbans.Where(x => x.Category.Equals(column.Category)).ToArray();
|
|
|
|
|
|
+ column.SetPackets(results.GetValueOrDefault(column.Category) ?? Enumerable.Empty<ManufacturingPacket>());
|
|
}
|
|
}
|
|
- //foreach (var col in Kanban.Columns)
|
|
|
|
- // col.IsExpanded = Kanbans.Where(x => col.Categories.Contains(x.Category.ToString())).Count() > 0;
|
|
|
|
-
|
|
|
|
- //bResizeRequired = true;
|
|
|
|
|
|
|
|
- //Kanban.ItemsSource = null;
|
|
|
|
- //Kanban.ItemsSource = Kanbans;
|
|
|
|
-
|
|
|
|
- elapsed = DateTime.Now - now;
|
|
|
|
- Logger.Send(LogType.Information, ClientFactory.UserID, string.Format("Loaded Columns in {0}ms", elapsed.TotalMilliseconds));
|
|
|
|
|
|
+ Logger.Send(LogType.Information, ClientFactory.UserID, string.Format("Loaded Columns in {0}ms", profiler.Restart()));
|
|
}
|
|
}
|
|
|
|
|
|
private Filter<ManufacturingPacket> GenerateFilter()
|
|
private Filter<ManufacturingPacket> GenerateFilter()
|
|
@@ -922,8 +658,8 @@ namespace PRSDesktop
|
|
|
|
|
|
var sctflt = new Filter<ManufacturingPacket>(x => x.StageLink).NotLinkValid();
|
|
var sctflt = new Filter<ManufacturingPacket>(x => x.StageLink).NotLinkValid();
|
|
|
|
|
|
- foreach (var Section in Sections.Where(x => CurrentFactory.Equals(Guid.Empty) || x.Factory.ID.Equals(CurrentFactory)))
|
|
|
|
- sctflt = sctflt.Or(x => x.StageLink.SectionID).IsEqualTo(Section.ID);
|
|
|
|
|
|
+ foreach (var section in Data.Sections.Where(x => CurrentFactory.Equals(Guid.Empty) || x.Factory.ID.Equals(CurrentFactory)))
|
|
|
|
+ sctflt = sctflt.Or(x => x.StageLink.SectionID).IsEqualTo(section.ID);
|
|
filter.Ands.Add(sctflt);
|
|
filter.Ands.Add(sctflt);
|
|
|
|
|
|
if (CurrentFactory != Guid.Empty)
|
|
if (CurrentFactory != Guid.Empty)
|
|
@@ -1007,71 +743,54 @@ namespace PRSDesktop
|
|
|
|
|
|
private void Factories_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
|
private void Factories_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
|
{
|
|
{
|
|
- if (e.AddedItems.Count == 0)
|
|
|
|
|
|
+ if (e.AddedItems.Count == 0 || e.AddedItems[0] is not Tuple<string, BitmapImage, Guid> selected)
|
|
return;
|
|
return;
|
|
|
|
|
|
- var selected = (Tuple<string, BitmapImage, Guid>)e.AddedItems[0];
|
|
|
|
CurrentFactory = selected.Item3;
|
|
CurrentFactory = selected.Item3;
|
|
|
|
|
|
-
|
|
|
|
if (IsReady)
|
|
if (IsReady)
|
|
SaveSettings();
|
|
SaveSettings();
|
|
|
|
|
|
- foreach (var column in _columns)
|
|
|
|
- column.ClearSelectedKanbans();
|
|
|
|
- //column.CheckedKanbans.Clear();
|
|
|
|
- //CheckedKanbans.Clear();
|
|
|
|
if (IsReady)
|
|
if (IsReady)
|
|
Refresh();
|
|
Refresh();
|
|
}
|
|
}
|
|
|
|
|
|
private void SortBy_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
|
private void SortBy_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
|
{
|
|
{
|
|
- if (e.AddedItems.Count == 0)
|
|
|
|
|
|
+ if (e.AddedItems.Count == 0 || e.AddedItems[0] is not ComboBoxItem selected)
|
|
return;
|
|
return;
|
|
|
|
|
|
- var selected = (ComboBoxItem)e.AddedItems[0];
|
|
|
|
SortByDueDate = selected.Content.Equals("Due Date");
|
|
SortByDueDate = selected.Content.Equals("Due Date");
|
|
|
|
|
|
-
|
|
|
|
if (IsReady)
|
|
if (IsReady)
|
|
SaveSettings();
|
|
SaveSettings();
|
|
|
|
|
|
- foreach (var column in _columns)
|
|
|
|
- column.ClearSelectedKanbans();
|
|
|
|
- //column.CheckedKanbans.Clear();
|
|
|
|
- //CheckedKanbans.Clear();
|
|
|
|
if (IsReady)
|
|
if (IsReady)
|
|
Refresh();
|
|
Refresh();
|
|
}
|
|
}
|
|
|
|
|
|
private void View_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
|
private void View_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
|
{
|
|
{
|
|
- if (e.AddedItems.Count == 0)
|
|
|
|
|
|
+ if (e.AddedItems.Count == 0 || e.AddedItems[0] is not ComboBoxItem selected)
|
|
return;
|
|
return;
|
|
|
|
|
|
- var selected = (ComboBoxItem)e.AddedItems[0];
|
|
|
|
- CompactView = selected.Content.Equals("Compact");
|
|
|
|
- ConsolidatedView = selected.Content.Equals("Consolidated");
|
|
|
|
|
|
+ ViewType = (ManufacturingViewType)View.SelectedIndex;
|
|
|
|
|
|
if (IsReady)
|
|
if (IsReady)
|
|
SaveSettings();
|
|
SaveSettings();
|
|
|
|
|
|
- foreach (var column in _columns)
|
|
|
|
- column.ClearSelectedKanbans();
|
|
|
|
- //column.CheckedKanbans.Clear();
|
|
|
|
- //CheckedKanbans.Clear();
|
|
|
|
|
|
+ if (ViewType == ManufacturingViewType.Job && SelectedJob != CoreUtils.FullGuid)
|
|
|
|
+ {
|
|
|
|
+ SelectedJob = CoreUtils.FullGuid;
|
|
|
|
+ JobChanging = true;
|
|
|
|
+ Job.SelectedValue = SelectedJob;
|
|
|
|
+ JobChanging = false;
|
|
|
|
+ }
|
|
|
|
|
|
if (IsReady)
|
|
if (IsReady)
|
|
Refresh();
|
|
Refresh();
|
|
}
|
|
}
|
|
|
|
|
|
- private ManufacturingPacket[] GetSelectedPackets(string currentid)
|
|
|
|
- {
|
|
|
|
- var rows = packets.Rows.Where(r => r.Get<ManufacturingPacket, Guid>(c => c.ID).Equals(Guid.Parse(currentid)));
|
|
|
|
- return rows.Select(r => r.ToObject<ManufacturingPacket>()).ToArray();
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
private void SearchBox_KeyUp(object sender, KeyEventArgs e)
|
|
private void SearchBox_KeyUp(object sender, KeyEventArgs e)
|
|
{
|
|
{
|
|
if (string.IsNullOrWhiteSpace(SearchBox.Text) || e.Key == Key.Return)
|
|
if (string.IsNullOrWhiteSpace(SearchBox.Text) || e.Key == Key.Return)
|
|
@@ -1114,8 +833,7 @@ namespace PRSDesktop
|
|
{
|
|
{
|
|
FactoryID = CurrentFactory,
|
|
FactoryID = CurrentFactory,
|
|
SortByDueDate = SortByDueDate,
|
|
SortByDueDate = SortByDueDate,
|
|
- CompactView = CompactView,
|
|
|
|
- ConsolidatedView = ConsolidatedView,
|
|
|
|
|
|
+ ViewType = ViewType,
|
|
IncludeHeld = bIncludeHeld,
|
|
IncludeHeld = bIncludeHeld,
|
|
IncludeOrders = bIncludeOrders,
|
|
IncludeOrders = bIncludeOrders,
|
|
IncludeCompleted = bIncludeCompleted
|
|
IncludeCompleted = bIncludeCompleted
|
|
@@ -1125,7 +843,7 @@ namespace PRSDesktop
|
|
|
|
|
|
private void Export_Click(object sender, RoutedEventArgs e)
|
|
private void Export_Click(object sender, RoutedEventArgs e)
|
|
{
|
|
{
|
|
- IEnumerable<string> columns = string.IsNullOrWhiteSpace(settings.ExportColumns) ? new string[] { } : settings.ExportColumns.Split(',');
|
|
|
|
|
|
+ IEnumerable<string> columns = string.IsNullOrWhiteSpace(settings.ExportColumns) ? Array.Empty<string>() : settings.ExportColumns.Split(',');
|
|
if (!columns.Any())
|
|
if (!columns.Any())
|
|
columns = packets.Columns.Select(x => x.ColumnName);
|
|
columns = packets.Columns.Select(x => x.ColumnName);
|
|
|
|
|