Skip to content

Commit 5cfce2c

Browse files
* finalize BOM editing
1 parent c08bef2 commit 5cfce2c

File tree

2 files changed

+155
-14
lines changed

2 files changed

+155
-14
lines changed

src/AasxPluginBomStructure/AasxPluginBomStructure.Options.json

+75-1
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,81 @@
219219
}
220220
],
221221
"NodeSupplSemIds": [
222-
""
222+
"http://admin-shell.io/sandbox/CompositeComponent/General/EntityOfBOM/1/0",
223+
"http://admin-shell.io/sandbox/CompositeComponent/General/FeatureOfEntity/1/0",
224+
"http://admin-shell.io/sandbox/CompositeComponent/Mechanical/EntityOfPhysicalBreakdown/1/0",
225+
"http://admin-shell.io/sandbox/CompositeComponent/Mechanical/EntityOfFunctionalBreakdown/1/0",
226+
"http://admin-shell.io/sandbox/CompositeComponent/Electrical/EntityOfElectricalEngineering/1/0",
227+
"http://admin-shell.io/sandbox/CompositeComponent/Electrical/Potential/1/0",
228+
"http://admin-shell.io/sandbox/CompositeComponent/Electrical/JunctionPoint/1/0",
229+
"http://admin-shell.io/sandbox/CompositeComponent/Electrical/PhysicalCable/1/0",
230+
"http://admin-shell.io/sandbox/CompositeComponent/Electrical/PhysicalWire/1/0",
231+
"http://admin-shell.io/sandbox/CompositeComponent/Fluidic/EntityOfFluidicEngineering/1/0",
232+
"http://admin-shell.io/sandbox/CompositeComponent/Fluidic/Potential/1/0",
233+
"http://admin-shell.io/sandbox/CompositeComponent/Fluidic/JunctionPoint/1/0",
234+
"http://admin-shell.io/sandbox/CompositeComponent/Fluidic/Tube/1/0",
235+
"http://admin-shell.io/sandbox/CompositeComponent/Fluidic/ConnectorTubePipe/1/0",
236+
"http://admin-shell.io/sandbox/CompositeComponent/PipeAndInstrumentation/EquipmentEntity/1/0",
237+
"http://admin-shell.io/sandbox/CompositeComponent/PipeAndInstrumentation/Valve/1/0",
238+
"http://admin-shell.io/sandbox/CompositeComponent/PipeAndInstrumentation/Sensor/1/0",
239+
"http://admin-shell.io/sandbox/CompositeComponent/PipeAndInstrumentation/Drive/1/0",
240+
"http://admin-shell.io/sandbox/CompositeComponent/PipeAndInstrumentation/PIDCtrl/1/0",
241+
"http://admin-shell.io/sandbox/CompositeComponent/PipeAndInstrumentation/TerminationSource/1/0",
242+
"http://admin-shell.io/sandbox/CompositeComponent/PipeAndInstrumentation/TerminationSink/1/0",
243+
"http://admin-shell.io/sandbox/CompositeComponent/PipeAndInstrumentation/EquipmentEntity/1/0",
244+
"http://admin-shell.io/sandbox/CompositeComponent/PipeAndInstrumentation/InstrumentationEntity/1/0",
245+
"http://admin-shell.io/sandbox/CompositeComponent/PipeAndInstrumentation/TerminationSource/1/0",
246+
"http://admin-shell.io/sandbox/CompositeComponent/PipeAndInstrumentation/TerminationSink/1/0",
247+
"http://admin-shell.io/sandbox/CompositeComponent/ProgrammableLogicControl/PouEntity/1/0",
248+
"http://admin-shell.io/sandbox/CompositeComponent/ProgrammableLogicControl/InstanceOfPou/1/0",
249+
"http://admin-shell.io/sandbox/CompositeComponent/ProgrammableLogicControl/PinOfInstance/1/0",
250+
"http://admin-shell.io/sandbox/CompositeComponent/ProgrammableLogicControl/InformationInput/1/0",
251+
"http://admin-shell.io/sandbox/CompositeComponent/ProgrammableLogicControl/InformationOutput/1/0"
252+
],
253+
"EdgeSupplSemIds": [
254+
"http://admin-shell.io/sandbox/CompositeComponent/General/FileToNavigateElement/1/0",
255+
"http://admin-shell.io/sandbox/CompositeComponent/General/FileToEntity/1/0",
256+
"http://admin-shell.io/sandbox/CompositeComponent/General/IsPartOfForBOM/1/0",
257+
"http://admin-shell.io/sandbox/CompositeComponent/General/IsIdenticalForBOM/1/0",
258+
"http://admin-shell.io/sandbox/CompositeComponent/Mechanical/IsPartOfPhysicalBreakdown/1/0",
259+
"http://admin-shell.io/sandbox/CompositeComponent/Mechanical/IsPartOfFunctionalBreakdown/1/0",
260+
"http://admin-shell.io/sandbox/CompositeComponent/Mechanical/FunctionalDirectlyConnected/1/0",
261+
"http://admin-shell.io/sandbox/CompositeComponent/Mechanical/PermanentJoint/1/0",
262+
"http://admin-shell.io/sandbox/CompositeComponent/Mechanical/DetachableJoint/1/0",
263+
"http://admin-shell.io/sandbox/CompositeComponent/Mechanical/PrismaticJoint/1/0",
264+
"http://admin-shell.io/sandbox/CompositeComponent/Mechanical/RevoluteJoint/1/0",
265+
"http://admin-shell.io/sandbox/CompositeComponent/Mechanical/CylindricalJoint/1/0",
266+
"http://admin-shell.io/sandbox/CompositeComponent/Mechanical/ShericalJoint/1/0",
267+
"http://admin-shell.io/sandbox/CompositeComponent/Electrical/IsPartOfCable/1/0",
268+
"http://admin-shell.io/sandbox/CompositeComponent/Electrical/SinglePoleConnection/1/0",
269+
"http://admin-shell.io/sandbox/CompositeComponent/Electrical/MultiPoleConnection/1/0",
270+
"http://admin-shell.io/sandbox/CompositeComponent/Electrical/BusConnection/1/0",
271+
"http://admin-shell.io/sandbox/CompositeComponent/Electrical/ConnectionOfPotential/1/0",
272+
"http://admin-shell.io/sandbox/CompositeComponent/Electrical/TerminalConnection/1/0",
273+
"http://admin-shell.io/sandbox/CompositeComponent/Fluidic/TubePipeConnection/1/0",
274+
"http://admin-shell.io/sandbox/CompositeComponent/Fluidic/TubePipeConnectionPneumatic/1/0",
275+
"http://admin-shell.io/sandbox/CompositeComponent/Fluidic/TubePipeConnectionHydraulic/1/0",
276+
"http://admin-shell.io/sandbox/CompositeComponent/Fluidic/FittingConnection/1/0",
277+
"http://admin-shell.io/sandbox/CompositeComponent/Fluidic/ManifoldConnection/1/0",
278+
"http://admin-shell.io/sandbox/CompositeComponent/PipeAndInstrumentation/PipeConnection/1/0",
279+
"http://admin-shell.io/sandbox/CompositeComponent/PipeAndInstrumentation/MeasurementLine/1/0",
280+
"http://admin-shell.io/sandbox/CompositeComponent/PipeAndInstrumentation/FunctionalLine/1/0",
281+
"http://admin-shell.io/sandbox/CompositeComponent/PipeAndInstrumentation/PipeConnection/1/0",
282+
"http://admin-shell.io/sandbox/CompositeComponent/PipeAndInstrumentation/ProcessConnectionLine/1/0",
283+
"http://admin-shell.io/sandbox/CompositeComponent/PipeAndInstrumentation/SignalLine/1/0",
284+
"http://admin-shell.io/sandbox/CompositeComponent/ProgrammableLogicControl/ParameterConnection/1/0",
285+
"http://admin-shell.io/sandbox/CompositeComponent/ProgrammableLogicControl/DataConnection/1/0",
286+
"http://admin-shell.io/sandbox/CompositeComponent/ProgrammableLogicControl/EventConnection/1/0",
287+
"http://admin-shell.io/sandbox/CompositeComponent/SoftwareEngineering/ClassEntity/1/0",
288+
"http://admin-shell.io/sandbox/CompositeComponent/SoftwareEngineering/ObjectEntity/1/0",
289+
"http://admin-shell.io/sandbox/CompositeComponent/SoftwareEngineering/ComponentEntity/1/0",
290+
"http://admin-shell.io/sandbox/CompositeComponent/SoftwareEngineering/ExecutionEnvironmentEntity/1/0",
291+
"http://admin-shell.io/sandbox/CompositeComponent/SoftwareEngineering/InheritanceRelationship/1/0",
292+
"http://admin-shell.io/sandbox/CompositeComponent/SoftwareEngineering/AggregateRelationship/1/0",
293+
"http://admin-shell.io/sandbox/CompositeComponent/SoftwareEngineering/ComposeRelationship/1/0",
294+
"http://admin-shell.io/sandbox/CompositeComponent/SoftwareEngineering/IsInstanceOfRelationship/1/0",
295+
"http://admin-shell.io/sandbox/CompositeComponent/SoftwareEngineering/IsInstanceOfRelationship/1/0",
296+
"http://admin-shell.io/sandbox/CompositeComponent/SoftwareEngineering/IsExecutedInRelationship/1/0"
223297
]
224298
}
225299
]

src/AasxPluginBomStructure/GenericBomControl.cs

+80-13
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,7 @@ public object FillWithWpfControls(
328328
dp.ContextMenu = new ContextMenu();
329329
dp.ContextMenu.Items.Add(new MenuItem() { Header = "Jump to selected ..", Tag = "JUMP" });
330330
dp.ContextMenu.Items.Add(new Separator());
331-
dp.ContextMenu.Items.Add(new MenuItem() { Header = "Edit Node ..", Tag = "EDIT" });
331+
dp.ContextMenu.Items.Add(new MenuItem() { Header = "Edit Node / Edge ..", Tag = "EDIT" });
332332
dp.ContextMenu.Items.Add(new MenuItem() { Header = "Create Node (to selected) ..", Tag = "CREATE" });
333333
dp.ContextMenu.Items.Add(new MenuItem() { Header = "Delete (selected) Node(s) ..", Tag = "DELETE" });
334334

@@ -507,6 +507,33 @@ protected void AdjustNodeInBom(
507507
});
508508
}
509509

510+
protected void AdjustEdgeInBom(
511+
Aas.ISubmodelElement edgeSme,
512+
string edgeIdShort,
513+
string edgeSemId,
514+
string edgeSuppSemId)
515+
{
516+
// access
517+
if (_submodel == null || edgeSme == null)
518+
return;
519+
520+
// write back new values
521+
edgeSme.IdShort = edgeIdShort;
522+
if (edgeSemId?.HasContent() == true)
523+
edgeSme.SemanticId = new Aas.Reference(Aas.ReferenceTypes.ExternalReference,
524+
(new Aas.IKey[] { new Aas.Key(Aas.KeyTypes.GlobalReference, edgeSemId) }).ToList());
525+
else
526+
edgeSme.SemanticId = null;
527+
528+
if (edgeSuppSemId?.HasContent() == true)
529+
edgeSme.SupplementalSemanticIds = (new Aas.IReference[] {
530+
new Aas.Reference(Aas.ReferenceTypes.ExternalReference,
531+
(new Aas.IKey[] { new Aas.Key(Aas.KeyTypes.GlobalReference, edgeSuppSemId) }).ToList())
532+
}).ToList();
533+
else
534+
edgeSme.SupplementalSemanticIds = null;
535+
}
536+
510537
#if cdscsd
511538
///// <summary>
512539
/////
@@ -609,12 +636,12 @@ protected void ContextMenu_Click(object sender, RoutedEventArgs e)
609636
if (action != "OK" || !(st.AasElem is Aas.ISubmodelElement nodeSme))
610637
return;
611638

612-
// modidfy
639+
// modify
613640
AdjustNodeInBom(
614641
nodeSme,
615642
nodeIdShort: st.TextBoxIdShort.Text,
616-
nodeSuppSemId: st.ComboBoxNodeSupplSemId.Text,
617-
nodeSemId: st.ComboBoxNodeSemId.Text);
643+
nodeSemId: st.ComboBoxNodeSemId.Text,
644+
nodeSuppSemId: st.ComboBoxNodeSupplSemId.Text);
618645

619646
// refresh
620647
SetNeedsFinalize(true);
@@ -629,7 +656,9 @@ protected void ContextMenu_Click(object sender, RoutedEventArgs e)
629656
&& edge.Edge?.UserData is Aas.ISubmodelElement edgeSme)
630657
{
631658
// create job
632-
var stat = new DialogueStatus() { Type = DialogueType.EditEdge, AasElem = edgeSme };
659+
var stat = new DialogueStatus() {
660+
Type = DialogueType.EditEdge, AasElem = edgeSme
661+
};
633662

634663
// set the action
635664
stat.Action = (st, action) =>
@@ -638,8 +667,12 @@ protected void ContextMenu_Click(object sender, RoutedEventArgs e)
638667
if (action != "OK" || !(st.AasElem is Aas.ISubmodelElement esme))
639668
return;
640669

641-
// modidfy
642-
esme.IdShort = st.TextBoxIdShort.Text;
670+
// modify
671+
AdjustEdgeInBom(
672+
esme,
673+
edgeIdShort: st.TextBoxIdShort.Text,
674+
edgeSemId: st.ComboBoxRelSemId.Text,
675+
edgeSuppSemId: st.ComboBoxRelSupplSemId.Text);
643676

644677
// refresh
645678
SetNeedsFinalize(true);
@@ -1263,7 +1296,7 @@ protected Panel CreateDialoguePanel(DialogueStatus stat)
12631296
Content = editEdge ? "Rel.idShort:" : "Node.idShort:"
12641297
});
12651298
AddToGrid(grid, 0, 1, colSpan:1, fe: stat.TextBoxIdShort = new TextBox() {
1266-
Text = editNode ? stat.AasElem?.IdShort : "",
1299+
Text = (editNode || editEdge) ? stat.AasElem?.IdShort : "",
12671300
VerticalContentAlignment = VerticalAlignment.Center,
12681301
Padding = new Thickness(0, -1, 0, -1),
12691302
Margin = new Thickness(0, 2, 0, 2),
@@ -1294,7 +1327,8 @@ protected Panel CreateDialoguePanel(DialogueStatus stat)
12941327
}
12951328
else
12961329
{
1297-
stat.ComboBoxNodeSemId.Text = "" + (stat.AasElem as Aas.IHasSemantics).SemanticId.Keys?.FirstOrDefault()?.Value;
1330+
stat.ComboBoxNodeSemId.Text = "" + (stat.AasElem as Aas.IHasSemantics).
1331+
SemanticId.Keys?.FirstOrDefault()?.Value;
12981332
}
12991333

13001334
AddToGrid(grid, 1, 1, colSpan: 3, fe: stat.ComboBoxNodeSemId);
@@ -1309,6 +1343,13 @@ protected Panel CreateDialoguePanel(DialogueStatus stat)
13091343
VerticalContentAlignment = VerticalAlignment.Center
13101344
};
13111345

1346+
if (_bomRecords != null)
1347+
foreach (var br in _bomRecords)
1348+
if (br.NodeSupplSemIds != null)
1349+
foreach (var nss in br.NodeSupplSemIds)
1350+
if (!stat.ComboBoxNodeSupplSemId.Items.Contains(nss))
1351+
stat.ComboBoxNodeSupplSemId.Items.Add(nss);
1352+
13121353
if (!editNode)
13131354
{
13141355
stat.ComboBoxNodeSupplSemId.Text = "";
@@ -1338,10 +1379,18 @@ protected Panel CreateDialoguePanel(DialogueStatus stat)
13381379

13391380
stat.ComboBoxRelSemId.Items.Add(prefHS.CD_HasPart?.GetSingleKey()?.Value);
13401381
stat.ComboBoxRelSemId.Items.Add(prefHS.CD_IsPartOf?.GetSingleKey()?.Value);
1341-
if (stat.ReverseDir)
1342-
stat.ComboBoxRelSemId.Text = stat.ComboBoxRelSemId.Items[1].ToString();
1343-
else
1344-
stat.ComboBoxRelSemId.Text = stat.ComboBoxRelSemId.Items[0].ToString();
1382+
1383+
if (!editEdge)
1384+
{
1385+
if (stat.ReverseDir)
1386+
stat.ComboBoxRelSemId.Text = stat.ComboBoxRelSemId.Items[1].ToString();
1387+
else
1388+
stat.ComboBoxRelSemId.Text = stat.ComboBoxRelSemId.Items[0].ToString();
1389+
} else
1390+
{
1391+
stat.ComboBoxRelSemId.Text = "" + (stat.AasElem as Aas.IHasSemantics)
1392+
.SemanticId.Keys?.FirstOrDefault()?.Value;
1393+
}
13451394

13461395
AddToGrid(grid, 3, 1, colSpan: 3, fe: stat.ComboBoxRelSemId);
13471396

@@ -1355,6 +1404,24 @@ protected Panel CreateDialoguePanel(DialogueStatus stat)
13551404
VerticalContentAlignment = VerticalAlignment.Center
13561405
};
13571406

1407+
if (_bomRecords != null)
1408+
foreach (var br in _bomRecords)
1409+
if (br.EdgeSupplSemIds != null)
1410+
foreach (var nss in br.EdgeSupplSemIds)
1411+
if (!stat.ComboBoxRelSupplSemId.Items.Contains(nss))
1412+
stat.ComboBoxRelSupplSemId.Items.Add(nss);
1413+
1414+
if (!editEdge)
1415+
{
1416+
stat.ComboBoxRelSupplSemId.Text = "";
1417+
}
1418+
else
1419+
{
1420+
stat.ComboBoxRelSupplSemId.Text =
1421+
"" + (stat.AasElem as Aas.IHasSemantics)?.SupplementalSemanticIds?
1422+
.FirstOrDefault()?.Keys?.FirstOrDefault()?.Value;
1423+
}
1424+
13581425
AddToGrid(grid, 4, 1, colSpan: 3, fe: stat.ComboBoxRelSupplSemId);
13591426
}
13601427

0 commit comments

Comments
 (0)