Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
T
Thick-Common
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
潘栩锋
Thick-Common
Commits
2ec2ccea
Commit
2ec2ccea
authored
Jun 26, 2021
by
潘栩锋
🚴
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1.GetSample 也变成支持 FObject.Reflect 通讯了
2.删除 FLY.Thick.Base/OBJ_INTERFACE
parent
28b5001c
Hide whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
224 additions
and
922 deletions
+224
-922
PgGetSample.xaml
Project.FLY.Thick.Base/FLY.Thick.Base.UI/PgGetSample.xaml
+1
-30
PgGetSample.xaml.cs
Project.FLY.Thick.Base/FLY.Thick.Base.UI/PgGetSample.xaml.cs
+2
-17
BorderSearchServiceClient.cs
...k.Base/FLY.Thick.Base/Client/BorderSearchServiceClient.cs
+6
-12
CurveServiceClient.cs
...LY.Thick.Base/FLY.Thick.Base/Client/CurveServiceClient.cs
+2
-10
FixServiceClient.cs
....FLY.Thick.Base/FLY.Thick.Base/Client/FixServiceClient.cs
+2
-10
GetSampleServiceClient.cs
...hick.Base/FLY.Thick.Base/Client/GetSampleServiceClient.cs
+21
-178
InitParamServiceClient.cs
...hick.Base/FLY.Thick.Base/Client/InitParamServiceClient.cs
+2
-10
ScanCorrServiceClient.cs
...Thick.Base/FLY.Thick.Base/Client/ScanCorrServiceClient.cs
+15
-20
FLY.Thick.Base.csproj
Project.FLY.Thick.Base/FLY.Thick.Base/FLY.Thick.Base.csproj
+4
-5
IGetSampleService.cs
...Y.Thick.Base/FLY.Thick.Base/IService/IGetSampleService.cs
+72
-34
CURVE_OBJ_INTERFACE.cs
....Base/FLY.Thick.Base/OBJ_INTERFACE/CURVE_OBJ_INTERFACE.cs
+0
-43
FIX_OBJ_INTERFACEC.cs
...k.Base/FLY.Thick.Base/OBJ_INTERFACE/FIX_OBJ_INTERFACEC.cs
+0
-28
GETSAMPLE_OBJ_INTERFACE.cs
...e/FLY.Thick.Base/OBJ_INTERFACE/GETSAMPLE_OBJ_INTERFACE.cs
+0
-88
SCANCORR_OBJ_INTERFACE.cs
...se/FLY.Thick.Base/OBJ_INTERFACE/SCANCORR_OBJ_INTERFACE.cs
+0
-151
GetSample_OBJProxy.cs
...Base/FLY.Thick.Base/Server.OBJProxy/GetSample_OBJProxy.cs
+0
-243
GetSample.cs
Project.FLY.Thick.Base/FLY.Thick.Base/Server/GetSample.cs
+97
-43
No files found.
Project.FLY.Thick.Base/FLY.Thick.Base.UI/PgGetSample.xaml
View file @
2ec2ccea
...
@@ -297,39 +297,10 @@
...
@@ -297,39 +297,10 @@
</StackPanel>
</StackPanel>
</StackPanel>
</StackPanel>
<StackPanel Orientation="Horizontal">
<Button Style="{StaticResource ButtonStyle3}" MinHeight="100" Margin="0,5,5,5" Width="150" Command="{Binding GetTempDataCmd}" >
<TextBlock Style="{StaticResource TextBlockStyle_ItemHeader}" Text="获取采集
过程" />
</Button>
<StackPanel Orientation="Horizontal">
<ItemsControl x:Name="tempdatas" >
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<StackPanel Orientation="Horizontal"/>
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate>
<DataTemplate>
<DataGrid ItemsSource="{Binding .}" IsReadOnly="True" Margin="{StaticResource ControlMargin}" AutoGenerateColumns="False" Width="400" TextBlock.FontSize="12" TextBlock.FontWeight="Normal"
>
<DataGrid.Columns>
<DataGridTextColumn Header="时间" Binding="{Binding Time,StringFormat={}{0:HH:mm:ss}}" FontSize="10" Width="100"/>
<DataGridTextColumn Header="AD" Binding="{Binding Ad}" Width="100"/>
<DataGridTextColumn Header="滤波AD" Binding="{Binding FilterAd}" Width="100"/>
<DataGridTextColumn Header="异常" Binding="{Binding IsReset}" Width="100"/>
</DataGrid.Columns>
</DataGrid>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</StackPanel>
</StackPanel>
</StackPanel>
</StackPanel>
</ScrollViewer>
</ScrollViewer>
<Button Style="{StaticResource
ButtonStyle_a
pply}" VerticalAlignment="Bottom" Margin="0,0,20,-45"
<Button Style="{StaticResource
Styles.Button.A
pply}" VerticalAlignment="Bottom" Margin="0,0,20,-45"
Command="{Binding ApplyCmd}"/>
Command="{Binding ApplyCmd}"/>
</Grid>
</Grid>
</Page>
</Page>
Project.FLY.Thick.Base/FLY.Thick.Base.UI/PgGetSample.xaml.cs
View file @
2ec2ccea
...
@@ -42,7 +42,7 @@ namespace FLY.Thick.Base.UI
...
@@ -42,7 +42,7 @@ namespace FLY.Thick.Base.UI
this
.
container
=
container
;
this
.
container
=
container
;
viewModel
=
new
GetSampleVm
();
viewModel
=
new
GetSampleVm
();
viewModel
.
Init
(
getSampleService
,
gageInfoService
,
tempdatas
);
viewModel
.
Init
(
getSampleService
,
gageInfoService
);
this
.
DataContext
=
viewModel
;
this
.
DataContext
=
viewModel
;
this
.
grid_initparam
.
DataContext
=
this
.
initParamService
;
this
.
grid_initparam
.
DataContext
=
this
.
initParamService
;
}
}
...
@@ -110,7 +110,6 @@ namespace FLY.Thick.Base.UI
...
@@ -110,7 +110,6 @@ namespace FLY.Thick.Base.UI
#
region
Command
#
region
Command
public
RelayCommand
ApplyCmd
{
get
;
}
public
RelayCommand
ApplyCmd
{
get
;
}
public
RelayCommand
GetOrgAdCmd
{
get
;
}
public
RelayCommand
GetOrgAdCmd
{
get
;
}
public
RelayCommand
GetTempDataCmd
{
get
;
}
#
endregion
#
endregion
public
event
PropertyChangedEventHandler
PropertyChanged
;
public
event
PropertyChangedEventHandler
PropertyChanged
;
...
@@ -121,7 +120,6 @@ namespace FLY.Thick.Base.UI
...
@@ -121,7 +120,6 @@ namespace FLY.Thick.Base.UI
public
GetSampleVm
()
public
GetSampleVm
()
{
{
ApplyCmd
=
new
RelayCommand
(
Apply
);
ApplyCmd
=
new
RelayCommand
(
Apply
);
GetTempDataCmd
=
new
RelayCommand
(
GetTempData
);
}
}
...
@@ -129,13 +127,11 @@ namespace FLY.Thick.Base.UI
...
@@ -129,13 +127,11 @@ namespace FLY.Thick.Base.UI
[
InjectionMethod
]
[
InjectionMethod
]
public
void
Init
(
public
void
Init
(
IGetSampleService
getSampleService
,
IGetSampleService
getSampleService
,
IGageInfoService
gageInfoService
,
IGageInfoService
gageInfoService
)
ItemsControl
tempdatas
)
{
{
this
.
getSampleService
=
getSampleService
;
this
.
getSampleService
=
getSampleService
;
this
.
gageInfoService
=
gageInfoService
;
this
.
gageInfoService
=
gageInfoService
;
this
.
tempdatas
=
tempdatas
;
Misc
.
BindingOperations
.
SetBinding
(
this
.
getSampleService
,
nameof
(
this
.
getSampleService
.
Enable
),
this
,
nameof
(
Enable
));
Misc
.
BindingOperations
.
SetBinding
(
this
.
getSampleService
,
nameof
(
this
.
getSampleService
.
Enable
),
this
,
nameof
(
Enable
));
Misc
.
BindingOperations
.
SetBinding
(
this
.
getSampleService
,
nameof
(
this
.
getSampleService
.
Velocity
),
this
,
nameof
(
Velocity
));
Misc
.
BindingOperations
.
SetBinding
(
this
.
getSampleService
,
nameof
(
this
.
getSampleService
.
Velocity
),
this
,
nameof
(
Velocity
));
Misc
.
BindingOperations
.
SetBinding
(
this
.
getSampleService
,
nameof
(
this
.
getSampleService
.
Range
),
this
,
nameof
(
Range
));
Misc
.
BindingOperations
.
SetBinding
(
this
.
getSampleService
,
nameof
(
this
.
getSampleService
.
Range
),
this
,
nameof
(
Range
));
...
@@ -212,17 +208,6 @@ namespace FLY.Thick.Base.UI
...
@@ -212,17 +208,6 @@ namespace FLY.Thick.Base.UI
TimeSpan
.
FromSeconds
(
2
));
TimeSpan
.
FromSeconds
(
2
));
}
}
private
void
GetTempData
()
{
getSampleService
.
GetTempFilterDatas
((
asyncContext
,
retData
)
=>
{
var
ll
=
retData
as
List
<
List
<
TempFilterData
>>;
tempdatas
.
ItemsSource
=
ll
;
FLY
.
ControlLibrary
.
Window_Tip
.
Show
(
"加载完成"
,
$"共加载
{
ll
.
Count
()}
列数据"
,
TimeSpan
.
FromSeconds
(
2
));
},
null
);
}
}
}
public
class
GetSampleVmUt
:
INotifyPropertyChanged
public
class
GetSampleVmUt
:
INotifyPropertyChanged
{
{
...
...
Project.FLY.Thick.Base/FLY.Thick.Base/Client/BorderSearchServiceClient.cs
View file @
2ec2ccea
using
System
;
using
FLY.Thick.Base.IService
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Text
;
using
System.ComponentModel
;
using
Misc
;
using
FObjBase
;
using
FObjBase
;
using
FLY.Thick.Base.IService
;
using
Misc
;
using
FLY.Thick.Base.OBJ_INTERFACE
;
using
System
;
using
FLY.Thick.Base.Common
;
namespace
FLY.Thick.Base.Client
namespace
FLY.Thick.Base.Client
{
{
/// <summary>
/// <summary>
/// 边界查找服务 客户代理
/// 边界查找服务 客户代理
/// </summary>
/// </summary>
public
class
BorderSearchServiceClient
:
FObjBase
.
Reflect
.
Reflect_SeviceClient
,
IBorderSearchService
public
class
BorderSearchServiceClient
:
FObjBase
.
Reflect
.
Reflect_SeviceClient
,
IBorderSearchService
{
{
protected
override
Type
InterfaceType
=>
typeof
(
IBorderSearchService
);
protected
override
Type
InterfaceType
=>
typeof
(
IBorderSearchService
);
/// <summary>
/// <summary>
...
@@ -44,7 +38,7 @@ namespace FLY.Thick.Base.Client
...
@@ -44,7 +38,7 @@ namespace FLY.Thick.Base.Client
/// </summary>
/// </summary>
public
bool
IsBreakDetect
{
get
;
set
;
}
=
true
;
public
bool
IsBreakDetect
{
get
;
set
;
}
=
true
;
public
RangeStruct
Valid
{
get
;
set
;
}
public
RangeStruct
Valid
{
get
;
set
;
}
public
Range
Border_Backw
{
get
;
set
;
}
=
new
Range
();
public
Range
Border_Backw
{
get
;
set
;
}
=
new
Range
();
...
@@ -113,7 +107,7 @@ namespace FLY.Thick.Base.Client
...
@@ -113,7 +107,7 @@ namespace FLY.Thick.Base.Client
{
{
Call
(
nameof
(
GetView
),
null
,
asyncDelegate
,
asyncContext
);
Call
(
nameof
(
GetView
),
null
,
asyncDelegate
,
asyncContext
);
}
}
public
void
Apply
()
public
void
Apply
()
{
{
Call
(
nameof
(
Apply
));
Call
(
nameof
(
Apply
));
}
}
...
...
Project.FLY.Thick.Base/FLY.Thick.Base/Client/CurveServiceClient.cs
View file @
2ec2ccea
using
System
;
using
FLY.Thick.Base.Common
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Text
;
using
System.Collections.ObjectModel
;
using
System.ComponentModel
;
using
FObjBase
;
using
FLY.Thick.Base.IService
;
using
FLY.Thick.Base.IService
;
using
FLY.Thick.Base.Common
;
using
System
;
using
FLY.Thick.Base.OBJ_INTERFACE
;
namespace
FLY.Thick.Base.Client
namespace
FLY.Thick.Base.Client
{
{
...
...
Project.FLY.Thick.Base/FLY.Thick.Base/Client/FixServiceClient.cs
View file @
2ec2ccea
using
System
;
using
FLY.Thick.Base.IService
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Text
;
using
System.ComponentModel
;
using
System.Net
;
using
FObjBase
;
using
FObjBase
;
using
FLY.Thick.Base.IService
;
using
FLY.Thick.Base.OBJ_INTERFACE
;
using
FLY.Thick.Base.Common
;
using
FObjBase.Reflect
;
using
FObjBase.Reflect
;
using
System
;
namespace
FLY.Thick.Base.Client
namespace
FLY.Thick.Base.Client
{
{
...
...
Project.FLY.Thick.Base/FLY.Thick.Base/Client/GetSampleServiceClient.cs
View file @
2ec2ccea
using
System
;
using
FLY.Thick.Base.IService
;
using
System
.Collections.Generic
;
using
System
;
using
System.Linq
;
using
System.Linq
;
using
System.Text
;
using
System.ComponentModel
;
using
FObjBase
;
using
FLY.Thick.Base.IService
;
using
FLY.Thick.Base.OBJ_INTERFACE
;
using
FLY.Thick.Base.Common
;
using
PropertyChanged
;
using
Newtonsoft.Json
;
namespace
FLY.Thick.Base.Client
namespace
FLY.Thick.Base.Client
{
{
/// <summary>
/// <summary>
/// 样品采样服务 客户代理
/// 样品采样服务 客户代理
/// </summary>
/// </summary>
[
JsonObject
(
MemberSerialization
.
OptIn
)]
public
class
GetSampleServiceClient
:
FObjBase
.
Reflect
.
Reflect_SeviceClient
,
IGetSampleService
public
class
GetSampleServiceClient
:
FObjServiceClient
,
IGetSampleService
{
{
protected
override
Type
InterfaceType
=>
typeof
(
IGetSampleService
);
/// <summary>
/// 边界查找服务 构造
/// </summary>
/// <param name="id"></param>
public
GetSampleServiceClient
(
UInt32
id
)
:
base
(
id
)
{
init
();
}
/// <summary>
/// 边界查找服务 构造
/// </summary>
/// <param name="serviceId">服务id</param>
/// <param name="connName">连接器</param>
public
GetSampleServiceClient
(
UInt32
serviceId
,
string
connName
)
:
base
(
serviceId
,
connName
)
{
init
();
}
#
region
IGetSampleService
成员
#
region
IGetSampleService
成员
/// <summary>
/// <summary>
/// 参数:使能
/// 参数:使能
/// </summary>
/// </summary>
[
JsonProperty
]
public
bool
Enable
{
get
;
set
;
}
public
bool
Enable
{
get
;
set
;
}
/// <summary>
/// <summary>
/// 参数:速度
/// 参数:速度
/// </summary>
/// </summary>
[
JsonProperty
]
public
UInt32
Velocity
{
get
;
set
;
}
public
UInt32
Velocity
{
get
;
set
;
}
/// <summary>
/// <summary>
/// 参数:样品点范围
/// 参数:样品点范围
/// </summary>
/// </summary>
[
JsonProperty
]
public
int
Range
{
get
;
set
;
}
public
int
Range
{
get
;
set
;
}
/// <summary>
/// <summary>
/// 滤波窗口
/// 滤波窗口
/// </summary>
/// </summary>
[
JsonProperty
]
public
int
Window
{
get
;
set
;
}
public
int
Window
{
get
;
set
;
}
/// <summary>
/// <summary>
/// 使用%方式检查异常
/// 使用%方式检查异常
/// </summary>
/// </summary>
[
JsonProperty
]
public
bool
IsCheckByPercent
{
get
;
set
;
}
=
true
;
public
bool
IsCheckByPercent
{
get
;
set
;
}
=
true
;
/// <summary>
/// <summary>
/// 异常% 单位%
/// 异常% 单位%
/// </summary>
/// </summary>
[
JsonProperty
]
public
double
ErrPercent
{
get
;
set
;
}
=
2
;
public
double
ErrPercent
{
get
;
set
;
}
=
2
;
/// <summary>
/// <summary>
/// 异常值
/// 异常值
/// </summary>
/// </summary>
[
JsonProperty
]
public
int
ErrValue
{
get
;
set
;
}
=
200
;
public
int
ErrValue
{
get
;
set
;
}
=
200
;
/// <summary>
/// <summary>
/// 样品
/// 样品
/// </summary>
/// </summary>
[
JsonProperty
]
public
SampleCell
[]
Samples
{
get
;
set
;
}
=
new
SampleCell
[
3
];
public
SampleCell
[]
Samples
{
get
;
set
;
}
=
new
SampleCell
[
3
];
/// <summary>
/// <summary>
/// 查找公差
/// 查找公差
/// </summary>
/// </summary>
[
JsonProperty
]
public
int
Search
{
get
;
set
;
}
public
int
Search
{
get
;
set
;
}
/// <summary>
/// <summary>
/// 特征 相识度 0 正, 1 反
/// 特征 相识度 0 正, 1 反
/// </summary>
/// </summary>
[
JsonProperty
]
public
SampleFeature
[]
Features
{
get
;
set
;
}
=
new
SampleFeature
[
2
];
public
SampleFeature
[]
Features
{
get
;
set
;
}
=
new
SampleFeature
[
2
];
/// <summary>
/// 状态:从flyad7 得到的。 用于绘制图
/// </summary>
[
JsonProperty
]
public
int
PosOfGrid
{
get
;
set
;
}
=
10
;
/// <summary>
/// <summary>
///
///
/// </summary>
/// </summary>
public
void
Apply
()
public
void
Apply
()
{
{
GETSAMPLE_OBJ_INTERFACE
.
Pack_Params
p
=
new
GETSAMPLE_OBJ_INTERFACE
.
Pack_Params
Call
(
nameof
(
Apply
));
{
enable
=
Enable
,
velocity
=
Velocity
,
range
=
Range
,
window
=
Window
,
IsCheckByPercent
=
IsCheckByPercent
,
ErrPercent
=
ErrPercent
,
ErrValue
=
ErrValue
,
search
=
Search
,
samples
=
from
sample
in
Samples
select
new
GETSAMPLE_OBJ_INTERFACE
.
Pack_Params_SampleCell
()
{
enable
=
sample
.
Enable
,
justForCheck
=
sample
.
JustForCheck
,
orgad
=
sample
.
OrgAD
,
position
=
sample
.
Position
},
features
=
from
feature
in
Features
select
new
GETSAMPLE_OBJ_INTERFACE
.
Pack_Params_SampleFeature
()
{
enable
=
feature
.
Enable
,
startpos
=
feature
.
StartPos
,
endpos
=
feature
.
EndPos
}
};
string
json
=
Newtonsoft
.
Json
.
JsonConvert
.
SerializeObject
(
p
);
//获取所有数据,设置推送
CurrObjSys
.
SetValueEx
(
mConn
,
mServerID
,
ID
,
GETSAMPLE_OBJ_INTERFACE
.
SET_PARAMS
,
Misc
.
Converter
.
StringToBytes
(
json
)
);
}
}
#
endregion
#
endregion
public
GetSampleServiceClient
(
UInt32
id
)
:
base
(
id
)
{
init
();
}
public
GetSampleServiceClient
(
UInt32
serviceId
,
string
connName
)
:
base
(
serviceId
,
connName
)
{
init
();
}
void
init
()
void
init
()
{
{
...
@@ -146,115 +98,6 @@ namespace FLY.Thick.Base.Client
...
@@ -146,115 +98,6 @@ namespace FLY.Thick.Base.Client
Features
[
i
]
=
new
SampleFeature
();
Features
[
i
]
=
new
SampleFeature
();
}
}
public
override
void
ConnectNotify
(
IFConn
from
)
{
base
.
ConnectNotify
(
from
);
if
(
from
.
IsConnected
)
{
//获取所有数据,设置推送
CurrObjSys
.
GetValueEx
(
mConn
,
mServerID
,
ID
,
GETSAMPLE_OBJ_INTERFACE
.
GET_PARAMS
);
CurrObjSys
.
GetValueEx
(
mConn
,
mServerID
,
ID
,
GETSAMPLE_OBJ_INTERFACE
.
GET_STATE
);
CurrObjSys
.
SenseConfigEx
(
mConn
,
mServerID
,
ID
,
0xffffffff
,
SENSE_CONFIG
.
ADD
);
}
}
public
override
void
PushGetValue
(
IFConn
from
,
uint
srcid
,
ushort
memid
,
byte
[]
infodata
)
{
switch
(
memid
)
{
case
GETSAMPLE_OBJ_INTERFACE
.
GET_PARAMS
:
{
string
json
=
Misc
.
Converter
.
BytesToString
(
infodata
);
var
p
=
Newtonsoft
.
Json
.
JsonConvert
.
DeserializeObject
<
GETSAMPLE_OBJ_INTERFACE
.
Pack_Params
>(
json
);
Enable
=
p
.
enable
;
Range
=
p
.
range
;
Velocity
=
p
.
velocity
;
Window
=
p
.
window
;
IsCheckByPercent
=
p
.
IsCheckByPercent
;
ErrPercent
=
p
.
ErrPercent
;
ErrValue
=
p
.
ErrValue
;
for
(
int
i
=
0
;
i
<
Samples
.
Count
()
&&
i
<
p
.
samples
.
Count
();
i
++)
{
var
sample_src
=
p
.
samples
.
ElementAt
(
i
);
var
sample_desp
=
Samples
[
i
];
sample_desp
.
Enable
=
sample_src
.
enable
;
sample_desp
.
JustForCheck
=
sample_src
.
justForCheck
;
sample_desp
.
OrgAD
=
sample_src
.
orgad
;
sample_desp
.
Position
=
sample_src
.
position
;
}
Search
=
p
.
search
;
for
(
int
i
=
0
;
i
<
Features
.
Count
()
&&
i
<
p
.
features
.
Count
();
i
++)
{
var
feature_src
=
p
.
features
.
ElementAt
(
i
);
var
feature_desp
=
Features
[
i
];
feature_desp
.
Enable
=
feature_src
.
enable
;
feature_desp
.
StartPos
=
feature_src
.
startpos
;
feature_desp
.
EndPos
=
feature_src
.
endpos
;
}
}
break
;
case
GETSAMPLE_OBJ_INTERFACE
.
GET_STATE
:
{
string
json
=
Misc
.
Converter
.
BytesToString
(
infodata
);
var
p
=
Newtonsoft
.
Json
.
JsonConvert
.
DeserializeObject
<
GETSAMPLE_OBJ_INTERFACE
.
Pack_State
>(
json
);
PosOfGrid
=
p
.
posOfGrid
;
for
(
int
i
=
0
;
i
<
Samples
.
Count
()
&&
i
<
p
.
samples
.
Count
();
i
++)
{
var
sample_src
=
p
.
samples
.
ElementAt
(
i
);
var
sample_desp
=
Samples
[
i
];
sample_desp
.
AD
=
sample_src
.
ad
;
sample_desp
.
SampleValue
=
sample_src
.
value
;
}
for
(
int
i
=
0
;
i
<
Features
.
Count
()
&&
i
<
p
.
features
.
Count
();
i
++)
{
var
feature_src
=
p
.
features
.
ElementAt
(
i
);
var
feature_desp
=
Features
[
i
];
feature_desp
.
MaxRelevancy
=
feature_src
.
maxRelevancy
;
feature_desp
.
MaxOffset
=
feature_src
.
maxOffset
;
feature_desp
.
ScanData
=
feature_src
.
scanData
;
}
}
break
;
}
}
public
override
void
PushInfo
(
IFConn
from
,
uint
srcid
,
ushort
infoid
,
byte
[]
infodata
)
{
PushGetValue
(
from
,
srcid
,
infoid
,
infodata
);
}
public
override
void
PushCallFunction
(
IFConn
from
,
uint
srcid
,
uint
magic
,
ushort
funcid
,
byte
[]
retdata
,
object
AsyncDelegate
,
object
AsyncState
)
{
switch
(
funcid
)
{
case
GETSAMPLE_OBJ_INTERFACE
.
CALL_GET_TEMPDATAS
:
{
string
json
=
Misc
.
Converter
.
BytesToString
(
retdata
);
var
reponse
=
Newtonsoft
.
Json
.
JsonConvert
.
DeserializeObject
<
List
<
List
<
TempFilterData
>>>(
json
);
(
AsyncDelegate
as
AsyncCBHandler
)(
AsyncState
,
reponse
);
}
break
;
}
}
public
void
GetTempFilterDatas
(
AsyncCBHandler
asyncCB
,
object
asyncContext
)
{
CurrObjSys
.
CallFunctionEx
(
mConn
,
mServerID
,
ID
,
GETSAMPLE_OBJ_INTERFACE
.
CALL_GET_TEMPDATAS
,
null
,
asyncCB
,
asyncContext
);
}
}
}
}
}
Project.FLY.Thick.Base/FLY.Thick.Base/Client/InitParamServiceClient.cs
View file @
2ec2ccea
using
System
;
using
FLY.Thick.Base.Common
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Text
;
using
System.ComponentModel
;
using
FObjBase
;
using
FLY.Thick.Base.IService
;
using
FLY.Thick.Base.IService
;
using
FLY.Thick.Base.OBJ_INTERFACE
;
using
System
;
using
FLY.Thick.Base.Common
;
using
Newtonsoft.Json
;
using
FLY.OBJComponents.Client
;
namespace
FLY.Thick.Base.Client
namespace
FLY.Thick.Base.Client
{
{
...
...
Project.FLY.Thick.Base/FLY.Thick.Base/Client/ScanCorrServiceClient.cs
View file @
2ec2ccea
using
System
;
using
FLY.Thick.Base.IService
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Text
;
using
System.ComponentModel
;
using
System.Collections.ObjectModel
;
using
FObjBase
;
using
FObjBase
;
using
FLY.Thick.Base.IService
;
using
FLY.Thick.Base.OBJ_INTERFACE
;
using
FLY.Thick.Base.Common
;
using
Newtonsoft.Json
;
using
FObjBase.Reflect
;
using
FObjBase.Reflect
;
using
System
;
namespace
FLY.Thick.Base.Client
namespace
FLY.Thick.Base.Client
{
{
...
@@ -20,10 +10,11 @@ namespace FLY.Thick.Base.Client
...
@@ -20,10 +10,11 @@ namespace FLY.Thick.Base.Client
protected
override
Type
InterfaceType
=>
typeof
(
IScanCorrService
);
protected
override
Type
InterfaceType
=>
typeof
(
IScanCorrService
);
public
ScanCorrServiceClient
(
UInt32
serviceId
)
:
base
(
serviceId
)
public
ScanCorrServiceClient
(
UInt32
serviceId
)
:
base
(
serviceId
)
{
{
}
}
public
ScanCorrServiceClient
(
UInt32
serviceId
,
string
connName
)
:
base
(
serviceId
,
connName
)
{
public
ScanCorrServiceClient
(
UInt32
serviceId
,
string
connName
)
:
base
(
serviceId
,
connName
)
{
}
}
/// <summary>
/// <summary>
...
@@ -65,7 +56,8 @@ namespace FLY.Thick.Base.Client
...
@@ -65,7 +56,8 @@ namespace FLY.Thick.Base.Client
/// <param name="groupIndex">组序号</param>
/// <param name="groupIndex">组序号</param>
/// <param name="scanCnt">扫描次数</param>
/// <param name="scanCnt">扫描次数</param>
/// <param name="smoothFactor">平滑</param>
/// <param name="smoothFactor">平滑</param>
public
void
Start
(
int
groupIndex
,
int
scanCnt
,
int
smoothFactor
)
{
public
void
Start
(
int
groupIndex
,
int
scanCnt
,
int
smoothFactor
)
{
Call
(
nameof
(
Start
),
new
{
groupIndex
=
groupIndex
,
scanCnt
=
scanCnt
,
smoothFactor
=
smoothFactor
});
Call
(
nameof
(
Start
),
new
{
groupIndex
=
groupIndex
,
scanCnt
=
scanCnt
,
smoothFactor
=
smoothFactor
});
}
}
...
@@ -73,7 +65,8 @@ namespace FLY.Thick.Base.Client
...
@@ -73,7 +65,8 @@ namespace FLY.Thick.Base.Client
/// 清空组数据
/// 清空组数据
/// </summary>
/// </summary>
/// <param name="groupIndex"></param>
/// <param name="groupIndex"></param>
public
void
Clear
(
int
groupIndex
)
{
public
void
Clear
(
int
groupIndex
)
{
Call
(
nameof
(
Clear
),
new
{
groupIndex
=
groupIndex
});
Call
(
nameof
(
Clear
),
new
{
groupIndex
=
groupIndex
});
}
}
...
@@ -83,13 +76,15 @@ namespace FLY.Thick.Base.Client
...
@@ -83,13 +76,15 @@ namespace FLY.Thick.Base.Client
/// <param name="groupIndex">组序号</param>
/// <param name="groupIndex">组序号</param>
/// <param name="corrDatas">修正数据</param>
/// <param name="corrDatas">修正数据</param>
/// <param name="avg">均值</param>
/// <param name="avg">均值</param>
public
void
SetCorrData
(
int
groupIndex
,
int
[][]
corrDatas
,
int
avg
)
{
public
void
SetCorrData
(
int
groupIndex
,
int
[][]
corrDatas
,
int
avg
)
Call
(
nameof
(
SetCorrData
),
new
{
groupIndex
=
groupIndex
,
corrDatas
=
corrDatas
,
avg
=
avg
});
{
Call
(
nameof
(
SetCorrData
),
new
{
groupIndex
=
groupIndex
,
corrDatas
=
corrDatas
,
avg
=
avg
});
}
}
[
Call
(
typeof
(
GetScanCorrGroupResponse
))]
[
Call
(
typeof
(
GetScanCorrGroupResponse
))]
public
void
GetScanCorrGroup
(
int
groupIndex
,
AsyncCBHandler
asyncDelegate
,
object
asyncContext
)
{
public
void
GetScanCorrGroup
(
int
groupIndex
,
AsyncCBHandler
asyncDelegate
,
object
asyncContext
)
{
Call
(
nameof
(
GetScanCorrGroup
),
new
{
groupIndex
=
groupIndex
},
asyncDelegate
,
asyncContext
);
Call
(
nameof
(
GetScanCorrGroup
),
new
{
groupIndex
=
groupIndex
},
asyncDelegate
,
asyncContext
);
}
}
...
...
Project.FLY.Thick.Base/FLY.Thick.Base/FLY.Thick.Base.csproj
View file @
2ec2ccea
...
@@ -91,12 +91,7 @@
...
@@ -91,12 +91,7 @@
<Compile
Include=
"IService\IRejectService.cs"
/>
<Compile
Include=
"IService\IRejectService.cs"
/>
<Compile
Include=
"IService\IScanCorrService.cs"
/>
<Compile
Include=
"IService\IScanCorrService.cs"
/>
<Compile
Include=
"IService\ITDGageService.cs"
/>
<Compile
Include=
"IService\ITDGageService.cs"
/>
<Compile
Include=
"OBJ_INTERFACE\CURVE_OBJ_INTERFACE.cs"
/>
<Compile
Include=
"OBJ_INTERFACE\FIX_OBJ_INTERFACEC.cs"
/>
<Compile
Include=
"OBJ_INTERFACE\GETSAMPLE_OBJ_INTERFACE.cs"
/>
<Compile
Include=
"OBJ_INTERFACE\SCANCORR_OBJ_INTERFACE.cs"
/>
<Compile
Include=
"Properties\AssemblyInfo.cs"
/>
<Compile
Include=
"Properties\AssemblyInfo.cs"
/>
<Compile
Include=
"Server.OBJProxy\GetSample_OBJProxy.cs"
/>
<Compile
Include=
"Server\BoltMapImg.cs"
/>
<Compile
Include=
"Server\BoltMapImg.cs"
/>
<Compile
Include=
"Server\BorderSearch.cs"
/>
<Compile
Include=
"Server\BorderSearch.cs"
/>
<Compile
Include=
"Server\CurveCollection.cs"
/>
<Compile
Include=
"Server\CurveCollection.cs"
/>
...
@@ -168,6 +163,10 @@
...
@@ -168,6 +163,10 @@
<Link>
.editorconfig
</Link>
<Link>
.editorconfig
</Link>
</None>
</None>
</ItemGroup>
</ItemGroup>
<ItemGroup>
<Folder
Include=
"OBJ_INTERFACE\"
/>
<Folder
Include=
"Server.OBJProxy\"
/>
</ItemGroup>
<Import
Project=
"$(MSBuildToolsPath)\Microsoft.CSharp.targets"
/>
<Import
Project=
"$(MSBuildToolsPath)\Microsoft.CSharp.targets"
/>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
Other similar extension points exist, see Microsoft.Common.targets.
...
...
Project.FLY.Thick.Base/FLY.Thick.Base/IService/IGetSampleService.cs
View file @
2ec2ccea
...
@@ -7,6 +7,7 @@ using System.ComponentModel;
...
@@ -7,6 +7,7 @@ using System.ComponentModel;
using
Newtonsoft.Json
;
using
Newtonsoft.Json
;
using
PropertyChanged
;
using
PropertyChanged
;
using
FObjBase
;
using
FObjBase
;
using
FObjBase.Reflect
;
namespace
FLY.Thick.Base.IService
namespace
FLY.Thick.Base.IService
{
{
...
@@ -20,8 +21,6 @@ namespace FLY.Thick.Base.IService
...
@@ -20,8 +21,6 @@ namespace FLY.Thick.Base.IService
/// </summary>
/// </summary>
bool
Enable
{
get
;
set
;
}
bool
Enable
{
get
;
set
;
}
/// <summary>
/// <summary>
/// 参数:速度
/// 参数:速度
/// </summary>
/// </summary>
...
@@ -49,38 +48,31 @@ namespace FLY.Thick.Base.IService
...
@@ -49,38 +48,31 @@ namespace FLY.Thick.Base.IService
/// 异常值
/// 异常值
/// </summary>
/// </summary>
int
ErrValue
{
get
;
set
;
}
int
ErrValue
{
get
;
set
;
}
/// <summary>
/// <summary>
/// 参数:样品点参数
/// 参数:样品点参数
/// </summary>
/// </summary>
[
PropertyPush
]
SampleCell
[]
Samples
{
get
;
}
SampleCell
[]
Samples
{
get
;
}
/// <summary>
/// <summary>
/// 参数:特征查找范围
/// 参数:特征查找范围
/// </summary>
/// </summary>
int
Search
{
get
;
set
;
}
int
Search
{
get
;
set
;
}
/// <summary>
/// <summary>
/// 参数:特征参数
/// 参数:特征参数
/// </summary>
/// </summary>
[
PropertyPush
]
SampleFeature
[]
Features
{
get
;
}
SampleFeature
[]
Features
{
get
;
}
/// <summary>
/// 状态:从flyad7 得到的。 用于绘制图
/// </summary>
int
PosOfGrid
{
get
;
set
;}
/// <summary>
/// <summary>
/// 应用
/// 应用
/// </summary>
/// </summary>
void
Apply
();
void
Apply
();
/// <summary>
/// 返回 List(List(TempFilterData))
/// </summary>
/// <param name="asyncCB"></param>
/// <param name="asyncContext"></param>
void
GetTempFilterDatas
(
AsyncCBHandler
asyncCB
,
object
asyncContext
);
}
}
/// <summary>
/// <summary>
/// 采样记录
/// 采样记录
/// </summary>
/// </summary>
...
@@ -103,36 +95,65 @@ namespace FLY.Thick.Base.IService
...
@@ -103,36 +95,65 @@ namespace FLY.Thick.Base.IService
/// </summary>
/// </summary>
public
bool
IsReset
{
get
;
set
;
}
public
bool
IsReset
{
get
;
set
;
}
}
}
/// <summary>
/// 样品点 参数
/// </summary>
public
class
SampleCellParam
:
INotifyPropertyChanged
{
/// <summary>
/// 参数:使能
/// </summary>
public
bool
Enable
{
get
;
set
;
}
/// <summary>
/// 参数:只检查不标定
/// </summary>
public
bool
JustForCheck
{
get
;
set
;
}
/// <summary>
/// 参数:原始AD值
/// </summary>
public
int
OrgAD
{
get
;
set
;
}
/// <summary>
/// 参数:位置
/// </summary>
public
int
Position
{
get
;
set
;
}
#
region
INotifyPropertyChanged
成员
public
event
PropertyChangedEventHandler
PropertyChanged
;
#
endregion
}
/// <summary>
/// <summary>
/// 样品点
/// 样品点
/// </summary>
/// </summary>
[
JsonObject
(
MemberSerialization
.
OptIn
)]
public
class
SampleCell
:
INotifyPropertyChanged
public
class
SampleCell
:
INotifyPropertyChanged
{
{
/// <summary>
/// <summary>
/// 参数:使能
/// 参数:使能
/// </summary>
/// </summary>
[
JsonProperty
]
public
bool
Enable
{
get
;
set
;
}
public
bool
Enable
{
get
;
set
;
}
/// <summary>
/// <summary>
/// 参数:只检查不标定
/// 参数:只检查不标定
/// </summary>
/// </summary>
[
JsonProperty
]
public
bool
JustForCheck
{
get
;
set
;
}
public
bool
JustForCheck
{
get
;
set
;
}
/// <summary>
/// <summary>
/// 参数:原始AD值
/// 参数:原始AD值
/// </summary>
/// </summary>
[
JsonProperty
]
public
int
OrgAD
{
get
;
set
;
}
public
int
OrgAD
{
get
;
set
;
}
/// <summary>
/// <summary>
/// 参数:位置
/// 参数:位置
/// </summary>
/// </summary>
[
JsonProperty
]
public
int
Position
{
get
;
set
;
}
public
int
Position
{
get
;
set
;
}
/// <summary>
/// <summary>
...
@@ -157,33 +178,57 @@ namespace FLY.Thick.Base.IService
...
@@ -157,33 +178,57 @@ namespace FLY.Thick.Base.IService
#
endregion
#
endregion
}
}
/// <summary>
/// 样品正向校正特征
/// </summary>
public
class
SampleFeatureParam
:
INotifyPropertyChanged
{
/// <summary>
/// 参数:使能
/// </summary>
public
bool
Enable
{
get
;
set
;
}
/// <summary>
/// 参数:开始位置
/// </summary>
public
int
StartPos
{
get
;
set
;
}
/// <summary>
/// 参数:结束位置
/// </summary>
public
int
EndPos
{
get
;
set
;
}
#
region
INotifyPropertyChanged
成员
public
event
PropertyChangedEventHandler
PropertyChanged
;
#
endregion
}
/// <summary>
/// <summary>
/// 样品正向校正特征
/// 样品正向校正特征
/// </summary>
/// </summary>
[
JsonObject
(
MemberSerialization
.
OptIn
)]
public
class
SampleFeature
:
INotifyPropertyChanged
public
class
SampleFeature
:
INotifyPropertyChanged
{
{
/// <summary>
/// <summary>
/// 参数:使能
/// 参数:使能
/// </summary>
/// </summary>
[
JsonProperty
]
public
bool
Enable
{
get
;
set
;
}
public
bool
Enable
{
get
;
set
;
}
/// <summary>
/// <summary>
/// 参数:开始位置
/// 参数:开始位置
/// </summary>
/// </summary>
[
JsonProperty
]
public
int
StartPos
{
get
;
set
;
}
public
int
StartPos
{
get
;
set
;
}
/// <summary>
/// <summary>
/// 参数:结束位置
/// 参数:结束位置
/// </summary>
/// </summary>
[
JsonProperty
]
public
int
EndPos
{
get
;
set
;
}
public
int
EndPos
{
get
;
set
;
}
...
@@ -197,13 +242,6 @@ namespace FLY.Thick.Base.IService
...
@@ -197,13 +242,6 @@ namespace FLY.Thick.Base.IService
/// </summary>
/// </summary>
public
int
MaxOffset
{
get
;
set
;
}
public
int
MaxOffset
{
get
;
set
;
}
/// <summary>
/// 状态:扫描数据,从扫描数据提取的相似的一段
/// 它的单位是 grid, 需要 posOfGrid, 转换为 pos
/// 开始位置是 StartPos - Search
/// </summary>
[
DoNotCheckEquality
]
public
int
[]
ScanData
{
get
;
set
;
}
#
region
INotifyPropertyChanged
成员
#
region
INotifyPropertyChanged
成员
...
...
Project.FLY.Thick.Base/FLY.Thick.Base/OBJ_INTERFACE/CURVE_OBJ_INTERFACE.cs
deleted
100644 → 0
View file @
28b5001c
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Text
;
using
FObjBase
;
using
FLY.Thick.Base.Common
;
namespace
FLY.Thick.Base.OBJ_INTERFACE
{
public
class
CURVE_OBJ_INTERFACE
{
#
region
Pack
public
class
Pack_CurveList
{
public
CurveCorrectWay
correctway
;
public
CurveType
flag
;
public
List
<
CurveCell
>
list
;
}
#
endregion
#
region
GetValue
/// <summary>
/// Pack_CurveList
/// </summary>
public
const
UInt16
GET_CURVELIST
=
0
;
#
endregion
#
region
SetValue
/// <summary>
/// Pack_CurveList
/// </summary>
public
const
UInt16
SET_CURVELIST
=
0
;
#
endregion
#
region
PushMsg
/// <summary>
/// Pack_CurveList
/// </summary>
public
const
UInt16
PUSH_CURVELIST
=
0
;
#
endregion
}
}
Project.FLY.Thick.Base/FLY.Thick.Base/OBJ_INTERFACE/FIX_OBJ_INTERFACEC.cs
deleted
100644 → 0
View file @
28b5001c
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Text
;
namespace
FLY.Thick.Base.OBJ_INTERFACE
{
public
class
FIX_OBJ_INTERFACE
{
#
region
Pack
#
endregion
#
region
GetValue
#
endregion
#
region
SetValue
#
endregion
#
region
PushMsg
public
const
UInt16
PUSH_TIMEGRID
=
1
;
#
endregion
#
region
CallFunction
#
endregion
}
}
Project.FLY.Thick.Base/FLY.Thick.Base/OBJ_INTERFACE/GETSAMPLE_OBJ_INTERFACE.cs
deleted
100644 → 0
View file @
28b5001c
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Text
;
using
FObjBase
;
using
FLY.Thick.Base.Common
;
namespace
FLY.Thick.Base.OBJ_INTERFACE
{
public
class
GETSAMPLE_OBJ_INTERFACE
{
#
region
Pack
public
class
Pack_Params_SampleCell
{
public
bool
enable
;
public
bool
justForCheck
;
public
int
orgad
;
public
int
position
;
}
public
class
Pack_Params_SampleFeature
{
public
bool
enable
;
public
int
startpos
;
public
int
endpos
;
}
public
class
Pack_Params
{
public
bool
enable
;
public
UInt32
velocity
;
public
int
range
;
public
int
window
;
public
bool
IsCheckByPercent
;
public
double
ErrPercent
;
public
int
ErrValue
;
public
IEnumerable
<
Pack_Params_SampleCell
>
samples
;
public
int
search
;
public
IEnumerable
<
Pack_Params_SampleFeature
>
features
;
}
public
class
Pack_State_SampleCell
{
public
int
ad
;
public
double
value
;
}
public
class
Pack_State_SampleFeature
{
public
double
maxRelevancy
;
public
int
maxOffset
;
public
int
[]
scanData
;
}
public
class
Pack_State
{
public
int
posOfGrid
;
public
IEnumerable
<
Pack_State_SampleCell
>
samples
;
public
IEnumerable
<
Pack_State_SampleFeature
>
features
;
}
#
endregion
#
region
GetValue
/// <summary>
/// Pack_Params
/// </summary>
public
const
UInt16
GET_PARAMS
=
0
;
public
const
UInt16
GET_STATE
=
1
;
#
endregion
#
region
SetValue
/// <summary>
/// Pack_Params
/// </summary>
public
const
UInt16
SET_PARAMS
=
0
;
#
endregion
#
region
PushMsg
/// <summary>
/// Pack_Params
/// </summary>
public
const
UInt16
PUSH_PARAMS
=
0
;
public
const
UInt16
PUSH_STATE
=
1
;
#
endregion
#
region
CallFunction
/// <summary>
/// request:null
/// reponse:List(List(TempFilterData))
/// </summary>
public
const
UInt16
CALL_GET_TEMPDATAS
=
0
;
#
endregion
}
}
Project.FLY.Thick.Base/FLY.Thick.Base/OBJ_INTERFACE/SCANCORR_OBJ_INTERFACE.cs
deleted
100644 → 0
View file @
28b5001c
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Text
;
using
FObjBase
;
namespace
FLY.Thick.Base.OBJ_INTERFACE
{
public
class
SCANCORR_OBJ_INTERFACE
{
#
region
Pack
public
class
Pack_GetState
{
public
int
progress
;
public
bool
ing
;
}
public
class
Pack_ValidRange
{
public
int
begin
;
public
int
end
;
}
public
class
Pack_StartParams
{
public
int
scantimer
;
public
int
smoothfactor
;
public
int
posofgrid
;
public
int
poslen
;
}
public
class
Pack_GroupParams
{
public
int
avgad0
;
public
int
avgad1
;
}
public
class
Pack_CallStart
{
public
int
scantimer
;
public
int
smoothfactor
;
public
int
groupindex
;
}
public
class
Pack_ClearRequest
{
public
int
groupindex
;
}
#
endregion
#
region
GetValue
/// <summary>
/// Pack_GetState
/// </summary>
public
const
UInt16
GET_PROGRESS
=
1
;
/// <summary>
/// Pack_Enable
/// </summary>
public
const
UInt16
GET_ENABLE
=
2
;
/// <summary>
/// Pack_StartParams
/// </summary>
public
const
UInt16
GET_START_PARAMS
=
3
;
/// <summary>
/// Pack_GroupParams
/// </summary>
public
const
UInt16
GET_GROUP_PARAMS
=
4
;
/// <summary>
/// Pack_Data
/// </summary>
public
const
UInt16
GET_GROUP0_FORW
=
5
;
/// <summary>
/// Pack_Data
/// </summary>
public
const
UInt16
GET_GROUP0_BACKW
=
6
;
/// <summary>
/// Pack_Data
/// </summary>
public
const
UInt16
GET_GROUP1_FORW
=
7
;
/// <summary>
/// Pack_Data
/// </summary>
public
const
UInt16
GET_GROUP1_BACKW
=
8
;
/// <summary>
/// Pack_ValidRange
/// </summary>
public
const
UInt16
GET_VALIDRANGE
=
9
;
#
endregion
#
region
SetValue
/// <summary>
/// Pack_Enable
/// </summary>
public
const
UInt16
SET_ENABLE
=
2
;
/// <summary>
/// Pack_ValidRange
/// </summary>
public
const
UInt16
SET_VALIDRANGE
=
9
;
#
endregion
#
region
CallFunction
/// <summary>
/// Pack_CallStart
/// </summary>
public
const
UInt16
CALL_START
=
1
;
/// <summary>
/// Pack_int
/// </summary>
public
const
UInt16
CALL_CLEAR
=
2
;
/// <summary>
/// Pack_CallStart
/// </summary>
public
const
UInt16
CALL_SMOOTH
=
3
;
#
endregion
#
region
PushInfo
/// <summary>
/// Pack_GetState
/// </summary>
public
const
UInt16
PUSH_PROGRESS
=
1
;
public
const
UInt16
PUSH_ENABLE
=
2
;
public
const
UInt16
PUSH_START_PARAMS
=
3
;
/// <summary>
/// Pack_GroupParams
/// </summary>
public
const
UInt16
PUSH_GROUP_PARAMS
=
4
;
/// <summary>
/// Pack_Data
/// </summary>
public
const
UInt16
PUSH_GROUP0_FORW
=
5
;
/// <summary>
/// Pack_Data
/// </summary>
public
const
UInt16
PUSH_GROUP0_BACKW
=
6
;
/// <summary>
/// Pack_Data
/// </summary>
public
const
UInt16
PUSH_GROUP1_FORW
=
7
;
/// <summary>
/// Pack_Data
/// </summary>
public
const
UInt16
PUSH_GROUP1_BACKW
=
8
;
/// <summary>
/// Pack_ValidRange
/// </summary>
public
const
UInt16
PUSH_VALIDRANGE
=
9
;
#
endregion
}
}
Project.FLY.Thick.Base/FLY.Thick.Base/Server.OBJProxy/GetSample_OBJProxy.cs
deleted
100644 → 0
View file @
28b5001c
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Text
;
using
System.ComponentModel
;
using
FObjBase
;
using
FLY.Thick.Base.IService
;
using
FLY.Thick.Base.OBJ_INTERFACE
;
namespace
FLY.Thick.Base.Server.OBJProxy
{
public
class
GetSample_OBJProxy
:
FObj
{
#
region
延时推送
MARKNO
const
int
MARKNO_PUSH_PARAMS
=
1
;
const
int
MARKNO_PUSH_STATE
=
2
;
#
endregion
IGetSampleService
mGetSampleService
;
public
GetSample_OBJProxy
(
int
objsys_idx
,
UInt32
id
,
IGetSampleService
getSampleService
)
:
base
(
objsys_idx
)
{
ID
=
id
;
mGetSampleService
=
getSampleService
;
mGetSampleService
.
PropertyChanged
+=
new
PropertyChangedEventHandler
(
mGetSampleService_PropertyChanged
);
for
(
int
i
=
0
;
i
<
mGetSampleService
.
Samples
.
Length
;
i
++)
{
mGetSampleService
.
Samples
[
i
].
PropertyChanged
+=
new
PropertyChangedEventHandler
(
mSampleCell_PropertyChanged
);
}
for
(
int
i
=
0
;
i
<
mGetSampleService
.
Features
.
Length
;
i
++)
{
mGetSampleService
.
Features
[
i
].
PropertyChanged
+=
new
PropertyChangedEventHandler
(
mSampleFeature_PropertyChanged
);
}
}
void
push_params
()
{
FObjBase
.
PollModule
.
Current
.
Poll_JustOnce
(
new
PollModule
.
PollHandler
(
delegate
()
{
byte
[]
buf
;
GetValue
(
null
,
0
,
GETSAMPLE_OBJ_INTERFACE
.
GET_PARAMS
,
out
buf
);
CurrObjSys
.
PushObjInfoEx
(
this
,
GETSAMPLE_OBJ_INTERFACE
.
PUSH_PARAMS
,
buf
);
}),
this
,
MARKNO_PUSH_PARAMS
);
}
void
push_state
()
{
FObjBase
.
PollModule
.
Current
.
Poll_JustOnce
(
new
PollModule
.
PollHandler
(
delegate
()
{
byte
[]
buf
;
GetValue
(
null
,
0
,
GETSAMPLE_OBJ_INTERFACE
.
GET_STATE
,
out
buf
);
CurrObjSys
.
PushObjInfoEx
(
this
,
GETSAMPLE_OBJ_INTERFACE
.
PUSH_STATE
,
buf
);
}),
this
,
MARKNO_PUSH_STATE
);
}
void
mSampleFeature_PropertyChanged
(
object
sender
,
PropertyChangedEventArgs
e
)
{
if
((
e
.
PropertyName
==
"Enable"
)
||
(
e
.
PropertyName
==
"StartPos"
)
||
(
e
.
PropertyName
==
"EndPos"
))
{
push_params
();
}
else
if
((
e
.
PropertyName
==
"MaxRelevancy"
)
||
(
e
.
PropertyName
==
"MaxOffset"
)
||
(
e
.
PropertyName
==
"ScanData"
))
{
push_state
();
}
}
void
mSampleCell_PropertyChanged
(
object
sender
,
PropertyChangedEventArgs
e
)
{
if
((
e
.
PropertyName
==
"Enable"
)
||
(
e
.
PropertyName
==
"JustForCheck"
)
||
(
e
.
PropertyName
==
"OrgAD"
)
||
(
e
.
PropertyName
==
"Position"
))
{
push_params
();
}
else
if
((
e
.
PropertyName
==
"AD"
)
||
(
e
.
PropertyName
==
"SampleValue"
))
{
push_state
();
}
}
void
mGetSampleService_PropertyChanged
(
object
sender
,
PropertyChangedEventArgs
e
)
{
if
((
e
.
PropertyName
==
"Enable"
)
||
(
e
.
PropertyName
==
"Interval"
)
||
(
e
.
PropertyName
==
"Velocity"
)
||
(
e
.
PropertyName
==
"Range"
)
||
(
e
.
PropertyName
==
"Window"
)
||
(
e
.
PropertyName
==
"IsCheckByPercent"
)
||
(
e
.
PropertyName
==
"ErrPercent"
)
||
(
e
.
PropertyName
==
"ErrValue"
)
||
(
e
.
PropertyName
==
"Search"
))
{
push_params
();
}
else
if
(
e
.
PropertyName
==
"PosOfGrid"
)
{
push_state
();
}
}
public
override
void
GetValue
(
IFConn
from
,
uint
srcid
,
ushort
memid
,
out
byte
[]
infodata
)
{
infodata
=
null
;
switch
(
memid
)
{
case
GETSAMPLE_OBJ_INTERFACE
.
GET_PARAMS
:
{
GETSAMPLE_OBJ_INTERFACE
.
Pack_Params
p
=
new
GETSAMPLE_OBJ_INTERFACE
.
Pack_Params
()
{
enable
=
mGetSampleService
.
Enable
,
range
=
mGetSampleService
.
Range
,
velocity
=
mGetSampleService
.
Velocity
,
window
=
mGetSampleService
.
Window
,
IsCheckByPercent
=
mGetSampleService
.
IsCheckByPercent
,
ErrPercent
=
mGetSampleService
.
ErrPercent
,
ErrValue
=
mGetSampleService
.
ErrValue
,
search
=
mGetSampleService
.
Search
};
p
.
samples
=
(
from
sample
in
mGetSampleService
.
Samples
select
new
GETSAMPLE_OBJ_INTERFACE
.
Pack_Params_SampleCell
()
{
enable
=
sample
.
Enable
,
justForCheck
=
sample
.
JustForCheck
,
orgad
=
sample
.
OrgAD
,
position
=
sample
.
Position
});
p
.
features
=
(
from
feature
in
mGetSampleService
.
Features
select
new
GETSAMPLE_OBJ_INTERFACE
.
Pack_Params_SampleFeature
()
{
enable
=
feature
.
Enable
,
startpos
=
feature
.
StartPos
,
endpos
=
feature
.
EndPos
});
string
json
=
Newtonsoft
.
Json
.
JsonConvert
.
SerializeObject
(
p
);
infodata
=
Misc
.
Converter
.
StringToBytes
(
json
);
}
break
;
case
GETSAMPLE_OBJ_INTERFACE
.
GET_STATE
:
{
GETSAMPLE_OBJ_INTERFACE
.
Pack_State
p
=
new
GETSAMPLE_OBJ_INTERFACE
.
Pack_State
()
{
posOfGrid
=
mGetSampleService
.
PosOfGrid
,
samples
=
from
sample
in
mGetSampleService
.
Samples
select
new
GETSAMPLE_OBJ_INTERFACE
.
Pack_State_SampleCell
()
{
ad
=
sample
.
AD
,
value
=
sample
.
SampleValue
},
features
=
from
feature
in
mGetSampleService
.
Features
select
new
GETSAMPLE_OBJ_INTERFACE
.
Pack_State_SampleFeature
()
{
maxRelevancy
=
feature
.
MaxRelevancy
,
maxOffset
=
feature
.
MaxOffset
,
scanData
=
feature
.
ScanData
}
};
string
json
=
Newtonsoft
.
Json
.
JsonConvert
.
SerializeObject
(
p
);
infodata
=
Misc
.
Converter
.
StringToBytes
(
json
);
}
break
;
default
:
infodata
=
null
;
break
;
}
}
public
override
void
SetValue
(
IFConn
from
,
uint
srcid
,
ushort
memid
,
byte
[]
infodata
)
{
switch
(
memid
)
{
case
GETSAMPLE_OBJ_INTERFACE
.
SET_PARAMS
:
{
string
json
=
Misc
.
Converter
.
BytesToString
(
infodata
);
var
p
=
Newtonsoft
.
Json
.
JsonConvert
.
DeserializeObject
<
GETSAMPLE_OBJ_INTERFACE
.
Pack_Params
>(
json
);
mGetSampleService
.
Enable
=
p
.
enable
;
mGetSampleService
.
Range
=
p
.
range
;
mGetSampleService
.
Velocity
=
p
.
velocity
;
mGetSampleService
.
Window
=
p
.
window
;
mGetSampleService
.
IsCheckByPercent
=
p
.
IsCheckByPercent
;
mGetSampleService
.
ErrPercent
=
p
.
ErrPercent
;
mGetSampleService
.
ErrValue
=
p
.
ErrValue
;
mGetSampleService
.
Search
=
p
.
search
;
for
(
int
i
=
0
;
i
<
mGetSampleService
.
Samples
.
Count
()
&&
i
<
p
.
samples
.
Count
();
i
++)
{
var
sample_src
=
p
.
samples
.
ElementAt
(
i
);
var
sample_desp
=
mGetSampleService
.
Samples
[
i
];
sample_desp
.
Enable
=
sample_src
.
enable
;
sample_desp
.
JustForCheck
=
sample_src
.
justForCheck
;
sample_desp
.
OrgAD
=
sample_src
.
orgad
;
sample_desp
.
Position
=
sample_src
.
position
;
}
for
(
int
i
=
0
;
i
<
mGetSampleService
.
Features
.
Count
()
&&
i
<
p
.
features
.
Count
();
i
++)
{
var
feature_src
=
p
.
features
.
ElementAt
(
i
);
var
feature_desp
=
mGetSampleService
.
Features
[
i
];
feature_desp
.
Enable
=
feature_src
.
enable
;
feature_desp
.
StartPos
=
feature_src
.
startpos
;
feature_desp
.
EndPos
=
feature_src
.
endpos
;
}
mGetSampleService
.
Apply
();
}
break
;
}
}
public
override
void
CallFunction
(
IFConn
from
,
uint
srcid
,
uint
magic
,
ushort
funcid
,
byte
[]
infodata
)
{
switch
(
funcid
)
{
case
GETSAMPLE_OBJ_INTERFACE
.
CALL_GET_TEMPDATAS
:
{
mGetSampleService
.
GetTempFilterDatas
((
context
,
retdata
)
=>
{
string
json
=
Newtonsoft
.
Json
.
JsonConvert
.
SerializeObject
(
retdata
);
CurrObjSys
.
PushCallFunctionEx
(
from
,
srcid
,
ID
,
magic
,
funcid
,
Misc
.
Converter
.
StringToBytes
(
json
));
},
null
);
}
break
;
}
}
}
}
Project.FLY.Thick.Base/FLY.Thick.Base/Server/GetSample.cs
View file @
2ec2ccea
...
@@ -15,10 +15,10 @@ using PropertyChanged;
...
@@ -15,10 +15,10 @@ using PropertyChanged;
using
Newtonsoft.Json
;
using
Newtonsoft.Json
;
using
static
Misc
.
ReverserInfo
;
using
static
Misc
.
ReverserInfo
;
using
FLY.Thick.Base.Common
;
using
FLY.Thick.Base.Common
;
using
AutoMapper
;
namespace
FLY.Thick.Base.Server
namespace
FLY.Thick.Base.Server
{
{
[
JsonObject
(
MemberSerialization
.
OptIn
)]
public
class
GSample
:
IGetSampleService
public
class
GSample
:
IGetSampleService
{
{
/// <summary>
/// <summary>
...
@@ -30,69 +30,53 @@ namespace FLY.Thick.Base.Server
...
@@ -30,69 +30,53 @@ namespace FLY.Thick.Base.Server
/// <summary>
/// <summary>
/// 参数:使能
/// 参数:使能
/// </summary>
/// </summary>
[
JsonProperty
]
public
bool
Enable
{
get
;
set
;
}
=
true
;
public
bool
Enable
{
get
;
set
;
}
=
true
;
/// <summary>
/// <summary>
/// 参数:速度
/// 参数:速度
/// </summary>
/// </summary>
[
JsonProperty
]
public
UInt32
Velocity
{
get
;
set
;
}
=
500
;
public
UInt32
Velocity
{
get
;
set
;
}
=
500
;
/// <summary>
/// <summary>
/// 参数:样品点范围
/// 参数:样品点范围
/// </summary>
/// </summary>
[
JsonProperty
]
public
int
Range
{
get
;
set
;
}
=
100
;
public
int
Range
{
get
;
set
;
}
=
100
;
/// <summary>
/// <summary>
/// 滤波窗口,单位 min
/// 滤波窗口,单位 min
/// </summary>
/// </summary>
[
JsonProperty
]
public
int
Window
{
get
;
set
;
}
public
int
Window
{
get
;
set
;
}
/// <summary>
/// <summary>
/// 使用%方式检查异常
/// 使用%方式检查异常
/// </summary>
/// </summary>
[
JsonProperty
]
public
bool
IsCheckByPercent
{
get
;
set
;
}
=
true
;
public
bool
IsCheckByPercent
{
get
;
set
;
}
=
true
;
/// <summary>
/// <summary>
/// 异常% 单位%
/// 异常% 单位%
/// </summary>
/// </summary>
[
JsonProperty
]
public
double
ErrPercent
{
get
;
set
;
}
=
2
;
public
double
ErrPercent
{
get
;
set
;
}
=
2
;
/// <summary>
/// <summary>
/// 异常值
/// 异常值
/// </summary>
/// </summary>
[
JsonProperty
]
public
int
ErrValue
{
get
;
set
;
}
=
200
;
public
int
ErrValue
{
get
;
set
;
}
=
200
;
/// <summary>
/// <summary>
/// 样品
/// 样品
/// </summary>
/// </summary>
[
JsonProperty
]
public
SampleCell
[]
Samples
{
get
;
set
;
}
public
SampleCell
[]
Samples
{
get
;
set
;
}
/// <summary>
/// <summary>
/// 查找公差
/// 查找公差
/// </summary>
/// </summary>
[
JsonProperty
]
public
int
Search
{
get
;
set
;
}
=
100
;
public
int
Search
{
get
;
set
;
}
=
100
;
/// <summary>
/// <summary>
/// 特征 相识度 0 正, 1 反
/// 特征 相识度 0 正, 1 反
/// </summary>
/// </summary>
[
JsonProperty
]
public
SampleFeature
[]
Features
{
get
;
set
;
}
public
SampleFeature
[]
Features
{
get
;
set
;
}
/// <summary>
/// 状态:从flyad7 得到的。 用于绘制图
/// </summary>
public
int
PosOfGrid
{
get
;
set
;
}
=
10
;
#
endregion
#
endregion
TempFilter2
[]
tempFilters
;
TempFilter2
[]
tempFilters
;
DIRECTION
[]
directions
;
DIRECTION
[]
directions
;
...
@@ -113,6 +97,7 @@ namespace FLY.Thick.Base.Server
...
@@ -113,6 +97,7 @@ namespace FLY.Thick.Base.Server
this
.
param_path
=
param_path
;
this
.
param_path
=
param_path
;
Samples
=
new
SampleCell
[
3
];
Samples
=
new
SampleCell
[
3
];
Features
=
new
SampleFeature
[
2
];
Features
=
new
SampleFeature
[
2
];
tempFilters
=
new
TempFilter2
[
Samples
.
Count
()];
tempFilters
=
new
TempFilter2
[
Samples
.
Count
()];
directions
=
new
DIRECTION
[
Samples
.
Count
()];
directions
=
new
DIRECTION
[
Samples
.
Count
()];
...
@@ -169,40 +154,20 @@ namespace FLY.Thick.Base.Server
...
@@ -169,40 +154,20 @@ namespace FLY.Thick.Base.Server
this
.
warningSystem
=
warningSystem
;
this
.
warningSystem
=
warningSystem
;
Misc
.
BindingOperations
.
SetBinding
(
flyad
,
nameof
(
flyad
.
PosOfGrid
),
this
,
nameof
(
PosOfGrid
));
}
}
public
bool
Load
()
public
bool
Load
()
{
{
try
return
GSampleJsonDb
.
Load
(
this
,
param_path
);
{
string
json
=
File
.
ReadAllText
(
param_path
);
Newtonsoft
.
Json
.
JsonConvert
.
PopulateObject
(
json
,
this
);
}
catch
{
return
false
;
}
return
true
;
}
}
/// <summary>
/// <summary>
/// 保存
/// 保存
/// </summary>
/// </summary>
public
void
Save
()
public
bool
Save
()
{
{
try
return
GSampleJsonDb
.
Save
(
this
,
param_path
);
{
string
json
=
Newtonsoft
.
Json
.
JsonConvert
.
SerializeObject
(
this
,
Formatting
.
Indented
);
File
.
WriteAllText
(
param_path
,
json
);
}
catch
{
}
}
}
/// <summary>
/// <summary>
/// 1.判断样品取样方向
/// 1.判断样品取样方向
...
@@ -409,15 +374,16 @@ namespace FLY.Thick.Base.Server
...
@@ -409,15 +374,16 @@ namespace FLY.Thick.Base.Server
int
grid_b
=
grid1
-
grid_searchtol
;
int
grid_b
=
grid1
-
grid_searchtol
;
int
grid_e
=
grid2
+
grid_searchtol
;
int
grid_e
=
grid2
+
grid_searchtol
;
int
grid_len
=
grid_e
-
grid_b
+
1
;
int
grid_len
=
grid_e
-
grid_b
+
1
;
psr
.
ScanData
=
new
int
[
grid_len
];
//这个方向的需要 特征查找范围内的数据,不用考虑 buf 不够 grid_len
int
[]
scanData
=
new
int
[
grid_len
];
//这个方向的需要 特征查找范围内的数据,不用考虑 buf 不够 grid_len
Array
.
Copy
(
buf
,
grid_b
-
grid_start
,
psr
.
ScanData
,
0
,
grid_len
);
Array
.
Copy
(
buf
,
grid_b
-
grid_start
,
scanData
,
0
,
grid_len
);
double
max_relvency
=
0
;
double
max_relvency
=
0
;
int
max_grid_offset
=
0
;
int
max_grid_offset
=
0
;
for
(
int
i
=
0
;
i
<
grid_searchtol
*
2
;
i
++)
for
(
int
i
=
0
;
i
<
grid_searchtol
*
2
;
i
++)
{
{
double
r
=
Misc
.
MyMath
.
Correl
(
gagedata
,
grid1
,
psr
.
S
canData
,
i
,
grid2
-
grid1
+
1
);
double
r
=
Misc
.
MyMath
.
Correl
(
gagedata
,
grid1
,
s
canData
,
i
,
grid2
-
grid1
+
1
);
if
(
r
>
max_relvency
)
if
(
r
>
max_relvency
)
{
{
max_relvency
=
r
;
max_relvency
=
r
;
...
@@ -620,4 +586,92 @@ namespace FLY.Thick.Base.Server
...
@@ -620,4 +586,92 @@ namespace FLY.Thick.Base.Server
}
}
public
delegate
void
SampleChangedEventHandler
(
GSample
gsample
);
public
delegate
void
SampleChangedEventHandler
(
GSample
gsample
);
public
class
GSampleJsonDb
{
static
Mapper
Mapper
{
get
;
}
=
new
AutoMapper
.
Mapper
(
new
MapperConfiguration
(
c
=>
{
c
.
CreateMap
<
GSample
,
GSampleJsonDb
>()
.
ForMember
(
s
=>
s
.
Samples
,
opt
=>
{
opt
.
MapFrom
(
s
=>
Map_SampleCell2SampleCellParam
(
s
.
Samples
));
}).
ForMember
(
s
=>
s
.
Features
,
opt
=>
{
opt
.
MapFrom
(
s
=>
Map_SampleFeature2SampleFeatureParam
(
s
.
Features
));
})
.
ReverseMap
()
.
ForMember
(
s
=>
s
.
Samples
,
opt
=>
{
opt
.
MapFrom
(
s
=>
Map_SampleCellParam2SampleCell
(
s
.
Samples
));
})
.
ForMember
(
s
=>
s
.
Features
,
opt
=>
{
opt
.
MapFrom
(
s
=>
Map_SampleFeatureParam2SampleFeature
(
s
.
Features
));
});
}));
static
SampleCell
[]
Map_SampleCellParam2SampleCell
(
SampleCellParam
[]
sampleCellParams
)
{
string
json
=
Newtonsoft
.
Json
.
JsonConvert
.
SerializeObject
(
sampleCellParams
);
return
Newtonsoft
.
Json
.
JsonConvert
.
DeserializeObject
<
SampleCell
[
]>
(
json
);
}
static
SampleCellParam
[]
Map_SampleCell2SampleCellParam
(
SampleCell
[]
sampleCells
)
{
string
json
=
Newtonsoft
.
Json
.
JsonConvert
.
SerializeObject
(
sampleCells
);
return
Newtonsoft
.
Json
.
JsonConvert
.
DeserializeObject
<
SampleCellParam
[
]>
(
json
);
}
static
SampleFeature
[]
Map_SampleFeatureParam2SampleFeature
(
SampleFeatureParam
[]
sampleFeatureParams
)
{
string
json
=
Newtonsoft
.
Json
.
JsonConvert
.
SerializeObject
(
sampleFeatureParams
);
return
Newtonsoft
.
Json
.
JsonConvert
.
DeserializeObject
<
SampleFeature
[
]>
(
json
);
}
static
SampleFeatureParam
[]
Map_SampleFeature2SampleFeatureParam
(
SampleFeature
[]
sampleFeatures
)
{
string
json
=
Newtonsoft
.
Json
.
JsonConvert
.
SerializeObject
(
sampleFeatures
);
return
Newtonsoft
.
Json
.
JsonConvert
.
DeserializeObject
<
SampleFeatureParam
[
]>
(
json
);
}
public
static
bool
Load
(
GSample
src
,
string
filePath
)
{
try
{
if
(
File
.
Exists
(
filePath
))
{
string
json
=
File
.
ReadAllText
(
filePath
);
var
p
=
JsonConvert
.
DeserializeObject
<
GSampleJsonDb
>(
json
);
Mapper
.
Map
(
p
,
src
);
return
true
;
}
}
catch
{
//异常,没有json 解码失败
}
return
false
;
}
public
static
bool
Save
(
GSample
src
,
string
filePath
)
{
var
p
=
Mapper
.
Map
<
GSampleJsonDb
>(
src
);
try
{
File
.
WriteAllText
(
filePath
,
JsonConvert
.
SerializeObject
(
p
,
Formatting
.
Indented
));
return
true
;
}
catch
{
//异常,没有json 编码失败
}
return
false
;
}
public
bool
Enable
{
get
;
set
;
}
=
true
;
public
int
Range
{
get
;
set
;
}
=
100
;
public
int
Window
{
get
;
set
;
}
public
bool
IsCheckByPercent
{
get
;
set
;
}
=
true
;
public
double
ErrPercent
{
get
;
set
;
}
=
2
;
public
int
ErrValue
{
get
;
set
;
}
=
200
;
public
SampleCellParam
[]
Samples
{
get
;
set
;
}
public
int
Search
{
get
;
set
;
}
=
100
;
public
SampleFeatureParam
[]
Features
{
get
;
set
;
}
}
}
}
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