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
441a1a7e
Commit
441a1a7e
authored
Aug 09, 2024
by
潘栩锋
🚴
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
把V8的服务器多国语言部分,复制过来
parent
221b90d1
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
249 additions
and
186 deletions
+249
-186
FlyData_WarningHistory.cs
...Components/OBJComponents/Common/FlyData_WarningHistory.cs
+7
-3
ErrorConf.cs
Project.FLY.OBJComponents/OBJComponents/Server/ErrorConf.cs
+1
-1
WarningSystem2.cs
....FLY.OBJComponents/OBJComponents/Server/WarningSystem2.cs
+1
-1
OnInitError.cs
...ct.FLY.Thick.Base/FLY.Thick.Base.UI/OnInit/OnInitError.cs
+15
-16
ERRNO.cs
Project.FLY.Thick.Base/FLY.Thick.Base/Common/ERRNO.cs
+79
-22
FlyADIODefine.cs
...ect.FLY.Thick.Base/FLY.Thick.Base/Common/FlyADIODefine.cs
+66
-61
FLY.Thick.Base.csproj
Project.FLY.Thick.Base/FLY.Thick.Base/FLY.Thick.Base.csproj
+12
-0
GetSample.cs
Project.FLY.Thick.Base/FLY.Thick.Base/Server/GetSample.cs
+68
-82
No files found.
Project.FLY.OBJComponents/OBJComponents/Common/FlyData_WarningHistory.cs
View file @
441a1a7e
...
@@ -115,8 +115,12 @@ namespace FLY.OBJComponents.Common
...
@@ -115,8 +115,12 @@ namespace FLY.OBJComponents.Common
/// </summary>
/// </summary>
public
struct
ERRNO
public
struct
ERRNO
{
{
public
UInt16
Code
;
public
int
Code
;
public
string
Descrption
;
public
string
Description
;
public
override
string
ToString
()
{
return
$"[
{
Code
}
]
{
Description
}
"
;
}
}
}
public
class
PlcErrNos
public
class
PlcErrNos
...
@@ -126,6 +130,6 @@ namespace FLY.OBJComponents.Common
...
@@ -126,6 +130,6 @@ namespace FLY.OBJComponents.Common
/// <summary>
/// <summary>
/// PLC连接断开
/// PLC连接断开
/// </summary>
/// </summary>
public
ERRNO
ERRNO_PLC_DISCONNECTED
=
new
ERRNO
()
{
Code
=
65535
,
Descrption
=
"PLC连接断开"
};
public
ERRNO
ERRNO_PLC_DISCONNECTED
=
new
ERRNO
()
{
Code
=
65535
,
Descr
i
ption
=
"PLC连接断开"
};
}
}
}
}
Project.FLY.OBJComponents/OBJComponents/Server/ErrorConf.cs
View file @
441a1a7e
...
@@ -59,7 +59,7 @@ namespace FLY.OBJComponents.Server
...
@@ -59,7 +59,7 @@ namespace FLY.OBJComponents.Server
//初始化 PLC连接断开的描述列表
//初始化 PLC连接断开的描述列表
int
plcCnt
=
PLCos
.
PLCs
.
Count
();
int
plcCnt
=
PLCos
.
PLCs
.
Count
();
int
errCode
=
plcErrCodeBegin
;
int
errCode
=
plcErrCodeBegin
;
string
descrption
=
PlcErrNos
.
Instance
.
ERRNO_PLC_DISCONNECTED
.
Descrption
;
string
descrption
=
PlcErrNos
.
Instance
.
ERRNO_PLC_DISCONNECTED
.
Descr
i
ption
;
for
(
int
i
=
0
;
i
<
plcCnt
;
i
++)
for
(
int
i
=
0
;
i
<
plcCnt
;
i
++)
{
{
plcDisconnectedErrMsgs
.
Add
(
new
PlcDisconnectedErrMsg
()
plcDisconnectedErrMsgs
.
Add
(
new
PlcDisconnectedErrMsg
()
...
...
Project.FLY.OBJComponents/OBJComponents/Server/WarningSystem2.cs
View file @
441a1a7e
...
@@ -86,7 +86,7 @@ namespace FLY.OBJComponents.Server
...
@@ -86,7 +86,7 @@ namespace FLY.OBJComponents.Server
public
void
Add
(
ERRNO
errno
,
bool
canReset
=
true
)
public
void
Add
(
ERRNO
errno
,
bool
canReset
=
true
)
{
{
Add
(
errno
.
Code
,
errno
.
Descrption
,
canReset
:
canReset
);
Add
(
errno
.
Code
,
errno
.
Descr
i
ption
,
canReset
:
canReset
);
}
}
public
void
Remove
(
ERRNO
errno
)
public
void
Remove
(
ERRNO
errno
)
{
{
...
...
Project.FLY.Thick.Base/FLY.Thick.Base.UI/OnInit/OnInitError.cs
View file @
441a1a7e
using
FLY.OBJComponents.IService
;
using
FLY.OBJComponents.IService
;
using
MultiLayout.UiModule
;
using
MultiLayout.UiModule
;
using
Misc
;
using
Misc
;
using
System
;
using
System
;
using
System.Collections.Generic
;
using
System.Collections.Generic
;
...
@@ -11,6 +11,7 @@ using System.Threading.Tasks;
...
@@ -11,6 +11,7 @@ using System.Threading.Tasks;
using
FLY.Thick.Base.UI
;
using
FLY.Thick.Base.UI
;
using
Unity
;
using
Unity
;
using
FLY.Thick.Base.Common
;
using
FLY.Thick.Base.Common
;
using
System.Windows
;
namespace
FLY.Thick.Base.UI.OnInit
namespace
FLY.Thick.Base.UI.OnInit
{
{
...
@@ -31,13 +32,13 @@ namespace FLY.Thick.Base.UI.OnInit
...
@@ -31,13 +32,13 @@ namespace FLY.Thick.Base.UI.OnInit
IUnityContainer
container
;
IUnityContainer
container
;
bool
enableScanErrBigTip
;
bool
enableScanErrBigTip
;
int
warningTipId
=
-
1
;
int
warningTipId
=
-
1
;
public
int
Level
{
get
;
}
public
int
Level
{
get
;
}
public
OnInitError
(
public
OnInitError
(
IUnityContainer
container
,
IUnityContainer
container
,
ParamDictionary
paramDictionary
,
ParamDictionary
paramDictionary
,
FLY
.
OBJComponents
.
IService
.
IWarningSystem2Service
warningService
,
IWarningSystem2Service
warningService
,
int
lv
=
1
)
int
lv
=
1
)
{
{
Level
=
lv
;
Level
=
lv
;
this
.
container
=
container
;
this
.
container
=
container
;
...
@@ -55,18 +56,19 @@ namespace FLY.Thick.Base.UI.OnInit
...
@@ -55,18 +56,19 @@ namespace FLY.Thick.Base.UI.OnInit
}
}
private
void
WarningService_PropertyChanged
(
object
sender
,
System
.
ComponentModel
.
PropertyChangedEventArgs
e
)
private
void
WarningService_PropertyChanged
(
object
sender
,
System
.
ComponentModel
.
PropertyChangedEventArgs
e
)
{
{
if
(
e
.
PropertyName
==
nameof
(
warningService
.
ReasonList
))
{
if
(
e
.
PropertyName
==
nameof
(
warningService
.
ReasonList
))
{
if
(!
enableScanErrBigTip
)
if
(!
enableScanErrBigTip
)
return
;
return
;
FObjBase
.
PollModule
.
Current
.
Poll_JustOnce
(
FObjBase
.
PollModule
.
Current
.
Poll_JustOnce
(
new
FObjBase
.
PollModule
.
PollHandler
(
delegate
()
new
FObjBase
.
PollModule
.
PollHandler
(
delegate
()
{
{
List
<
int
>
errCodes
=
new
List
<
int
>
{
ERRNOs
.
Instance
.
SCAN_ERRNO_OVERCTRL
.
Code
,
ERRNOs
.
Instance
.
SCAN_
ERRNO_OVERTOL
.
Code
};
List
<
int
>
errCodes
=
new
List
<
int
>
{
ERRNOs
.
Instance
.
ERRNO_OVERCTRL
.
Code
,
ERRNOs
.
Instance
.
ERRNO_OVERTOL
.
Code
};
var
record
=
warningService
.
ReasonList
;
var
record
=
warningService
.
ReasonList
;
if
(
record
==
null
)
if
(
record
==
null
)
...
@@ -94,22 +96,19 @@ namespace FLY.Thick.Base.UI.OnInit
...
@@ -94,22 +96,19 @@ namespace FLY.Thick.Base.UI.OnInit
}
}
return
;
return
;
}
}
int
errcode
=
rs
.
First
().
ErrCode
;
int
errcode
=
rs
.
First
().
ErrCode
;
string
msg
=
rs
.
First
().
Description
;
string
description
=
rs
.
First
().
Description
;
string
path
=
paramDictionary
.
GetValue
<
string
>(
ParamDistItemKeys
.
WarningTipPath
);
string
path
=
paramDictionary
.
GetValue
<
string
>(
ParamDistItemKeys
.
WarningTipPath
);
string
msg
=
description
;
//报警!!!!!!!!
//报警!!!!!!!!
//记录打开的报警提示框Id,用于以后关闭
//记录打开的报警提示框Id,用于以后关闭
warningTipId
=
FLY
.
ControlLibrary
.
Window_WarningTip
.
Show
(
warningTipId
=
FLY
.
ControlLibrary
.
Window_WarningTip
.
Show
(
null
,
msg
,
TimeSpan
.
MaxValue
,
$"编码=
{
errcode
}
"
,
msg
,
TimeSpan
.
MaxValue
,
path
,
path
,
warningService
.
Reset
warningService
.
Reset
);
);
}),
this
,
MARKNO_WARNING_RING
);
}),
this
,
MARKNO_WARNING_RING
);
}
}
}
}
...
...
Project.FLY.Thick.Base/FLY.Thick.Base/Common/ERRNO.cs
View file @
441a1a7e
...
@@ -3,6 +3,7 @@ using System;
...
@@ -3,6 +3,7 @@ using System;
using
System.Collections.Generic
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Linq
;
using
System.Text
;
using
System.Text
;
using
System.Windows
;
namespace
FLY.Thick.Base.Common
namespace
FLY.Thick.Base.Common
{
{
...
@@ -13,28 +14,84 @@ namespace FLY.Thick.Base.Common
...
@@ -13,28 +14,84 @@ namespace FLY.Thick.Base.Common
{
{
public
static
ERRNOs
Instance
{
get
;
}
=
new
ERRNOs
();
public
static
ERRNOs
Instance
{
get
;
}
=
new
ERRNOs
();
public
ERRNO
BASE_ERRNO_ONBOOT
=
new
ERRNO
()
{
Code
=
250
,
Descrption
=
"系统启动"
};
public
ERRNOs
()
public
ERRNO
BASE_ERRNO_RINGTEST
=
new
ERRNO
()
{
Code
=
1
,
Descrption
=
"报警测试"
};
{
public
ERRNO
BASE_ERRNO_AD_MIN
=
new
ERRNO
()
{
Code
=
2
,
Descrption
=
"AD值太小"
};
string
resourceName
=
$"dict.StringResource.ERRNO"
;
public
ERRNO
BASE_ERRNO_AD_MAX
=
new
ERRNO
()
{
Code
=
3
,
Descrption
=
"AD值太大"
};
public
ERRNO
BASE_ERRNO_EMERGENCY
=
new
ERRNO
()
{
Code
=
4
,
Descrption
=
"急停"
};
var
rd_errnos
=
(
ResourceDictionary
)
Application
.
Current
.
FindResource
(
resourceName
);
//异常直接让它出错
public
ERRNO
BASE_ERRNO_LIMIT
=
new
ERRNO
()
{
Code
=
5
,
Descrption
=
"限位"
};
public
ERRNO
BASE_ERRNO_FLYAD7DISCONNECTED
=
new
ERRNO
()
{
Code
=
6
,
Descrption
=
"AD盒连接断开"
};
Type
t
=
this
.
GetType
();
public
ERRNO
BASE_ERRNO_LICENSE_TIP
=
new
ERRNO
()
{
Code
=
7
,
Descrption
=
"授权将要过期"
};
var
fields
=
t
.
GetFields
();
public
ERRNO
BASE_ERRNO_LICENSE
=
new
ERRNO
()
{
Code
=
8
,
Descrption
=
"授权限制"
};
public
ERRNO
BASE_ERRNO_FILE_ERR_RESTORE
=
new
ERRNO
()
{
Code
=
9
,
Descrption
=
"数据文件异常,恢复不成功"
};
foreach
(
var
field
in
fields
)
public
ERRNO
BASE_ERRNO_FILE_RESTORE
=
new
ERRNO
()
{
Code
=
10
,
Descrption
=
"数据文件异常,恢复成功"
};
{
public
ERRNO
SCAN_ERRNO_OVERCTRL
=
new
ERRNO
()
{
Code
=
11
,
Descrption
=
"扫描超控制报警"
};
if
(
field
.
Name
.
StartsWith
(
"ERRNO_"
))
public
ERRNO
SCAN_ERRNO_OVERTOL
=
new
ERRNO
()
{
Code
=
12
,
Descrption
=
"扫描超规格报警"
};
{
public
ERRNO
BASE_ERRNO_DB
=
new
ERRNO
()
{
Code
=
13
,
Descrption
=
"数据库异常,重建"
};
var
errno
=
(
ERRNO
)
field
.
GetValue
(
this
);
public
ERRNO
BASE_ERRNO_TIMEGRIDADV
=
new
ERRNO
()
{
Code
=
14
,
Descrption
=
"AD卡版本太低,不能启动 [高级AD数据]"
};
errno
.
Description
=
ToDescription
(
rd_errnos
,
field
.
Name
);
public
ERRNO
BASE_ERRNO_DB_BACKUP
=
new
ERRNO
()
{
Code
=
15
,
Descrption
=
"已经连续开机1个月,数据库需要备份归档,请尽快重启服务器"
};
field
.
SetValue
(
this
,
errno
);
}
public
ERRNO
SCAN_ERRNO_FATAL
=
new
ERRNO
()
{
Code
=
20
,
Descrption
=
"扫描异常,致命错误 必须停止扫描"
};
}
public
ERRNO
SYNC_ERRNO_FATAL
=
new
ERRNO
()
{
Code
=
21
,
Descrption
=
"同步异常,致命错误 必须停止扫描"
};
}
public
ERRNO
MEASURE_SYNC_ERRNO_FATAL
=
new
ERRNO
()
{
Code
=
22
,
Descrption
=
"测量同步参数异常,致命错误 必须停止"
};
string
ToDescription
(
ResourceDictionary
rd_errnos
,
string
errNoKey
)
{
public
ERRNO
SAMPLE_ERRNO_Failure
=
new
ERRNO
()
{
Code
=
60
,
Descrption
=
"样品取样出错"
};
string
resourceName
=
$"str.ERRNO.
{
errNoKey
}
"
;
return
(
string
)
rd_errnos
[
resourceName
];
//异常直接让它出错
}
public
virtual
List
<
ERRNO
>
GetAll
()
{
List
<
ERRNO
>
list
=
new
List
<
ERRNO
>();
Type
t
=
this
.
GetType
();
var
fields
=
t
.
GetFields
();
foreach
(
var
field
in
fields
)
{
if
(
field
.
Name
.
StartsWith
(
"ERRNO_"
))
{
var
errno
=
(
ERRNO
)
field
.
GetValue
(
this
);
list
.
Add
(
errno
);
}
}
list
.
Sort
((
e0
,
e1
)
=>
{
return
e0
.
Code
.
CompareTo
(
e1
.
Code
);
});
return
list
;
}
public
ERRNO
ERRNO_AUTH_EXP
=
new
ERRNO
()
{
Code
=
0
,
Description
=
"AUTH_EXP"
};
//"授权过期" };
public
ERRNO
ERRNO_FLYAD7_DC
=
new
ERRNO
()
{
Code
=
1
,
Description
=
"FLYAD7_DC"
};
//"AD盒连接断开" };
public
ERRNO
ERRNO_AD_MIN
=
new
ERRNO
()
{
Code
=
2
,
Description
=
"AD_MIN"
};
//"AD值太小" };
public
ERRNO
ERRNO_AD_MAX
=
new
ERRNO
()
{
Code
=
3
,
Description
=
"AD_MAX"
};
//"AD值太大" };
public
ERRNO
ERRNO_SCRAM
=
new
ERRNO
()
{
Code
=
4
,
Description
=
"SCRAM"
};
//"急停" };
public
ERRNO
ERRNO_LIMIT
=
new
ERRNO
()
{
Code
=
5
,
Description
=
"LIMIT"
};
//"限位" };
public
ERRNO
ERRNO_OVERTOL
=
new
ERRNO
()
{
Code
=
6
,
Description
=
"OVERTOL"
};
//"扫描超规格报警" };
public
ERRNO
ERRNO_SCAN_FATAL
=
new
ERRNO
()
{
Code
=
7
,
Description
=
"SCAN_FATAL"
};
//"扫描动作异常" };
public
ERRNO
ERRNO_SAMPLE_FATAL
=
new
ERRNO
()
{
Code
=
8
,
Description
=
"SAMPLE_FATAL"
};
//"采样异常" };
public
ERRNO
ERRNO_ALARM_TEST
=
new
ERRNO
()
{
Code
=
9
,
Description
=
"ALARM_TEST"
};
//"报警测试" };
public
ERRNO
ERRNO_WILL_EXP
=
new
ERRNO
()
{
Code
=
10
,
Description
=
"WILL_EXP"
};
//"授权将要过期" };
public
ERRNO
ERRNO_OVERCTRL
=
new
ERRNO
()
{
Code
=
11
,
Description
=
"OVERCTRL"
};
//"扫描超控制报警" };
public
ERRNO
ERRNO_DB_BACKUP
=
new
ERRNO
()
{
Code
=
12
,
Description
=
"DB_BACKUP"
};
//"已经连续开机1个月,数据库需要备份归档,请尽快重启服务器" };
public
ERRNO
ERRNO_SAMPLE_ParamErr
=
new
ERRNO
()
{
Code
=
20
,
Description
=
"SAMPLE_ParamErr"
};
//"采样出错:参数异常" };
public
ERRNO
ERRNO_SAMPLE_ADZero
=
new
ERRNO
()
{
Code
=
21
,
Description
=
"SAMPLE_ADZero"
};
//"采样出错:AD值为0" };
public
ERRNO
ERRNO_SAMPLE_NoData
=
new
ERRNO
()
{
Code
=
22
,
Description
=
"SAMPLE_NoData"
};
//"采样出错:没有采集数据" };
public
ERRNO
ERRNO_SAMPLE_FilterErr
=
new
ERRNO
()
{
Code
=
23
,
Description
=
"SAMPLE_FilterErr"
};
//"采样出错:滤波数据与原始数据差异大" };
public
ERRNO
ERRNO_SAMPLE_PercentErr
=
new
ERRNO
()
{
Code
=
24
,
Description
=
"SAMPLE_PercentErr"
};
//"采样出错:样品AD与上次差异大" };
public
ERRNO
ERRNO_SAMPLE_CrossErr
=
new
ERRNO
()
{
Code
=
25
,
Description
=
"SAMPLE_CrossErr"
};
//"采样出错:样品比值与上次差异大" };
}
}
...
...
Project.FLY.Thick.Base/FLY.Thick.Base/Common/FlyADIODefine.cs
View file @
441a1a7e
using
FLY.Thick.Base.IService
;
using
FLY.Thick.Base.IService
;
using
FlyADBase
;
using
FObjBase
;
using
FObjBase
;
using
System
;
using
System
;
using
System.Collections.Generic
;
using
System.Collections.Generic
;
...
@@ -20,10 +21,10 @@ namespace FLY.Thick.Base.Common
...
@@ -20,10 +21,10 @@ namespace FLY.Thick.Base.Common
/// 6.在Gage中 调用 FlyADIODefine.SetInstance(new FlyADIODefine());
/// 6.在Gage中 调用 FlyADIODefine.SetInstance(new FlyADIODefine());
/// 7.在Gage中 注册 AD盒事件, AD盒版本修改时,FlyADIODefine.SerVersion(version);
/// 7.在Gage中 注册 AD盒事件, AD盒版本修改时,FlyADIODefine.SerVersion(version);
/// </summary>
/// </summary>
public
class
FlyADIODefine
:
IFlyAdIoDefineService
public
class
FlyADIODefine
:
IFlyAdIoDefineService
{
{
protected
static
FlyADIODefine
instance
;
protected
static
FlyADIODefine
instance
;
public
static
void
SetInstance
(
FlyADIODefine
flyADIODefine
)
public
static
void
SetInstance
(
FlyADIODefine
flyADIODefine
)
{
{
instance
=
flyADIODefine
;
instance
=
flyADIODefine
;
}
}
...
@@ -31,70 +32,73 @@ namespace FLY.Thick.Base.Common
...
@@ -31,70 +32,73 @@ namespace FLY.Thick.Base.Common
/// 子类 需要 重新 把子类对象 赋值给 Instance, 确保整个环境只用一个版本的 单例
/// 子类 需要 重新 把子类对象 赋值给 Instance, 确保整个环境只用一个版本的 单例
/// </summary>
/// </summary>
public
static
FlyADIODefine
Instance
=>
instance
;
public
static
FlyADIODefine
Instance
=>
instance
;
#
region
输入口
#
region
输入口
/// <summary>
/// 扫描按钮信号
/// </summary>
public
int
InNo_Scan
{
get
;
protected
set
;
}
=
1
-
1
;
/// <summary>
/// <summary>
/// 归零信号
/// 归零信号
/// </summary>
/// </summary>
[
Description
(
"归零信号"
)]
public
int
InNo_Org
{
get
;
protected
set
;
}
=
2
-
1
;
public
int
InNo_Org
{
get
;
protected
set
;
}
=
2
-
1
;
/// <summary>
/// <summary>
/// 正向限位
/// 正向限位
/// </summary>
/// </summary>
[
Description
(
"正向限位"
)]
public
int
InNo_Limit_Forw
{
get
;
protected
set
;
}
=
3
-
1
;
public
int
InNo_Limit_Forw
{
get
;
protected
set
;
}
=
3
-
1
;
/// <summary>
/// <summary>
/// 反向限位
/// 反向限位
/// </summary>
/// </summary>
[
Description
(
"反向限位"
)]
public
int
InNo_Limit_Backw
{
get
;
protected
set
;
}
=
4
-
1
;
public
int
InNo_Limit_Backw
{
get
;
protected
set
;
}
=
4
-
1
;
/// <summary>
/// <summary>
/// 数据有效
/// 数据有效
/// </summary>
/// </summary>
[
Description
(
"数据有效"
)]
public
int
InNo_DataValid
{
get
;
protected
set
;
}
=
6
-
1
;
public
int
InNo_DataValid
{
get
;
protected
set
;
}
=
6
-
1
;
/// <summary>
/// <summary>
/// 急停 and 手动正转
/// 急停 and 手动正转
/// </summary>
/// </summary>
[
Description
(
"急停 & 手动正转"
)]
public
int
InNo_Manual_Forw
{
get
;
protected
set
;
}
=
7
-
1
;
public
int
InNo_Manual_Forw
{
get
;
protected
set
;
}
=
7
-
1
;
/// <summary>
/// <summary>
/// 急停 and 手动反转
/// 急停 and 手动反转
/// </summary>
/// </summary>
[
Description
(
"急停 & 手动反转"
)]
public
int
InNo_Manual_Backw
{
get
;
protected
set
;
}
=
8
-
1
;
public
int
InNo_Manual_Backw
{
get
;
protected
set
;
}
=
8
-
1
;
/// <summary>
/// <summary>
/// 同步输入信号
/// 同步输入信号
/// </summary>
/// </summary>
[
Description
(
"同步输入信号"
)]
public
int
InNo_Sync
{
get
;
protected
set
;
}
=
9
-
1
;
public
int
InNo_Sync
{
get
;
protected
set
;
}
=
9
-
1
;
/// <summary>
/// <summary>
/// 辊速信号
/// 辊速信号
/// </summary>
/// </summary>
[
Description
(
"辊速信号"
)]
public
int
InNo_Roll
{
get
;
protected
set
;
}
=
11
-
1
;
public
int
InNo_Roll
{
get
;
protected
set
;
}
=
11
-
1
;
/// <summary>
/// <summary>
/// 控制主轴脉冲启动计数输入, o3 接 i11;
/// 控制主轴脉冲启动计数输入, o3 接 i11;
/// i11 为 0 计数停止
/// i11 为 0 计数停止
/// </summary>
/// </summary>
[
Description
(
"主轴脉冲启动计数"
)]
public
int
InNo_Pos2OnOff
{
get
;
protected
set
;
}
=
11
-
1
;
public
int
InNo_Pos2OnOff
{
get
;
protected
set
;
}
=
11
-
1
;
/// <summary>
/// <summary>
/// 纵向光纤信号
/// 纵向光纤信号
/// </summary>
/// </summary>
[
Description
(
"纵向光纤信号"
)]
public
int
InNo_VSign
{
get
;
protected
set
;
}
=
12
-
1
;
public
int
InNo_VSign
{
get
;
protected
set
;
}
=
12
-
1
;
#
endregion
#
endregion
#
region
输出口
#
region
输出口
/// <summary>
/// 扫描动作中
/// </summary>
[
Description
(
"扫描动作中"
)]
public
int
OutNo_Scan
{
get
;
protected
set
;
}
=
1
-
1
;
/// <summary>
/// <summary>
/// 变频器反转 VF0 是松下的变频器牌子
/// 变频器反转 VF0 是松下的变频器牌子
/// </summary>
/// </summary>
...
@@ -132,37 +136,36 @@ namespace FLY.Thick.Base.Common
...
@@ -132,37 +136,36 @@ namespace FLY.Thick.Base.Common
#
endregion
#
endregion
private
int
version
=
2
;
IFlyAD
flyAD
;
/// <summary>
public
virtual
void
SetFlyAD
(
IFlyAD
_flyAD
)
/// 根据AD盒的版本,设置
/// </summary>
/// <param name="version"></param>
public
virtual
void
SerVersion
(
int
version
)
{
{
this
.
version
=
version
;
this
.
flyAD
=
_flyAD
;
if
(
this
.
version
==
3
)
Misc
.
BindingOperations
.
SetBinding
(
flyAD
,
nameof
(
flyAD
.
HardwareVersion
),
()
=>
{
{
InNo_Org
=
13
-
1
;
if
(
this
.
flyAD
.
HardwareVersion
<
3
)
InNo_Limit_Forw
=
14
-
1
;
{
InNo_Limit_Backw
=
16
-
1
;
InNo_Org
=
2
-
1
;
InNo_Limit_Forw
=
3
-
1
;
InNo_Limit_Backw
=
4
-
1
;
InNo_Roll
=
15
-
1
;
InNo_Roll
=
11
-
1
;
}
}
else
else
{
{
InNo_Org
=
2
-
1
;
InNo_Org
=
13
-
1
;
InNo_Limit_Forw
=
3
-
1
;
InNo_Limit_Forw
=
14
-
1
;
InNo_Limit_Backw
=
4
-
1
;
InNo_Limit_Backw
=
16
-
1
;
InNo_Roll
=
11
-
1
;
InNo_Roll
=
15
-
1
;
}
}
});
}
}
/// <summary>
/// <summary>
/// 获取输入口 属性名
/// 获取输入口 属性名
/// </summary>
/// </summary>
/// <returns></returns>
/// <returns></returns>
protected
virtual
List
<
string
>
GetInputPropertyNames
()
protected
virtual
List
<
string
>
GetInputPropertyNames
()
{
{
List
<
string
>
reponse
=
new
List
<
string
>();
List
<
string
>
reponse
=
new
List
<
string
>();
Type
t
=
this
.
GetType
();
Type
t
=
this
.
GetType
();
...
@@ -201,37 +204,45 @@ namespace FLY.Thick.Base.Common
...
@@ -201,37 +204,45 @@ namespace FLY.Thick.Base.Common
public
void
GetIODefine
(
AsyncCBHandler
asyncDelegate
,
object
asyncContext
)
public
void
GetIODefine
(
AsyncCBHandler
asyncDelegate
,
object
asyncContext
)
{
{
//获取全部带 Description 的属性,且名字 InNo_XXX 或 OutNo_XXX
//获取全部带 Description 的属性,且名字 InNo_XXX 或 OutNo_XXX
IODefineCollection
reponse
=
new
IODefineCollection
();
IODefineCollection
re
s
ponse
=
new
IODefineCollection
();
List
<
IODefine
>
list
=
new
List
<
IODefine
>();
List
<
IODefine
>
list
=
new
List
<
IODefine
>();
reponse
.
List
=
list
;
re
s
ponse
.
List
=
list
;
if
(
version
==
3
)
if
(
flyAD
.
HardwareVersion
<
3
)
{
{
re
ponse
.
InCount
=
16
;
re
sponse
.
InCount
=
12
;
re
ponse
.
OutCount
=
8
;
re
sponse
.
OutCount
=
4
;
}
}
else
{
else
reponse
.
InCount
=
12
;
{
reponse
.
OutCount
=
4
;
response
.
InCount
=
16
;
response
.
OutCount
=
8
;
}
}
var
inputPropertyNames
=
GetInputPropertyNames
();
var
inputPropertyNames
=
GetInputPropertyNames
();
var
outputPropertyNames
=
GetOutputPropertyNames
();
var
outputPropertyNames
=
GetOutputPropertyNames
();
if
(
flyAD
.
MotorType
!=
FlyADBase
.
MOTORTYPE
.
VF0
)
{
//把 变频器 接口删除
outputPropertyNames
.
Remove
(
nameof
(
OutNo_VF0_Forw
));
outputPropertyNames
.
Remove
(
nameof
(
OutNo_VF0_Backw
));
outputPropertyNames
.
Remove
(
nameof
(
OutNo_VF0_Slow
));
}
if
(
flyAD
.
MotorType
==
FlyADBase
.
MOTORTYPE
.
VF0
)
{
//变频器 模式 没有扫描状态灯
outputPropertyNames
.
Remove
(
nameof
(
OutNo_Scan
));
}
Type
t
=
this
.
GetType
();
Type
t
=
this
.
GetType
();
foreach
(
var
propertyName
in
inputPropertyNames
)
foreach
(
var
propertyName
in
inputPropertyNames
)
{
{
var
property
=
t
.
GetProperty
(
propertyName
);
var
property
=
t
.
GetProperty
(
propertyName
);
var
attrs
=
property
.
GetCustomAttributes
(
typeof
(
DescriptionAttribute
),
false
);
if
(
attrs
.
Count
()
==
0
)
{
throw
new
Exception
(
$"
{
propertyName
}
没有写 [Description]"
);
}
var
attr
=
attrs
.
First
()
as
DescriptionAttribute
;
string
desp
=
propertyName
;
string
desp
=
attr
.
Description
;
var
index
=
(
int
)
property
.
GetValue
(
this
);
var
index
=
(
int
)
property
.
GetValue
(
this
);
var
iodefine
=
new
IODefine
()
var
iodefine
=
new
IODefine
()
...
@@ -240,6 +251,7 @@ namespace FLY.Thick.Base.Common
...
@@ -240,6 +251,7 @@ namespace FLY.Thick.Base.Common
Index
=
index
,
Index
=
index
,
Description
=
desp
Description
=
desp
};
};
list
.
Add
(
iodefine
);
list
.
Add
(
iodefine
);
}
}
...
@@ -247,14 +259,7 @@ namespace FLY.Thick.Base.Common
...
@@ -247,14 +259,7 @@ namespace FLY.Thick.Base.Common
{
{
var
property
=
t
.
GetProperty
(
propertyName
);
var
property
=
t
.
GetProperty
(
propertyName
);
var
attrs
=
property
.
GetCustomAttributes
(
typeof
(
DescriptionAttribute
),
false
);
string
desp
=
propertyName
;
if
(
attrs
.
Count
()
==
0
)
{
throw
new
Exception
(
$"
{
propertyName
}
没有写 [Description]"
);
}
var
attr
=
attrs
.
First
()
as
DescriptionAttribute
;
string
desp
=
attr
.
Description
;
var
index
=
(
int
)
property
.
GetValue
(
this
);
var
index
=
(
int
)
property
.
GetValue
(
this
);
var
iodefine
=
new
IODefine
()
var
iodefine
=
new
IODefine
()
...
@@ -266,7 +271,7 @@ namespace FLY.Thick.Base.Common
...
@@ -266,7 +271,7 @@ namespace FLY.Thick.Base.Common
list
.
Add
(
iodefine
);
list
.
Add
(
iodefine
);
}
}
asyncDelegate
?.
Invoke
(
asyncContext
,
reponse
);
asyncDelegate
?.
Invoke
(
asyncContext
,
re
s
ponse
);
}
}
}
}
}
}
Project.FLY.Thick.Base/FLY.Thick.Base/FLY.Thick.Base.csproj
View file @
441a1a7e
...
@@ -42,6 +42,8 @@
...
@@ -42,6 +42,8 @@
</ApplicationIcon>
</ApplicationIcon>
</PropertyGroup>
</PropertyGroup>
<ItemGroup>
<ItemGroup>
<Reference
Include=
"PresentationCore"
/>
<Reference
Include=
"PresentationFramework"
/>
<Reference
Include=
"System"
/>
<Reference
Include=
"System"
/>
<Reference
Include=
"System.Core"
/>
<Reference
Include=
"System.Core"
/>
<Reference
Include=
"System.Xml.Linq"
/>
<Reference
Include=
"System.Xml.Linq"
/>
...
@@ -162,6 +164,16 @@
...
@@ -162,6 +164,16 @@
<Folder
Include=
"OBJ_INTERFACE\"
/>
<Folder
Include=
"OBJ_INTERFACE\"
/>
<Folder
Include=
"Server.OBJProxy\"
/>
<Folder
Include=
"Server.OBJProxy\"
/>
</ItemGroup>
</ItemGroup>
<ItemGroup>
<Page
Include=
"Themes\StringResources\en\StringResource.ERRNO.xaml"
>
<Generator>
MSBuild:Compile
</Generator>
<SubType>
Designer
</SubType>
</Page>
<Page
Include=
"Themes\StringResources\StringResource.ERRNO.xaml"
>
<Generator>
MSBuild:Compile
</Generator>
<SubType>
Designer
</SubType>
</Page>
</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/Server/GetSample.cs
View file @
441a1a7e
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