Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
孙克
/
RC1250-AssemblyLine
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit 9e1824ec
由
张东亮
编写于
2022-06-02 16:21:17 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
在主线程加锁,io断开连接时心跳包不发送
1 个父辈
3190641f
显示空白字符变更
内嵌
并排
正在显示
5 个修改的文件
包含
34 行增加
和
10 行删除
source/DeviceLibrary/assemblyLine/EquipBase.cs
source/DeviceLibrary/assemblyLine/LineBean.cs
source/DeviceLibrary/deviceLibrary/IO/AIOBOX/AIOBOX.cs
source/DeviceLibrary/deviceLibrary/IO/AIOBOX/AIOBOXManager.cs
source/DeviceLibrary/model/KTK_Store.cs
source/DeviceLibrary/assemblyLine/EquipBase.cs
查看文件 @
9e1824e
...
@@ -45,8 +45,19 @@ namespace OnlineStore.DeviceLibrary
...
@@ -45,8 +45,19 @@ namespace OnlineStore.DeviceLibrary
protected
abstract
void
CheckFixtureProcess
();
protected
abstract
void
CheckFixtureProcess
();
protected
override
void
mainTimer_Elapsed
(
object
sender
,
System
.
Timers
.
ElapsedEventArgs
e
)
protected
override
void
mainTimer_Elapsed
(
object
sender
,
System
.
Timers
.
ElapsedEventArgs
e
)
{
{
if
(
Monitor
.
TryEnter
(
lockMainTimer
))
{
try
{
TimerProcess
();
TimerProcess
();
}
}
finally
{
Monitor
.
Exit
(
lockMainTimer
);
}
}
}
public
DateTime
LastAlarmTime
=
DateTime
.
Now
;
public
DateTime
LastAlarmTime
=
DateTime
.
Now
;
public
override
void
Alarm
(
LineAlarmType
alarmType
)
public
override
void
Alarm
(
LineAlarmType
alarmType
)
{
{
...
...
source/DeviceLibrary/assemblyLine/LineBean.cs
查看文件 @
9e1824e
...
@@ -758,6 +758,8 @@ namespace OnlineStore.DeviceLibrary
...
@@ -758,6 +758,8 @@ namespace OnlineStore.DeviceLibrary
/// </summary>
/// </summary>
protected
override
void
mainTimer_Elapsed
(
object
sender
,
System
.
Timers
.
ElapsedEventArgs
e
)
protected
override
void
mainTimer_Elapsed
(
object
sender
,
System
.
Timers
.
ElapsedEventArgs
e
)
{
{
if
(
Monitor
.
TryEnter
(
lockMainTimer
))
{
try
try
{
{
DateTime
time
=
DateTime
.
Now
;
DateTime
time
=
DateTime
.
Now
;
...
@@ -773,7 +775,7 @@ namespace OnlineStore.DeviceLibrary
...
@@ -773,7 +775,7 @@ namespace OnlineStore.DeviceLibrary
if
(
isAutoStart
&&
fuweiValue
.
Equals
(
IO_VALUE
.
HIGH
)
&&
lastFuwei
.
Equals
(
IO_VALUE
.
LOW
))
if
(
isAutoStart
&&
fuweiValue
.
Equals
(
IO_VALUE
.
HIGH
)
&&
lastFuwei
.
Equals
(
IO_VALUE
.
LOW
))
{
{
//没有启动时收到启动按钮
//没有启动时收到启动按钮
LogUtil
.
info
(
Name
+
"没有启动时收到启动按钮,开始调用启动方法!"
);
LogUtil
.
info
(
Name
+
"没有启动时收到启动按钮,开始调用启动方法!"
);
bool
isOk
=
StartRun
();
bool
isOk
=
StartRun
();
if
(!
isOk
)
if
(!
isOk
)
{
{
...
@@ -805,10 +807,16 @@ namespace OnlineStore.DeviceLibrary
...
@@ -805,10 +807,16 @@ namespace OnlineStore.DeviceLibrary
}
}
catch
(
Exception
ex
)
catch
(
Exception
ex
)
{
{
LogUtil
.
error
(
Name
+
"主定时器出错:"
,
ex
);
LogUtil
.
error
(
Name
+
"主定时器出错:"
,
ex
);
}
finally
{
Monitor
.
Exit
(
mainTimer
);
}
}
Thread
.
Sleep
(
1
);
Thread
.
Sleep
(
1
);
}
}
}
private
bool
busyPro
=
false
;
private
bool
busyPro
=
false
;
private
DateTime
busyProTime
=
DateTime
.
Now
;
private
DateTime
busyProTime
=
DateTime
.
Now
;
private
int
maxSeconds
=
3
;
private
int
maxSeconds
=
3
;
...
...
source/DeviceLibrary/deviceLibrary/IO/AIOBOX/AIOBOX.cs
查看文件 @
9e1824e
...
@@ -133,10 +133,12 @@ namespace Asa.IOModule
...
@@ -133,10 +133,12 @@ namespace Asa.IOModule
tRecon
=
new
Thread
(
new
ThreadStart
(
Reconn
));
tRecon
=
new
Thread
(
new
ThreadStart
(
Reconn
));
tSend
=
new
Thread
(
new
ThreadStart
(
Send
));
tSend
=
new
Thread
(
new
ThreadStart
(
Send
));
tListen
=
new
Thread
(
new
ThreadStart
(
Listen
));
tListen
=
new
Thread
(
new
ThreadStart
(
Listen
));
tRecon
.
IsBackground
=
true
;
tSend
.
IsBackground
=
true
;
tListen
.
IsBackground
=
true
;
tRecon
.
Start
();
tRecon
.
Start
();
tSend
.
Start
();
tSend
.
Start
();
tListen
.
Start
();
tListen
.
Start
();
log
.
Info
(
LogName
+
"Connect"
);
}
}
/// <summary>
/// <summary>
...
@@ -297,7 +299,7 @@ namespace Asa.IOModule
...
@@ -297,7 +299,7 @@ namespace Asa.IOModule
log
.
Error
(
LogName
+
"WriteDO Fail : IsConn= "
+
IsConn
);
log
.
Error
(
LogName
+
"WriteDO Fail : IsConn= "
+
IsConn
);
return
false
;
return
false
;
}
}
log
.
Info
(
LogName
+
"call WriteDO
"
);
log
.
Debug
(
LogName
+
"WriteDO【"
+
$
"{add}={sta}"
+
"】
"
);
byte
[]
data
=
Command
();
byte
[]
data
=
Command
();
byte
[]
buff
=
new
byte
[
12
];
byte
[]
buff
=
new
byte
[
12
];
...
@@ -311,8 +313,8 @@ namespace Asa.IOModule
...
@@ -311,8 +313,8 @@ namespace Asa.IOModule
}
}
catch
(
Exception
ex
)
catch
(
Exception
ex
)
{
{
LogUtil
.
error
(
LogName
+
"WriteDO
"
,
ex
);
LogUtil
.
error
(
LogName
+
"WriteDO
【"
+
$
"{add}={sta}"
+
"】
"
,
ex
);
log
.
Error
(
LogName
+
"WriteDO "
,
ex
);
log
.
Error
(
LogName
+
"WriteDO【"
+
$
"{add}={sta}"
+
"】"
,
ex
);
return
false
;
return
false
;
}
}
}
}
...
@@ -410,10 +412,13 @@ namespace Asa.IOModule
...
@@ -410,10 +412,13 @@ namespace Asa.IOModule
{
{
try
try
{
{
if
(
IsConn
)
{
_client
.
Send
(
buff
);
_client
.
Send
(
buff
);
log
.
Debug
(
LogName
+
"Send: "
+
HexBuff
(
buff
));
log
.
Debug
(
LogName
+
"Send: "
+
HexBuff
(
buff
));
return
true
;
return
true
;
}
}
}
catch
(
Exception
ex
)
catch
(
Exception
ex
)
{
{
LogUtil
.
error
(
LogName
+
"Send Error Socket Close"
,
ex
);
LogUtil
.
error
(
LogName
+
"Send Error Socket Close"
,
ex
);
...
@@ -662,7 +667,7 @@ namespace Asa.IOModule
...
@@ -662,7 +667,7 @@ namespace Asa.IOModule
buff
=
GetReadDO_Command
();
buff
=
GetReadDO_Command
();
SendToDevice
(
buff
);
SendToDevice
(
buff
);
LogUtil
.
error
(
LogName
+
"Socket Connect OK"
);
LogUtil
.
info
(
LogName
+
"Socket Connect OK"
);
log
.
Info
(
LogName
+
"Socket Connect OK"
);
log
.
Info
(
LogName
+
"Socket Connect OK"
);
}
}
catch
(
Exception
ex
)
catch
(
Exception
ex
)
...
...
source/DeviceLibrary/deviceLibrary/IO/AIOBOX/AIOBOXManager.cs
查看文件 @
9e1824e
...
@@ -330,7 +330,7 @@ namespace OnlineStore.DeviceLibrary
...
@@ -330,7 +330,7 @@ namespace OnlineStore.DeviceLibrary
bool
result
=
aioBox
.
WriteDO
(
StartAddress
,
GetBox_Sta
(
onOff
));
bool
result
=
aioBox
.
WriteDO
(
StartAddress
,
GetBox_Sta
(
onOff
));
if
(!
result
)
if
(!
result
)
{
{
LogUtil
.
error
(
"AIO WriteSingleDO ["
+
ioIp
+
"] ["
+
StartAddress
+
"] 失败
:
"
);
LogUtil
.
error
(
"AIO WriteSingleDO ["
+
ioIp
+
"] ["
+
StartAddress
+
"] 失败"
);
}
}
}
}
else
else
...
...
source/DeviceLibrary/model/KTK_Store.cs
查看文件 @
9e1824e
...
@@ -250,7 +250,7 @@ namespace OnlineStore.DeviceLibrary
...
@@ -250,7 +250,7 @@ namespace OnlineStore.DeviceLibrary
/// 移动信息
/// 移动信息
/// </summary>
/// </summary>
public
LineMoveInfo
MoveInfo
=
null
;
public
LineMoveInfo
MoveInfo
=
null
;
protected
object
lockMainTimer
=
new
object
();
/// <summary>
/// <summary>
/// 定时处理,监听信号,监听IO
/// 定时处理,监听信号,监听IO
/// </summary>
/// </summary>
...
...
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论