Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
李娜
/
Line-Smart-Workstation
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit b3049428
由
LN
编写于
2023-07-31 10:03:52 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
candll调用时增加异常捕获。退出调宽页面时自动停止调宽。
1 个父辈
dc0d39bb
隐藏空白字符变更
内嵌
并排
正在显示
6 个修改的文件
包含
76 行增加
和
14 行删除
DeviceLibrary/csvLoad/CSVBomManager.cs
DeviceLibrary/manager/LineWidthManager.cs
PUSICANLibrary/PUSICANControl.cs
TSA-V/FrmChangeWidth.cs
TSA-V/workForm/FrmBoardSelect.Designer.cs
TSA-V/workForm/FrmBoardSelect.cs
DeviceLibrary/csvLoad/CSVBomManager.cs
查看文件 @
b304942
...
@@ -600,12 +600,12 @@ namespace TSA_V.LoadCSVLibrary
...
@@ -600,12 +600,12 @@ namespace TSA_V.LoadCSVLibrary
Dictionary
<
string
,
ComponetInfo
>
comMap
=
new
Dictionary
<
string
,
ComponetInfo
>();
Dictionary
<
string
,
ComponetInfo
>
comMap
=
new
Dictionary
<
string
,
ComponetInfo
>();
foreach
(
ComponetInfo
obj
in
comList
)
foreach
(
ComponetInfo
obj
in
comList
)
{
{
string
key
=
obj
.
PN
+
"-"
+
obj
.
PositionNum
;
string
key
=
obj
.
PN
+
"-"
+
obj
.
PositionNum
;
if
(
comMap
.
ContainsKey
(
key
))
if
(
comMap
.
ContainsKey
(
key
))
{
{
continue
;
continue
;
}
}
obj
.
TagNo
=
""
;
//
obj.TagNo = "";
comMap
.
Add
(
key
,
obj
);
comMap
.
Add
(
key
,
obj
);
}
}
List
<
ComponetInfo
>
list
=
new
List
<
ComponetInfo
>(
comMap
.
Values
);
List
<
ComponetInfo
>
list
=
new
List
<
ComponetInfo
>(
comMap
.
Values
);
...
...
DeviceLibrary/manager/LineWidthManager.cs
查看文件 @
b304942
...
@@ -67,7 +67,12 @@ namespace TSA_V.DeviceLibrary
...
@@ -67,7 +67,12 @@ namespace TSA_V.DeviceLibrary
public
static
void
StopChangeWidth
()
public
static
void
StopChangeWidth
()
{
{
IsStop
=
true
;
if
(!
IsStop
)
{
IsStop
=
true
;
PUSICANControl
.
StopMove
(
LWidthManager
.
Line_NodeAddr
);
LogUtil
.
info
(
"StopChangeWidth ,停止调宽电机运动"
);
}
}
}
public
static
string
StartChangeWidth
(
int
targetWidth
,
int
targetPosition
,
int
timeOutSeconds
=
600
)
public
static
string
StartChangeWidth
(
int
targetWidth
,
int
targetPosition
,
int
timeOutSeconds
=
600
)
{
{
...
...
PUSICANLibrary/PUSICANControl.cs
查看文件 @
b304942
...
@@ -50,7 +50,7 @@ namespace PUSICANLibrary
...
@@ -50,7 +50,7 @@ namespace PUSICANLibrary
public
static
extern
PUSIResult
PUSICO_SetNodeState
(
uint
nodeid
,
SLAVE_MANAGEMENT
slaveManagement
);
public
static
extern
PUSIResult
PUSICO_SetNodeState
(
uint
nodeid
,
SLAVE_MANAGEMENT
slaveManagement
);
#endregion
#
endregion
private
static
Dictionary
<
uint
,
Dictionary
<
uint
,
int
>>
sdoLastData
=
new
Dictionary
<
uint
,
Dictionary
<
uint
,
int
>>();
private
static
Dictionary
<
uint
,
Dictionary
<
uint
,
int
>>
sdoLastData
=
new
Dictionary
<
uint
,
Dictionary
<
uint
,
int
>>();
...
@@ -87,6 +87,7 @@ namespace PUSICANLibrary
...
@@ -87,6 +87,7 @@ namespace PUSICANLibrary
}
}
return
-
1
;
return
-
1
;
}
}
[
HandleProcessCorruptedStateExceptions
]
public
static
PUSIResult
WriteSDO
(
uint
nodeId
,
uint
sdoAddr
,
int
value
)
public
static
PUSIResult
WriteSDO
(
uint
nodeId
,
uint
sdoAddr
,
int
value
)
{
{
PUSIResult
result
=
PUSIResult
.
RET_READSDO_FAIL
;
PUSIResult
result
=
PUSIResult
.
RET_READSDO_FAIL
;
...
@@ -112,6 +113,10 @@ namespace PUSICANLibrary
...
@@ -112,6 +113,10 @@ namespace PUSICANLibrary
UpdateSDOData
(
nodeId
,
sdoAddr
,
value
);
UpdateSDOData
(
nodeId
,
sdoAddr
,
value
);
}
}
}
}
catch
(
AccessViolationException
e
)
{
LogUtil
.
error
(
"write "
+
nodeId
+
" CAN_Address."
+
sdoAddr
+
" AccessViolationException 异常 ."
+
e
.
ToString
());
}
catch
(
Exception
ex
)
catch
(
Exception
ex
)
{
{
LogUtil
.
error
(
"write "
+
nodeId
+
" CAN_Address."
+
sdoAddr
+
" error ."
+
ex
.
ToString
());
LogUtil
.
error
(
"write "
+
nodeId
+
" CAN_Address."
+
sdoAddr
+
" error ."
+
ex
.
ToString
());
...
@@ -119,6 +124,7 @@ namespace PUSICANLibrary
...
@@ -119,6 +124,7 @@ namespace PUSICANLibrary
return
result
;
return
result
;
}
}
[
HandleProcessCorruptedStateExceptions
]
public
static
PUSIResult
ReadSDO
(
uint
nodeId
,
uint
sdoAddr
,
out
int
outValue
)
public
static
PUSIResult
ReadSDO
(
uint
nodeId
,
uint
sdoAddr
,
out
int
outValue
)
{
{
outValue
=
0
;
outValue
=
0
;
...
@@ -145,6 +151,10 @@ namespace PUSICANLibrary
...
@@ -145,6 +151,10 @@ namespace PUSICANLibrary
Console
.
WriteLine
(
"read "
+
addr
.
sdoAddr
+
" sdo ok."
+
outValue
);
Console
.
WriteLine
(
"read "
+
addr
.
sdoAddr
+
" sdo ok."
+
outValue
);
}
}
}
}
catch
(
AccessViolationException
e
)
{
LogUtil
.
error
(
"read "
+
nodeId
+
" CAN_Address."
+
sdoAddr
+
" AccessViolationException 异常 ."
+
e
.
ToString
());
}
catch
(
Exception
ex
)
catch
(
Exception
ex
)
{
{
LogUtil
.
error
(
"read "
+
nodeId
+
" CAN_Address."
+
sdoAddr
+
" error ."
+
ex
.
ToString
());
LogUtil
.
error
(
"read "
+
nodeId
+
" CAN_Address."
+
sdoAddr
+
" error ."
+
ex
.
ToString
());
...
@@ -174,6 +184,7 @@ namespace PUSICANLibrary
...
@@ -174,6 +184,7 @@ namespace PUSICANLibrary
return
Open
(
adapterIndex
,
baudIndex
,
Ip
,
port
);
return
Open
(
adapterIndex
,
baudIndex
,
Ip
,
port
);
}
}
[
HandleProcessCorruptedStateExceptions
]
public
static
void
Close
()
public
static
void
Close
()
{
{
try
try
...
@@ -185,11 +196,17 @@ namespace PUSICANLibrary
...
@@ -185,11 +196,17 @@ namespace PUSICANLibrary
ISOpen
=
false
;
ISOpen
=
false
;
}
}
}
}
catch
(
AccessViolationException
e
)
{
LogUtil
.
error
(
"Close出错 AccessViolationException 异常 ."
+
e
.
ToString
());
}
catch
(
Exception
ex
)
catch
(
Exception
ex
)
{
{
LogUtil
.
error
(
"Close出错:"
+
ex
.
ToString
());
LogUtil
.
error
(
"Close出错:"
+
ex
.
ToString
());
}
}
}
}
[
HandleProcessCorruptedStateExceptions
]
public
static
string
Open
(
int
adapterIndex
,
int
baudIndex
,
string
Ip
,
int
port
)
public
static
string
Open
(
int
adapterIndex
,
int
baudIndex
,
string
Ip
,
int
port
)
{
{
try
try
...
@@ -254,6 +271,10 @@ namespace PUSICANLibrary
...
@@ -254,6 +271,10 @@ namespace PUSICANLibrary
return
"打开端口失败!"
;
return
"打开端口失败!"
;
}
}
}
}
catch
(
AccessViolationException
e
)
{
LogUtil
.
error
(
"Open出错 AccessViolationException 异常 ."
+
e
.
ToString
());
}
catch
(
Exception
ex
)
catch
(
Exception
ex
)
{
{
LogUtil
.
error
(
"Open出错:"
+
ex
.
ToString
());
LogUtil
.
error
(
"Open出错:"
+
ex
.
ToString
());
...
@@ -263,20 +284,48 @@ namespace PUSICANLibrary
...
@@ -263,20 +284,48 @@ namespace PUSICANLibrary
/// <summary>
/// <summary>
/// 初始化节点
/// 初始化节点
/// </summary>
/// </summary>
[
HandleProcessCorruptedStateExceptions
]
public
static
bool
InitNode
(
uint
nodeid
)
public
static
bool
InitNode
(
uint
nodeid
)
{
{
//添加节点
try
PUSIResult
result
=
PUSICANControl
.
PUSICO_AddNode
(
Convert
.
ToUInt32
(
nodeid
));
{
//启动节点
result
=
PUSICANControl
.
PUSICO_SetNodeState
(
nodeid
,
SLAVE_MANAGEMENT
.
SLAVE_START
);
//添加节点
return
SetOutStopType
(
nodeid
);
PUSIResult
result
=
PUSICANControl
.
PUSICO_AddNode
(
Convert
.
ToUInt32
(
nodeid
));
//启动节点
result
=
PUSICANControl
.
PUSICO_SetNodeState
(
nodeid
,
SLAVE_MANAGEMENT
.
SLAVE_START
);
return
SetOutStopType
(
nodeid
);
}
catch
(
AccessViolationException
e
)
{
LogUtil
.
error
(
"InitNode 出错 AccessViolationException 异常 ."
+
e
.
ToString
());
}
catch
(
Exception
ex
)
{
LogUtil
.
error
(
"InitNode 出错:"
+
ex
.
ToString
());
}
return
false
;
}
}
[
HandleProcessCorruptedStateExceptions
]
public
static
bool
RemoveNode
(
uint
nodeid
)
public
static
bool
RemoveNode
(
uint
nodeid
)
{
{
LogUtil
.
info
(
"RemoveNode "
+
nodeid
);
try
//删除节点
{
PUSIResult
result
=
PUSICANControl
.
PUSICO_RemoveNode
(
Convert
.
ToUInt32
(
nodeid
));
LogUtil
.
info
(
"RemoveNode "
+
nodeid
);
return
true
;
//删除节点
PUSIResult
result
=
PUSICANControl
.
PUSICO_RemoveNode
(
Convert
.
ToUInt32
(
nodeid
));
return
true
;
}
catch
(
AccessViolationException
e
)
{
LogUtil
.
error
(
"RemoveNode 出错 AccessViolationException 异常 ."
+
e
.
ToString
());
}
catch
(
Exception
ex
)
{
LogUtil
.
error
(
"RemoveNode 出错:"
+
ex
.
ToString
());
}
return
false
;
}
}
public
static
bool
InitRNodeConfig
(
uint
nodeId
,
bool
isLineSlv
=
false
)
public
static
bool
InitRNodeConfig
(
uint
nodeId
,
bool
isLineSlv
=
false
)
...
...
TSA-V/FrmChangeWidth.cs
查看文件 @
b304942
...
@@ -107,7 +107,8 @@ namespace TSA_V
...
@@ -107,7 +107,8 @@ namespace TSA_V
private
void
FrmPutCom_FormClosing
(
object
sender
,
FormClosingEventArgs
e
)
private
void
FrmPutCom_FormClosing
(
object
sender
,
FormClosingEventArgs
e
)
{
{
//停止调宽
LWidthManager
.
StopChangeWidth
();
}
}
private
void
timer1_Tick
(
object
sender
,
EventArgs
e
)
private
void
timer1_Tick
(
object
sender
,
EventArgs
e
)
...
...
TSA-V/workForm/FrmBoardSelect.Designer.cs
查看文件 @
b304942
...
@@ -190,6 +190,7 @@
...
@@ -190,6 +190,7 @@
this
.
Controls
.
Add
(
this
.
chbOffLine
);
this
.
Controls
.
Add
(
this
.
chbOffLine
);
this
.
Name
=
"FrmBoardSelect"
;
this
.
Name
=
"FrmBoardSelect"
;
this
.
Text
=
"请选择程序"
;
this
.
Text
=
"请选择程序"
;
this
.
FormClosing
+=
new
System
.
Windows
.
Forms
.
FormClosingEventHandler
(
this
.
FrmBoardSelect_FormClosing
);
this
.
Load
+=
new
System
.
EventHandler
(
this
.
FrmBoardSelect_Load
);
this
.
Load
+=
new
System
.
EventHandler
(
this
.
FrmBoardSelect_Load
);
this
.
Shown
+=
new
System
.
EventHandler
(
this
.
FrmBoardSelect_Shown
);
this
.
Shown
+=
new
System
.
EventHandler
(
this
.
FrmBoardSelect_Shown
);
this
.
ResumeLayout
(
false
);
this
.
ResumeLayout
(
false
);
...
...
TSA-V/workForm/FrmBoardSelect.cs
查看文件 @
b304942
...
@@ -370,5 +370,11 @@ namespace TSA_V
...
@@ -370,5 +370,11 @@ namespace TSA_V
}
}
}
}
private
void
FrmBoardSelect_FormClosing
(
object
sender
,
FormClosingEventArgs
e
)
{
//停止调宽
LWidthManager
.
StopChangeWidth
();
}
}
}
}
}
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论