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
6bcbed45
Commit
6bcbed45
authored
Oct 11, 2022
by
潘栩锋
🚴
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
优化 机架修正 可以读取V6 的csv 升级到 V7
parent
2d79dd84
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
227 additions
and
15 deletions
+227
-15
PgScanCorrVm.cs
...Y.Thick.Base/FLY.Thick.Base.UI/PgScanCorr/PgScanCorrVm.cs
+34
-2
ScanCorrServiceClient.cs
...Thick.Base/FLY.Thick.Base/Client/ScanCorrServiceClient.cs
+3
-2
IScanCorrService.cs
...LY.Thick.Base/FLY.Thick.Base/IService/IScanCorrService.cs
+2
-2
GM_ScanCorr.cs
Project.FLY.Thick.Base/FLY.Thick.Base/Server/GM_ScanCorr.cs
+188
-9
No files found.
Project.FLY.Thick.Base/FLY.Thick.Base.UI/PgScanCorr/PgScanCorrVm.cs
View file @
6bcbed45
...
@@ -389,8 +389,12 @@ namespace FLY.Thick.Base.UI
...
@@ -389,8 +389,12 @@ namespace FLY.Thick.Base.UI
for
(
int
i
=
0
;
i
<
2
;
i
++)
for
(
int
i
=
0
;
i
<
2
;
i
++)
corrDatas
[
i
]
=
SeriesInfos
[
2
+
i
].
Datas
.
Select
(
d
=>
double
.
IsNaN
(
d
)
?
Misc
.
MyBase
.
NULL_VALUE
:
(
int
)
d
).
ToArray
();
corrDatas
[
i
]
=
SeriesInfos
[
2
+
i
].
Datas
.
Select
(
d
=>
double
.
IsNaN
(
d
)
?
Misc
.
MyBase
.
NULL_VALUE
:
(
int
)
d
).
ToArray
();
int
[][]
orgDatas
=
new
int
[
2
][];
for
(
int
i
=
0
;
i
<
2
;
i
++)
orgDatas
[
i
]
=
SeriesInfos
[
i
].
Datas
.
Select
(
d
=>
double
.
IsNaN
(
d
)
?
Misc
.
MyBase
.
NULL_VALUE
:
(
int
)
d
).
ToArray
();
//发送出去
//发送出去
scanCorrService
.
SetCorrData
(
SelectedGroupIndex
,
corrDatas
,
(
int
)
AvgAd
);
scanCorrService
.
SetCorrData
(
SelectedGroupIndex
,
corrDatas
,
(
int
)
AvgAd
,
orgDatas
);
FLY
.
ControlLibrary
.
Window_Tip
.
Show
(
"应用成功"
,
FLY
.
ControlLibrary
.
Window_Tip
.
Show
(
"应用成功"
,
null
,
null
,
...
@@ -681,7 +685,7 @@ namespace FLY.Thick.Base.UI
...
@@ -681,7 +685,7 @@ namespace FLY.Thick.Base.UI
App
.
Current
.
Dispatcher
.
Invoke
(()
=>
App
.
Current
.
Dispatcher
.
Invoke
(()
=>
{
{
for
(
int
j
=
2
;
j
<=
3
;
j
++)
for
(
int
j
=
0
;
j
<
4
;
j
++)
{
{
List
<
double
>
datas
=
new
List
<
double
>();
List
<
double
>
datas
=
new
List
<
double
>();
for
(
int
i
=
0
;
i
<
dataTable
.
Rows
.
Count
;
i
++)
for
(
int
i
=
0
;
i
<
dataTable
.
Rows
.
Count
;
i
++)
...
@@ -696,6 +700,34 @@ namespace FLY.Thick.Base.UI
...
@@ -696,6 +700,34 @@ namespace FLY.Thick.Base.UI
datas
.
AverageNoNull
();
datas
.
AverageNoNull
();
}
}
var
list
=
SeriesInfos
[
0
].
Datas
.
Where
((
d
)
=>
{
if
(
double
.
IsNaN
(
d
))
return
false
;
else
return
true
;
});
//设置Y轴范围
int
max
=
(
int
)
list
.
Max
();
int
min
=
(
int
)
list
.
Min
();
//扩大3倍显示
int
range
=
max
-
min
;
if
(
range
==
0
)
{
//异常
}
else
{
ymax
=
max
+
range
/
4
;
ymin
=
min
-
range
/
4
;
YRangeSliderMin
=
min
-
range
;
YRangeSliderMax
=
max
+
range
;
}
NotifyPropertyChanged
(
nameof
(
YMax
));
NotifyPropertyChanged
(
nameof
(
YMin
));
double
avg0
=
SeriesInfos
[
2
].
Datas
.
AverageNoNull
();
double
avg0
=
SeriesInfos
[
2
].
Datas
.
AverageNoNull
();
double
avg1
=
SeriesInfos
[
3
].
Datas
.
AverageNoNull
();
double
avg1
=
SeriesInfos
[
3
].
Datas
.
AverageNoNull
();
if
(!
double
.
IsNaN
(
avg0
)
&&
!
double
.
IsNaN
(
avg1
))
{
if
(!
double
.
IsNaN
(
avg0
)
&&
!
double
.
IsNaN
(
avg1
))
{
...
...
Project.FLY.Thick.Base/FLY.Thick.Base/Client/ScanCorrServiceClient.cs
View file @
6bcbed45
...
@@ -76,9 +76,10 @@ namespace FLY.Thick.Base.Client
...
@@ -76,9 +76,10 @@ 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
)
/// <param name="orgDatas">原始数据</param>
public
void
SetCorrData
(
int
groupIndex
,
int
[][]
corrDatas
,
int
avg
,
int
[][]
orgDatas
)
{
{
Call
(
nameof
(
SetCorrData
),
new
{
groupIndex
=
groupIndex
,
corrDatas
=
corrDatas
,
avg
=
avg
});
Call
(
nameof
(
SetCorrData
),
new
{
groupIndex
=
groupIndex
,
corrDatas
=
corrDatas
,
avg
=
avg
,
orgDatas
=
orgDatas
});
}
}
...
...
Project.FLY.Thick.Base/FLY.Thick.Base/IService/IScanCorrService.cs
View file @
6bcbed45
...
@@ -67,8 +67,8 @@ namespace FLY.Thick.Base.IService
...
@@ -67,8 +67,8 @@ namespace FLY.Thick.Base.IService
/// <param name="groupIndex">组序号</param>
/// <param name="groupIndex">组序号</param>
/// <param name="corrDatas">修正数据</param>
/// <param name="corrDatas">修正数据</param>
/// <param name="avg">均值</param>
/// <param name="avg">均值</param>
void
SetCorrData
(
int
groupIndex
,
int
[][]
corrDatas
,
int
avg
);
/// <param name="orgDatas">原始数据</param>
void
SetCorrData
(
int
groupIndex
,
int
[][]
corrDatas
,
int
avg
,
int
[][]
orgDatas
);
[
Call
(
typeof
(
GetScanCorrGroupResponse
))]
[
Call
(
typeof
(
GetScanCorrGroupResponse
))]
void
GetScanCorrGroup
(
int
groupIndex
,
AsyncCBHandler
asyncDelegate
,
object
asyncContext
);
void
GetScanCorrGroup
(
int
groupIndex
,
AsyncCBHandler
asyncDelegate
,
object
asyncContext
);
...
...
Project.FLY.Thick.Base/FLY.Thick.Base/Server/GM_ScanCorr.cs
View file @
6bcbed45
...
@@ -296,15 +296,7 @@ namespace FLY.Thick.Base.Server
...
@@ -296,15 +296,7 @@ namespace FLY.Thick.Base.Server
NotifyPropertyChanged
(
nameof
(
UpdateTimes
));
NotifyPropertyChanged
(
nameof
(
UpdateTimes
));
}
}
bool
Load
()
{
return
ScanCorrJsonDb
.
Load
(
file_path
,
this
);
}
bool
Save
()
{
return
ScanCorrJsonDb
.
Save
(
file_path
,
this
);
}
/// <summary>
/// <summary>
/// 设置修正曲线
/// 设置修正曲线
...
@@ -312,7 +304,8 @@ namespace FLY.Thick.Base.Server
...
@@ -312,7 +304,8 @@ namespace FLY.Thick.Base.Server
/// <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
)
/// <param name="orgDatas">原始数据</param>
public
void
SetCorrData
(
int
groupIndex
,
int
[][]
corrDatas
,
int
avg
,
int
[][]
orgDatas
)
{
{
if
(
Groups
==
null
||
groupIndex
<
0
||
groupIndex
>=
Groups
.
Count
())
if
(
Groups
==
null
||
groupIndex
<
0
||
groupIndex
>=
Groups
.
Count
())
{
{
...
@@ -321,6 +314,7 @@ namespace FLY.Thick.Base.Server
...
@@ -321,6 +314,7 @@ namespace FLY.Thick.Base.Server
var
group
=
Groups
[
groupIndex
];
var
group
=
Groups
[
groupIndex
];
group
.
CorrDatas
=
corrDatas
;
group
.
CorrDatas
=
corrDatas
;
group
.
OrgDatas
=
orgDatas
;
group
.
Avg
=
avg
;
group
.
Avg
=
avg
;
Save
();
Save
();
}
}
...
@@ -476,6 +470,191 @@ namespace FLY.Thick.Base.Server
...
@@ -476,6 +470,191 @@ namespace FLY.Thick.Base.Server
return
ad
;
return
ad
;
}
}
bool
Load
()
{
if
(
File
.
Exists
(
file_path
))
{
return
ScanCorrJsonDb
.
Load
(
file_path
,
this
);
}
else
{
//兼容 V6版本的.csv 文件
//当存在 scancorr.csv, 转为 file_path, 删除 scancorr.csv
string
filepath
=
"scancorr.csv"
;
if
(
File
.
Exists
(
filepath
))
{
bool
ret
=
LoadCSV
(
filepath
);
//删除
File
.
Delete
(
filepath
);
//保存
Save
();
return
ret
;
}
return
false
;
}
}
bool
Save
()
{
return
ScanCorrJsonDb
.
Save
(
file_path
,
this
);
}
bool
LoadCSV
(
string
filepath
)
{
Groups
=
new
ScanCorrGroup
[
2
]
{
new
ScanCorrGroup
(),
new
ScanCorrGroup
()
};
List
<
int
>[]
ADs
=
new
List
<
int
>[
4
]
{
new
List
<
int
>(),
new
List
<
int
>(),
new
List
<
int
>(),
new
List
<
int
>()
};
try
{
bool
keyvalue_state
=
true
;
//键值对模式
using
(
StreamReader
sw
=
new
StreamReader
(
filepath
,
Encoding
.
GetEncoding
(
"GB2312"
)))
{
while
(!
sw
.
EndOfStream
)
{
string
item
;
item
=
sw
.
ReadLine
();
string
[]
items
=
item
.
Split
(
','
);
if
(
keyvalue_state
)
{
if
(
items
.
Count
()
>=
2
)
{
if
(
items
[
0
].
StartsWith
(
"Enable"
))
{
bool
b
;
if
(
bool
.
TryParse
(
items
[
1
],
out
b
))
Enable
=
b
;
else
return
false
;
}
else
if
(
items
[
0
].
StartsWith
(
"ScanTimer"
))
{
int
i
;
if
(
int
.
TryParse
(
items
[
1
],
out
i
))
ScanCnt
=
i
;
else
return
false
;
}
else
if
(
items
[
0
].
StartsWith
(
"SmoothFactor"
))
{
//int i;
//if (int.TryParse(items[1], out i))
// SmoothFactor = i;
//else
// return false;
}
else
if
(
items
[
0
].
StartsWith
(
"PosOfGrid"
))
{
int
i
;
if
(
int
.
TryParse
(
items
[
1
],
out
i
))
{
Groups
[
0
].
PosOfGrid
=
i
;
Groups
[
1
].
PosOfGrid
=
i
;
}
else
return
false
;
}
else
if
(
items
[
0
].
StartsWith
(
"PosLen"
))
{
int
i
;
if
(
int
.
TryParse
(
items
[
1
],
out
i
))
{
Groups
[
0
].
PosLen
=
i
;
Groups
[
1
].
PosLen
=
i
;
}
else
return
false
;
}
else
if
(
items
[
0
].
StartsWith
(
"position"
))
{
keyvalue_state
=
false
;
//正文
}
}
}
else
{
//正文
if
(
items
.
Count
()
==
0
)
{
break
;
}
for
(
int
i
=
1
;
i
<
5
;
i
++)
{
if
(
i
>=
items
.
Count
())
break
;
int
ad
;
if
(
string
.
IsNullOrEmpty
(
items
[
i
]))
ad
=
Misc
.
MyBase
.
NULL_VALUE
;
else
{
if
(!
int
.
TryParse
(
items
[
i
],
out
ad
))
ad
=
Misc
.
MyBase
.
NULL_VALUE
;
}
ADs
[
i
-
1
].
Add
(
ad
);
//switch (i)
//{
// case 1:
// Group0.ForwDatas.Add(ad);
// break;
// case 2:
// Group0.BackwDatas.Add(ad);
// break;
// case 3:
// Group1.ForwDatas.Add(ad);
// break;
// case 4:
// Group1.BackwDatas.Add(ad);
// break;
//}
}
}
}
}
if
(
ADs
[
0
].
Count
()
==
0
)
return
true
;
if
(
ADs
[
0
].
All
(
ad
=>
ad
==
Misc
.
MyBase
.
NULL_VALUE
))
return
true
;
if
(
ADs
[
1
].
All
(
ad
=>
ad
==
Misc
.
MyBase
.
NULL_VALUE
))
return
true
;
Groups
[
0
].
OrgDatas
=
new
int
[
2
][];
Groups
[
0
].
CorrDatas
=
new
int
[
2
][];
Groups
[
0
].
OrgDatas
[
0
]
=
ADs
[
0
].
ToArray
();
Groups
[
0
].
OrgDatas
[
1
]
=
ADs
[
1
].
ToArray
();
Groups
[
0
].
CorrDatas
[
0
]
=
ADs
[
0
].
ToArray
();
Groups
[
0
].
CorrDatas
[
1
]
=
ADs
[
1
].
ToArray
();
if
(
ADs
[
2
].
All
(
ad
=>
ad
==
Misc
.
MyBase
.
NULL_VALUE
))
return
true
;
if
(
ADs
[
3
].
All
(
ad
=>
ad
==
Misc
.
MyBase
.
NULL_VALUE
))
return
true
;
Groups
[
1
].
OrgDatas
=
new
int
[
2
][];
Groups
[
1
].
CorrDatas
=
new
int
[
2
][];
Groups
[
1
].
OrgDatas
[
0
]
=
ADs
[
2
].
ToArray
();
Groups
[
1
].
OrgDatas
[
1
]
=
ADs
[
3
].
ToArray
();
Groups
[
1
].
CorrDatas
[
0
]
=
ADs
[
2
].
ToArray
();
Groups
[
1
].
CorrDatas
[
1
]
=
ADs
[
3
].
ToArray
();
//没数据了
return
true
;
}
catch
{
return
false
;
}
return
true
;
}
}
}
public
class
ScanCorrGroup
public
class
ScanCorrGroup
...
...
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