Skip to content
This repository was archived by the owner on Mar 25, 2025. It is now read-only.

Commit 20a4320

Browse files
[BUG]Inspectors bugs (#755)
* Create draft PR for #754 * ****TcoInspectors***** +HideButtons(Retry,Terminate,Overide) +RetryThenTerminate +Evaluate method - cover all scenarios during inspecting (CarryOn,Retry,Terminate,RetryThenTerminate.... can be set as parameter) *presenter in expanded view of inspectors data --------- Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: peterbarancek <[email protected]>
1 parent 0d4d935 commit 20a4320

File tree

15 files changed

+1161
-352
lines changed

15 files changed

+1161
-352
lines changed

src/TcoInspectors/src/Wpf/TcOpen.Inxton.TcoInspectors.Wpf/Abstractions/GenericTcoInspectorDataView.xaml

+5-5
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
mc:Ignorable="d"
1010
d:DesignHeight="450" d:DesignWidth="800">
1111
<d:UserControl.DataContext>
12-
<tcoinspectors:TcoInspectorData></tcoinspectors:TcoInspectorData>
12+
<tcoinspectors:TcoInspectorData></tcoinspectors:TcoInspectorData>
1313
</d:UserControl.DataContext>
1414
<materialDesign:Card
1515
Margin="100,5,10,10"
@@ -43,19 +43,19 @@
4343
DataContext="{Binding ErrorCode}"
4444
PresentationType="{Binding PresentationType, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type local:GenericTcoInspectorDataView}}}" />
4545
</StackPanel>
46-
<StackPanel Grid.Column="1" Grid.IsSharedSizeScope="True">
46+
<StackPanel Grid.Column="1" Grid.IsSharedSizeScope="True" IsEnabled="False">
4747
<controls:RenderableContentControl
4848
Margin="5"
4949
DataContext="{Binding TimeStamp}"
50-
PresentationType="Display" />
50+
PresentationType="{Binding PresentationType, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type local:GenericTcoInspectorDataView}}}" />
5151
<controls:RenderableContentControl
5252
Margin="5"
5353
DataContext="{Binding RetryAttemptsCount}"
54-
PresentationType="Display" />
54+
PresentationType="{Binding PresentationType, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type local:GenericTcoInspectorDataView}}}" />
5555
<controls:RenderableContentControl
5656
Margin="5"
5757
DataContext="{Binding Result}"
58-
PresentationType="Display" />
58+
PresentationType="{Binding PresentationType, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type local:GenericTcoInspectorDataView}}}" />
5959
</StackPanel>
6060
</Grid>
6161
</materialDesign:Card>

src/TcoInspectors/src/Wpf/TcOpen.Inxton.TcoInspectors.Wpf/Abstractions/InspectorDialogue/TcoInspectorDialogDialogView.xaml

+9-4
Original file line numberDiff line numberDiff line change
@@ -127,11 +127,16 @@
127127
<Setter Property="Margin" Value="10" />
128128
</Style>
129129
</WrapPanel.Resources>
130-
<Button Command="{Binding RetryCommand, Mode=OneWay}" Content="{x:Static s:strings.Retry}" />
131-
<Button Command="{Binding TerminateCommand, Mode=OneWay}" Content="{x:Static s:strings.Terminate}" />
132-
<vortexs:PermissionBox Permissions="can_override_inspection">
133-
<Button Command="{Binding OverrideCommand, Mode=OneWay}" Content="{x:Static s:strings.Override}" />
130+
131+
<Button Visibility="{Binding Dialog._hideRetryButton.Cyclic,Converter={vortex:BooleanToVisibilityConverter},ConverterParameter=true}" Command="{Binding RetryCommand, Mode=OneWay}" Content="{x:Static s:strings.Retry}" />
132+
<vortexs:PermissionBox Permissions="can_terminate_inspection">
133+
<Button Visibility="{Binding Dialog._hideTerminateButton.Cyclic,Converter={vortex:BooleanToVisibilityConverter},ConverterParameter=true}" Command="{Binding TerminateCommand, Mode=OneWay}" Content="{x:Static s:strings.Terminate}" />
134134
</vortexs:PermissionBox>
135+
<WrapPanel Visibility="{Binding Dialog._hideOverideButton.Cyclic,Converter={vortex:BooleanToVisibilityConverter},ConverterParameter=true}">
136+
<vortexs:PermissionBox Permissions="can_override_inspection">
137+
<Button Command="{Binding OverrideCommand, Mode=OneWay}" Content="{x:Static s:strings.Override}" />
138+
</vortexs:PermissionBox>
139+
</WrapPanel>
135140
</WrapPanel>
136141
<Expander
137142
Grid.Row="4"

src/TcoInspectors/src/Wpf/TcOpen.Inxton.TcoInspectors.Wpf/TcoDataInspector/Online/TcoDataInspectorControlView.xaml

+5-5
Original file line numberDiff line numberDiff line change
@@ -41,23 +41,23 @@
4141
TextWrapping="WrapWithOverflow" />
4242
<WrapPanel Grid.Column="2">
4343
<controls:RenderableContentControl
44-
Grid.Column="1"
44+
Margin="10,0"
4545
DataContext="{Binding _data.RequiredStatus}"
4646
PresentationType="ControlSlim" />
4747
<controls:RenderableContentControl
48-
Grid.Column="2"
48+
Margin="10,0"
4949
DataContext="{Binding _data.DetectedStatus}"
5050
PresentationType="ControlSlim" />
5151
<controls:RenderableContentControl
52-
Grid.Column="3"
52+
Margin="10,0"
5353
DataContext="{Binding _data.StarNotationEnabled}"
5454
PresentationType="ControlSlim" />
5555
<controls:RenderableContentControl
56-
Grid.Column="4"
56+
Margin="10,0"
5757
DataContext="{Binding _data.IsByPassed}"
5858
PresentationType="ControlSlim" />
5959
<controls:RenderableContentControl
60-
Grid.Column="5"
60+
Margin="10,0"
6161
DataContext="{Binding _data.IsExcluded}"
6262
PresentationType="ControlSlim" />
6363
</WrapPanel>

src/TcoInspectors/src/XAE/XAE/TcoInspectors/POUs/TcoInspectionGroup/TcoInspectionGroup.TcPOU

+118
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,92 @@ END_VAR
203203
</Implementation>
204204
</Get>
205205
</Property>
206+
<Method Name="Evaluate" Id="{ec0c8dd4-dd5c-0319-2bb9-6b847f04a479}" FolderPath="OnFail\">
207+
<Declaration><![CDATA[(*~
208+
<docu>
209+
<summary>
210+
Upon failure the inspection retries given number of time. When it reach given numbers then terminate
211+
</summary>
212+
</docu>
213+
~*)
214+
215+
{attribute 'hide'}
216+
{attribute 'obsolete' := 'You should access `Evaluate` method via `OnFail()` method.'}
217+
METHOD PUBLIC Evaluate : BOOL
218+
VAR_INPUT
219+
(*~
220+
<docu>
221+
<summary>
222+
State from which the inspection will restart.
223+
</summary>
224+
</docu>
225+
~*)
226+
inFromState : INT;
227+
(*~
228+
<docu>
229+
<summary>
230+
Behavior when ispection is failed
231+
</summary>
232+
</docu>
233+
~*)
234+
inFailMode : eTcoInspectorFailMode;
235+
(*~
236+
<docu>
237+
<summary>
238+
State from which the inspection will continue.
239+
</summary>
240+
</docu>
241+
~*)
242+
inToState : INT;
243+
END_VAR
244+
]]></Declaration>
245+
<Implementation>
246+
<ST><![CDATA[IF (_coordinator = 0) THEN
247+
RETURN;
248+
END_IF
249+
250+
IF (THIS^.Done) THEN
251+
IF (THIS^._currentRunResult.Result = eOverallResult.Failed) THEN
252+
IF (__ISVALIDREF(_refOverallResult)) THEN
253+
_refOverallResult := _originalOverallResult;
254+
END_IF
255+
256+
IF inFailMode = eTcoInspectorFailMode.CarryOn THEN
257+
_coordinator.MoveNext();
258+
ELSIF inFailMode = eTcoInspectorFailMode.JumpTo THEN
259+
_coordinator.Retry(inToState);
260+
ELSIF inFailMode = eTcoInspectorFailMode.Terminate THEN
261+
_coordinator.Terminate();
262+
ELSIF inFailMode = eTcoInspectorFailMode.RetryThenCarryOn THEN
263+
IF OverInspected THEN
264+
_coordinator.MoveNext();
265+
ELSE
266+
_coordinator.Retry(inFromState);
267+
END_IF;
268+
ELSIF inFailMode = eTcoInspectorFailMode.RetryThenJumpTo THEN
269+
IF OverInspected THEN
270+
_coordinator.Retry(inToState);
271+
ELSE
272+
_coordinator.Retry(inFromState);
273+
END_IF;
274+
275+
ELSIF inFailMode = eTcoInspectorFailMode.RetryThenTeminate THEN
276+
IF OverInspected THEN
277+
_coordinator.Terminate();
278+
ELSE
279+
_coordinator.Retry(inFromState);
280+
END_IF;
281+
282+
END_IF
283+
ELSE
284+
285+
_coordinator.MoveNext();
286+
END_IF;
287+
END_IF;
288+
289+
Evaluate := THIS^.Done;]]></ST>
290+
</Implementation>
291+
</Method>
206292
<Method Name="Inspect" Id="{5050b1c2-e64a-023f-2d54-61af21de371f}">
207293
<Declaration><![CDATA[(*~
208294
<summary>
@@ -340,6 +426,38 @@ END_IF;
340426
Retry := THIS^.Done;]]></ST>
341427
</Implementation>
342428
</Method>
429+
<Method Name="RetryThenTerminate" Id="{a1d11a84-0c54-0300-27d8-3ee3e5fb3c1c}" FolderPath="OnFail\">
430+
<Declaration><![CDATA[{attribute 'hide'}
431+
{attribute 'obsolete' := 'You should access `RetryThenTerminate` method via `OnFail()` method.'}
432+
METHOD RetryThenTerminate : BOOL
433+
VAR_INPUT
434+
inFromState : INT;
435+
END_VAR]]></Declaration>
436+
<Implementation>
437+
<ST><![CDATA[IF (_coordinator = 0) THEN
438+
RETURN;
439+
END_IF
440+
441+
IF (THIS^.Done) THEN
442+
IF (THIS^._currentRunResult.Result = eOverallResult.Failed) THEN
443+
IF (__ISVALIDREF(_refOverallResult)) THEN
444+
_refOverallResult := _originalOverallResult;
445+
END_IF
446+
447+
ClearResult(_currentRunResult);
448+
IF OverInspected THEN
449+
_coordinator.Terminate();
450+
ELSE
451+
_coordinator.Retry(inFromState);
452+
END_IF;
453+
ELSE
454+
_coordinator.MoveNext();
455+
END_IF;
456+
END_IF;
457+
458+
RetryThenTerminate := THIS^.Done;]]></ST>
459+
</Implementation>
460+
</Method>
343461
<Method Name="Terminate" Id="{ef8afc1b-48c1-0d87-3e46-8fe826fdd29c}" FolderPath="OnFail\">
344462
<Declaration><![CDATA[{attribute 'hide'}
345463
{attribute 'obsolete' := 'You should access `Terminate` method via `OnFail()` method.'}

src/TcoInspectors/src/XAE/XAE/TcoInspectors/POUs/TcoInspector/IInspector.TcIO

+15
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,21 @@ PROPERTY CommonData : REFERENCE TO TcoInspectorData]]></Declaration>
3434
<Declaration><![CDATA[]]></Declaration>
3535
</Get>
3636
</Property>
37+
<Method Name="HideOverride" Id="{b431c33c-95f9-04d3-2b46-90c0ee1194d0}">
38+
<Declaration><![CDATA[METHOD HideOverride : IInspector
39+
40+
]]></Declaration>
41+
</Method>
42+
<Method Name="HideRetry" Id="{d3a6b912-afba-0dc7-214b-0768c024db38}">
43+
<Declaration><![CDATA[METHOD HideRetry : IInspector
44+
45+
]]></Declaration>
46+
</Method>
47+
<Method Name="HideTerminate" Id="{1fdd4937-bf43-037d-3d7e-7880941def25}">
48+
<Declaration><![CDATA[METHOD HideTerminate : IInspector
49+
50+
]]></Declaration>
51+
</Method>
3752
<Property Name="Identity" Id="{30ca9dd1-1e56-01cf-3dbc-58c99beb7408}">
3853
<Declaration><![CDATA[PROPERTY Identity : ULINT]]></Declaration>
3954
<Get Name="Get" Id="{275ba232-6810-0478-08ce-630296e4e874}">

src/TcoInspectors/src/XAE/XAE/TcoInspectors/POUs/TcoInspector/IOnFail.TcIO

+16
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,28 @@ VAR_INPUT
2020
inRetrySignal:BOOL;
2121
inTerminateSignal : BOOL;
2222
END_VAR]]></Declaration>
23+
</Method>
24+
<Method Name="Evaluate" Id="{3ac67a28-9e55-0b52-3955-5ec6682aa94d}">
25+
<Declaration><![CDATA[METHOD Evaluate : BOOL
26+
VAR_INPUT
27+
inFromState : INT;
28+
inFailMode : eTcoInspectorFailMode;
29+
inToState : INT;
30+
END_VAR
31+
]]></Declaration>
2332
</Method>
2433
<Method Name="Retry" Id="{35cbf4b9-b3aa-0f5d-0000-a466366ca062}">
2534
<Declaration><![CDATA[METHOD Retry : BOOL
2635
VAR_INPUT
2736
inFromState : INT;
2837
END_VAR
38+
]]></Declaration>
39+
</Method>
40+
<Method Name="RetryThenTerminate" Id="{f7a58b72-6f87-0c49-0dfe-12fd5d319e9a}">
41+
<Declaration><![CDATA[METHOD RetryThenTerminate : BOOL
42+
VAR_INPUT
43+
inFromState : INT;
44+
END_VAR
2945
]]></Declaration>
3046
</Method>
3147
<Method Name="Terminate" Id="{6bd31019-9b56-0c3f-1fdb-bb53e3d258fc}">

0 commit comments

Comments
 (0)