|
@@ -140,6 +140,7 @@ public class Module
|
|
|
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;
|
|
|
+ ProcessButton.Visibility = Security.IsAllowed<CanApproveSetouts>() ? Visibility.Visible : Visibility.Hidden;
|
|
|
|
|
|
//stagingSetoutGrid.ScanFiles(_settings.SetoutsFolder);
|
|
|
stagingSetoutGrid.Refresh(true, true);
|
|
@@ -172,23 +173,26 @@ public class Module
|
|
|
if (_mode == DocumentMode.Markup)
|
|
|
{
|
|
|
MarkUpButton.Content = "Mark Up";
|
|
|
- MarkUpButton.IsEnabled = Document != null;
|
|
|
+ MarkUpButton.IsEnabled = Document != null && !Document.Approved;
|
|
|
+ ProcessButton.IsEnabled = Document != null && Document.Approved;
|
|
|
+ RejectButton.IsEnabled = Document != null && !Document.Approved;
|
|
|
ApproveButton.IsEnabled = Document != null;
|
|
|
- RejectButton.IsEnabled = Document != null;
|
|
|
}
|
|
|
else if (_mode == DocumentMode.Complete)
|
|
|
{
|
|
|
MarkUpButton.Content = "Complete";
|
|
|
MarkUpButton.IsEnabled = Document != null;
|
|
|
- ApproveButton.IsEnabled = false;
|
|
|
+ ProcessButton.IsEnabled = false;
|
|
|
RejectButton.IsEnabled = false;
|
|
|
+ ApproveButton.IsEnabled = false;
|
|
|
}
|
|
|
else if (_mode == DocumentMode.Locked)
|
|
|
{
|
|
|
MarkUpButton.Content = "Locked";
|
|
|
MarkUpButton.IsEnabled = false;
|
|
|
- ApproveButton.IsEnabled = false;
|
|
|
+ ProcessButton.IsEnabled = false;
|
|
|
RejectButton.IsEnabled = false;
|
|
|
+ ApproveButton.IsEnabled = false;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -233,7 +237,7 @@ public class Module
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- private void ApproveButton_Click(object sender, RoutedEventArgs e)
|
|
|
+ private void ProcessButton_Click(object sender, RoutedEventArgs e)
|
|
|
{
|
|
|
bool bulkApprove = false;
|
|
|
if (selectedSetouts.Count > 1)
|
|
@@ -244,6 +248,20 @@ public class Module
|
|
|
Progress.Show("Approving Setouts..");
|
|
|
}
|
|
|
}
|
|
|
+ if(selectedSetouts.Any(x => x.UnapprovedDocuments > 0))
|
|
|
+ {
|
|
|
+ MessageBox.Show("Cannot process setouts with unapproved documents.");
|
|
|
+ Progress.Close();
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ else if(selectedSetouts.Any(x => x.Packets == 0))
|
|
|
+ {
|
|
|
+ if(MessageBox.Show("Warning: some setouts do not have any manufacturing packets: are you sure you wish to proceed?", "Warning", MessageBoxButton.YesNoCancel) != MessageBoxResult.Yes)
|
|
|
+ {
|
|
|
+ Progress.Close();
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
string message = "Result: " + Environment.NewLine;
|
|
|
|
|
@@ -372,7 +390,20 @@ public class Module
|
|
|
}
|
|
|
|
|
|
var packets = new List<Tuple<ManufacturingPacket, StagingManufacturingPacket>>();
|
|
|
- foreach(var stagingPacket in ManufacturingPacketList.GetPackets())
|
|
|
+ var stagingPackets = new Client<StagingManufacturingPacket>()
|
|
|
+ .Query(
|
|
|
+ new Filter<StagingManufacturingPacket>(x => x.StagingSetout.ID).IsEqualTo(item.ID),
|
|
|
+ new Columns<StagingManufacturingPacket>(x => x.ID)
|
|
|
+ .Add(x => x.Serial)
|
|
|
+ .Add(x => x.Title)
|
|
|
+ .Add(x => x.Quantity)
|
|
|
+ .Add(x => x.BarcodeQuantity)
|
|
|
+ .Add(x => x.Watermark.ID)
|
|
|
+ .Add(x => x.Location)
|
|
|
+ .Add(x => x.ITP.ID)
|
|
|
+ .Add(x => x.Job.ID)
|
|
|
+ .Add(x => x.Template.ID));
|
|
|
+ foreach(var stagingPacket in stagingPackets.ToObjects<StagingManufacturingPacket>())
|
|
|
{
|
|
|
if(stagingPacket.ManufacturingPacket.ID != Guid.Empty)
|
|
|
{
|
|
@@ -491,6 +522,18 @@ public class Module
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ private void ApproveButton_Click(object sender, RoutedEventArgs e)
|
|
|
+ {
|
|
|
+ if (Document is null || selectedSetout is null)
|
|
|
+ {
|
|
|
+ MessageBox.Show("Please select a setout first.");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ Document.Approved = !Document.Approved;
|
|
|
+ new Client<StagingSetoutDocument>().Save(Document, "");
|
|
|
+ stagingSetoutGrid.Refresh(false, true);
|
|
|
+ }
|
|
|
+
|
|
|
private void OnMarkupSelected()
|
|
|
{
|
|
|
if (Document is null || selectedSetout is null)
|
|
@@ -561,12 +604,14 @@ public class Module
|
|
|
var doc = new Client<StagingSetoutDocument>()
|
|
|
.Query(
|
|
|
new Filter<StagingSetoutDocument>(x => x.EntityLink.ID).IsEqualTo(selectedSetout.ID),
|
|
|
- new Columns<StagingSetoutDocument>(x => x.ID, x => x.DocumentLink.ID, x => x.DocumentLink.FileName))
|
|
|
+ new Columns<StagingSetoutDocument>(x => x.ID, x => x.DocumentLink.ID, x => x.DocumentLink.FileName, x => x.Approved))
|
|
|
.ToObjects<StagingSetoutDocument>().FirstOrDefault();
|
|
|
if(doc is null)
|
|
|
{
|
|
|
MessageBox.Show("No document found for this setout.");
|
|
|
Document = null;
|
|
|
+ ManufacturingPacketList.Setout = null;
|
|
|
+ CollapsePacketsButton.IsEnabled = false;
|
|
|
return;
|
|
|
}
|
|
|
|
|
@@ -582,6 +627,7 @@ public class Module
|
|
|
selectedSetout.LockedBy.ID == App.EmployeeID ?
|
|
|
DocumentMode.Complete :
|
|
|
DocumentMode.Locked;
|
|
|
+ ApproveButton.Content = Document.Approved ? "Unapprove" : "Approve";
|
|
|
}
|
|
|
|
|
|
public bool IsReady { get; set; }
|
|
@@ -682,6 +728,7 @@ public class Module
|
|
|
private void AddPacketButton_Click(object sender, RoutedEventArgs e)
|
|
|
{
|
|
|
ManufacturingPacketList.Add();
|
|
|
+ stagingSetoutGrid.Refresh(false, true);
|
|
|
}
|
|
|
|
|
|
private void CollapsePacketsButton_Click(object sender, RoutedEventArgs e)
|