Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
孙克
/
RC1250-VMILineClient
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit 96725a1a
由
LN
编写于
2020-02-10 12:48:46 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
1
1 个父辈
e371218f
隐藏空白字符变更
内嵌
并排
正在显示
9 个修改的文件
包含
370 行增加
和
103 行删除
source/DeviceLibrary/DeviceLibrary.csproj
source/DeviceLibrary/acVmiLine/VMILineBean.cs
source/DeviceLibrary/acVmiLine/VMILineBean_Partial.cs
source/DeviceLibrary/agvClient/AgvClient-20200117-back.cs
source/DeviceLibrary/agvClient/AgvClient.cs
source/VMILineClient/App.config
source/VMILineClient/FrmVMIClient.Designer.cs
source/VMILineClient/FrmVMIClient.cs
source/VMILineClient/VMILineClient.csproj
source/DeviceLibrary/DeviceLibrary.csproj
查看文件 @
96725a1
...
@@ -39,7 +39,8 @@
...
@@ -39,7 +39,8 @@
<Reference Include="Asa.IOModule.AIOBOX">
<Reference Include="Asa.IOModule.AIOBOX">
<HintPath>..\..\dll\Asa.IOModule.AIOBOX.dll</HintPath>
<HintPath>..\..\dll\Asa.IOModule.AIOBOX.dll</HintPath>
</Reference>
</Reference>
<Reference Include="Client">
<Reference Include="Client, Version=1.0.0.1, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\dll\Client.dll</HintPath>
<HintPath>..\..\dll\Client.dll</HintPath>
</Reference>
</Reference>
<Reference Include="CodeLibrary">
<Reference Include="CodeLibrary">
...
...
source/DeviceLibrary/acVmiLine/VMILineBean.cs
查看文件 @
96725a1
...
@@ -276,6 +276,15 @@ namespace OnlineStore.DeviceLibrary
...
@@ -276,6 +276,15 @@ namespace OnlineStore.DeviceLibrary
ol_noshelfWatch
.
Stop
();
ol_noshelfWatch
.
Stop
();
IOManager
.
CIOMove
(
IO_Type
.
OutL_InStopDown
,
IO_VALUE
.
LOW
);
IOManager
.
CIOMove
(
IO_Type
.
OutL_InStopDown
,
IO_VALUE
.
LOW
);
}
}
//如果入口无料架即可进入
if
(
IOManager
.
IOValue
(
IO_Type
.
OutL_InCheck
).
Equals
(
IO_VALUE
.
LOW
))
{
AgvClient
.
NeedEnter
(
Config
.
InL_AgvName
,
""
);
}
else
{
AgvClient
.
ConnotEnter
(
Config
.
InL_AgvName
,
""
);
}
}
}
private
DateTime
il_lastCallAgvTime
=
DateTime
.
Now
;
private
DateTime
il_lastCallAgvTime
=
DateTime
.
Now
;
private
Stopwatch
il_outstopCheckWarch
=
new
Stopwatch
();
private
Stopwatch
il_outstopCheckWarch
=
new
Stopwatch
();
...
@@ -295,8 +304,8 @@ namespace OnlineStore.DeviceLibrary
...
@@ -295,8 +304,8 @@ namespace OnlineStore.DeviceLibrary
il_lastCallAgvTime
=
DateTime
.
Now
;
il_lastCallAgvTime
=
DateTime
.
Now
;
//StopIOMove(IO_Type.InL_OutStopDown, StopDownMS);
//StopIOMove(IO_Type.InL_OutStopDown, StopDownMS);
LogUtil
.
info
(
" 入库线体出口有料架
,呼叫agv小车["
+
Config
.
InL_AgvName
+
"]
"
);
LogUtil
.
info
(
" 入库线体出口有料架
"
+
LastOutShelfId
+
",呼叫agv小车["
+
Config
.
InL_AgvName
+
"] [NeedLeave]
"
);
AgvClient
.
NeedLeave
(
Config
.
InL_AgvName
);
AgvClient
.
NeedLeave
(
Config
.
InL_AgvName
,
LastOutShelfId
);
}
}
}
}
else
if
(
span
.
TotalMilliseconds
>
StopDownMS
)
else
if
(
span
.
TotalMilliseconds
>
StopDownMS
)
...
...
source/DeviceLibrary/acVmiLine/VMILineBean_Partial.cs
查看文件 @
96725a1
...
@@ -125,7 +125,8 @@ namespace OnlineStore.DeviceLibrary
...
@@ -125,7 +125,8 @@ namespace OnlineStore.DeviceLibrary
public
string
GetRunInfo
()
public
string
GetRunInfo
()
{
{
return
"进料流水线:入口处料架 ["
+
LastInShelfId
+
"] 出口处料架 ["
+
LastOutShelfId
+
"]"
;
return
"进料入口料架: "
+
LastInShelfId
+
" 进料出口料架: "
+
LastOutShelfId
+
"\r\n"
+
"进料出口"
+
Config
.
InL_AgvName
+
":"
+
AgvClient
.
GetAction
(
Config
.
InL_AgvName
)+
" 出料进口"
+
Config
.
OutL_AgvName
+
":"
+
AgvClient
.
GetAction
(
Config
.
OutL_AgvName
)
+
""
;
}
}
#
endregion
#
endregion
}
}
...
...
source/DeviceLibrary/agvClient/AgvClient-20200117-back.cs
0 → 100644
查看文件 @
96725a1
using
Asa
;
using
Asa.RFID
;
using
OnlineStore.Common
;
using
OnlineStore.LoadCSVLibrary
;
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Text
;
using
System.Threading.Tasks
;
namespace
OnlineStore.DeviceLibrary
{
public
class
AgvClient
{
private
static
string
ServerIp
=
ConfigAppSettings
.
GetValue
(
Setting_Init
.
AgvServerIp
);
private
static
Asa
.
Client
agvClient
;
public
static
Dictionary
<
string
,
string
>
actionMap
=
new
Dictionary
<
string
,
string
>();
public
static
List
<
string
>
NodeList
=
new
List
<
string
>();
private
static
bool
isInit
=
false
;
public
static
void
Init
()
{
try
{
if
(!
isInit
)
{
isInit
=
true
;
agvClient
=
new
Asa
.
Client
(
ServerIp
);
agvClient
.
Log
+=
AgvClient_Log
;
agvClient
.
Arrive
+=
AgvClient_Arrive
;
agvClient
.
CanEnter
+=
AgvClient_CanEnter
;
agvClient
.
Ready
+=
AgvClient_Ready
;
}
lastNeedLeave
=
""
;
lastNeedEnter
=
""
;
actionMap
=
new
Dictionary
<
string
,
string
>();
foreach
(
string
key
in
NodeList
)
{
actionMap
.
Add
(
key
,
AGVAction
.
None
);
}
agvClient
.
Connect
(
NodeList
.
ToArray
());
}
catch
(
Exception
ex
)
{
LogUtil
.
error
(
"初始化agvClient "
+
ServerIp
+
" 出错:"
,
ex
);
}
}
private
static
void
AgvClient_Ready
(
string
id
,
byte
[]
content
)
{
UpdateAction
(
id
,
AGVAction
.
Ready
);
RFIDData
data
=
new
RFIDData
(
content
);
LogUtil
.
info
(
"收到 AgvClient_Ready ["
+
id
+
"] ["
+
data
.
ToData
()
+
"] "
);
if
(
id
.
Equals
(
LineManager
.
Config
.
OutL_AgvName
))
{
// MayEnter("C2");
if
(
IOManager
.
IOValue
(
IO_Type
.
OutL_InCheck
).
Equals
(
IO_VALUE
.
LOW
))
{
agvClient
.
MayEnter
(
id
);
LogUtil
.
info
(
"收到 AgvClient_Ready ["
+
id
+
"] ["
+
data
.
ToData
()
+
"] 调用 MayEnter "
);
}
}
else
if
(
id
.
Equals
(
LineManager
.
Config
.
InL_AgvName
))
{
if
(
IOManager
.
IOValue
(
IO_Type
.
InL_OutStopCheck
).
Equals
(
IO_VALUE
.
HIGH
))
{
LineManager
.
VMILine
.
StopIOMove
(
IO_Type
.
InL_OutStopDown
);
agvClient
.
MayLeave
(
id
);
LogUtil
.
info
(
"收到 AgvClient_Ready ["
+
id
+
"] ["
+
data
.
ToData
()
+
"] ,下降 InL_OutStopDown 600ms,调用 MayLeave "
);
}
}
}
private
static
void
AgvClient_CanEnter
(
string
id
,
byte
[]
content
)
{
UpdateAction
(
id
,
AGVAction
.
CanEnter
);
RFIDData
data
=
new
RFIDData
(
content
);
LogUtil
.
info
(
"收到 AgvClient_CanEnter ["
+
id
+
"] ["
+
data
.
ToData
()
+
"] "
);
if
(
id
.
Equals
(
LineManager
.
Config
.
OutL_AgvName
))
{
bool
result
=
IOManager
.
IOValue
(
IO_Type
.
OutL_InCheck
).
Equals
(
IO_VALUE
.
LOW
);
if
(
IOManager
.
IOValue
(
IO_Type
.
OutL_InCheck
).
Equals
(
IO_VALUE
.
LOW
))
{
agvClient
.
IsEnter
(
id
);
}
}
else
if
(
id
.
Equals
(
LineManager
.
Config
.
InL_AgvName
))
{
}
}
private
static
void
AgvClient_Arrive
(
string
id
,
byte
[]
content
)
{
UpdateAction
(
id
,
AGVAction
.
Arrive
);
RFIDData
data
=
new
RFIDData
(
content
);
LogUtil
.
info
(
"收到 AgvClient_Arrive ["
+
id
+
"] ["
+
data
.
ToData
()
+
"] "
);
}
public
static
bool
ISConnected
()
{
if
(
agvClient
==
null
)
{
return
false
;
}
return
agvClient
.
IsConn
;
}
public
static
void
SendRFID
(
string
NodeName
,
string
rfid
)
{
agvClient
.
SendRFID
(
NodeName
,
rfid
);
}
private
static
string
lastNeedEnter
=
""
;
public
static
void
NeedEnter
(
string
NodeName
,
string
shelfID
,
bool
NeedClearLast
=
false
)
{
if
(
NeedClearLast
)
{
lastNeedEnter
=
""
;
}
if
(
lastNeedEnter
.
Equals
(
NodeName
+
shelfID
))
{
//return;
}
bool
result
=
agvClient
.
NeedEnter
(
NodeName
);
if
(
result
)
{
lastNeedEnter
=
NodeName
+
shelfID
;
LogUtil
.
info
(
" agvClient 料架需要进入:NeedEnter["
+
NodeName
+
shelfID
+
"],呼叫成功"
);
}
else
{
LogUtil
.
info
(
" agvClient 料架需要进入:NeedEnter["
+
NodeName
+
shelfID
+
"],呼叫失败,等待重新呼叫"
);
}
}
private
static
string
lastNeedLeave
=
""
;
public
static
void
NeedLeave
(
string
NodeName
,
string
shelfID
,
bool
NeedClearLast
=
false
)
{
if
(
NeedClearLast
)
{
lastNeedLeave
=
""
;
}
if
(
lastNeedLeave
.
Equals
(
NodeName
+
shelfID
))
{
// return;
}
bool
result
=
agvClient
.
NeedLeave
(
NodeName
);
if
(
result
)
{
lastNeedLeave
=
NodeName
+
shelfID
;
LogUtil
.
info
(
" agvClient 料架需要离开:NeedLeave["
+
NodeName
+
shelfID
+
"],呼叫成功"
);
}
else
{
LogUtil
.
info
(
" agvClient 料架需要离开:NeedLeave["
+
NodeName
+
shelfID
+
"],呼叫失败,等待重新呼叫"
);
}
}
public
static
void
MayEnter
(
string
NodeName
)
{
agvClient
.
MayEnter
(
NodeName
);
}
public
static
void
FinishEnter
(
string
NodeName
)
{
agvClient
.
FinishEnter
(
NodeName
);
}
public
static
void
MayLeave
(
string
NodeName
)
{
agvClient
.
MayLeave
(
NodeName
);
}
public
static
void
IsEnter
(
string
NodeName
,
bool
result
)
{
if
(
result
)
{
agvClient
.
IsEnter
(
NodeName
);
}
}
private
static
void
AgvClient_Log
(
string
s
)
{
try
{
bool
isLog
=
ConfigAppSettings
.
GetIntValue
(
Setting_Init
.
Agv_Log_Open
).
Equals
(
1
);
if
(
isLog
)
{
LogUtil
.
info
(
" AGV "
+
ServerIp
+
" Log : "
+
s
);
}
}
catch
(
Exception
ex
)
{
LogUtil
.
error
(
"AgvClient_Log 出错:"
+
ex
.
ToString
());
}
}
public
static
string
GetAction
(
string
NodeName
)
{
if
(
actionMap
.
ContainsKey
(
NodeName
))
{
return
actionMap
[
NodeName
];
}
return
AGVAction
.
None
;
}
public
static
void
UpdateAction
(
string
name
,
string
action
)
{
if
(
actionMap
.
ContainsKey
(
name
))
{
actionMap
[
name
]
=
action
;
}
else
{
actionMap
.
Add
(
name
,
action
);
}
}
public
static
void
Dispose
()
{
try
{
lastNeedLeave
=
""
;
lastNeedEnter
=
""
;
if
(
agvClient
!=
null
)
{
agvClient
.
Close
();
}
}
catch
(
Exception
ex
)
{
LogUtil
.
error
(
"agvClient.Close "
+
ServerIp
+
" 出错:"
,
ex
);
}
}
}
public
class
AGVAction
{
public
static
string
None
=
"None"
;
public
static
string
Arrive
=
"Arrive"
;
public
static
string
CanEnter
=
"CanEnter"
;
public
static
string
GetRFID
=
"GetRFID"
;
public
static
string
Ready
=
"Ready"
;
}
}
source/DeviceLibrary/agvClient/AgvClient.cs
查看文件 @
96725a1
...
@@ -7,6 +7,7 @@ using System;
...
@@ -7,6 +7,7 @@ using System;
using
System.Collections.Generic
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Linq
;
using
System.Text
;
using
System.Text
;
using
System.Threading
;
using
System.Threading.Tasks
;
using
System.Threading.Tasks
;
namespace
OnlineStore.DeviceLibrary
namespace
OnlineStore.DeviceLibrary
...
@@ -14,8 +15,8 @@ namespace OnlineStore.DeviceLibrary
...
@@ -14,8 +15,8 @@ namespace OnlineStore.DeviceLibrary
public
class
AgvClient
public
class
AgvClient
{
{
private
static
string
ServerIp
=
ConfigAppSettings
.
GetValue
(
Setting_Init
.
AgvServerIp
);
private
static
string
ServerIp
=
ConfigAppSettings
.
GetValue
(
Setting_Init
.
AgvServerIp
);
private
static
Asa
.
Client
agvClient
;
private
static
Asa
.
Client
2
agvClient
;
public
static
Dictionary
<
string
,
string
>
actionMap
=
new
Dictionary
<
string
,
string
>();
public
static
Dictionary
<
string
,
Asa
.
ClientAction
>
actionMap
=
new
Dictionary
<
string
,
Asa
.
ClientAction
>();
public
static
List
<
string
>
NodeList
=
new
List
<
string
>();
public
static
List
<
string
>
NodeList
=
new
List
<
string
>();
private
static
bool
isInit
=
false
;
private
static
bool
isInit
=
false
;
public
static
void
Init
()
public
static
void
Init
()
...
@@ -25,19 +26,24 @@ namespace OnlineStore.DeviceLibrary
...
@@ -25,19 +26,24 @@ namespace OnlineStore.DeviceLibrary
if
(!
isInit
)
if
(!
isInit
)
{
{
isInit
=
true
;
isInit
=
true
;
agvClient
=
new
Asa
.
Client
(
ServerIp
);
agvClient
=
new
Asa
.
Client
2
(
ServerIp
);
agvClient
.
Log
+=
AgvClient_Log
;
agvClient
.
Log
+=
AgvClient_Log
;
agvClient
.
Arrive
+=
AgvClient_Arrive
;
agvClient
.
Arrive
+=
AgvClient_Arrive
;
agvClient
.
CanEnter
+=
AgvClient_CanEnter
;
//
agvClient.CanEnter += AgvClient_CanEnter;
agvClient
.
Ready
+=
AgvClient_Ready
;
agvClient
.
Ready
+=
AgvClient_Ready
;
agvClient
.
GetRFID
+=
AgvClient_GetRFID
;
}
}
actionMap
=
new
Dictionary
<
string
,
string
>();
actionMap
=
new
Dictionary
<
string
,
Asa
.
ClientAction
>();
foreach
(
string
key
in
NodeList
)
foreach
(
string
key
in
NodeList
)
{
{
actionMap
.
Add
(
key
,
A
GV
Action
.
None
);
actionMap
.
Add
(
key
,
A
sa
.
Client
Action
.
None
);
}
}
agvClient
.
Connect
(
NodeList
.
ToArray
());
agvClient
.
Connect
();
foreach
(
string
str
in
NodeList
)
{
SetStatus
(
str
);
}
}
}
catch
(
Exception
ex
)
catch
(
Exception
ex
)
...
@@ -46,20 +52,41 @@ namespace OnlineStore.DeviceLibrary
...
@@ -46,20 +52,41 @@ namespace OnlineStore.DeviceLibrary
}
}
}
}
private
static
void
AgvClient_GetRFID
(
string
name
,
byte
[]
content
)
{
}
public
static
void
SetStatus
(
string
id
,
string
shelfId
=
""
,
ClientAction
action
=
ClientAction
.
None
,
ClientLevel
level
=
ClientLevel
.
Low
)
{
agvClient
.
SetStatus
(
id
,
shelfId
,
action
,
level
);
UpdateAction
(
id
,
action
);
}
private
static
void
AgvClient_Ready
(
string
id
,
byte
[]
content
)
private
static
void
AgvClient_Ready
(
string
id
,
byte
[]
content
)
{
{
UpdateAction
(
id
,
AGVAction
.
Ready
);
RFIDData
data
=
new
RFIDData
(
content
);
RFIDData
data
=
new
RFIDData
(
content
);
LogUtil
.
info
(
"收到 AgvClient_Ready ["
+
id
+
"] ["
+
data
.
ToData
()
+
"] "
);
LogUtil
.
info
(
"收到 AgvClient_Ready ["
+
id
+
"] ["
+
data
.
ToData
()
+
"] "
);
UpdateAction
(
id
,
Asa
.
ClientAction
.
Ready
);
if
(
id
.
Equals
(
LineManager
.
Config
.
OutL_AgvName
))
if
(
id
.
Equals
(
LineManager
.
Config
.
OutL_AgvName
))
{
{
// MayEnter("C2");
// MayEnter("C2");
if
(
IOManager
.
IOValue
(
IO_Type
.
OutL_InCheck
).
Equals
(
IO_VALUE
.
LOW
))
if
(
IOManager
.
IOValue
(
IO_Type
.
OutL_InCheck
).
Equals
(
IO_VALUE
.
LOW
))
{
{
agvClient
.
MayEnter
(
id
);
SetStatus
(
id
,
""
,
ClientAction
.
MayEnter
);
LogUtil
.
info
(
"收到 AgvClient_Ready ["
+
id
+
"] ["
+
data
.
ToData
()
+
"] 调用 MayEnter "
);
LogUtil
.
info
(
"收到 AgvClient_Ready ["
+
id
+
"] ["
+
data
.
ToData
()
+
"] 调用 MayEnter "
);
Task
.
Factory
.
StartNew
(
delegate
{
//两秒后改为离开状态
Thread
.
Sleep
(
5000
);
SetStatus
(
id
,
""
,
ClientAction
.
FinishEnter
);
Thread
.
Sleep
(
2000
);
SetStatus
(
id
,
""
,
ClientAction
.
None
);
});
}
}
}
}
...
@@ -68,42 +95,60 @@ namespace OnlineStore.DeviceLibrary
...
@@ -68,42 +95,60 @@ namespace OnlineStore.DeviceLibrary
if
(
IOManager
.
IOValue
(
IO_Type
.
InL_OutStopCheck
).
Equals
(
IO_VALUE
.
HIGH
))
if
(
IOManager
.
IOValue
(
IO_Type
.
InL_OutStopCheck
).
Equals
(
IO_VALUE
.
HIGH
))
{
{
LineManager
.
VMILine
.
StopIOMove
(
IO_Type
.
InL_OutStopDown
);
LineManager
.
VMILine
.
StopIOMove
(
IO_Type
.
InL_OutStopDown
);
agvClient
.
MayLeave
(
id
);
//agvClient.MayLeave(id);
SetStatus
(
id
,
""
,
ClientAction
.
MayLeave
);
LogUtil
.
info
(
"收到 AgvClient_Ready ["
+
id
+
"] ["
+
data
.
ToData
()
+
"] ,下降 InL_OutStopDown 600ms,调用 MayLeave "
);
LogUtil
.
info
(
"收到 AgvClient_Ready ["
+
id
+
"] ["
+
data
.
ToData
()
+
"] ,下降 InL_OutStopDown 600ms,调用 MayLeave "
);
Task
.
Factory
.
StartNew
(
delegate
{
//两秒后改为离开状态
Thread
.
Sleep
(
5000
);
SetStatus
(
id
,
""
,
ClientAction
.
FinishEnter
);
Thread
.
Sleep
(
2000
);
SetStatus
(
id
,
""
,
ClientAction
.
None
);
});
}
}
}
}
}
private
static
void
AgvClient_Arrive
(
string
id
,
byte
[]
content
)
{
UpdateAction
(
id
,
Asa
.
ClientAction
.
Arrive
);
RFIDData
data
=
new
RFIDData
(
content
);
LogUtil
.
info
(
"收到 AgvClient_Arrive ["
+
id
+
"] ["
+
data
.
ToData
()
+
"] "
);
}
}
p
rivate
static
void
AgvClient_CanEnter
(
string
id
,
byte
[]
content
)
p
ublic
static
bool
ConnotEnter
(
string
id
,
string
shelfId
)
{
{
UpdateAction
(
id
,
AGVAction
.
CanEnter
);
ClientAction
currA
=
GetAction
(
id
);
RFIDData
data
=
new
RFIDData
(
content
);
if
(
currA
.
Equals
(
ClientAction
.
None
)
||
currA
.
Equals
(
ClientAction
.
FinishLeave
)
||
currA
.
Equals
(
ClientAction
.
FinishEnter
))
LogUtil
.
info
(
"收到 AgvClient_CanEnter ["
+
id
+
"] ["
+
data
.
ToData
()
+
"] "
);
if
(
id
.
Equals
(
LineManager
.
Config
.
OutL_AgvName
))
{
{
bool
result
=
IOManager
.
IOValue
(
IO_Type
.
OutL_InCheck
).
Equals
(
IO_VALUE
.
LOW
);
SetStatus
(
id
,
shelfId
,
ClientAction
.
None
);
if
(
IOManager
.
IOValue
(
IO_Type
.
OutL_InCheck
).
Equals
(
IO_VALUE
.
LOW
))
return
true
;
{
agvClient
.
IsEnter
(
id
);
}
}
}
else
if
(
id
.
Equals
(
LineManager
.
Config
.
InL_AgvName
))
return
false
;
}
public
static
bool
NeedEnter
(
string
id
,
string
shelfId
)
{
ClientAction
currA
=
GetAction
(
id
);
if
(
currA
.
Equals
(
ClientAction
.
None
)
||
currA
.
Equals
(
ClientAction
.
FinishLeave
)
||
currA
.
Equals
(
ClientAction
.
FinishEnter
))
{
{
SetStatus
(
id
,
shelfId
,
ClientAction
.
NeedEnter
);
return
true
;
}
}
return
false
;
}
}
public
static
bool
NeedLeave
(
string
id
,
string
shelfId
)
private
static
void
AgvClient_Arrive
(
string
id
,
byte
[]
content
)
{
{
UpdateAction
(
id
,
AGVAction
.
Arrive
);
ClientAction
currA
=
GetAction
(
id
);
RFIDData
data
=
new
RFIDData
(
content
);
if
(
currA
.
Equals
(
ClientAction
.
None
)
||
currA
.
Equals
(
ClientAction
.
FinishLeave
)
||
currA
.
Equals
(
ClientAction
.
FinishEnter
))
{
LogUtil
.
info
(
"收到 AgvClient_Arrive ["
+
id
+
"] ["
+
data
.
ToData
()
+
"] "
);
SetStatus
(
id
,
shelfId
,
ClientAction
.
NeedLeave
);
return
true
;
}
return
false
;
}
}
public
static
bool
ISConnected
()
public
static
bool
ISConnected
()
{
{
if
(
agvClient
==
null
)
if
(
agvClient
==
null
)
...
@@ -116,36 +161,7 @@ namespace OnlineStore.DeviceLibrary
...
@@ -116,36 +161,7 @@ namespace OnlineStore.DeviceLibrary
{
{
agvClient
.
SendRFID
(
NodeName
,
rfid
);
agvClient
.
SendRFID
(
NodeName
,
rfid
);
}
}
public
static
void
NeedEnter
(
string
NodeName
)
{
agvClient
.
NeedEnter
(
NodeName
);
}
public
static
void
NeedLeave
(
string
NodeName
)
{
agvClient
.
NeedLeave
(
NodeName
);
}
public
static
void
MayEnter
(
string
NodeName
)
{
agvClient
.
MayEnter
(
NodeName
);
}
public
static
void
FinishEnter
(
string
NodeName
)
{
agvClient
.
FinishEnter
(
NodeName
);
}
public
static
void
MayLeave
(
string
NodeName
)
{
agvClient
.
MayLeave
(
NodeName
);
}
public
static
void
IsEnter
(
string
NodeName
,
bool
result
)
{
if
(
result
)
{
agvClient
.
IsEnter
(
NodeName
);
}
}
private
static
void
AgvClient_Log
(
string
s
)
private
static
void
AgvClient_Log
(
string
s
)
{
{
try
try
...
@@ -162,15 +178,15 @@ namespace OnlineStore.DeviceLibrary
...
@@ -162,15 +178,15 @@ namespace OnlineStore.DeviceLibrary
}
}
}
}
public
static
string
GetAction
(
string
NodeName
)
public
static
Asa
.
ClientAction
GetAction
(
string
NodeName
)
{
{
if
(
actionMap
.
ContainsKey
(
NodeName
))
if
(
actionMap
.
ContainsKey
(
NodeName
))
{
{
return
actionMap
[
NodeName
];
return
actionMap
[
NodeName
];
}
}
return
A
GV
Action
.
None
;
return
A
sa
.
Client
Action
.
None
;
}
}
public
static
void
UpdateAction
(
string
name
,
string
action
)
public
static
void
UpdateAction
(
string
name
,
Asa
.
ClientAction
action
)
{
{
if
(
actionMap
.
ContainsKey
(
name
))
if
(
actionMap
.
ContainsKey
(
name
))
{
{
...
@@ -184,7 +200,7 @@ namespace OnlineStore.DeviceLibrary
...
@@ -184,7 +200,7 @@ namespace OnlineStore.DeviceLibrary
public
static
void
Dispose
()
public
static
void
Dispose
()
{
{
try
try
{
{
if
(
agvClient
!=
null
)
if
(
agvClient
!=
null
)
{
{
agvClient
.
Close
();
agvClient
.
Close
();
...
@@ -195,13 +211,5 @@ namespace OnlineStore.DeviceLibrary
...
@@ -195,13 +211,5 @@ namespace OnlineStore.DeviceLibrary
LogUtil
.
error
(
"agvClient.Close "
+
ServerIp
+
" 出错:"
,
ex
);
LogUtil
.
error
(
"agvClient.Close "
+
ServerIp
+
" 出错:"
,
ex
);
}
}
}
}
}
}
public
class
AGVAction
{
public
static
string
None
=
"None"
;
public
static
string
Arrive
=
"Arrive"
;
public
static
string
CanEnter
=
"CanEnter"
;
public
static
string
GetRFID
=
"GetRFID"
;
public
static
string
Ready
=
"Ready"
;
}
}
}
source/VMILineClient/App.config
查看文件 @
96725a1
...
@@ -54,10 +54,10 @@
...
@@ -54,10 +54,10 @@
<
level
value
=
"Error"
/>
<
level
value
=
"Error"
/>
<
appender
-
ref
ref
=
"TheRFID"
/>
<
appender
-
ref
ref
=
"TheRFID"
/>
</
logger
>
</
logger
>
<!-- <
root
> -->
<
root
>
<!-- <
level
value
=
"Info"
/> -->
<
level
value
=
"Info"
/>
<!-- <
appender
-
ref
ref
=
"RollingLogFileAppender"
/> -->
<
appender
-
ref
ref
=
"RollingLogFileAppender"
/>
<!-- </
root
> -->
</
root
>
</
log4net
>
</
log4net
>
<
startup
>
<
startup
>
<
supportedRuntime
version
=
"v4.0"
sku
=
".NETFramework,Version=v4.6.1"
/>
<
supportedRuntime
version
=
"v4.0"
sku
=
".NETFramework,Version=v4.6.1"
/>
...
...
source/VMILineClient/FrmVMIClient.Designer.cs
查看文件 @
96725a1
...
@@ -60,12 +60,12 @@
...
@@ -60,12 +60,12 @@
this
.
btnInLineRun
=
new
System
.
Windows
.
Forms
.
Button
();
this
.
btnInLineRun
=
new
System
.
Windows
.
Forms
.
Button
();
this
.
btnOutL
=
new
System
.
Windows
.
Forms
.
Button
();
this
.
btnOutL
=
new
System
.
Windows
.
Forms
.
Button
();
this
.
groupBox5
=
new
System
.
Windows
.
Forms
.
GroupBox
();
this
.
groupBox5
=
new
System
.
Windows
.
Forms
.
GroupBox
();
this
.
txtShelfId
=
new
System
.
Windows
.
Forms
.
TextBox
();
this
.
txtname
=
new
System
.
Windows
.
Forms
.
TextBox
();
this
.
txtname
=
new
System
.
Windows
.
Forms
.
TextBox
();
this
.
btnNeedEntry
=
new
System
.
Windows
.
Forms
.
Button
();
this
.
btnNeedEntry
=
new
System
.
Windows
.
Forms
.
Button
();
this
.
btnNeedLeave
=
new
System
.
Windows
.
Forms
.
Button
();
this
.
btnNeedLeave
=
new
System
.
Windows
.
Forms
.
Button
();
this
.
btnDis
=
new
System
.
Windows
.
Forms
.
Button
();
this
.
btnDis
=
new
System
.
Windows
.
Forms
.
Button
();
this
.
btnInit
=
new
System
.
Windows
.
Forms
.
Button
();
this
.
btnInit
=
new
System
.
Windows
.
Forms
.
Button
();
this
.
txtShelfId
=
new
System
.
Windows
.
Forms
.
TextBox
();
this
.
groupBox3
.
SuspendLayout
();
this
.
groupBox3
.
SuspendLayout
();
this
.
panel1
.
SuspendLayout
();
this
.
panel1
.
SuspendLayout
();
this
.
contextMenuStrip1
.
SuspendLayout
();
this
.
contextMenuStrip1
.
SuspendLayout
();
...
@@ -139,15 +139,15 @@
...
@@ -139,15 +139,15 @@
this
.
panel1
.
Controls
.
Add
(
this
.
chbDebug
);
this
.
panel1
.
Controls
.
Add
(
this
.
chbDebug
);
this
.
panel1
.
Controls
.
Add
(
this
.
btnVmiStop
);
this
.
panel1
.
Controls
.
Add
(
this
.
btnVmiStop
);
this
.
panel1
.
Controls
.
Add
(
this
.
chbAuto
);
this
.
panel1
.
Controls
.
Add
(
this
.
chbAuto
);
this
.
panel1
.
Location
=
new
System
.
Drawing
.
Point
(
5
,
1
8
);
this
.
panel1
.
Location
=
new
System
.
Drawing
.
Point
(
5
,
1
5
);
this
.
panel1
.
Name
=
"panel1"
;
this
.
panel1
.
Name
=
"panel1"
;
this
.
panel1
.
Size
=
new
System
.
Drawing
.
Size
(
1121
,
4
5
);
this
.
panel1
.
Size
=
new
System
.
Drawing
.
Size
(
1121
,
4
8
);
this
.
panel1
.
TabIndex
=
273
;
this
.
panel1
.
TabIndex
=
273
;
//
//
// lblInfo
// lblInfo
//
//
this
.
lblInfo
.
AutoSize
=
true
;
this
.
lblInfo
.
AutoSize
=
true
;
this
.
lblInfo
.
Location
=
new
System
.
Drawing
.
Point
(
27
4
,
14
);
this
.
lblInfo
.
Location
=
new
System
.
Drawing
.
Point
(
27
7
,
5
);
this
.
lblInfo
.
Name
=
"lblInfo"
;
this
.
lblInfo
.
Name
=
"lblInfo"
;
this
.
lblInfo
.
Size
=
new
System
.
Drawing
.
Size
(
56
,
17
);
this
.
lblInfo
.
Size
=
new
System
.
Drawing
.
Size
(
56
,
17
);
this
.
lblInfo
.
TabIndex
=
273
;
this
.
lblInfo
.
TabIndex
=
273
;
...
@@ -502,6 +502,16 @@
...
@@ -502,6 +502,16 @@
this
.
groupBox5
.
TabStop
=
false
;
this
.
groupBox5
.
TabStop
=
false
;
this
.
groupBox5
.
Text
=
"AGV调度通信"
;
this
.
groupBox5
.
Text
=
"AGV调度通信"
;
//
//
// txtShelfId
//
this
.
txtShelfId
.
Font
=
new
System
.
Drawing
.
Font
(
"微软雅黑"
,
10.5F
,
System
.
Drawing
.
FontStyle
.
Regular
,
System
.
Drawing
.
GraphicsUnit
.
Point
,
((
byte
)(
134
)));
this
.
txtShelfId
.
Location
=
new
System
.
Drawing
.
Point
(
354
,
31
);
this
.
txtShelfId
.
MaxLength
=
4
;
this
.
txtShelfId
.
Name
=
"txtShelfId"
;
this
.
txtShelfId
.
Size
=
new
System
.
Drawing
.
Size
(
53
,
26
);
this
.
txtShelfId
.
TabIndex
=
6
;
this
.
txtShelfId
.
Text
=
"000"
;
//
// txtname
// txtname
//
//
this
.
txtname
.
Font
=
new
System
.
Drawing
.
Font
(
"微软雅黑"
,
10.5F
,
System
.
Drawing
.
FontStyle
.
Regular
,
System
.
Drawing
.
GraphicsUnit
.
Point
,
((
byte
)(
134
)));
this
.
txtname
.
Font
=
new
System
.
Drawing
.
Font
(
"微软雅黑"
,
10.5F
,
System
.
Drawing
.
FontStyle
.
Regular
,
System
.
Drawing
.
GraphicsUnit
.
Point
,
((
byte
)(
134
)));
...
@@ -556,16 +566,6 @@
...
@@ -556,16 +566,6 @@
this
.
btnInit
.
UseVisualStyleBackColor
=
true
;
this
.
btnInit
.
UseVisualStyleBackColor
=
true
;
this
.
btnInit
.
Click
+=
new
System
.
EventHandler
(
this
.
btnInit_Click
);
this
.
btnInit
.
Click
+=
new
System
.
EventHandler
(
this
.
btnInit_Click
);
//
//
// txtShelfId
//
this
.
txtShelfId
.
Font
=
new
System
.
Drawing
.
Font
(
"微软雅黑"
,
10.5F
,
System
.
Drawing
.
FontStyle
.
Regular
,
System
.
Drawing
.
GraphicsUnit
.
Point
,
((
byte
)(
134
)));
this
.
txtShelfId
.
Location
=
new
System
.
Drawing
.
Point
(
354
,
31
);
this
.
txtShelfId
.
MaxLength
=
4
;
this
.
txtShelfId
.
Name
=
"txtShelfId"
;
this
.
txtShelfId
.
Size
=
new
System
.
Drawing
.
Size
(
53
,
26
);
this
.
txtShelfId
.
TabIndex
=
6
;
this
.
txtShelfId
.
Text
=
"000"
;
//
// FrmVMIClient
// FrmVMIClient
//
//
this
.
AutoScaleDimensions
=
new
System
.
Drawing
.
SizeF
(
96F
,
96F
);
this
.
AutoScaleDimensions
=
new
System
.
Drawing
.
SizeF
(
96F
,
96F
);
...
...
source/VMILineClient/FrmVMIClient.cs
查看文件 @
96725a1
...
@@ -367,13 +367,12 @@ namespace OnlineStore.VMILineClient
...
@@ -367,13 +367,12 @@ namespace OnlineStore.VMILineClient
string
agvName
=
"C2"
;
string
agvName
=
"C2"
;
private
void
btnNeedLeave_Click
(
object
sender
,
EventArgs
e
)
private
void
btnNeedLeave_Click
(
object
sender
,
EventArgs
e
)
{
{
AgvClient
.
NeedLeave
(
txtname
.
Text
,
txtShelfId
.
Text
);
AgvClient
.
SetStatus
(
txtname
.
Text
,
txtShelfId
.
Text
,
Asa
.
ClientAction
.
NeedLeave
);
}
}
private
void
btnNeedEntry_Click
(
object
sender
,
EventArgs
e
)
private
void
btnNeedEntry_Click
(
object
sender
,
EventArgs
e
)
{
{
AgvClient
.
SetStatus
(
txtname
.
Text
,
txtShelfId
.
Text
,
Asa
.
ClientAction
.
NeedEnter
);
AgvClient
.
NeedEnter
(
txtname
.
Text
);
}
}
private
void
btnInit_Click
(
object
sender
,
EventArgs
e
)
private
void
btnInit_Click
(
object
sender
,
EventArgs
e
)
...
...
source/VMILineClient/VMILineClient.csproj
查看文件 @
96725a1
...
@@ -53,8 +53,9 @@
...
@@ -53,8 +53,9 @@
<ApplicationIcon>DfIcon.ico</ApplicationIcon>
<ApplicationIcon>DfIcon.ico</ApplicationIcon>
</PropertyGroup>
</PropertyGroup>
<ItemGroup>
<ItemGroup>
<Reference Include="halcondotnet">
<Reference Include="Client, Version=1.0.0.1, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\dll\halcondotnet.dll</HintPath>
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\dll\Client.dll</HintPath>
</Reference>
</Reference>
<Reference Include="log4net">
<Reference Include="log4net">
<HintPath>..\..\dll\log4net.dll</HintPath>
<HintPath>..\..\dll\log4net.dll</HintPath>
...
...
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论