Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
孙克
/
RC1250-ACPackingStore
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit 4dfa6eca
由
LN
编写于
2019-12-18 11:57:38 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
1
1 个父辈
7f566ced
隐藏空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
116 行增加
和
137 行删除
source/DeviceLibrary/StoreConfig/shelfPosition.csv
source/DeviceLibrary/device/IO/AIOBOX/AIOBOXManager.cs
source/DeviceLibrary/device/IO/IOManager.cs
source/DeviceLibrary/device/IO/KangNaiDe/KNDManager.cs
source/DeviceLibrary/StoreConfig/shelfPosition.csv
查看文件 @
4dfa6ec
位置,优先级,高度,宽度,料仓ID,旋转轴位置P101,升降轴低点P101,升降轴高点P102,进出轴位置P101
位置,优先级,高度,宽度,料仓ID,旋转轴位置P101,升降轴低点P101,升降轴高点P102,进出轴位置P101
1#S_1_4,1,8,7,1,211783,51884,55245,81000
1#S_1_1,1,8,7,1,211783,51884,55245,81000
1#S_1_5,2,8,7,1,211783,67807,71168,81000
1#S_1_2,2,8,7,1,211783,67807,71168,81000
1#S_1_6,3,8,7,1,211783,83730,87091,81000
1#S_1_3,3,8,7,1,211783,83730,87091,81000
1#S_1_7,4,8,7,1,211783,99653,103014,81000
1#S_1_4,4,8,7,1,211783,99653,103014,81000
1#S_1_8,5,8,7,1,211783,115576,118937,81000
1#S_1_5,5,8,7,1,211783,115576,118937,81000
1#S_1_9,6,8,7,1,211783,131499,134860,81000
1#S_1_6,6,8,7,1,211783,131499,134860,81000
1#S_1_10,7,8,7,1,211783,147422,150783,81000
1#S_1_7,7,8,7,1,211783,147422,150783,81000
1#S_1_11,8,8,7,1,211783,163345,166706,81000
1#S_1_8,8,8,7,1,211783,163345,166706,81000
1#S_1_12,9,8,7,1,211783,179268,182629,81000
1#S_1_9,9,8,7,1,211783,179268,182629,81000
1#S_1_13,10,8,7,1,211783,195191,198552,81000
1#S_1_14,11,8,7,1,211783,211114,214475,81000
1#S_1_15,12,8,7,1,211783,227037,230398,81000
1#S_1_16,13,8,7,1,211783,242960,246321,81000
1#S_1_17,14,8,7,1,211783,258883,262244,81000
1#S_1_18,15,8,7,1,211783,274806,278167,81000
1#S_1_19,16,8,7,1,211783,289000,294090,81000
1#S_1_20,17,8,7,1,211783,304652,310013,81000
1#S_1_21,18,8,7,1,211783,320575,325936,81000
1#S_1_22,19,8,7,1,211783,336498,341859,81000
1#S_2_3,20,8,7,1,211783,385700,389433,81000
1#S_2_4,21,8,7,1,211783,403000,405356,81000
1#S_2_5,22,8,7,1,211783,418345,421279,81000
1#S_2_6,23,8,7,1,211783,434000,437202,81000
1#S_2_7,24,8,7,1,211783,450000,453125,81000
1#S_2_8,25,8,7,1,211783,465900,469048,81000
1#S_2_9,26,8,7,1,211783,481800,484971,81000
1#S_2_10,27,8,7,1,211783,497660,500894,81000
1#S_2_11,28,8,7,1,211783,513600,516817,81000
1#S_2_12,29,8,7,1,211783,529200,532740,81000
1#S_2_13,30,8,7,1,211783,545100,548663,81000
1#S_2_14,31,8,7,1,211783,560500,564586,81000
1#S_2_15,32,8,7,1,211783,575500,580509,81000
1#S_2_16,33,8,7,1,211783,591500,596432,81000
1#S_2_17,34,8,7,1,211783,606000,612355,81000
1#S_2_18,35,8,7,1,211783,621000,628278,81000
,,,,,,,,
2#S_1_4,1,8,7,2,211783,51884,55245,81000
2#S_1_5,2,8,7,2,211783,67807,71168,81000
2#S_1_6,3,8,7,2,211783,83730,87091,81000
2#S_1_7,4,8,7,2,211783,99653,103014,81000
2#S_1_8,5,8,7,2,211783,115576,118937,81000
2#S_1_9,6,8,7,2,211783,131499,134860,81000
2#S_1_10,7,8,7,2,211783,147422,150783,81000
2#S_1_11,8,8,7,2,211783,163345,166706,81000
2#S_1_12,9,8,7,2,211783,179268,182629,81000
2#S_1_13,10,8,7,2,211783,195191,198552,81000
2#S_1_14,11,8,7,2,211783,211114,214475,81000
2#S_1_15,12,8,7,2,211783,227037,230398,81000
2#S_1_16,13,8,7,2,211783,242960,246321,81000
2#S_1_17,14,8,7,2,211783,258883,262244,81000
2#S_1_18,15,8,7,2,211783,274806,278167,81000
2#S_1_19,16,8,7,2,211783,289000,294090,81000
2#S_1_20,17,8,7,2,211783,304652,310013,81000
2#S_1_21,18,8,7,2,211783,320575,325936,81000
2#S_1_22,19,8,7,2,211783,336498,341859,81000
2#S_2_3,20,8,7,2,211783,385700,389433,81000
2#S_2_4,21,8,7,2,211783,403000,405356,81000
2#S_2_5,22,8,7,2,211783,418345,421279,81000
2#S_2_6,23,8,7,2,211783,434000,437202,81000
2#S_2_7,24,8,7,2,211783,450000,453125,81000
2#S_2_8,25,8,7,2,211783,465900,469048,81000
2#S_2_9,26,8,7,2,211783,481800,484971,81000
2#S_2_10,27,8,7,2,211783,497660,500894,81000
2#S_2_11,28,8,7,2,211783,513600,516817,81000
2#S_2_12,29,8,7,2,211783,529200,532740,81000
2#S_2_13,30,8,7,2,211783,545100,548663,81000
2#S_2_14,31,8,7,2,211783,560500,564586,81000
2#S_2_15,32,8,7,2,211783,575500,580509,81000
2#S_2_16,33,8,7,2,211783,591500,596432,81000
2#S_2_17,34,8,7,2,211783,606000,612355,81000
2#S_2_18,35,8,7,2,211783,621000,628278,81000
source/DeviceLibrary/device/IO/AIOBOX/AIOBOXManager.cs
查看文件 @
4dfa6ec
...
@@ -33,15 +33,17 @@ namespace OnlineStore.DeviceLibrary
...
@@ -33,15 +33,17 @@ namespace OnlineStore.DeviceLibrary
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
=
6
0000
;
conTimer
.
Interval
=
1
0000
;
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
;
foreach
(
string
ip
in
DIONameList
)
foreach
(
string
ip
in
DIONameList
)
{
{
ConnectionIP
(
ip
);
ConnectionIP
(
ip
);
...
@@ -52,38 +54,75 @@ namespace OnlineStore.DeviceLibrary
...
@@ -52,38 +54,75 @@ namespace OnlineStore.DeviceLibrary
conTimer
.
Start
();
conTimer
.
Start
();
}
}
}
}
private
bool
isProcess
=
false
;
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
;
if
(
span
.
TotalMinutes
<
IoIPLIst
.
Count
&&
isProcess
)
{
return
;
}
isProcess
=
true
;
lastTime
=
DateTime
.
Now
;
try
{
//判断是否还在连接
foreach
(
AIOBOX
box
in
AIOMap
.
Values
)
{
if
(!
box
.
IsConn
)
{
if
(
IoIPLIst
.
Contains
(
box
.
IP
).
Equals
(
false
))
{
LogUtil
.
info
(
"IO模块【"
+
box
.
IP
+
"】已断开,加入集合等待重连"
);
IoIPLIst
.
Add
(
box
.
IP
);
}
}
}
}
catch
(
Exception
ex
)
{
LogUtil
.
error
(
"AOI 判断是否需要重连 出错"
+
ex
.
ToString
());
}
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模块 ------------"
);
conCount
=
1
;
foreach
(
string
ip
in
list
)
foreach
(
string
ip
in
list
)
{
{
LogUtil
.
info
(
"重连AOI :"
+
ip
);
ConnectionIP
(
ip
);
ConnectionIP
(
ip
);
}
}
LogUtil
.
info
(
"结束重连IO模块 ------------"
);
}
}
GC
.
Collect
();
}
}
catch
(
Exception
ex
)
catch
(
Exception
ex
)
{
{
LogUtil
.
error
(
"AOI ConTimer_Elapsed 出错: "
+
ex
.
ToString
());
LogUtil
.
error
(
"AOI ConTimer_Elapsed 出错: "
+
ex
.
ToString
());
}
}
isProcess
=
false
;
}
}
private
int
conCount
=
3
;
public
void
ConnectionIP
(
string
ioIp
)
public
void
ConnectionIP
(
string
ioIp
)
{
{
AIOBOX
aioBox
=
null
;
AIOBOX
aioBox
=
null
;
if
(
AIOMap
.
ContainsKey
(
ioIp
))
if
(
AIOMap
.
ContainsKey
(
ioIp
))
{
{
aioBox
=
AIOMap
[
ioIp
];
aioBox
=
AIOMap
[
ioIp
];
try
if
(
null
!=
aioBox
)
{
{
aioBox
.
Close
();
if
(
null
!=
aioBox
)
aioBox
=
null
;
{
aioBox
.
Close
();
aioBox
=
null
;
}
}
catch
(
Exception
ex
)
{
LogUtil
.
error
(
"关闭Io模块【"
+
ioIp
+
"】出错:"
+
ex
);
}
}
AIOMap
.
Remove
(
ioIp
);
AIOMap
.
Remove
(
ioIp
);
}
}
...
@@ -112,6 +151,7 @@ namespace OnlineStore.DeviceLibrary
...
@@ -112,6 +151,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\");
aioBox
.
IP
=
ioIp
;
aioBox
.
IP
=
ioIp
;
// bool rtn = aioBox.AutoIP(ioIp);
// bool rtn = aioBox.AutoIP(ioIp);
...
@@ -119,36 +159,39 @@ namespace OnlineStore.DeviceLibrary
...
@@ -119,36 +159,39 @@ namespace OnlineStore.DeviceLibrary
aioBox
.
SetInput
(
Asa
.
IOModule
.
Box_Type
.
DI
,
DILength
);
aioBox
.
SetInput
(
Asa
.
IOModule
.
Box_Type
.
DI
,
DILength
);
aioBox
.
SetOutput
(
Asa
.
IOModule
.
Box_Type
.
DO
,
DOLength
);
aioBox
.
SetOutput
(
Asa
.
IOModule
.
Box_Type
.
DO
,
DOLength
);
//DI主动上传
//DI主动上传
aioBox
.
AutoReadInput
(
true
);
aioBox
.
AutoReadInput
(
true
,
DIMS
);
aioBox
.
AutoReadOutput
(
true
,
DOMS
);
aioBox
.
AutoReadOutput
(
false
,
DOMS
);
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;
AIOMap
.
Add
(
ioIp
,
aioBox
);
LogUtil
.
debug
(
"开始连接"
+
logName
+
",尝试重连5次"
);
for
(
int
i
=
1
;
i
<=
3
;
i
++)
LogUtil
.
debug
(
"开始连接"
+
logName
+
",尝试重连3次"
);
for
(
int
i
=
1
;
i
<=
conCount
;
i
++)
{
{
bool
result
=
aioBox
.
Connect
();
bool
result
=
aioBox
.
Connect
();
if
(
result
)
if
(
result
)
{
{
LogUtil
.
info
(
"第【"
+
i
+
"】次连接 "
+
logName
+
" 成功:"
+
aioBox
.
ErrInfo
);
LogUtil
.
info
(
"第【"
+
i
+
"】次连接 "
+
logName
+
" 成功:"
+
aioBox
.
ErrInfo
);
Thread
.
Sleep
(
10
);
//读取所有的DO
ReadAllDI
(
ioIp
,
0
);
if
(
IoIPLIst
.
Contains
(
ioIp
))
if
(
IoIPLIst
.
Contains
(
ioIp
))
{
{
IoIPLIst
.
Remove
(
ioIp
);
IoIPLIst
.
Remove
(
ioIp
);
}
}
AIOMap
.
Add
(
ioIp
,
aioBox
);
Thread
.
Sleep
(
10
);
//读取所有的DO
ReadAllDI
(
ioIp
,
0
);
break
;
break
;
}
}
else
else
{
{
LogUtil
.
error
(
"第【"
+
i
+
"】次连接 "
+
logName
+
" 失败:"
+
aioBox
.
ErrInfo
+
""
);
LogUtil
.
error
(
"第【"
+
i
+
"】次连接 "
+
logName
+
" 失败:"
+
aioBox
.
ErrInfo
+
""
);
}
}
Thread
.
Sleep
(
2
);
Thread
.
Sleep
(
5
);
GC
.
Collect
();
}
}
}
}
...
@@ -177,7 +220,7 @@ namespace OnlineStore.DeviceLibrary
...
@@ -177,7 +220,7 @@ namespace OnlineStore.DeviceLibrary
{
{
foreach
(
string
str
in
s
)
foreach
(
string
str
in
s
)
{
{
//
LogUtil.AIOLog.Debug("[" + box.IP + "]" + str);
LogUtil
.
AIOLog
.
Debug
(
"["
+
box
.
IP
+
"]"
+
str
);
}
}
}
}
...
@@ -294,17 +337,6 @@ namespace OnlineStore.DeviceLibrary
...
@@ -294,17 +337,6 @@ namespace OnlineStore.DeviceLibrary
}
}
}
}
}
}
//else
//{
// if (sta == null)
// {
// LogUtil.error("UpdateAllDO ip[" + ip + "], sta=null");
// }
// else
// {
// LogUtil.error(" UpdateAllDO ip[" + ip + "], sta.Length=" + sta.Length);
// }
//}
}
}
...
@@ -317,9 +349,6 @@ namespace OnlineStore.DeviceLibrary
...
@@ -317,9 +349,6 @@ namespace OnlineStore.DeviceLibrary
ushort
length
=
StoreManager
.
Config
.
GetDOLength
(
aio
.
IP
);
ushort
length
=
StoreManager
.
Config
.
GetDOLength
(
aio
.
IP
);
for
(
ushort
i
=
0
;
i
<
length
;
i
++)
for
(
ushort
i
=
0
;
i
<
length
;
i
++)
{
{
// ushort u = (ushort)(i + length);
// ushort u = (ushort)(i );
// Box_Addr addr = GetAddr(u);
aio
.
WriteDO
(
i
,
Box_Sta
.
Off
);
aio
.
WriteDO
(
i
,
Box_Sta
.
Off
);
}
}
}
}
...
@@ -329,7 +358,14 @@ namespace OnlineStore.DeviceLibrary
...
@@ -329,7 +358,14 @@ namespace OnlineStore.DeviceLibrary
{
{
foreach
(
AIOBOX
aio
in
AIOMap
.
Values
)
foreach
(
AIOBOX
aio
in
AIOMap
.
Values
)
{
{
aio
.
Close
();
try
{
aio
.
Close
();
}
catch
(
Exception
ex
)
{
LogUtil
.
error
(
"aio.Close出错:"
+
ex
.
ToString
());
}
}
}
AIOMap
.
Clear
();
AIOMap
.
Clear
();
}
}
...
@@ -343,18 +379,18 @@ namespace OnlineStore.DeviceLibrary
...
@@ -343,18 +379,18 @@ namespace OnlineStore.DeviceLibrary
{
{
// Box_Addr add = GetAddr(StartAddress);
// Box_Addr add = GetAddr(StartAddress);
for
(
int
i
=
1
;
i
<=
3
;
i
++)
// for (int i = 1; i <= 3; i++)
//{
bool
result
=
aioBox
.
WriteDO
(
StartAddress
,
GetBox_Sta
(
onOff
));
if
(!
result
)
{
{
bool
result
=
aioBox
.
WriteDO
(
StartAddress
,
GetBox_Sta
(
onOff
));
LogUtil
.
error
(
"AIO WriteSingleDO ["
+
ioIp
+
"] ["
+
StartAddress
+
"] 失败:"
+
aioBox
.
ErrInfo
);
if
(!
result
)
{
LogUtil
.
error
(
"AIO WriteSingleDO ["
+
StartAddress
+
"] 第"
+
i
+
"次失败:"
+
aioBox
.
ErrInfo
);
}
else
{
break
;
}
}
}
// else
// {
// break;
// }
//}
}
}
else
else
{
{
...
@@ -363,19 +399,17 @@ namespace OnlineStore.DeviceLibrary
...
@@ -363,19 +399,17 @@ namespace OnlineStore.DeviceLibrary
}
}
catch
(
Exception
ex
)
catch
(
Exception
ex
)
{
{
LOGGER
.
Error
(
"出错啦:"
+
ex
.
ToString
());
LOGGER
.
Error
(
"
AIO WriteSingleDO ["
+
ioIp
+
"] ["
+
StartAddress
+
"]
出错啦:"
+
ex
.
ToString
());
}
}
}
}
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
);
Box_Sta
currBox_Sta
=
GetBox_Sta
(
onOff
);
if
(
aioBox
!=
null
)
if
(
aioBox
!=
null
)
{
{
// Box_Addr add = GetAddr(StartAddress
);
Box_Sta
currBox_Sta
=
GetBox_Sta
(
onOff
);
aioBox
.
WriteDO
(
StartAddress
,
currBox_Sta
);
aioBox
.
WriteDO
(
StartAddress
,
currBox_Sta
);
//写入之后,等待指定间隔后回写
//写入之后,等待指定间隔后回写
...
@@ -385,7 +419,7 @@ namespace OnlineStore.DeviceLibrary
...
@@ -385,7 +419,7 @@ namespace OnlineStore.DeviceLibrary
try
try
{
{
aioBox
.
WriteDO
(
StartAddress
,
aioBox
.
ReverseStatus
(
currBox_Sta
));
aioBox
.
WriteDO
(
StartAddress
,
aioBox
.
ReverseStatus
(
currBox_Sta
));
LogUtil
.
debug
(
LOGGER
,
"**********定时回写入 IO
【"
+
ioIp
+
","
+
StartAddress
+
",
值"
+
aioBox
.
ReverseStatus
(
currBox_Sta
)
+
"】:"
);
LogUtil
.
debug
(
LOGGER
,
"**********定时回写入 IO
["
+
ioIp
+
"] ["
+
StartAddress
+
"]
值"
+
aioBox
.
ReverseStatus
(
currBox_Sta
)
+
"】:"
);
}
}
catch
(
Exception
ex
)
catch
(
Exception
ex
)
{
{
...
@@ -394,15 +428,16 @@ namespace OnlineStore.DeviceLibrary
...
@@ -394,15 +428,16 @@ namespace OnlineStore.DeviceLibrary
};
};
mytimer
.
AutoReset
=
false
;
//设置是否自动重启,即自动执行多次;
mytimer
.
AutoReset
=
false
;
//设置是否自动重启,即自动执行多次;
mytimer
.
Enabled
=
true
;
//是否执行System.Timers.Timer.Elapsed事件mytask;
mytimer
.
Enabled
=
true
;
//是否执行System.Timers.Timer.Elapsed事件mytask;
}
}
else
else
{
{
LogUtil
.
error
(
LOGGER
,
"
WriteSingleDO
出错 没有连接IO模块:"
+
ioIp
);
LogUtil
.
error
(
LOGGER
,
"
AIO WriteSingleDO ["
+
ioIp
+
"] ["
+
StartAddress
+
"]
出错 没有连接IO模块:"
+
ioIp
);
}
}
}
}
catch
(
Exception
ex
)
catch
(
Exception
ex
)
{
{
LogUtil
.
error
(
"
WriteSingleDO
出错:"
+
ioIp
);
LogUtil
.
error
(
"
AIO WriteSingleDO ["
+
ioIp
+
"] ["
+
StartAddress
+
"]
出错:"
+
ioIp
);
}
}
}
}
public
override
void
ReadAllDI
(
string
ioIp
,
byte
slaveId
)
public
override
void
ReadAllDI
(
string
ioIp
,
byte
slaveId
)
...
@@ -418,7 +453,7 @@ namespace OnlineStore.DeviceLibrary
...
@@ -418,7 +453,7 @@ namespace OnlineStore.DeviceLibrary
}
}
catch
(
Exception
ex
)
catch
(
Exception
ex
)
{
{
LogUtil
.
error
(
"ReadAllDI出错:"
+
ioIp
);
LogUtil
.
error
(
"ReadAllDI
["
+
ioIp
+
"]
出错:"
+
ioIp
);
}
}
}
}
public
override
void
ReadAllDO
(
string
ioIp
,
byte
slaveId
)
public
override
void
ReadAllDO
(
string
ioIp
,
byte
slaveId
)
...
@@ -435,7 +470,7 @@ namespace OnlineStore.DeviceLibrary
...
@@ -435,7 +470,7 @@ namespace OnlineStore.DeviceLibrary
}
}
catch
(
Exception
ex
)
catch
(
Exception
ex
)
{
{
LogUtil
.
error
(
"ReadAllDO出错:"
+
ioIp
);
LogUtil
.
error
(
"ReadAllDO
["
+
ioIp
+
"]
出错:"
+
ioIp
);
}
}
}
}
public
override
IO_VALUE
GetDOValue
(
string
ioIP
,
byte
slaveId
,
ushort
StartAddress
)
public
override
IO_VALUE
GetDOValue
(
string
ioIP
,
byte
slaveId
,
ushort
StartAddress
)
...
@@ -447,9 +482,6 @@ namespace OnlineStore.DeviceLibrary
...
@@ -447,9 +482,6 @@ namespace OnlineStore.DeviceLibrary
if
(
aioBox
!=
null
)
if
(
aioBox
!=
null
)
{
{
Box_Sta
sta
=
Box_Sta
.
Off
;
Box_Sta
sta
=
Box_Sta
.
Off
;
// Box_Addr addr = GetAddr(StartAddress);
// int index = (int)StartAddress - (int)StoreManager.Config.GetDILength(ioIP);
if
(
DOValueMap
.
ContainsKey
(
ioIP
)
&&
DOValueMap
[
ioIP
].
Count
>
StartAddress
)
if
(
DOValueMap
.
ContainsKey
(
ioIP
)
&&
DOValueMap
[
ioIP
].
Count
>
StartAddress
)
{
{
sta
=
DOValueMap
[
ioIP
][
StartAddress
];
sta
=
DOValueMap
[
ioIP
][
StartAddress
];
...
@@ -464,7 +496,7 @@ namespace OnlineStore.DeviceLibrary
...
@@ -464,7 +496,7 @@ namespace OnlineStore.DeviceLibrary
}
}
catch
(
Exception
ex
)
catch
(
Exception
ex
)
{
{
LogUtil
.
error
(
"GetDOValue 出错:"
+
ex
.
ToString
());
LogUtil
.
error
(
"GetDOValue
["
+
ioIP
+
"] ["
+
StartAddress
+
"]
出错:"
+
ex
.
ToString
());
}
}
return
value
;
return
value
;
}
}
...
@@ -496,7 +528,7 @@ namespace OnlineStore.DeviceLibrary
...
@@ -496,7 +528,7 @@ namespace OnlineStore.DeviceLibrary
}
}
catch
(
Exception
ex
)
catch
(
Exception
ex
)
{
{
LogUtil
.
error
(
"GetDIValue 出错:"
+
ex
.
ToString
());
LogUtil
.
error
(
"GetDIValue
["
+
ioIP
+
"] ["
+
StartAddress
+
"]
出错:"
+
ex
.
ToString
());
}
}
return
value
;
return
value
;
}
}
...
@@ -507,24 +539,20 @@ namespace OnlineStore.DeviceLibrary
...
@@ -507,24 +539,20 @@ namespace OnlineStore.DeviceLibrary
{
{
if
(
configIO
.
ProType
.
Equals
(
ConfigItemType
.
DI
))
if
(
configIO
.
ProType
.
Equals
(
ConfigItemType
.
DI
))
{
{
return
GetDIValue
(
configIO
.
DeviceName
,
configIO
.
SlaveID
,
configIO
.
GetIOAddr
());
return
GetDIValue
(
configIO
.
IO_IP
,
configIO
.
SlaveID
,
configIO
.
GetIOAddr
());
}
}
else
if
(
configIO
.
ProType
.
Equals
(
ConfigItemType
.
DO
))
else
if
(
configIO
.
ProType
.
Equals
(
ConfigItemType
.
DO
))
{
{
return
GetDOValue
(
configIO
.
DeviceName
,
configIO
.
SlaveID
,
configIO
.
GetIOAddr
());
return
GetDOValue
(
configIO
.
IO_IP
,
configIO
.
SlaveID
,
configIO
.
GetIOAddr
());
}
}
}
}
catch
(
Exception
ex
)
catch
(
Exception
ex
)
{
{
LogUtil
.
error
(
LOGGER
,
" GetIOValue 获取数据出错:"
+
ex
.
ToString
());
LogUtil
.
error
(
LOGGER
,
" GetIOValue
["
+
configIO
.
IO_IP
+
"] ["
+
configIO
.
GetIOAddr
()
+
"]
获取数据出错:"
+
ex
.
ToString
());
}
}
return
value
;
return
value
;
}
}
//private Box_Addr GetAddr(ushort StartAddress)
//{
// return (Box_Addr)(StartAddress);
//}
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
))
...
@@ -546,5 +574,18 @@ namespace OnlineStore.DeviceLibrary
...
@@ -546,5 +574,18 @@ namespace OnlineStore.DeviceLibrary
}
}
return
aioBox
;
return
aioBox
;
}
}
public
override
bool
IsConnect
(
string
ip
)
{
if
(
AIOMap
.
ContainsKey
(
ip
))
{
if
(
AIOMap
[
ip
].
IsConn
)
{
return
true
;
}
return
false
;
}
return
false
;
}
}
}
}
}
source/DeviceLibrary/device/IO/IOManager.cs
查看文件 @
4dfa6ec
...
@@ -176,6 +176,6 @@ namespace OnlineStore.DeviceLibrary
...
@@ -176,6 +176,6 @@ namespace OnlineStore.DeviceLibrary
public
abstract
void
CloseAllDO
();
public
abstract
void
CloseAllDO
();
public
abstract
void
CloseAllConnection
();
public
abstract
void
CloseAllConnection
();
public
abstract
bool
IsConnect
(
string
ip
);
}
}
}
}
source/DeviceLibrary/device/IO/KangNaiDe/KNDManager.cs
查看文件 @
4dfa6ec
...
@@ -101,7 +101,7 @@ namespace OnlineStore.DeviceLibrary
...
@@ -101,7 +101,7 @@ namespace OnlineStore.DeviceLibrary
/// <summary>
/// <summary>
/// 判断Io模块是否连接
/// 判断Io模块是否连接
/// </summary>
/// </summary>
public
static
bool
IsConnection
(
string
ip
)
public
override
bool
IsConnect
(
string
ip
)
{
{
try
try
{
{
...
...
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论