|
@@ -49,6 +49,21 @@ namespace PRSDesktop
|
|
|
}
|
|
|
private void DocumentPreviewer_OnApproved(IEntityDocument stagingsetoutdocument)
|
|
|
{
|
|
|
+ if (_item.Group.ID == Guid.Empty)
|
|
|
+ {
|
|
|
+ var message = "Setout has no group assigned";
|
|
|
+ if (Security.IsAllowed<CanApproveSetoutsWithoutGroup>())
|
|
|
+ {
|
|
|
+ if (MessageBox.Show(message + ", continue?", "Continue?", MessageBoxButton.OKCancel) != MessageBoxResult.OK)
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ MessageBox.Show(message + ", please assign a group!");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
var table = new Client<Setout>().Query(new Filter<Setout>(x => x.Number).IsEqualTo(_item.Number),
|
|
|
new Columns<Setout>(x => x.ID));
|
|
|
|
|
@@ -61,6 +76,8 @@ namespace PRSDesktop
|
|
|
|
|
|
setout = table.Rows.FirstOrDefault().ToObject<Setout>();
|
|
|
|
|
|
+ setout.Group.ID = _item.Group.ID;
|
|
|
+
|
|
|
_item.Setout.ID = setout.ID;
|
|
|
|
|
|
var setoutdoc = new SetoutDocument();
|
|
@@ -83,6 +100,7 @@ namespace PRSDesktop
|
|
|
}
|
|
|
}
|
|
|
new Client<SetoutDocument>().Save(setoutdocs, "Updated from Staging Screen");
|
|
|
+ new Client<Setout>().Save(setout, "Updated from Staging Screen");
|
|
|
|
|
|
MessageBox.Show("Document for setout " + _item.Number + " superceded.", "Success");
|
|
|
|
|
@@ -92,12 +110,9 @@ namespace PRSDesktop
|
|
|
//no setout for this pdf - create new
|
|
|
else
|
|
|
{
|
|
|
- if (manufacturingControl.Data.Rows.Count == 0)
|
|
|
- if (MessageBox.Show("No Packets created for this setout. Continue?", "Proceed?", MessageBoxButton.YesNo) != MessageBoxResult.Yes)
|
|
|
- return;
|
|
|
-
|
|
|
setout.Number = _item.Number;
|
|
|
setout.JobLink.ID = _item.JobLink.ID;
|
|
|
+ setout.Group.ID = _item.Group.ID;
|
|
|
|
|
|
var editor = new DynamicDataGrid<Setout>();
|
|
|
editor.OnAfterSave += (editor, items) =>
|
|
@@ -122,7 +137,8 @@ namespace PRSDesktop
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- CreatePackets(setout);
|
|
|
+ //currently not creating packets due to temporary change in requirements - to uncomment and check for validity when required
|
|
|
+ //CreatePackets(setout);
|
|
|
}
|
|
|
|
|
|
private void CreatePackets(Setout setout)
|
|
@@ -193,7 +209,7 @@ namespace PRSDesktop
|
|
|
|
|
|
private void CreateComponents(Guid stagingPacketID, Guid packetID, Dictionary<StagingManufacturingPacketComponent, ManufacturingPacketComponent> stagingToActualComponents)
|
|
|
{
|
|
|
- var components = new List<ManufacturingPacketComponent>();
|
|
|
+ var components = new List<ManufacturingPacketComponent>();
|
|
|
CoreTable table = new Client<StagingManufacturingPacketComponent>().Query(
|
|
|
new Filter<StagingManufacturingPacketComponent>(x => x.StagingPacket.ID).IsEqualTo(stagingPacketID)
|
|
|
.And(x => x.ComponentID).IsEqualTo(Guid.Empty),
|
|
@@ -205,7 +221,7 @@ namespace PRSDesktop
|
|
|
x => x.Width
|
|
|
));
|
|
|
foreach (var row in table.Rows)
|
|
|
- {
|
|
|
+ {
|
|
|
var stagingComponent = row.ToObject<StagingManufacturingPacketComponent>();
|
|
|
var component = stagingComponent.CreateComponent(packetID);
|
|
|
components.Add(component);
|