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
40c272a7
Commit
40c272a7
authored
Jan 19, 2020
by
540597360@qq.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改数据选择界面
parent
b1e2cc45
Hide whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
384 additions
and
69 deletions
+384
-69
App.config
....FLY.ThickHeatAnalyst.Fix/FLY.HeatingHelper.UI/App.config
+1
-1
App.xaml
...ct.FLY.ThickHeatAnalyst.Fix/FLY.HeatingHelper.UI/App.xaml
+24
-0
App.xaml.cs
...FLY.ThickHeatAnalyst.Fix/FLY.HeatingHelper.UI/App.xaml.cs
+17
-0
FLY.HeatingHelper.UI.csproj
...lyst.Fix/FLY.HeatingHelper.UI/FLY.HeatingHelper.UI.csproj
+27
-2
MainWindow.xaml
...ThickHeatAnalyst.Fix/FLY.HeatingHelper.UI/MainWindow.xaml
+2
-1
HeatThickDetector.xaml
...lper.UI/UIModule/HeatThickDetector/HeatThickDetector.xaml
+2
-2
HeatThickDetector.xaml.cs
...r.UI/UIModule/HeatThickDetector/HeatThickDetector.xaml.cs
+8
-7
ViewModel_HeatThickDetector.cs
...UIModule/HeatThickDetector/ViewModel_HeatThickDetector.cs
+43
-0
Page_HeatDetector.xaml.cs
...x/FLY.HeatingHelper.UI/UIModule/Page_HeatDetector.xaml.cs
+2
-6
UC_SelectData.xaml
...eatingHelper.UI/UIModule/UC_SelectData/UC_SelectData.xaml
+48
-0
UC_SelectData.xaml.cs
...ingHelper.UI/UIModule/UC_SelectData/UC_SelectData.xaml.cs
+28
-0
ViewModel_UC_SelectData.cs
...lper.UI/UIModule/UC_SelectData/ViewModel_UC_SelectData.cs
+12
-0
IThickHeatData.cs
....ThickHeatAnalyst.Fix/FLY.HeatingHelper/IThickHeatData.cs
+33
-14
ThickHeatData.cs
...Y.ThickHeatAnalyst.Fix/FLY.HeatingHelper/ThickHeatData.cs
+61
-15
ThickHeatData4SQLite_V1.cs
...tAnalyst.Fix/FLY.HeatingHelper/ThickHeatData4SQLite_V1.cs
+21
-10
ThickHeatData4SQLite_V2.cs
...tAnalyst.Fix/FLY.HeatingHelper/ThickHeatData4SQLite_V2.cs
+55
-11
No files found.
Project.FLY.ThickHeatAnalyst.Fix/FLY.HeatingHelper.UI/App.config
View file @
40c272a7
...
...
@@ -18,5 +18,5 @@
<
provider
invariantName
=
"System.Data.SQLite.EF6"
type
=
"System.Data.SQLite.EF6.SQLiteProviderServices, System.Data.SQLite.EF6"
/>
</
providers
>
</
entityFramework
>
</
configuration
>
Project.FLY.ThickHeatAnalyst.Fix/FLY.HeatingHelper.UI/App.xaml
0 → 100644
View file @
40c272a7
<Application x:Class="FLY.HeatingHelper.UI.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:FLY.HeatingHelper.UI"
StartupUri="MainWindow.xaml">
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Controls.xaml" />
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Fonts.xaml" />
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Colors.xaml" />
<!-- accent resource -->
<!-- change "Cobalt" to the accent color you want -->
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Accents/Cobalt.xaml" />
<!-- theme resource -->
<!-- change "BaseLight" to the theme you want -->
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Accents/BaseLight.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>
</Application>
Project.FLY.ThickHeatAnalyst.Fix/FLY.HeatingHelper.UI/App.xaml.cs
0 → 100644
View file @
40c272a7
using
System
;
using
System.Collections.Generic
;
using
System.Configuration
;
using
System.Data
;
using
System.Linq
;
using
System.Threading.Tasks
;
using
System.Windows
;
namespace
FLY.HeatingHelper.UI
{
/// <summary>
/// App.xaml 的交互逻辑
/// </summary>
public
partial
class
App
:
Application
{
}
}
Project.FLY.ThickHeatAnalyst.Fix/FLY.HeatingHelper.UI/FLY.HeatingHelper.UI.csproj
View file @
40c272a7
...
...
@@ -100,9 +100,13 @@
<Reference
Include=
"PresentationFramework"
/>
</ItemGroup>
<ItemGroup>
<Compile
Include=
"UIModule\HeatThickDetector.xaml.cs"
>
<Compile
Include=
"App.xaml.cs"
>
<DependentUpon>
App.xaml
</DependentUpon>
</Compile>
<Compile
Include=
"UIModule\HeatThickDetector\HeatThickDetector.xaml.cs"
>
<DependentUpon>
HeatThickDetector.xaml
</DependentUpon>
</Compile>
<Compile
Include=
"UIModule\HeatThickDetector\ViewModel_HeatThickDetector.cs"
/>
<Compile
Include=
"UIModule\Page_HeatDetector.xaml.cs"
>
<DependentUpon>
Page_HeatDetector.xaml
</DependentUpon>
</Compile>
...
...
@@ -120,6 +124,14 @@
<DependentUpon>
UC_HeatBoltAnalyst.xaml
</DependentUpon>
</Compile>
<Compile
Include=
"UIModule\UC_HeatBoltAnalystViewModel.cs"
/>
<Compile
Include=
"UIModule\UC_SelectData\UC_SelectData.xaml.cs"
>
<DependentUpon>
UC_SelectData.xaml
</DependentUpon>
</Compile>
<Compile
Include=
"UIModule\UC_SelectData\ViewModel_UC_SelectData.cs"
/>
<Page
Include=
"App.xaml"
>
<Generator>
MSBuild:Compile
</Generator>
<SubType>
Designer
</SubType>
</Page>
<Page
Include=
"MainWindow.xaml"
>
<Generator>
MSBuild:Compile
</Generator>
<SubType>
Designer
</SubType>
...
...
@@ -128,7 +140,7 @@
<DependentUpon>
MainWindow.xaml
</DependentUpon>
<SubType>
Code
</SubType>
</Compile>
<Page
Include=
"UIModule\HeatThickDetector.xaml"
>
<Page
Include=
"UIModule\HeatThickDetector
\HeatThickDetector
.xaml"
>
<Generator>
MSBuild:Compile
</Generator>
<SubType>
Designer
</SubType>
</Page>
...
...
@@ -152,6 +164,10 @@
<SubType>
Designer
</SubType>
<Generator>
MSBuild:Compile
</Generator>
</Page>
<Page
Include=
"UIModule\UC_SelectData\UC_SelectData.xaml"
>
<SubType>
Designer
</SubType>
<Generator>
MSBuild:Compile
</Generator>
</Page>
</ItemGroup>
<ItemGroup>
<Compile
Include=
"Properties\AssemblyInfo.cs"
>
...
...
@@ -195,6 +211,15 @@
</ProjectReference>
</ItemGroup>
<ItemGroup>
<PackageReference
Include=
"ControlzEx"
>
<Version>
4.2.1
</Version>
</PackageReference>
<PackageReference
Include=
"MahApps.Metro"
>
<Version>
1.6.5
</Version>
</PackageReference>
<PackageReference
Include=
"MahApps.Metro.IconPacks"
>
<Version>
3.1.0
</Version>
</PackageReference>
<PackageReference
Include=
"MathNet.Numerics"
>
<Version>
4.9.0
</Version>
</PackageReference>
...
...
Project.FLY.ThickHeatAnalyst.Fix/FLY.HeatingHelper.UI/MainWindow.xaml
View file @
40c272a7
...
...
@@ -4,9 +4,10 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:FLY.HeatingHelper.UI"
xmlns:Controls="clr-namespace:MahApps.Metro.Controls;assembly=MahApps.Metro"
mc:Ignorable="d"
Title="MainWindow" Height="450" Width="800">
<Grid>
<Controls:RangeSlider/>
</Grid>
</Window>
Project.FLY.ThickHeatAnalyst.Fix/FLY.HeatingHelper.UI/UIModule/HeatThickDetector.xaml
→
Project.FLY.ThickHeatAnalyst.Fix/FLY.HeatingHelper.UI/UIModule/HeatThickDetector
/HeatThickDetector
.xaml
View file @
40c272a7
...
...
@@ -31,11 +31,11 @@
<RowDefinition Height="Auto"></RowDefinition>
</Grid.RowDefinitions>
<StackPanel Orientation="Horizontal" Grid.Row="0">
<TextBlock Text="{Binding State,Converter={StaticResource StateToMessage}}" Background="AliceBlue"/>
<TextBlock Text="{Binding
Path=Dat.
State,Converter={StaticResource StateToMessage}}" Background="AliceBlue"/>
</StackPanel>
<StackPanel Orientation="Horizontal" Grid.Row="1">
<TextBlock Text="风环偏转"/>
<TextBlock Text="{Binding AirRingShift}" Background="AliceBlue"/>
<TextBlock Text="{Binding
Path=Dat.
AirRingShift}" Background="AliceBlue"/>
</StackPanel>
</Grid>
</Button>
...
...
Project.FLY.ThickHeatAnalyst.Fix/FLY.HeatingHelper.UI/UIModule/HeatThickDetector.xaml.cs
→
Project.FLY.ThickHeatAnalyst.Fix/FLY.HeatingHelper.UI/UIModule/HeatThickDetector
/HeatThickDetector
.xaml.cs
View file @
40c272a7
...
...
@@ -23,25 +23,26 @@ namespace FLY.HeatingHelper.UI.UIModule
public
partial
class
HeatThickDetector
:
Page
{
//ThickHeatData4SQLite_V1 _thickHeatData4SQLite_V1;
IThickHeatData
_dat
;
ViewModel_HeatThickDetector
vm
;
public
HeatThickDetector
()
{
InitializeComponent
();
_dat
=
DataManager
.
GetThickDataInstance
();
_dat
.
SetDB
(
@"D:\blowingdata\airring.sqlite3"
);
this
.
DataContext
=
_dat
;
var
_dat
=
DataManager
.
GetThickDataInstance
();
_dat
.
DBPath
=
@"D:\blowingdata\airring.sqlite3"
;
vm
=
new
ViewModel_HeatThickDetector
(
_dat
);
this
.
DataContext
=
vm
;
}
private
void
Button_Click
(
object
sender
,
RoutedEventArgs
e
)
{
if
(!
_dat
.
IsDataReady
)
return
;
if
(!
vm
.
HasData
)
return
;
NavigationService
ns
=
Application
.
Current
.
Properties
[
"NavigationService"
]
as
NavigationService
;
if
(
ns
!=
null
)
{
if
(
_dat
.
BeginUse
())
if
(
vm
.
_dat
.
BeginUse
())
{
Page_HeatDetector
page
=
new
Page_HeatDetector
();
page
.
InitData
(
_dat
);
page
.
InitData
(
vm
.
_dat
);
ns
.
Navigate
(
page
);
}
}
...
...
Project.FLY.ThickHeatAnalyst.Fix/FLY.HeatingHelper.UI/UIModule/HeatThickDetector/ViewModel_HeatThickDetector.cs
0 → 100644
View file @
40c272a7
using
System
;
using
System.Collections.Generic
;
using
System.ComponentModel
;
using
System.Linq
;
using
System.Text
;
using
System.Threading.Tasks
;
namespace
FLY.HeatingHelper.UI.UIModule
{
public
class
ViewModel_HeatThickDetector
:
INotifyPropertyChanged
{
public
IThickHeatData
_dat
;
public
IThickHeatData
Dat
{
get
{
return
_dat
;
}
set
{
_dat
=
value
;
}
}
public
ViewModel_HeatThickDetector
(
IThickHeatData
dat
)
{
_dat
=
dat
;
}
public
bool
HasData
{
get
{
if
(
_dat
==
null
)
return
false
;
if
(
_dat
.
TotalDataFrom
!=
DateTime
.
MinValue
)
return
true
;
return
false
;
}
}
public
event
PropertyChangedEventHandler
PropertyChanged
;
}
}
Project.FLY.ThickHeatAnalyst.Fix/FLY.HeatingHelper.UI/UIModule/Page_HeatDetector.xaml.cs
View file @
40c272a7
...
...
@@ -230,12 +230,9 @@ namespace FLY.HeatingHelper.UI.UIModule
}
private
void
Data_Updated
(
object
o
,
PropertyChangedEventArgs
e
)
{
if
(
e
.
PropertyName
==
"
IsDataReady
"
)
if
(
e
.
PropertyName
==
"
DataChanged
"
)
{
if
(
_data
.
IsDataReady
)
{
Update_Tab1
();
}
Update_Tab1
();
}
}
#
region
ViewModel
For
Page1
...
...
@@ -311,7 +308,6 @@ namespace FLY.HeatingHelper.UI.UIModule
public
void
Update_Tab1
()
{
if
(!
_data
.
IsDataReady
)
return
;
DBFrom
=
_data
.
TotalDataFrom
;
DBTo
=
_data
.
TotalDataTo
;
//DataFrom = _data.Dat_Times.First();
...
...
Project.FLY.ThickHeatAnalyst.Fix/FLY.HeatingHelper.UI/UIModule/UC_SelectData/UC_SelectData.xaml
0 → 100644
View file @
40c272a7
<UserControl x:Class="FLY.HeatingHelper.UI.UIModule.UC_SelectData.UC_SelectData"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:FLY.HeatingHelper.UI.UIModule.UC_SelectData"
xmlns:Controls="clr-namespace:MahApps.Metro.Controls;assembly=MahApps.Metro"
xmlns:i="http://schemas.microsoft.com/xaml/behaviors"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800">
<UserControl.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Controls.xaml" />
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Fonts.xaml" />
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Colors.xaml" />
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Accents/Cobalt.xaml" />
<!-- theme resource -->
<!-- change "BaseLight" to the theme you want -->
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Accents/BaseLight.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</UserControl.Resources>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Grid Grid.Row="0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="auto"/>
<ColumnDefinition Width="auto"/>
</Grid.ColumnDefinitions>
<StackPanel Orientation="Vertical">
<Controls:DateTimePicker Controls:TextBoxHelper.UseFloatingWatermark="True" Margin="0,0,0,1">
</Controls:DateTimePicker>
<Controls:DateTimePicker Controls:TextBoxHelper.UseFloatingWatermark="True" Margin="0,1,0,0">
</Controls:DateTimePicker>
</StackPanel>
</Grid>
</Grid>
</UserControl>
Project.FLY.ThickHeatAnalyst.Fix/FLY.HeatingHelper.UI/UIModule/UC_SelectData/UC_SelectData.xaml.cs
0 → 100644
View file @
40c272a7
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Text
;
using
System.Threading.Tasks
;
using
System.Windows
;
using
System.Windows.Controls
;
using
System.Windows.Data
;
using
System.Windows.Documents
;
using
System.Windows.Input
;
using
System.Windows.Media
;
using
System.Windows.Media.Imaging
;
using
System.Windows.Navigation
;
using
System.Windows.Shapes
;
namespace
FLY.HeatingHelper.UI.UIModule.UC_SelectData
{
/// <summary>
/// UC_SelectData.xaml 的交互逻辑
/// </summary>
public
partial
class
UC_SelectData
:
UserControl
{
public
UC_SelectData
()
{
InitializeComponent
();
}
}
}
Project.FLY.ThickHeatAnalyst.Fix/FLY.HeatingHelper.UI/UIModule/UC_SelectData/ViewModel_UC_SelectData.cs
0 → 100644
View file @
40c272a7
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Text
;
using
System.Threading.Tasks
;
namespace
FLY.HeatingHelper.UI.UIModule.UC_SelectData
{
class
ViewModel_UC_SelectData
{
}
}
Project.FLY.ThickHeatAnalyst.Fix/FLY.HeatingHelper/IThickHeatData.cs
View file @
40c272a7
...
...
@@ -15,7 +15,11 @@ namespace FLY.HeatingHelper
/// </summary>
public
interface
IThickHeatData
:
INotifyPropertyChanged
{
#
region
用于
UI
的接口
#
region
用于
UI
的接口
(
数据库数据选择接口
)
/// <summary>
/// 数据库路径(含数据库名)
/// </summary>
string
DBPath
{
get
;
set
;
}
/// <summary>
/// 数据库中存在的数据范围
/// </summary>
...
...
@@ -25,14 +29,33 @@ namespace FLY.HeatingHelper
/// <summary>
/// DataTo和DataSpan确定数据的起始位置,对象中存在的数据范围
/// </summary>
DateTime
DataTo
{
get
;
set
;
}
TimeSpan
DataSpan
{
get
;
set
;
}
DateTime
LoadDataFrom
{
get
;
set
;
}
DateTime
LoadDataTo
{
get
;
set
;
}
int
LoadDataMinID
{
get
;
}
int
LoadDataMaxID
{
get
;
}
/// <summary>
/// 加载数据时是否过滤掉加热相同的连续数据
/// </summary>
bool
IsDataFilter
{
get
;
set
;
}
/// <summary>
/// 重新设定加载数据的缺省范围
/// </summary>
void
SetLoadDaTaDefault
();
/// <summary>
/// 加载元数据,主要包括数据的范围,即TotalDataFrom和TotalDataTo
/// </summary>
/// <returns></returns>
int
LoadMetaDataFromDB
();
/// <summary>
/// DFrom和DTo用于确定用于计算的数据
/// 根据上面的设定加载数据,reload=0自动判断是否是否重新加载所有数据,
/// reload=1强制重新加载所有数据
/// reload=-1只加载之后产生的数据
/// </summary>
DateTime
DFrom
{
get
;
set
;
}
DateTime
DTo
{
get
;
set
;
}
/// <returns></returns>
int
LoadDataFromDB
(
int
reload
);
#
endregion
/// <summary>
/// 风环偏差值
...
...
@@ -40,11 +63,6 @@ namespace FLY.HeatingHelper
int
AirRingShift
{
get
;
}
StateCode
State
{
get
;
}
#
endregion
/// <summary>
/// 通知新数据产生
/// </summary>
bool
NewDataArrived
{
set
;
}
int
CalculateFromToByClass
(
int
selected_class
,
ref
int
from
,
ref
int
to
);
...
...
@@ -56,7 +74,6 @@ namespace FLY.HeatingHelper
Tuple
<
int
,
double
>
CalculateAirRingShiftFromCorelVector
(
double
[]
correlVec
);
#
endregion
void
SetDB
(
string
dbname
);
#
region
获取数据接口
/// <summary>
...
...
@@ -87,7 +104,7 @@ namespace FLY.HeatingHelper
int
BoltCnt
{
get
;
}
double
[]
HeatEffect
{
get
;
set
;
}
#
region
整体分析和局部分析的功能
jiekou
#
region
整体分析和局部分析的功能
接口(数据处理)
List
<
HeatBoltAnalystItem
>
SearchFeaturedBoltsItem
(
int
startIdx
,
int
endIdx
,
int
searchNum
,
int
maxFrameInterval
,
int
heatRating
,
int
neglectHeatRate
,
int
Separation
,
int
shiftRange
);
...
...
@@ -123,7 +140,9 @@ namespace FLY.HeatingHelper
/// 检查数据库,当数据库有新数据时,更新DataTo属性,并读取新数据到对象中。该函数可以一定时间间隔执行。
/// </summary>
void
RefreshData
();
bool
IsDataReady
{
get
;
}
int
DataChanged
{
get
;
set
;
}
//bool IsDataReady { get; }
bool
BeginUse
(
bool
isAsync
=
true
);
void
EndUse
();
...
...
Project.FLY.ThickHeatAnalyst.Fix/FLY.HeatingHelper/ThickHeatData.cs
View file @
40c272a7
...
...
@@ -22,7 +22,7 @@ namespace FLY.HeatingHelper
DBName
=
null
;
}
p
ublic
void
SetDB
(
string
dbname
)
p
rivate
void
SetDB
(
string
dbname
)
{
if
(
DBName
==
dbname
)
return
;
DBName
=
dbname
;
...
...
@@ -74,7 +74,7 @@ namespace FLY.HeatingHelper
/// <summary>
/// 从dataTable中提取数据到内部缓冲区
/// </summary>
protected
abstract
void
FetchData
();
protected
abstract
int
FetchData
();
/// <summary>
/// 从dataTable中提取新数据到内部缓冲区
...
...
@@ -104,11 +104,65 @@ namespace FLY.HeatingHelper
#
endregion
#
region
IThickHeatData
接口
public
bool
IsDataReady
{
get
;
internal
set
;
}
=
false
;
public
DateTime
DataTo
{
get
;
set
;
}
public
TimeSpan
DataSpan
{
get
;
set
;
}
public
DateTime
DFrom
{
get
;
set
;
}
public
DateTime
DTo
{
get
;
set
;
}
#
region
用于
UI
的接口
(
数据库数据选择接口
)
//public bool IsDataReady { get; internal set; } = false;
public
int
DataChanged
{
get
;
set
;
}
=
0
;
public
string
DBPath
{
get
{
return
DBName
;
}
set
{
if
(
DBName
==
value
)
return
;
SetDB
(
value
);
}
}
public
DateTime
TotalDataFrom
{
get
;
protected
set
;
}
=
DateTime
.
MinValue
;
public
DateTime
TotalDataTo
{
get
;
protected
set
;
}
=
DateTime
.
MinValue
;
public
DateTime
LoadDataFrom
{
get
;
set
;
}
public
DateTime
LoadDataTo
{
get
;
set
;
}
public
TimeSpan
LoadDataSpan
{
get
;
set
;
}
public
int
LoadDataMinID
{
get
{
if
(
_ids
.
Count
()
<=
0
)
return
-
1
;
return
_ids
.
First
();
}
}
public
int
LoadDataMaxID
{
get
{
if
(
_ids
.
Count
()
<=
0
)
return
-
1
;
return
_ids
.
Last
();
}
}
/// <summary>
/// 加载数据时是否过滤掉加热相同的连续数据
/// </summary>
public
bool
IsDataFilter
{
get
;
set
;
}
=
true
;
/// <summary>
/// 重新设定加载数据的缺省范围
/// </summary>
public
void
SetLoadDaTaDefault
()
{
if
(
TotalDataFrom
==
null
)
return
;
LoadDataTo
=
TotalDataTo
;
LoadDataSpan
=
new
TimeSpan
(
2
,
0
,
0
,
0
);
LoadDataFrom
=
LoadDataTo
-
LoadDataSpan
;
return
;
}
public
abstract
int
LoadMetaDataFromDB
();
public
abstract
int
LoadDataFromDB
(
int
reload
);
#
endregion
public
int
AirRingShift
{
get
;
internal
set
;
}
=
0
;
...
...
@@ -126,12 +180,6 @@ namespace FLY.HeatingHelper
Monitor
.
Exit
(
_sync
);
}
public
bool
NewDataArrived
{
set
=>
RefreshData
();
}
public
DateTime
TotalDataFrom
{
get
;
protected
set
;
}
public
DateTime
TotalDataTo
{
get
;
protected
set
;
}
public
void
CalculateAirRingShift
()
{
//int[] idxs = CalculateMaxHeatVariation(thickClasses[0]);
...
...
@@ -1340,7 +1388,6 @@ namespace FLY.HeatingHelper
/// </summary>
public
void
RefreshData
()
{
IsDataReady
=
false
;
int
newItems
=
0
;
// 计算风环偏转量
if
(
_dat_times
.
Count
()
>
0
)
...
...
@@ -1363,7 +1410,6 @@ namespace FLY.HeatingHelper
AutoSearchForAirRingShift
(
newItems
);
CalculateAirRingShift
();
}
IsDataReady
=
true
;
State
=
StateCode
.
STC_IDLE
;
}
...
...
Project.FLY.ThickHeatAnalyst.Fix/FLY.HeatingHelper/ThickHeatData4SQLite_V1.cs
View file @
40c272a7
...
...
@@ -61,22 +61,22 @@ namespace FLY.HeatingHelper
var
result
=
db
.
Database
.
SqlQuery
<
Temp
>(
"SELECT min(\"结束时间\")as A,MAX(\"结束时间\") as B from HeatData"
).
First
();
TotalDataFrom
=
DateTime
.
Parse
(
result
.
A
);
TotalDataTo
=
DateTime
.
Parse
(
result
.
B
);
DataTo
=
new
DateTime
(
TotalDataTo
.
Ticks
);
DataSpan
=
new
TimeSpan
(
2
,
0
,
0
,
0
);
Load
DataTo
=
new
DateTime
(
TotalDataTo
.
Ticks
);
Load
DataSpan
=
new
TimeSpan
(
2
,
0
,
0
,
0
);
//DataFrom = DBTo - new TimeSpan(2, 0, 0, 0);
}
string
cmdstr
;
if
(
reload
||
_dat_times
.
Count
()
<=
0
)
{
cmdstr
=
string
.
Format
(
"select * from [HeatData2] where 结束时间>=\"{0}\" and 结束时间<=\"{1}\""
,
(
DataTo
-
DataSpan
).
ToString
(
"yyyy-MM-dd HH:mm:ss"
),
DataTo
.
ToString
(
"yyyy-MM-dd HH:mm:ss"
));
(
LoadDataTo
-
Load
DataSpan
).
ToString
(
"yyyy-MM-dd HH:mm:ss"
),
Load
DataTo
.
ToString
(
"yyyy-MM-dd HH:mm:ss"
));
}
else
{
cmdstr
=
string
.
Format
(
"select * from [HeatData2] where 结束时间>=\"{0}\" and 结束时间<=\"{1}\""
,
(
_dat_times
.
Last
()).
ToString
(
"yyyy-MM-dd HH:mm:ss"
),
DataTo
.
ToString
(
"yyyy-MM-dd HH:mm:ss"
));
Load
DataTo
.
ToString
(
"yyyy-MM-dd HH:mm:ss"
));
}
SQLiteDataAdapter
dbDataAdapter
=
new
SQLiteDataAdapter
(
cmdstr
,
connectionString
);
SQLiteCommandBuilder
cb
=
new
SQLiteCommandBuilder
(
dbDataAdapter
);
...
...
@@ -90,13 +90,14 @@ namespace FLY.HeatingHelper
/// <summary>
/// 从dataTable中提取数据到内部缓冲区
/// </summary>
protected
override
void
FetchData
()
protected
override
int
FetchData
()
{
_dat_times
.
Clear
();
_thicks
.
Clear
();
_thick_means
.
Clear
();
_thick_2sigmas
.
Clear
();
_heats
.
Clear
();
int
cnt
=
0
;
int
i
=
1
;
foreach
(
DataRow
dr
in
dataTable
.
Rows
)
{
...
...
@@ -139,10 +140,11 @@ namespace FLY.HeatingHelper
_heats
.
Add
(
heat
.
ToArray
());
_resetBolts
.
Add
(
dr
.
Field
<
int
>(
"复位区号"
));
_rotAngles
.
Add
(
dr
.
Field
<
double
>(
"旋转角度°"
));
cnt
++;
}
BoltCnt
=
_thicks
[
0
].
Count
();
D
From
=
_dat_times
.
First
()
;
DTo
=
_dat_times
.
Last
()
;
D
ataChanged
++
;
return
cnt
;
}
/// <summary>
...
...
@@ -196,11 +198,20 @@ namespace FLY.HeatingHelper
_heats
.
Add
(
heat
.
ToArray
());
cnt
++;
}
DFrom
=
_dat_times
.
First
();
DTo
=
_dat_times
.
Last
();
DataChanged
++;
return
cnt
;
}
public
override
int
LoadMetaDataFromDB
()
{
throw
new
NotImplementedException
();
}
public
override
int
LoadDataFromDB
(
int
reload
)
{
throw
new
NotImplementedException
();
}
private
DataTable
dataTable
=
new
DataTable
();
#
endregion
}
...
...
Project.FLY.ThickHeatAnalyst.Fix/FLY.HeatingHelper/ThickHeatData4SQLite_V2.cs
View file @
40c272a7
...
...
@@ -64,14 +64,14 @@ namespace FLY.HeatingHelper
if
(
dtb
.
Rows
[
0
].
IsNull
(
"A"
))
return
;
TotalDataFrom
=
DateTime
.
Parse
(
dtb
.
Rows
[
0
].
Field
<
string
>(
"A"
));
TotalDataTo
=
DateTime
.
Parse
(
dtb
.
Rows
[
0
].
Field
<
string
>(
"B"
));
DataTo
=
new
DateTime
((
TotalDataTo
+
new
TimeSpan
(
0
,
0
,
1
)).
Ticks
);
DataSpan
=
new
TimeSpan
(
2
,
0
,
0
,
0
);
Load
DataTo
=
new
DateTime
((
TotalDataTo
+
new
TimeSpan
(
0
,
0
,
1
)).
Ticks
);
Load
DataSpan
=
new
TimeSpan
(
2
,
0
,
0
,
0
);
string
cmdstr
;
if
(
reload
||
_ids
.
Count
()
==
0
)
{
cmdstr
=
string
.
Format
(
"select * from [ThickHeat] where IsStable=1 and EndTime>=\"{0}\" and EndTime<=\"{1}\""
,
(
DataTo
-
DataSpan
).
ToString
(
"yyyy-MM-dd HH:mm:ss"
),
DataTo
.
ToString
(
"yyyy-MM-dd HH:mm:ss"
));
(
LoadDataTo
-
Load
DataSpan
).
ToString
(
"yyyy-MM-dd HH:mm:ss"
),
Load
DataTo
.
ToString
(
"yyyy-MM-dd HH:mm:ss"
));
}
else
{
...
...
@@ -94,7 +94,7 @@ namespace FLY.HeatingHelper
/// <summary>
/// 从dataTable中提取数据到内部缓冲区
/// </summary>
protected
override
void
FetchData
()
protected
override
int
FetchData
()
{
_dat_times
.
Clear
();
_thicks
.
Clear
();
...
...
@@ -102,13 +102,14 @@ namespace FLY.HeatingHelper
_thick_2sigmas
.
Clear
();
_heats
.
Clear
();
_ids
.
Clear
();
int
cnt
=
0
;
foreach
(
DataRow
dr
in
dataTable
.
Rows
)
{
string
th_dat
=
dr
.
Field
<
string
>(
"Thicks"
);
string
heat_dat
=
dr
.
Field
<
string
>(
"Heats"
);
var
t1
=
Newtonsoft
.
Json
.
JsonConvert
.
DeserializeObject
<
double
[
]>
(
th_dat
);
var
h1
=
Newtonsoft
.
Json
.
JsonConvert
.
DeserializeObject
<
double
[
]>
(
heat_dat
);
if
(
_heats
.
Count
()
>
0
)
if
(
(
_heats
.
Count
()
>
0
)
&&
IsDataFilter
)
{
if
(
IsHeatSame
(
h1
,
_heats
.
Last
()))
DeleteDataLast
();
}
...
...
@@ -122,10 +123,10 @@ namespace FLY.HeatingHelper
_thick_2sigmas
.
Add
(
r
.
Item2
);
_resetBolts
.
Add
((
int
)
dr
.
Field
<
long
>(
"OrgBoltNo"
));
_rotAngles
.
Add
(
dr
.
Field
<
double
>(
"RAngle"
));
cnt
++;
}
BoltCnt
=
_thicks
[
0
].
Count
();
DFrom
=
_dat_times
.
First
();
DTo
=
_dat_times
.
Last
();
return
cnt
;
}
/// <summary>
...
...
@@ -144,7 +145,7 @@ namespace FLY.HeatingHelper
string
heat_dat
=
dr
.
Field
<
string
>(
"Heats"
);
var
t1
=
Newtonsoft
.
Json
.
JsonConvert
.
DeserializeObject
<
double
[
]>
(
th_dat
);
var
h1
=
Newtonsoft
.
Json
.
JsonConvert
.
DeserializeObject
<
double
[
]>
(
heat_dat
);
if
(
_heats
.
Count
()>
0
)
if
((
_heats
.
Count
()
>
0
)
&&
IsDataFilter
)
{
if
(
IsHeatSame
(
h1
,
_heats
.
Last
()))
DeleteDataLast
();
}
...
...
@@ -160,8 +161,6 @@ namespace FLY.HeatingHelper
_rotAngles
.
Add
(
dr
.
Field
<
double
>(
"RAngle"
));
cnt
++;
}
DFrom
=
_dat_times
.
First
();
DTo
=
_dat_times
.
Last
();
return
cnt
;
}
...
...
@@ -195,6 +194,51 @@ namespace FLY.HeatingHelper
_rotAngles
.
RemoveAt
(
idx
);
}
public
override
int
LoadMetaDataFromDB
()
{
mSQLiteHelper
.
ConnectionString
=
ConnectionString
;
var
dtb
=
mSQLiteHelper
.
ExecuteReader
(
"SELECT min(\"EndTime\")as A,MAX(\"EndTime\") as B from ThickHeat"
);
if
(
dtb
.
Rows
[
0
].
IsNull
(
"A"
))
return
-
1
;
TotalDataFrom
=
DateTime
.
Parse
(
dtb
.
Rows
[
0
].
Field
<
string
>(
"A"
));
TotalDataTo
=
DateTime
.
Parse
(
dtb
.
Rows
[
0
].
Field
<
string
>(
"B"
));
return
0
;
}
public
override
int
LoadDataFromDB
(
int
reload
)
{
mSQLiteHelper
.
ConnectionString
=
ConnectionString
;
string
cmdstr
;
bool
clear
=
false
;
if
((
reload
==
0
&&
_ids
.
Count
()
==
0
)
||
(
reload
==
1
))
{
clear
=
true
;
cmdstr
=
string
.
Format
(
"select * from [ThickHeat] where IsStable=1 and EndTime>=\"{0}\" and EndTime<=\"{1}\""
,
(
LoadDataTo
-
LoadDataSpan
).
ToString
(
"yyyy-MM-dd HH:mm:ss"
),
LoadDataTo
.
ToString
(
"yyyy-MM-dd HH:mm:ss"
));
}
else
{
cmdstr
=
string
.
Format
(
"select * from [ThickHeat] where ID>\"{0}\" and IsStable=1"
,
_ids
.
Last
());
}
try
{
dataTable
=
mSQLiteHelper
.
ExecuteReader
(
cmdstr
);
if
(
clear
)
{
return
FetchData
();
}
else
{
return
FetchNewData
();
}
}
catch
{
return
-
99
;
}
}
private
DataTable
dataTable
=
new
DataTable
();
#
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