Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
孙克
/
RC1250-ACPackingStore
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit 256f3373
由
LN
编写于
2020-01-13 14:40:50 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
agv修改
1 个父辈
3078ab8b
隐藏空白字符变更
内嵌
并排
正在显示
10 个修改的文件
包含
120 行增加
和
113 行删除
dll/Client.dll
source/ACPackingStore/App.config
source/Common/Setting_Init.cs
source/DeviceLibrary/ACPackingStore/AC_BOX_Bean_Partial.cs
source/DeviceLibrary/ACPackingStore/AC_BOX_Bean_Shelf.cs
source/DeviceLibrary/ACPackingStore/PackingStoreBean.cs
source/DeviceLibrary/DeviceLibrary.csproj
source/DeviceLibrary/agvClient/AgvClient.cs
source/DeviceLibrary/device/RFID/RFIDManager.cs
source/DeviceLibrary/store/model/StoreMoveInfo.cs
dll/Client.dll
查看文件 @
256f337
此文件类型无法预览
source/ACPackingStore/App.config
查看文件 @
256f337
...
...
@@ -54,6 +54,7 @@
<
add
key
=
"AutoShelfInstore"
value
=
"1"
/>
<!--是否启用入料口移门,
1
=启用,
0
=禁用-->
<
add
key
=
"UseDoor"
value
=
"1"
/>
<
add
key
=
"Agv_Log_Open"
value
=
"1"
/>
</
appSettings
>
<
log4net
>
<
appender
name
=
"RollingLogFileAppender"
type
=
"log4net.Appender.RollingFileAppender"
>
...
...
@@ -67,7 +68,7 @@
</
layout
>
</
appender
>
<
appender
name
=
"TheRFID"
type
=
"log4net.Appender.RollingFileAppender"
>
<
file
value
=
"logs/TheRFID.log"
/>
<
file
value
=
"logs/TheRFID
-p-1-2
.log"
/>
<
param
name
=
"Encoding"
value
=
"UTF-8"
/>
<
appendToFile
value
=
"true"
/>
<
rollingStyle
value
=
"Date"
/>
...
...
source/Common/Setting_Init.cs
查看文件 @
256f337
...
...
@@ -11,6 +11,7 @@ namespace OnlineStore.Common
/// </summary>
public
class
Setting_Init
{
public
static
string
Agv_Log_Open
=
"Agv_Log_Open"
;
public
static
string
Server_Log_Open
=
"Server_Log_Open"
;
/// <summary>
/// 系统启动时自动启动料仓,=1时自动启动,并隐藏窗口,=0时不需要
...
...
source/DeviceLibrary/ACPackingStore/AC_BOX_Bean_Partial.cs
查看文件 @
256f337
...
...
@@ -105,12 +105,12 @@ namespace OnlineStore.DeviceLibrary
else
if
(
wait
.
WaitType
.
Equals
(
WaitEnum
.
W010_AgvStatus
))
{
int
agvA
=
(
int
)
AgvClient
.
GetAction
(
Config
.
AgvNodeName
);
string
agvA
=
AgvClient
.
GetAction
(
Config
.
AgvNodeName
);
wait
.
IsEnd
=
agvA
.
Equals
(
wait
.
TargetPosition
);
if
(!
wait
.
IsEnd
&&
span
.
TotalSeconds
>
10
)
{
//如果是等待AGV到达,等待有料架信号也算结束
if
(
wait
.
TargetPosition
.
Equals
((
int
)
Asa
.
Actions
.
Arrive
)
&&
MoveInfo
.
MoveStep
.
Equals
(
StoreMoveStep
.
BI_01_ReadyShelf
))
if
(
wait
.
AgvAction
.
Equals
(
AGVAction
.
Arrive
)
&&
MoveInfo
.
MoveStep
.
Equals
(
StoreMoveStep
.
BI_01_ReadyShelf
))
{
if
(
IOValue
(
IO_Type
.
LineTake_Check
).
Equals
(
IO_VALUE
.
HIGH
))
{
...
...
@@ -123,7 +123,7 @@ namespace OnlineStore.DeviceLibrary
wait
.
IsEnd
=
true
;
}
}
else
if
(
wait
.
TargetPosition
.
Equals
((
int
)
Asa
.
Actions
.
FinishOut
))
else
if
(
wait
.
AgvAction
.
Equals
(
AGVAction
.
FinishOut
))
{
if
(
IOValue
(
IO_Type
.
LineTake_Check
).
Equals
(
IO_VALUE
.
LOW
)
&&
IOValue
(
IO_Type
.
LineIn_Check
).
Equals
(
IO_VALUE
.
LOW
))
{
...
...
@@ -743,8 +743,8 @@ namespace OnlineStore.DeviceLibrary
InOutStoreLog
(
"出库 "
+
MoveInfo
.
SLog
+
": 通知agv调度准备带料架的agv,等待agv到达或检测到料架信号,进出轴到P1"
);
InOutBackToP1
(
MoveInfo
.
MoveParam
.
MoveP
.
InOut_P1
);
//需要先叫agv到达
AgvClient
.
ReadyShelf
(
Config
.
AgvNodeName
);
MoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitAgvAction
(
(
int
)
Asa
.
Actions
.
Arrive
));
AgvClient
.
NeedEnter
(
Config
.
AgvNodeName
);
MoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitAgvAction
(
AGVAction
.
Arrive
));
}
else
{
...
...
source/DeviceLibrary/ACPackingStore/AC_BOX_Bean_Shelf.cs
查看文件 @
256f337
...
...
@@ -201,15 +201,15 @@ namespace OnlineStore.DeviceLibrary
MoveInfo
.
OneWaitCanEndStep
=
true
;
MoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitTime
(
10000
));
InOutStoreLog
(
moveName
+
MoveInfo
.
SLog
+
":调用AgvClient.ReadyEmpty,等待Agv到达 ,最多等待1000"
);
AgvClient
.
ReadyEmpty
(
Config
.
AgvNodeName
);
AgvClient
.
NeedLeave
(
Config
.
AgvNodeName
);
//等待agv到达
MoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitAgvAction
(
(
int
)
Asa
.
Actions
.
Arrive
));
MoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitAgvAction
(
AGVAction
.
Arrive
));
}
else
if
(
MoveInfo
.
MoveStep
.
Equals
(
StoreMoveStep
.
BS_04_ReadyEmpty
))
{
MoveInfo
.
NextMoveStep
(
StoreMoveStep
.
BS_05_LineBackRun
);
//agv到达
if
(
AgvClient
.
GetAction
(
Config
.
AgvNodeName
).
Equals
(
A
sa
.
Actions
.
Arrive
))
if
(
AgvClient
.
GetAction
(
Config
.
AgvNodeName
).
Equals
(
A
GVAction
.
Arrive
))
{
if
(
instoreShelf
)
{
...
...
@@ -221,11 +221,12 @@ namespace OnlineStore.DeviceLibrary
{
InOutStoreLog
(
moveName
+
MoveInfo
.
SLog
+
":agv到达, 调用AgvClient.MayOut,线体开始反转"
);
}
AgvClient
.
May
Out
(
Config
.
AgvNodeName
);
AgvClient
.
May
Leave
(
Config
.
AgvNodeName
);
LineBackRun
();
}
else
{
//如果agv未到达,直接结束
{
//如果agv未到达,直接结束
MoveEndToRuningStatus
();
EmprtShelfList
=
new
ConcurrentQueue
<
string
>();
InOutStoreLog
(
moveName
+
MoveInfo
.
SLog
+
":等待agv超时,直接结束"
);
...
...
@@ -241,10 +242,12 @@ namespace OnlineStore.DeviceLibrary
else
if
(
MoveInfo
.
MoveStep
.
Equals
(
StoreMoveStep
.
BS_06_WaitInLineSingle
))
{
MoveInfo
.
NextMoveStep
(
StoreMoveStep
.
BS_07_WaitTime
);
InOutStoreLog
(
moveName
+
MoveInfo
.
SLog
+
":再转动3000时间,同时等待收到FinishOut"
);
InOutStoreLog
(
moveName
+
MoveInfo
.
SLog
+
":再转动3000时间,同时等待收到FinishOut
,等待入料口无信号
"
);
MoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitTime
(
3000
));
MoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitIO
(
IO_Type
.
LineIn_Check
,
IO_VALUE
.
LOW
));
//等到agv离开
MoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitAgvAction
((
int
)
Asa
.
Actions
.
FinishOut
));
//MoveInfo.WaitList.Add(WaitResultInfo.WaitAgvAction(AGVAction
.FinishOut));
}
else
if
(
MoveInfo
.
MoveStep
.
Equals
(
StoreMoveStep
.
BS_07_WaitTime
))
{
...
...
@@ -252,7 +255,7 @@ namespace OnlineStore.DeviceLibrary
InOutStoreLog
(
moveName
+
MoveInfo
.
SLog
+
": ,同时等待 AGV离开,最多等待5000"
);
MoveInfo
.
OneWaitCanEndStep
=
true
;
MoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitTime
(
5000
));
MoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitAgvAction
((
int
)
Asa
.
Actions
.
FinishOut
));
//MoveInfo.WaitList.Add(WaitResultInfo.WaitAgvAction(action
.FinishOut));
}
else
if
(
MoveInfo
.
MoveStep
.
Equals
(
StoreMoveStep
.
BS_08_WaitAGVLeave
))
...
...
@@ -275,11 +278,11 @@ namespace OnlineStore.DeviceLibrary
#
region
AGV
internal
bool
ProcessAGVAction
(
string
name
,
Asa
.
Actions
action
)
internal
bool
ProcessAGVAction
(
string
name
,
string
action
)
{
string
logN
=
name
+
"收到调度【"
+
name
+
"】=【"
+
action
+
"】"
;
//状态处理
if
(
action
.
Equals
(
A
sa
.
Actions
.
Usable
))
if
(
action
.
Equals
(
A
GVAction
.
CanEnter
))
{
//判断入口是否可用:入口无料架,缓冲工位无料架,不在入料架处理中
bool
usable
=
(
storeRunStatus
.
Equals
(
StoreRunStatus
.
Runing
)
&&
...
...
@@ -289,10 +292,10 @@ namespace OnlineStore.DeviceLibrary
&&
IOValue
(
IO_Type
.
LineIn_Check
).
Equals
(
IO_VALUE
.
LOW
)
&&
IOValue
(
IO_Type
.
LineTake_Check
).
Equals
(
IO_VALUE
.
LOW
));
LogUtil
.
info
(
logN
+
":"
+
usable
);
LogUtil
.
info
(
logN
+
":"
+
usable
);
return
usable
;
}
else
if
(
action
.
Equals
(
A
sa
.
Actions
.
Arrive
))
else
if
(
action
.
Equals
(
A
GVAction
.
Arrive
))
{
//出库处理中不处理
if
(
MoveInfo
.
MoveType
.
Equals
(
StoreMoveType
.
OutStore
))
...
...
source/DeviceLibrary/ACPackingStore/PackingStoreBean.cs
查看文件 @
256f337
...
...
@@ -387,7 +387,7 @@ namespace OnlineStore.DeviceLibrary
WarnMsg
=
msg
;
}
internal
bool
AGVProcess
(
string
name
,
Actions
action
)
internal
bool
AGVProcess
(
string
name
,
string
action
)
{
foreach
(
AC_BOX_Bean
box
in
this
.
BoxMap
.
Values
)
{
...
...
source/DeviceLibrary/DeviceLibrary.csproj
查看文件 @
256f337
...
...
@@ -39,7 +39,8 @@
<Reference Include="Asa.IOModule.AIOBOX">
<HintPath>..\..\dll\Asa.IOModule.AIOBOX.dll</HintPath>
</Reference>
<Reference Include="Client">
<Reference Include="Client, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\dll\Client.dll</HintPath>
</Reference>
<Reference Include="CodeLibrary">
...
...
source/DeviceLibrary/agvClient/AgvClient.cs
查看文件 @
256f337
using
BLL
;
using
Asa
;
using
OnlineStore.Common
;
using
System
;
using
System.Collections.Generic
;
...
...
@@ -11,142 +11,134 @@ namespace OnlineStore.DeviceLibrary
public
class
AgvClient
{
private
static
string
ServerIp
=
ConfigAppSettings
.
GetValue
(
Setting_Init
.
AgvServerIp
);
//private string NodeName = "";
private
static
Client
agvClient
=
new
Client
(
ServerIp
);
public
static
Dictionary
<
string
,
Asa
.
Actions
>
actionMap
=
new
Dictionary
<
string
,
Asa
.
Actions
>();
public
static
List
<
string
>
NodeList
=
new
List
<
string
>();
public
static
void
Init
(
)
private
static
Client
agvClient
;
public
static
Dictionary
<
string
,
string
>
actionMap
=
new
Dictionary
<
string
,
string
>();
public
static
List
<
string
>
NodeList
=
new
List
<
string
>();
public
static
void
Init
()
{
try
{
// this.NodeName = nodeID;
if
(
agvClient
==
null
)
{
agvClient
=
new
Client
(
ServerIp
);
agvClient
=
new
Client
(
ServerIp
);
}
actionMap
=
new
Dictionary
<
string
,
Asa
.
Actions
>();
foreach
(
string
key
in
NodeList
)
actionMap
=
new
Dictionary
<
string
,
string
>();
foreach
(
string
key
in
NodeList
)
{
actionMap
.
Add
(
key
,
A
sa
.
Actions
.
ClientClos
e
);
actionMap
.
Add
(
key
,
A
GVAction
.
Non
e
);
}
agvClient
.
Info
+=
AgvClient_Info
;
agvClient
.
Log
+=
AgvClient_Log
;
agvClient
.
Connected
+=
AgvClient_Connected
;
agvClient
.
Action
+=
AgvClient_Action
;
agvClient
.
Arrive
+=
AgvClient_Arrive
;
agvClient
.
CanEnter
+=
AgvClient_CanEnter
;
agvClient
.
Ready
+=
AgvClient_Ready
;
agvClient
.
Connect
();
agvClient
.
SetNodeID
(
NodeList
.
ToArray
());
}
catch
(
Exception
ex
)
{
LogUtil
.
error
(
"初始化agvClient "
+
ServerIp
+
" 出错:"
+
ex
.
ToString
());
}
}
internal
static
bool
ISConnected
()
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
()
+
"] "
);
StoreManager
.
Store
.
AGVProcess
(
id
,
AGVAction
.
Ready
);
}
private
static
void
AgvClient_CanEnter
(
string
id
,
byte
[]
content
)
{
UpdateAction
(
id
,
AGVAction
.
CanEnter
);
RFIDData
data
=
new
RFIDData
(
content
);
LogUtil
.
info
(
"收到 AgvClient_Ready ["
+
id
+
"] ["
+
data
.
ToData
()
+
"] "
);
StoreManager
.
Store
.
AGVProcess
(
id
,
AGVAction
.
CanEnter
);
}
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
()
+
"] "
);
StoreManager
.
Store
.
AGVProcess
(
id
,
AGVAction
.
Arrive
);
}
internal
static
bool
ISConnected
()
{
if
(
agvClient
==
null
)
{
return
false
;
}
}
return
agvClient
.
IsConn
;
}
/// <summary>
///02 发送RFID
/// </summary>
/// <param name="NodeName"></param>
internal
static
void
SendRFID
(
string
NodeName
,
string
shelfId
)
internal
static
void
SendRFID
(
string
NodeName
,
string
rfid
)
{
byte
[]
data
=
null
;
agvClient
.
SendRFID
(
NodeName
,
data
);
}
/// <summary>
/// 10 准备空车
/// </summary>
/// <param name="NodeName"></param>
internal
static
void
ReadyEmpty
(
string
NodeName
)
agvClient
.
SendRFID
(
NodeName
,
rfid
);
}
internal
static
void
NeedEnter
(
string
NodeName
)
{
agvClient
.
ReadyEmpty
(
NodeName
);
agvClient
.
NeedEnter
(
NodeName
);
}
/// <summary>
/// 11 准备agv带料架
/// </summary>
/// <param name="NodeName"></param>
internal
static
void
ReadyShelf
(
string
NodeName
)
internal
static
void
NeedLeave
(
string
NodeName
)
{
agvClient
.
ReadyShelf
(
NodeName
);
agvClient
.
NeedLeave
(
NodeName
);
}
/// <summary>
/// 12 可以进入
/// </summary>
/// <param name="NodeName"></param>
internal
static
void
MayEnter
(
string
NodeName
)
{
agvClient
.
MayEnter
(
NodeName
);
}
/// <summary>
///13 完成进入
/// </summary>
/// <param name="NodeName"></param>
internal
static
void
FinishEnter
(
string
NodeName
)
{
agvClient
.
FinishEnter
(
NodeName
);
}
/// <summary>
/// 14 可以出去
/// </summary>
/// <param name="NodeName"></param>
internal
static
void
MayOut
(
string
NodeName
)
{
agvClient
.
MayOut
(
NodeName
);
}
/// <summary>
///17 agv离开
/// </summary>
/// <param name="NodeName"></param>
internal
static
void
GetOut
(
string
NodeName
)
internal
static
void
MayLeave
(
string
NodeName
)
{
agvClient
.
GetOut
(
NodeName
);
agvClient
.
MayLeave
(
NodeName
);
}
private
static
bool
AgvClient_Action
(
string
name
,
Asa
.
Actions
action
)
private
static
void
AgvClient_Log
(
string
s
)
{
if
(
actionMap
.
ContainsKey
(
name
))
try
{
actionMap
[
name
]
=
action
;
bool
isLog
=
ConfigAppSettings
.
GetIntValue
(
Setting_Init
.
Agv_Log_Open
).
Equals
(
1
);
if
(
isLog
)
{
LogUtil
.
info
(
" AGV "
+
ServerIp
+
" Log : "
+
s
);
}
}
else
catch
(
Exception
ex
)
{
actionMap
.
Add
(
name
,
action
);
LogUtil
.
error
(
"AgvClient_Log 出错:"
+
ex
.
ToString
()
);
}
return
StoreManager
.
Store
.
AGVProcess
(
name
,
action
);
}
private
static
void
AgvClient_Connected
()
{
agvClient
.
SetNodeID
(
NodeList
.
ToArray
());
}
private
static
void
AgvClient_Log
(
string
s
)
{
LogUtil
.
info
(
"AGV "
+
ServerIp
+
" Log:"
+
s
);
}
private
static
void
AgvClient_Info
(
string
s
)
{
LogUtil
.
info
(
"AGV "
+
ServerIp
+
" Info:"
+
s
);
}
public
static
Asa
.
Actions
GetAction
(
string
NodeName
)
public
static
string
GetAction
(
string
NodeName
)
{
if
(
actionMap
.
ContainsKey
(
NodeName
))
{
return
actionMap
[
NodeName
];
}
return
A
sa
.
Actions
.
ClientClos
e
;
return
A
GVAction
.
Non
e
;
}
public
static
void
Dispose
()
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
{
...
...
@@ -157,8 +149,17 @@ namespace OnlineStore.DeviceLibrary
}
catch
(
Exception
ex
)
{
LogUtil
.
error
(
"释放 agvClient "
+
ServerIp
+
" 出错:"
+
ex
.
ToString
());
LogUtil
.
error
(
"释放 agvClient "
+
ServerIp
+
" 出错:"
+
ex
.
ToString
());
}
}
}
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"
;
public
static
string
FinishOut
=
"FinishOut"
;
}
}
source/DeviceLibrary/device/RFID/RFIDManager.cs
查看文件 @
256f337
...
...
@@ -51,7 +51,7 @@ namespace OnlineStore.DeviceLibrary
{
//LogUtil.error("ReadRFID["+ip+"]出错:" + ex.ToString());
}
return
new
RFIDData
(
-
1
,
-
1
);
return
new
RFIDData
();
}
...
...
@@ -73,11 +73,11 @@ namespace OnlineStore.DeviceLibrary
/// <summary>
/// RFID类型,区分是料架还是托盘,托盘E=69,包装料料架A=65,料串=B
/// </summary>
public
char
RFType
=
'
A
'
;
public
char
RFType
=
'
0
'
;
public
int
Num
=
0
;
public
RFIDData
(
int
num
,
int
t
)
public
RFIDData
(
int
num
=
0
,
int
t
=
0
)
{
if
(
t
<
65
)
{
...
...
source/DeviceLibrary/store/model/StoreMoveInfo.cs
查看文件 @
256f337
...
...
@@ -267,11 +267,11 @@ namespace OnlineStore.DeviceLibrary
wait
.
IsHomeMove
=
false
;
return
wait
;
}
public
static
WaitResultInfo
WaitAgvAction
(
int
arrive
)
public
static
WaitResultInfo
WaitAgvAction
(
string
arrive
)
{
WaitResultInfo
wait
=
new
WaitResultInfo
();
wait
.
WaitType
=
WaitEnum
.
W010_AgvStatus
;
wait
.
TargetPosi
tion
=
arrive
;
wait
.
AgvAc
tion
=
arrive
;
return
wait
;
}
public
string
ToStr
()
...
...
@@ -319,7 +319,7 @@ namespace OnlineStore.DeviceLibrary
return
"扫码完成"
;
}
else
if
(
WaitType
.
Equals
(
WaitEnum
.
W010_AgvStatus
))
{
return
"Agv状态:"
+
(
Asa
.
Actions
)
TargetPosi
tion
;
return
"Agv状态:"
+
AgvAc
tion
;
}
else
{
...
...
@@ -372,7 +372,7 @@ namespace OnlineStore.DeviceLibrary
/// </summary>
public
bool
IsEnd
{
get
;
set
;
}
public
string
AgvAction
=
""
;
}
internal
class
WaitEnum
{
...
...
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论