|
@@ -1,4 +1,5 @@
|
|
|
using Comal.Classes;
|
|
|
+using Comal.Classes;
|
|
|
using InABox.Core;
|
|
|
using System;
|
|
|
using System.Collections.Generic;
|
|
@@ -217,7 +218,20 @@ public class Module
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- private StagingSetoutDocument? Document { get; set; }
|
|
|
+ private StagingSetoutDocument? _document;
|
|
|
+
|
|
|
+ private StagingSetoutDocument? Document
|
|
|
+ {
|
|
|
+ get => _document;
|
|
|
+ set
|
|
|
+ {
|
|
|
+ _document = value;
|
|
|
+ if(_document is not null)
|
|
|
+ {
|
|
|
+ ApproveButton.Content = _document.Approved ? "Unapprove" : "Approve";
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
private byte[]? _documentdata = null;
|
|
|
|
|
@@ -277,7 +291,14 @@ public class Module
|
|
|
Progress.Close();
|
|
|
return;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
+ if (selectedSetouts.Any(x => x.JobLink.ID == Guid.Empty))
|
|
|
+ {
|
|
|
+ MessageBox.Show("Cannot process setout without a linked job.");
|
|
|
+ Progress.Close();
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
if (ManufacturingPacketList.Packets.Any(x => x.Template.ID == Guid.Empty))
|
|
|
{
|
|
|
MessageBox.Show("Cannot process manufacturing packets without templates.");
|
|
@@ -575,6 +596,7 @@ public class Module
|
|
|
selectedSetout = null;
|
|
|
|
|
|
ClearDocuments();
|
|
|
+ refreshing = true;
|
|
|
stagingSetoutGrid.Refresh(false, true);
|
|
|
}
|
|
|
else
|
|
@@ -627,6 +649,7 @@ public class Module
|
|
|
}
|
|
|
Document.Approved = !Document.Approved;
|
|
|
new Client<StagingSetoutDocument>().Save(Document, "");
|
|
|
+ refreshing = true;
|
|
|
stagingSetoutGrid.Refresh(false, true);
|
|
|
}
|
|
|
|
|
@@ -665,6 +688,7 @@ public class Module
|
|
|
|
|
|
p.Start();
|
|
|
}
|
|
|
+ refreshing = true;
|
|
|
stagingSetoutGrid.Refresh(false, true);
|
|
|
}
|
|
|
private void OnMarkupComplete()
|
|
@@ -675,19 +699,27 @@ public class Module
|
|
|
return;
|
|
|
}
|
|
|
StagingSetoutGrid.ReloadFile(selectedSetout);
|
|
|
+ refreshing = true;
|
|
|
stagingSetoutGrid.Refresh(false, true);
|
|
|
}
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
+ private bool refreshing = false;
|
|
|
+
|
|
|
+ private void stagingSetoutGrid_AfterRefresh(object sender, AfterRefreshEventArgs args)
|
|
|
+ {
|
|
|
+ refreshing = false;
|
|
|
+ }
|
|
|
+
|
|
|
private void StagingSetoutGrid_OnSelectItem(object sender, InABox.DynamicGrid.DynamicGridSelectionEventArgs e)
|
|
|
{
|
|
|
var newSetouts = new List<StagingSetout>();
|
|
|
foreach (var row in e.Rows ?? Enumerable.Empty<CoreRow>())
|
|
|
newSetouts.Add(row.ToObject<StagingSetout>());
|
|
|
|
|
|
- if(selectedSetouts.Count == newSetouts.Count
|
|
|
- && !selectedSetouts.Any(x => !newSetouts.Any(y => x.ID == y.ID)))
|
|
|
+ if(!refreshing && (selectedSetouts.Count == newSetouts.Count
|
|
|
+ && !selectedSetouts.Any(x => !newSetouts.Any(y => x.ID == y.ID))))
|
|
|
{
|
|
|
return;
|
|
|
}
|
|
@@ -743,7 +775,6 @@ public class Module
|
|
|
docTask.Wait();
|
|
|
RenderDocuments(docTask.Result);
|
|
|
|
|
|
- ApproveButton.Content = Document!.Approved ? "Unapprove" : "Approve";
|
|
|
SetMode(mode);
|
|
|
}
|
|
|
|
|
@@ -858,7 +889,7 @@ public class Module
|
|
|
public void Refresh()
|
|
|
{
|
|
|
//stagingSetoutGrid.ScanFiles(_settings.SetoutsFolder);
|
|
|
- stagingSetoutGrid.SelectedRows = Array.Empty<CoreRow>();
|
|
|
+ refreshing = true;
|
|
|
stagingSetoutGrid.Refresh(false, true);
|
|
|
/*Document = null;
|
|
|
|
|
@@ -1184,6 +1215,5 @@ public class Module
|
|
|
MessageBox.Show($"Error opening {componentFileName}: {e.Message}");
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
}
|