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
d17b0a44
Commit
d17b0a44
authored
Sep 22, 2020
by
潘栩锋
🚴
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'dev6.0' of
http://private.flyautomation.net:82/panruising/thick_public
into dev6.0
parents
6fb9b493
556f69da
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
228 additions
and
273 deletions
+228
-273
PgMainEditDynArea.xaml
MultiLayout/MainEdit/PgMeDynArea/PgMainEditDynArea.xaml
+3
-3
RatioConverter.cs
...rolLibrary/FLY.ControlLibrary/Converter/RatioConverter.cs
+30
-29
FlyAD7.cs
Project.FLY.FlyADBase/FlyADBase/FlyAD7.cs
+6
-6
SyncPropServiceClient.cs
...JComponents/OBJComponents/Client/SyncPropServiceClient.cs
+19
-0
PropertiesManager.cs
...Y.OBJComponents/OBJComponents/Common/PropertiesManager.cs
+6
-0
ErrorConf.cs
Project.FLY.OBJComponents/OBJComponents/Server/ErrorConf.cs
+46
-26
CtMicroGage.xaml
...Thick.Base/FLY.Thick.Base.UI/CtMicroGage/CtMicroGage.xaml
+36
-4
CtMicroGageStyle.xaml
....Base/FLY.Thick.Base.UI/CtMicroGage/CtMicroGageStyle.xaml
+7
-1
DynAreaIO.xaml
....FLY.Thick.Base/FLY.Thick.Base.UI/UiModule/DynAreaIO.xaml
+47
-21
DBTable.cs
Project.SQLiteHelper/SQLiteHelper/DBTable.cs
+2
-7
IgnoreAttribute.cs
Project.SQLiteHelper/SQLiteHelper/IgnoreAttribute.cs
+0
-9
SQLiteHelper.cs
Project.SQLiteHelper/SQLiteHelper/SQLiteHelper.cs
+26
-167
No files found.
MultiLayout/MainEdit/PgMeDynArea/PgMainEditDynArea.xaml
View file @
d17b0a44
...
...
@@ -202,9 +202,9 @@
<ItemsControl.ItemTemplate>
<DataTemplate>
<Button Style="{StaticResource ButtonStyle_empty}" Background="{Binding Background}" Tag="{Binding .}" Click="button_componentNew_Click" Margin="5" BorderBrush="#FF0C0C0C">
<StackPanel
Orientation="Vertical"
Margin="10">
<TextBlock Text="{Binding Header}" FontSize="
20
" TextWrapping = "Wrap" />
<TextBlock Text="{Binding Count}" FontSize="1
5
" Margin="0,20,0,0"/>
<StackPanel Margin="10">
<TextBlock Text="{Binding Header}" FontSize="
18
" TextWrapping = "Wrap" />
<TextBlock Text="{Binding Count}" FontSize="1
2
" Margin="0,20,0,0"/>
</StackPanel>
</Button>
</DataTemplate>
...
...
Project.FLY.ControlLibrary/FLY.ControlLibrary/Converter/RatioConverter.cs
View file @
d17b0a44
...
...
@@ -6,29 +6,36 @@ using System.Windows.Data;
namespace
FLY.ControlLibrary.Converter
{
/// <summary>
/// 3个输入,
/// [0]比例分子;
/// [1]比例分母;
/// [2]控件最大长度
/// </summary>
public
class
RatioConverter
:
IMultiValueConverter
public
class
RatioConverter
:
IMultiValueConverter
{
#
region
IMultiValueConverter
成员
double
getValue
(
object
value
)
{
if
((
value
is
int
)
&&
(!
Misc
.
MyBase
.
ISVALIDATA
((
int
)
value
)))
return
0
;
try
{
return
System
.
Convert
.
ToDouble
(
value
);
}
catch
{
return
0
;
}
}
public
object
Convert
(
object
[]
values
,
Type
targetType
,
object
parameter
,
System
.
Globalization
.
CultureInfo
culture
)
{
if
(
values
.
Length
==
3
&&
(
values
[
0
]
is
int
)
&&
(
values
[
1
]
is
int
)
&&
(
values
[
2
]
is
double
))
//必须要检查,不然 界面生成器 会错误,提示转换异常
if
(
values
.
Length
!=
3
)
//必须要检查,不然 界面生成器 会错误,提示转换异常
{
double
ratio
;
int
value
=
(
int
)
values
[
0
];
if
(
value
==
99999998
)
value
=
0
;
int
max
=
(
int
)
values
[
1
];
double
ActualWidth
=
(
double
)
values
[
2
];
return
100
;
}
double
ratio
;
double
value
=
getValue
(
values
[
0
]);
double
max
=
getValue
(
values
[
1
]);
double
ActualWidth
=
getValue
(
values
[
2
]);
if
(
max
<=
0
)
if
(
max
<=
0
)
ratio
=
0
;
else
ratio
=
(
double
)
value
/
max
;
...
...
@@ -37,14 +44,8 @@ namespace FLY.ControlLibrary.Converter
ratio
=
0
;
else
if
(
ratio
>
1
)
ratio
=
1
;
return
ActualWidth
*
ratio
;
}
else
{
return
100
;
}
}
public
object
[]
ConvertBack
(
object
value
,
Type
[]
targetTypes
,
object
parameter
,
System
.
Globalization
.
CultureInfo
culture
)
{
...
...
Project.FLY.FlyADBase/FlyADBase/FlyAD7.cs
View file @
d17b0a44
...
...
@@ -349,8 +349,8 @@ namespace FlyADBase
ID
,
FLYAD7_OBJ_INTERFACE
.
FLYIO_OBJ_INTERFACE
.
GET_IO
);
NotifyPropertyChanged
(
"Pos1LCShift"
);
//写入到AD盒
NotifyPropertyChanged
(
"Pos2Comp"
);
//写入到AD盒
NotifyPropertyChanged
(
nameof
(
Pos1LCShift
)
);
//写入到AD盒
NotifyPropertyChanged
(
nameof
(
Pos2Comp
)
);
//写入到AD盒
SyncPos2Clear
();
SyncClear
();
...
...
@@ -516,12 +516,12 @@ namespace FlyADBase
Array
.
Copy
(
pack
.
code
,
Code
,
pack
.
code
.
Length
);
Code
[
6
]
=
0x06
;
NotifyPropertyChanged
(
"Code"
);
NotifyPropertyChanged
(
nameof
(
Code
)
);
Surplus
=
pack
.
surplus
;
Array
.
Copy
(
pack
.
access
,
Access
,
pack
.
access
.
Length
);
NotifyPropertyChanged
(
"Access"
);
NotifyPropertyChanged
(
nameof
(
Access
)
);
}
break
;
case
FLYAD7_OBJ_INTERFACE
.
SYS_DATA_INTERFACE
.
GET_ZERO_POS
:
...
...
@@ -976,12 +976,12 @@ namespace FlyADBase
public
int
ADMax
{
get
;
}
=
65535
;
/// <summary>
/// 输入口状态,只有12位有效
/// 输入口状态,只有12位有效
, 大AD盒 16位
/// </summary>
public
UInt16
IStatus
{
get
;
private
set
;
}
=
0xffff
;
/// <summary>
/// 输出口状态,只有4位有效
/// 输出口状态,只有4位有效
, 大AD盒 8位
/// </summary>
public
UInt16
OStatus
{
get
;
private
set
;
}
=
0xffff
;
...
...
Project.FLY.OBJComponents/OBJComponents/Client/SyncPropServiceClient.cs
View file @
d17b0a44
using
FLY.OBJComponents.Common
;
using
FLY.OBJComponents.IService
;
using
FLY.OBJComponents.OBJ_INTERFACE
;
using
FObjBase
;
using
Newtonsoft.Json
;
...
...
@@ -6,6 +7,7 @@ using System;
using
System.Collections.Generic
;
using
System.ComponentModel
;
using
System.Linq
;
using
System.Reflection
;
using
System.Text
;
namespace
FLY.OBJComponents.Client
...
...
@@ -71,6 +73,23 @@ namespace FLY.OBJComponents.Client
/// <param name="e"></param>
void
Data_PropertyChanged
(
object
sender
,
System
.
ComponentModel
.
PropertyChangedEventArgs
e
)
{
PropertyInfo
property
=
sender
.
GetType
().
GetProperty
(
e
.
PropertyName
);
if
(!
property
.
CanWrite
)
{
return
;
}
if
(
sender
is
IPropertyOpt
)
{
var
opt
=
(
IPropertyOpt
)
sender
;
string
[]
nosync
=
opt
.
GetNoSyncPropNames
();
if
(
nosync
!=
null
&&
nosync
.
Count
()!=
0
)
{
if
(
nosync
.
Contains
(
e
.
PropertyName
))
{
//这个不需要同步
return
;
}
}
}
string
objname
=
(
from
kv
in
ObjNames
where
kv
.
Value
==
sender
select
kv
.
Key
).
First
();
Dictionary
<
string
,
Dictionary
<
string
,
object
>>
DsDso
=
new
Dictionary
<
string
,
Dictionary
<
string
,
object
>>
...
...
Project.FLY.OBJComponents/OBJComponents/Common/PropertiesManager.cs
View file @
d17b0a44
...
...
@@ -25,10 +25,16 @@ namespace FLY.OBJComponents.Common
{
throw
new
Exception
(
"PropertiesManager_JSON 类型="
+
obj
.
GetType
().
ToString
()+
" 不能找到 属性名="
+
propertyName
,
e
);
}
if
(!
property
.
CanWrite
)
{
throw
new
Exception
(
"PropertiesManager_JSON 类型="
+
obj
.
GetType
().
ToString
()
+
" 属性名="
+
propertyName
+
" 不能set"
);
}
if
(
property
!=
null
)
{
if
(
v
.
GetType
()
==
property
.
PropertyType
)
{
property
.
SetValue
(
obj
,
v
,
null
);
}
else
...
...
Project.FLY.OBJComponents/OBJComponents/Server/ErrorConf.cs
View file @
d17b0a44
...
...
@@ -46,7 +46,6 @@ namespace FLY.OBJComponents.Server
public
string
property
;
public
byte
code
;
public
string
msg
;
public
bool
offIsError
;
}
Dictionary
<
INotifyPropertyChanged
,
ErrorAction
>
obj_error
=
new
Dictionary
<
INotifyPropertyChanged
,
ErrorAction
>();
...
...
@@ -60,14 +59,12 @@ namespace FLY.OBJComponents.Server
{
//肯定有,没有就让它出错!!!
string
desp
=
(
propertyInfo
.
GetCustomAttributes
(
typeof
(
DescriptionAttribute
),
false
).
First
()
as
DescriptionAttribute
).
Description
;
//bool offIsError = (propertyInfo.GetCustomAttributes(typeof(IsErrorAttribute), false).First() as IsErrorAttribute).OffIsError;
//报警如果是反向, 会被设置为放大=-1, 所以 最后属性 肯定是 true 时报警, offIsError没有用
ErrorInfo
errorInfo
=
new
ErrorInfo
()
{
property
=
propertyInfo
.
Name
,
msg
=
desp
,
//offIsError = offIsError,
code
=
ErrCode
};
error_property
.
Add
(
errorInfo
);
...
...
@@ -105,7 +102,7 @@ namespace FLY.OBJComponents.Server
FObjBase
.
PollModule
.
Current
.
Poll_Config
(
PollModule
.
POLL_CONFIG
.
ADD
,
()
=>
{
Misc
.
BindingOperations
.
SetBinding
(
PLCos
,
"IsConnectedWithPLC"
,
()
=>
Misc
.
BindingOperations
.
SetBinding
(
PLCos
,
nameof
(
PLCos
.
IsConnectedWithPLC
)
,
()
=>
{
bool
b
=
!
PLCos
.
IsConnectedWithPLC
;
...
...
@@ -119,23 +116,51 @@ namespace FLY.OBJComponents.Server
},
TimeSpan
.
FromSeconds
(
3
),
true
,
false
,
this
,
MARKNO_DELAY_ISCONNECTED
,
true
);
//--------------------------------------------------------------------------------
//把全部报警状态取反,也就是不报警!!!
foreach
(
var
kv
in
obj_error
)
{
object
sender
=
kv
.
Key
;
foreach
(
var
ei
in
kv
.
Value
.
error_property
)
//启动定时器,每1秒查报警,防止 以为报警复位了,但其实还在报警
//FObjBase.PollModule.Current.Poll_Config(PollModule.POLL_CONFIG.ADD,
// () =>
// {
// foreach(var objError in obj_error)
// {
// object sender = objError.Key;
// ErrorAction errorAction = objError.Value;
// foreach (var ei in errorAction.error_property)
// {
// //获取描述
// var type = sender.GetType();
// var property = type.GetProperty(ei.property);
// bool b = (bool)property.GetValue(sender, null);
// string desp = ei.msg;
// ERR_STATE state = b ? ERR_STATE.ON : ERR_STATE.OFF;
// byte errcode = ei.code;//每个报警必须不一样!!
// string description = desp;
// errorAction.action?.Invoke(ref description, errorAction.state);
// mWarning.Add(errcode, description, state);
// }
// }
// }, TimeSpan.FromSeconds(1));
}
public
void
ResetError
(
INotifyPropertyChanged
sender
)
{
if
(
ei
.
offIsError
)
var
type
=
sender
.
GetType
();
foreach
(
var
ei
in
obj_error
[
sender
as
INotifyPropertyChanged
].
error_property
)
{
Misc
.
PropertiesManager
.
SetValue
(
sender
,
ei
.
property
,
true
);
var
property
=
type
.
GetProperty
(
ei
.
property
);
property
.
SetValue
(
sender
,
false
);
}
//false 不用写,默认值就是
}
public
void
ResetError
()
{
foreach
(
var
sender
in
obj_error
.
Keys
)
{
ResetError
(
sender
);
}
}
void
Obj_PropertyChanged_ForError
(
object
sender
,
PropertyChangedEventArgs
e
)
{
ErrorAction
errorAction
=
obj_error
[
sender
as
INotifyPropertyChanged
];
...
...
@@ -150,13 +175,8 @@ namespace FLY.OBJComponents.Server
var
property
=
type
.
GetProperty
(
ei
.
property
);
bool
b
=
(
bool
)
property
.
GetValue
(
sender
,
null
);
string
desp
=
ei
.
msg
;
bool
offIsError
=
ei
.
offIsError
;
ERR_STATE
state
;
if
(
offIsError
)
state
=
!
b
?
ERR_STATE
.
ON
:
ERR_STATE
.
OFF
;
else
state
=
b
?
ERR_STATE
.
ON
:
ERR_STATE
.
OFF
;
ERR_STATE
state
=
b
?
ERR_STATE
.
ON
:
ERR_STATE
.
OFF
;
byte
errcode
=
ei
.
code
;
//每个报警必须不一样!!
string
description
=
desp
;
...
...
Project.FLY.Thick.Base/FLY.Thick.Base.UI/CtMicroGage/CtMicroGage.xaml
View file @
d17b0a44
...
...
@@ -103,23 +103,43 @@
<StackPanel >
<StackPanel Orientation="Horizontal" Margin="2">
<TextBlock Text="入" Style="{StaticResource ItemHeaderStyle}" />
<StackPanel Orientation="Horizontal" Margin="4,0">
<Rectangle Fill="{Binding IStatus,Converter={StaticResource io2bitcolorconv},ConverterParameter=15}" Style="{StaticResource IOStyle}"/>
<Rectangle Fill="{Binding IStatus,Converter={StaticResource io2bitcolorconv},ConverterParameter=14}" Style="{StaticResource IOStyle}"/>
<Rectangle Fill="{Binding IStatus,Converter={StaticResource io2bitcolorconv},ConverterParameter=13}" Style="{StaticResource IOStyle}"/>
<Grid>
<Rectangle Fill="{Binding IStatus,Converter={StaticResource io2bitcolorconv},ConverterParameter=12}" Style="{StaticResource IOStyle}"/>
<TextBlock Text="13" Style="{StaticResource IOTextStyle}"/>
</Grid>
</StackPanel>
<StackPanel Orientation="Horizontal" Margin="4,0">
<Rectangle Fill="{Binding IStatus,Converter={StaticResource io2bitcolorconv},ConverterParameter=11}" Style="{StaticResource IOStyle}"/>
<Rectangle Fill="{Binding IStatus,Converter={StaticResource io2bitcolorconv},ConverterParameter=10}" Style="{StaticResource IOStyle}"/>
<Rectangle Fill="{Binding IStatus,Converter={StaticResource io2bitcolorconv},ConverterParameter=9}" Style="{StaticResource IOStyle}"/>
<Grid>
<Rectangle Fill="{Binding IStatus,Converter={StaticResource io2bitcolorconv},ConverterParameter=8}" Style="{StaticResource IOStyle}"/>
<TextBlock Text="9" Style="{StaticResource IOTextStyle}"/>
</Grid>
</StackPanel>
<StackPanel Orientation="Horizontal" Margin="4,0">
<Rectangle Fill="{Binding IStatus,Converter={StaticResource io2bitcolorconv},ConverterParameter=7}" Style="{StaticResource IOStyle}"/>
<Rectangle Fill="{Binding IStatus,Converter={StaticResource io2bitcolorconv},ConverterParameter=6}" Style="{StaticResource IOStyle}"/>
<Rectangle Fill="{Binding IStatus,Converter={StaticResource io2bitcolorconv},ConverterParameter=5}" Style="{StaticResource IOStyle}"/>
<Grid>
<Rectangle Fill="{Binding IStatus,Converter={StaticResource io2bitcolorconv},ConverterParameter=4}" Style="{StaticResource IOStyle}"/>
<TextBlock Text="5" Style="{StaticResource IOTextStyle}"/>
</Grid>
</StackPanel>
<StackPanel Orientation="Horizontal" Margin="4,0">
<Rectangle Fill="{Binding IStatus,Converter={StaticResource io2bitcolorconv},ConverterParameter=3}" Style="{StaticResource IOStyle}"/>
<Rectangle Fill="{Binding IStatus,Converter={StaticResource io2bitcolorconv},ConverterParameter=2}" Style="{StaticResource IOStyle}"/>
<Rectangle Fill="{Binding IStatus,Converter={StaticResource io2bitcolorconv},ConverterParameter=1}" Style="{StaticResource IOStyle}"/>
<Grid>
<Rectangle Fill="{Binding IStatus,Converter={StaticResource io2bitcolorconv},ConverterParameter=0}" Style="{StaticResource IOStyle}"/>
<TextBlock Text="1" Style="{StaticResource IOTextStyle}"/>
</Grid>
</StackPanel>
</StackPanel>
<Grid Margin="2">
...
...
@@ -129,11 +149,23 @@
</Grid.ColumnDefinitions>
<StackPanel Orientation="Horizontal" VerticalAlignment="Top">
<TextBlock Text="出" Style="{StaticResource ItemHeaderStyle}" />
<StackPanel Orientation="Horizontal" Margin="4,0">
<Rectangle Fill="{Binding OStatus,Converter={StaticResource io2bitcolorconv},ConverterParameter=7}" Style="{StaticResource IOStyle}"/>
<Rectangle Fill="{Binding OStatus,Converter={StaticResource io2bitcolorconv},ConverterParameter=6}" Style="{StaticResource IOStyle}"/>
<Rectangle Fill="{Binding OStatus,Converter={StaticResource io2bitcolorconv},ConverterParameter=5}" Style="{StaticResource IOStyle}"/>
<Grid>
<Rectangle Fill="{Binding OStatus,Converter={StaticResource io2bitcolorconv},ConverterParameter=4}" Style="{StaticResource IOStyle}"/>
<TextBlock Text="5" Style="{StaticResource IOTextStyle}"/>
</Grid>
</StackPanel>
<StackPanel Orientation="Horizontal" Margin="4,0">
<Rectangle Fill="{Binding OStatus,Converter={StaticResource io2bitcolorconv},ConverterParameter=3}" Style="{StaticResource IOStyle}"/>
<Rectangle Fill="{Binding OStatus,Converter={StaticResource io2bitcolorconv},ConverterParameter=2}" Style="{StaticResource IOStyle}"/>
<Rectangle Fill="{Binding OStatus,Converter={StaticResource io2bitcolorconv},ConverterParameter=1}" Style="{StaticResource IOStyle}"/>
<Grid>
<Rectangle Fill="{Binding OStatus,Converter={StaticResource io2bitcolorconv},ConverterParameter=0}" Style="{StaticResource IOStyle}"/>
<TextBlock Text="1" Style="{StaticResource IOTextStyle}"/>
</Grid>
</StackPanel>
</StackPanel>
<Grid Margin="1" >
...
...
Project.FLY.Thick.Base/FLY.Thick.Base.UI/CtMicroGage/CtMicroGageStyle.xaml
View file @
d17b0a44
...
...
@@ -16,10 +16,16 @@
<Setter Property="Margin" Value="5,0"/>
</Style>
<Style x:Key="IOStyle" TargetType="Rectangle" >
<Setter Property="Width" Value="1
1
" />
<Setter Property="Width" Value="1
0
" />
<Setter Property="Height" Value="12" />
<Setter Property="Margin" Value="1" />
</Style>
<Style x:Key="IOTextStyle" TargetType="TextBlock">
<Setter Property="Foreground" Value="#FF119EDA" />
<Setter Property="HorizontalAlignment" Value="Center" />
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="FontSize" Value="10"/>
</Style>
<Style x:Key="BtnStyle" TargetType="{x:Type Button}" BasedOn="{StaticResource ButtonStyle_empty}">
<Setter Property="Margin" Value="2"/>
<Setter Property="Foreground" Value="{StaticResource AccentBaseColorBrush}"/>
...
...
Project.FLY.Thick.Base/FLY.Thick.Base.UI/UiModule/DynAreaIO.xaml
View file @
d17b0a44
This diff is collapsed.
Click to expand it.
Project.SQLiteHelper/SQLiteHelper/DBTable.cs
View file @
d17b0a44
...
...
@@ -9,8 +9,6 @@ namespace SQLite
public
class
DBTable
<
T
>
:
IDBTable
where
T
:
new
()
{
public
List
<
SQLiteHelper
.
ArrayFieldTypeInfo
>
ArrayFieldTypeInfos
=
new
List
<
SQLiteHelper
.
ArrayFieldTypeInfo
>();
public
string
TableName
{
get
;
private
set
;
}
private
long
freeID
=
0
;
...
...
@@ -32,10 +30,7 @@ namespace SQLite
{
get
{
if
(
ArrayFieldTypeInfos
.
Count
()
==
0
)
return
ddl
;
else
return
SQLiteHelper
.
GetCreateTableCommandText
(
typeof
(
T
),
ArrayFieldTypeInfos
.
ToArray
());
}
}
...
...
@@ -81,7 +76,7 @@ namespace SQLite
sql
+=
" "
+
condition
;
DataTable
dataTable
=
sqliteHelper
.
ExecuteReader
(
sql
);
return
SQLiteHelper
.
ToObjs
<
T
>(
dataTable
,
ArrayFieldTypeInfos
.
ToArray
()
);
return
SQLiteHelper
.
ToObjs
<
T
>(
dataTable
);
}
/// <summary>
...
...
Project.SQLiteHelper/SQLiteHelper/IgnoreAttribute.cs
View file @
d17b0a44
...
...
@@ -11,15 +11,6 @@ namespace SQLite
}
}
public
class
BortherAttribute
:
Attribute
{
}
public
class
ChildAttribute
:
Attribute
{
}
public
class
PropertyIndexAttribute
:
Attribute
{
...
...
Project.SQLiteHelper/SQLiteHelper/SQLiteHelper.cs
View file @
d17b0a44
This diff is collapsed.
Click to expand it.
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