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
6203fadd
Commit
6203fadd
authored
Aug 25, 2019
by
潘栩锋
🚴
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
完成新长盛要求的 保存图片功能
parent
9f708bbf
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
1007 additions
and
205 deletions
+1007
-205
App.xaml.cs
...Thick.Blowing/FLY.Thick.Blowing.UI.Fix.Client/App.xaml.cs
+3
-6
FLY.Thick.Blowing.UI.Fix.Client.csproj
...wing.UI.Fix.Client/FLY.Thick.Blowing.UI.Fix.Client.csproj
+7
-0
NLog.config
...Thick.Blowing/FLY.Thick.Blowing.UI.Fix.Client/NLog.config
+44
-0
PgProfileBlowing.xaml
...ing/FLY.Thick.Blowing.UI.Fix.Client/PgProfileBlowing.xaml
+124
-123
PgScanWarning.xaml
...lowing/FLY.Thick.Blowing.UI.Fix.Client/PgScanWarning.xaml
+5
-2
App.xaml.cs
...Thick.Blowing/FLY.Thick.Blowing.UI.Fix.Server/App.xaml.cs
+4
-4
FLY.Thick.Blowing.UI.Fix.Server.csproj
...wing.UI.Fix.Server/FLY.Thick.Blowing.UI.Fix.Server.csproj
+18
-0
MainWindow.xaml
...k.Blowing/FLY.Thick.Blowing.UI.Fix.Server/MainWindow.xaml
+4
-4
MainWindow.xaml.cs
...lowing/FLY.Thick.Blowing.UI.Fix.Server/MainWindow.xaml.cs
+13
-5
NLog.config
...Thick.Blowing/FLY.Thick.Blowing.UI.Fix.Server/NLog.config
+44
-0
PicHistory.cs
...ick.Blowing/FLY.Thick.Blowing.UI.Fix.Server/PicHistory.cs
+242
-0
WindowSavePic.xaml
...lowing/FLY.Thick.Blowing.UI.Fix.Server/WindowSavePic.xaml
+11
-0
WindowSavePic.xaml.cs
...ing/FLY.Thick.Blowing.UI.Fix.Server/WindowSavePic.xaml.cs
+398
-0
ScanWarningServiceClient.cs
...wing/FLY.Thick.Blowing/Client/ScanWarningServiceClient.cs
+7
-0
IScanWarningService.cs
...Blowing/FLY.Thick.Blowing/IService/IScanWarningService.cs
+6
-1
SCANWARNING_OBJ_INTERFACE.cs
....Thick.Blowing/OBJ_INTERFACE/SCANWARNING_OBJ_INTERFACE.cs
+1
-0
ScanWarning_OBJProxy.cs
...FLY.Thick.Blowing/Server.OBJProxy/ScanWarning_OBJProxy.cs
+5
-1
ScanWarning.cs
...FLY.Thick.Blowing/FLY.Thick.Blowing/Server/ScanWarning.cs
+67
-56
TDGage.cs
Project.FLY.Thick.Blowing/FLY.Thick.Blowing/Server/TDGage.cs
+3
-2
thick_public
thick_public
+1
-1
No files found.
Project.FLY.Thick.Blowing/FLY.Thick.Blowing.UI.Fix.Client/App.xaml.cs
View file @
6203fadd
...
...
@@ -14,19 +14,16 @@ namespace FLY.Thick.Blowing.UI.Fix.Client
public
partial
class
App
:
Application
{
FLY
.
AppHelper
.
AppJustOne
appjustone
;
NLog
.
Logger
log
=
NLog
.
LogManager
.
GetLogger
(
"app"
);
public
App
()
{
appjustone
=
new
AppHelper
.
AppJustOne
(
this
);
//DispatcherUnhandledException += App_DispatcherUnhandledException;
AppDomain
.
CurrentDomain
.
UnhandledException
+=
(
s
,
e
)
=>
{
log
.
Error
(
"App()"
,
e
);
string
err
=
e
.
ExceptionObject
.
ToString
();
Misc
.
Log
.
LogMessage
(
"App"
,
0
,
err
);
MessageBox
.
Show
(
"程序出现异常,请把下面信息拍照发给厂家"
+
Environment
.
NewLine
+
err
,
"异常,联系厂家"
,
MessageBoxButton
.
OK
,
MessageBoxImage
.
Error
);
...
...
Project.FLY.Thick.Blowing/FLY.Thick.Blowing.UI.Fix.Client/FLY.Thick.Blowing.UI.Fix.Client.csproj
View file @
6203fadd
...
...
@@ -281,6 +281,7 @@
<SubType>
Designer
</SubType>
</EmbeddedResource>
<None
Include=
"app.config"
/>
<None
Include=
"NLog.config"
/>
<None
Include=
"Properties\Settings.settings"
>
<Generator>
SettingsSingleFileGenerator
</Generator>
<LastGenOutput>
Settings.Designer.cs
</LastGenOutput>
...
...
@@ -394,6 +395,12 @@
<PackageReference
Include=
"Newtonsoft.Json"
>
<Version>
12.0.2
</Version>
</PackageReference>
<PackageReference
Include=
"NLog"
>
<Version>
4.6.6
</Version>
</PackageReference>
<PackageReference
Include=
"NLog.Config"
>
<Version>
4.6.6
</Version>
</PackageReference>
<PackageReference
Include=
"PropertyChanged.Fody"
>
<Version>
2.6.1
</Version>
</PackageReference>
...
...
Project.FLY.Thick.Blowing/FLY.Thick.Blowing.UI.Fix.Client/NLog.config
0 → 100644
View file @
6203fadd
<?
xml
version
=
"1.0"
encoding
=
"utf-8"
?>
<
nlog
xmlns
=
"http://www.nlog-project.org/schemas/NLog.xsd"
xmlns
:
xsi
=
"http://www.w3.org/2001/XMLSchema-instance"
xsi
:
schemaLocation
=
"http://www.nlog-project.org/schemas/NLog.xsd NLog.xsd"
autoReload
=
"true"
throwExceptions
=
"false"
internalLogLevel
=
"Off"
internalLogFile
=
"c:\temp\nlog-internal.log"
>
<!--
optional
,
add
some
variables
https
://
github
.
com
/
nlog
/
NLog
/
wiki
/
Configuration
-
file
#variables
-->
<
variable
name
=
"myvar"
value
=
"myvalue"
/>
<!--
See
https
://
github
.
com
/
nlog
/
nlog
/
wiki
/
Configuration
-
file
for
information
on
customizing
logging
rules
and
outputs
.
-->
<
targets
>
<!--
add
your
targets
here
See
https
://
github
.
com
/
nlog
/
NLog
/
wiki
/
Targets
for
possible
targets
.
See
https
://
github
.
com
/
nlog
/
NLog
/
wiki
/
Layout
-
Renderers
for
the
possible
layout
renderers
.
-->
<!--
Write
events
to
a
file
with
the
date
in
the
filename
.
<
target
xsi
:
type
=
"File"
name
=
"f"
fileName
=
"${basedir}/logs/${shortdate}.log"
layout
=
"${longdate} ${uppercase:${level}} ${message}"
/>
-->
<
target
xsi
:
type
=
"File"
name
=
"f"
fileName
=
"${basedir}/logs/${shortdate}.log"
layout
=
"${longdate} ${uppercase:${level}} ${message}"
/>
</
targets
>
<
rules
>
<!--
add
your
logging
rules
here
-->
<!--
Write
all
events
with
minimal
level
of
Debug
(
So
Debug
,
Info
,
Warn
,
Error
and
Fatal
,
but
not
Trace
)
to
"f"
<
logger
name
=
"*"
minlevel
=
"Debug"
writeTo
=
"f"
/>
-->
<
logger
name
=
"app"
minlevel
=
"Debug"
writeTo
=
"f"
/>
</
rules
>
</
nlog
>
Project.FLY.Thick.Blowing/FLY.Thick.Blowing.UI.Fix.Client/PgProfileBlowing.xaml
View file @
6203fadd
This diff is collapsed.
Click to expand it.
Project.FLY.Thick.Blowing/FLY.Thick.Blowing.UI.Fix.Client/PgScanWarning.xaml
View file @
6203fadd
...
...
@@ -41,14 +41,17 @@
<TextBlock Style="{StaticResource ResourceKey=TextBlockStyle_FieldHeaderEditable}" Text="使能" />
<ToggleButton Style="{StaticResource ToggleButtonStyle1}" IsChecked="{Binding Enable}" />
</StackPanel>
<StackPanel Orientation="Vertical" Margin="5" >
<TextBlock Style="{StaticResource ResourceKey=TextBlockStyle_FieldHeaderEditable}" Text="自动目标值" />
<ToggleButton Style="{StaticResource ToggleButtonStyle1}" IsChecked="{Binding IsAutoTarget}" />
</StackPanel>
</StackPanel>
<StackPanel Orientation="Horizontal" Margin="5">
<TextBlock Style="{StaticResource ResourceKey=TextBlockStyle_FieldHeaderEditable}" Text="连续" />
<TextBox Style="{StaticResource ResourceKey=TextBoxStyle_FieldContent}" Text="{Binding AlarmCnt_Tolerance}" />
<TextBlock Style="{StaticResource ResourceKey=TextBlockStyle_FieldContent_mm}" Text="个分区"/>
<TextBlock Style="{StaticResource ResourceKey=TextBlockStyle_FieldHeaderEditable}" Text="超出" />
<TextBlock Style="{StaticResource ResourceKey=TextBlockStyle_FieldHeaderEditable}" Text="
规格线
" Foreground="DarkRed" FontSize="30"/>
<TextBlock Style="{StaticResource ResourceKey=TextBlockStyle_FieldHeaderEditable}" Text="
公差
" Foreground="DarkRed" FontSize="30"/>
<TextBlock Style="{StaticResource ResourceKey=TextBlockStyle_FieldHeaderEditable}" Text="报警" />
</StackPanel>
...
...
Project.FLY.Thick.Blowing/FLY.Thick.Blowing.UI.Fix.Server/App.xaml.cs
View file @
6203fadd
...
...
@@ -14,6 +14,7 @@ namespace FLY.Thick.Blowing.UI.Fix.Server
public
partial
class
App
:
Application
{
FLY
.
AppHelper
.
AppJustOne
appjustone
;
NLog
.
Logger
log
=
NLog
.
LogManager
.
GetLogger
(
"app"
);
public
App
()
{
appjustone
=
new
AppHelper
.
AppJustOne
(
this
);
...
...
@@ -22,10 +23,9 @@ namespace FLY.Thick.Blowing.UI.Fix.Server
AppDomain
.
CurrentDomain
.
UnhandledException
+=
(
s
,
e
)
=>
{
log
.
Error
(
"App()"
,
e
);
string
err
=
e
.
ExceptionObject
.
ToString
();
Misc
.
Log
.
LogMessage
(
"App"
,
0
,
err
);
MessageBox
.
Show
(
"程序出现异常,请把下面信息拍照发给厂家"
+
Environment
.
NewLine
+
err
,
"异常,联系厂家"
,
MessageBoxButton
.
OK
,
MessageBoxImage
.
Error
);
...
...
@@ -38,7 +38,7 @@ namespace FLY.Thick.Blowing.UI.Fix.Server
var
cfg
=
new
AutoMapper
.
Configuration
.
MapperConfigurationExpression
();
//var assemblies = System.AppDomain.CurrentDomain.GetAssemblies();
//cfg.AddMaps(assemblies);
cfg
.
AddMaps
(
"FLY.Thick.Blowing
.UI.Fix.Server
"
);
cfg
.
AddMaps
(
"FLY.Thick.Blowing"
);
AutoMapper
.
Mapper
.
Initialize
(
cfg
);
}
...
...
Project.FLY.Thick.Blowing/FLY.Thick.Blowing.UI.Fix.Server/FLY.Thick.Blowing.UI.Fix.Server.csproj
View file @
6203fadd
...
...
@@ -52,6 +52,7 @@
<Reference
Include=
"System.Data"
/>
<Reference
Include=
"System.Drawing"
/>
<Reference
Include=
"System.Windows.Forms"
/>
<Reference
Include=
"System.Windows.Forms.DataVisualization"
/>
<Reference
Include=
"System.Xml"
/>
<Reference
Include=
"Microsoft.CSharp"
/>
<Reference
Include=
"System.Core"
/>
...
...
@@ -60,15 +61,21 @@
<Reference
Include=
"System.Xaml"
>
<RequiredTargetFramework>
4.0
</RequiredTargetFramework>
</Reference>
<Reference
Include=
"UIAutomationProvider"
/>
<Reference
Include=
"WindowsBase"
/>
<Reference
Include=
"PresentationCore"
/>
<Reference
Include=
"PresentationFramework"
/>
<Reference
Include=
"WindowsFormsIntegration"
/>
</ItemGroup>
<ItemGroup>
<ApplicationDefinition
Include=
"App.xaml"
>
<Generator>
MSBuild:Compile
</Generator>
<SubType>
Designer
</SubType>
</ApplicationDefinition>
<Compile
Include=
"PicHistory.cs"
/>
<Compile
Include=
"WindowSavePic.xaml.cs"
>
<DependentUpon>
WindowSavePic.xaml
</DependentUpon>
</Compile>
<Page
Include=
"MainWindow.xaml"
>
<Generator>
MSBuild:Compile
</Generator>
<SubType>
Designer
</SubType>
...
...
@@ -81,6 +88,10 @@
<DependentUpon>
MainWindow.xaml
</DependentUpon>
<SubType>
Code
</SubType>
</Compile>
<Page
Include=
"WindowSavePic.xaml"
>
<SubType>
Designer
</SubType>
<Generator>
MSBuild:Compile
</Generator>
</Page>
</ItemGroup>
<ItemGroup>
<Compile
Include=
"Properties\AssemblyInfo.cs"
>
...
...
@@ -102,6 +113,7 @@
<SubType>
Designer
</SubType>
</EmbeddedResource>
<None
Include=
"app.config"
/>
<None
Include=
"NLog.config"
/>
<None
Include=
"Properties\Settings.settings"
>
<Generator>
SettingsSingleFileGenerator
</Generator>
<LastGenOutput>
Settings.Designer.cs
</LastGenOutput>
...
...
@@ -149,6 +161,12 @@
<PackageReference
Include=
"Costura.Fody"
>
<Version>
3.3.3
</Version>
</PackageReference>
<PackageReference
Include=
"NLog"
>
<Version>
4.6.6
</Version>
</PackageReference>
<PackageReference
Include=
"NLog.Config"
>
<Version>
4.6.6
</Version>
</PackageReference>
<PackageReference
Include=
"System.Data.SQLite"
>
<Version>
1.0.111
</Version>
</PackageReference>
...
...
Project.FLY.Thick.Blowing/FLY.Thick.Blowing.UI.Fix.Server/MainWindow.xaml
View file @
6203fadd
...
...
@@ -3,7 +3,7 @@
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow"
ResizeMode="CanMinimize" Icon="/FLY.Thick.Blowing.UI.Fix.Server;component/BlowingFixServer.ico
">
Icon="/FLY.Thick.Blowing.UI.Fix.Server;component/BlowingFixServer.ico" SizeToContent="WidthAndHeight
">
<Window.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
...
...
@@ -16,12 +16,12 @@
<StackPanel Orientation="Vertical" >
<StackPanel Orientation="Vertical" Margin="5,20">
<StackPanel Orientation="Vertical" Margin="5">
<TextBlock Style="{StaticResource ResourceKey=TextBlockStyle_FieldHeader
Editable}" Text="本地IP &端口
" />
<TextBlock Style="{StaticResource ResourceKey=TextBlockStyle_FieldHeader
}" Text="本地地址
" />
<StackPanel Orientation="Horizontal">
<TextBox Style="{StaticResource ResourceKey=TextBoxStyle_FieldContent}" Text="{Binding LocalEP, Converter={StaticResource ResourceKey=ipepconv}}" Tag="Full" MinWidth="250" Width="378"
/>
<TextBlock Style="{StaticResource TextBlockStyle_FieldContent}" Text="{Binding LocalEP, Converter={StaticResource ResourceKey=ipepconv}}" MinWidth="250"
/>
</StackPanel>
</StackPanel>
<Button Style="{StaticResource ButtonStyle2}" Content="保存" Width="AUTO" Click="button_save
_Click"/>
<Button x:Name="btnOpen" Style="{StaticResource ButtonStyle2}" Content="打开图片文件夹" FontSize="25" Width="AUTO" Click="button_open
_Click"/>
</StackPanel>
</StackPanel>
...
...
Project.FLY.Thick.Blowing/FLY.Thick.Blowing.UI.Fix.Server/MainWindow.xaml.cs
View file @
6203fadd
...
...
@@ -30,13 +30,22 @@ namespace FLY.Thick.Blowing.UI.Fix.Server
FLY
.
AppHelper
.
WindowNotifyIconHelper
notifyiconhelper
;
TDGage
mGage
;
OBJProxy
mOBJProxy
;
PicHistory
mPicHistory
;
public
MainWindow
()
{
InitializeComponent
();
mGage
=
new
TDGage
(
"Gage1"
);
mOBJProxy
=
new
OBJProxy
(
0
,
mGage
);
mPicHistory
=
new
PicHistory
();
if
(!
mPicHistory
.
Enable
)
btnOpen
.
Visibility
=
Visibility
.
Collapsed
;
mGage
.
mScanWarning
.
ScanWarningCheck
+=
(
s
,
e
)
=>
{
mPicHistory
.
Add
(
e
.
profile
,
e
.
scandata
,
e
.
isWarning
);
};
Misc
.
BindingOperations
.
SetBinding
(
mGage
.
mScanWarning
,
"IsAutoTarget"
,
mPicHistory
,
"IsAutoTarget"
);
this
.
Title
=
(
new
Misc
.
Ver
()
{
SrcType
=
typeof
(
MainWindow
)
}).
ToString
();
...
...
@@ -49,11 +58,10 @@ namespace FLY.Thick.Blowing.UI.Fix.Server
this
.
DataContext
=
mGage
.
mSysParam
;
}
private
void
button_save_Click
(
object
sender
,
RoutedEventArgs
e
)
private
void
button_open_Click
(
object
sender
,
RoutedEventArgs
e
)
{
mGage
.
mSysParam
.
Save
();
string
path
=
mPicHistory
.
RootPath
;
System
.
Diagnostics
.
Process
.
Start
(
"explorer.exe"
,
path
);
}
}
}
Project.FLY.Thick.Blowing/FLY.Thick.Blowing.UI.Fix.Server/NLog.config
0 → 100644
View file @
6203fadd
<?
xml
version
=
"1.0"
encoding
=
"utf-8"
?>
<
nlog
xmlns
=
"http://www.nlog-project.org/schemas/NLog.xsd"
xmlns
:
xsi
=
"http://www.w3.org/2001/XMLSchema-instance"
xsi
:
schemaLocation
=
"http://www.nlog-project.org/schemas/NLog.xsd NLog.xsd"
autoReload
=
"true"
throwExceptions
=
"false"
internalLogLevel
=
"Off"
internalLogFile
=
"c:\temp\nlog-internal.log"
>
<!--
optional
,
add
some
variables
https
://
github
.
com
/
nlog
/
NLog
/
wiki
/
Configuration
-
file
#variables
-->
<
variable
name
=
"myvar"
value
=
"myvalue"
/>
<!--
See
https
://
github
.
com
/
nlog
/
nlog
/
wiki
/
Configuration
-
file
for
information
on
customizing
logging
rules
and
outputs
.
-->
<
targets
>
<!--
add
your
targets
here
See
https
://
github
.
com
/
nlog
/
NLog
/
wiki
/
Targets
for
possible
targets
.
See
https
://
github
.
com
/
nlog
/
NLog
/
wiki
/
Layout
-
Renderers
for
the
possible
layout
renderers
.
-->
<!--
Write
events
to
a
file
with
the
date
in
the
filename
.
<
target
xsi
:
type
=
"File"
name
=
"f"
fileName
=
"${basedir}/logs/${shortdate}.log"
layout
=
"${longdate} ${uppercase:${level}} ${message}"
/>
-->
<
target
xsi
:
type
=
"File"
name
=
"f"
fileName
=
"${basedir}/logs/${shortdate}.log"
layout
=
"${longdate} ${uppercase:${level}} ${message}"
/>
</
targets
>
<
rules
>
<!--
add
your
logging
rules
here
-->
<!--
Write
all
events
with
minimal
level
of
Debug
(
So
Debug
,
Info
,
Warn
,
Error
and
Fatal
,
but
not
Trace
)
to
"f"
<
logger
name
=
"*"
minlevel
=
"Debug"
writeTo
=
"f"
/>
-->
<
logger
name
=
"app"
minlevel
=
"Debug"
writeTo
=
"f"
/>
</
rules
>
</
nlog
>
Project.FLY.Thick.Blowing/FLY.Thick.Blowing.UI.Fix.Server/PicHistory.cs
0 → 100644
View file @
6203fadd
using
FLY.Thick.Blowing.Server.Model
;
using
System
;
using
System.Collections.Generic
;
using
System.ComponentModel
;
using
System.IO
;
using
System.Linq
;
using
System.Text
;
using
System.Text.RegularExpressions
;
using
System.Threading.Tasks
;
namespace
FLY.Thick.Blowing.UI.Fix.Server
{
public
class
PicHistory
:
INotifyPropertyChanged
,
Misc
.
ISaveToXml
{
/// <summary>
/// 数据能保存的天数
/// </summary>
public
int
KeepDay
{
get
;
set
;
}
=
180
;
/// <summary>
/// Y轴比例
/// </summary>
public
int
YRangePercent
{
get
;
set
;
}
=
3
;
/// <summary>
/// 曲线类型
/// </summary>
public
CHART_TYPE
ChartType
{
get
;
set
;
}
=
CHART_TYPE
.
Column
;
/// <summary>
/// 保存的根路径
/// </summary>
public
string
RootPath
{
get
;
set
;
}
=
@"D:\flydata\pic_history"
;
/// <summary>
/// 使能
/// </summary>
public
bool
Enable
{
get
;
set
;
}
=
false
;
/// <summary>
/// 自动目标值
/// </summary>
public
bool
IsAutoTarget
{
get
;
set
;
}
=
true
;
/// <summary>
/// 当前保存的数据天数
/// </summary>
public
int
CurrDays
{
get
;
private
set
;
}
double
Target
{
get
;
set
;
}
=
double
.
NaN
;
double
TolerancePercent
{
get
;
set
;
}
=
double
.
NaN
;
string
Title
{
get
;
set
;
}
/// <summary>
/// 已经保存了数据的日期,
/// </summary>
private
List
<
DateTime
>
dateInRootPath
=
new
List
<
DateTime
>();
public
PicHistory
()
{
Load
();
InitKeepDay
();
}
string
CreateCurrPath
(
DateTime
time
,
bool
isWarning
)
{
//创建路径
DateTime
dt
=
time
;
string
dirpath
;
if
(
isWarning
)
{
dirpath
=
RootPath
+
@"\iswarning\"
+
dt
.
ToString
(
@"yyyy\\MM\\dd"
);
}
else
{
dirpath
=
RootPath
+
@"\all\"
+
dt
.
ToString
(
@"yyyy\\MM\\dd"
);
}
Directory
.
CreateDirectory
(
dirpath
);
return
dirpath
+
@"\"
+
dt
.
ToString
(
"HH_mm_ss"
);
}
public
async
Task
Add
(
DB_Profile
dB_Profile
,
LC_ScanData
scanData
,
bool
isWarning
)
{
Target
=
dB_Profile
.
Target
;
TolerancePercent
=
dB_Profile
.
TolerancePercent
;
if
(
double
.
IsNaN
(
Target
))
return
;
if
(
double
.
IsNaN
(
TolerancePercent
))
return
;
Title
=
$"
{
dB_Profile
.
PName
}
-
{
dB_Profile
.
OrderNo
}
-
{
dB_Profile
.
Number
}
"
;
string
title
=
Title
+
" "
+
scanData
.
Time
.
ToString
();
//ALL
string
path
=
CreateCurrPath
(
scanData
.
Time
,
false
);
bool
ret
=
false
;
App
.
Current
.
MainWindow
.
Dispatcher
.
Invoke
(()
=>
{
WindowSavePic
w
=
new
WindowSavePic
();
ret
=
w
.
Paint
(
scanData
,
title
,
IsAutoTarget
,
Target
,
TolerancePercent
,
path
+
".jpg"
,
YRangePercent
,
ChartType
);
});
if
(!
ret
)
return
;
await
Task
.
Factory
.
StartNew
(()
=>
{
try
{
if
(
isWarning
)
{
string
path_iswarning
=
CreateCurrPath
(
scanData
.
Time
,
isWarning
);
File
.
Copy
(
path
+
".jpg"
,
path_iswarning
+
".jpg"
,
true
);
}
Keep
();
}
catch
{
return
;
}
});
}
#
region
自动删数据
private
void
InitKeepDay
()
{
dateInRootPath
.
Clear
();
if
(!
Directory
.
Exists
(
RootPath
+
@"\all"
))
{
Directory
.
CreateDirectory
(
RootPath
+
@"\all"
);
return
;
}
DirectoryInfo
mydir
=
new
DirectoryInfo
(
RootPath
+
@"\all"
);
//年
Regex
regex_year
=
new
Regex
(
@"\d{4}"
);
Regex
regex_month
=
new
Regex
(
@"\d{2}"
);
Regex
regex_day
=
new
Regex
(
@"\d{2}"
);
var
fsil_year
=
from
fsi
in
mydir
.
GetFileSystemInfos
()
where
(
fsi
.
Attributes
==
FileAttributes
.
Directory
)
&&
(
regex_year
.
IsMatch
(
fsi
.
Name
))
select
fsi
;
foreach
(
var
fsi_year
in
fsil_year
)
{
var
fsil_month
=
from
fsi
in
((
DirectoryInfo
)
fsi_year
).
GetFileSystemInfos
()
where
(
fsi
.
Attributes
==
FileAttributes
.
Directory
)
&&
(
regex_month
.
IsMatch
(
fsi
.
Name
))
select
fsi
;
foreach
(
var
fsi_month
in
fsil_month
)
{
var
fsil_day
=
from
fsi
in
((
DirectoryInfo
)
fsi_month
).
GetFileSystemInfos
()
where
(
fsi
.
Attributes
==
FileAttributes
.
Directory
)
&&
(
regex_day
.
IsMatch
(
fsi
.
Name
))
select
fsi
;
foreach
(
var
fsi_day
in
fsil_day
)
{
DateTime
dt
=
new
DateTime
(
int
.
Parse
(
fsi_year
.
Name
),
int
.
Parse
(
fsi_month
.
Name
),
int
.
Parse
(
fsi_day
.
Name
));
//if (DateTime.TryParse(fsi_year.Name.ToString() + "-" + fsi_month.Name.ToString() + "-" + fsi_day.Name.ToString(), out dt))
{
dateInRootPath
.
Add
(
dt
);
}
}
}
}
dateInRootPath
.
Sort
(
new
Comparison
<
DateTime
>(
delegate
(
DateTime
t1
,
DateTime
t2
)
{
if
(
t1
>
t2
)
return
1
;
else
if
(
t1
==
t2
)
return
0
;
else
return
-
1
;
}));
CurrDays
=
dateInRootPath
.
Count
;
Keep
();
}
private
void
Keep
()
{
while
(
dateInRootPath
.
Count
>
KeepDay
)
{
string
dirpath
=
RootPath
+
@"\all\"
+
dateInRootPath
.
First
().
ToString
(
@"yyyy\\MM\\dd"
);
Directory
.
Delete
(
dirpath
,
true
);
dirpath
=
RootPath
+
@"\iswarning\"
+
dateInRootPath
.
First
().
ToString
(
@"yyyy\\MM\\dd"
);
Directory
.
Delete
(
dirpath
,
true
);
dateInRootPath
.
RemoveAt
(
0
);
}
CurrDays
=
dateInRootPath
.
Count
;
}
#
endregion
public
string
[]
GetSavePropertyNames
()
{
return
new
string
[]{
"KeepDay"
,
"YRangePercent"
,
"ChartType"
,
"RootPath"
,
"Enable"
};
}
/// <summary>
/// 加载历史数据
/// </summary>
/// <returns></returns>
public
bool
Load
()
{
return
Misc
.
SaveToXmlHepler
.
Load
(
"pichistory.xml"
,
this
);
}
/// <summary>
/// 保存
/// </summary>
public
void
Save
()
{
Misc
.
SaveToXmlHepler
.
Save
(
"pichistory.xml"
,
this
);
}
#
region
INotifyPropertyChanged
成员
public
event
PropertyChangedEventHandler
PropertyChanged
;
#
endregion
}
}
Project.FLY.Thick.Blowing/FLY.Thick.Blowing.UI.Fix.Server/WindowSavePic.xaml
0 → 100644
View file @
6203fadd
<Window x:Class="FLY.Thick.Blowing.UI.Fix.Server.WindowSavePic"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:Chr="clr-namespace:System.Windows.Forms.DataVisualization.Charting;assembly=System.Windows.Forms.DataVisualization"
Title="WindowSavePic" >
<Grid>
<WindowsFormsHost Background="Black" Width="1024" Height="250">
<Chr:Chart x:Name="chart1" Width="1024" Height="250"/>
</WindowsFormsHost>
</Grid>
</Window>
Project.FLY.Thick.Blowing/FLY.Thick.Blowing.UI.Fix.Server/WindowSavePic.xaml.cs
0 → 100644
View file @
6203fadd
This diff is collapsed.
Click to expand it.
Project.FLY.Thick.Blowing/FLY.Thick.Blowing/Client/ScanWarningServiceClient.cs
View file @
6203fadd
...
...
@@ -28,6 +28,11 @@ namespace FLY.Thick.Blowing.Client
/// </summary>
public
bool
Enable
{
get
;
set
;
}
/// <summary>
/// 自动目标值
/// </summary>
public
bool
IsAutoTarget
{
get
;
set
;
}
/// <summary>
/// 连续N个点,大于规格线(公差)才算报警
/// </summary>
...
...
@@ -39,6 +44,7 @@ namespace FLY.Thick.Blowing.Client
SCANWARNING_OBJ_INTERFACE
.
Pack_Params
p
=
new
SCANWARNING_OBJ_INTERFACE
.
Pack_Params
();
p
.
alarmcnt_tolerance
=
AlarmCnt_Tolerance
;
p
.
enable
=
Enable
;
p
.
isAutoTarget
=
IsAutoTarget
;
string
json
=
JsonConvert
.
SerializeObject
(
p
);
//获取所有数据,设置推送
...
...
@@ -80,6 +86,7 @@ namespace FLY.Thick.Blowing.Client
AlarmCnt_Tolerance
=
p
.
alarmcnt_tolerance
;
Enable
=
p
.
enable
;
IsAutoTarget
=
p
.
isAutoTarget
;
}
break
;
}
}
...
...
Project.FLY.Thick.Blowing/FLY.Thick.Blowing/IService/IScanWarningService.cs
View file @
6203fadd
...
...
@@ -12,7 +12,12 @@ namespace FLY.Thick.Blowing.IService
/// 使能
/// </summary>
bool
Enable
{
get
;
set
;
}
/// <summary>
/// 自动目标值
/// </summary>
bool
IsAutoTarget
{
get
;
set
;
}
/// <summary>
/// 连续N个点,大于规格线(公差)才算报警
/// </summary>
...
...
Project.FLY.Thick.Blowing/FLY.Thick.Blowing/OBJ_INTERFACE/SCANWARNING_OBJ_INTERFACE.cs
View file @
6203fadd
...
...
@@ -12,6 +12,7 @@ namespace FLY.Thick.Blowing.OBJ_INTERFACE
public
class
Pack_Params
{
public
bool
enable
;
public
bool
isAutoTarget
;
public
int
alarmcnt_tolerance
;
}
#
endregion
...
...
Project.FLY.Thick.Blowing/FLY.Thick.Blowing/Server.OBJProxy/ScanWarning_OBJProxy.cs
View file @
6203fadd
...
...
@@ -29,7 +29,8 @@ namespace FLY.Thick.Blowing.Server.OBJProxy
void
mScanWarning_PropertyChanged
(
object
sender
,
System
.
ComponentModel
.
PropertyChangedEventArgs
e
)
{
if
((
e
.
PropertyName
==
"AlarmCnt_Tolerance"
)
||
(
e
.
PropertyName
==
"Enable"
)
(
e
.
PropertyName
==
"Enable"
)
||
(
e
.
PropertyName
==
"IsAutoTarget"
)
)
{
FObjBase
.
PollModule
.
Current
.
Poll_JustOnce
(
...
...
@@ -54,6 +55,8 @@ namespace FLY.Thick.Blowing.Server.OBJProxy
{
alarmcnt_tolerance
=
mScanWarning
.
AlarmCnt_Tolerance
,
enable
=
mScanWarning
.
Enable
,
isAutoTarget
=
mScanWarning
.
IsAutoTarget
};
string
json
=
JsonConvert
.
SerializeObject
(
p
);
...
...
@@ -77,6 +80,7 @@ namespace FLY.Thick.Blowing.Server.OBJProxy
mScanWarning
.
AlarmCnt_Tolerance
=
p
.
alarmcnt_tolerance
;
mScanWarning
.
Enable
=
p
.
enable
;
mScanWarning
.
IsAutoTarget
=
p
.
isAutoTarget
;
mScanWarning
.
Apply
();
}
break
;
}
...
...
Project.FLY.Thick.Blowing/FLY.Thick.Blowing/Server/ScanWarning.cs
View file @
6203fadd
...
...
@@ -12,13 +12,15 @@ using FLY.OBJComponents.Common;
using
FLY.Thick.Blowing.IService.IBulkDBServicePack
;
using
FLY.Thick.Blowing.IService
;
using
FLY.Thick.Blowing.Common
;
using
Misc
;
using
FLY.Thick.Blowing.Server.Model
;
namespace
FLY.Thick.Blowing.Server
{
public
class
ScanWarning
:
Misc
.
ISaveToXml
,
INotifyPropertyChanged
,
IScanWarningService
{
private
WarningSystem
mWarning
;
private
I
BulkDBService
mBulk
DB
;
private
I
ShareDBService
mshare
DB
;
/// <summary>
/// 使能
...
...
@@ -26,30 +28,43 @@ namespace FLY.Thick.Blowing.Server
public
bool
Enable
{
get
;
set
;
}
/// <summary>
///
目标值,绑定 profileparam.Target
///
自动目标值
/// </summary>
public
double
Target
{
get
;
set
;
}
/// <summary>
/// 产品公差,绑定 profileparam.TolerancePercent
/// </summary>
public
double
TolerancePercent
{
get
;
set
;
}
public
bool
IsAutoTarget
{
get
;
set
;
}
=
true
;
/// <summary>
/// 连续N个点,大于规格线(公差)才算报警
/// </summary>
public
int
AlarmCnt_Tolerance
{
get
;
set
;
}
=
10
;
public
event
ScanWarningCheckEventHandler
ScanWarningCheck
;
enum
CheckResult
{
Idle
,
ToleranceWarning
,
}
CheckResult
Check
(
double
[]
data
)
//数据是环形的。
/// <summary>
/// 数据是环形的。
/// </summary>
/// <param name="target"></param>
/// <param name="tolerancePercent"></param>
/// <param name="data"></param>
/// <returns></returns>
CheckResult
Check
(
double
target
,
double
tolerancePercent
,
double
[]
data
)
{
double
tolerance
=
Target
*
TolerancePercent
;
double
avg
=
data
.
AverageNoNull
();
if
(
double
.
IsNaN
(
avg
))
return
CheckResult
.
Idle
;
if
(
IsAutoTarget
)
target
=
avg
;
double
tolerance
=
target
*
tolerancePercent
;
int
cnt_tolerance
=
0
;
int
start_tolerance
=
0
;
int
valid_index
=
-
1
;
//第1个合格范围数据
for
(
int
i
=
0
;
i
<
data
.
Length
;
i
++)
...
...
@@ -57,13 +72,12 @@ namespace FLY.Thick.Blowing.Server
double
d
=
data
[
i
];
if
(
double
.
IsNaN
(
d
))
continue
;
double
delta
=
Math
.
Abs
(
d
-
T
arget
);
double
delta
=
Math
.
Abs
(
d
-
t
arget
);
if
(
delta
>
tolerance
)
{
//触发
if
(
cnt_tolerance
==
0
)
start_tolerance
=
i
;
cnt_tolerance
++;
if
(
cnt_tolerance
>=
AlarmCnt_Tolerance
)
{
...
...
@@ -85,7 +99,7 @@ namespace FLY.Thick.Blowing.Server
double
d
=
data
[
i
];
if
(
double
.
IsNaN
(
d
))
continue
;
double
delta
=
Math
.
Abs
(
d
-
T
arget
);
double
delta
=
Math
.
Abs
(
d
-
t
arget
);
if
(
delta
>
tolerance
)
{
//触发
...
...
@@ -109,57 +123,39 @@ namespace FLY.Thick.Blowing.Server
Load
();
}
public
void
Init
(
WarningSystem
warning
,
BlowingFixProfileParam
profileParam
,
IBulkDBService
bulk
DB
)
public
void
Init
(
WarningSystem
warning
,
IShareDBService
share
DB
)
{
mWarning
=
warning
;
mBulkDB
=
bulkDB
;
Misc
.
BindingOperations
.
SetBinding
(
profileParam
,
"Target"
,
this
,
"Target"
);
Misc
.
BindingOperations
.
SetBinding
(
profileParam
,
"TolerancePercent"
,
this
,
"TolerancePercent"
);
mshareDB
=
shareDB
;
m
BulkDB
.
PropertyChanged
+=
MBulkDB_Property
Changed
;
m
shareDB
.
ScanDataChanged
+=
MshareDB_ScanData
Changed
;
}
private
void
M
BulkDB_PropertyChanged
(
object
sender
,
Property
ChangedEventArgs
e
)
private
void
M
shareDB_ScanDataChanged
(
object
sender
,
IService
.
IShareDBServicePack
.
ScanData
ChangedEventArgs
e
)
{
if
(
e
.
PropertyName
==
"Count"
)
if
(!
e
.
isInsert
)
return
;
if
(!
Enable
)
return
;
mshareDB
.
GetProfile
((
asyncContext
,
retData
)
=>
{
if
(
Enable
)
{
if
(
mBulkDB
.
Count
>
0
)
{
int
lastIndex
=
mBulkDB
.
Count
-
1
;
mBulkDB
.
GetFrame
(
new
Pack_GetFrameRequest
()
{
Index
=
lastIndex
,
Count
=
1
},
GetFrameCB
,
null
);
DB_Profile
dB_Profile
=
retData
as
DB_Profile
;
if
(
dB_Profile
==
null
)
return
;
}
}
}
GetFrameCB
(
dB_Profile
,
e
.
scandata
);
},
null
);
}
void
GetFrameCB
(
object
AyncContext
,
object
ret
Data
)
void
GetFrameCB
(
DB_Profile
dB_Profile
,
LC_ScanData
lc_Scan
Data
)
{
Pack_GetFrameReponse
reponse
=
retData
as
Pack_GetFrameReponse
;
CheckResult
result
=
Check
(
dB_Profile
.
Target
,
dB_Profile
.
TolerancePercent
,
lc_ScanData
.
Thicks
)
;
CheckResult
result
;
string
accessory
=
""
;
if
(
reponse
.
Values
!=
null
&&
reponse
.
Values
.
Count
()
>
0
)
{
Model
.
LC_ScanData
lc_ScanData
=
reponse
.
Values
.
First
();
result
=
Check
(
lc_ScanData
.
Thicks
);
if
(
result
!=
CheckResult
.
Idle
)
accessory
=
Newtonsoft
.
Json
.
JsonConvert
.
SerializeObject
(
lc_ScanData
.
ID
);
}
else
{
result
=
CheckResult
.
Idle
;
}
string
accessory
=
""
;
if
(
result
!=
CheckResult
.
Idle
)
accessory
=
Newtonsoft
.
Json
.
JsonConvert
.
SerializeObject
(
lc_ScanData
.
ID
);
switch
(
result
)
{
...
...
@@ -182,8 +178,15 @@ namespace FLY.Thick.Blowing.Server
}
break
;
}
}
ScanWarningCheck
?.
Invoke
(
this
,
new
ScanWarningCheckEventArgs
()
{
isWarning
=
(
result
!=
CheckResult
.
Idle
),
profile
=
dB_Profile
,
scandata
=
lc_ScanData
});
}
public
void
Save
()
{
...
...
@@ -205,7 +208,15 @@ namespace FLY.Thick.Blowing.Server
public
string
[]
GetSavePropertyNames
()
{
return
new
string
[]{
"Enable"
,
"AlarmCnt_Tolerance"
};
"Enable"
,
"
IsAutoTarget"
,
"
AlarmCnt_Tolerance"
};
}
}
public
class
ScanWarningCheckEventArgs
{
public
bool
isWarning
;
public
DB_Profile
profile
;
public
LC_ScanData
scandata
;
}
public
delegate
void
ScanWarningCheckEventHandler
(
object
sender
,
ScanWarningCheckEventArgs
e
);
}
Project.FLY.Thick.Blowing/FLY.Thick.Blowing/Server/TDGage.cs
View file @
6203fadd
...
...
@@ -244,7 +244,7 @@ namespace FLY.Thick.Blowing.Server
//---------------------------------------------------------------------------------------------------------------
//ScanWarning_Create
mScanWarning
=
new
ScanWarning
();
mScanWarning
.
Init
(
mWarning
,
mProfile
.
Param
,
mBulk
DB
);
mScanWarning
.
Init
(
mWarning
,
mHistory
DB
);
...
...
@@ -252,8 +252,9 @@ namespace FLY.Thick.Blowing.Server
//GM_Fix_Create
mGMFix
=
new
GM_Fix
(
mFlyAD
);
mGMFix
.
Init
(
mDynArea
,
AD2Thick
);
mGMFix
.
IsIgnoreDataWhenIdle
=
false
;
mGMManager
.
AddGM
(
mGMFix
);
//---------------------------------------------------------------------------------------------------------------
//GM_RenZiJiaFix_Create
...
...
thick_public
@
9634c9f8
Subproject commit
1205881fabaf2866240810954569fd8ce1818968
Subproject commit
9634c9f8a8964b9fb70f18b7f028acb4f540fb95
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