Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
H
hemei
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
潘栩锋
hemei
Commits
1edad180
Commit
1edad180
authored
Jul 04, 2022
by
潘栩锋
🚴
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改 扫描图,环形图的unittest
parent
caeb1e1a
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
363 additions
and
632 deletions
+363
-632
AirRingGraphVm.cs
...enZiJia.UI.Client/UiModule/AirRingGraph/AirRingGraphVm.cs
+36
-29
ScanGraph.xaml
...ng/FLY.Thick.Blowing.UI/UiModule/ScanGraph/ScanGraph.xaml
+1
-1
ScanGraphVm.cs
...ng/FLY.Thick.Blowing.UI/UiModule/ScanGraph/ScanGraphVm.cs
+28
-14
ScanGraphVmUt.cs
.../FLY.Thick.Blowing.UI/UiModule/ScanGraph/ScanGraphVmUt.cs
+42
-191
ScanGraph2.xaml
.../FLY.Thick.Blowing.UI/UiModule/ScanGraph2/ScanGraph2.xaml
+1
-1
ScanGraph2Vm.cs
.../FLY.Thick.Blowing.UI/UiModule/ScanGraph2/ScanGraph2Vm.cs
+87
-73
ScanGraph2VmUt.cs
...LY.Thick.Blowing.UI/UiModule/ScanGraph2/ScanGraph2VmUt.cs
+48
-218
ScanGraphCircular.xaml
...wing.UI/UiModule/ScanGraphCircular/ScanGraphCircular.xaml
+6
-5
ScanGraphCircularVm.cs
...wing.UI/UiModule/ScanGraphCircular/ScanGraphCircularVm.cs
+29
-24
ScanGraphCircularVmUt.cs
...ng.UI/UiModule/ScanGraphCircular/ScanGraphCircularVmUt.cs
+85
-76
No files found.
Project.FLY.FeedbackRenZiJia/FLY.FeedbackRenZiJia.UI.Client/UiModule/AirRingGraph/AirRingGraphVm.cs
View file @
1edad180
...
...
@@ -368,45 +368,52 @@ namespace FLY.FeedbackRenZiJia.UI.Client.UiModule
private
void
Save
()
{
WdSaveHeatsFile
w
=
new
WdSaveHeatsFile
()
;
w
.
Owner
=
FLY
.
ControlLibrary
.
COMMON
.
GetWindow
(
btnClearH
);
w
.
FileName
=
mFeedback
.
HeatsProductName
;
string
txt
=
mFeedback
.
HeatsProductName
;
if
(!
FLY
.
ControlLibrary
.
Prompt
.
Show
(
"请输出产品名称"
,
ref
txt
))
return
;
if
(
w
.
ShowDialog
()
==
true
)
{
if
(
string
.
IsNullOrEmpty
(
w
.
FileName
))
{
FLY
.
ControlLibrary
.
Window_WarningTip
.
Show
(
"异常"
,
"产品名称 为空"
,
TimeSpan
.
FromSeconds
(
2
));
return
;
}
char
[]
invalids
=
System
.
IO
.
Path
.
GetInvalidFileNameChars
();
//WdSaveHeatsFile w = new WdSaveHeatsFile();
//w.Owner = FLY.ControlLibrary.COMMON.GetWindow(btnClearH);
//w.FileName = mFeedback.HeatsProductName;
foreach
(
char
invalidChar
in
invalids
)
{
if
(
w
.
FileName
.
Contains
(
invalidChar
))
{
FLY
.
ControlLibrary
.
Window_WarningTip
.
Show
(
"异常"
,
"产品名称 含有非法字符 "
+
invalidChar
,
TimeSpan
.
FromSeconds
(
2
));
return
;
}
}
//if (w.ShowDialog() != true)
// return;
if
(
w
.
FileName
.
Length
>
30
)
//string txt = w.FileName;
if
(
string
.
IsNullOrEmpty
(
txt
))
{
FLY
.
ControlLibrary
.
Window_WarningTip
.
Show
(
"异常"
,
"产品名称 为空"
,
TimeSpan
.
FromSeconds
(
2
));
return
;
}
char
[]
invalids
=
System
.
IO
.
Path
.
GetInvalidFileNameChars
();
foreach
(
char
invalidChar
in
invalids
)
{
if
(
txt
.
Contains
(
invalidChar
))
{
FLY
.
ControlLibrary
.
Window_WarningTip
.
Show
(
"异常"
,
"产品名称 > 30字符"
,
TimeSpan
.
FromSeconds
(
2
));
"产品名称 含有非法字符 "
+
invalidChar
,
TimeSpan
.
FromSeconds
(
2
));
return
;
}
}
mFeedback
.
SaveHeats
(
w
.
FileName
);
FLY
.
ControlLibrary
.
Window_Tip
.
Show
(
"加载成功"
,
w
.
FileName
,
if
(
txt
.
Length
>
30
)
{
FLY
.
ControlLibrary
.
Window_WarningTip
.
Show
(
"异常"
,
"产品名称 > 30字符"
,
TimeSpan
.
FromSeconds
(
2
));
return
;
}
mFeedback
.
SaveHeats
(
txt
);
FLY
.
ControlLibrary
.
Window_Tip
.
Show
(
"加载成功"
,
txt
,
TimeSpan
.
FromSeconds
(
2
));
}
private
void
Load
()
...
...
Project.FLY.Thick.Blowing/FLY.Thick.Blowing.UI/UiModule/ScanGraph/ScanGraph.xaml
View file @
1edad180
...
...
@@ -82,7 +82,7 @@
/>
</lvc:Axis.Sections>
<lvc:Axis.Separator>
<lvc:Separator
Stroke="Transparent
" />
<lvc:Separator
Visibility="Collapsed
" />
</lvc:Axis.Separator>
</lvc:Axis>
...
...
Project.FLY.Thick.Blowing/FLY.Thick.Blowing.UI/UiModule/ScanGraph/ScanGraphVm.cs
View file @
1edad180
...
...
@@ -81,7 +81,7 @@ namespace FLY.Thick.Blowing.UI.UiModule
/// <summary>
/// 混合数
/// </summary>
public
int
Mix
{
get
;
pr
ivate
set
;
}
=
2
;
public
int
Mix
{
get
;
pr
otected
set
;
}
=
1
;
/// <summary>
/// 测量时间
...
...
@@ -146,12 +146,12 @@ namespace FLY.Thick.Blowing.UI.UiModule
ChartValues
<
double
>
Values
=
new
ChartValues
<
double
>();
object
Mapper
;
BlowingFixProfileParam
profileParam
;
ScanGraphItemParam
graphparam
;
IBulkDbService
bulkDb
;
Lc_ScanData
scanData
;
protected
BlowingFixProfileParam
profileParam
;
protected
ScanGraphItemParam
graphparam
;
protected
IBulkDbService
bulkDb
;
protected
Lc_ScanData
scanData
;
Db_Profile
profile
;
IBlowingService
blowingService
;
protected
IBlowingService
blowingService
;
ParamDictionary
paramDictionary
;
protected
DispatcherTimer
timer
;
public
ScanGraphVm
()
...
...
@@ -271,7 +271,6 @@ namespace FLY.Thick.Blowing.UI.UiModule
}
void
Init
()
{
Misc
.
BindingOperations
.
SetBinding
(
graphparam
,
nameof
(
graphparam
.
Mix
),
this
,
nameof
(
Mix
));
Misc
.
BindingOperations
.
SetBinding
(
blowingService
,
nameof
(
blowingService
.
BPC
),
this
,
nameof
(
BPC
));
paramDictionary
.
SetBinding
(
this
,
nameof
(
XStepOrg
),
nameof
(
XStep
),
5
);
...
...
@@ -367,7 +366,7 @@ namespace FLY.Thick.Blowing.UI.UiModule
}
if
(
propertyname_updateMaxMinText
.
Contains
(
e
.
PropertyName
))
UpdateMaxMinText
();
UpdateMaxMinText
_delay
();
}
...
...
@@ -423,7 +422,7 @@ namespace FLY.Thick.Blowing.UI.UiModule
void
UpdateY
()
protected
void
UpdateY
()
{
//if (this.profile != null)
//{
...
...
@@ -488,7 +487,7 @@ namespace FLY.Thick.Blowing.UI.UiModule
YMin
=
target
-
tolerance
*
graphparam
.
YRangePercent
;
}
void
UpdateX
()
protected
void
UpdateX
()
{
XMin
=
0
;
XMax
=
this
.
blowingService
.
NBolts
+
1
;
...
...
@@ -499,7 +498,7 @@ namespace FLY.Thick.Blowing.UI.UiModule
Update4IdChanged
();
}
void
UpdateMaxMinText
()
void
UpdateMaxMinText
_delay
()
{
PollModule
.
Current
.
Poll_JustOnce
(()
=>
{
...
...
@@ -517,8 +516,23 @@ namespace FLY.Thick.Blowing.UI.UiModule
}
},
this
,
MARKNO_TEXTUP
);
}
protected
void
UpdateMaxMinText
()
{
if
(
graphparam
.
IsPercent
&&
(
Average
>
0
))
{
MaxText
=
$"+
{((
Max
-
Average
)
/
Average
)
*
100.0
:
F1
}
%"
;
MinText
=
$"-
{((
Average
-
Min
)
/
Average
)
*
100.0
:
F1
}
%"
;
Sigma2Text
=
$"
{(
Sigma2
/
Average
)
*
100.0
:
F1
}
%"
;
}
else
{
MaxText
=
$"
{
Max
:
F1
}
"
;
MinText
=
$"
{
Min
:
F1
}
"
;
Sigma2Text
=
$"
{
Sigma2
:
F1
}
"
;
}
}
void
UpdateAverage
()
{
protected
void
UpdateAverage
()
{
if
(
this
.
scanData
==
null
)
{
Time
=
DateTime
.
MinValue
;
...
...
@@ -638,7 +652,7 @@ namespace FLY.Thick.Blowing.UI.UiModule
(
object
AsyncContext
,
object
retData
)
=>
{
Pack_GetFrameReponse
reponse
=
retData
as
Pack_GetFrameReponse
;
Mix
=
reponse
.
Request
.
Mix
;
//if (reponse.scanData != null)
{
this
.
scanData
=
reponse
.
scanData
;
...
...
@@ -685,7 +699,7 @@ namespace FLY.Thick.Blowing.UI.UiModule
Number
=
graphparam
.
Number
;
}
void
NotifyPropertyChanged
(
string
propertyName
)
{
protected
void
NotifyPropertyChanged
(
string
propertyName
)
{
PropertyChanged
?.
Invoke
(
this
,
new
PropertyChangedEventArgs
(
propertyName
));
}
public
event
PropertyChangedEventHandler
PropertyChanged
;
...
...
Project.FLY.Thick.Blowing/FLY.Thick.Blowing.UI/UiModule/ScanGraph/ScanGraphVmUt.cs
View file @
1edad180
...
...
@@ -11,139 +11,10 @@ using System.Windows.Media;
namespace
FLY.Thick.Blowing.UI.UiModule
{
public
class
ScanGraphVmUt
:
INotifyPropertyChanged
public
class
ScanGraphVmUt
:
ScanGraphVm
{
#
region
图表控制
public
double
YMax
{
get
;
set
;
}
public
double
YMin
{
get
;
set
;
}
public
double
Target
{
get
;
set
;
}
public
double
Tolerance2YMax
{
get
;
set
;
}
public
double
Tolerance2YMin
{
get
;
set
;
}
public
double
ToleranceYMax
{
get
;
set
;
}
public
double
ToleranceYMin
{
get
;
set
;
}
public
double
XMax
{
get
;
set
;
}
public
double
XMin
{
get
;
set
;
}
public
int
XStep
{
get
;
set
;
}
=
5
;
public
Func
<
double
,
string
>
YFormatter
{
get
;
set
;
}
public
SeriesCollection
Series
{
get
;
set
;
}
#
endregion
#
region
颜色
List
<
Brush
>
AreaColors
;
#
endregion
#
region
界面统计值
public
double
Average
{
get
;
set
;
}
public
string
Sigma2Text
{
get
;
set
;
}
public
string
MaxText
{
get
;
set
;
}
public
string
MinText
{
get
;
set
;
}
/// <summary>
/// 混合数
/// </summary>
public
int
Mix
{
get
;
set
;
}
/// <summary>
/// 旋转方向 是反向
/// </summary>
public
bool
IsBackw
{
get
;
set
;
}
/// <summary>
/// 旋转1周的时间
/// </summary>
public
TimeSpan
RPeriod
{
get
;
set
;
}
/// <summary>
/// 测量时间
/// </summary>
public
DateTime
Time
{
get
;
set
;
}
public
DateTime
EndTime
{
get
;
set
;
}
/// <summary>
/// 数据库中的ID标示
/// </summary>
public
int
Id
{
get
;
set
;
}
/// <summary>
/// 复位区号
/// </summary>
public
int
OrgBoltNo
{
get
;
set
;
}
public
bool
IsPercent
{
get
;
set
;
}
public
bool
IsAutoTarget
{
get
;
set
;
}
#
endregion
ChartValues
<
double
>
Values
{
get
;
}
=
new
ChartValues
<
double
>();
object
Mapper
{
get
;
set
;
}
public
ScanGraphVmUt
()
{
#
region
与数据无关界面参数
AreaColors
=
FLY
.
Thick
.
Blowing
.
UI
.
Themes
.
Colors
.
AreaColors
;
YFormatter
=
(
y
)
=>
{
if
(
IsPercent
)
{
if
(
y
==
Average
)
{
return
y
.
ToString
(
"F1"
);
}
else
{
double
percent
=
100.0
*
(
y
-
Average
)
/
Average
;
if
(
percent
>
0
)
{
return
$"+
{
Math
.
Abs
(
percent
):
F1
}
%"
;
}
else
{
return
$"-
{
Math
.
Abs
(
percent
):
F1
}
%"
;
}
}
}
else
{
return
y
.
ToString
(
"F1"
);
}
};
Mapper
=
Mappers
.
Xy
<
double
>()
.
X
((
value
,
index
)
=>
{
return
index
+
1
;
})
.
Y
(
value
=>
value
)
.
Fill
((
value
)
=>
{
if
((
value
>
Tolerance2YMax
)
||
(
value
<
Tolerance2YMin
))
{
return
AreaColors
[
2
];
}
else
if
((
value
>
ToleranceYMax
)
||
(
value
<
ToleranceYMin
))
{
return
AreaColors
[
1
];
}
else
{
return
AreaColors
[
0
];
}
});
#
endregion
#
region
数据
double
target
=
150
;
double
tolerance
=
target
*
0.02
;
...
...
@@ -156,78 +27,58 @@ namespace FLY.Thick.Blowing.UI.UiModule
datas
[
i
]
=
(
Math
.
Sin
(
i
*
Math
.
PI
/
nbolts
)
*
3
)
*
tolerance
+
target
+
(
random
.
NextDouble
()
-
0.5
)
*
1
-
6
;
}
#
endregion
#
region
界面数据
profileParam
=
new
Common
.
BlowingFixProfileParam
()
{
Target
=
target
,
TolerancePercent
=
0.02
,
K
=
1
,
PName
=
"abc"
,
OrderNo
=
"12313121"
,
Number
=
"2"
};
graphparam
=
new
ScanGraphItemParam
()
{
IsPercent
=
true
,
IsAutoTarget
=
true
,
YRangePercent
=
yrangepercent
,
Number
=
-
1
,
Mix
=
2
};
XMin
=
0
;
XMax
=
nbolts
+
1
;
XStep
=
5
;
Mix
=
2
;
Time
=
DateTime
.
Now
;
Id
=
312312
;
OrgBoltNo
=
31
;
IsPercent
=
true
;
IsAutoTarget
=
true
;
Values
.
Clear
();
Values
.
Add
(
double
.
NaN
);
Values
.
AddRange
(
datas
);
Average
=
datas
.
AverageNoNull
();
IsBackw
=
false
;
RPeriod
=
TimeSpan
.
FromSeconds
(
60
*
6.5
);
scanData
=
new
Server
.
Model
.
Lc_ScanData
()
{
Time
=
DateTime
.
Now
.
AddSeconds
(-
30
),
EndTime
=
DateTime
.
Now
,
ID
=
1234567
,
K
=
2
,
Thicks
=
datas
,
IsBackw
=
false
,
FilmLength
=
23.3
,
FilmVelocity
=
53.1
,
OrgBoltNo
=
41
,
RAngle
=
355
,
RCnt
=
6
,
RPeriod
=
TimeSpan
.
FromMinutes
(
6.7
)
};
double
Max
=
datas
.
Max
();
double
Min
=
datas
.
Min
();
double
Sigma2
=
datas
.
Sigma
()
*
2
;
#
endregion
#
region
界面数据
Mix
=
graphparam
.
Mix
;
XStepOrg
=
5
;
if
(
IsPercent
)
{
MaxText
=
$"+
{((
Max
-
Average
)
/
Average
)*
100.0
:
F1
}
%"
;
MinText
=
$"-
{((
Average
-
Min
)
/
Average
)
*
100.0
:
F1
}
%"
;
Sigma2Text
=
$"
{(
Sigma2
/
Average
)
*
100.0
:
F1
}
%"
;
}
else
{
MaxText
=
$"
{
Max
:
F1
}
"
;
MinText
=
$"
{
Min
:
F1
}
"
;
Sigma2Text
=
$"
{
Sigma2
:
F1
}
"
;
}
if
(
IsPercent
||
IsAutoTarget
)
{
Target
=
Average
;
}
else
{
Target
=
target
;
}
UpdateAverage
();
UpdateMaxMinText
();
UpdateY
();
ToleranceYMax
=
Target
+
tolerance
;
ToleranceYMin
=
Target
-
tolerance
;
Tolerance2YMax
=
Target
+
tolerance
*
2
;
Tolerance2YMin
=
Target
-
tolerance
*
2
;
YMax
=
Target
+
tolerance
*
yrangepercent
;
YMin
=
Target
-
tolerance
*
yrangepercent
;
//UpdateX();
XMax
=
nbolts
+
1
;
#
endregion
Series
=
new
SeriesCollection
{
new
Column2Series
{
Title
=
"扫描图"
,
Values
=
Values
,
StrokeThickness
=
1
,
Stroke
=
new
SolidColorBrush
(
Colors
.
Black
),
PointGeometry
=
null
,
Configuration
=
Mapper
}
};
((
Series
)
Series
[
0
]).
SetBinding
(
Column2Series
.
YAxisCrossingProperty
,
new
Binding
(
"Target"
)
{
Source
=
this
});
}
public
event
PropertyChangedEventHandler
PropertyChanged
;
}
}
Project.FLY.Thick.Blowing/FLY.Thick.Blowing.UI/UiModule/ScanGraph2/ScanGraph2.xaml
View file @
1edad180
...
...
@@ -21,7 +21,7 @@
<local:ScanGraph2VmUt x:Key="viewmodel"/>
</ResourceDictionary>
</UserControl.Resources>
<Border Style="{StaticResource
BorderStyle_module
}" >
<Border Style="{StaticResource
Styles.Module.Border
}" >
<Grid d:DataContext="{StaticResource viewmodel}">
<Grid.RowDefinitions>
<RowDefinition Height="auto"/>
...
...
Project.FLY.Thick.Blowing/FLY.Thick.Blowing.UI/UiModule/ScanGraph2/ScanGraph2Vm.cs
View file @
1edad180
...
...
@@ -95,7 +95,7 @@ namespace FLY.Thick.Blowing.UI.UiModule
/// <summary>
/// 混合数
/// </summary>
public
int
Mix
{
get
;
pr
ivate
set
;
}
=
2
;
public
int
Mix
{
get
;
pr
otected
set
;
}
=
1
;
/// <summary>
/// 测量时间
...
...
@@ -305,7 +305,6 @@ namespace FLY.Thick.Blowing.UI.UiModule
}
void
Init
()
{
Misc
.
BindingOperations
.
SetBinding
(
graphparam
,
nameof
(
graphparam
.
Mix
),
this
,
nameof
(
Mix
));
Misc
.
BindingOperations
.
SetBinding
(
blowingService
,
nameof
(
blowingService
.
BPC
),
this
,
nameof
(
BPC
));
paramDictionary
.
SetBinding
(
this
,
nameof
(
XStepOrg
),
nameof
(
XStep
),
5
);
UpdateY
();
...
...
@@ -381,7 +380,7 @@ namespace FLY.Thick.Blowing.UI.UiModule
}
};
}
pr
ivate
void
BulkDb_TempFrameChanged
(
object
sender
,
EventArgs
_e
)
pr
otected
void
BulkDb_TempFrameChanged
(
object
sender
,
EventArgs
_e
)
{
BulkDbTempFrameChangedEventArgs
e
=
(
BulkDbTempFrameChangedEventArgs
)
_e
;
...
...
@@ -416,16 +415,16 @@ namespace FLY.Thick.Blowing.UI.UiModule
{
if
(
e
.
PropertyName
==
nameof
(
Average
))
{
UpdateTarget
();
UpdateMaxMinText
();
UpdateTarget
_delay
();
UpdateMaxMinText
_delay
();
}
else
if
((
e
.
PropertyName
==
nameof
(
Max
))
||
(
e
.
PropertyName
==
nameof
(
Min
))
||
(
e
.
PropertyName
==
nameof
(
Sigma2
)))
{
UpdateMaxMinText
();
UpdateMaxMinText
_delay
();
}
else
if
(
e
.
PropertyName
==
nameof
(
Average2
))
{
UpdateTarget
();
UpdateTarget
_delay
();
}
else
if
(
e
.
PropertyName
==
nameof
(
Target
))
{
...
...
@@ -433,11 +432,11 @@ namespace FLY.Thick.Blowing.UI.UiModule
{
NotifyPropertyChanged
(
nameof
(
YFormatter
));
}
UpdateY2
();
UpdateY2
_delay
();
}
else
if
(
e
.
PropertyName
==
nameof
(
TolerancePercent
))
{
UpdateY2
();
UpdateY2
_delay
();
}
else
if
(
e
.
PropertyName
==
nameof
(
Number
))
{
...
...
@@ -477,24 +476,24 @@ namespace FLY.Thick.Blowing.UI.UiModule
{
if
(
e
.
PropertyName
==
nameof
(
graphparam
.
YRangePercent
))
{
UpdateTarget
();
UpdateY2
();
UpdateTarget
_delay
();
UpdateY2
_delay
();
}
if
(
e
.
PropertyName
==
nameof
(
graphparam
.
IsPercent
))
{
NotifyPropertyChanged
(
nameof
(
YFormatter
));
UpdateTarget
();
UpdateMaxMinText
();
UpdateTarget
_delay
();
UpdateMaxMinText
_delay
();
}
else
if
(
e
.
PropertyName
==
nameof
(
graphparam
.
IsAutoTarget
))
{
UpdateTarget
();
UpdateTarget
_delay
();
}
}
void
UpdateOrgTarget
()
protected
void
UpdateOrgTarget
()
{
//if (this.profile != null)
//{
...
...
@@ -523,71 +522,82 @@ namespace FLY.Thick.Blowing.UI.UiModule
void
UpdateY
()
{
UpdateOrgTarget
();
UpdateTarget
();
UpdateY2
();
UpdateTarget
_delay
();
UpdateY2
_delay
();
}
void
UpdateTarget
()
void
UpdateTarget
_delay
()
{
PollModule
.
Current
.
Poll_JustOnce
(()
=>
{
double
target
=
OrgTarget
;
if
(
graphparam
.
IsPercent
||
graphparam
.
IsAutoTarget
)
{
if
(!
double
.
IsNaN
(
Average
))
target
=
Average
;
}
UpdateTarget
();
},
this
,
MARKNO_TARGET
);
}
protected
void
UpdateTarget
()
{
double
tolerance
=
TolerancePercent
*
target
;
double
target
=
OrgTarget
;
if
(
graphparam
.
IsPercent
||
graphparam
.
IsAutoTarget
)
{
if
(!
double
.
IsNaN
(
Average
))
target
=
Average
;
}
double
tolerance
=
TolerancePercent
*
target
;
if
(
tolerance
<
0.1
)
tolerance
=
0.1
;
if
(
tolerance
<
0.1
)
tolerance
=
0.1
;
if
(!
double
.
IsNaN
(
Average2
))
if
(!
double
.
IsNaN
(
Average2
))
{
//tempdata 不在显示范围内, 调整 target 为 Average2
if
(
Math
.
Abs
(
Average2
-
target
)
>
tolerance
*
graphparam
.
YRangePercent
)
{
//tempdata 不在显示范围内, 调整 target 为 Average2
if
(
Math
.
Abs
(
Average2
-
target
)
>
tolerance
*
graphparam
.
YRangePercent
)
target
=
Target
;
if
(
!
double
.
IsNaN
(
target
)
)
{
target
=
Target
;
if
(
!
double
.
IsNaN
(
target
)
)
//tempdata 也不在 当前视图 内
if
(
Math
.
Abs
(
Average2
-
target
)
>
tolerance
*
graphparam
.
YRangePercent
)
{
//tempdata 也不在 当前视图 内
if
(
Math
.
Abs
(
Average2
-
target
)
>
tolerance
*
graphparam
.
YRangePercent
)
{
target
=
Average2
;
}
}
else
{
//视图还没初始化。。。
target
=
Average2
;
}
}
else
{
//视图还没初始化。。。
target
=
Average2
;
}
}
}
Target
=
target
;
},
this
,
MARKNO_TARGET
);
Target
=
target
;
}
void
UpdateY2
()
protected
void
UpdateY2
()
{
PollModule
.
Current
.
Poll_JustOnce
(()
=>
{
double
target
=
Target
;
double
tolerancePercent
=
TolerancePercent
;
double
target
=
Target
;
double
tolerancePercent
=
TolerancePercent
;
double
tolerance
=
target
*
tolerancePercent
;
if
(
tolerance
<
0.1
)
tolerance
=
0.1
;
double
tolerance
=
target
*
tolerancePercent
;
if
(
tolerance
<
0.1
)
tolerance
=
0.1
;
ToleranceYMax
=
target
+
tolerance
;
ToleranceYMin
=
target
-
tolerance
;
Tolerance2YMax
=
target
+
tolerance
*
2
;
Tolerance2YMin
=
target
-
tolerance
*
2
;
ToleranceYMax
=
target
+
tolerance
;
ToleranceYMin
=
target
-
tolerance
;
Tolerance2YMax
=
target
+
tolerance
*
2
;
Tolerance2YMin
=
target
-
tolerance
*
2
;
YMax
=
target
+
tolerance
*
graphparam
.
YRangePercent
;
YMin
=
target
-
tolerance
*
graphparam
.
YRangePercent
;
YMax
=
target
+
tolerance
*
graphparam
.
YRangePercent
;
YMin
=
target
-
tolerance
*
graphparam
.
YRangePercent
;
}
void
UpdateY2_delay
()
{
PollModule
.
Current
.
Poll_JustOnce
(()
=>
{
UpdateY2
();
},
this
,
MARKNO_Y
);
}
void
UpdateX
()
...
...
@@ -608,28 +618,31 @@ namespace FLY.Thick.Blowing.UI.UiModule
{
Update4IdChanged
();
}
void
UpdateMaxMinText
()
void
UpdateMaxMinText_delay
()
{
PollModule
.
Current
.
Poll_JustOnce
(()
=>
{
if
(
graphparam
.
IsPercent
&&
(
Average
>
0
))
{
MaxText
=
$"+
{((
Max
-
Average
)
/
Average
)
*
100.0
:
F1
}
%"
;
MinText
=
$"-
{((
Average
-
Min
)
/
Average
)
*
100.0
:
F1
}
%"
;
Sigma2Text
=
$"
{(
Sigma2
/
Average
)
*
100.0
:
F1
}
%"
;
}
else
{
MaxText
=
$"
{
Max
:
F1
}
"
;
MinText
=
$"
{
Min
:
F1
}
"
;
Sigma2Text
=
$"
{
Sigma2
:
F1
}
"
;
}
UpdateMaxMinText
();
},
this
,
MARKNO_TEXT
);
}
protected
void
UpdateMaxMinText
()
{
if
(
graphparam
.
IsPercent
&&
(
Average
>
0
))
{
MaxText
=
$"+
{((
Max
-
Average
)
/
Average
)
*
100.0
:
F1
}
%"
;
MinText
=
$"-
{((
Average
-
Min
)
/
Average
)
*
100.0
:
F1
}
%"
;
Sigma2Text
=
$"
{(
Sigma2
/
Average
)
*
100.0
:
F1
}
%"
;
}
else
{
MaxText
=
$"
{
Max
:
F1
}
"
;
MinText
=
$"
{
Min
:
F1
}
"
;
Sigma2Text
=
$"
{
Sigma2
:
F1
}
"
;
}
}
void
Update4IdChanged2
()
protected
void
Update4IdChanged2
()
{
Values
.
Clear
();
if
(
this
.
scanData
==
null
)
...
...
@@ -708,6 +721,7 @@ namespace FLY.Thick.Blowing.UI.UiModule
{
Pack_GetFrameReponse
reponse
=
retData
as
Pack_GetFrameReponse
;
Mix
=
reponse
.
Request
.
Mix
;
//if (reponse.scanData != null)
{
this
.
scanData
=
reponse
.
scanData
;
...
...
@@ -749,7 +763,7 @@ namespace FLY.Thick.Blowing.UI.UiModule
}
}
void
NotifyPropertyChanged
(
string
propertyName
)
protected
void
NotifyPropertyChanged
(
string
propertyName
)
{
PropertyChanged
?.
Invoke
(
this
,
new
PropertyChangedEventArgs
(
propertyName
));
}
...
...
Project.FLY.Thick.Blowing/FLY.Thick.Blowing.UI/UiModule/ScanGraph2/ScanGraph2VmUt.cs
View file @
1edad180
using
LiveCharts
;
using
FLY.Thick.Blowing.IService
;
using
LiveCharts
;
using
LiveCharts.Configurations
;
using
LiveCharts.Wpf
;
using
Misc
;
...
...
@@ -11,154 +12,10 @@ using System.Windows.Media;
namespace
FLY.Thick.Blowing.UI.UiModule
{
public
class
ScanGraph2VmUt
:
INotifyPropertyChanged
public
class
ScanGraph2VmUt
:
ScanGraph2Vm
{
#
region
图表控制
public
double
YMax
{
get
;
set
;
}
public
double
YMin
{
get
;
set
;
}
public
double
Target
{
get
;
set
;
}
public
double
Tolerance2YMax
{
get
;
set
;
}
public
double
Tolerance2YMin
{
get
;
set
;
}
public
double
ToleranceYMax
{
get
;
set
;
}
public
double
ToleranceYMin
{
get
;
set
;
}
public
double
XMax
{
get
;
set
;
}
public
double
XMin
{
get
;
set
;
}
public
int
XStep
{
get
;
set
;
}
=
5
;
public
Func
<
double
,
string
>
YFormatter
{
get
;
set
;
}
public
SeriesCollection
Series
{
get
;
set
;
}
#
endregion
#
region
颜色
List
<
Brush
>
AreaColors
;
#
endregion
#
region
界面统计值
public
double
Average
{
get
;
set
;
}
public
string
Sigma2Text
{
get
;
set
;
}
public
string
MaxText
{
get
;
set
;
}
public
string
MinText
{
get
;
set
;
}
/// <summary>
/// 混合数
/// </summary>
public
int
Mix
{
get
;
set
;
}
/// <summary>
/// 测量时间
/// </summary>
public
DateTime
Time
{
get
;
set
;
}
/// <summary>
/// 旋转方向 是反向
/// </summary>
public
bool
IsBackw
{
get
;
private
set
;
}
/// <summary>
/// 旋转1周的时间
/// </summary>
public
TimeSpan
RPeriod
{
get
;
private
set
;
}
public
DateTime
Time2
{
get
;
set
;
}
/// <summary>
/// 数据库中的ID标示
/// </summary>
public
int
Id
{
get
;
set
;
}
/// <summary>
/// 复位区号
/// </summary>
public
int
OrgBoltNo
{
get
;
set
;
}
public
bool
IsPercent
{
get
;
set
;
}
public
bool
IsAutoTarget
{
get
;
set
;
}
#
endregion
ChartValues
<
double
>
Values
{
get
;
}
=
new
ChartValues
<
double
>();
ChartValues
<
double
>
Values2
{
get
;
}
=
new
ChartValues
<
double
>();
object
Mapper
{
get
;
set
;
}
object
Mapper2
{
get
;
set
;
}
public
ScanGraph2VmUt
()
{
#
region
与数据无关界面参数
AreaColors
=
new
List
<
Brush
>();
for
(
int
i
=
0
;
i
<
5
;
i
++)
AreaColors
.
Add
(
FLY
.
ControlLibrary
.
Themes
.
Styles
.
AreaColors
[
i
]);
YFormatter
=
(
y
)
=>
{
if
(
IsPercent
)
{
if
(
y
==
Average
)
{
return
y
.
ToString
(
"F1"
);
}
else
{
double
percent
=
100.0
*
(
y
-
Average
)
/
Average
;
if
(
percent
>
0
)
{
return
$"+
{
Math
.
Abs
(
percent
):
F1
}
%"
;
}
else
{
return
$"-
{
Math
.
Abs
(
percent
):
F1
}
%"
;
}
}
}
else
{
return
y
.
ToString
(
"F1"
);
}
};
Mapper
=
Mappers
.
Xy
<
double
>()
.
X
((
value
,
index
)
=>
index
+
1
)
.
Y
(
value
=>
value
)
.
Fill
((
value
)
=>
{
if
(
value
>
Tolerance2YMax
)
{
return
AreaColors
[
0
];
}
else
if
(
value
>
ToleranceYMax
)
{
return
AreaColors
[
1
];
}
else
if
(
value
>=
ToleranceYMin
)
{
return
AreaColors
[
2
];
}
else
if
(
value
>=
Tolerance2YMin
)
{
return
AreaColors
[
1
];
}
else
{
return
AreaColors
[
0
];
}
});
Mapper2
=
Mappers
.
Xy
<
double
>()
.
X
((
value
,
index
)
=>
index
+
1
)
.
Y
(
value
=>
value
);
#
endregion
#
region
数据
double
target
=
150
;
double
tolerance
=
target
*
0.02
;
...
...
@@ -177,91 +34,64 @@ namespace FLY.Thick.Blowing.UI.UiModule
datas2
[
i
]
=
(
Math
.
Sin
(
i
*
Math
.
PI
/
nbolts
)
*
3
)
*
tolerance
+
target
+
(
random
.
NextDouble
()
-
0.5
)
*
1
-
6
;
}
#
endregion
#
region
界面数据
profileParam
=
new
Common
.
BlowingFixProfileParam
()
{
Target
=
target
,
TolerancePercent
=
0.02
,
K
=
1
,
PName
=
"abc"
,
OrderNo
=
"12313121"
,
Number
=
"2"
};
XMin
=
0
;
XMax
=
nbolts
+
1
;
XStep
=
5
;
Mix
=
2
;
Time
=
DateTime
.
Now
;
Time2
=
DateTime
.
Now
-
TimeSpan
.
FromMinutes
(
10
);
graphparam
=
new
ScanGraphItemParam
()
{
IsPercent
=
true
,
IsAutoTarget
=
true
,
YRangePercent
=
3
,
Number
=
-
1
,
Mix
=
2
};
IsBackw
=
true
;
RPeriod
=
TimeSpan
.
FromMinutes
(
10.1
);
Id
=
312312
;
scanData
=
new
Server
.
Model
.
Lc_ScanData
()
{
Time
=
DateTime
.
Now
.
AddSeconds
(-
60
),
EndTime
=
DateTime
.
Now
.
AddSeconds
(-
30
),
ID
=
1234567
,
K
=
2
,
Thicks
=
datas
};
BulkDbTempFrameChangedEventArgs
e
=
new
BulkDbTempFrameChangedEventArgs
()
{
Time
=
DateTime
.
Now
.
AddSeconds
(-
25
),
EndTime
=
DateTime
.
Now
,
StartIndex
=
0
,
D
=
datas2
};
#
endregion
#
region
界面数据
OrgBoltNo
=
31
;
IsPercent
=
true
;
IsAutoTarget
=
true
;
Values
.
AddRange
(
datas
);
Values2
.
AddRange
(
datas2
);
Average
=
datas
.
AverageNoNull
();
Mix
=
graphparam
.
Mix
;
XStepOrg
=
5
;
double
Max
=
datas
.
Max
();
double
Min
=
datas
.
Min
();
double
Sigma2
=
datas
.
Sigma
()
*
2
;
BulkDb_TempFrameChanged
(
null
,
e
);
if
(
IsPercent
)
{
MaxText
=
$"+
{((
Max
-
Average
)
/
Average
)*
100.0
:
F1
}
%"
;
MinText
=
$"-
{((
Average
-
Min
)
/
Average
)
*
100.0
:
F1
}
%"
;
Sigma2Text
=
$"
{(
Sigma2
/
Average
)
*
100.0
:
F1
}
%"
;
}
else
{
MaxText
=
$"
{
Max
:
F1
}
"
;
MinText
=
$"
{
Min
:
F1
}
"
;
Sigma2Text
=
$"
{
Sigma2
:
F1
}
"
;
}
Update4IdChanged2
();
UpdateOrgTarget
();
if
(
IsPercent
||
IsAutoTarget
)
{
Target
=
Average
;
}
else
{
Target
=
target
;
}
UpdateTarget
();
UpdateY2
();
UpdateMaxMinText
();
ToleranceYMax
=
Target
+
tolerance
;
ToleranceYMin
=
Target
-
tolerance
;
Tolerance2YMax
=
Target
+
tolerance
*
2
;
Tolerance2YMin
=
Target
-
tolerance
*
2
;
YMax
=
Target
+
tolerance
*
yrangepercent
;
YMin
=
Target
-
tolerance
*
yrangepercent
;
//UpdateX();
XMax
=
nbolts
+
1
;
#
endregion
Series
=
new
SeriesCollection
{
new
Column2Series
{
Title
=
"扫描图"
,
Values
=
Values
,
StrokeThickness
=
1
,
Stroke
=
new
SolidColorBrush
(
Colors
.
Black
),
PointGeometry
=
null
,
Configuration
=
Mapper
},
new
LineSeries
{
Title
=
"曲线图"
,
Values
=
Values2
,
StrokeThickness
=
3
,
Stroke
=
new
SolidColorBrush
(
Colors
.
DarkBlue
),
Fill
=
new
SolidColorBrush
(
Colors
.
Transparent
),
PointGeometry
=
null
,
Configuration
=
Mapper2
}
};
((
Series
)
Series
[
0
]).
SetBinding
(
Column2Series
.
YAxisCrossingProperty
,
new
Binding
(
"Target"
)
{
Source
=
this
});
}
public
event
PropertyChangedEventHandler
PropertyChanged
;
}
}
}
Project.FLY.Thick.Blowing/FLY.Thick.Blowing.UI/UiModule/ScanGraphCircular/ScanGraphCircular.xaml
View file @
1edad180
...
...
@@ -14,10 +14,11 @@
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="pack://application:,,,/FLY.ControlLibrary;component/Converter/Dictionary_MyConv.xaml"/>
<ResourceDictionary Source="pack://application:,,,/FLY.Thick.Blowing.UI;component/Themes/Styles.xaml"/>
<ResourceDictionary Source="pack://application:,,,/FLY.Thick.Blowing.UI;component/Themes/Colors.xaml"/>
</ResourceDictionary.MergedDictionaries>
<local:ScanGraphCircularVmUt x:Key="viewmodel"/>
<SolidColorBrush x:Key="TextBrush" Color="#4C4949" />
<
!--<
SolidColorBrush x:Key="TextBrush" Color="#4C4949" />
<SolidColorBrush x:Key="GrayBrush1" Color="#FF727272"/>
<SolidColorBrush x:Key="GrayBrush2" Color="#FF858484" />
<SolidColorBrush x:Key="SemiTransparentGreyBrush" Color="#99F0F0F0"/>
...
...
@@ -44,10 +45,10 @@
<Setter Property="Foreground" Value="{StaticResource GrayBrush2}"/>
<Setter Property="FontSize" Value="15"/>
<Setter Property="VerticalAlignment" Value="Bottom"/>
</Style>
</Style>
-->
</ResourceDictionary>
</UserControl.Resources>
<Border Style="{StaticResource
BorderStyle_module
}" >
<Border Style="{StaticResource
Styles.Module.Border
}" >
<Grid d:DataContext="{StaticResource viewmodel}">
<Grid.RowDefinitions>
<RowDefinition Height="auto"/>
...
...
@@ -60,9 +61,9 @@
</Grid.ColumnDefinitions>
<local:PolarChart x:Name="graph" Grid.Row="1" Grid.ColumnSpan="3" />
<Button Style="{StaticResource
ButtonStyle_i
con}" Margin="0,0,0,-20"
<Button Style="{StaticResource
Styles.Button.I
con}" Margin="0,0,0,-20"
Click="Button_info_click" >
<Grid Style="{StaticResource
GridStyle_Button
Shadow}" >
<Grid Style="{StaticResource
Styles.
Shadow}" >
<TextBlock Padding="10,5" VerticalAlignment="Top"
FontSize="24" Foreground="White" Background="{StaticResource Brushes.Activity}"
Text="环型图" />
...
...
Project.FLY.Thick.Blowing/FLY.Thick.Blowing.UI/UiModule/ScanGraphCircular/ScanGraphCircularVm.cs
View file @
1edad180
...
...
@@ -52,7 +52,7 @@ namespace FLY.Thick.Blowing.UI.UiModule
/// <summary>
/// 混合数
/// </summary>
public
int
Mix
{
get
;
pr
ivate
set
;
}
=
2
;
public
int
Mix
{
get
;
pr
otected
set
;
}
=
1
;
/// <summary>
/// 测量时间
...
...
@@ -112,13 +112,14 @@ namespace FLY.Thick.Blowing.UI.UiModule
public
RelayCommand
AutoLockCmd
{
get
;
private
set
;
}
ScanGraphCircularParam
graphparam
;
protected
ScanGraphCircularParam
graphparam
;
IBulkDbService
bulkDb
;
Lc_ScanData
scanData
;
protected
Lc_ScanData
scanData
;
Db_Profile
profile
;
IBlowingService
blowingService
;
BlowingFixProfileParam
profileParam
;
protected
BlowingFixProfileParam
profileParam
;
protected
DispatcherTimer
timer
;
protected
PolarChart
graph
;
public
ScanGraphCircularVm
()
{
...
...
@@ -139,7 +140,7 @@ namespace FLY.Thick.Blowing.UI.UiModule
this
.
bulkDb
=
bulkDb
;
this
.
blowingService
=
blowingService
;
this
.
profileParam
=
profileParam
;
this
.
graph
=
graph
;
graph
.
SetBinding
(
PolarChart
.
TolerancePercentProperty
,
new
Binding
(
nameof
(
profileParam
.
TolerancePercent
))
{
Source
=
profileParam
});
graph
.
SetBinding
(
PolarChart
.
TargetProperty
,
new
Binding
(
nameof
(
profileParam
.
Target
))
{
Source
=
profileParam
});
...
...
@@ -170,7 +171,6 @@ namespace FLY.Thick.Blowing.UI.UiModule
graph
.
Values
=
Values
;
graph
.
LineValues
=
Values2
;
Misc
.
BindingOperations
.
SetBinding
(
graphparam
,
nameof
(
graphparam
.
Mix
),
this
,
nameof
(
Mix
));
init_autoKeep
();
...
...
@@ -239,7 +239,7 @@ namespace FLY.Thick.Blowing.UI.UiModule
}
};
}
pr
ivate
void
BulkDb_TempFrameChanged
(
object
sender
,
EventArgs
_e
)
pr
otected
void
BulkDb_TempFrameChanged
(
object
sender
,
EventArgs
_e
)
{
BulkDbTempFrameChangedEventArgs
e
=
(
BulkDbTempFrameChangedEventArgs
)
_e
;
...
...
@@ -279,7 +279,7 @@ namespace FLY.Thick.Blowing.UI.UiModule
private
void
ScanGraphCircularVm_PropertyChanged
(
object
sender
,
PropertyChangedEventArgs
e
)
{
if
(
propertyname_updateMaxMinText
.
Contains
(
e
.
PropertyName
))
UpdateMaxMinText
();
UpdateMaxMinText
_delay
();
else
if
(
e
.
PropertyName
==
nameof
(
Number
))
{
UpdateId
();
...
...
@@ -321,25 +321,29 @@ namespace FLY.Thick.Blowing.UI.UiModule
{
Update4IdChanged
();
}
void
UpdateMaxMinText
()
void
UpdateMaxMinText
_delay
()
{
PollModule
.
Current
.
Poll_JustOnce
(()
=>
{
if
(
Average
>
0
)
{
MaxText
=
$"+
{((
Max
-
Average
)
/
Average
)
*
100.0
:
F1
}
%"
;
MinText
=
$"-
{((
Average
-
Min
)
/
Average
)
*
100.0
:
F1
}
%"
;
Sigma2Text
=
$"
{(
Sigma2
/
Average
)
*
100.0
:
F1
}
%"
;
}
else
{
MaxText
=
$"
{
Max
:
F1
}
"
;
MinText
=
$"
{
Min
:
F1
}
"
;
Sigma2Text
=
$"
{
Sigma2
:
F1
}
"
;
}
UpdateMaxMinText
();
},
this
,
MARKNO_TEXTUP
);
}
void
UpdateAverage
()
protected
void
UpdateMaxMinText
()
{
if
(
Average
>
0
)
{
MaxText
=
$"+
{((
Max
-
Average
)
/
Average
)
*
100.0
:
F1
}
%"
;
MinText
=
$"-
{((
Average
-
Min
)
/
Average
)
*
100.0
:
F1
}
%"
;
Sigma2Text
=
$"
{(
Sigma2
/
Average
)
*
100.0
:
F1
}
%"
;
}
else
{
MaxText
=
$"
{
Max
:
F1
}
"
;
MinText
=
$"
{
Min
:
F1
}
"
;
Sigma2Text
=
$"
{
Sigma2
:
F1
}
"
;
}
}
protected
void
UpdateAverage
()
{
if
(
this
.
scanData
==
null
)
{
...
...
@@ -417,6 +421,7 @@ namespace FLY.Thick.Blowing.UI.UiModule
{
Pack_GetFrameReponse
reponse
=
retData
as
Pack_GetFrameReponse
;
Mix
=
reponse
.
Request
.
Mix
;
if
(
reponse
.
scanData
!=
null
)
{
this
.
scanData
=
reponse
.
scanData
;
...
...
@@ -427,7 +432,7 @@ namespace FLY.Thick.Blowing.UI.UiModule
},
this
);
}
void
Update4IdChanged2
()
protected
void
Update4IdChanged2
()
{
//清除全部数据
Values
.
Clear
();
...
...
@@ -470,7 +475,7 @@ namespace FLY.Thick.Blowing.UI.UiModule
}
}
void
NotifyPropertyChanged
(
string
propertyName
)
protected
void
NotifyPropertyChanged
(
string
propertyName
)
{
PropertyChanged
?.
Invoke
(
this
,
new
PropertyChangedEventArgs
(
propertyName
));
}
...
...
Project.FLY.Thick.Blowing/FLY.Thick.Blowing.UI/UiModule/ScanGraphCircular/ScanGraphCircularVmUt.cs
View file @
1edad180
...
...
@@ -15,101 +15,110 @@ using System.Windows.Data;
namespace
FLY.Thick.Blowing.UI.UiModule
{
public
class
ScanGraphCircularVmUt
:
INotifyPropertyChanged
public
class
ScanGraphCircularVmUt
:
ScanGraphCircularVm
{
public
event
PropertyChangedEventHandler
PropertyChanged
;
public
ScanGraphCircularVmUt
()
{
#
region
数据
double
target
=
150
;
double
tolerance
=
target
*
0.02
;
double
yrangepercent
=
3
;
int
nbolts
=
80
;
double
[]
datas
=
new
double
[
nbolts
];
Random
random
=
new
Random
();
for
(
int
i
=
0
;
i
<
nbolts
;
i
++)
{
datas
[
i
]
=
(
Math
.
Sin
(
i
*
Math
.
PI
/
nbolts
)
*
3
)
*
tolerance
+
target
+
(
random
.
NextDouble
()
-
0.5
)
*
1
-
6
;
}
#
region
界面统计值
/// <summary>
/// 平均值
/// </summary>
public
double
Average
{
get
;
private
set
;
}
=
double
.
NaN
;
double
[]
datas2
=
new
double
[
nbolts
];
for
(
int
i
=
0
;
i
<
nbolts
;
i
++)
{
datas2
[
i
]
=
(
Math
.
Sin
(
i
*
Math
.
PI
/
nbolts
)
*
3
)
*
tolerance
+
target
+
(
random
.
NextDouble
()
-
0.5
)
*
1
-
6
;
}
public
double
Sigma2
{
get
;
private
set
;
}
=
double
.
NaN
;
/// <summary>
/// 最大值
/// </summary>
public
double
Max
{
get
;
private
set
;
}
=
double
.
NaN
;
/// <summary>
/// 最小值
/// </summary>
public
double
Min
{
get
;
private
set
;
}
=
double
.
NaN
;
profileParam
=
new
Common
.
BlowingFixProfileParam
()
{
Target
=
target
,
TolerancePercent
=
0.02
,
K
=
1
,
PName
=
"abc"
,
OrderNo
=
"12313121"
,
Number
=
"2"
};
graphparam
=
new
ScanGraphCircularParam
()
{
IsPercent
=
true
,
IsAutoTarget
=
true
,
YRangePercent
=
yrangepercent
,
Number
=
-
1
,
Mix
=
2
};
public
string
Sigma2Text
{
get
;
private
set
;
}
public
string
MaxText
{
get
;
private
set
;
}
public
string
MinText
{
get
;
private
set
;
}
/// <summary>
/// 混合数
/// </summary>
public
int
Mix
{
get
;
private
set
;
}
=
2
;
scanData
=
new
Server
.
Model
.
Lc_ScanData
()
{
Time
=
DateTime
.
Now
.
AddSeconds
(-
30
),
EndTime
=
DateTime
.
Now
,
ID
=
1234567
,
K
=
2
,
Thicks
=
datas
,
IsBackw
=
false
,
FilmLength
=
23.3
,
FilmVelocity
=
53.1
,
OrgBoltNo
=
41
,
RAngle
=
355
,
RCnt
=
6
,
RPeriod
=
TimeSpan
.
FromMinutes
(
6.7
)
};
BulkDbTempFrameChangedEventArgs
e
=
new
BulkDbTempFrameChangedEventArgs
()
{
Time
=
DateTime
.
Now
.
AddSeconds
(-
25
),
EndTime
=
DateTime
.
Now
,
StartIndex
=
0
,
D
=
datas2
};
#
endregion
/// <summary>
/// 测量时间
/// </summary>
public
DateTime
Time
{
get
;
private
set
;
}
#
region
界面数据
/// <summary>
/// 旋转方向 是反向
/// </summary>
public
bool
IsBackw
{
get
;
private
set
;
}
/// <summary>
/// 旋转1周的时间
/// </summary>
public
TimeSpan
RPeriod
{
get
;
private
set
;
}
Mix
=
graphparam
.
Mix
;
XStep
=
5
;
BulkDb_TempFrameChanged
(
null
,
e
);
/// <summary>
/// 数据库中的序号
/// </summary>
public
long
Id
{
get
;
private
set
;
}
=
1231221
;
public
int
OrgBoltNo
{
get
;
private
set
;
}
=
-
100
;
Update4IdChanged2
();
#
endregion
UpdateMaxMinText
();
ObservableCollection
<
double
>
Values
{
get
;
}=
new
ObservableCollection
<
double
>();
public
ScanGraphCircularVmUt
()
{
#
region
数据
double
target
=
100
;
double
tolerancePercent
=
0.02
;
double
yrangepercent
=
3
;
int
nbolts
=
80
;
double
[]
datas
=
new
double
[
nbolts
];
Random
random
=
new
Random
();
for
(
int
i
=
0
;
i
<
nbolts
;
i
++)
{
datas
[
i
]
=
(
Math
.
Sin
(
i
*
Math
.
PI
/
nbolts
)
*
3
)
*
(
target
*
tolerancePercent
)
+
target
+
(
random
.
NextDouble
()
-
0.5
)
*
1
-
6
;
}
//graph.SetBinding(PolarChart.TolerancePercentProperty, new Binding(nameof(profileParam.TolerancePercent)) { Source = profileParam });
//graph.SetBinding(PolarChart.TargetProperty, new Binding(nameof(profileParam.Target)) { Source = profileParam });
#
endregion
#
region
界面数据
Mix
=
2
;
Time
=
DateTime
.
Now
;
Id
=
312312
;
OrgBoltNo
=
31
;
Values
.
Clear
();
foreach
(
var
data
in
datas
)
Values
.
Add
(
data
);
Average
=
datas
.
AverageNoNull
();
IsBackw
=
false
;
RPeriod
=
TimeSpan
.
FromSeconds
(
60
*
6.5
);
double
Max
=
datas
.
Max
();
double
Min
=
datas
.
Min
();
double
Sigma2
=
datas
.
Sigma
()
*
2
;
MaxText
=
$"+
{((
Max
-
Average
)
/
Average
)
*
100.0
:
F1
}
%"
;
MinText
=
$"-
{((
Average
-
Min
)
/
Average
)
*
100.0
:
F1
}
%"
;
Sigma2Text
=
$"
{(
Sigma2
/
Average
)
*
100.0
:
F1
}
%"
;
//graph.SetBinding(PolarChart.YRangePercentProperty, new Binding(nameof(graphparam.YRangePercent)) { Source = graphparam });
//graph.SetBinding(PolarChart.IsPercentProperty, new Binding(nameof(graphparam.IsPercent)) { Source = graphparam });
//graph.SetBinding(PolarChart.IsAutoTargetProperty, new Binding(nameof(graphparam.IsAutoTarget)) { Source = graphparam });
//graph.SetBinding(PolarChart.HasAlianZoneProperty, new Binding(nameof(graphparam.HasAlianZone)) { Source = graphparam });
//graph.SetBinding(PolarChart.AlianZoneBoltNoOf3oClockProperty, new Binding(nameof(graphparam.AlianZoneBoltNoOf3oClock)) { Source = graphparam });
//graph.SetBinding(PolarChart.AlianZoneBoltCntProperty, new Binding(nameof(graphparam.AlianZoneBoltCnt)) { Source = graphparam });
//graph.SetBinding(PolarChart.AlianZoneIsCCWProperty, new Binding(nameof(graphparam.AlianZoneIsCCW)) { Source = graphparam });
//graph.SetBinding(PolarChart.AlianZoneIsShowXStepProperty, new Binding(nameof(graphparam.AlianZoneIsShowXStep)) { Source = graphparam });
//graph.BoltCnt = nbolts;
//graph.BPC = 1;
//graph.OrgBoltNo = scanData.OrgBoltNo;
//graph.MPIsRight = true;
//graph.IsForwCW = false;
//graph.XStep = XStep;
#
endregion
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment