Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
孙克
/
RC1250-AssemblyLine
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit 74efec2b
由
LN
编写于
2020-02-28 09:29:55 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
AIO的dll更新,托盘处理修改
1 个父辈
2411414f
隐藏空白字符变更
内嵌
并排
正在显示
7 个修改的文件
包含
164 行增加
和
142 行删除
dll/Asa.IOModule.AIOBOX.dll
dll/Asa.IOModule.AIOBOX.xml
source/AssemblyLineClient/记录.txt
source/DeviceLibrary/assemblyLine/FeedingEquip_InStore.cs
source/DeviceLibrary/assemblyLine/LineBean_Partial.cs
source/DeviceLibrary/deviceLibrary/IO/AIOBOX/AIOBOXManager.cs
source/DeviceLibrary/server/LineServer.cs
dll/Asa.IOModule.AIOBOX.dll
查看文件 @
74efec2
此文件类型无法预览
dll/Asa.IOModule.AIOBOX.xml
查看文件 @
74efec2
...
@@ -114,7 +114,6 @@
...
@@ -114,7 +114,6 @@
<summary>
<summary>
连接
连接
</summary>
</summary>
<returns></returns>
</member>
</member>
<member
name=
"M:Asa.IOModule.AIOBOX.Close"
>
<member
name=
"M:Asa.IOModule.AIOBOX.Close"
>
<summary>
<summary>
...
...
source/AssemblyLineClient/记录.txt
查看文件 @
74efec2
...
@@ -156,6 +156,12 @@ agv客户端启动时需要设置状态为none
...
@@ -156,6 +156,12 @@ agv客户端启动时需要设置状态为none
横移机构优化,上一个托盘准备离开时,下一个托盘就可以进入。
横移机构优化,上一个托盘准备离开时,下一个托盘就可以进入。
20200227
AIO的dll更新,增加重连功能。
托盘横移过程中,提前下降第一个横移顶升。
上料模块,只有料盘到达流水线上方后才拦截托盘。
...
...
source/DeviceLibrary/assemblyLine/FeedingEquip_InStore.cs
查看文件 @
74efec2
...
@@ -716,7 +716,7 @@ namespace OnlineStore.DeviceLibrary
...
@@ -716,7 +716,7 @@ namespace OnlineStore.DeviceLibrary
TrayManager
.
UpdateTrayInfo
(
currTrayNum
,
true
,
ReelType
.
InStore
,
param
,
"扫码失败"
);
TrayManager
.
UpdateTrayInfo
(
currTrayNum
,
true
,
ReelType
.
InStore
,
param
,
"扫码失败"
);
}
}
//从服务器获取库位号
//从服务器获取库位号
string
result
=
SServerManager
.
CodeReceived
(
Name
,
currTrayNum
,
LastCodeList
,
LastHeight
,
LastWidth
,
CurrShelfId
);
string
result
=
SServerManager
.
CodeReceived
(
Name
,
currTrayNum
,
LastCodeList
,
LastHeight
,
LastWidth
,
CurrShelfId
,
DeviceID
);
if
(!
result
.
Equals
(
""
))
if
(!
result
.
Equals
(
""
))
{
{
InOutParam
param
=
new
InOutParam
(
currTrayNum
,
code
,
""
,
LastHeight
,
LastWidth
,
true
);
InOutParam
param
=
new
InOutParam
(
currTrayNum
,
code
,
""
,
LastHeight
,
LastWidth
,
true
);
...
@@ -1086,8 +1086,9 @@ namespace OnlineStore.DeviceLibrary
...
@@ -1086,8 +1086,9 @@ namespace OnlineStore.DeviceLibrary
if
(
trayCanUse
&&
runStatus
.
Equals
(
LineRunStatus
.
Busy
)
&&
MoveInfo
.
MoveType
.
Equals
(
LineMoveType
.
InStore
))
if
(
trayCanUse
&&
runStatus
.
Equals
(
LineRunStatus
.
Busy
)
&&
MoveInfo
.
MoveType
.
Equals
(
LineMoveType
.
InStore
))
{
{
//入料执行中, 且需要空托盘
//入料执行中, 且需要空托盘
if
(
MoveInfo
.
MoveStep
>=
LineMoveStep
.
FI_11_CylinderUp
&&
MoveInfo
.
MoveStep
<=
LineMoveStep
.
FI_20_WaitTray
)
if
(
MoveInfo
.
MoveStep
>=
LineMoveStep
.
FI_20_WaitTray
&&
MoveInfo
.
MoveStep
<=
LineMoveStep
.
FI_20_WaitTray
)
{
//if (MoveInfo.MoveStep >= LineMoveStep.FI_11_CylinderUp && MoveInfo.MoveStep <= LineMoveStep.FI_20_WaitTray)
{
if
(
NeedSaveParam
)
if
(
NeedSaveParam
)
{
{
CheckParam
=
param
;
CheckParam
=
param
;
...
...
source/DeviceLibrary/assemblyLine/LineBean_Partial.cs
查看文件 @
74efec2
...
@@ -284,9 +284,10 @@ namespace OnlineStore.DeviceLibrary
...
@@ -284,9 +284,10 @@ namespace OnlineStore.DeviceLibrary
}
}
if
(
sidesWayNum
.
Equals
(
2
))
if
(
sidesWayNum
.
Equals
(
2
))
{
{
LineMoveInfo
moveInfo
=
FeedingEquipMap
[
104
].
SecondMoveInfo
;
if
(
SW23_MoveInfo
.
MoveType
.
Equals
(
LineMoveType
.
None
))
if
(
SW23_MoveInfo
.
MoveType
.
Equals
(
LineMoveType
.
None
))
{
{
LineMoveInfo
moveInfo
=
FeedingEquipMap
[
104
].
SecondMoveInfo
;
if
(
moveInfo
.
MoveType
.
Equals
(
LineMoveType
.
None
))
if
(
moveInfo
.
MoveType
.
Equals
(
LineMoveType
.
None
))
{
{
return
true
;
return
true
;
...
@@ -297,6 +298,10 @@ namespace OnlineStore.DeviceLibrary
...
@@ -297,6 +298,10 @@ namespace OnlineStore.DeviceLibrary
{
{
return
true
;
return
true
;
}
}
}
else
if
(
SW23_MoveInfo
.
MoveStep
.
Equals
(
LineMoveStep
.
SW12_WaitTrayGo
)
&&
moveInfo
.
MoveType
.
Equals
(
LineMoveType
.
None
))
{
return
true
;
}
}
}
}
else
if
(
sidesWayNum
.
Equals
(
3
)
&&
runStatus
<=
LineRunStatus
.
Wait
)
else
if
(
sidesWayNum
.
Equals
(
3
)
&&
runStatus
<=
LineRunStatus
.
Wait
)
...
@@ -307,9 +312,10 @@ namespace OnlineStore.DeviceLibrary
...
@@ -307,9 +312,10 @@ namespace OnlineStore.DeviceLibrary
if
(
sidesWayNum
.
Equals
(
4
))
if
(
sidesWayNum
.
Equals
(
4
))
{
{
LineMoveInfo
moveInfo
=
FeedingEquipMap
[
101
].
SecondMoveInfo
;
if
(
SW41_MoveInfo
.
MoveType
.
Equals
(
LineMoveType
.
None
))
if
(
SW41_MoveInfo
.
MoveType
.
Equals
(
LineMoveType
.
None
))
{
{
LineMoveInfo
moveInfo
=
FeedingEquipMap
[
101
].
SecondMoveInfo
;
if
(
moveInfo
.
MoveType
.
Equals
(
LineMoveType
.
None
))
if
(
moveInfo
.
MoveType
.
Equals
(
LineMoveType
.
None
))
{
{
return
true
;
return
true
;
...
@@ -321,6 +327,11 @@ namespace OnlineStore.DeviceLibrary
...
@@ -321,6 +327,11 @@ namespace OnlineStore.DeviceLibrary
return
true
;
return
true
;
}
}
}
}
else
if
(
SW41_MoveInfo
.
Equals
(
LineMoveStep
.
SW12_WaitTrayGo
)
&&
moveInfo
.
MoveType
.
Equals
(
LineMoveType
.
None
))
{
return
true
;
}
}
}
else
if
(
sidesWayNum
.
Equals
(
3
)
&&
runStatus
<=
LineRunStatus
.
Wait
)
else
if
(
sidesWayNum
.
Equals
(
3
)
&&
runStatus
<=
LineRunStatus
.
Wait
)
{
{
...
@@ -591,14 +602,15 @@ namespace OnlineStore.DeviceLibrary
...
@@ -591,14 +602,15 @@ namespace OnlineStore.DeviceLibrary
else
if
(
SW41_MoveInfo
.
MoveStep
.
Equals
(
LineMoveStep
.
SW07_DriveMotorMove
))
else
if
(
SW41_MoveInfo
.
MoveStep
.
Equals
(
LineMoveStep
.
SW07_DriveMotorMove
))
{
{
SW41_MoveInfo
.
NextMoveStep
(
LineMoveStep
.
SW08_WaitOutCheck
);
SW41_MoveInfo
.
NextMoveStep
(
LineMoveStep
.
SW08_WaitOutCheck
);
SWLog
(
"横移轨道41:等待托盘到达出口 "
);
SWLog
(
"横移轨道41:收到SW1_TrayCheck,先顶升4下降,等待托盘到达出口 "
);
CylinderMove
(
null
,
IO_Type
.
SW4_TopCylinder_Up
,
IO_Type
.
SW4_TopCylinder_Down
);
SW41_MoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitTime
(
300
));
SW41_MoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitTime
(
300
));
SW41_MoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitIO
(
IO_Type
.
SW1_TrayCheck
,
IO_VALUE
.
HIGH
));
SW41_MoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitIO
(
IO_Type
.
SW1_TrayCheck
,
IO_VALUE
.
HIGH
));
}
}
else
if
(
SW41_MoveInfo
.
MoveStep
.
Equals
(
LineMoveStep
.
SW08_WaitOutCheck
))
else
if
(
SW41_MoveInfo
.
MoveStep
.
Equals
(
LineMoveStep
.
SW08_WaitOutCheck
))
{
{
SW41_MoveInfo
.
NextMoveStep
(
LineMoveStep
.
SW09_WatOutFixture2
);
SW41_MoveInfo
.
NextMoveStep
(
LineMoveStep
.
SW09_WatOutFixture2
);
SWLog
(
"横移轨道41:再次验证托盘是否在出口处 "
);
SWLog
(
"横移轨道41:再次验证托盘是否在出口处 "
);
SW41_MoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitTime
(
300
));
SW41_MoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitTime
(
300
));
SW41_MoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitIO
(
IO_Type
.
SW1_TrayCheck
,
IO_VALUE
.
HIGH
));
SW41_MoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitIO
(
IO_Type
.
SW1_TrayCheck
,
IO_VALUE
.
HIGH
));
...
@@ -748,7 +760,8 @@ namespace OnlineStore.DeviceLibrary
...
@@ -748,7 +760,8 @@ namespace OnlineStore.DeviceLibrary
else
if
(
SW23_MoveInfo
.
MoveStep
.
Equals
(
LineMoveStep
.
SW07_DriveMotorMove
))
else
if
(
SW23_MoveInfo
.
MoveStep
.
Equals
(
LineMoveStep
.
SW07_DriveMotorMove
))
{
{
SW23_MoveInfo
.
NextMoveStep
(
LineMoveStep
.
SW08_WaitOutCheck
);
SW23_MoveInfo
.
NextMoveStep
(
LineMoveStep
.
SW08_WaitOutCheck
);
SWLog
(
"横移轨道23:等待托盘到达出口 "
);
SWLog
(
"横移轨道23:收到 SW3_TrayCheck,先顶升2下降,,等待托盘到达出口 "
);
CylinderMove
(
null
,
IO_Type
.
SW2_TopCylinder_Up
,
IO_Type
.
SW2_TopCylinder_Down
);
SW23_MoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitTime
(
300
));
SW23_MoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitTime
(
300
));
SW23_MoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitIO
(
IO_Type
.
SW3_TrayCheck
,
IO_VALUE
.
HIGH
));
SW23_MoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitIO
(
IO_Type
.
SW3_TrayCheck
,
IO_VALUE
.
HIGH
));
}
}
...
...
source/DeviceLibrary/deviceLibrary/IO/AIOBOX/AIOBOXManager.cs
查看文件 @
74efec2
...
@@ -29,82 +29,82 @@ namespace OnlineStore.DeviceLibrary
...
@@ -29,82 +29,82 @@ namespace OnlineStore.DeviceLibrary
private
object
DILock
=
""
;
private
object
DILock
=
""
;
private
object
DOLock
=
""
;
private
object
DOLock
=
""
;
private
List
<
string
>
IoIPLIst
=
new
List
<
string
>();
//
private List<string> IoIPLIst = new List<string>();
private
System
.
Timers
.
Timer
conTimer
=
null
;
//
private System.Timers.Timer conTimer = null;
public
override
void
ConnectionIOList
(
List
<
string
>
DIONameList
)
public
override
void
ConnectionIOList
(
List
<
string
>
DIONameList
)
{
{
if
(
conTimer
==
null
)
//
if (conTimer == null)
{
//
{
conTimer
=
new
System
.
Timers
.
Timer
();
//
conTimer = new System.Timers.Timer();
conTimer
.
AutoReset
=
true
;
//
conTimer.AutoReset = true;
conTimer
.
Interval
=
10000
;
//
conTimer.Interval = 10000;
conTimer
.
Elapsed
+=
ConTimer_Elapsed
;
//
conTimer.Elapsed += ConTimer_Elapsed;
}
//
}
conTimer
.
Enabled
=
false
;
//
conTimer.Enabled = false;
IoIPLIst
=
new
List
<
string
>(
DIONameList
);
//
IoIPLIst = new List<string>(DIONameList);
conCount
=
3
;
//
conCount = 3;
foreach
(
string
ip
in
DIONameList
)
foreach
(
string
ip
in
DIONameList
)
{
{
ConnectionIP
(
ip
);
ConnectionIP
(
ip
);
}
}
if
(
IoIPLIst
.
Count
>
0
)
//
if (IoIPLIst.Count > 0)
{
//
{
//启动定时器,1一分钟重连一次
//
//启动定时器,1一分钟重连一次
conTimer
.
Start
();
//
conTimer.Start();
}
//
}
}
}
private
bool
isProcess
=
false
;
private
bool
isProcess
=
false
;
private
DateTime
lastTime
=
DateTime
.
Now
;
private
DateTime
lastTime
=
DateTime
.
Now
;
private
void
ConTimer_Elapsed
(
object
sender
,
System
.
Timers
.
ElapsedEventArgs
e
)
//
private void ConTimer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
{
//
{
TimeSpan
span
=
DateTime
.
Now
-
lastTime
;
//
TimeSpan span = DateTime.Now - lastTime;
if
(
span
.
TotalMinutes
<
IoIPLIst
.
Count
&&
isProcess
)
//
if(span.TotalMinutes< IoIPLIst .Count&& isProcess)
{
//
{
return
;
//
return;
}
//
}
isProcess
=
true
;
//
isProcess = true;
lastTime
=
DateTime
.
Now
;
//
lastTime = DateTime.Now;
try
//
try
{
//
{
//判断是否还在连接
//
//判断是否还在连接
foreach
(
AIOBOX
box
in
AIOMap
.
Values
)
//
foreach(AIOBOX box in AIOMap.Values)
{
//
{
if
(!
box
.
IsConn
)
//
if (!box.IsConn)
{
//
{
if
(
IoIPLIst
.
Contains
(
box
.
IP
).
Equals
(
false
))
//
if (IoIPLIst.Contains(box.IP).Equals(false))
{
//
{
LogUtil
.
info
(
"IO模块【"
+
box
.
IP
+
"】已断开,加入集合等待重连"
);
//
LogUtil.info("IO模块【"+box.IP+"】已断开,加入集合等待重连");
IoIPLIst
.
Add
(
box
.
IP
);
//
IoIPLIst.Add(box.IP);
}
//
}
}
//
}
}
//
}
}
catch
(
Exception
ex
)
//
}catch(Exception ex)
{
//
{
LogUtil
.
error
(
"AOI 判断是否需要重连 出错"
,
ex
);
//
LogUtil.error("AOI 判断是否需要重连 出错",ex);
}
//
}
try
//
try
{
//
{
List
<
string
>
list
=
new
List
<
string
>(
IoIPLIst
);
//
List<string> list = new List<string>(IoIPLIst);
if
(
list
.
Count
>
0
)
//
if (list.Count > 0)
{
//
{
LogUtil
.
info
(
"开始重连IO模块 ------------"
);
//
LogUtil.info("开始重连IO模块 ------------" );
conCount
=
1
;
//
conCount = 1;
foreach
(
string
ip
in
list
)
//
foreach (string ip in list)
{
//
{
ConnectionIP
(
ip
);
//
ConnectionIP(ip);
}
//
}
LogUtil
.
info
(
"结束重连IO模块 ------------"
);
//
LogUtil.info("结束重连IO模块 ------------");
}
//
}
GC
.
Collect
();
//
GC.Collect();
}
catch
(
Exception
ex
)
//
}catch(Exception ex)
{
//
{
LogUtil
.
error
(
"AOI ConTimer_Elapsed 出错: "
,
ex
);
//
LogUtil.error("AOI ConTimer_Elapsed 出错: ",ex);
}
//
}
isProcess
=
false
;
//
isProcess = false;
}
//
}
private
int
conCount
=
3
;
//
private int conCount = 3;
public
void
ConnectionIP
(
string
ioIp
)
public
void
ConnectionIP
(
string
ioIp
)
{
{
AIOBOX
aioBox
=
null
;
AIOBOX
aioBox
=
null
;
...
@@ -121,7 +121,7 @@ namespace OnlineStore.DeviceLibrary
...
@@ -121,7 +121,7 @@ namespace OnlineStore.DeviceLibrary
}
}
catch
(
Exception
ex
)
catch
(
Exception
ex
)
{
{
LogUtil
.
error
(
"关闭Io模块【"
+
ioIp
+
"】出错:"
,
ex
);
LogUtil
.
error
(
"关闭Io模块【"
+
ioIp
+
"】出错:"
,
ex
);
}
}
AIOMap
.
Remove
(
ioIp
);
AIOMap
.
Remove
(
ioIp
);
}
}
...
@@ -150,7 +150,7 @@ namespace OnlineStore.DeviceLibrary
...
@@ -150,7 +150,7 @@ namespace OnlineStore.DeviceLibrary
{
{
// Create new modbus master and add event functions
// Create new modbus master and add event functions
aioBox
=
new
AIOBOX
();
aioBox
=
new
AIOBOX
();
aioBox
.
LogPath
(
Application
.
StartupPath
+
@"\logs\aio\"
,
LogType
.
OnlyError
);
aioBox
.
LogPath
(
Application
.
StartupPath
+
@"\logs\aio\"
,
LogType
.
OnlyError
);
aioBox
.
IP
=
ioIp
;
aioBox
.
IP
=
ioIp
;
...
@@ -165,35 +165,38 @@ namespace OnlineStore.DeviceLibrary
...
@@ -165,35 +165,38 @@ namespace OnlineStore.DeviceLibrary
aioBox
.
DI_Changed_Event
+=
AioBox_DI_Changed_Event
;
;
aioBox
.
DI_Changed_Event
+=
AioBox_DI_Changed_Event
;
;
aioBox
.
DO_Changed_Event
+=
AioBox_DO_Changed_Event
;
aioBox
.
DO_Changed_Event
+=
AioBox_DO_Changed_Event
;
// aioBox.Log_Out_Event += AioBox_Log_Out_Event;
// aioBox.Log_Out_Event += AioBox_Log_Out_Event;
//aioBox.Log_RxTx_Event += AioBox_Log_RxTx_Event;
//aioBox.Log_RxTx_Event += AioBox_Log_RxTx_Event;
LogUtil
.
debug
(
"开始连接"
+
logName
+
",尝试重连3次"
);
// LogUtil.debug("开始连接" + logName + ",尝试重连3次");
for
(
int
i
=
1
;
i
<=
conCount
;
i
++)
// for (int i = 1; i <= conCount; i++)
{
//{
bool
result
=
aioBox
.
Connect
();
if
(
result
)
{
LogUtil
.
info
(
"第【"
+
i
+
"】次连接 "
+
logName
+
" 成功:"
+
aioBox
.
ErrInfo
);
if
(
IoIPLIst
.
Contains
(
ioIp
))
{
IoIPLIst
.
Remove
(
ioIp
);
}
AIOMap
.
Add
(
ioIp
,
aioBox
);
Thread
.
Sleep
(
10
);
//读取所有的DO
ReadAllDI
(
ioIp
,
0
);
break
;
}
else
{
LogUtil
.
error
(
"第【"
+
i
+
"】次连接 "
+
logName
+
" 失败:"
+
aioBox
.
ErrInfo
+
""
);
}
Thread
.
Sleep
(
5
);
GC
.
Collect
();
}
LogUtil
.
info
(
"开始连接:"
+
logName
+
":"
+
aioBox
.
ErrInfo
);
aioBox
.
Connect
();
//bool result = aioBox.Connect();
//if (result)
//{
// LogUtil.info("第【" + i + "】次连接 " + logName + " 成功:" + aioBox.ErrInfo);
//if (IoIPLIst.Contains(ioIp))
//{
// IoIPLIst.Remove(ioIp);
//}
AIOMap
.
Add
(
ioIp
,
aioBox
);
Thread
.
Sleep
(
5
);
//读取所有的DO
ReadAllDI
(
ioIp
,
0
);
// break;
//}
//else
//{
// LogUtil.error("第【" + i + "】次连接 " + logName + " 失败:" + aioBox.ErrInfo + "");
//}
Thread
.
Sleep
(
5
);
GC
.
Collect
();
// }
}
}
catch
(
Exception
error
)
catch
(
Exception
error
)
{
{
...
@@ -201,17 +204,17 @@ namespace OnlineStore.DeviceLibrary
...
@@ -201,17 +204,17 @@ namespace OnlineStore.DeviceLibrary
}
}
}
}
private
void
AioBox_Reconnect_Event
(
AIOBOX
box
,
int
times
,
ref
bool
conn
,
Dictionary
<
string
,
string
>
dict
)
//
private void AioBox_Reconnect_Event(AIOBOX box, int times, ref bool conn, Dictionary<string, string> dict)
{
//
{
conn
=
true
;
//
conn = true;
string
msg
=
"重连AIO块【"
+
box
.
IP
+
"】次数:"
+
times
+
"【"
+
box
.
ErrInfo
+
"】,连接信息如下\r\n"
;
//
string msg = "重连AIO块【" + box.IP + "】次数:" + times + "【" + box.ErrInfo + "】,连接信息如下\r\n";
foreach
(
string
key
in
dict
.
Keys
)
//
foreach (string key in dict.Keys)
{
//
{
msg
=
msg
+
"\t"
+
"["
+
key
+
"]=["
+
dict
[
key
]
+
"],"
;
//
msg = msg + "\t" + "[" + key + "]=[" + dict[key] + "],";
}
//
}
LogUtil
.
error
(
msg
);
//
LogUtil.error(msg);
}
//
}
private
DateTime
lastLogTime
=
DateTime
.
Now
;
private
DateTime
lastLogTime
=
DateTime
.
Now
;
...
@@ -232,7 +235,7 @@ namespace OnlineStore.DeviceLibrary
...
@@ -232,7 +235,7 @@ namespace OnlineStore.DeviceLibrary
}
}
catch
(
Exception
ex
)
catch
(
Exception
ex
)
{
{
LogUtil
.
error
(
"AioBox_DI_Changed_Event出错:"
,
ex
);
LogUtil
.
error
(
"AioBox_DI_Changed_Event出错:"
,
ex
);
}
}
}
}
private
void
AioBox_DO_Changed_Event
(
AIOBOX
box
,
Box_Sta
[]
sta
)
private
void
AioBox_DO_Changed_Event
(
AIOBOX
box
,
Box_Sta
[]
sta
)
...
@@ -244,7 +247,7 @@ namespace OnlineStore.DeviceLibrary
...
@@ -244,7 +247,7 @@ namespace OnlineStore.DeviceLibrary
}
}
catch
(
Exception
ex
)
catch
(
Exception
ex
)
{
{
LogUtil
.
error
(
"AioBox_DO_Changed_Event出错:"
,
ex
);
LogUtil
.
error
(
"AioBox_DO_Changed_Event出错:"
,
ex
);
}
}
}
}
...
@@ -336,7 +339,7 @@ namespace OnlineStore.DeviceLibrary
...
@@ -336,7 +339,7 @@ namespace OnlineStore.DeviceLibrary
DOValueMap
.
Add
(
ip
,
newList
);
DOValueMap
.
Add
(
ip
,
newList
);
}
}
}
}
}
}
}
}
...
@@ -348,7 +351,7 @@ namespace OnlineStore.DeviceLibrary
...
@@ -348,7 +351,7 @@ namespace OnlineStore.DeviceLibrary
{
{
ushort
length
=
LineManager
.
Config
.
GetDOLength
(
aio
.
IP
);
ushort
length
=
LineManager
.
Config
.
GetDOLength
(
aio
.
IP
);
for
(
ushort
i
=
0
;
i
<
length
;
i
++)
for
(
ushort
i
=
0
;
i
<
length
;
i
++)
{
{
aio
.
WriteDO
(
i
,
Box_Sta
.
Off
);
aio
.
WriteDO
(
i
,
Box_Sta
.
Off
);
}
}
}
}
...
@@ -364,7 +367,7 @@ namespace OnlineStore.DeviceLibrary
...
@@ -364,7 +367,7 @@ namespace OnlineStore.DeviceLibrary
}
}
catch
(
Exception
ex
)
catch
(
Exception
ex
)
{
{
LogUtil
.
error
(
"aio.Close出错:"
,
ex
);
LogUtil
.
error
(
"aio.Close出错:"
,
ex
);
}
}
}
}
AIOMap
.
Clear
();
AIOMap
.
Clear
();
...
@@ -390,36 +393,36 @@ namespace OnlineStore.DeviceLibrary
...
@@ -390,36 +393,36 @@ namespace OnlineStore.DeviceLibrary
}
}
catch
(
Exception
ex
)
catch
(
Exception
ex
)
{
{
LOGGER
.
Error
(
"AIO WriteSingleDO ["
+
ioIp
+
"] ["
+
StartAddress
+
"] 出错啦:"
,
ex
);
LOGGER
.
Error
(
"AIO WriteSingleDO ["
+
ioIp
+
"] ["
+
StartAddress
+
"] 出错啦:"
,
ex
);
}
}
}
}
public
override
void
WriteSingleDO
(
string
ioIp
,
byte
slaveId
,
ushort
StartAddress
,
IO_VALUE
onOff
,
int
mSeconds
)
public
override
void
WriteSingleDO
(
string
ioIp
,
byte
slaveId
,
ushort
StartAddress
,
IO_VALUE
onOff
,
int
mSeconds
)
{
{
try
try
{
{
AIOBOX
aioBox
=
getAIO
(
ioIp
);
AIOBOX
aioBox
=
getAIO
(
ioIp
);
if
(
aioBox
!=
null
)
if
(
aioBox
!=
null
)
{
{
Box_Sta
currBox_Sta
=
GetBox_Sta
(
onOff
);
Box_Sta
currBox_Sta
=
GetBox_Sta
(
onOff
);
aioBox
.
WriteDO
(
StartAddress
,
currBox_Sta
);
aioBox
.
WriteDO
(
StartAddress
,
currBox_Sta
);
//写入之后,等待指定间隔后回写
//写入之后,等待指定间隔后回写
System
.
Timers
.
Timer
mytimer
=
new
System
.
Timers
.
Timer
(
mSeconds
);
System
.
Timers
.
Timer
mytimer
=
new
System
.
Timers
.
Timer
(
mSeconds
);
mytimer
.
Elapsed
+=
(
o1
,
e1
)
=>
mytimer
.
Elapsed
+=
(
o1
,
e1
)
=>
{
try
{
aioBox
.
WriteDO
(
StartAddress
,
aioBox
.
ReverseStatus
(
currBox_Sta
));
LogUtil
.
debug
(
LOGGER
,
"**********定时回写入 IO ["
+
ioIp
+
"] ["
+
StartAddress
+
"]值"
+
aioBox
.
ReverseStatus
(
currBox_Sta
)
+
"】:"
);
}
catch
(
Exception
ex
)
{
{
try
LogUtil
.
error
(
LOGGER
,
"**********定时回写入 出错:"
,
ex
);
{
}
aioBox
.
WriteDO
(
StartAddress
,
aioBox
.
ReverseStatus
(
currBox_Sta
));
};
LogUtil
.
debug
(
LOGGER
,
"**********定时回写入 IO ["
+
ioIp
+
"] ["
+
StartAddress
+
"]值"
+
aioBox
.
ReverseStatus
(
currBox_Sta
)
+
"】:"
);
mytimer
.
AutoReset
=
false
;
//设置是否自动重启,即自动执行多次;
}
mytimer
.
Enabled
=
true
;
//是否执行System.Timers.Timer.Elapsed事件mytask;
catch
(
Exception
ex
)
{
LogUtil
.
error
(
LOGGER
,
"**********定时回写入 出错:"
,
ex
);
}
};
mytimer
.
AutoReset
=
false
;
//设置是否自动重启,即自动执行多次;
mytimer
.
Enabled
=
true
;
//是否执行System.Timers.Timer.Elapsed事件mytask;
}
}
else
else
{
{
...
@@ -472,7 +475,7 @@ namespace OnlineStore.DeviceLibrary
...
@@ -472,7 +475,7 @@ namespace OnlineStore.DeviceLibrary
AIOBOX
aioBox
=
getAIO
(
ioIP
);
AIOBOX
aioBox
=
getAIO
(
ioIP
);
if
(
aioBox
!=
null
)
if
(
aioBox
!=
null
)
{
{
Box_Sta
sta
=
Box_Sta
.
Off
;
Box_Sta
sta
=
Box_Sta
.
Off
;
if
(
DOValueMap
.
ContainsKey
(
ioIP
)
&&
DOValueMap
[
ioIP
].
Count
>
StartAddress
)
if
(
DOValueMap
.
ContainsKey
(
ioIP
)
&&
DOValueMap
[
ioIP
].
Count
>
StartAddress
)
{
{
sta
=
DOValueMap
[
ioIP
][
StartAddress
];
sta
=
DOValueMap
[
ioIP
][
StartAddress
];
...
@@ -487,7 +490,7 @@ namespace OnlineStore.DeviceLibrary
...
@@ -487,7 +490,7 @@ namespace OnlineStore.DeviceLibrary
}
}
catch
(
Exception
ex
)
catch
(
Exception
ex
)
{
{
LogUtil
.
error
(
"GetDOValue ["
+
ioIP
+
"] ["
+
StartAddress
+
"] 出错:"
,
ex
);
LogUtil
.
error
(
"GetDOValue ["
+
ioIP
+
"] ["
+
StartAddress
+
"] 出错:"
,
ex
);
}
}
return
value
;
return
value
;
}
}
...
@@ -519,7 +522,7 @@ namespace OnlineStore.DeviceLibrary
...
@@ -519,7 +522,7 @@ namespace OnlineStore.DeviceLibrary
}
}
catch
(
Exception
ex
)
catch
(
Exception
ex
)
{
{
LogUtil
.
error
(
"GetDIValue ["
+
ioIP
+
"] ["
+
StartAddress
+
"] 出错:"
,
ex
);
LogUtil
.
error
(
"GetDIValue ["
+
ioIP
+
"] ["
+
StartAddress
+
"] 出错:"
,
ex
);
}
}
return
value
;
return
value
;
}
}
...
@@ -539,11 +542,11 @@ namespace OnlineStore.DeviceLibrary
...
@@ -539,11 +542,11 @@ namespace OnlineStore.DeviceLibrary
}
}
catch
(
Exception
ex
)
catch
(
Exception
ex
)
{
{
LogUtil
.
error
(
LOGGER
,
" GetIOValue ["
+
configIO
.
IO_IP
+
"] ["
+
configIO
.
GetIOAddr
()
+
"] 获取数据出错:"
,
ex
);
LogUtil
.
error
(
LOGGER
,
" GetIOValue ["
+
configIO
.
IO_IP
+
"] ["
+
configIO
.
GetIOAddr
()
+
"] 获取数据出错:"
,
ex
);
}
}
return
value
;
return
value
;
}
}
private
Box_Sta
GetBox_Sta
(
IO_VALUE
onOff
)
private
Box_Sta
GetBox_Sta
(
IO_VALUE
onOff
)
{
{
if
(
onOff
.
Equals
(
IO_VALUE
.
HIGH
))
if
(
onOff
.
Equals
(
IO_VALUE
.
HIGH
))
...
...
source/DeviceLibrary/server/LineServer.cs
查看文件 @
74efec2
...
@@ -161,7 +161,7 @@ namespace OnlineStore.DeviceLibrary
...
@@ -161,7 +161,7 @@ namespace OnlineStore.DeviceLibrary
{
{
IdList
.
Add
(
i
);
IdList
.
Add
(
i
);
}
}
for
(
int
i
=
1
;
i
<=
1
1
;
i
++)
for
(
int
i
=
1
;
i
<=
1
0
;
i
++)
{
{
IdList
.
Add
(
i
);
IdList
.
Add
(
i
);
}
}
...
...
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论