Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
刘韬
/
SO815-AutoInOutStore
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
图表
网络
创建新的问题
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit 16cc676d
由
几米阳光
编写于
2018-12-10 14:43:14 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
1
1 个父辈
b93747cb
全部展开
显示空白字符变更
内嵌
并排
正在显示
7 个修改的文件
包含
35 行增加
和
34 行删除
doc/设备IP地址分配.xlsx
source/ACSingleStore/FrmAxisDebug.cs
source/ACSingleStore/FrmIOStatus.Designer.cs
source/ACSingleStore/FrmStoreBox.cs
source/DeviceLibrary/KangNaiDe/MasterTcpClient.cs
source/DeviceLibrary/StoreConfig/AC/StoreConfig.csv
source/LoadCVSLibrary/storeConfig/config/StoreConfig.cs
doc/设备IP地址分配.xlsx
查看文件 @
16cc676
此文件类型无法预览
source/ACSingleStore/FrmAxisDebug.cs
查看文件 @
16cc676
...
@@ -345,10 +345,10 @@ namespace OnlineStore.AutoInOutStore
...
@@ -345,10 +345,10 @@ namespace OnlineStore.AutoInOutStore
}
}
private
void
UpdateAutoPosition
()
private
void
UpdateAutoPosition
()
{
{
int
inoutPosition
=
ACServerManager
.
GetTargetPosition
(
inout
.
DeviceName
,
inout
.
GetAxisValue
());
int
autoPosition
=
ACServerManager
.
GetTargetPosition
(
auto
.
DeviceName
,
auto
.
GetAxisValue
());
if
(!
txt
InOutPosition
.
Text
.
Equals
(
inout
Position
.
ToString
()))
if
(!
txt
AutoPosition
.
Text
.
Equals
(
auto
Position
.
ToString
()))
{
{
txt
InOutPosition
.
Text
=
inout
Position
.
ToString
();
txt
AutoPosition
.
Text
=
auto
Position
.
ToString
();
}
}
}
}
private
void
btnAutoMove_MouseDown
(
object
sender
,
MouseEventArgs
e
)
private
void
btnAutoMove_MouseDown
(
object
sender
,
MouseEventArgs
e
)
...
...
source/ACSingleStore/FrmIOStatus.Designer.cs
查看文件 @
16cc676
此文件的差异被折叠,
点击展开。
source/ACSingleStore/FrmStoreBox.cs
查看文件 @
16cc676
...
@@ -334,7 +334,7 @@ namespace OnlineStore.AutoInOutStore
...
@@ -334,7 +334,7 @@ namespace OnlineStore.AutoInOutStore
btnBatchInStore
.
Enabled
=
!
dooIsOpen
;
btnBatchInStore
.
Enabled
=
!
dooIsOpen
;
btnGetOutTray
.
Enabled
=
!
dooIsOpen
;
btnGetOutTray
.
Enabled
=
!
dooIsOpen
;
btnStartBatchInStore
.
Enabled
=
dooIsOpen
;
btnStartBatchInStore
.
Enabled
=
dooIsOpen
;
btnBatchReset
.
Enabled
=
dooIsOpen
;
btnBatchReset
.
Enabled
=
!
dooIsOpen
;
}
}
private
void
ReadPosistion
()
private
void
ReadPosistion
()
...
...
source/DeviceLibrary/KangNaiDe/MasterTcpClient.cs
查看文件 @
16cc676
...
@@ -70,7 +70,7 @@ namespace OnlineStore.DeviceLibrary
...
@@ -70,7 +70,7 @@ namespace OnlineStore.DeviceLibrary
// ------------------------------------------------------------------------
// ------------------------------------------------------------------------
/// <summary>Response data event. This event is called when new data arrives</summary>
/// <summary>Response data event. This event is called when new data arrives</summary>
public
delegate
void
ResponseData
(
string
ip
,
ushort
id
,
byte
function
,
byte
[]
data
,
byte
[]
reviceData
);
public
delegate
void
ResponseData
(
string
ip
,
ushort
id
,
byte
function
,
byte
[]
data
,
byte
[]
reviceData
);
/// <summary>Response data event. This event is called when new data arrives</summary>
/// <summary>Response data event. This event is called when new data arrives</summary>
public
event
ResponseData
OnResponseData
;
public
event
ResponseData
OnResponseData
;
/// <summary>Exception data event. This event is called when the data is incorrect</summary>
/// <summary>Exception data event. This event is called when the data is incorrect</summary>
...
@@ -106,11 +106,10 @@ namespace OnlineStore.DeviceLibrary
...
@@ -106,11 +106,10 @@ namespace OnlineStore.DeviceLibrary
public
MasterTcpClient
()
public
MasterTcpClient
()
{
{
}
}
private
string
IP
=
""
;
public
int
TimeOutTime
=
0
;
public
int
TimeOutTime
=
0
;
public
MasterTcpClient
(
string
ip
,
ushort
port
)
public
MasterTcpClient
(
string
ip
,
ushort
port
)
{
{
this
.
IP
=
ip
;
TimeOutTime
=
2000
;
TimeOutTime
=
2000
;
connect
(
ip
,
port
);
connect
(
ip
,
port
);
}
}
...
@@ -119,6 +118,7 @@ namespace OnlineStore.DeviceLibrary
...
@@ -119,6 +118,7 @@ namespace OnlineStore.DeviceLibrary
{
{
try
try
{
{
OnResponseData
=
null
;
// Connect asynchronous client
// Connect asynchronous client
socketClient
=
new
Socket
(
IPAddress
.
Parse
(
ip
).
AddressFamily
,
SocketType
.
Stream
,
ProtocolType
.
Tcp
);
socketClient
=
new
Socket
(
IPAddress
.
Parse
(
ip
).
AddressFamily
,
SocketType
.
Stream
,
ProtocolType
.
Tcp
);
if
(
TimeOutTime
<=
0
)
if
(
TimeOutTime
<=
0
)
...
@@ -127,6 +127,7 @@ namespace OnlineStore.DeviceLibrary
...
@@ -127,6 +127,7 @@ namespace OnlineStore.DeviceLibrary
socketClient
.
SetSocketOption
(
SocketOptionLevel
.
Socket
,
SocketOptionName
.
SendTimeout
,
_timeout
);
socketClient
.
SetSocketOption
(
SocketOptionLevel
.
Socket
,
SocketOptionName
.
SendTimeout
,
_timeout
);
socketClient
.
SetSocketOption
(
SocketOptionLevel
.
Socket
,
SocketOptionName
.
ReceiveTimeout
,
_timeout
);
socketClient
.
SetSocketOption
(
SocketOptionLevel
.
Socket
,
SocketOptionName
.
ReceiveTimeout
,
_timeout
);
socketClient
.
SetSocketOption
(
SocketOptionLevel
.
Socket
,
SocketOptionName
.
NoDelay
,
1
);
socketClient
.
SetSocketOption
(
SocketOptionLevel
.
Socket
,
SocketOptionName
.
NoDelay
,
1
);
}
}
else
else
{
{
...
@@ -153,11 +154,10 @@ namespace OnlineStore.DeviceLibrary
...
@@ -153,11 +154,10 @@ namespace OnlineStore.DeviceLibrary
reviceTimer
.
Enabled
=
true
;
reviceTimer
.
Enabled
=
true
;
_connected
=
true
;
_connected
=
true
;
}
}
catch
(
System
.
IO
.
IO
Exception
error
)
catch
(
Exception
error
)
{
{
LogUtil
.
info
(
LOGGER
,
"Connect to "
+
ip
+
":"
+
port
+
" fail!"
);
LogUtil
.
info
(
LOGGER
,
"Connect to "
+
ip
+
":"
+
port
+
" fail!"
);
_connected
=
false
;
_connected
=
false
;
throw
(
error
);
}
}
}
}
...
@@ -171,7 +171,7 @@ namespace OnlineStore.DeviceLibrary
...
@@ -171,7 +171,7 @@ namespace OnlineStore.DeviceLibrary
}
}
catch
(
Exception
ex
)
catch
(
Exception
ex
)
{
{
LOGGER
.
Error
(
"
IO模块["
+
IP
+
"]
出错:"
+
ex
.
ToString
());
LOGGER
.
Error
(
"出错:"
+
ex
.
ToString
());
}
}
}
}
...
@@ -214,7 +214,7 @@ namespace OnlineStore.DeviceLibrary
...
@@ -214,7 +214,7 @@ namespace OnlineStore.DeviceLibrary
}
}
dataLength
=
rdata
[
currStartIndex
+
lengthIndex
];
dataLength
=
rdata
[
currStartIndex
+
lengthIndex
];
allLength
=
lengthIndex
+
1
+
dataLength
;
allLength
=
lengthIndex
+
1
+
dataLength
;
byte
[]
thisData
=
new
byte
[
allLength
];
byte
[]
thisData
=
new
byte
[
allLength
];
Array
.
Copy
(
rdata
,
currStartIndex
,
thisData
,
0
,
allLength
);
Array
.
Copy
(
rdata
,
currStartIndex
,
thisData
,
0
,
allLength
);
...
@@ -241,7 +241,7 @@ namespace OnlineStore.DeviceLibrary
...
@@ -241,7 +241,7 @@ namespace OnlineStore.DeviceLibrary
LogUtil
.
debug
(
LOGGER
,
clientipe
.
ToString
()
+
"收到数据(无需分包):"
+
str
);
LogUtil
.
debug
(
LOGGER
,
clientipe
.
ToString
()
+
"收到数据(无需分包):"
+
str
);
ushort
id
=
BitConverter
.
ToUInt16
(
rdata
,
0
);
ushort
id
=
BitConverter
.
ToUInt16
(
rdata
,
0
);
byte
function
=
rdata
[
7
];
byte
function
=
rdata
[
7
];
DataProcess
(
clientipe
.
ToString
(),
id
,
function
,
rdata
);
DataProcess
(
clientipe
.
ToString
(),
id
,
function
,
rdata
);
}
}
}
}
}
}
...
@@ -295,7 +295,6 @@ namespace OnlineStore.DeviceLibrary
...
@@ -295,7 +295,6 @@ namespace OnlineStore.DeviceLibrary
}
}
catch
(
SocketException
e
)
catch
(
SocketException
e
)
{
{
LogUtil
.
error
(
LOGGER
,
"IO模块["
+
IP
+
"]接收数据出现错误:"
+
e
.
ToString
());
if
(
socketClient
!=
null
)
if
(
socketClient
!=
null
)
{
{
socketClient
.
Close
();
socketClient
.
Close
();
...
@@ -329,14 +328,8 @@ namespace OnlineStore.DeviceLibrary
...
@@ -329,14 +328,8 @@ namespace OnlineStore.DeviceLibrary
{
{
if
(
socketClient
.
Connected
)
if
(
socketClient
.
Connected
)
{
{
try
try
{
socketClient
.
Shutdown
(
SocketShutdown
.
Both
);
}
{
catch
{
}
socketClient
.
Shutdown
(
SocketShutdown
.
Both
);
}
catch
(
Exception
ex
)
{
LogUtil
.
error
(
LOGGER
,
"IO模块["
+
IP
+
"]dispose出错:"
+
ex
.
ToString
());
}
socketClient
.
Close
();
socketClient
.
Close
();
}
}
socketClient
=
null
;
socketClient
=
null
;
...
@@ -511,7 +504,9 @@ namespace OnlineStore.DeviceLibrary
...
@@ -511,7 +504,9 @@ namespace OnlineStore.DeviceLibrary
// ------------------------------------------------------------------------
// ------------------------------------------------------------------------
// Write asynchronous data
// Write asynchronous data
private
void
WriteAsyncData
(
byte
[]
write_data
,
ushort
id
)
public
void
WriteAsyncData
(
byte
[]
write_data
,
ushort
id
)
{
try
{
{
if
(
socketClient
==
null
)
if
(
socketClient
==
null
)
{
{
...
@@ -527,7 +522,7 @@ namespace OnlineStore.DeviceLibrary
...
@@ -527,7 +522,7 @@ namespace OnlineStore.DeviceLibrary
string
str
=
""
;
string
str
=
""
;
foreach
(
byte
by
in
write_data
)
foreach
(
byte
by
in
write_data
)
{
{
str
=
str
+
" "
+
by
;
str
=
str
+
" "
+
by
;
}
}
//LogUtil.info( clientipe.ToString()+"发送数据:" + str);
//LogUtil.info( clientipe.ToString()+"发送数据:" + str);
...
@@ -537,12 +532,16 @@ namespace OnlineStore.DeviceLibrary
...
@@ -537,12 +532,16 @@ namespace OnlineStore.DeviceLibrary
}
}
catch
(
SystemException
error
)
catch
(
SystemException
error
)
{
{
LogUtil
.
error
(
LOGGER
,
"IO模块 WriteAsyncData出错:"
+
error
.
ToString
());
CallException
(
id
,
write_data
[
7
],
excExceptionConnectionLost
,
tcpSocketReviceBuffer
);
CallException
(
id
,
write_data
[
7
],
excExceptionConnectionLost
,
tcpSocketReviceBuffer
);
}
}
}
}
else
CallException
(
id
,
write_data
[
7
],
excExceptionConnectionLost
,
tcpSocketReviceBuffer
);
else
CallException
(
id
,
write_data
[
7
],
excExceptionConnectionLost
,
tcpSocketReviceBuffer
);
}
}
catch
(
Exception
ex
)
{
LOGGER
.
Error
(
"出错:"
+
ex
.
ToString
());
}
}
// ------------------------------------------------------------------------
// ------------------------------------------------------------------------
// Write asynchronous data acknowledge
// Write asynchronous data acknowledge
...
@@ -560,7 +559,8 @@ namespace OnlineStore.DeviceLibrary
...
@@ -560,7 +559,8 @@ namespace OnlineStore.DeviceLibrary
return
;
return
;
}
}
IPEndPoint
clientipe
=
(
IPEndPoint
)
socketClient
.
RemoteEndPoint
;
IPEndPoint
clientipe
=
(
IPEndPoint
)
socketClient
.
RemoteEndPoint
;
if
(
result
.
IsCompleted
==
false
)
{
if
(
result
.
IsCompleted
==
false
)
{
CallException
(
0xFF
,
0xFF
,
excExceptionConnectionLost
,
tcpSocketReviceBuffer
);
CallException
(
0xFF
,
0xFF
,
excExceptionConnectionLost
,
tcpSocketReviceBuffer
);
}
}
...
@@ -587,7 +587,7 @@ namespace OnlineStore.DeviceLibrary
...
@@ -587,7 +587,7 @@ namespace OnlineStore.DeviceLibrary
if
(
function
>
excExceptionOffset
)
if
(
function
>
excExceptionOffset
)
{
{
function
-=
excExceptionOffset
;
function
-=
excExceptionOffset
;
CallException
(
id
,
function
,
tcpSocketReviceBuffer
[
8
],
tcpSocketReviceBuffer
);
CallException
(
id
,
function
,
tcpSocketReviceBuffer
[
8
],
tcpSocketReviceBuffer
);
}
}
// ------------------------------------------------------------
// ------------------------------------------------------------
// Response data is regular data
// Response data is regular data
...
...
source/DeviceLibrary/StoreConfig/AC/StoreConfig.csv
查看文件 @
16cc676
...
@@ -9,7 +9,7 @@ DI,吸盘气缸上升端,SuckingDisc_Up,206,192.168.200.11,0,吸盘气缸上升端,X07,DI-07,0
...
@@ -9,7 +9,7 @@ DI,吸盘气缸上升端,SuckingDisc_Up,206,192.168.200.11,0,吸盘气缸上升端,X07,DI-07,0
DI,吸盘气缸下降端,SuckingDisc_Down,207,192.168.200.11,0,吸盘气缸下降端,X08,DI-08,0,
DI,吸盘气缸下降端,SuckingDisc_Down,207,192.168.200.11,0,吸盘气缸下降端,X08,DI-08,0,
DI,料盘宽度检测1,WidthCheck1,208,192.168.200.11,0,料盘宽度检测1,X09,DI-09,0,
DI,料盘宽度检测1,WidthCheck1,208,192.168.200.11,0,料盘宽度检测1,X09,DI-09,0,
DI,料盘宽度检测2,WidthCheck2,209,192.168.200.11,0,料盘宽度检测2,X10,DI-10,0,
DI,料盘宽度检测2,WidthCheck2,209,192.168.200.11,0,料盘宽度检测2,X10,DI-10,0,
DI,料盘检测1
(上料机构),TrayCheck_LoadMaterial
,210,192.168.200.11,0,料盘检测1(上料机构),X11,DI-11,0,
DI,料盘检测1
(上料机构),TrayCheck_LoadMaterial
,210,192.168.200.11,0,料盘检测1(上料机构),X11,DI-11,0,
DI,上料机构出料检测,OutCheck,211,192.168.200.11,0,上料机构出料检测,X12,DI-12,0,
DI,上料机构出料检测,OutCheck,211,192.168.200.11,0,上料机构出料检测,X12,DI-12,0,
DI,门锁气缸打开端,BatchDoor_Open,212,192.168.200.11,0,门锁气缸打开端,X13,DI-13,0,
DI,门锁气缸打开端,BatchDoor_Open,212,192.168.200.11,0,门锁气缸打开端,X13,DI-13,0,
DI,门锁气缸关闭端,BatchDoor_Close,213,192.168.200.11,0,门锁气缸关闭端,X14,DI-14,0,
DI,门锁气缸关闭端,BatchDoor_Close,213,192.168.200.11,0,门锁气缸关闭端,X14,DI-14,0,
...
@@ -31,10 +31,10 @@ DO,门锁气缸打开SOL,AutoDoor_Open,112,192.168.200.11,0,门锁气缸打开SOL,Y13,DO-13,
...
@@ -31,10 +31,10 @@ DO,门锁气缸打开SOL,AutoDoor_Open,112,192.168.200.11,0,门锁气缸打开SOL,Y13,DO-13,
DO,门锁气缸关闭SOL,AutoDoor_Close,113,192.168.200.11,0,门锁气缸关闭SOL,Y14,DO-14,0,
DO,门锁气缸关闭SOL,AutoDoor_Close,113,192.168.200.11,0,门锁气缸关闭SOL,Y14,DO-14,0,
,,,114,192.168.200.11,0,,Y15,DO-15,0,
,,,114,192.168.200.11,0,,Y15,DO-15,0,
,,,115,192.168.200.11,0,,Y16,DO-16,0,
,,,115,192.168.200.11,0,,Y16,DO-16,0,
DI,上料机构门关闭,DoorClose_LoadMaterial,200,192.168.200.12,0,上料机构门关闭,X
17
,DI-21,0,
DI,上料机构门关闭,DoorClose_LoadMaterial,200,192.168.200.12,0,上料机构门关闭,X
21
,DI-21,0,
DI,气压检测,Airpressure_Check,201,192.168.200.12,0,气压检测,X
18
,DI-22,0,
DI,气压检测,Airpressure_Check,201,192.168.200.12,0,气压检测,X
22
,DI-22,0,
DI,吸盘压力确认信号,SuckingDisc_Air,202,192.168.200.12,0,吸盘压力确认信号,X
19
,DI-23,0,
DI,吸盘压力确认信号,SuckingDisc_Air,202,192.168.200.12,0,吸盘压力确认信号,X
23
,DI-23,0,
DI,左侧门关闭,DoorColse_Single,203,192.168.200.12,0,左侧门关闭,X2
0
,DI-24,0,
DI,左侧门关闭,DoorColse_Single,203,192.168.200.12,0,左侧门关闭,X2
4
,DI-24,0,
,,,100,192.168.200.12,0,,Y17,DO-21,0,
,,,100,192.168.200.12,0,,Y17,DO-21,0,
,,,101,192.168.200.12,0,,Y18,DO-22,0,
,,,101,192.168.200.12,0,,Y18,DO-22,0,
,,,102,192.168.200.12,0,,Y19,DO-23,0,
,,,102,192.168.200.12,0,,Y19,DO-23,0,
...
@@ -142,5 +142,5 @@ PRO,(轴五)上料轴最大限位,BatchAxis_PositionMax,0,,,,,,,
...
@@ -142,5 +142,5 @@ PRO,(轴五)上料轴最大限位,BatchAxis_PositionMax,0,,,,,,,
PRO,(轴五)上料轴P1速度,BatchAxis_P1_Speed,50,,,,,,,
PRO,(轴五)上料轴P1速度,BatchAxis_P1_Speed,50,,,,,,,
,,,,,,,,,,
,,,,,,,,,,
,,,,,,,,,,
,,,,,,,,,,
PRO,IO模块对应的DI数量,IO_DILength,192.168.200.11#16;192.168.200.1
1
#4,,,,,, ,
PRO,IO模块对应的DI数量,IO_DILength,192.168.200.11#16;192.168.200.1
2
#4,,,,,, ,
PRO,模块对应的DO数量,IO_DOLength,192.168.200.11#16;192.168.200.1
1
#4,,,,,,,
PRO,模块对应的DO数量,IO_DOLength,192.168.200.11#16;192.168.200.1
2
#4,,,,,,,
source/LoadCVSLibrary/storeConfig/config/StoreConfig.cs
查看文件 @
16cc676
...
@@ -86,6 +86,7 @@ namespace OnlineStore.LoadCSVLibrary
...
@@ -86,6 +86,7 @@ namespace OnlineStore.LoadCSVLibrary
Dictionary
<
string
,
string
>
proMap
=
CSVReaderBase
.
getConfigProAttributeMap
(
GetType
());
Dictionary
<
string
,
string
>
proMap
=
CSVReaderBase
.
getConfigProAttributeMap
(
GetType
());
List
<
string
>
checkProList
=
new
List
<
string
>(
proMap
.
Keys
);
//用来检测attribute属性都应该要配置值
List
<
string
>
checkProList
=
new
List
<
string
>(
proMap
.
Keys
);
//用来检测attribute属性都应该要配置值
List
<
string
>
IoTypeList
=
IO_Type
.
GetTypeList
();
foreach
(
ConfigBase
con
in
configList
)
foreach
(
ConfigBase
con
in
configList
)
{
{
if
(
con
.
ProType
==
ConfigItemType
.
AXIS
||
con
.
ProType
==
ConfigItemType
.
PRO
)
if
(
con
.
ProType
==
ConfigItemType
.
AXIS
||
con
.
ProType
==
ConfigItemType
.
PRO
)
...
@@ -120,7 +121,7 @@ namespace OnlineStore.LoadCSVLibrary
...
@@ -120,7 +121,7 @@ namespace OnlineStore.LoadCSVLibrary
}
}
else
if
(
con
.
ProType
==
ConfigItemType
.
DI
)
else
if
(
con
.
ProType
==
ConfigItemType
.
DI
)
{
{
if
(
I
O_Type
.
GetTypeList
()
.
Contains
(
con
.
ProName
))
if
(
I
oTypeList
.
Contains
(
con
.
ProName
))
{
{
ConfigIO
io
=
(
ConfigIO
)
con
;
ConfigIO
io
=
(
ConfigIO
)
con
;
if
(!
DIODeviceNameList
.
Contains
(
io
.
DeviceName
)
&&
io
.
GetIOAddr
()
>=
0
)
if
(!
DIODeviceNameList
.
Contains
(
io
.
DeviceName
)
&&
io
.
GetIOAddr
()
>=
0
)
...
...
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论