Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
张东亮
/
NS200
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
图表
网络
创建新的问题
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit 5bab452a
由
张东亮
编写于
2026-02-12 20:28:53 +0800
浏览文件
选项
浏览文件
标签
下载
差异文件
1
2 个父辈
d2bbb096
9a16b822
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
57 行增加
和
44 行删除
DeviceLibrary/AutoScanAndLabel/AxisBean.cs
DeviceLibrary/AutoScanAndLabel/MainMachine _LabelProcess.cs
DeviceLibrary/AutoScanAndLabel/MainMachine _RightProcess.cs
DeviceLibrary/AutoScanAndLabel/AxisBean.cs
查看文件 @
5bab452
...
...
@@ -3,10 +3,7 @@ using OnlineStore.Common;
using
OnlineStore.LoadCSVLibrary
;
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Text
;
using
System.Threading
;
using
System.Threading.Tasks
;
namespace
DeviceLibrary
{
...
...
@@ -22,7 +19,7 @@ namespace DeviceLibrary
/// <summary>
/// 干涉检测回调 from, to
/// </summary>
public
event
Func
<
int
,
int
,(
bool
,
string
)>
interference
;
public
event
Func
<
int
,
int
,
(
bool
,
string
)>
interference
;
public
string
AxisName
;
public
AxisBean
(
ConfigMoveAxis
axisConfig
,
string
deviceName
)
{
...
...
@@ -126,7 +123,7 @@ namespace DeviceLibrary
else
{
AxisManager
.
ServoOff
(
portName
,
slvAddr
);
msg
=
crc
.
GetString
(
"Res0117.2bf5c941"
,
"打开轴"
)
+
Config
.
Explain
+
crc
.
GetString
(
"Res0118.33d2a704"
,
"失败 "
);
msg
=
crc
.
GetString
(
"Res0117.2bf5c941"
,
"打开轴"
)
+
Config
.
Explain
+
crc
.
GetString
(
"Res0118.33d2a704"
,
"失败 "
);
LogUtil
.
info
(
AxisName
+
msg
);
return
false
;
}
...
...
@@ -192,7 +189,7 @@ namespace DeviceLibrary
int
isAlarm
=
AxisManager
.
GetAlarmStatus
(
deviceName
,
axisNo
);
if
(
isAlarm
.
Equals
(
1
))
{
clearMsg
=
crc
.
GetString
(
"Res0119.cbd5d752"
,
"清理报警,"
);
clearMsg
=
crc
.
GetString
(
"Res0119.cbd5d752"
,
"清理报警,"
);
AxisManager
.
AlarmClear
(
deviceName
,
axisNo
);
Thread
.
Sleep
(
200
);
AxisManager
.
ServoOn
(
deviceName
,
axisNo
);
...
...
@@ -204,7 +201,7 @@ namespace DeviceLibrary
AxisManager
.
SuddenStop
(
axis
.
DeviceName
,
axis
.
GetAxisValue
());
Thread
.
Sleep
(
100
);
}
LogUtil
.
error
(
$
"{
MoveInfo.Name} {MoveInfo.MoveStep} {axis.DisplayStr}目标位置{targetPosition}当前位置{outCount},误差过大,{clearMsg}重新开始运动,剩余{MoveInfo.CanWhileCount}次"
);
LogUtil
.
error
(
$
"{MoveInfo.Name} {MoveInfo.MoveStep} {axis.DisplayStr}目标位置{targetPosition}当前位置{outCount},误差过大,{clearMsg}重新开始运动,剩余{MoveInfo.CanWhileCount}次"
);
AxisManager
.
AbsMove
(
axis
.
DeviceName
,
axis
.
GetAxisValue
(),
targetPosition
,
targetSpeed
,
targetSpeed
*
4
,
targetSpeed
*
4
);
// , axis.AddSpeed, axis.DelSpeed);
MoveInfo
.
CanWhileCount
--;
Thread
.
Sleep
(
200
);
...
...
@@ -239,7 +236,7 @@ namespace DeviceLibrary
}
else
{
msg
=
MoveInfo
.
Name
+
" "
+
MoveInfo
.
MoveStep
+
axis
.
DisplayStr
+
crc
.
GetString
(
"Res0120.405c5a9e"
,
",收到原点完成信号,当前位置["
)
+
outCount
+
crc
.
GetString
(
"Res0121.6658614e"
,
"],误差过大,需要报警"
);
msg
=
MoveInfo
.
Name
+
" "
+
MoveInfo
.
MoveStep
+
axis
.
DisplayStr
+
crc
.
GetString
(
"Res0120.405c5a9e"
,
",收到原点完成信号,当前位置["
)
+
outCount
+
crc
.
GetString
(
"Res0121.6658614e"
,
"],误差过大,需要报警"
);
LogUtil
.
error
(
msg
);
}
}
...
...
@@ -292,62 +289,76 @@ namespace DeviceLibrary
/// 判断轴运动是否安全
/// </summary>
/// <returns></returns>
public
bool
IsSafe
(
int
Targetpos
,
out
string
msg
){
public
bool
IsSafe
(
int
Targetpos
,
out
string
msg
)
{
msg
=
""
;
if
(
interference
==
null
)
return
true
;
bool
result
;
(
result
,
msg
)
=
interference
.
Invoke
(
GetAclPosition
(),
Targetpos
);
(
result
,
msg
)
=
interference
.
Invoke
(
GetAclPosition
(),
Targetpos
);
return
!
result
;
}
#
region
匀速上升处理
private
System
.
Timers
.
Timer
axisCheckTimer
=
null
;
internal
string
TargetIoType
=
""
;
//
private System.Timers.Timer axisCheckTimer = null;
internal
string
TargetIoType
;
internal
IO_VALUE
TargetIoValue
=
IO_VALUE
.
HIGH
;
public
bool
BatchAxisStartCheck
(
string
targetIo
,
IO_VALUE
value
=
IO_VALUE
.
HIGH
)
public
bool
BatchAxisStartCheck
(
string
targetIo
,
IO_VALUE
value
=
IO_VALUE
.
HIGH
)
{
if
(
String
.
IsNullOrEmpty
(
targetIo
))
{
targetIo
=
""
;
}
if
(
axisCheckTimer
==
null
)
{
axisCheckTimer
=
new
System
.
Timers
.
Timer
();
axisCheckTimer
.
AutoReset
=
true
;
axisCheckTimer
.
Interval
+=
15
;
axisCheckTimer
.
Elapsed
+=
CheckTimer_Elapsed
;
axisCheckTimer
.
Enabled
=
false
;
}
TargetIoValue
=
value
;
TargetIoType
=
targetIo
;
axisCheckTimer
.
Start
();
IsInProcess
=
true
;
new
Thread
(()
=>
{
CheckTimer_Elapsed
();
})
{
IsBackground
=
true
}
// 按需设成后台线程
.
Start
();
return
true
;
}
public
bool
StopAxisCheckMove
()
{
if
(!(
axisCheckTimer
==
null
))
{
axisCheckTimer
.
Stop
();
}
IsInProcess
=
false
;
return
true
;
}
private
void
CheckTimer_Elapsed
(
object
sender
,
System
.
Timers
.
ElapsedEventArgs
e
)
{
try
private
bool
IsInProcess
=
false
;
private
void
CheckTimer_Elapsed
()
{
while
(
IsInProcess
)
{
if
(
IOManager
.
IOValue
(
TargetIoType
).
Equals
(
TargetIoValue
))
Thread
.
Sleep
(
1
);
try
{
SuddenStop
();
StopAxisCheckMove
();
LogUtil
.
info
(
AxisName
+
"上料轴,检测到 "
+
TargetIoType
+
"="
+
TargetIoValue
+
",停止运动"
);
if
(
TargetIoValue
==
IO_VALUE
.
HIGH
)
{
if
(
IOManager
.
IOValue
(
TargetIoType
).
Equals
(
TargetIoValue
))
{
SuddenStop
();
LogUtil
.
info
(
AxisName
+
"上料轴,检测到 "
+
TargetIoType
+
"="
+
TargetIoValue
+
",停止运动"
);
StopAxisCheckMove
();
break
;
}
}
else
{
if
(
IOManager
.
IOValue
(
TargetIoType
).
Equals
(
TargetIoValue
))
{
SuddenStop
();
LogUtil
.
info
(
AxisName
+
"上料轴,检测到 ="
+
TargetIoValue
+
",停止运动"
);
StopAxisCheckMove
();
break
;
}
}
}
catch
(
Exception
ex
)
{
LogUtil
.
error
(
"CheckTimer_Elapsed出错:"
,
ex
);
IsInProcess
=
false
;
}
}
catch
(
Exception
ex
)
{
LogUtil
.
error
(
"CheckTimer_Elapsed出错:"
,
ex
);
}
}
#
endregion
...
...
@@ -382,7 +393,7 @@ namespace DeviceLibrary
public
static
void
CloseMultiAxis
(
List
<
AxisBean
>
axisArray
)
{
foreach
(
AxisBean
axis
in
axisArray
)
{
{
axis
.
ServoOff
();
Thread
.
Sleep
(
10
);
}
...
...
DeviceLibrary/AutoScanAndLabel/MainMachine _LabelProcess.cs
查看文件 @
5bab452
...
...
@@ -374,7 +374,7 @@ namespace DeviceLibrary
break
;
case
MoveStep
.
Lbl14
:
LeftMoveInfo
.
NextMoveStep
(
MoveStep
.
L30_LabelFinish
);
L
abelMoveInfo
.
log
(
"完成贴标.
"
);
L
eftMoveInfo
.
log
(
"通知贴标完成
"
);
LabelMoveInfo
.
NextMoveStep
(
MoveStep
.
Lbl01
);
LabelMoveInfo
.
log
(
"完成贴标."
);
break
;
...
...
DeviceLibrary/AutoScanAndLabel/MainMachine _RightProcess.cs
查看文件 @
5bab452
...
...
@@ -58,6 +58,8 @@ namespace DeviceLibrary
{
param
.
RightPulseHeight
=
PlwHight
;
param
.
RightPlateHeight
=
PlwHight
/
Config
.
Right_Batch_ChangeValue
;
if
(
param
.
RightPlateHeight
<=
0
)
param
.
RightPlateHeight
=
8
;
RightMoveInfo
.
log
(
$
"批量轴上升到P2位置到位,当前位置:{Uplast},uid={param.UID}, PlwHight:{param.RightPulseHeight},plateH:{param.RightPlateHeight}"
);
}
else
...
...
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论