Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
李娜
/
SO827-AssemblyLine
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
图表
网络
创建新的问题
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit 3cce09bf
由
LN
编写于
2021-01-28 11:06:43 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
1
1 个父辈
0918f3ac
显示空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
70 行增加
和
244 行删除
source/DeviceLibrary/agvClient/AgvClient -20200210-back.cs
source/DeviceLibrary/assemblyLine/MoveEquip_Partial.cs
source/DeviceLibrary/model/LineMoveInfo.cs
source/DeviceLibrary/server/LineServer.cs
source/DeviceLibrary/agvClient/AgvClient -20200210-back.cs
deleted
100644 → 0
查看文件 @
0918f3a
using
Asa
;
using
OnlineStore.Common
;
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
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
{
if
(
agvClient
==
null
)
{
agvClient
=
new
Client
(
ServerIp
);
}
actionMap
=
new
Dictionary
<
string
,
string
>();
foreach
(
string
key
in
NodeList
)
{
actionMap
.
Add
(
key
,
AGVAction
.
None
);
}
agvClient
.
Log
+=
AgvClient_Log
;
agvClient
.
Arrive
+=
AgvClient_Arrive
;
agvClient
.
CanEnter
+=
AgvClient_CanEnter
;
agvClient
.
Ready
+=
AgvClient_Ready
;
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
()
+
"] "
);
FeedingEquip
equip
=
getFeedEquip
(
id
);
if
(
equip
==
null
)
{
LogUtil
.
error
(
"收到 AgvClient_Ready ["
+
id
+
"] ["
+
data
.
ToData
()+
"] 未找到对应的设备 ,暂不处理"
);
return
;
}
equip
.
AgvReady
(
id
,
data
);
}
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
()
+
"] "
);
FeedingEquip
equip
=
getFeedEquip
(
id
);
if
(
equip
==
null
)
{
string
okName
=
""
;
foreach
(
FeedingEquip
feed
in
LineManager
.
Line
.
FeedingEquipMap
.
Values
)
{
if
(
id
.
Contains
(
feed
.
Config
.
AgvInName
))
{
if
(
feed
.
AgvCanEnter
(
id
,
data
))
{
okName
+=
feed
.
Config
.
AgvInName
;
}
}
}
agvClient
.
IsEnter
(
okName
);
return
;
}
else
{
bool
result
=
equip
.
AgvCanEnter
(
id
,
data
);
agvClient
.
IsEnter
(
equip
.
Config
.
AgvInName
);
}
}
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
()
+
"] "
);
FeedingEquip
equip
=
getFeedEquip
(
id
);
if
(
equip
==
null
)
{
LogUtil
.
error
(
"收到 AgvClient_Ready ["
+
id
+
"] ["
+
data
.
ToData
()
+
"] 未找到对应的设备 ,暂不处理 "
);
return
;
}
equip
.
AgvArrive
(
id
,
data
);
}
private
static
FeedingEquip
getFeedEquip
(
string
nodeId
)
{
foreach
(
FeedingEquip
feed
in
LineManager
.
Line
.
FeedingEquipMap
.
Values
)
{
if
(
feed
.
Config
.
AgvInName
.
Equals
(
nodeId
)
||
feed
.
Config
.
AgvOutName
.
Equals
(
nodeId
))
{
return
feed
;
}
}
return
null
;
}
internal
static
bool
ISConnected
()
{
if
(
agvClient
==
null
)
{
return
false
;
}
return
agvClient
.
IsConn
;
}
internal
static
void
SendRFID
(
string
NodeName
,
string
rfid
)
{
agvClient
.
SendRFID
(
NodeName
,
rfid
);
}
internal
static
void
NeedEnter
(
string
NodeName
)
{
agvClient
.
NeedEnter
(
NodeName
);
}
internal
static
void
NeedLeave
(
string
NodeName
)
{
agvClient
.
NeedLeave
(
NodeName
);
}
internal
static
void
MayEnter
(
string
NodeName
)
{
agvClient
.
MayEnter
(
NodeName
);
}
internal
static
void
FinishEnter
(
string
NodeName
)
{
agvClient
.
FinishEnter
(
NodeName
);
}
internal
static
void
MayLeave
(
string
NodeName
)
{
agvClient
.
MayLeave
(
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
{
if
(
agvClient
!=
null
)
{
agvClient
.
Close
();
}
}
catch
(
Exception
ex
)
{
LogUtil
.
error
(
"释放 agvClient "
+
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/assemblyLine/MoveEquip_Partial.cs
查看文件 @
3cce09b
...
@@ -435,6 +435,27 @@ namespace OnlineStore.DeviceLibrary
...
@@ -435,6 +435,27 @@ namespace OnlineStore.DeviceLibrary
else
if
(
MoveInfo
.
IsStep
(
LineMoveStep
.
MI_14_CylinderAfter
))
else
if
(
MoveInfo
.
IsStep
(
LineMoveStep
.
MI_14_CylinderAfter
))
{
{
MoveInfo
.
NextMoveStep
(
LineMoveStep
.
MI_15_SendPosToStore
);
MoveInfo
.
NextMoveStep
(
LineMoveStep
.
MI_15_SendPosToStore
);
string
code
=
MoveInfo
.
MoveParam
.
WareCode
;
if
(
OnlyProOutTray
)
{
if
(
MoveInfo
.
MoveParam
.
InStoreNg
)
{
OutLog
(
MoveInfo
.
SLog
+
",NG料已放到出料口,发送 cancelPutInTask "
);
string
msg
=
SServerManager
.
cancelPutInTask
(
Name
,
code
);
afterPutCutOK
=
true
;
}
else
{
OutLog
(
MoveInfo
.
SLog
+
",工单料到达接驳台,发送 arrive3fRobotLocation "
);
string
msg
=
SServerManager
.
arrive3fRobotLocation
(
Name
,
1
,
code
);
afterPutCutOK
=
true
;
}
}
else
{
afterPutCutOK
=
true
;
}
InLog
(
"入库 "
+
MoveInfo
.
SLog
+
",通知BOX开始入库,等待3000"
);
InLog
(
"入库 "
+
MoveInfo
.
SLog
+
",通知BOX开始入库,等待3000"
);
MoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitTime
(
3000
));
MoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitTime
(
3000
));
LineServer
.
StartInStore
(
DeviceID
,
MoveInfo
.
MoveParam
);
LineServer
.
StartInStore
(
DeviceID
,
MoveInfo
.
MoveParam
);
...
@@ -471,6 +492,7 @@ namespace OnlineStore.DeviceLibrary
...
@@ -471,6 +492,7 @@ namespace OnlineStore.DeviceLibrary
MoveEndS
();
MoveEndS
();
}
}
}
}
private
bool
afterPutCutOK
=
false
;
private
int
sendCount
=
0
;
private
int
sendCount
=
0
;
private
bool
IsInStoreNeed
()
private
bool
IsInStoreNeed
()
{
{
...
@@ -556,7 +578,7 @@ namespace OnlineStore.DeviceLibrary
...
@@ -556,7 +578,7 @@ namespace OnlineStore.DeviceLibrary
return
false
;
return
false
;
}
}
private
int
LastWidth
=
0
;
private
bool
ChekcIsNeedMoveReel
()
private
bool
ChekcIsNeedMoveReel
()
{
{
if
(
currTrayNum
<=
0
)
if
(
currTrayNum
<=
0
)
...
@@ -566,14 +588,31 @@ namespace OnlineStore.DeviceLibrary
...
@@ -566,14 +588,31 @@ namespace OnlineStore.DeviceLibrary
if
(
OnlyProOutTray
)
if
(
OnlyProOutTray
)
{
{
TrayInfo
tray
=
TrayManager
.
GetTrayInfo
(
currTrayNum
);
TrayInfo
tray
=
TrayManager
.
GetTrayInfo
(
currTrayNum
);
InOutParam
param
=
tray
.
InoutPar
;
if
(
tray
.
InOrOutStore
.
Equals
(
2
))
if
(
tray
.
InOrOutStore
.
Equals
(
2
))
{
{
//获取尺寸
int
robotIndex
=
0
;
string
code
=
SecondMoveInfo
.
MoveParam
.
WareCode
;
string
result
=
SServerManager
.
GetTraySize
(
Name
,
robotIndex
,
code
,
out
LastWidth
);
LogUtil
.
info
(
Name
+
"["
+
currTrayNum
+
"] ["
+
code
+
"] 获取尺寸【"
+
LastWidth
+
"】【"
+
result
+
"】"
);
if
(
LastWidth
>
0
)
{
SecondMoveInfo
.
MoveParam
=
param
.
Clone
();
return
true
;
return
true
;
}
else
if
(
tray
.
InoutPar
.
InStoreNg
)
}
else
{
{
LogUtil
.
info
(
Name
+
"["
+
currTrayNum
+
"] ["
+
tray
.
ToStr
()
+
"] 获取尺寸失败,托盘继续流转"
);
}
}
else
if
(
param
.
InStoreNg
)
{
SecondMoveInfo
.
MoveParam
=
param
.
Clone
();
return
true
;
return
true
;
}
}
}
return
false
;
}
return
false
;
}
}
private
bool
CheckIsNeedInStore
()
private
bool
CheckIsNeedInStore
()
...
...
source/DeviceLibrary/model/LineMoveInfo.cs
查看文件 @
3cce09b
...
@@ -296,37 +296,7 @@ namespace OnlineStore.DeviceLibrary
...
@@ -296,37 +296,7 @@ namespace OnlineStore.DeviceLibrary
wait
.
WaitType
=
WaitEnum
.
W009_BoxCanInstore
;
wait
.
WaitType
=
WaitEnum
.
W009_BoxCanInstore
;
return
wait
;
return
wait
;
}
}
//public static WaitResultInfo WaitSWCanTopUp(int swNum)
//{
// WaitResultInfo wait = new WaitResultInfo();
// wait.WaitType = WaitEnum.W010_SWCanTopUp;
// wait.TargetPosition = swNum;
// return wait;
//}
//public static WaitResultInfo WaitSideWay()
//{
// WaitResultInfo wait = new WaitResultInfo();
// wait.WaitType = WaitEnum.W010_SW34NoTray;
// return wait;
//}
/// <summary>
/// 等待出料移栽可以开始移栽
/// </summary>
//public static WaitResultInfo WaitProvidingEquipCanOut()
//{
// WaitResultInfo wait = new WaitResultInfo();
// wait.WaitType = WaitEnum.W201_ProvidingCanOut;
// return wait;
//}
/// <summary>
/// 等待出料流水线可以接收料盘
/// </summary>
//public static WaitResultInfo WaitDLineCanReviceTray()
//{
// WaitResultInfo wait = new WaitResultInfo();
// wait.WaitType = WaitEnum.W202_DLineCanOut;
// return wait;
//}
public
static
WaitResultInfo
WaitBatchAxis
(
ConfigMoveAxis
axis
,
int
targetPosition
,
int
targetSpeed
)
public
static
WaitResultInfo
WaitBatchAxis
(
ConfigMoveAxis
axis
,
int
targetPosition
,
int
targetSpeed
)
{
{
WaitResultInfo
wait
=
new
WaitResultInfo
();
WaitResultInfo
wait
=
new
WaitResultInfo
();
...
...
source/DeviceLibrary/server/LineServer.cs
查看文件 @
3cce09b
...
@@ -92,10 +92,22 @@ namespace OnlineStore.DeviceLibrary
...
@@ -92,10 +92,22 @@ namespace OnlineStore.DeviceLibrary
if
(
box
!=
null
&&
span
.
TotalSeconds
<
ClientKeepSecond
)
if
(
box
!=
null
&&
span
.
TotalSeconds
<
ClientKeepSecond
)
{
{
if
(
id
.
Equals
(
7
))
{
LineStatus
status
=
(
LineStatus
)
box
.
SStatus
;
LineRunStatus
runs
=
(
LineRunStatus
)
box
.
SRunStatus
;
if
(
runs
.
Equals
(
LineRunStatus
.
Busy
))
{
if
(
status
.
Equals
(
LineStatus
.
InStoreEnd
)
||
status
.
Equals
(
LineStatus
.
InStoreExecute
)
||
box
.
WaitInStoreList
.
Contains
(
posId
))
{
return
true
;
}
}
}
else
{
LineStatus
status
=
(
LineStatus
)
box
.
SStatus
;
LineStatus
status
=
(
LineStatus
)
box
.
SStatus
;
LineRunStatus
runs
=
(
LineRunStatus
)
box
.
SRunStatus
;
LineRunStatus
runs
=
(
LineRunStatus
)
box
.
SRunStatus
;
if
(
runs
.
Equals
(
LineRunStatus
.
Busy
))
if
(
runs
.
Equals
(
LineRunStatus
.
Busy
))
{
{
if
(
status
.
Equals
(
LineStatus
.
InStoreEnd
)
||
status
.
Equals
(
LineStatus
.
InStoreExecute
))
if
(
status
.
Equals
(
LineStatus
.
InStoreEnd
)
||
status
.
Equals
(
LineStatus
.
InStoreExecute
))
...
@@ -109,6 +121,7 @@ namespace OnlineStore.DeviceLibrary
...
@@ -109,6 +121,7 @@ namespace OnlineStore.DeviceLibrary
}
}
}
}
}
}
}
return
false
;
return
false
;
}
}
/// <summary>
/// <summary>
...
@@ -121,10 +134,19 @@ namespace OnlineStore.DeviceLibrary
...
@@ -121,10 +134,19 @@ namespace OnlineStore.DeviceLibrary
BoxInfo
box
=
GetBoxInfo
(
id
);
BoxInfo
box
=
GetBoxInfo
(
id
);
if
(
box
!=
null
)
if
(
box
!=
null
)
{
{
LineRunStatus
runs
=
(
LineRunStatus
)
box
.
SRunStatus
;
TimeSpan
span
=
DateTime
.
Now
-
box
.
LastMsgTime
;
TimeSpan
span
=
DateTime
.
Now
-
box
.
LastMsgTime
;
if
(
span
.
TotalSeconds
<
ClientKeepSecond
&&
box
.
HasTray
.
Equals
(
0
)
&&
box
.
SAlarmType
.
Equals
(
LineAlarmType
.
None
))
if
(
span
.
TotalSeconds
<
ClientKeepSecond
&&
box
.
HasTray
.
Equals
(
0
)
&&
box
.
SAlarmType
.
Equals
(
LineAlarmType
.
None
))
{
{
LineRunStatus
runs
=
(
LineRunStatus
)
box
.
SRunStatus
;
if
(
id
.
Equals
(
7
))
{
if
(
box
.
WaitInStoreList
==
null
||
box
.
WaitInStoreList
.
Count
<=
0
)
{
return
true
;
}
}
else
{
if
(
runs
.
Equals
(
LineRunStatus
.
Runing
))
if
(
runs
.
Equals
(
LineRunStatus
.
Runing
))
{
{
...
@@ -132,6 +154,7 @@ namespace OnlineStore.DeviceLibrary
...
@@ -132,6 +154,7 @@ namespace OnlineStore.DeviceLibrary
}
}
}
}
}
}
}
return
false
;
return
false
;
}
}
/// <summary>
/// <summary>
...
@@ -432,7 +455,7 @@ namespace OnlineStore.DeviceLibrary
...
@@ -432,7 +455,7 @@ namespace OnlineStore.DeviceLibrary
public
static
string
S_WareCode
=
"WareCode"
;
public
static
string
S_WareCode
=
"WareCode"
;
public
static
string
S_IsDebug
=
"IsDebug"
;
public
static
string
S_IsDebug
=
"IsDebug"
;
public
static
string
S_RFID
=
"rfid"
;
public
static
string
S_RFID
=
"rfid"
;
public
static
string
S_NG
=
"
rfid
"
;
public
static
string
S_NG
=
"
IsNg
"
;
}
}
public
class
StoreReviceBean
public
class
StoreReviceBean
...
...
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论