|
@@ -100,17 +100,9 @@ namespace PRSDesktop
|
|
|
|
|
|
UpdateTemplateButton();
|
|
|
|
|
|
- StagesGrid.Refresh(true, false);
|
|
|
- ComponentGrid.Refresh(true, false);
|
|
|
- TreatmentGrid.Refresh(true, false);
|
|
|
-
|
|
|
- StagesGrid.InitialiseData(packet, results?.Get<StagingManufacturingPacketStage>());
|
|
|
- ComponentGrid.InitialiseData(packet, results?.Get<StagingManufacturingPacketComponent>());
|
|
|
- TreatmentGrid.InitialiseData(packet, results?.Get<StagingManufacturingPacketTreatment>());
|
|
|
-
|
|
|
- StagesGrid.Refresh(false, true);
|
|
|
- ComponentGrid.Refresh(false, true);
|
|
|
- TreatmentGrid.Refresh(false, true);
|
|
|
+ StagesGrid.Packet = packet;
|
|
|
+ ComponentGrid.Packet = packet;
|
|
|
+ TreatmentGrid.Packet = packet;
|
|
|
|
|
|
ITPCode.Text = Packet.ITP.Code;
|
|
|
ITPDescription.Text = Packet.ITP.Description;
|
|
@@ -123,11 +115,6 @@ namespace PRSDesktop
|
|
|
IsEditable = packet.ManufacturingPacket.ID == Guid.Empty;
|
|
|
}
|
|
|
|
|
|
- // TODO: This sucks
|
|
|
- private static StagingManufacturingPacketComponentGrid? componentColumnsGrid;
|
|
|
- private static StagingManufacturingPacketTreatmentGrid? treatmentColumnsGrid;
|
|
|
- private static StagingManufacturingPacketStageGrid? stageColumnsGrid;
|
|
|
-
|
|
|
public static IEnumerable<IKeyedQueryDef> GetQueries(StagingSetout setout)
|
|
|
{
|
|
|
var packetFilter = new Filter<StagingManufacturingPacket>(x => x.StagingSetout.ID).IsEqualTo(setout.ID);
|
|
@@ -152,27 +139,6 @@ namespace PRSDesktop
|
|
|
.Add(x => x.Template.ID)
|
|
|
.Add(x => x.Template.Code)
|
|
|
.Add(x => x.ManufacturingPacket.ID)));
|
|
|
-
|
|
|
- stageColumnsGrid ??= new StagingManufacturingPacketStageGrid();
|
|
|
- stageColumnsGrid.Refresh(true, false);
|
|
|
-
|
|
|
- yield return new KeyedQueryDef<StagingManufacturingPacketStage>(
|
|
|
- new Filter<StagingManufacturingPacketStage>(x => x.Packet.ID).InQuery(packetFilter, x => x.ID),
|
|
|
- DynamicGridUtils.LoadEditorColumns(stageColumnsGrid.DataColumns()));
|
|
|
-
|
|
|
- componentColumnsGrid ??= new StagingManufacturingPacketComponentGrid();
|
|
|
- componentColumnsGrid.Refresh(true, false);
|
|
|
-
|
|
|
- yield return new KeyedQueryDef<StagingManufacturingPacketComponent>(
|
|
|
- new Filter<StagingManufacturingPacketComponent>(x => x.Packet.ID).InQuery(packetFilter, x => x.ID),
|
|
|
- DynamicGridUtils.LoadEditorColumns(componentColumnsGrid.DataColumns()));
|
|
|
-
|
|
|
- treatmentColumnsGrid ??= new StagingManufacturingPacketTreatmentGrid();
|
|
|
- treatmentColumnsGrid.Refresh(true, false);
|
|
|
-
|
|
|
- yield return new KeyedQueryDef<StagingManufacturingPacketTreatment>(
|
|
|
- new Filter<StagingManufacturingPacketTreatment>(x => x.Packet.ID).InQuery(packetFilter, x => x.ID),
|
|
|
- DynamicGridUtils.LoadEditorColumns(treatmentColumnsGrid.DataColumns()));
|
|
|
}
|
|
|
|
|
|
private void EditButton_Click(object sender, RoutedEventArgs e)
|
|
@@ -437,8 +403,8 @@ namespace PRSDesktop
|
|
|
|
|
|
private bool ShowITPLookup()
|
|
|
{
|
|
|
- Dictionary<String, String>? code = null;
|
|
|
- if (!String.IsNullOrWhiteSpace(ITPCode.Text))
|
|
|
+ Dictionary<string, string>? code = null;
|
|
|
+ if (!string.IsNullOrWhiteSpace(ITPCode.Text))
|
|
|
code = new Dictionary<string, string>() { { "Code", Packet.ITP.Code } };
|
|
|
|
|
|
var itps = new PopupList(
|
|
@@ -450,7 +416,7 @@ namespace PRSDesktop
|
|
|
|
|
|
itps.OnDefineFilter += type => new Filter<JobITP>(x => x.Job.ID).IsEqualTo(Packet.Job.ID);
|
|
|
|
|
|
- bool result = (itps.ShowDialog() == true);
|
|
|
+ bool result = itps.ShowDialog() == true;
|
|
|
if (result)
|
|
|
{
|
|
|
Packet.ITP.ID = itps.ID;
|
|
@@ -465,7 +431,27 @@ namespace PRSDesktop
|
|
|
}
|
|
|
return result;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
+ private void DynamicTabControl_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
|
|
+ {
|
|
|
+ if (e.OriginalSource != TabControl
|
|
|
+ || TabControl?.SelectedItem is not DynamicTabItem tab)
|
|
|
+ return;
|
|
|
+
|
|
|
+ if (tab.Content == StagesGrid && !StagesGrid.IsReady)
|
|
|
+ {
|
|
|
+ StagesGrid.Refresh(true, true);
|
|
|
+ }
|
|
|
+ else if(tab.Content == ComponentGrid && !ComponentGrid.IsReady)
|
|
|
+ {
|
|
|
+ ComponentGrid.Refresh(true, true);
|
|
|
+ }
|
|
|
+ else if (tab.Content == TreatmentGrid && !TreatmentGrid.IsReady)
|
|
|
+ {
|
|
|
+ TreatmentGrid.Refresh(true, true);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
// private void LocationBox_TextChanged(object sender, TextChangedEventArgs e)
|
|
|
// {
|
|
|
// _locationChanged = true;
|