Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
孙克
/
RC1250-ACPackingStore
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit 3b0cd387
由
LN
编写于
2019-11-28 12:00:28 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
调整料架进出逻辑
1 个父辈
2ae1c884
隐藏空白字符变更
内嵌
并排
正在显示
15 个修改的文件
包含
1209 行增加
和
1387 行删除
source/DeviceLibrary/ACPackingStore/AC_BOX_Bean.cs
source/DeviceLibrary/ACPackingStore/AC_BOX_Bean_Partial.cs
source/DeviceLibrary/ACPackingStore/AC_BOX_Bean_Shelf.cs
source/DeviceLibrary/ACPackingStore/PackingStoreBean.cs
source/DeviceLibrary/ACPackingStore/PackingStoreBean_Partial.cs
source/DeviceLibrary/ACPackingStore/StoreManager.cs
source/DeviceLibrary/DeviceLibrary.csproj
source/DeviceLibrary/StoreConfig/BoxConfig_1.csv
source/DeviceLibrary/StoreConfig/BoxConfig_2.csv
source/DeviceLibrary/store/AutoInoutInfo.cs
source/DeviceLibrary/store/InOutParam.cs
source/DeviceLibrary/store/KTK_Store.cs
source/DeviceLibrary/store/StoreStep.cs
source/DeviceLibrary/store/model/StoreMoveInfo.cs
source/LoadCVSLibrary/storeConfig/ConfigItemBase.cs
source/DeviceLibrary/ACPackingStore/AC_BOX_Bean.cs
查看文件 @
3b0cd38
...
...
@@ -3,6 +3,7 @@ using Asa;
using
OnlineStore.Common
;
using
OnlineStore.LoadCSVLibrary
;
using
System
;
using
System.Collections.Concurrent
;
using
System.Collections.Generic
;
using
System.Diagnostics
;
using
System.Linq
;
...
...
@@ -18,18 +19,18 @@ namespace OnlineStore.DeviceLibrary
public
partial
class
AC_BOX_Bean
:
KTK_Store
{
private
static
bool
IsIntSlvBlock
=
false
;
public
AutoInoutInfo
AutoInout
=
new
AutoInoutInfo
();
public
AutoInoutInfo
AutoInout
=
new
AutoInoutInfo
();
public
string
CID
=
""
;
public
AC_BOX_Config
Config
;
public
AC_BOX_Config
Config
;
public
string
lastPosId
=
""
;
public
StoreStatus
lastPosIdStatus
=
StoreStatus
.
StoreOnline
;
public
List
<
ConfigMoveAxis
>
moveAxisList
=
new
List
<
ConfigMoveAxis
>();
public
List
<
ConfigMoveAxis
>
moveAxisList
=
new
List
<
ConfigMoveAxis
>();
public
List
<
string
>
PositionNumList
=
new
List
<
string
>();
public
List
<
string
>
ShelfPosList
=
new
List
<
string
>();
/// <summary>
/// 料架未放料盘的位置列表
/// </summary>
public
Queue
<
string
>
EmprtShelfList
=
new
Queue
<
string
>();
public
ConcurrentQueue
<
string
>
EmprtShelfList
=
new
Concurrent
Queue
<
string
>();
public
HumitureBean
humBean
=
null
;
private
System
.
Timers
.
Timer
serverConnectTimer
=
new
System
.
Timers
.
Timer
();
...
...
@@ -57,7 +58,7 @@ namespace OnlineStore.DeviceLibrary
this
.
DeviceID
=
config
.
DeviceID
;
this
.
Config
=
config
;
//温湿度
humBean
=
new
HumitureBean
(
config
.
Humiture_Port
,
Name
);
humBean
=
new
HumitureBean
(
config
.
Humiture_Port
,
Name
);
humBean
.
Init
();
moveAxisList
=
new
List
<
ConfigMoveAxis
>();
MoveAxisConfig
();
...
...
@@ -117,7 +118,7 @@ namespace OnlineStore.DeviceLibrary
moveAxisList
.
Add
(
Config
.
Middle_Axis
);
moveAxisList
.
Add
(
Config
.
UpDown_Axis
);
moveAxisList
.
Add
(
Config
.
InOut_Axis
);
moveAxisList
.
Add
(
Config
.
Comp_Axis
);
moveAxisList
.
Add
(
Config
.
Comp_Axis
);
}
/// <summary>
...
...
@@ -168,7 +169,7 @@ namespace OnlineStore.DeviceLibrary
mainTimer
.
Enabled
=
true
;
IoCheckTimer
.
Enabled
=
true
;
serverConnectTimer
.
Enabled
=
true
;
return
true
;
}
else
...
...
@@ -190,9 +191,9 @@ namespace OnlineStore.DeviceLibrary
#
region
原点返回和复位处理
private
void
ReturnHome
()
{
{
AutoInout
.
ClearCount
();
storeRunStatus
=
StoreRunStatus
.
HomeMoving
;
MoveInfo
.
NewMove
(
StoreMoveType
.
ReturnHome
);
...
...
@@ -204,7 +205,7 @@ namespace OnlineStore.DeviceLibrary
MoveInfo
.
NewMove
(
StoreMoveType
.
StoreReset
);
MoveInfo
.
NextMoveStep
(
StoreMoveStep
.
BOX_H54_TOP1_InOutToP1
);
LogInfo
(
"到待机状态,进出轴到P1,判断叉子没有料盘"
);
ACAxisMove
(
Config
.
InOut_Axis
,
Config
.
InOutAxis_P1_Position
,
Config
.
InOutAxis_P1_Speed
);
ACAxisMove
(
Config
.
InOut_Axis
,
Config
.
InOutAxis_P1_Position
,
Config
.
InOutAxis_P1_Speed
);
}
public
override
void
Reset
(
bool
isNeedClearAuto
=
true
)
...
...
@@ -223,8 +224,8 @@ namespace OnlineStore.DeviceLibrary
{
LogInfo
(
"复位时打开轴失败,需要再次复位,直接报警停止复位"
);
return
;
}
InoutStartReset
();
}
InoutStartReset
();
isInPro
=
false
;
}
private
void
InoutStartReset
()
...
...
@@ -242,7 +243,7 @@ namespace OnlineStore.DeviceLibrary
//开始复位动作
MoveInfo
.
NextMoveStep
(
StoreMoveStep
.
BOX_H01_DoorClose
);
LogInfo
(
MoveInfo
.
MoveType
+
": 线体停止,入口移门关闭,NG升降门下降"
);
LogInfo
(
MoveInfo
.
MoveType
+
": 线体停止,入口移门关闭,NG升降门下降"
);
IOMove
(
IO_Type
.
Line_BackRun
,
IO_VALUE
.
LOW
);
IOMove
(
IO_Type
.
Line_Run
,
IO_VALUE
.
LOW
);
CylinderMove
(
MoveInfo
,
IO_Type
.
NGDoowCylinder_Up
,
IO_Type
.
NGDoorCylinder_Down
);
...
...
@@ -264,7 +265,7 @@ namespace OnlineStore.DeviceLibrary
}
switch
(
MoveInfo
.
MoveStep
)
{
case
StoreMoveStep
.
BOX_H01_DoorClose
:
MoveInfo
.
NextMoveStep
(
StoreMoveStep
.
BOX_H03_InOutBack
);
ACAxisHomeMove
(
Config
.
InOut_Axis
);
...
...
@@ -300,54 +301,36 @@ namespace OnlineStore.DeviceLibrary
LogInfo
(
MoveInfo
.
MoveType
+
": 旋转轴运动到P1,上下轴走到P1,压紧轴到P1!"
);
ACAxisMove
(
Config
.
Middle_Axis
,
Config
.
MiddleAxis_P1
,
Config
.
MiddleAxis_P1_Speed
);
ACAxisMove
(
Config
.
UpDown_Axis
,
Config
.
UpDownAxis_P1
,
Config
.
UpDownAxis_P1_Speed
);
ACAxisMove
(
Config
.
Comp_Axis
,
Config
.
CompAxis_P1_Position
,
Config
.
CompAxis_P1_Speed
);
ACAxisMove
(
Config
.
Comp_Axis
,
Config
.
CompAxis_P1_Position
,
Config
.
CompAxis_P1_Speed
);
break
;
case
StoreMoveStep
.
BOX_H06_MiddleAxisToP1
:
LogInfo
(
MoveInfo
.
MoveType
+
": 完成"
);
storeRunStatus
=
StoreRunStatus
.
Runing
;
MoveInfo
.
EndMove
();
storeStatus
=
StoreStatus
.
StoreOnline
;
if
(
alarmType
.
Equals
(
StoreAlarmType
.
None
))
{
WarnMsg
=
""
;
}
LogInfo
(
MoveInfo
.
MoveType
+
": 完成"
);
MoveEndToRuningStatus
();
break
;
case
StoreMoveStep
.
BOX_H54_TOP1_InOutToP1
:
MoveInfo
.
NextMoveStep
(
StoreMoveStep
.
BOX_H55_TOP1_CompressHome
);
LogInfo
(
"到待机状态,压紧轴回原点,关闭舱门"
);
ACAxisHomeMove
(
Config
.
Comp_Axis
);
ACAxisHomeMove
(
Config
.
Comp_Axis
);
break
;
case
StoreMoveStep
.
BOX_H55_TOP1_CompressHome
:
MoveInfo
.
NextMoveStep
(
StoreMoveStep
.
BOX_H56_TOP1_OtherAxisToP1
);
LogInfo
(
MoveInfo
.
MoveType
+
": 旋转轴运动到P1,上下轴走到P1,压紧轴到P1!"
);
ACAxisMove
(
Config
.
Middle_Axis
,
Config
.
MiddleAxis_P1
,
Config
.
MiddleAxis_P1_Speed
);
ACAxisMove
(
Config
.
UpDown_Axis
,
Config
.
UpDownAxis_P1
,
Config
.
UpDownAxis_P1_Speed
);
ACAxisMove
(
Config
.
Comp_Axis
,
Config
.
CompAxis_P1_Position
,
Config
.
CompAxis_P1_Speed
);
ACAxisMove
(
Config
.
Comp_Axis
,
Config
.
CompAxis_P1_Position
,
Config
.
CompAxis_P1_Speed
);
break
;
case
StoreMoveStep
.
BOX_H56_TOP1_OtherAxisToP1
:
LogInfo
(
"到待机状态完成"
);
MoveInfo
.
EndMove
();
storeStatus
=
StoreStatus
.
StoreOnline
;
storeRunStatus
=
StoreRunStatus
.
Runing
;
if
(
alarmType
.
Equals
(
StoreAlarmType
.
None
))
{
WarnMsg
=
""
;
}
LogInfo
(
"到待机状态完成"
);
MoveEndToRuningStatus
();
break
;
default
:
break
;
}
}
/// <summary>
/// 原点返回处理
/// </summary>
protected
override
void
ReturnHomeProcess
()
{
ResetProcess
();
}
#
endregion
public
bool
RunAxis
(
bool
isCheck
)
...
...
@@ -431,7 +414,7 @@ namespace OnlineStore.DeviceLibrary
IOMove
(
IO_Type
.
Axis_Brake
,
IO_VALUE
.
LOW
);
foreach
(
ConfigMoveAxis
axis
in
moveAxisList
)
{
ACServerManager
.
ServoOff
(
axis
.
DeviceName
,
axis
.
GetAxisValue
());
ACServerManager
.
ServoOff
(
axis
.
DeviceName
,
axis
.
GetAxisValue
());
}
Thread
.
Sleep
(
100
);
IOMove
(
IO_Type
.
Run_Signal
,
IO_VALUE
.
LOW
);
...
...
@@ -452,10 +435,10 @@ namespace OnlineStore.DeviceLibrary
storeRunStatus
=
StoreRunStatus
.
Wait
;
mainTimer
.
Enabled
=
false
;
TimeSpan
span
=
DateTime
.
Now
-
StartTime
;
//LineConnect.StopConnect();
// IOManager.instance.CloseAllDO();
// IOManager.instance.CloseAllDO();
LogInfo
(
",停止运行,总运行时间:"
+
span
.
ToString
());
}
...
...
@@ -475,20 +458,20 @@ namespace OnlineStore.DeviceLibrary
if
(
alarmType
.
Equals
(
StoreAlarmType
.
AxisAlarm
)
|
alarmType
.
Equals
(
StoreAlarmType
.
AxisMoveError
))
{
LogUtil
.
error
(
Name
+
"轴报警, 停止运动, 打开报警灯"
);
StopMove
();
}
else
if
(
alarmType
==
StoreAlarmType
.
SuddenStop
)
{
isInSuddenDown
=
true
;
LogUtil
.
error
(
Name
+
"收到急停信号,停止运动, 打开报警灯 "
);
LogUtil
.
error
(
Name
+
"收到急停信号,停止运动, 打开报警灯 "
);
StopMove
();
storeStatus
=
StoreStatus
.
SuddenStop
;
}
else
if
(
alarmType
.
Equals
(
StoreAlarmType
.
NoAirCheck
))
{
isNoAirCheck
=
true
;
LogUtil
.
error
(
Name
+
" 未检测到气压信号 ,停止运动, 打开报警灯 "
);
LogUtil
.
error
(
Name
+
" 未检测到气压信号 ,停止运动, 打开报警灯 "
);
StopMove
();
storeStatus
=
StoreStatus
.
SuddenStop
;
}
...
...
@@ -690,10 +673,10 @@ namespace OnlineStore.DeviceLibrary
{
return
;
}
if
(
storeRunStatus
<
StoreRunStatus
.
Runing
||
isInSuddenDown
||
isNoAirCheck
)
if
(
storeRunStatus
<
StoreRunStatus
.
Runing
||
isInSuddenDown
||
isNoAirCheck
)
{
return
;
}
}
//若BOX和移栽都没有在等待Io的过程中则此Io超时异常可能已经处理过
if
(
MoveInfo
.
IsInWait
==
false
)
{
...
...
@@ -715,7 +698,7 @@ namespace OnlineStore.DeviceLibrary
private
void
AutoResetProcess
()
{
try
{
{
bool
noInStore
=
true
;
if
(
AutoInout
.
CurrInOutACount
>=
this
.
Config
.
Box_ResetACount
&&
noInStore
)
{
...
...
@@ -728,28 +711,16 @@ namespace OnlineStore.DeviceLibrary
LogInfo
(
"已经累计出入库"
+
AutoInout
.
CurrInOutACount
+
"次,需要复位一下"
);
Reset
();
}
}
else
if
(
CanStarInOut
())
return
;
}
else
if
(
waitOutStoreList
.
Count
>
0
)
{
InOutParam
param
=
null
;
lock
(
waitOutListLock
)
{
if
(
waitOutStoreList
.
Count
>
0
&&
CanStarInOut
())
{
param
=
waitOutStoreList
[
0
];
waitOutStoreList
.
RemoveAt
(
0
);
}
}
if
(
param
!=
null
)
{
//出库
bool
result
=
waitOutStoreList
.
TryDequeue
(
out
param
);
if
(
result
&&
param
!=
null
)
{
LogInfo
(
"开始执行排队中的出库【"
+
param
.
ToStr
()
+
"】"
);
bool
result
=
StartOutStoreMove
(
new
InOutParam
(
param
.
WareCode
,
param
.
PosID
,
param
.
PlateH
,
param
.
PlateW
,
param
.
ShelfPosID
));
if
(!
result
)
{
LogInfo
(
" 执行排队中的出库【"
+
param
.
ToStr
()
+
"】失败,重新加入等待队列"
);
AddWaitOutInfo
(
param
);
}
StartExecuctOut
(
param
);
}
}
}
...
...
@@ -758,6 +729,7 @@ namespace OnlineStore.DeviceLibrary
LogUtil
.
error
(
Name
+
"处理出入库排队列表出错:"
+
ex
.
ToString
());
}
}
/// <summary>
/// 判断是否报警,返回 true表示报警 报警检测2秒钟检测一次
...
...
@@ -774,7 +746,7 @@ namespace OnlineStore.DeviceLibrary
//在回原点,复位,出入库时,检测报警间隔减小
if
((
storeRunStatus
.
Equals
(
StoreRunStatus
.
Runing
)
&&
span
.
TotalSeconds
<
3
)
||
span
.
TotalSeconds
<
1
)
{
return
false
;
return
false
;
}
checkAlarmTime
=
DateTime
.
Now
;
bool
isInAlarm
=
false
;
...
...
@@ -786,7 +758,7 @@ namespace OnlineStore.DeviceLibrary
if
(
ACServerManager
.
GetAlarmStatus
(
deviceName
,
axis
)
==
1
)
{
WarnMsg
=
Name
+
" 运动轴"
+
axisInfo
.
Explain
+
"报警"
;
WarnMsg
=
Name
+
" 运动轴"
+
axisInfo
.
Explain
+
"报警"
;
Alarm
(
StoreAlarmType
.
AxisAlarm
,
GetAlarmCodeByAxis
(
axisInfo
).
ToString
(),
WarnMsg
,
StoreMoveType
.
None
);
isInAlarm
=
true
;
}
...
...
@@ -811,26 +783,17 @@ namespace OnlineStore.DeviceLibrary
LogInfo
(
"StopMove"
);
isInPro
=
false
;
}
/// <summary>
/// 判断是可以开始出入库(当前在忙碌状态则需要排队等待)
/// </summary>
/// <returns></returns>
public
bool
CanStarInOut
()
{
if
(
isInSuddenDown
||
isNoAirCheck
||
(!
storeRunStatus
.
Equals
(
StoreRunStatus
.
Runing
))
||
storeStatus
.
Equals
(
StoreStatus
.
InStoreExecute
)
||
storeStatus
.
Equals
(
StoreStatus
.
OutStoreExecute
)
||
storeStatus
.
Equals
(
StoreStatus
.
InStoreEnd
)
||
storeStatus
.
Equals
(
StoreStatus
.
OutStoreBoxEnd
))
private
void
MoveEndToRuningStatus
()
{
MoveInfo
.
EndMove
();
storeRunStatus
=
StoreRunStatus
.
Runing
;
storeStatus
=
StoreStatus
.
StoreOnline
;
if
(
alarmType
.
Equals
(
StoreAlarmType
.
None
))
{
return
false
;
WarnMsg
=
""
;
}
return
true
;
}
#
region
与服务器通信定时器,每
1
秒向服务器通知一次状态
,
同时执行出库操作
private
string
CodeMsg
=
""
;
...
...
@@ -855,7 +818,7 @@ namespace OnlineStore.DeviceLibrary
{
LogUtil
.
error
(
Name
+
"定时SendLineStatus出错:"
+
ex
.
ToString
());
}
}
}
isInProcess
=
false
;
}
...
...
@@ -875,7 +838,7 @@ namespace OnlineStore.DeviceLibrary
{
lineOperation
.
status
=
(
int
)
StoreStatus
.
Warning
;
lineOperation
.
msg
=
WarnMsg
;
}
}
lineOperation
.
status
=
(
int
)
StoreStatus
.
StoreOnline
;
BoxStatus
boxStatus
=
new
BoxStatus
();
...
...
@@ -1022,14 +985,14 @@ namespace OnlineStore.DeviceLibrary
}
else
{
InOutParam
currInOutFixture
=
new
InOutParam
(
""
,
posId
,
plateW
,
plateH
);
InOutParam
inoutParam
=
new
InOutParam
(
""
,
posId
,
plateW
,
plateH
,
""
);
try
{
//判断是否接收过此库位的出库信息
if
(
MoveInfo
.
MoveType
.
Equals
(
StoreMoveType
.
OutStore
)
&&
MoveInfo
.
MoveParam
.
PosID
.
Equals
(
posId
))
{
LogInfo
(
" 收到出库【"
+
currInOutFixture
.
ToStr
()
+
"】重复,当前已在【"
+
posId
+
"】出库中"
);
LogInfo
(
" 收到出库【"
+
inoutParam
.
ToStr
()
+
"】重复,当前已在【"
+
posId
+
"】出库中"
);
continue
;
}
else
...
...
@@ -1039,42 +1002,31 @@ namespace OnlineStore.DeviceLibrary
reviceList
=
(
from
m
in
reviceList
where
m
.
PosID
.
Equals
(
posId
)
select
m
).
ToList
<
InOutParam
>();
if
(
reviceList
.
Count
>
0
)
{
LogInfo
(
" 收到出库【"
+
currInOutFixture
.
ToStr
()
+
"】重复,排队列表中已存在【"
+
reviceList
[
0
].
ToStr
()
+
"】"
);
LogInfo
(
" 收到出库【"
+
inoutParam
.
ToStr
()
+
"】重复,排队列表中已存在【"
+
reviceList
[
0
].
ToStr
()
+
"】"
);
continue
;
}
}
}
catch
(
Exception
ex
)
{
LogUtil
.
error
(
"验证出库【"
+
currInOutFixture
.
ToStr
()
+
"】是否重复出错:"
+
ex
.
ToString
());
LogUtil
.
error
(
"验证出库【"
+
inoutParam
.
ToStr
()
+
"】是否重复出错:"
+
ex
.
ToString
());
}
string
shelfPosId
=
""
;
if
(
EmprtShelfList
.
Count
>
0
)
string
shelfPosID
=
""
;
bool
hasShelf
=
EmprtShelfList
.
TryDequeue
(
out
shelfPosID
);
if
(
hasShelf
)
{
shelfPosId
=
EmprtShelfList
.
Dequeue
();
inoutParam
.
NeedEnterShelf
=
false
;
inoutParam
.
NeedOutShelf
=
false
;
inoutParam
.
ShelfPosID
=
shelfPosID
;
}
else
{
LogUtil
.
error
(
Name
+
"执行出库【"
+
currInOutFixture
.
ToStr
()
+
"】失败,料架没有空位置"
);
}
if
(
CanStarInOut
()
&&
String
.
IsNullOrEmpty
(
shelfPosId
).
Equals
(
false
))
//if (CanStarInOut() &&( LineConnect.CanStartOut()||IsDebug))
{
bool
result
=
StartOutStoreMove
(
new
InOutParam
(
""
,
posId
,
plateW
,
plateH
,
shelfPosId
));
if
(!
result
)
{
LogInfo
(
" 执行出库【"
+
currInOutFixture
.
ToStr
()
+
"】失败,加入等待队列"
);
AddWaitOutInfo
(
currInOutFixture
);
}
}
else
{
LogUtil
.
error
(
Name
+
"执行出库【"
+
currInOutFixture
.
ToStr
()
+
"】失败,当前在忙碌中,加入等待队列"
);
AddWaitOutInfo
(
currInOutFixture
);
inoutParam
.
NeedEnterShelf
=
true
;
inoutParam
.
NeedOutShelf
=
false
;
LogUtil
.
error
(
Name
+
"执行出库【"
+
inoutParam
.
ToStr
()
+
"】,么有空料架,需要使用新料架"
);
}
StartExecuctOut
(
inoutParam
);
}
}
TimeSpan
span
=
DateTime
.
Now
-
time
;
if
(
span
.
TotalMilliseconds
>
10
)
...
...
@@ -1084,6 +1036,6 @@ namespace OnlineStore.DeviceLibrary
}
}
#
endregion
}
}
\ No newline at end of file
source/DeviceLibrary/ACPackingStore/AC_BOX_Bean_Partial.cs
查看文件 @
3b0cd38
using
OnlineStore.Common
;
using
OnlineStore.LoadCSVLibrary
;
using
System
;
using
System.Collections.Concurrent
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Text
;
using
System.Threading
;
using
System.Threading.Tasks
;
namespace
OnlineStore.DeviceLibrary
{
...
...
@@ -35,7 +37,7 @@ namespace OnlineStore.DeviceLibrary
continue
;
}
NotOkMsg
=
wait
.
ToStr
();
if
(
wait
.
WaitType
==
1
)
if
(
wait
.
WaitType
.
Equals
(
WaitEnum
.
W001_AxisMove
)
)
{
string
msg
=
""
;
if
(
wait
.
IsHomeMove
)
...
...
@@ -54,11 +56,11 @@ namespace OnlineStore.DeviceLibrary
break
;
}
}
else
if
(
wait
.
WaitType
==
2
)
else
if
(
wait
.
WaitType
.
Equals
(
WaitEnum
.
W002_IOValue
)
)
{
wait
.
IsEnd
=
IOValue
(
wait
.
IoType
).
Equals
(
wait
.
IoValue
);
int
timeOutMs
=
Config
.
IOSingle_TimerOut
;
if
((!
wait
.
IsEnd
)
&&
span
.
TotalMilliseconds
>
timeOutMs
)
{
ConfigIO
io
=
Config
.
getWaitIO
(
wait
.
IoType
);
...
...
@@ -67,26 +69,16 @@ namespace OnlineStore.DeviceLibrary
LogUtil
.
error
(
Name
+
wait
.
IoType
+
"等待信号("
+
io
.
DisplayStr
+
"="
+
wait
.
IoValue
+
") 超时"
,
14
);
isOk
=
false
;
break
;
}
//else if ((!wait.IsEnd) && MoveInfo.MoveStep.Equals(StoreMoveStep.SO_14_WaitTake) && LineConnect.CanReSend())
//{
// //判断是否需要重发入库结束命令
// SendOutStoreEnd(MoveInfo);
//}
}
}
else
if
(
wait
.
WaitType
==
3
)
else
if
(
wait
.
WaitType
.
Equals
(
WaitEnum
.
W003_Time
)
)
{
wait
.
IsEnd
=
(
span
.
TotalMilliseconds
>=
wait
.
TimeMSeconds
);
}
else
if
(
wait
.
WaitType
==
7
)
{
//wait.IsEnd = (wait.HeightValue.Equals(GetHeight()));
//if (wait.IsEnd)
//{
// LogUtil.debug("等待height=" + wait.HeightValue + "完成");
//}
else
if
(
wait
.
WaitType
.
Equals
(
WaitEnum
.
W007_ReelHeight
))
{
}
else
if
(
wait
.
WaitType
.
Equals
(
8
))
else
if
(
wait
.
WaitType
.
Equals
(
WaitEnum
.
W008_Compress
))
{
string
msg
=
""
;
if
(
IOValue
(
TargetIoType
).
Equals
(
TargetIoValue
))
...
...
@@ -103,10 +95,11 @@ namespace OnlineStore.DeviceLibrary
wait
.
IsEnd
=
result
;
}
}
else
if
(
wait
.
WaitType
.
Equals
(
9
))
else
if
(
wait
.
WaitType
.
Equals
(
WaitEnum
.
W009_ScanCode
))
{
wait
.
IsEnd
=
(
LastScanCodes
.
Count
>
0
);
}
else
if
(
wait
.
WaitType
.
Equals
(
10
))
}
else
if
(
wait
.
WaitType
.
Equals
(
WaitEnum
.
W010_AgvStatus
))
{
int
agvA
=
(
int
)
AgvClient
.
GetAction
(
Config
.
AgvNodeName
);
wait
.
IsEnd
=
agvA
.
Equals
(
wait
.
TargetPosition
);
...
...
@@ -157,7 +150,128 @@ namespace OnlineStore.DeviceLibrary
}
#
endregion
public
ConcurrentQueue
<
InOutParam
>
waitOutStoreList
=
new
ConcurrentQueue
<
InOutParam
>();
private
List
<
string
>
LastScanCodes
=
new
List
<
string
>();
private
int
ComTargetPosition
=
0
;
private
int
LastWidth
=
0
;
private
int
LastHeight
=
0
;
private
RFIDData
LastShelfData
=
new
RFIDData
(
0
);
#
region
入库
private
void
ClearLastTrayInfo
()
{
LastScanCodes
=
new
List
<
string
>();
ComTargetPosition
=
0
;
LastWidth
=
0
;
LastHeight
=
0
;
}
private
DateTime
startInStoreTime
=
DateTime
.
Now
;
/// <summary>
/// 开始单盘入库
/// </summary>
public
override
void
StartInStoreMove
(
InOutParam
param
)
{
startInStoreTime
=
DateTime
.
Now
;
string
posId
=
param
!=
null
?
param
.
PosID
:
""
;
if
(
isInSuddenDown
||
isNoAirCheck
||
(!
storeRunStatus
.
Equals
(
StoreRunStatus
.
Runing
))
||
(!
MoveInfo
.
MoveType
.
Equals
(
StoreMoveType
.
None
)))
{
LogUtil
.
error
(
Name
+
" 启动出库出错,忙碌或报警中 ,storeStatus="
+
storeRunStatus
+
",MoveType="
+
MoveInfo
.
MoveType
+
",isInSuddenDown="
+
isInSuddenDown
+
",isNoAirCheck"
+
isNoAirCheck
);
return
;
}
if
(!
StoreManager
.
LoadInoutParam
(
param
,
true
,
this
))
{
LogUtil
.
error
(
Name
+
" 启动入库【"
+
posId
+
"】出错,找不到库位信息"
);
return
;
}
if
(
IOValue
(
IO_Type
.
TrayCheck_Fixture
).
Equals
(
IO_VALUE
.
HIGH
))
{
LogUtil
.
error
(
Name
+
" 启动入库【"
+
posId
+
"】出错,叉子料盘检测有料"
);
return
;
}
param
.
NeedEnterShelf
=
false
;
param
.
NeedOutShelf
=
false
;
LogInfo
(
" 启动入库【"
+
posId
+
"】"
);
storeRunStatus
=
StoreRunStatus
.
Busy
;
storeStatus
=
StoreStatus
.
InStoreExecute
;
MoveInfo
.
NewMove
(
StoreMoveType
.
InStore
,
param
);
//新的料架库位
MoveInfo
.
NextMoveStep
(
StoreMoveStep
.
BI_11_InoutToP1
);
MoveInfo
.
SingleInstore
=
true
;
InOutStoreLog
(
"料架取料:叉子后退到待机点P1, 重置盘信息"
);
ACAxisMove
(
Config
.
InOut_Axis
,
Config
.
InOutAxis_P1_Position
,
Config
.
InOutAxis_P1_Speed
);
ClearLastTrayInfo
();
}
/// <summary>
/// 开始料架入库
/// </summary>
public
void
StartShelfInStore
()
{
bool
canStart
=
(
storeRunStatus
.
Equals
(
StoreRunStatus
.
Runing
)
&&
MoveInfo
.
MoveType
.
Equals
(
StoreMoveType
.
None
)
&&
IOValue
(
IO_Type
.
LineIn_Check
).
Equals
(
IO_VALUE
.
HIGH
));
if
(!
canStart
)
{
return
;
}
//读取RFID
RFIDData
data
=
RFIDManager
.
ReadData
(
Config
.
RFID_IP
);
//TODO 判断料架是否正确
if
(
data
.
RFType
.
Equals
(
"A"
))
{
LastShelfData
=
data
;
AgvClient
.
SendRFID
(
Config
.
AgvNodeName
,
data
.
ToData
());
}
else
{
LogUtil
.
error
(
Name
+
"检测到入料口有料架,读取RFID数据错误:"
+
data
.
ToStr
());
return
;
}
storeRunStatus
=
StoreRunStatus
.
Busy
;
storeStatus
=
StoreStatus
.
InStoreExecute
;
EmprtShelfList
=
new
ConcurrentQueue
<
string
>();
LogInfo
(
" 空闲中,读取到料架"
+
data
.
ToStr
()
+
",料架入库:入料口移门打开,"
);
MoveInfo
.
NewMove
(
StoreMoveType
.
InStore
,
new
InOutParam
());
MoveInfo
.
MoveParam
.
MoveP
=
new
LineMoveP
();
MoveInfo
.
MoveParam
.
MoveP
.
ComPress_P1
=
Config
.
CompAxis_P1_Position
;
MoveInfo
.
MoveParam
.
MoveP
.
InOut_P1
=
Config
.
InOutAxis_P1_Position
;
MoveInfo
.
MoveParam
.
MoveP
.
Middle_P1
=
Config
.
MiddleAxis_P1
;
MoveInfo
.
MoveParam
.
MoveP
.
UpDown_P1
=
Config
.
UpDownAxis_P1
;
MoveInfo
.
MoveParam
.
MoveP
.
UpDown_P2
=
Config
.
UpDownAxis_P2
;
MoveInfo
.
ShelfPositionList
=
new
List
<
string
>(
ShelfPosList
);
MoveInfo
.
NextMoveStep
(
StoreMoveStep
.
BI_02_DoorOpen
);
CylinderMove
(
MoveInfo
,
IO_Type
.
EntranceDoor_Close
,
IO_Type
.
EntranceDoor_Open
);
}
private
void
StartMoveToBag
()
{
MoveInfo
.
NextMoveStep
(
StoreMoveStep
.
BI_21_MoveToBag
);
InOutStoreLog
(
"入库:移动到库位点,轴1( 转盘) 至P2( 库位点)轴2(上下) 至P3(库位入库前点)"
);
ACAxisMove
(
Config
.
Middle_Axis
,
MoveInfo
.
MoveParam
.
MoveP
.
Middle_P2
,
Config
.
MiddleAxis_P2_Speed
);
ACAxisMove
(
Config
.
UpDown_Axis
,
MoveInfo
.
MoveParam
.
MoveP
.
UpDown_P3
,
Config
.
UpDownAxis_P3_Speed
);
}
private
void
StartSendTray
(
string
str
=
"扫码失败"
)
{
MoveInfo
.
NextMoveStep
(
StoreMoveStep
.
BI_31_ToNGDoor
);
InOutStoreLog
(
"送出料盘:"
+
str
+
",升降轴移动到NG料门口上端,旋转轴移动到NG料门口"
);
ACAxisMove
(
Config
.
UpDown_Axis
,
MoveInfo
.
MoveParam
.
MoveP
.
UpDown_P1
,
Config
.
UpDownAxis_P1_Speed
);
ACAxisMove
(
Config
.
Middle_Axis
,
MoveInfo
.
MoveParam
.
MoveP
.
Middle_P1
,
Config
.
MiddleAxis_P1_Speed
);
}
protected
override
void
InStoreProcess
()
{
...
...
@@ -170,194 +284,644 @@ namespace OnlineStore.DeviceLibrary
{
return
;
}
ShelfInStoreProcess
();
#
region
料架取料盘扫码获取
POSID
if
(
MoveInfo
.
MoveStep
.
Equals
(
StoreMoveStep
.
BI_08_StartGetTray
))
{
if
(
MoveInfo
.
NextShelfPos
())
{
//新的料架库位
startInStoreTime
=
DateTime
.
Now
;
MoveInfo
.
NextMoveStep
(
StoreMoveStep
.
BI_11_InoutToP1
);
InOutStoreLog
(
"料架取料:叉子后退到待机点P1, 重置盘信息"
);
ACAxisMove
(
Config
.
InOut_Axis
,
Config
.
InOutAxis_P1_Position
,
Config
.
InOutAxis_P1_Speed
);
ClearLastTrayInfo
();
}
else
{
//所有料盘已取料完成,送出料架
StartShelfOut
();
}
}
else
if
(
MoveInfo
.
MoveStep
.
Equals
(
StoreMoveStep
.
BI_11_InoutToP1
))
{
MoveInfo
.
NextMoveStep
(
StoreMoveStep
.
BI_12_MoveToShelf
);
InOutStoreLog
(
"料架取料:升降轴移动到P101低点,旋转轴移动到P101点,压紧轴到压紧前点"
);
ACAxisMove
(
Config
.
UpDown_Axis
,
moveP
.
UpDown_LP101
,
Config
.
UpDownAxis_P101_Speed
);
ACAxisMove
(
Config
.
Middle_Axis
,
moveP
.
Middle_P101
,
Config
.
MiddleAxis_P101_Speed
);
ACAxisMove
(
Config
.
Comp_Axis
,
Config
.
CompAxis_P3_Position
,
Config
.
CompAxis_P3_Speed
);
}
else
if
(
MoveInfo
.
MoveStep
.
Equals
(
StoreMoveStep
.
BI_12_MoveToShelf
))
{
MoveInfo
.
NextMoveStep
(
StoreMoveStep
.
BI_13_InoutToP101
);
InOutStoreLog
(
"料架取料:叉子前进到P101点"
);
ACAxisMove
(
Config
.
InOut_Axis
,
moveP
.
InOut_P101
,
Config
.
InOutAxis_P101_Speed
);
}
else
if
(
MoveInfo
.
MoveStep
.
Equals
(
StoreMoveStep
.
BI_13_InoutToP101
))
{
MoveInfo
.
NextMoveStep
(
StoreMoveStep
.
BI_14_UpdownToP102
);
InOutStoreLog
(
"料架取料:升降轴上升到P102点"
);
ACAxisMove
(
Config
.
UpDown_Axis
,
moveP
.
UpDown_HP102
,
Config
.
UpDownAxis_P102_Speed
);
}
else
if
(
MoveInfo
.
MoveStep
.
Equals
(
StoreMoveStep
.
BI_14_UpdownToP102
))
{
MoveInfo
.
NextMoveStep
(
StoreMoveStep
.
BI_15_StartCompress
);
InOutStoreLog
(
"料架取料:压紧轴开始缓慢压紧到P4"
);
MoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitComAxis
(
Config
.
Comp_Axis
,
Config
.
CompAxis_P4_Position
,
Config
.
CompAxis_P4_Speed
));
Config
.
Comp_Axis
.
TargetPosition
=
Config
.
CompAxis_P4_Position
;
ACServerManager
.
AbsMove
(
Config
.
Comp_Axis
.
DeviceName
,
Config
.
Comp_Axis
.
GetAxisValue
(),
Config
.
CompAxis_P4_Position
,
Config
.
CompAxis_P4_Speed
);
ComAxisStartCheck
();
}
else
if
(
MoveInfo
.
MoveStep
.
Equals
(
StoreMoveStep
.
BI_15_StartCompress
))
{
MoveInfo
.
NextMoveStep
(
StoreMoveStep
.
BI_16_ComAxisDownMove
);
int
currPosition
=
ACServerManager
.
GetActualtPosition
(
Config
.
Comp_Axis
);
ComTargetPosition
=
currPosition
;
int
targetP
=
currPosition
+
Config
.
CompAxis_Down_Position
;
LastHeight
=
Config
.
GetComP2PlateH
(
targetP
);
InOutStoreLog
(
"料架取料:检测到料叉压紧确认信号,向下押金【"
+
ComTargetPosition
+
"】目标【"
+
targetP
+
"】,记录料盘高度【"
+
LastHeight
+
"】"
);
ACAxisMove
(
Config
.
Comp_Axis
,
targetP
,
Config
.
CompAxis_P1_Speed
);
}
else
if
(
MoveInfo
.
MoveStep
.
Equals
(
StoreMoveStep
.
BI_16_ComAxisDownMove
))
{
MoveInfo
.
NextMoveStep
(
StoreMoveStep
.
BI_17_InoutBack
);
InOutStoreLog
(
"料架取料:记录压紧高度,叉子后退到扫码点"
);
ACAxisMove
(
Config
.
InOut_Axis
,
Config
.
InOutAxis_P1_Position
,
Config
.
CompAxis_P1_Speed
);
}
else
if
(
MoveInfo
.
MoveStep
.
Equals
(
StoreMoveStep
.
BI_17_InoutBack
))
{
if
(
IOValue
(
IO_Type
.
TrayCheck_3
).
Equals
(
IO_VALUE
.
HIGH
)
&&
IOValue
(
IO_Type
.
TrayCheck_4
).
Equals
(
IO_VALUE
.
HIGH
))
{
LastWidth
=
13
;
}
else
if
(
IOValue
(
IO_Type
.
TrayCheck_1
).
Equals
(
IO_VALUE
.
HIGH
)
&&
IOValue
(
IO_Type
.
TrayCheck_2
).
Equals
(
IO_VALUE
.
HIGH
))
{
LastWidth
=
7
;
}
else
{
LogUtil
.
info
(
"未检测到识别区料盘检测信号, 默认高度为7"
);
}
if
(
MoveInfo
.
SingleInstore
)
{
//单盘入库,不需要扫码
StartMoveToBag
();
}
else
{
MoveInfo
.
NextMoveStep
(
StoreMoveStep
.
BI_18_ScanCode
);
InOutStoreLog
(
"料架取料:记录宽度,开始扫码"
);
MoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitTime
(
5000
));
MoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitCode
());
Task
.
Factory
.
StartNew
(
delegate
{
IOMove
(
IO_Type
.
Camera_Led
,
IO_VALUE
.
HIGH
);
LastScanCodes
=
CodeManager
.
CameraScan
(
Config
.
GetCameraList
());
IOMove
(
IO_Type
.
Camera_Led
,
IO_VALUE
.
LOW
);
});
}
}
else
if
(
MoveInfo
.
MoveStep
.
Equals
(
StoreMoveStep
.
BI_18_ScanCode
))
{
if
(
LastScanCodes
.
Count
<=
0
)
{
StartSendTray
(
"扫码失败"
);
}
else
{
MoveInfo
.
NextMoveStep
(
StoreMoveStep
.
BI_19_GetPosId
);
InOutStoreLog
(
"料架取料:扫码成功,从服务器获取库位号"
);
MoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitTime
(
10000
));
bool
result
=
GetPosIdByCode
();
if
(
result
)
{
MoveInfo
.
NextMoveStep
(
StoreMoveStep
.
BI_20_SetInstoreParam
);
InOutStoreLog
(
"料架取料: 获取库位号完成,设置位置参数,开始入库"
);
}
else
{
StartSendTray
(
"获取入库库位失败"
);
}
}
}
else
if
(
MoveInfo
.
MoveStep
.
Equals
(
StoreMoveStep
.
BI_19_GetPosId
))
{
MoveInfo
.
NextMoveStep
(
StoreMoveStep
.
BI_20_SetInstoreParam
);
InOutStoreLog
(
"料架取料: 获取库位号完成,设置位置参数,开始入库"
);
}
#
endregion
#
region
入库逻辑
else
if
(
MoveInfo
.
MoveStep
.
Equals
(
StoreMoveStep
.
BI_20_SetInstoreParam
))
{
StartMoveToBag
();
}
else
if
(
MoveInfo
.
MoveStep
.
Equals
(
StoreMoveStep
.
BI_21_MoveToBag
))
{
MoveInfo
.
NextMoveStep
(
StoreMoveStep
.
BI_22_DeviceToBag
);
InOutStoreLog
(
"入库:叉子进入库位中,轴3( 叉子) 至P3(库位取放料点)"
);
ACAxisMove
(
Config
.
InOut_Axis
,
moveP
.
InOut_P3
,
Config
.
InOutAxis_P3_Speed
);
}
else
if
(
MoveInfo
.
MoveStep
.
Equals
(
StoreMoveStep
.
BI_22_DeviceToBag
))
{
MoveInfo
.
NextMoveStep
(
StoreMoveStep
.
BI_23_PutWareToBag
);
InOutStoreLog
(
"入库:放下物品,轴2( 上下) 至P4( 库位入料缓冲点)轴4( 压紧) 至P3( 压紧前点)"
);
// 5= 入仓位完成(料仓Box把料盘放入对应的库位中,装置还未恢复原始状态)
string
posId
=
MoveInfo
.
MoveParam
!=
null
?
MoveInfo
.
MoveParam
.
PosID
:
""
;
lastPosId
=
posId
;
lastPosIdStatus
=
StoreStatus
.
InStoreEnd
;
storeStatus
=
StoreStatus
.
InStoreEnd
;
//手动发给服务器状态,防止没有手动
//SendLineStatus(StoreID, posId, StoreStatus.InStoreEnd);
ACAxisMove
(
Config
.
Comp_Axis
,
moveP
.
ComPress_P3
,
Config
.
CompAxis_P3_Speed
);
ACAxisMove
(
Config
.
UpDown_Axis
,
moveP
.
UpDown_P4
,
Config
.
UpDownAxis_P4_Speed
);
}
else
if
(
MoveInfo
.
MoveStep
.
Equals
(
StoreMoveStep
.
BI_23_PutWareToBag
))
{
MoveInfo
.
NextMoveStep
(
StoreMoveStep
.
BI_24_DeviceBackFromBag
);
InOutStoreLog
(
"入库:叉子从库位中返回,轴3( 叉子) 动作至P1( 待机点)"
);
ACAxisMove
(
Config
.
InOut_Axis
,
Config
.
InOutAxis_P1_Position
,
Config
.
InOutAxis_P1_Speed
);
}
else
if
(
MoveInfo
.
MoveStep
.
Equals
(
StoreMoveStep
.
BI_24_DeviceBackFromBag
))
{
MoveInfo
.
NextMoveStep
(
StoreMoveStep
.
BI_25_GoBack
);
InOutStoreLog
(
"入库:返回待机点,轴2/轴1/轴4动作至P1( 待机点))开始"
);
ACAxisMove
(
Config
.
Comp_Axis
,
moveP
.
ComPress_P1
,
Config
.
CompAxis_P1_Speed
);
ACAxisMove
(
Config
.
Middle_Axis
,
moveP
.
Middle_P1
,
Config
.
MiddleAxis_P1_Speed
);
ACAxisMove
(
Config
.
UpDown_Axis
,
moveP
.
UpDown_P1
,
Config
.
UpDownAxis_P1_Speed
);
}
else
if
(
MoveInfo
.
MoveStep
.
Equals
(
StoreMoveStep
.
BI_25_GoBack
))
{
TimeSpan
span
=
DateTime
.
Now
-
startInStoreTime
;
if
(
MoveInfo
.
SingleInstore
)
{
string
posId
=
MoveInfo
.
MoveParam
!=
null
?
MoveInfo
.
MoveParam
.
PosID
:
""
;
LogInfo
(
" 【"
+
posId
+
"】单盘入库结束,耗时【"
+
FormUtil
.
GetSpanStr
(
span
)
+
"】!"
);
MoveEndToRuningStatus
();
AutoInout
.
InOutEndProcess
(
this
,
StoreMoveType
.
InStore
);
}
else
{
MoveInfo
.
NextMoveStep
(
StoreMoveStep
.
BI_08_StartGetTray
);
InOutStoreLog
(
"料架入库:上一盘入库结束, 耗时【"
+
FormUtil
.
GetSpanStr
(
span
)
+
"】判断是否有下个料盘,扫码入库"
);
}
}
#
endregion
#
region
把料盘送到
NG
逻辑
else
if
(
MoveInfo
.
MoveStep
.
Equals
(
StoreMoveStep
.
BI_31_ToNGDoor
))
{
MoveInfo
.
NextMoveStep
(
StoreMoveStep
.
BI_32_NGDoorUp
);
InOutStoreLog
(
"送出料盘:NG料口升降门上升"
);
CylinderMove
(
MoveInfo
,
IO_Type
.
NGDoorCylinder_Down
,
IO_Type
.
NGDoowCylinder_Up
);
}
else
if
(
MoveInfo
.
MoveStep
.
Equals
(
StoreMoveStep
.
BI_32_NGDoorUp
))
{
MoveInfo
.
NextMoveStep
(
StoreMoveStep
.
BI_33_InoutToNGDoor
);
InOutStoreLog
(
"送出料盘:进出轴前进到NG料门口位置"
);
ACAxisMove
(
Config
.
InOut_Axis
,
moveP
.
InOut_P2
,
Config
.
InOutAxis_P2_Speed
);
}
else
if
(
MoveInfo
.
MoveStep
.
Equals
(
StoreMoveStep
.
BI_33_InoutToNGDoor
))
{
MoveInfo
.
NextMoveStep
(
StoreMoveStep
.
BI_34_UpdownDown
);
InOutStoreLog
(
"送出料盘:升降轴缓慢下降,放下料盘"
);
ACAxisMove
(
Config
.
UpDown_Axis
,
moveP
.
UpDown_P2
,
Config
.
UpDownAxis_P2_Speed
);
ACAxisMove
(
Config
.
Comp_Axis
,
moveP
.
ComPress_P3
,
Config
.
CompAxis_P3_Speed
);
}
else
if
(
MoveInfo
.
MoveStep
.
Equals
(
StoreMoveStep
.
BI_34_UpdownDown
))
{
MoveInfo
.
NextMoveStep
(
StoreMoveStep
.
BI_35_InoutToP1
);
InOutStoreLog
(
"送出料盘:叉子后退到P1"
);
ACAxisMove
(
Config
.
InOut_Axis
,
moveP
.
InOut_P1
,
Config
.
InOutAxis_P1_Speed
);
}
else
if
(
MoveInfo
.
MoveStep
.
Equals
(
StoreMoveStep
.
BI_35_InoutToP1
))
{
MoveInfo
.
NextMoveStep
(
StoreMoveStep
.
BI_36_NGDoorDown
);
InOutStoreLog
(
"送出料盘:关门NG料门,送出料盘结束"
);
CylinderMove
(
MoveInfo
,
IO_Type
.
NGDoowCylinder_Up
,
IO_Type
.
NGDoorCylinder_Down
);
}
else
if
(
MoveInfo
.
MoveStep
.
Equals
(
StoreMoveStep
.
BI_36_NGDoorDown
))
{
MoveInfo
.
NextMoveStep
(
StoreMoveStep
.
BI_08_StartGetTray
);
InOutStoreLog
(
"料架入库:开始循环逐个取料盘,扫码入库"
);
}
#
endregion
//料架进入逻辑
else
if
(
MoveInfo
.
MoveStep
<
StoreMoveStep
.
BI_08_StartGetTray
)
{
ShelfOutProcess
();
}
//料架送出逻辑
else
if
(
MoveInfo
.
MoveStep
>=
StoreMoveStep
.
BS_01_TopCylinder_Down
)
{
ShelfOutProcess
();
}
else
{
LogInfo
(
" 入库,moveStatus="
+
MoveInfo
.
MoveStep
+
",没有对应的处理!"
);
}
}
#
endregion
#
region
扫码获取库位
private
string
ProcessCode
()
{
string
message
=
""
;
string
spiltStr
=
"##"
;
string
codeSize
=
LastWidth
+
"x"
+
LastHeight
;
foreach
(
string
str
in
LastScanCodes
)
{
if
(
str
.
Trim
().
Equals
(
""
))
{
continue
;
}
string
code
=
"=1+0x0-"
+
codeSize
+
"="
+
str
.
Trim
();
if
(!
String
.
IsNullOrEmpty
(
code
))
{
message
=
message
+
code
+
spiltStr
;
}
}
return
message
;
}
private
DateTime
startInStoreTime
=
DateTime
.
Now
;
/// <summary>
/// 开始入库移动移动
/// </summary>
public
override
void
StartInStoreMove
(
InOutParam
param
)
/// 扫码枪数据接收
/// </summary>
/// <param name="message"></param>
private
bool
GetPosIdByCode
()
{
startInStoreTime
=
DateTime
.
Now
;
string
posId
=
param
!=
null
?
param
.
PosID
:
""
;
if
(
storeRunStatus
==
StoreRunStatus
.
Runing
)
try
{
if
(!
StoreManager
.
LoadInoutParam
(
param
,
this
))
string
message
=
ProcessCode
();
if
(
message
.
Equals
(
""
)
||
string
.
IsNullOrEmpty
(
message
))
{
CodeMsg
=
"未扫到二维码"
;
LogInfo
(
"未扫到二维码"
);
return
false
;
}
if
(
storeRunStatus
.
Equals
(
StoreRunStatus
.
Wait
))
{
LogUtil
.
error
(
Name
+
" 启动入库【"
+
posId
+
"】出错,找不到库位信息"
);
return
;
LogInfo
(
"二维码【 "
+
message
+
"】,设备未启动,不需要发送服务器"
);
return
false
;
}
// CodeMsg = "收到二维码【 " + message + "】,发送给服务器获取入库PosID";
LogUtil
.
info
(
Name
+
"二维码【 "
+
message
+
"】,发送给服务器获取入库PosID"
);
//发送扫码内容到服务器进行入库操作
Operation
operation
=
getLineBoxStatus
();
operation
.
op
=
1
;
operation
.
data
=
new
Dictionary
<
string
,
string
>()
{
{
"code"
,
message
},
{
"boxId"
,
DeviceID
.
ToString
()
}
};
string
server
=
ConfigAppSettings
.
GetValue
(
Setting_Init
.
http_server
);
Operation
resultOperation
=
HttpHelper
.
Post
(
StoreManager
.
GetPostApi
(
server
),
operation
,
false
);
if
(
resultOperation
==
null
)
{
CodeMsg
=
"二维码【"
+
message
+
"】没有收到服务器反馈"
;
LogInfo
(
"二维码【 "
+
message
+
"】没有收到服务器反馈!"
);
return
false
;
}
if
(
IOValue
(
IO_Type
.
TrayCheck_Fixture
).
Equals
(
IO_VALUE
.
HIGH
))
else
if
(!
string
.
IsNullOrEmpty
(
resultOperation
.
msg
))
{
LogUtil
.
error
(
Name
+
" 启动入库【"
+
posId
+
"】出错,叉子料盘检测有料"
);
return
;
//如果有提示消息,直接显示提示
LogInfo
(
"二维码【 "
+
message
+
"】 :"
+
resultOperation
.
msg
);
return
false
;
}
LogInfo
(
" 启动入库【"
+
posId
+
"】"
);
storeRunStatus
=
StoreRunStatus
.
Busy
;
storeStatus
=
StoreStatus
.
InStoreExecute
;
MoveInfo
.
NewMove
(
StoreMoveType
.
InStore
,
param
);
//新的料架库位
MoveInfo
.
NextMoveStep
(
StoreMoveStep
.
BI_11_InoutToP1
);
MoveInfo
.
SingleInstore
=
true
;
InOutStoreLog
(
"料架取料:叉子后退到待机点P1, 重置盘信息"
);
ACAxisMove
(
Config
.
InOut_Axis
,
Config
.
InOutAxis_P1_Position
,
Config
.
InOutAxis_P1_Speed
);
ClearLastTrayInfo
();
if
(
resultOperation
.
op
.
Equals
(
1
))
{
Dictionary
<
string
,
string
>
data
=
resultOperation
.
data
;
if
(
data
!=
null
&&
data
.
ContainsKey
(
ParamDefine
.
posId
)
&&
data
.
ContainsKey
(
ParamDefine
.
plateH
)
&&
data
.
ContainsKey
(
ParamDefine
.
plateW
))
{
//服务器返回时有:posId库位编号,plateW:料盘宽度,plateH:料盘高度,
//postId格式BoxId#位置
string
posId
=
data
[
ParamDefine
.
posId
];
string
plateW
=
data
[
ParamDefine
.
plateW
];
string
plateH
=
data
[
ParamDefine
.
plateH
];
string
[]
posArray
=
posId
.
Split
(
'#'
);
if
(!(
posArray
.
Length
==
2
))
{
WarnMsg
=
Name
+
"入库库位格式错误:二维码【"
+
message
+
"】库位【"
+
posId
+
"】"
;
LogUtil
.
error
(
Name
+
"服务器反馈 入库库位格式错误:二维码【"
+
message
+
"】库位【"
+
posId
+
"】"
);
return
false
;
}
int
storeId
=
int
.
Parse
(
posArray
[
0
]);
//根据发送的posId获取位置列表
ACBoxPosition
position
=
CSVPositionReader
<
ACBoxPosition
>.
GetPositon
(
posId
);
if
(
position
==
null
)
{
//出入库没有找到服务器发送的库位,需要打印日志方便查询原因
WarnMsg
=
"入库未找到库位:二维码【"
+
message
+
"】库位【"
+
posId
+
"】 "
;
LogUtil
.
error
(
Name
+
"收到服务器入库命令:入库未找到库位:二维码【"
+
message
+
"】库位【"
+
posId
+
"】"
);
return
false
;
}
LogInfo
(
" 收到服务器入库命令:库位号【"
+
posId
+
"】二维码【"
+
message
+
"】设置入库参数 , 开始入库!"
);
MoveInfo
.
MoveParam
.
UpdatePosId
(
message
,
posId
,
plateW
,
plateH
,
ComTargetPosition
);
return
true
;
}
}
else
if
(
resultOperation
.
op
.
Equals
(
2
))
{
ReviceOutStoreProcess
(
resultOperation
);
}
else
if
(
resultOperation
.
op
.
Equals
(
5
))
{
humBean
.
ProcessHumidityCMD
(
resultOperation
);
}
else
{
LogUtil
.
error
(
"收到服务器命令:op="
+
resultOperation
.
op
+
",未找到对应处理"
);
}
}
catch
(
Exception
ex
)
{
LogUtil
.
error
(
Name
+
"GetPosIdByCode"
+
ex
.
StackTrace
);
}
return
false
;
}
#
endregion
#
region
料架进出料仓处理:出入库模块共用
private
void
ShelfEnterProcess
()
{
string
moveName
=
"料架入库"
;
bool
instoreShelf
=
true
;
if
(
MoveInfo
.
MoveType
.
Equals
(
StoreMoveType
.
OutStore
))
{
instoreShelf
=
false
;
moveName
=
"空料架进入"
;
}
if
(
MoveInfo
.
MoveStep
.
Equals
(
StoreMoveStep
.
BI_01_ReadyShelf
))
{
MoveInfo
.
ShelfPositionList
=
new
List
<
string
>(
ShelfPosList
);
InOutStoreLog
(
moveName
+
"调用AgvClient.MayEnter,小车已到达,打开入料口移门"
);
MoveInfo
.
NextMoveStep
(
StoreMoveStep
.
BI_02_DoorOpen
);
CylinderMove
(
MoveInfo
,
IO_Type
.
EntranceDoor_Close
,
IO_Type
.
EntranceDoor_Open
);
}
else
if
(
MoveInfo
.
MoveStep
.
Equals
(
StoreMoveStep
.
BI_02_DoorOpen
))
{
MoveInfo
.
NextMoveStep
(
StoreMoveStep
.
BI_03_LineRun
);
InOutStoreLog
(
moveName
+
"调用AgvClient.MayEnter,线体正转,等待取料位检测到信号"
);
AgvClient
.
MayEnter
(
Config
.
AgvNodeName
);
IOMove
(
IO_Type
.
Line_BackRun
,
IO_VALUE
.
LOW
);
IOMove
(
IO_Type
.
Line_Run
,
IO_VALUE
.
HIGH
);
MoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitIO
(
IO_Type
.
LineIn_Check
,
IO_VALUE
.
LOW
));
MoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitIO
(
IO_Type
.
LineTake_Check
,
IO_VALUE
.
HIGH
));
}
else
if
(
MoveInfo
.
MoveStep
.
Equals
(
StoreMoveStep
.
BI_03_LineRun
))
{
MoveInfo
.
NextMoveStep
(
StoreMoveStep
.
BI_04_LineStop
);
InOutStoreLog
(
moveName
+
"调用AgvClient.FinishEnter,取料位检测到信号,停止线体正转"
);
IOMove
(
IO_Type
.
Line_Run
,
IO_VALUE
.
LOW
);
AgvClient
.
FinishEnter
(
Config
.
AgvNodeName
);
if
(!
instoreShelf
)
{
EmprtShelfList
=
new
System
.
Collections
.
Concurrent
.
ConcurrentQueue
<
string
>(
ShelfPosList
);
if
(
MoveInfo
.
MoveParam
.
ShelfPosID
.
Equals
(
""
))
{
string
shelfPosId
=
""
;
bool
result
=
EmprtShelfList
.
TryDequeue
(
out
shelfPosId
);
if
(
result
)
{
MoveInfo
.
MoveParam
.
UpdateShelfPosId
(
shelfPosId
);
InOutStoreLog
(
"出库:重置EmprtShelfList列表,设置料架位置:"
+
MoveInfo
.
MoveParam
.
ShelfPosID
);
}
else
{
waitOutStoreList
.
Enqueue
(
MoveInfo
.
MoveParam
);
InOutStoreLog
(
"出库:重置EmprtShelfList列表,获取料架位置失败!结束出库,并将"
+
MoveInfo
.
MoveParam
.
ToStr
()+
"放入等待列表"
);
MoveEndToRuningStatus
();
}
}
}
}
else
if
(
MoveInfo
.
MoveStep
.
Equals
(
StoreMoveStep
.
BI_04_LineStop
))
{
MoveInfo
.
NextMoveStep
(
StoreMoveStep
.
BI_05_DoorClose
);
InOutStoreLog
(
moveName
+
"入料口移门关闭"
);
CylinderMove
(
MoveInfo
,
IO_Type
.
EntranceDoor_Open
,
IO_Type
.
EntranceDoor_Close
);
if
(!
instoreShelf
)
{
InOutStoreLog
(
"出库:SO_03 走到库位,压紧轴至P3(压紧前点) ,旋转轴至P2(库位点),升降轴至P5(库位出库前点)"
);
ACAxisMove
(
Config
.
Comp_Axis
,
MoveInfo
.
MoveParam
.
MoveP
.
ComPress_P3
,
Config
.
CompAxis_P3_Speed
);
ACAxisMove
(
Config
.
Middle_Axis
,
MoveInfo
.
MoveParam
.
MoveP
.
Middle_P2
,
Config
.
MiddleAxis_P2_Speed
);
ACAxisMove
(
Config
.
UpDown_Axis
,
MoveInfo
.
MoveParam
.
MoveP
.
UpDown_P5
,
Config
.
UpDownAxis_P5_Speed
);
}
}
else
if
(
MoveInfo
.
MoveStep
.
Equals
(
StoreMoveStep
.
BI_05_DoorClose
))
{
MoveInfo
.
NextMoveStep
(
StoreMoveStep
.
BI_06_LocationUp
);
InOutStoreLog
(
moveName
+
"定位装置上升"
);
CylinderMove
(
MoveInfo
,
IO_Type
.
LocationCylinder_Down
,
IO_Type
.
LocationCylinder_Up
);
if
(!
instoreShelf
)
{
InOutStoreLog
(
"出库:SO_04 叉子进入库位中, 进出轴至P3(库位取放料点) "
);
ACAxisMove
(
Config
.
InOut_Axis
,
MoveInfo
.
MoveParam
.
MoveP
.
InOut_P3
,
Config
.
InOutAxis_P3_Speed
);
}
}
else
if
(
MoveInfo
.
MoveStep
.
Equals
(
StoreMoveStep
.
BI_06_LocationUp
))
{
MoveInfo
.
NextMoveStep
(
StoreMoveStep
.
BI_07_TopCylinderUp
);
InOutStoreLog
(
moveName
+
"顶升装置上升"
);
CylinderMove
(
MoveInfo
,
IO_Type
.
TopCylinder_Down
,
IO_Type
.
TopCylinder_Up
);
if
(!
instoreShelf
)
{
InOutStoreLog
(
"出库:SO_05 拿起物品,升降轴至P6(库位出料缓冲点),压紧轴至P2(压紧点) "
);
ACAxisMove
(
Config
.
Comp_Axis
,
MoveInfo
.
MoveParam
.
MoveP
.
ComPress_P2
,
Config
.
CompAxis_P2_Speed
);
ACAxisMove
(
Config
.
UpDown_Axis
,
MoveInfo
.
MoveParam
.
MoveP
.
UpDown_P6
,
Config
.
UpDownAxis_P6_Speed
);
}
}
else
if
(
MoveInfo
.
MoveStep
.
Equals
(
StoreMoveStep
.
BI_07_TopCylinderUp
))
{
if
(
instoreShelf
)
{
MoveInfo
.
NextMoveStep
(
StoreMoveStep
.
BI_08_StartGetTray
);
InOutStoreLog
(
moveName
+
"开始循环从第一个空位逐个取料盘,扫码入库"
);
}
else
{
MoveInfo
.
NextMoveStep
(
StoreMoveStep
.
SO_06_BagDeviceBack
);
InOutStoreLog
(
"出库:SO_06 叉子从库位返回,进出轴至P1(待机点) "
);
//ACAxisMove(Config.InOut_Axis, moveP.InOut_P1, Config.InOutAxis_P1_Speed);
InOutBackToP1
(
MoveInfo
.
MoveParam
.
MoveP
.
InOut_P1
);
//把库位的物品放到取到叉子上之后是出仓完成
string
posId
=
MoveInfo
.
MoveParam
!=
null
?
MoveInfo
.
MoveParam
.
PosID
:
""
;
lastPosId
=
posId
;
lastPosIdStatus
=
StoreStatus
.
OutStoreBoxEnd
;
storeStatus
=
StoreStatus
.
OutStoreBoxEnd
;
}
}
}
private
void
StartShelfOut
()
{
MoveInfo
.
NextMoveStep
(
StoreMoveStep
.
BS_01_TopCylinder_Down
);
if
(
MoveInfo
.
MoveType
.
Equals
(
StoreMoveType
.
OutStore
))
{
InOutStoreLog
(
"送出出库料架:顶升气缸下降"
);
}
else
{
LogUtil
.
error
(
Name
+
" 启动【"
+
posId
+
"】入库出错,当前状态,storeStatus="
+
storeRunStatus
);
}
}
//private void SI_02_Move(LineMoveP moveP)
//{
// MoveInfo.NextMoveStep(StoreMoveStep.SI_02_InOutAxisHome);
// InOutStoreLog("入库:SI_02_ 进出轴(叉子)动作至P1,打开舱门");
// OpenDoor();
// InOutBackToP1(moveP.InOut_P1);
//}
//private void SI_05_DeviceToDoor()
//{
// MoveInfo.NextMoveStep(StoreMoveStep.SI_05_DeviceToDoor);
// InOutStoreLog("入库:SI_05 叉子进入入料口,进出轴至P2(进料口取料点) ");
// ACAxisMove(Config.InOut_Axis, MoveInfo.MoveParam.MoveP.InOut_P2, Config.InOutAxis_P2_Speed);
// //NeedCheckSafetyLight = 1;
//}
//protected override void InStoreProcess()
//{
// LineMoveP moveP = MoveInfo.MoveParam.MoveP;
// if (MoveInfo.IsInWait)
// {
// CheckWait();
// }
// if (MoveInfo.IsInWait)
// {
// return;
// }
//if (MoveInfo.MoveStep == StoreMoveStep.SI_00_TrayCheck)
//{
// SI_02_Move(moveP);
//}
//if (MoveInfo.MoveStep == StoreMoveStep.SI_01_LocationCylinderDown)
//{
// SI_02_Move(moveP);
//}
//else if (MoveInfo.MoveStep == StoreMoveStep.SI_02_InOutAxisHome)
//{
// MoveInfo.NextMoveStep(StoreMoveStep.SI_03_ReturnHome);
// InOutStoreLog("入库:SI_03 所有轴回到待机点,轴2、轴1 动作到P1,,轴4动作至P3");
// ACAxisMove(Config.Comp_Axis,moveP.ComPress_P3, Config.CompAxis_P3_Speed);
// ACAxisMove(Config.UpDown_Axis, moveP.UpDown_P1, Config.UpDownAxis_P1_Speed);
// ACAxisMove(Config.Middle_Axis, moveP.Middle_P1, Config.MiddleAxis_P1_Speed);
//}
//else if (MoveInfo.MoveStep == StoreMoveStep.SI_03_ReturnHome)
//{
// MoveInfo.NextMoveStep(StoreMoveStep.SI_04_CompressWare);
// InOutStoreLog("入库:SI_04_CompressWare 压紧物品(有压紧轴的才需要此步骤),压紧轴至P3(压紧前点) 开始");
// ACAxisMove(Config.Comp_Axis,moveP.ComPress_P3, Config.CompAxis_P3_Speed);
//}
//else if (MoveInfo.MoveStep == StoreMoveStep.SI_04_CompressWare)
//{
// SI_05_DeviceToDoor();
//}
//else if (MoveInfo.MoveStep == StoreMoveStep.SI_05_DeviceToDoor)
//{
// //NeedCheckSafetyLight = 0;
// MoveInfo.NextMoveStep(StoreMoveStep.SI_06_DoorWarToDevice);
// InOutStoreLog("入库:SI_06 拿物品,压紧轴至P2(压紧点)) 升降轴至P7(进料口取料缓冲点) ");
// ACAxisMove(Config.Comp_Axis,moveP.ComPress_P2, Config.CompAxis_P2_Speed);
// // ACAxisMove(Config.UpDown_Axis, moveP.UpDown_P7, Config.UpDownAxis_P7_Speed);
//}
//else if (MoveInfo.MoveStep == StoreMoveStep.SI_06_DoorWarToDevice)
//{
// MoveInfo.NextMoveStep(StoreMoveStep.SI_07_DeviceBackFromDoor);
// InOutStoreLog("入库:SI_07 叉子 从入料口抽出,进出轴至P1(待机点) ");
// InOutBackToP1(moveP.InOut_P1);
//}
//else if (MoveInfo.MoveStep == StoreMoveStep.SI_07_DeviceBackFromDoor)
//{
// MoveInfo.NextMoveStep(StoreMoveStep.SI_09_MoveToBag);
// InOutStoreLog("入库:SI_09 移动到库位点,旋转轴至P2(库位点),升降轴至P3(库位入库前点) ");
// ACAxisMove(Config.Middle_Axis, moveP.Middle_P2, Config.MiddleAxis_P2_Speed);
// ACAxisMove(Config.UpDown_Axis, moveP.UpDown_P3, Config.UpDownAxis_P3_Speed);
// CloseDoor(false);
//}
//else if (MoveInfo.MoveStep == StoreMoveStep.SI_08_LocationCylinder_Up)
//{
// MoveInfo.NextMoveStep(StoreMoveStep.SI_09_MoveToBag);
// InOutStoreLog("入库:SI_09 移动到库位点,旋转轴至P2(库位点),升降轴至P3(库位入库前点)),关闭舱门 ");
// ACAxisMove(Config.Middle_Axis, moveP.Middle_P2, Config.MiddleAxis_P1_Speed);
// ACAxisMove(Config.UpDown_Axis, moveP.UpDown_P3, Config.UpDownAxis_P3_Speed);
// CloseDoor(false);
//}
//else if (MoveInfo.MoveStep == StoreMoveStep.SI_09_MoveToBag)
//{
// MoveInfo.NextMoveStep(StoreMoveStep.SI_11_DeviceToBag);
// InOutStoreLog("入库:SI_11 叉子进入库位中,进出轴至P3(库位取放料点) ");
// ACAxisMove(Config.InOut_Axis, moveP.InOut_P3, Config.InOutAxis_P3_Speed);
//}
//else if (MoveInfo.MoveStep == StoreMoveStep.SI_10_LocationCylinder_Down)
//{
// MoveInfo.NextMoveStep(StoreMoveStep.SI_11_DeviceToBag);
// InOutStoreLog("入库:SI_11 叉子进入库位中,进出轴至P3(库位取放料点) ");
// ACAxisMove(Config.InOut_Axis, moveP.InOut_P3, Config.InOutAxis_P3_Speed);
//}
//else if (MoveInfo.MoveStep == StoreMoveStep.SI_11_DeviceToBag)
//{
// // 5= 入仓位完成(料仓Box把料盘放入对应的库位中,装置还未恢复原始状态)
// string posId = MoveInfo.MoveParam != null ? MoveInfo.MoveParam.PosID : "";
// lastPosId = posId;
// lastPosIdStatus = StoreStatus.InStoreEnd;
// storeStatus = StoreStatus.InStoreEnd;
// //手动发给服务器状态,防止没有手动
// //SendLineStatus(StoreID, posId, StoreStatus.InStoreEnd);
// MoveInfo.NextMoveStep(StoreMoveStep.SI_12_PutWareToBag);
// InOutStoreLog("入库:SI_12 放下物品,升降轴至P4(库位入料缓冲点),压紧轴至P3(压紧前点) ");
// ACAxisMove(Config.Comp_Axis,moveP.ComPress_P3, Config.CompAxis_P3_Speed);
// ACAxisMove(Config.UpDown_Axis, moveP.UpDown_P4, Config.UpDownAxis_P4_Speed);
//}
//else if (MoveInfo.MoveStep == StoreMoveStep.SI_12_PutWareToBag)
//{
// MoveInfo.NextMoveStep(StoreMoveStep.SI_13_DeviceBackFromBag);
// InOutStoreLog("入库:SI_13 叉子从库位中返回,进出轴动作至P1(待机点) ");
// InOutBackToP1(moveP.InOut_P1);
//}
//else if (MoveInfo.MoveStep == StoreMoveStep.SI_13_DeviceBackFromBag)
//{
// MoveInfo.NextMoveStep(StoreMoveStep.SI_14_GoBack);
// InOutStoreLog("入库:SI_14 返回待机点,轴2/轴1/轴4动作至P1(待机点)),检测门关闭");
// ACAxisMove(Config.Comp_Axis,moveP.ComPress_P1, Config.CompAxis_P1_Speed);
// ACAxisMove(Config.Middle_Axis, moveP.Middle_P1, Config.MiddleAxis_P1_Speed);
// ACAxisMove(Config.UpDown_Axis, moveP.UpDown_P1, Config.UpDownAxis_P1_Speed);
// CloseDoor();
//}
//else if (MoveInfo.MoveStep == StoreMoveStep.SI_14_GoBack)
//{
// TimeSpan span = DateTime.Now - startInStoreTime;
// string posId = MoveInfo.MoveParam != null ? MoveInfo.MoveParam.PosID : "";
// LogInfo(" 【" + posId + "】 整个入库流程结束,耗时【" + FormUtil.GetSpanStr(span) + "】!");
// MoveInfo.EndMove();
// storeRunStatus = StoreRunStatus.Runing;
// //设备连接,入库后,BOX恢复原始状态
// storeStatus = StoreStatus.StoreOnline;
// AutoInout.InOutEndProcess(this, StoreMoveType.InStore);
//}
//else
// {
// ShelfInStoreProcess();
// }
//}
InOutStoreLog
(
"送出空料架:顶升气缸下降"
);
}
CylinderMove
(
MoveInfo
,
IO_Type
.
TopCylinder_Up
,
IO_Type
.
TopCylinder_Down
);
}
private
void
ShelfOutProcess
()
{
string
moveName
=
"送出空料架"
;
bool
instoreShelf
=
true
;
if
(
MoveInfo
.
MoveType
.
Equals
(
StoreMoveType
.
OutStore
))
{
instoreShelf
=
false
;
moveName
=
"送出出库料架"
;
}
if
(
MoveInfo
.
MoveStep
.
Equals
(
StoreMoveStep
.
BS_01_TopCylinder_Down
))
{
MoveInfo
.
NextMoveStep
(
StoreMoveStep
.
BS_02_LocatinCylinder_Down
);
InOutStoreLog
(
moveName
+
" :定位气缸下降"
);
CylinderMove
(
MoveInfo
,
IO_Type
.
LocationCylinder_Up
,
IO_Type
.
LocationCylinder_Down
);
}
else
if
(
MoveInfo
.
MoveStep
.
Equals
(
StoreMoveStep
.
BS_02_LocatinCylinder_Down
))
{
MoveInfo
.
NextMoveStep
(
StoreMoveStep
.
BS_03_DoorOpen
);
InOutStoreLog
(
moveName
+
":打开仓门,调用AgvClient.ReadyEmpty,等待Agv小车到达"
);
CylinderMove
(
MoveInfo
,
IO_Type
.
EntranceDoor_Close
,
IO_Type
.
EntranceDoor_Open
);
AgvClient
.
ReadyEmpty
(
Config
.
AgvNodeName
);
//等待小车到达
MoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitAgvAction
((
int
)
Asa
.
Actions
.
Arrive
));
}
else
if
(
MoveInfo
.
MoveStep
.
Equals
(
StoreMoveStep
.
BS_03_DoorOpen
))
{
MoveInfo
.
NextMoveStep
(
StoreMoveStep
.
BS_04_LineBack
);
if
(
instoreShelf
)
{
InOutStoreLog
(
moveName
+
":调用AgvClient.SendRFID【"
+
LastShelfData
.
ToData
()
+
"】,调用AgvClient.MayOut,线体开始反转"
);
//TODO AGV到达,发送料架信息,是否需要重新读取?
AgvClient
.
SendRFID
(
Config
.
AgvNodeName
,
LastShelfData
.
ToData
());
}
else
{
InOutStoreLog
(
moveName
+
": 调用AgvClient.MayOut,线体开始反转"
);
}
AgvClient
.
MayOut
(
Config
.
AgvNodeName
);
IOMove
(
IO_Type
.
Line_Run
,
IO_VALUE
.
LOW
);
IOMove
(
IO_Type
.
Line_BackRun
,
IO_VALUE
.
HIGH
);
}
else
if
(
MoveInfo
.
MoveStep
.
Equals
(
StoreMoveStep
.
BS_04_LineBack
))
{
MoveInfo
.
NextMoveStep
(
StoreMoveStep
.
BS_05_WaitInLineSingle
);
InOutStoreLog
(
moveName
+
":等待取料工位无信号,入料口有信号"
);
MoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitIO
(
IO_Type
.
LineTake_Check
,
IO_VALUE
.
LOW
));
MoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitIO
(
IO_Type
.
LineIn_Check
,
IO_VALUE
.
HIGH
));
}
else
if
(
MoveInfo
.
MoveStep
.
Equals
(
StoreMoveStep
.
BS_05_WaitInLineSingle
))
{
MoveInfo
.
NextMoveStep
(
StoreMoveStep
.
BS_06_WaitTime
);
InOutStoreLog
(
moveName
+
":再转动300时间,同时等待收到FinishOut"
);
MoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitTime
(
300
));
//等到小车离开
MoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitAgvAction
((
int
)
Asa
.
Actions
.
FinishOut
));
}
else
if
(
MoveInfo
.
MoveStep
.
Equals
(
StoreMoveStep
.
BS_06_WaitTime
))
{
//结束
MoveEndToRuningStatus
();
EmprtShelfList
=
new
ConcurrentQueue
<
string
>();
InOutStoreLog
(
moveName
+
":停止转动,料架入料结束"
);
IOMove
(
IO_Type
.
Line_Run
,
IO_VALUE
.
LOW
);
IOMove
(
IO_Type
.
Line_BackRun
,
IO_VALUE
.
LOW
);
}
}
#
endregion
#
region
压紧轴压紧处理
private
System
.
Timers
.
Timer
axisCheckTimer
=
null
;
private
string
TargetIoType
=
IO_Type
.
Compress_Check
;
private
IO_VALUE
TargetIoValue
=
IO_VALUE
.
HIGH
;
private
bool
ComAxisStartCheck
(
string
targetIo
=
""
,
IO_VALUE
value
=
IO_VALUE
.
HIGH
)
{
if
(
String
.
IsNullOrEmpty
(
targetIo
))
{
targetIo
=
IO_Type
.
Compress_Check
;
}
if
(
axisCheckTimer
==
null
)
{
axisCheckTimer
=
new
System
.
Timers
.
Timer
();
axisCheckTimer
.
AutoReset
=
true
;
axisCheckTimer
.
Interval
+=
30
;
axisCheckTimer
.
Elapsed
+=
CheckTimer_Elapsed
;
axisCheckTimer
.
Enabled
=
false
;
}
TargetIoValue
=
value
;
TargetIoType
=
targetIo
;
axisCheckTimer
.
Start
();
return
true
;
}
private
bool
ComAxisStopCheck
()
{
if
(!(
axisCheckTimer
==
null
))
{
axisCheckTimer
.
Stop
();
}
return
true
;
}
private
bool
IsInProcess
=
false
;
private
void
CheckTimer_Elapsed
(
object
sender
,
System
.
Timers
.
ElapsedEventArgs
e
)
{
if
(
IsInProcess
)
{
return
;
}
IsInProcess
=
true
;
if
(
IOValue
(
TargetIoType
).
Equals
(
TargetIoValue
))
{
LogUtil
.
info
(
Name
+
"上料轴,检测到 "
+
TargetIoType
+
"="
+
TargetIoValue
+
",可以停止运动"
);
ACServerManager
.
SuddenStop
(
Config
.
Comp_Axis
.
DeviceName
,
Config
.
Comp_Axis
.
GetAxisValue
());
ComAxisStopCheck
();
}
IsInProcess
=
false
;
}
#
endregion
#
region
出库
private
DateTime
startOutStoreTime
=
DateTime
.
Now
;
private
void
StartExecuctOut
(
InOutParam
param
)
{
bool
result
=
StartOutStoreMove
(
param
);
if
(!
result
)
{
LogInfo
(
" 执行出库【"
+
param
.
ToStr
()
+
"】失败,加入等待队列"
);
waitOutStoreList
.
Enqueue
(
param
);
}
}
/// <summary>
/// 开始出库运动
/// </summary>
...
...
@@ -365,36 +929,50 @@ namespace OnlineStore.DeviceLibrary
{
startOutStoreTime
=
DateTime
.
Now
;
string
posId
=
param
!=
null
?
param
.
PosID
:
""
;
if
(
storeRunStatus
==
StoreRunStatus
.
Runing
)
if
(
isInSuddenDown
||
isNoAirCheck
||
(!
storeRunStatus
.
Equals
(
StoreRunStatus
.
Runing
))
||
(!
MoveInfo
.
MoveType
.
Equals
(
StoreMoveType
.
None
)))
{
if
(!
StoreManager
.
LoadInoutParam
(
param
,
this
))
{
LogUtil
.
error
(
Name
+
" 启动出库【"
+
posId
+
"】出错,找不到库位信息"
);
return
false
;
}
if
(
IOValue
(
IO_Type
.
TrayCheck_Fixture
).
Equals
(
IO_VALUE
.
HIGH
))
{
LogUtil
.
error
(
Name
+
" 启动出库【"
+
posId
+
"】出错,叉子料盘检测有料"
);
return
false
;
}
storeStatus
=
StoreStatus
.
OutStoreExecute
;
LogInfo
(
"启动出库【"
+
posId
+
"】 "
);
storeRunStatus
=
StoreRunStatus
.
Busy
;
MoveInfo
.
NewMove
(
StoreMoveType
.
OutStore
,
param
);
LogUtil
.
error
(
Name
+
" 启动出库出错,忙碌或报警中 ,storeStatus="
+
storeRunStatus
+
",MoveType="
+
MoveInfo
.
MoveType
+
",isInSuddenDown="
+
isInSuddenDown
+
",isNoAirCheck"
+
isNoAirCheck
);
return
false
;
}
MoveInfo
.
NextMoveStep
(
StoreMoveStep
.
SO_32_DeviceBack
);
InOutStoreLog
(
"出库:SO_02 叉子先运动到P1 ,打开舱门 开始"
);
//ACAxisMove(Config.InOut_Axis, StoreMove.MoveParam.MoveP.InOut_P1, Config.InOutAxis_P1_Speed);
if
(!
StoreManager
.
LoadInoutParam
(
param
,
false
,
this
))
{
LogUtil
.
error
(
Name
+
" 启动出库【"
+
posId
+
"】出错,找不到库位信息"
);
return
false
;
}
if
(
IOValue
(
IO_Type
.
TrayCheck_Fixture
).
Equals
(
IO_VALUE
.
HIGH
))
{
LogUtil
.
error
(
Name
+
" 启动出库【"
+
posId
+
"】出错,叉子料盘检测有料"
);
return
false
;
}
storeStatus
=
StoreStatus
.
OutStoreExecute
;
LogInfo
(
"启动出库【"
+
posId
+
"】 NeedEnterShelf【"
+
MoveInfo
.
MoveParam
.
NeedEnterShelf
+
"】NeedOutShelf【"
+
MoveInfo
.
MoveParam
.
NeedOutShelf
+
"】 "
);
storeRunStatus
=
StoreRunStatus
.
Busy
;
MoveInfo
.
NewMove
(
StoreMoveType
.
OutStore
,
param
);
//当前无料架,或料架位置为空
if
((
IOValue
(
IO_Type
.
LineTake_Check
).
Equals
(
IO_VALUE
.
LOW
)
&&
MoveInfo
.
MoveParam
.
NeedEnterShelf
)
||
MoveInfo
.
MoveParam
.
ShelfPosID
.
Equals
(
""
))
{
MoveInfo
.
NextMoveStep
(
StoreMoveStep
.
BI_01_ReadyShelf
);
InOutStoreLog
(
"出库:ReadyShelf:通知agv调度准备带料架的小车,等待小车到达,进出轴到P1"
);
InOutBackToP1
(
MoveInfo
.
MoveParam
.
MoveP
.
InOut_P1
);
return
true
;
//需要先叫小车到达
AgvClient
.
ReadyShelf
(
Config
.
AgvNodeName
);
MoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitAgvAction
((
int
)
Asa
.
Actions
.
Arrive
));
}
else
{
LogUtil
.
error
(
Name
+
" 启动出库出错,当前状态,storeStatus="
+
storeRunStatus
);
MoveInfo
.
NextMoveStep
(
StoreMoveStep
.
SO_02_DeviceBack
);
InOutStoreLog
(
"出库:SO_02 进出轴到P1 开始"
);
InOutBackToP1
(
MoveInfo
.
MoveParam
.
MoveP
.
InOut_P1
);
}
return
false
;
return
true
;
}
protected
override
void
OutStoreProcess
()
{
LineMoveP
moveP
=
MoveInfo
.
MoveParam
.
MoveP
;
...
...
@@ -406,37 +984,39 @@ namespace OnlineStore.DeviceLibrary
{
return
;
}
if
(
MoveInfo
.
MoveStep
==
StoreMoveStep
.
SO_31_LocationCylinderDown
)
#
region
出入库步骤
if
(
MoveInfo
.
MoveStep
==
StoreMoveStep
.
SO_01_LocationCylinderDown
)
{
MoveInfo
.
NextMoveStep
(
StoreMoveStep
.
SO_
3
2_DeviceBack
);
InOutStoreLog
(
"出库:SO_02
叉子先运动
到P1 "
);
MoveInfo
.
NextMoveStep
(
StoreMoveStep
.
SO_
0
2_DeviceBack
);
InOutStoreLog
(
"出库:SO_02
进出轴
到P1 "
);
InOutBackToP1
(
MoveInfo
.
MoveParam
.
MoveP
.
InOut_P1
);
}
else
if
(
MoveInfo
.
MoveStep
==
StoreMoveStep
.
SO_
3
2_DeviceBack
)
else
if
(
MoveInfo
.
MoveStep
==
StoreMoveStep
.
SO_
0
2_DeviceBack
)
{
MoveInfo
.
NextMoveStep
(
StoreMoveStep
.
SO_
3
3_ToBagPosition
);
MoveInfo
.
NextMoveStep
(
StoreMoveStep
.
SO_
0
3_ToBagPosition
);
InOutStoreLog
(
"出库:SO_03 走到库位,压紧轴至P3(压紧前点) ,旋转轴至P2(库位点),升降轴至P5(库位出库前点)"
);
ACAxisMove
(
Config
.
Comp_Axis
,
moveP
.
ComPress_P3
,
Config
.
CompAxis_P3_Speed
);
ACAxisMove
(
Config
.
Middle_Axis
,
MoveInfo
.
MoveParam
.
MoveP
.
Middle_P2
,
Config
.
MiddleAxis_P2_Speed
);
ACAxisMove
(
Config
.
UpDown_Axis
,
MoveInfo
.
MoveParam
.
MoveP
.
UpDown_P5
,
Config
.
UpDownAxis_P5_Speed
);
}
else
if
(
MoveInfo
.
MoveStep
==
StoreMoveStep
.
SO_
3
3_ToBagPosition
)
else
if
(
MoveInfo
.
MoveStep
==
StoreMoveStep
.
SO_
0
3_ToBagPosition
)
{
MoveInfo
.
NextMoveStep
(
StoreMoveStep
.
SO_
3
4_DeviceToBag
);
MoveInfo
.
NextMoveStep
(
StoreMoveStep
.
SO_
0
4_DeviceToBag
);
InOutStoreLog
(
"出库:SO_04 叉子进入库位中, 进出轴至P3(库位取放料点) "
);
ACAxisMove
(
Config
.
InOut_Axis
,
moveP
.
InOut_P3
,
Config
.
InOutAxis_P3_Speed
);
}
else
if
(
MoveInfo
.
MoveStep
==
StoreMoveStep
.
SO_
3
4_DeviceToBag
)
else
if
(
MoveInfo
.
MoveStep
==
StoreMoveStep
.
SO_
0
4_DeviceToBag
)
{
MoveInfo
.
NextMoveStep
(
StoreMoveStep
.
SO_
3
5_BagWareToDevice
);
MoveInfo
.
NextMoveStep
(
StoreMoveStep
.
SO_
0
5_BagWareToDevice
);
InOutStoreLog
(
"出库:SO_05 拿起物品,升降轴至P6(库位出料缓冲点),压紧轴至P2(压紧点) "
);
ACAxisMove
(
Config
.
Comp_Axis
,
moveP
.
ComPress_P2
,
Config
.
CompAxis_P2_Speed
);
ACAxisMove
(
Config
.
UpDown_Axis
,
moveP
.
UpDown_P6
,
Config
.
UpDownAxis_P6_Speed
);
}
else
if
(
MoveInfo
.
MoveStep
==
StoreMoveStep
.
SO_
3
5_BagWareToDevice
)
else
if
(
MoveInfo
.
MoveStep
==
StoreMoveStep
.
SO_
0
5_BagWareToDevice
)
{
MoveInfo
.
NextMoveStep
(
StoreMoveStep
.
SO_
3
6_BagDeviceBack
);
MoveInfo
.
NextMoveStep
(
StoreMoveStep
.
SO_
0
6_BagDeviceBack
);
InOutStoreLog
(
"出库:SO_06 叉子从库位返回,进出轴至P1(待机点) "
);
//ACAxisMove(Config.InOut_Axis, moveP.InOut_P1, Config.InOutAxis_P1_Speed);
InOutBackToP1
(
moveP
.
InOut_P1
);
...
...
@@ -447,7 +1027,7 @@ namespace OnlineStore.DeviceLibrary
storeStatus
=
StoreStatus
.
OutStoreBoxEnd
;
}
else
if
(
MoveInfo
.
MoveStep
==
StoreMoveStep
.
SO_
3
6_BagDeviceBack
)
else
if
(
MoveInfo
.
MoveStep
==
StoreMoveStep
.
SO_
0
6_BagDeviceBack
)
{
if
(
IOValue
(
IO_Type
.
TrayCheck_Fixture
).
Equals
(
IO_VALUE
.
LOW
))
{
...
...
@@ -456,64 +1036,64 @@ namespace OnlineStore.DeviceLibrary
LogUtil
.
error
(
CodeMsg
);
}
MoveInfo
.
NextMoveStep
(
StoreMoveStep
.
SO_
3
8_ToShelfPosition
);
MoveInfo
.
NextMoveStep
(
StoreMoveStep
.
SO_
0
8_ToShelfPosition
);
InOutStoreLog
(
"出库:SO_08 走到料架位置,旋转轴至P101,升降轴至P102, "
);
ACAxisMove
(
Config
.
UpDown_Axis
,
moveP
.
UpDown_HP102
,
Config
.
UpDownAxis_P102_Speed
);
ACAxisMove
(
Config
.
Middle_Axis
,
moveP
.
Middle_P101
,
Config
.
MiddleAxis_P101_Speed
);
}
else
if
(
MoveInfo
.
MoveStep
==
StoreMoveStep
.
SO_
3
7_LocationCylinder_Up
)
else
if
(
MoveInfo
.
MoveStep
==
StoreMoveStep
.
SO_
0
7_LocationCylinder_Up
)
{
MoveInfo
.
NextMoveStep
(
StoreMoveStep
.
SO_
3
8_ToShelfPosition
);
MoveInfo
.
NextMoveStep
(
StoreMoveStep
.
SO_
0
8_ToShelfPosition
);
InOutStoreLog
(
"出库:SO_08 走到料架位置,旋转轴至P101,升降轴至P102, "
);
ACAxisMove
(
Config
.
UpDown_Axis
,
moveP
.
UpDown_HP102
,
Config
.
UpDownAxis_P102_Speed
);
ACAxisMove
(
Config
.
Middle_Axis
,
moveP
.
Middle_P101
,
Config
.
MiddleAxis_P101_Speed
);
}
else
if
(
MoveInfo
.
MoveStep
==
StoreMoveStep
.
SO_
3
8_ToShelfPosition
)
else
if
(
MoveInfo
.
MoveStep
==
StoreMoveStep
.
SO_
0
8_ToShelfPosition
)
{
MoveInfo
.
NextMoveStep
(
StoreMoveStep
.
SO_
4
0_WaitNoTray
);
MoveInfo
.
NextMoveStep
(
StoreMoveStep
.
SO_
1
0_WaitNoTray
);
}
//此处需要等待移栽没有工作,才能把盘放入出料口
else
if
(
MoveInfo
.
MoveStep
==
StoreMoveStep
.
SO_
3
9_LocationCylinder_Down
)
else
if
(
MoveInfo
.
MoveStep
==
StoreMoveStep
.
SO_
0
9_LocationCylinder_Down
)
{
MoveInfo
.
NextMoveStep
(
StoreMoveStep
.
SO_
4
0_WaitNoTray
);
MoveInfo
.
NextMoveStep
(
StoreMoveStep
.
SO_
1
0_WaitNoTray
);
}
else
if
(
MoveInfo
.
MoveStep
==
StoreMoveStep
.
SO_
4
0_WaitNoTray
)
else
if
(
MoveInfo
.
MoveStep
==
StoreMoveStep
.
SO_
1
0_WaitNoTray
)
{
MoveInfo
.
NextMoveStep
(
StoreMoveStep
.
SO_
4
1_DeviceToShelf
);
MoveInfo
.
NextMoveStep
(
StoreMoveStep
.
SO_
1
1_DeviceToShelf
);
InOutStoreLog
(
"出库:SO_10 叉子进出料口,进出轴至P101"
);
ACAxisMove
(
Config
.
InOut_Axis
,
moveP
.
InOut_P101
,
Config
.
InOutAxis_P101_Speed
);
}
else
if
(
MoveInfo
.
MoveStep
==
StoreMoveStep
.
SO_
4
1_DeviceToShelf
)
else
if
(
MoveInfo
.
MoveStep
==
StoreMoveStep
.
SO_
1
1_DeviceToShelf
)
{
MoveInfo
.
NextMoveStep
(
StoreMoveStep
.
SO_
4
2_DevicePutWare
);
MoveInfo
.
NextMoveStep
(
StoreMoveStep
.
SO_
1
2_DevicePutWare
);
InOutStoreLog
(
"出库:SO_11 放下物品,压紧轴到P1,升降轴至P101 "
);
ACAxisMove
(
Config
.
Comp_Axis
,
moveP
.
ComPress_P1
,
Config
.
CompAxis_P1_Speed
);
ACAxisMove
(
Config
.
UpDown_Axis
,
moveP
.
UpDown_LP101
,
Config
.
UpDownAxis_P101_Speed
);
}
else
if
(
MoveInfo
.
MoveStep
==
StoreMoveStep
.
SO_
4
2_DevicePutWare
)
else
if
(
MoveInfo
.
MoveStep
==
StoreMoveStep
.
SO_
1
2_DevicePutWare
)
{
MoveInfo
.
NextMoveStep
(
StoreMoveStep
.
SO_
4
3_DeviceOutFromDoor
);
MoveInfo
.
NextMoveStep
(
StoreMoveStep
.
SO_
1
3_DeviceOutFromDoor
);
InOutStoreLog
(
"出库:SO_12 叉子从出料口返回,,进出轴动作至P1(待机点) "
);
InOutBackToP1
(
moveP
.
InOut_P1
);
}
else
if
(
MoveInfo
.
MoveStep
==
StoreMoveStep
.
SO_
4
3_DeviceOutFromDoor
)
else
if
(
MoveInfo
.
MoveStep
==
StoreMoveStep
.
SO_
1
3_DeviceOutFromDoor
)
{
MoveInfo
.
NextMoveStep
(
StoreMoveStep
.
SO_
4
4_GoBack
);
MoveInfo
.
NextMoveStep
(
StoreMoveStep
.
SO_
1
4_GoBack
);
InOutStoreLog
(
"出库:SO_13 升降轴返回,轴2至P1(待机点) ,"
);
ACAxisMove
(
Config
.
UpDown_Axis
,
moveP
.
UpDown_P1
,
Config
.
UpDownAxis_P1_Speed
);
//发送消息给流水线
// SendOutStoreEnd(MoveInfo);
}
else
if
(
MoveInfo
.
MoveStep
==
StoreMoveStep
.
SO_
4
4_GoBack
)
else
if
(
MoveInfo
.
MoveStep
==
StoreMoveStep
.
SO_
1
4_GoBack
)
{
//判断是否需要送出料架
if
(
waitOutStoreList
.
Count
<=
0
)
if
(
EmprtShelfList
.
Count
<=
0
)
{
StartShelfOut
();
}
else
{
...
...
@@ -521,10 +1101,18 @@ namespace OnlineStore.DeviceLibrary
string
posId
=
MoveInfo
.
MoveParam
!=
null
?
MoveInfo
.
MoveParam
.
PosID
:
""
;
storeStatus
=
StoreStatus
.
StoreOnline
;
LogInfo
(
" 【"
+
posId
+
"】 整个出库流程结束,耗时【"
+
FormUtil
.
GetSpanStr
(
span
)
+
"】!"
);
MoveInfo
.
EndMove
();
storeRunStatus
=
StoreRunStatus
.
Runing
;
MoveEndToRuningStatus
()
;
AutoInout
.
InOutEndProcess
(
this
,
StoreMoveType
.
OutStore
);
}
}
#
endregion
else
if
(
MoveInfo
.
MoveStep
<=
StoreMoveStep
.
SO_01_LocationCylinderDown
)
{
ShelfEnterProcess
();
}
else
if
(
MoveInfo
.
MoveStep
>=
StoreMoveStep
.
BS_01_TopCylinder_Down
)
{
ShelfOutProcess
();
}
else
{
...
...
@@ -535,22 +1123,55 @@ namespace OnlineStore.DeviceLibrary
#
endregion
public
List
<
InOutParam
>
waitOutStoreList
=
new
List
<
InOutParam
>();
public
object
waitOutListLock
=
""
;
public
void
AddWaitOutInfo
(
InOutParam
code
)
#
region
AGV
internal
bool
ProcessAGVAction
(
string
name
,
Asa
.
Actions
action
)
{
lock
(
waitOutListLock
)
string
logN
=
name
+
"收到调度【"
+
name
+
"】=【"
+
action
+
"】"
;
//状态处理
if
(
action
.
Equals
(
Asa
.
Actions
.
Usable
))
{
//判断入口是否可用:入口无料架,缓冲工位无料架,不在入料架处理中
bool
usable
=
(
storeRunStatus
.
Equals
(
StoreRunStatus
.
Runing
)
&&
waitOutStoreList
.
Count
<=
0
&&
MoveInfo
.
MoveType
.
Equals
(
StoreMoveType
.
None
)
&&
alarmType
.
Equals
(
StoreAlarmType
.
None
)
&&
IOValue
(
IO_Type
.
LineIn_Check
).
Equals
(
IO_VALUE
.
LOW
)
&&
IOValue
(
IO_Type
.
LineTake_Check
).
Equals
(
IO_VALUE
.
LOW
));
LogUtil
.
info
(
logN
+
":"
+
usable
);
return
usable
;
}
else
if
(
action
.
Equals
(
Asa
.
Actions
.
Arrive
))
{
//出库处理中不处理
if
(
MoveInfo
.
MoveType
.
Equals
(
StoreMoveType
.
OutStore
))
{
return
true
;
}
if
(
IOValue
(
IO_Type
.
LineIn_Check
).
Equals
(
IO_VALUE
.
LOW
))
{
LogUtil
.
info
(
logN
+
" ,未检测到:LineIn_Check,不处理"
);
return
false
;
}
//小车到达,开始处理
if
(
storeRunStatus
.
Equals
(
StoreRunStatus
.
Runing
)
&&
MoveInfo
.
MoveType
.
Equals
(
StoreMoveType
.
None
)
&&
IOValue
(
IO_Type
.
LineTake_Check
).
Equals
(
IO_VALUE
.
LOW
))
{
StartShelfInStore
();
return
true
;
}
}
else
{
waitOutStoreList
.
Add
(
code
);
LogUtil
.
info
(
name
+
logN
+
" ,未找到相关处理"
);
}
return
false
;
}
private
void
InOutStoreLog
(
string
msg
)
{
string
posId
=
MoveInfo
.
MoveParam
!=
null
?
MoveInfo
.
MoveParam
.
PosID
:
""
;
string
shelfId
=
MoveInfo
.
MoveParam
!=
null
?
"_"
+
MoveInfo
.
MoveParam
.
ShelfPosID
:
"_"
;
LogInfo
(
"["
+
posId
+
shelfId
+
"]"
+
MoveInfo
.
MoveStep
+
":"
+
msg
);
}
#
endregion
}
}
source/DeviceLibrary/ACPackingStore/AC_BOX_Bean_Shelf.cs
deleted
100644 → 0
查看文件 @
2ae1c88
using
Asa
;
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
{
/// <summary>
/// 料架新增的出入库逻辑
/// </summary>
partial
class
AC_BOX_Bean
{
private
List
<
string
>
LastScanCodes
=
new
List
<
string
>();
private
int
ComTargetPosition
=
0
;
private
int
LastWidth
=
0
;
private
int
LastHeight
=
0
;
private
RFIDData
LastShelfData
=
new
RFIDData
(
0
);
private
void
ClearLastTrayInfo
()
{
LastScanCodes
=
new
List
<
string
>();
ComTargetPosition
=
0
;
LastWidth
=
0
;
LastHeight
=
0
;
}
/// <summary>
/// 开始入库移动移动
/// </summary>
public
void
StartShelfInStore
()
{
bool
canStart
=
(
storeRunStatus
.
Equals
(
StoreRunStatus
.
Runing
)
&&
MoveInfo
.
MoveType
.
Equals
(
StoreMoveType
.
None
)
&&
IOValue
(
IO_Type
.
LineIn_Check
).
Equals
(
IO_VALUE
.
HIGH
));
if
(!
canStart
)
{
return
;
}
//读取RFID
RFIDData
data
=
RFIDManager
.
ReadData
(
Config
.
RFID_IP
);
//TODO 判断料架是否正确
if
(
data
.
RFType
.
Equals
(
"A"
))
{
LastShelfData
=
data
;
AgvClient
.
SendRFID
(
Config
.
AgvNodeName
,
data
.
ToData
());
}
else
{
LogUtil
.
error
(
Name
+
"检测到入料口有料架,读取RFID数据错误:"
+
data
.
ToStr
());
return
;
}
storeRunStatus
=
StoreRunStatus
.
Busy
;
storeStatus
=
StoreStatus
.
InStoreExecute
;
EmprtShelfList
=
new
Queue
<
string
>();
LogInfo
(
" 空闲中,读取到料架"
+
data
.
ToStr
()
+
",料架入库:入料口移门打开,"
);
MoveInfo
.
NewMove
(
StoreMoveType
.
InStore
,
new
InOutParam
());
MoveInfo
.
MoveParam
.
MoveP
=
new
LineMoveP
();
MoveInfo
.
MoveParam
.
MoveP
.
ComPress_P1
=
Config
.
CompAxis_P1_Position
;
MoveInfo
.
MoveParam
.
MoveP
.
InOut_P1
=
Config
.
InOutAxis_P1_Position
;
MoveInfo
.
MoveParam
.
MoveP
.
Middle_P1
=
Config
.
MiddleAxis_P1
;
MoveInfo
.
MoveParam
.
MoveP
.
UpDown_P1
=
Config
.
UpDownAxis_P1
;
MoveInfo
.
MoveParam
.
MoveP
.
UpDown_P2
=
Config
.
UpDownAxis_P2
;
MoveInfo
.
ShelfPositionList
=
new
List
<
string
>(
ShelfPosList
);
MoveInfo
.
NextMoveStep
(
StoreMoveStep
.
BI_02_DoorOpen
);
CylinderMove
(
MoveInfo
,
IO_Type
.
EntranceDoor_Close
,
IO_Type
.
EntranceDoor_Open
);
}
private
void
ShelfInStoreProcess
()
{
LineMoveP
moveP
=
MoveInfo
.
MoveParam
.
MoveP
;
#
region
料架移入料仓内部处理
//if (MoveInfo.MoveStep.Equals(StoreMoveStep.BI_01_LineIn_Check))
//{
// MoveInfo.NextMoveStep(StoreMoveStep.BI_02_DoorOpen);
// InOutStoreLog("料架入库:入料口移门打开");
// CylinderMove(MoveInfo, IO_Type.EntranceDoor_Close, IO_Type.EntranceDoor_Open);
//}
//else
if
(
MoveInfo
.
MoveStep
.
Equals
(
StoreMoveStep
.
BI_02_DoorOpen
))
{
MoveInfo
.
NextMoveStep
(
StoreMoveStep
.
BI_03_LineRun
);
InOutStoreLog
(
"料架入库:调用AgvClient.MayEnter,线体正转,等待取料位检测到信号"
);
AgvClient
.
MayEnter
(
Config
.
AgvNodeName
);
IOMove
(
IO_Type
.
Line_BackRun
,
IO_VALUE
.
LOW
);
IOMove
(
IO_Type
.
Line_Run
,
IO_VALUE
.
HIGH
);
MoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitIO
(
IO_Type
.
LineIn_Check
,
IO_VALUE
.
LOW
));
MoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitIO
(
IO_Type
.
LineTake_Check
,
IO_VALUE
.
HIGH
));
}
else
if
(
MoveInfo
.
MoveStep
.
Equals
(
StoreMoveStep
.
BI_03_LineRun
))
{
MoveInfo
.
NextMoveStep
(
StoreMoveStep
.
BI_04_LineStop
);
InOutStoreLog
(
"料架入库:调用AgvClient.FinishEnter,取料位检测到信号,停止线体正转"
);
IOMove
(
IO_Type
.
Line_Run
,
IO_VALUE
.
LOW
);
AgvClient
.
FinishEnter
(
Config
.
AgvNodeName
);
}
else
if
(
MoveInfo
.
MoveStep
.
Equals
(
StoreMoveStep
.
BI_04_LineStop
))
{
MoveInfo
.
NextMoveStep
(
StoreMoveStep
.
BI_05_DoorClose
);
InOutStoreLog
(
"料架入库:入料口移门关闭"
);
CylinderMove
(
MoveInfo
,
IO_Type
.
EntranceDoor_Open
,
IO_Type
.
EntranceDoor_Close
);
}
else
if
(
MoveInfo
.
MoveStep
.
Equals
(
StoreMoveStep
.
BI_05_DoorClose
))
{
MoveInfo
.
NextMoveStep
(
StoreMoveStep
.
BI_06_LocationUp
);
InOutStoreLog
(
"料架入库:定位装置上升"
);
CylinderMove
(
MoveInfo
,
IO_Type
.
LocationCylinder_Down
,
IO_Type
.
LocationCylinder_Up
);
}
else
if
(
MoveInfo
.
MoveStep
.
Equals
(
StoreMoveStep
.
BI_06_LocationUp
))
{
MoveInfo
.
NextMoveStep
(
StoreMoveStep
.
BI_07_TopCylinderUp
);
InOutStoreLog
(
"料架入库:顶升装置上升"
);
CylinderMove
(
MoveInfo
,
IO_Type
.
TopCylinder_Down
,
IO_Type
.
TopCylinder_Up
);
}
else
if
(
MoveInfo
.
MoveStep
.
Equals
(
StoreMoveStep
.
BI_07_TopCylinderUp
))
{
MoveInfo
.
NextMoveStep
(
StoreMoveStep
.
BI_08_StartGetTray
);
InOutStoreLog
(
"料架入库:开始循环从第一个空位逐个取料盘,扫码入库"
);
}
#
endregion
#
region
料架取料盘扫码获取
POSID
else
if
(
MoveInfo
.
MoveStep
.
Equals
(
StoreMoveStep
.
BI_08_StartGetTray
))
{
if
(
MoveInfo
.
NextShelfPos
())
{
//新的料架库位
MoveInfo
.
NextMoveStep
(
StoreMoveStep
.
BI_11_InoutToP1
);
InOutStoreLog
(
"料架取料:叉子后退到待机点P1, 重置盘信息"
);
ACAxisMove
(
Config
.
InOut_Axis
,
Config
.
InOutAxis_P1_Position
,
Config
.
InOutAxis_P1_Speed
);
ClearLastTrayInfo
();
}
else
{
//所有料盘已取料完成,送出料架
StartSendShelfOut
();
}
}
else
if
(
MoveInfo
.
MoveStep
.
Equals
(
StoreMoveStep
.
BI_11_InoutToP1
))
{
MoveInfo
.
NextMoveStep
(
StoreMoveStep
.
BI_12_MoveToShelf
);
InOutStoreLog
(
"料架取料:升降轴移动到P101低点,旋转轴移动到P101点,压紧轴到压紧前点"
);
ACAxisMove
(
Config
.
UpDown_Axis
,
moveP
.
UpDown_LP101
,
Config
.
UpDownAxis_P101_Speed
);
ACAxisMove
(
Config
.
Middle_Axis
,
moveP
.
Middle_P101
,
Config
.
MiddleAxis_P101_Speed
);
ACAxisMove
(
Config
.
Comp_Axis
,
Config
.
CompAxis_P3_Position
,
Config
.
CompAxis_P3_Speed
);
}
else
if
(
MoveInfo
.
MoveStep
.
Equals
(
StoreMoveStep
.
BI_12_MoveToShelf
))
{
MoveInfo
.
NextMoveStep
(
StoreMoveStep
.
BI_13_InoutToP101
);
InOutStoreLog
(
"料架取料:叉子前进到P101点"
);
ACAxisMove
(
Config
.
InOut_Axis
,
moveP
.
InOut_P101
,
Config
.
InOutAxis_P101_Speed
);
}
else
if
(
MoveInfo
.
MoveStep
.
Equals
(
StoreMoveStep
.
BI_13_InoutToP101
))
{
MoveInfo
.
NextMoveStep
(
StoreMoveStep
.
BI_14_UpdownToP102
);
InOutStoreLog
(
"料架取料:升降轴上升到P102点"
);
ACAxisMove
(
Config
.
UpDown_Axis
,
moveP
.
UpDown_HP102
,
Config
.
UpDownAxis_P102_Speed
);
}
else
if
(
MoveInfo
.
MoveStep
.
Equals
(
StoreMoveStep
.
BI_14_UpdownToP102
))
{
MoveInfo
.
NextMoveStep
(
StoreMoveStep
.
BI_15_StartCompress
);
InOutStoreLog
(
"料架取料:压紧轴开始缓慢压紧到P4"
);
MoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitComAxis
(
Config
.
Comp_Axis
,
Config
.
CompAxis_P4_Position
,
Config
.
CompAxis_P4_Speed
));
Config
.
Comp_Axis
.
TargetPosition
=
Config
.
CompAxis_P4_Position
;
ACServerManager
.
AbsMove
(
Config
.
Comp_Axis
.
DeviceName
,
Config
.
Comp_Axis
.
GetAxisValue
(),
Config
.
CompAxis_P4_Position
,
Config
.
CompAxis_P4_Speed
);
ComAxisStartCheck
();
}
else
if
(
MoveInfo
.
MoveStep
.
Equals
(
StoreMoveStep
.
BI_15_StartCompress
))
{
MoveInfo
.
NextMoveStep
(
StoreMoveStep
.
BI_16_ComAxisDownMove
);
int
currPosition
=
ACServerManager
.
GetActualtPosition
(
Config
.
Comp_Axis
);
ComTargetPosition
=
currPosition
;
int
targetP
=
currPosition
+
Config
.
CompAxis_Down_Position
;
LastHeight
=
Config
.
GetComP2PlateH
(
targetP
);
InOutStoreLog
(
"料架取料:检测到料叉压紧确认信号,向下押金【"
+
ComTargetPosition
+
"】目标【"
+
targetP
+
"】,记录料盘高度【"
+
LastHeight
+
"】"
);
ACAxisMove
(
Config
.
Comp_Axis
,
targetP
,
Config
.
CompAxis_P1_Speed
);
}
else
if
(
MoveInfo
.
MoveStep
.
Equals
(
StoreMoveStep
.
BI_16_ComAxisDownMove
))
{
MoveInfo
.
NextMoveStep
(
StoreMoveStep
.
BI_17_InoutBack
);
InOutStoreLog
(
"料架取料:记录压紧高度,叉子后退到扫码点"
);
ACAxisMove
(
Config
.
InOut_Axis
,
Config
.
InOutAxis_P1_Position
,
Config
.
CompAxis_P1_Speed
);
}
else
if
(
MoveInfo
.
MoveStep
.
Equals
(
StoreMoveStep
.
BI_17_InoutBack
))
{
if
(
IOValue
(
IO_Type
.
TrayCheck_3
).
Equals
(
IO_VALUE
.
HIGH
)
&&
IOValue
(
IO_Type
.
TrayCheck_4
).
Equals
(
IO_VALUE
.
HIGH
))
{
LastWidth
=
13
;
}
else
if
(
IOValue
(
IO_Type
.
TrayCheck_1
).
Equals
(
IO_VALUE
.
HIGH
)
&&
IOValue
(
IO_Type
.
TrayCheck_2
).
Equals
(
IO_VALUE
.
HIGH
))
{
LastWidth
=
7
;
}
else
{
LogUtil
.
info
(
"未检测到识别区料盘检测信号, 默认高度为7"
);
}
if
(
MoveInfo
.
SingleInstore
)
{
//单盘入库,不需要扫码
StartMoveToBag
();
}
else
{
MoveInfo
.
NextMoveStep
(
StoreMoveStep
.
BI_18_ScanCode
);
InOutStoreLog
(
"料架取料:记录宽度,开始扫码"
);
MoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitTime
(
5000
));
MoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitCode
());
Task
.
Factory
.
StartNew
(
delegate
{
IOMove
(
IO_Type
.
Camera_Led
,
IO_VALUE
.
HIGH
);
LastScanCodes
=
CodeManager
.
CameraScan
(
Config
.
GetCameraList
());
IOMove
(
IO_Type
.
Camera_Led
,
IO_VALUE
.
LOW
);
});
}
}
else
if
(
MoveInfo
.
MoveStep
.
Equals
(
StoreMoveStep
.
BI_18_ScanCode
))
{
if
(
LastScanCodes
.
Count
<=
0
)
{
StartSendTray
(
"扫码失败"
);
}
else
{
MoveInfo
.
NextMoveStep
(
StoreMoveStep
.
BI_19_GetPosId
);
InOutStoreLog
(
"料架取料:扫码成功,从服务器获取库位号"
);
MoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitTime
(
10000
));
bool
result
=
GetPosIdByCode
();
if
(
result
)
{
MoveInfo
.
NextMoveStep
(
StoreMoveStep
.
BI_20_SetInstoreParam
);
InOutStoreLog
(
"料架取料: 获取库位号完成,设置位置参数,开始入库"
);
}
else
{
StartSendTray
(
"获取入库库位失败"
);
}
}
}
else
if
(
MoveInfo
.
MoveStep
.
Equals
(
StoreMoveStep
.
BI_19_GetPosId
))
{
MoveInfo
.
NextMoveStep
(
StoreMoveStep
.
BI_20_SetInstoreParam
);
InOutStoreLog
(
"料架取料: 获取库位号完成,设置位置参数,开始入库"
);
}
#
endregion
#
region
入库逻辑
else
if
(
MoveInfo
.
MoveStep
.
Equals
(
StoreMoveStep
.
BI_20_SetInstoreParam
))
{
StartMoveToBag
();
}
else
if
(
MoveInfo
.
MoveStep
.
Equals
(
StoreMoveStep
.
BI_21_MoveToBag
))
{
MoveInfo
.
NextMoveStep
(
StoreMoveStep
.
BI_22_DeviceToBag
);
InOutStoreLog
(
"入库:叉子进入库位中,轴3( 叉子) 至P3(库位取放料点)"
);
ACAxisMove
(
Config
.
InOut_Axis
,
moveP
.
InOut_P3
,
Config
.
InOutAxis_P3_Speed
);
}
else
if
(
MoveInfo
.
MoveStep
.
Equals
(
StoreMoveStep
.
BI_22_DeviceToBag
))
{
MoveInfo
.
NextMoveStep
(
StoreMoveStep
.
BI_23_PutWareToBag
);
InOutStoreLog
(
"入库:放下物品,轴2( 上下) 至P4( 库位入料缓冲点)轴4( 压紧) 至P3( 压紧前点)"
);
// 5= 入仓位完成(料仓Box把料盘放入对应的库位中,装置还未恢复原始状态)
string
posId
=
MoveInfo
.
MoveParam
!=
null
?
MoveInfo
.
MoveParam
.
PosID
:
""
;
lastPosId
=
posId
;
lastPosIdStatus
=
StoreStatus
.
InStoreEnd
;
storeStatus
=
StoreStatus
.
InStoreEnd
;
//手动发给服务器状态,防止没有手动
//SendLineStatus(StoreID, posId, StoreStatus.InStoreEnd);
ACAxisMove
(
Config
.
Comp_Axis
,
moveP
.
ComPress_P3
,
Config
.
CompAxis_P3_Speed
);
ACAxisMove
(
Config
.
UpDown_Axis
,
moveP
.
UpDown_P4
,
Config
.
UpDownAxis_P4_Speed
);
}
else
if
(
MoveInfo
.
MoveStep
.
Equals
(
StoreMoveStep
.
BI_23_PutWareToBag
))
{
MoveInfo
.
NextMoveStep
(
StoreMoveStep
.
BI_24_DeviceBackFromBag
);
InOutStoreLog
(
"入库:叉子从库位中返回,轴3( 叉子) 动作至P1( 待机点)"
);
ACAxisMove
(
Config
.
InOut_Axis
,
Config
.
InOutAxis_P1_Position
,
Config
.
InOutAxis_P1_Speed
);
}
else
if
(
MoveInfo
.
MoveStep
.
Equals
(
StoreMoveStep
.
BI_24_DeviceBackFromBag
))
{
MoveInfo
.
NextMoveStep
(
StoreMoveStep
.
BI_25_GoBack
);
InOutStoreLog
(
"入库:返回待机点,轴2/轴1/轴4动作至P1( 待机点))开始"
);
ACAxisMove
(
Config
.
Comp_Axis
,
moveP
.
ComPress_P1
,
Config
.
CompAxis_P1_Speed
);
ACAxisMove
(
Config
.
Middle_Axis
,
moveP
.
Middle_P1
,
Config
.
MiddleAxis_P1_Speed
);
ACAxisMove
(
Config
.
UpDown_Axis
,
moveP
.
UpDown_P1
,
Config
.
UpDownAxis_P1_Speed
);
}
else
if
(
MoveInfo
.
MoveStep
.
Equals
(
StoreMoveStep
.
BI_25_GoBack
))
{
MoveInfo
.
NextMoveStep
(
StoreMoveStep
.
BI_08_StartGetTray
);
InOutStoreLog
(
"料架入库:开始循环逐个取料盘,扫码入库"
);
}
#
endregion
#
region
把料盘送到
NG
逻辑
else
if
(
MoveInfo
.
MoveStep
.
Equals
(
StoreMoveStep
.
BI_31_ToNGDoor
))
{
MoveInfo
.
NextMoveStep
(
StoreMoveStep
.
BI_32_NGDoorUp
);
InOutStoreLog
(
"送出料盘:NG料口升降门上升"
);
CylinderMove
(
MoveInfo
,
IO_Type
.
NGDoorCylinder_Down
,
IO_Type
.
NGDoowCylinder_Up
);
}
else
if
(
MoveInfo
.
MoveStep
.
Equals
(
StoreMoveStep
.
BI_32_NGDoorUp
))
{
MoveInfo
.
NextMoveStep
(
StoreMoveStep
.
BI_33_InoutToNGDoor
);
InOutStoreLog
(
"送出料盘:进出轴前进到NG料门口位置"
);
ACAxisMove
(
Config
.
InOut_Axis
,
moveP
.
InOut_P2
,
Config
.
InOutAxis_P2_Speed
);
}
else
if
(
MoveInfo
.
MoveStep
.
Equals
(
StoreMoveStep
.
BI_33_InoutToNGDoor
))
{
MoveInfo
.
NextMoveStep
(
StoreMoveStep
.
BI_34_UpdownDown
);
InOutStoreLog
(
"送出料盘:升降轴缓慢下降,放下料盘"
);
ACAxisMove
(
Config
.
UpDown_Axis
,
moveP
.
UpDown_P2
,
Config
.
UpDownAxis_P2_Speed
);
ACAxisMove
(
Config
.
Comp_Axis
,
moveP
.
ComPress_P3
,
Config
.
CompAxis_P3_Speed
);
}
else
if
(
MoveInfo
.
MoveStep
.
Equals
(
StoreMoveStep
.
BI_34_UpdownDown
))
{
MoveInfo
.
NextMoveStep
(
StoreMoveStep
.
BI_35_InoutToP1
);
InOutStoreLog
(
"送出料盘:叉子后退到P1"
);
ACAxisMove
(
Config
.
InOut_Axis
,
moveP
.
InOut_P1
,
Config
.
InOutAxis_P1_Speed
);
}
else
if
(
MoveInfo
.
MoveStep
.
Equals
(
StoreMoveStep
.
BI_35_InoutToP1
))
{
MoveInfo
.
NextMoveStep
(
StoreMoveStep
.
BI_36_NGDoorDown
);
InOutStoreLog
(
"送出料盘:关门NG料门,送出料盘结束"
);
CylinderMove
(
MoveInfo
,
IO_Type
.
NGDoowCylinder_Up
,
IO_Type
.
NGDoorCylinder_Down
);
}
else
if
(
MoveInfo
.
MoveStep
.
Equals
(
StoreMoveStep
.
BI_36_NGDoorDown
))
{
MoveInfo
.
NextMoveStep
(
StoreMoveStep
.
BI_08_StartGetTray
);
InOutStoreLog
(
"料架入库:开始循环逐个取料盘,扫码入库"
);
}
#
endregion
//料架送出逻辑
else
if
(
MoveInfo
.
MoveStep
>=
StoreMoveStep
.
BS_01_TopCylinder_Down
&&
MoveInfo
.
MoveStep
>=
StoreMoveStep
.
BS_06_WaitTime
)
{
SendShelfProcess
();
}
else
{
LogInfo
(
" 入库,moveStatus="
+
MoveInfo
.
MoveStep
+
",没有对应的处理!"
);
}
}
private
void
StartMoveToBag
()
{
MoveInfo
.
NextMoveStep
(
StoreMoveStep
.
BI_21_MoveToBag
);
InOutStoreLog
(
"入库:移动到库位点,轴1( 转盘) 至P2( 库位点)轴2(上下) 至P3(库位入库前点)"
);
ACAxisMove
(
Config
.
Middle_Axis
,
MoveInfo
.
MoveParam
.
MoveP
.
Middle_P2
,
Config
.
MiddleAxis_P2_Speed
);
ACAxisMove
(
Config
.
UpDown_Axis
,
MoveInfo
.
MoveParam
.
MoveP
.
UpDown_P3
,
Config
.
UpDownAxis_P3_Speed
);
}
private
void
StartSendTray
(
string
str
=
"扫码失败"
)
{
MoveInfo
.
NextMoveStep
(
StoreMoveStep
.
BI_31_ToNGDoor
);
InOutStoreLog
(
"送出料盘:"
+
str
+
",升降轴移动到NG料门口上端,旋转轴移动到NG料门口"
);
ACAxisMove
(
Config
.
UpDown_Axis
,
MoveInfo
.
MoveParam
.
MoveP
.
UpDown_P1
,
Config
.
UpDownAxis_P1_Speed
);
ACAxisMove
(
Config
.
Middle_Axis
,
MoveInfo
.
MoveParam
.
MoveP
.
Middle_P1
,
Config
.
MiddleAxis_P1_Speed
);
}
private
void
StartSendShelfOut
()
{
MoveInfo
.
NextMoveStep
(
StoreMoveStep
.
BS_01_TopCylinder_Down
);
InOutStoreLog
(
"送出料架:顶升气缸下降"
);
CylinderMove
(
MoveInfo
,
IO_Type
.
TopCylinder_Up
,
IO_Type
.
TopCylinder_Down
);
}
private
void
SendShelfProcess
()
{
if
(
MoveInfo
.
MoveStep
.
Equals
(
StoreMoveStep
.
BS_01_TopCylinder_Down
))
{
MoveInfo
.
NextMoveStep
(
StoreMoveStep
.
BS_02_LocatinCylinder_Down
);
InOutStoreLog
(
"送出料架:定位气缸下降"
);
CylinderMove
(
MoveInfo
,
IO_Type
.
LocationCylinder_Up
,
IO_Type
.
LocationCylinder_Down
);
}
else
if
(
MoveInfo
.
MoveStep
.
Equals
(
StoreMoveStep
.
BS_02_LocatinCylinder_Down
))
{
MoveInfo
.
NextMoveStep
(
StoreMoveStep
.
BS_03_DoorOpen
);
InOutStoreLog
(
"送出料架:打开仓门,调用AgvClient.ReadyEmpty,等待Agv小车到达"
);
CylinderMove
(
MoveInfo
,
IO_Type
.
EntranceDoor_Close
,
IO_Type
.
EntranceDoor_Open
);
AgvClient
.
ReadyEmpty
(
Config
.
AgvNodeName
);
//等待小车到达
MoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitAgvAction
((
int
)
Asa
.
Actions
.
Arrive
));
}
else
if
(
MoveInfo
.
MoveStep
.
Equals
(
StoreMoveStep
.
BS_03_DoorOpen
))
{
MoveInfo
.
NextMoveStep
(
StoreMoveStep
.
BS_04_LineBack
);
InOutStoreLog
(
"送出料架:调用AgvClient.SendRFID【"
+
LastShelfData
.
ToData
()
+
"】,调用AgvClient.MayOut,线体开始反转"
);
//TODO AGV到达,发送料架信息,是否需要重新读取?
AgvClient
.
SendRFID
(
Config
.
AgvNodeName
,
LastShelfData
.
ToData
());
AgvClient
.
MayOut
(
Config
.
AgvNodeName
);
IOMove
(
IO_Type
.
Line_Run
,
IO_VALUE
.
LOW
);
IOMove
(
IO_Type
.
Line_BackRun
,
IO_VALUE
.
HIGH
);
}
else
if
(
MoveInfo
.
MoveStep
.
Equals
(
StoreMoveStep
.
BS_04_LineBack
))
{
MoveInfo
.
NextMoveStep
(
StoreMoveStep
.
BS_05_WaitInLineSingle
);
InOutStoreLog
(
"送出料架:等待取料工位无信号,入料口有信号"
);
MoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitIO
(
IO_Type
.
LineTake_Check
,
IO_VALUE
.
LOW
));
MoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitIO
(
IO_Type
.
LineIn_Check
,
IO_VALUE
.
HIGH
));
}
else
if
(
MoveInfo
.
MoveStep
.
Equals
(
StoreMoveStep
.
BS_05_WaitInLineSingle
))
{
MoveInfo
.
NextMoveStep
(
StoreMoveStep
.
BS_06_WaitTime
);
InOutStoreLog
(
"送出料架:再转动300时间,同时等待收到FinishOut"
);
MoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitTime
(
300
));
//等到小车离开
MoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitAgvAction
((
int
)
Asa
.
Actions
.
FinishOut
));
}
else
if
(
MoveInfo
.
MoveStep
.
Equals
(
StoreMoveStep
.
BS_06_WaitTime
))
{
//结束
MoveInfo
.
EndMove
();
storeRunStatus
=
StoreRunStatus
.
Runing
;
storeStatus
=
StoreStatus
.
StoreOnline
;
EmprtShelfList
=
new
Queue
<
string
>();
InOutStoreLog
(
"送出料架:停止转动,料架入料结束"
);
IOMove
(
IO_Type
.
Line_Run
,
IO_VALUE
.
LOW
);
IOMove
(
IO_Type
.
Line_BackRun
,
IO_VALUE
.
LOW
);
}
//else if (MoveInfo.MoveStep.Equals(StoreMoveStep.BS_07_LineStop))
//{
// MoveInfo.NextMoveStep(StoreMoveStep.BS_08_CallAGV);
// InOutStoreLog("送出料架:通知调度系统拿走");
// //TODO
//}
//else if (MoveInfo.MoveStep.Equals(StoreMoveStep.BS_08_CallAGV))
//{
// MoveInfo.NextMoveStep(StoreMoveStep.BS_09_CloseDoor);
// InOutStoreLog("送出料架:关闭仓门");
// CylinderMove(MoveInfo, IO_Type.EntranceDoor_Open, IO_Type.EntranceDoor_Close);
//}
//else if (MoveInfo.MoveStep.Equals(StoreMoveStep.BS_09_CloseDoor))
//{
//}
}
#
region
扫码获取库位
private
string
ProcessCode
()
{
string
message
=
""
;
string
spiltStr
=
"##"
;
string
codeSize
=
LastWidth
+
"x"
+
LastHeight
;
foreach
(
string
str
in
LastScanCodes
)
{
if
(
str
.
Trim
().
Equals
(
""
))
{
continue
;
}
string
code
=
"=1+0x0-"
+
codeSize
+
"="
+
str
.
Trim
();
if
(!
String
.
IsNullOrEmpty
(
code
))
{
message
=
message
+
code
+
spiltStr
;
}
}
return
message
;
}
/// <summary>
/// 扫码枪数据接收
/// </summary>
/// <param name="message"></param>
private
bool
GetPosIdByCode
()
{
try
{
string
message
=
ProcessCode
();
if
(
message
.
Equals
(
""
)
||
string
.
IsNullOrEmpty
(
message
))
{
CodeMsg
=
"未扫到二维码"
;
LogInfo
(
"未扫到二维码"
);
return
false
;
}
if
(
storeRunStatus
.
Equals
(
StoreRunStatus
.
Wait
))
{
LogInfo
(
"二维码【 "
+
message
+
"】,设备未启动,不需要发送服务器"
);
return
false
;
}
// CodeMsg = "收到二维码【 " + message + "】,发送给服务器获取入库PosID";
LogUtil
.
info
(
Name
+
"二维码【 "
+
message
+
"】,发送给服务器获取入库PosID"
);
//发送扫码内容到服务器进行入库操作
Operation
operation
=
getLineBoxStatus
();
operation
.
op
=
1
;
operation
.
data
=
new
Dictionary
<
string
,
string
>()
{
{
"code"
,
message
},
{
"boxId"
,
DeviceID
.
ToString
()
}
};
string
server
=
ConfigAppSettings
.
GetValue
(
Setting_Init
.
http_server
);
Operation
resultOperation
=
HttpHelper
.
Post
(
StoreManager
.
GetPostApi
(
server
),
operation
,
false
);
if
(
resultOperation
==
null
)
{
CodeMsg
=
"二维码【"
+
message
+
"】没有收到服务器反馈"
;
LogInfo
(
"二维码【 "
+
message
+
"】没有收到服务器反馈!"
);
return
false
;
}
else
if
(!
string
.
IsNullOrEmpty
(
resultOperation
.
msg
))
{
//如果有提示消息,直接显示提示
LogInfo
(
"二维码【 "
+
message
+
"】 :"
+
resultOperation
.
msg
);
return
false
;
}
if
(
resultOperation
.
op
.
Equals
(
1
))
{
Dictionary
<
string
,
string
>
data
=
resultOperation
.
data
;
if
(
data
!=
null
&&
data
.
ContainsKey
(
ParamDefine
.
posId
)
&&
data
.
ContainsKey
(
ParamDefine
.
plateH
)
&&
data
.
ContainsKey
(
ParamDefine
.
plateW
))
{
//服务器返回时有:posId库位编号,plateW:料盘宽度,plateH:料盘高度,
//postId格式BoxId#位置
string
posId
=
data
[
ParamDefine
.
posId
];
string
plateW
=
data
[
ParamDefine
.
plateW
];
string
plateH
=
data
[
ParamDefine
.
plateH
];
string
[]
posArray
=
posId
.
Split
(
'#'
);
if
(!(
posArray
.
Length
==
2
))
{
WarnMsg
=
Name
+
"入库库位格式错误:二维码【"
+
message
+
"】库位【"
+
posId
+
"】"
;
LogUtil
.
error
(
Name
+
"服务器反馈 入库库位格式错误:二维码【"
+
message
+
"】库位【"
+
posId
+
"】"
);
return
false
;
}
int
storeId
=
int
.
Parse
(
posArray
[
0
]);
//根据发送的posId获取位置列表
ACBoxPosition
position
=
CSVPositionReader
<
ACBoxPosition
>.
GetPositon
(
posId
);
if
(
position
==
null
)
{
//出入库没有找到服务器发送的库位,需要打印日志方便查询原因
WarnMsg
=
"入库未找到库位:二维码【"
+
message
+
"】库位【"
+
posId
+
"】 "
;
LogUtil
.
error
(
Name
+
"收到服务器入库命令:入库未找到库位:二维码【"
+
message
+
"】库位【"
+
posId
+
"】"
);
return
false
;
}
LogInfo
(
" 收到服务器入库命令:库位号【"
+
posId
+
"】二维码【"
+
message
+
"】设置入库参数 , 开始入库!"
);
MoveInfo
.
MoveParam
.
UpdatePosId
(
message
,
posId
,
plateW
,
plateH
,
ComTargetPosition
);
return
true
;
}
}
else
if
(
resultOperation
.
op
.
Equals
(
2
))
{
ReviceOutStoreProcess
(
resultOperation
);
}
else
if
(
resultOperation
.
op
.
Equals
(
5
))
{
humBean
.
ProcessHumidityCMD
(
resultOperation
);
}
else
{
LogUtil
.
error
(
"收到服务器命令:op="
+
resultOperation
.
op
+
",未找到对应处理"
);
}
}
catch
(
Exception
ex
)
{
LogUtil
.
error
(
Name
+
"GetPosIdByCode"
+
ex
.
StackTrace
);
}
return
false
;
}
#
endregion
#
region
压紧轴压紧处理
private
System
.
Timers
.
Timer
axisCheckTimer
=
null
;
private
string
TargetIoType
=
IO_Type
.
Compress_Check
;
private
IO_VALUE
TargetIoValue
=
IO_VALUE
.
HIGH
;
private
bool
ComAxisStartCheck
(
string
targetIo
=
""
,
IO_VALUE
value
=
IO_VALUE
.
HIGH
)
{
if
(
String
.
IsNullOrEmpty
(
targetIo
))
{
targetIo
=
IO_Type
.
Compress_Check
;
}
if
(
axisCheckTimer
==
null
)
{
axisCheckTimer
=
new
System
.
Timers
.
Timer
();
axisCheckTimer
.
AutoReset
=
true
;
axisCheckTimer
.
Interval
+=
30
;
axisCheckTimer
.
Elapsed
+=
CheckTimer_Elapsed
;
axisCheckTimer
.
Enabled
=
false
;
}
TargetIoValue
=
value
;
TargetIoType
=
targetIo
;
axisCheckTimer
.
Start
();
return
true
;
}
private
bool
ComAxisStopCheck
()
{
if
(!(
axisCheckTimer
==
null
))
{
axisCheckTimer
.
Stop
();
}
return
true
;
}
private
bool
IsInProcess
=
false
;
private
void
CheckTimer_Elapsed
(
object
sender
,
System
.
Timers
.
ElapsedEventArgs
e
)
{
if
(
IsInProcess
)
{
return
;
}
IsInProcess
=
true
;
if
(
IOValue
(
TargetIoType
).
Equals
(
TargetIoValue
))
{
LogUtil
.
info
(
Name
+
"上料轴,检测到 "
+
TargetIoType
+
"="
+
TargetIoValue
+
",可以停止运动"
);
ACServerManager
.
SuddenStop
(
Config
.
Comp_Axis
.
DeviceName
,
Config
.
Comp_Axis
.
GetAxisValue
());
ComAxisStopCheck
();
}
IsInProcess
=
false
;
}
#
endregion
#
region
AGV
private
bool
ProcessShelf
=
false
;
internal
bool
ProcessAGVAction
(
string
name
,
Actions
action
)
{
string
logN
=
name
+
"收到调度【"
+
name
+
"】=【"
+
action
+
"】"
;
//状态处理
if
(
action
.
Equals
(
Asa
.
Actions
.
Usable
))
{
//判断入口是否可用:入口无料架,缓冲工位无料架,不在入料架处理中
bool
usable
=
(
storeRunStatus
.
Equals
(
StoreRunStatus
.
Runing
)
&&
MoveInfo
.
MoveType
.
Equals
(
StoreMoveType
.
None
)
&&
ProcessShelf
.
Equals
(
false
)
&&
IOValue
(
IO_Type
.
LineIn_Check
).
Equals
(
IO_VALUE
.
LOW
)
&&
IOValue
(
IO_Type
.
LineTake_Check
).
Equals
(
IO_VALUE
.
LOW
));
LogUtil
.
info
(
logN
+
":"
+
usable
);
return
usable
;
}
else
if
(
action
.
Equals
(
Asa
.
Actions
.
Arrive
))
{
if
(
IOValue
(
IO_Type
.
LineIn_Check
).
Equals
(
IO_VALUE
.
LOW
))
{
LogUtil
.
info
(
logN
+
" ,未检测到:LineIn_Check,不处理"
);
return
false
;
}
//小车到达,开始处理
if
(
storeRunStatus
.
Equals
(
StoreRunStatus
.
Runing
)
&&
MoveInfo
.
MoveType
.
Equals
(
StoreMoveType
.
None
)
&&
ProcessShelf
.
Equals
(
false
)
&&
IOValue
(
IO_Type
.
LineTake_Check
).
Equals
(
IO_VALUE
.
LOW
))
{
StartShelfInStore
();
return
true
;
}
}
else
{
LogUtil
.
info
(
name
+
logN
+
" ,未找到相关处理"
);
}
return
false
;
}
#
endregion
}
}
source/DeviceLibrary/ACPackingStore/PackingStoreBean.cs
查看文件 @
3b0cd38
...
...
@@ -445,6 +445,30 @@ namespace OnlineStore.DeviceLibrary
}
return
false
;
}
public
override
void
Alarm
(
StoreAlarmType
alarmType
,
string
alarmDetial
,
string
alarmMsg
,
StoreMoveType
storeMoveType
)
{
}
#
region
出库
public
override
bool
StartOutStoreMove
(
InOutParam
param
)
{
return
true
;
}
protected
override
void
OutStoreProcess
()
{
}
#
endregion
#
region
入库
public
override
void
StartInStoreMove
(
InOutParam
param
)
{
}
protected
override
void
InStoreProcess
()
{
}
#
endregion
}
}
\ No newline at end of file
source/DeviceLibrary/ACPackingStore/PackingStoreBean_Partial.cs
deleted
100644 → 0
查看文件 @
2ae1c88
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
{
partial
class
PackingStoreBean
{
public
override
void
Alarm
(
StoreAlarmType
alarmType
,
string
alarmDetial
,
string
alarmMsg
,
StoreMoveType
storeMoveType
)
{
}
protected
override
void
ReturnHomeProcess
()
{
}
#
region
出库
public
override
bool
StartOutStoreMove
(
InOutParam
param
)
{
return
true
;
}
protected
override
void
OutStoreProcess
()
{
}
#
endregion
#
region
入库
public
override
void
StartInStoreMove
(
InOutParam
param
)
{
}
protected
override
void
InStoreProcess
()
{
}
#
endregion
}
}
\ No newline at end of file
source/DeviceLibrary/ACPackingStore/StoreManager.cs
查看文件 @
3b0cd38
...
...
@@ -160,7 +160,7 @@ namespace OnlineStore.DeviceLibrary
LOGGER
.
Error
(
"出错:"
,
ex
);
}
return
false
;
}
public
static
bool
LoadInoutParam
(
InOutParam
param
,
AC_BOX_Bean
box
)
public
static
bool
LoadInoutParam
(
InOutParam
param
,
bool
needCheckShelf
,
AC_BOX_Bean
box
)
{
if
(
param
==
null
)
{
...
...
@@ -177,16 +177,18 @@ namespace OnlineStore.DeviceLibrary
return
false
;
}
ShelfPosition
sp
=
CSVPositionReader
<
ShelfPosition
>.
GetPositon
(
param
.
ShelfPosID
);
if
(
sp
==
null
)
if
(
sp
==
null
&&
needCheckShelf
)
{
LogUtil
.
error
(
box
.
Name
+
"GetPositon["
+
param
.
ShelfPosID
+
"]=null,没有库位不能执行出入库"
);
return
false
;
}
p
.
InOut_P101
=
sp
.
InoutAxis_P101
;
p
.
UpDown_LP101
=
sp
.
UpDownAxis_LP101
;
p
.
UpDown_HP102
=
sp
.
UpDownAxis_HP102
;
p
.
Middle_P101
=
sp
.
MiddleAxis_P101
;
if
(
sp
!=
null
)
{
p
.
InOut_P101
=
sp
.
InoutAxis_P101
;
p
.
UpDown_LP101
=
sp
.
UpDownAxis_LP101
;
p
.
UpDown_HP102
=
sp
.
UpDownAxis_HP102
;
p
.
Middle_P101
=
sp
.
MiddleAxis_P101
;
}
p
.
ComPress_P1
=
box
.
Config
.
CompAxis_P1_Position
;
p
.
InOut_P1
=
box
.
Config
.
InOutAxis_P1_Position
;
...
...
source/DeviceLibrary/DeviceLibrary.csproj
查看文件 @
3b0cd38
...
...
@@ -68,10 +68,8 @@
<ItemGroup>
<Compile Include="ACPackingStore\AC_BOX_Bean.cs" />
<Compile Include="ACPackingStore\AC_BOX_Bean_Partial.cs" />
<Compile Include="ACPackingStore\AC_BOX_Bean_Shelf.cs" />
<Compile Include="ACPackingStore\HumitureBean.cs" />
<Compile Include="ACPackingStore\PackingStoreBean.cs" />
<Compile Include="ACPackingStore\PackingStoreBean_Partial.cs" />
<Compile Include="ACPackingStore\StoreManager.cs" />
<Compile Include="agvClient\AgvClient.cs" />
<Compile Include="device\halcon\CodeManager.cs" />
...
...
source/DeviceLibrary/StoreConfig/BoxConfig_1.csv
查看文件 @
3b0cd38
...
...
@@ -129,6 +129,6 @@ PRO,每次吹气的时间(分钟),BlowAir_Time,10,,,,,,,
PRO,两次吹气间隔(分钟),BlowAir_Interval,10,,,,,,,
,,,,,,,,,,
PRO,温湿度端口号,Humiture_Port,COM2,,,,,,,
PRO,扫码的相机名称(多个用#分隔),CameraNameList,,,,,,,,
PRO,扫码的相机名称(多个用#分隔),CameraNameList,
CameraName
,,,,,,,
PRO,RFID读卡器IP,RFID_IP,192.168.106.101,,,,,,,
PRO,是否是调试状态,IsInDebug,1,,,,,,,
source/DeviceLibrary/StoreConfig/BoxConfig_2.csv
查看文件 @
3b0cd38
...
...
@@ -128,7 +128,7 @@ PRO,每次吹气的时间(分钟),BlowAir_Time,10,,,,,,,
PRO,两次吹气间隔(分钟),BlowAir_Interval,10,,,,,,,
PRO,温湿度端口号,Humiture_Port,COM2,,,,,,,
,,,,,,,,,,
PRO,扫码的相机名称(多个用#分隔),CameraNameList,,,,,,
PRO,扫码的相机名称(多个用#分隔),CameraNameList,
CameraName,,
,,,,,
PRO,RFID读卡器IP,RFID_IP,192.168.106.102,,,,,,,
PRO,是否是调试状态,IsInDebug,1,,,,,,,
source/DeviceLibrary/store/AutoInoutInfo.cs
查看文件 @
3b0cd38
...
...
@@ -83,7 +83,7 @@ namespace OnlineStore.DeviceLibrary
boxBean
.
LogInfo
(
"自动进入下一个出库:posid="
+
posid
+
",当时已经出入库"
+
CurrInOutACount
+
"次,需要重置BOX,先把出库信息存入排队列表中"
);
boxBean
.
Reset
(
false
);
autoMsg
=
"自动出库:"
+
posid
;
boxBean
.
AddWaitOutInfo
(
new
InOutParam
(
""
,
posid
,
shelfPosId
));
boxBean
.
waitOutStoreList
.
Enqueue
(
new
InOutParam
(
""
,
posid
,
shelfPosId
));
}
else
{
...
...
@@ -119,7 +119,7 @@ namespace OnlineStore.DeviceLibrary
boxBean
.
LogInfo
(
"自动进入下一个入库:posid="
+
posid
+
",当时已经出入库"
+
CurrInOutACount
+
"次,需要重置BOX,先把入库信息存入排队列表中"
);
boxBean
.
Reset
(
false
);
autoMsg
=
"自动入库:"
+
posid
;
boxBean
.
AddWaitOutInfo
(
new
InOutParam
(
"AAAA"
,
posid
,
shelfPosId
));
boxBean
.
waitOutStoreList
.
Enqueue
(
new
InOutParam
(
"AAAA"
,
posid
,
shelfPosId
));
}
else
{
...
...
source/DeviceLibrary/store/InOutParam.cs
查看文件 @
3b0cd38
...
...
@@ -34,7 +34,7 @@ namespace OnlineStore.DeviceLibrary
MoveP
=
null
;
IsSolderPaste
=
false
;
}
public
InOutParam
(
string
wareNo
,
string
posId
,
string
plateH
,
string
plateW
,
string
ShelfPosID
=
""
)
public
InOutParam
(
string
wareNo
,
string
posId
,
string
plateH
,
string
plateW
,
string
ShelfPosID
)
{
this
.
ShelfPosID
=
ShelfPosID
;
WareCode
=
wareNo
;
...
...
@@ -50,6 +50,8 @@ namespace OnlineStore.DeviceLibrary
PosID
=
posId
;
MoveP
=
linePosition
;
IsSolderPaste
=
false
;
NeedEnterShelf
=
false
;
NeedOutShelf
=
false
;
}
/// <summary>
/// 物品二维码信息
...
...
source/DeviceLibrary/store/KTK_Store.cs
查看文件 @
3b0cd38
...
...
@@ -67,8 +67,7 @@ namespace OnlineStore.DeviceLibrary
/// 是否没有检测到气压
/// </summary>
public
bool
isNoAirCheck
=
false
;
//protected int NeedCheckSafetyLight = 0;
/// <summary>
/// 是否再报警中
/// </summary>
...
...
@@ -142,7 +141,7 @@ namespace OnlineStore.DeviceLibrary
isInPro
=
false
;
break
;
case
StoreMoveType
.
ReturnHome
:
Re
turnHome
Process
();
Re
set
Process
();
isInPro
=
false
;
break
;
case
StoreMoveType
.
StoreReset
:
...
...
@@ -226,10 +225,7 @@ namespace OnlineStore.DeviceLibrary
/// 重置处理
/// </summary>
protected
abstract
void
ResetProcess
();
/// <summary>
/// 原点返回处理
/// </summary>
protected
abstract
void
ReturnHomeProcess
();
/// <summary>
/// 松下伺服轴原点返回运动,等待收到反馈后才会返回
...
...
@@ -474,7 +470,7 @@ namespace OnlineStore.DeviceLibrary
/// <summary>
/// 阻塞等待IO信号,等到返回true,未等到返回false
/// </summary>c
p
ublic
bool
WaitIo
(
string
ioType
,
IO_VALUE
value
,
int
timeOut
,
string
errName
=
""
)
p
rotected
bool
WaitIo
(
string
ioType
,
IO_VALUE
value
,
int
timeOut
,
string
errName
=
""
)
{
return
WaitUtil
.
Wait
(
timeOut
,
delegate
()
{
return
value
.
Equals
(
IOValue
(
ioType
));
...
...
@@ -484,6 +480,12 @@ namespace OnlineStore.DeviceLibrary
{
LogUtil
.
info
(
Name
+
logInfo
);
}
protected
void
InOutStoreLog
(
string
msg
)
{
string
posId
=
MoveInfo
.
MoveParam
!=
null
?
MoveInfo
.
MoveParam
.
PosID
:
""
;
string
shelfId
=
MoveInfo
.
MoveParam
!=
null
?
"_"
+
MoveInfo
.
MoveParam
.
ShelfPosID
:
"_"
;
LogInfo
(
"["
+
posId
+
shelfId
+
"]"
+
MoveInfo
.
MoveStep
+
":"
+
msg
);
}
protected
int
GetAlarmCodeByAxis
(
ConfigMoveAxis
axis
)
{
int
alarmCode
=
LineAlarm
.
InOutAxisAlarm
;
...
...
source/DeviceLibrary/store/StoreStep.cs
查看文件 @
3b0cd38
...
...
@@ -115,7 +115,7 @@ namespace OnlineStore.DeviceLibrary
/// 无操作,等待状态
/// </summary>
Wait
=
0
,
#
region
料仓原点返回和重置步骤
010
开始
#
region
料仓原点返回和重置步骤
0
0
10
开始
/// <summary>
/// BOX复位:线体停止,入料移门关闭,NG料口关闭
/// </summary>
...
...
@@ -154,330 +154,244 @@ namespace OnlineStore.DeviceLibrary
BOX_H56_TOP1_OtherAxisToP1
=
56
,
#
endregion
#
region
料仓内部出库步骤
10101
开始
#
region
料架进入料仓步骤
1000
开始
/// <summary>
///
料仓出库,,定位气缸下降
///
通知agv准备带料架小车
/// </summary>
SO_31_LocationCylinderDown
=
1013
1
,
BI_01_ReadyShelf
=
100
1
,
/// <summary>
///
料仓出库:叉子先运动到P1
///
料架入库:入料口移门打开
/// </summary>
SO_32_DeviceBack
=
1013
2
,
BI_02_DoorOpen
=
100
2
,
/// <summary>
///
料仓出库,,所有轴运行到库位, 轴4( 压紧) 至P3(压紧前点) ,轴1( 转盘) 至P2( 库位点),轴2(上下) 至P5(库位出库前点)
///
料架入库:线体正转
/// </summary>
SO_33_ToBagPosition
=
1013
3
,
BI_03_LineRun
=
100
3
,
/// <summary>
///
料仓出库,,叉子进入库位中, 轴3( 叉子) 至P3(库位取放料点)
///
料架入库:取料位检测到信号,停止线体正转
/// </summary>
SO_34_DeviceToBag
=
10134
,
BI_04_LineStop
=
1004
,
/// <summary>
///
料仓出库,, 库位的物品放入叉子上,轴2( 上下) 至P6( 库位出料缓冲点),轴4( 压紧) 至P2(压紧点)
///
料架入库:入料口移门关闭
/// </summary>
SO_35_BagWareToDevice
=
10135
,
BI_05_DoorClose
=
1005
,
/// <summary>
///
料仓出库,,叉子从 库位返回,轴3( 叉子) 至P1( 待机点)
///
料架入库:定位装置上升
/// </summary>
SO_36_BagDeviceBack
=
10136
,
BI_06_LocationUp
=
1006
,
/// <summary>
/// 料
仓出库,定位气缸伸出(有压紧轴的不需要此步骤 )
/// 料
架入库:顶升装置上升
/// </summary>
SO_37_LocationCylinder_Up
=
1013
7
,
BI_07_TopCylinderUp
=
100
7
,
/// <summary>
/// 料仓出库,走到料架位置,旋转轴至P101,升降轴至P102,
/// </summary>
SO_38_ToShelfPosition
=
10138
,
#
endregion
#
region
出库步骤
2000
开始
/// <summary>
///
料仓出库,定位气缸退回(有压紧轴的不需要此步骤),,定位气缸退回(Y104-1/PCI5O1-84) (Y104-2/PCI5O1-91) (Y104-2/PCI5O1-96) 退回到位
///
料仓出库,,定位气缸下降
/// </summary>
SO_
39_LocationCylinder_Down
=
10139
,
SO_
01_LocationCylinderDown
=
2001
,
/// <summary>
///
等待门口无料盘
///
料仓出库:叉子先运动到P1
/// </summary>
SO_
40_WaitNoTray
=
10140
,
SO_
02_DeviceBack
=
2002
,
/// <summary>
/// 料仓出库,叉子到料架,进出轴至P101
/// /// </summary>
SO_41_DeviceToShelf
=
10141
,
/// <summary>
/// 料仓出库,,把物品放下,压紧轴到P1,升降轴至P101
/// 料仓出库,,所有轴运行到库位, 轴4( 压紧) 至P3(压紧前点) ,轴1( 转盘) 至P2( 库位点),轴2(上下) 至P5(库位出库前点)
/// </summary>
SO_
42_DevicePutWare
=
10142
,
SO_
03_ToBagPosition
=
2003
,
/// <summary>
///
料仓出库,,叉子从出料口返回,,轴3( 叉子) 动作至P1( 待机
点)
///
料仓出库,,叉子进入库位中, 轴3( 叉子) 至P3(库位取放料
点)
/// </summary>
SO_
43_DeviceOutFromDoor
=
10143
,
SO_
04_DeviceToBag
=
2004
,
/// <summary>
///
料仓出库,,升降轴返回,, 轴2至P1( 待机点)
///
料仓出库,, 库位的物品放入叉子上,轴2( 上下) 至P6( 库位出料缓冲点),轴4( 压紧) 至P2(压紧点)
/// </summary>
SO_44_GoBack
=
10144
,
SO_05_BagWareToDevice
=
2005
,
/// <summary>
/// 送出料架:顶升气缸下降
/// </summary>
SO_51_TopCylinder_Down
=
10151
,
/// <summary>
/// 送出料架:定位气缸下降
/// </summary>
SO_52_LocatinCylinder_Down
=
10152
,
/// <summary>
/// 送出料架:打开仓门
/// </summary>
SO_53_DoorOpen
=
10153
,
/// <summary>
/// 送出料架:线体反转
///料仓出库,,叉子从 库位返回,轴3( 叉子) 至P1( 待机点)
/// </summary>
SO_54_LineBack
=
10154
,
SO_06_BagDeviceBack
=
2006
,
/// <summary>
///
送出料架:等待取料工位无信号,入料口有信号
///
料仓出库,定位气缸伸出(有压紧轴的不需要此步骤 )
/// </summary>
SO_55_WaitInLineSingle
=
10155
,
SO_07_LocationCylinder_Up
=
2007
,
/// <summary>
///
送出料架:再转动300时间
///
料仓出库,走到料架位置,旋转轴至P20,升降轴至P102,
/// </summary>
SO_56_WaitTime
=
10156
,
#
endregion
#
region
料仓内部入库步骤
20500
///// <summary>
///// 入库检测
///// </summary>
//SI_00_TrayCheck = 20500,
///// <summary>
///// 入库,。定位气缸下降
///// </summary>
//SI_01_LocationCylinderDown =20501,
///// <summary>
///// 入库。。进出轴(叉子)先返回P1
///// </summary>
//SI_02_InOutAxisHome =20502,
///// <summary>
///// 入库。。所有轴先回到待机点,轴2、轴1 动作到P1,,轴4动作至P3
///// </summary>
//SI_03_ReturnHome =20503,
///// <summary>
///// 入库。。压紧物品(有压紧轴的才需要此步骤),轴4( 压紧) 至P3(压紧前点)
///// </summary>
//SI_04_CompressWare =20504,
///// <summary>
///// 入库。。叉子进入入料口,轴3( 叉子) 至P2( 进料口取料点)
///// </summary>
//SI_05_DeviceToDoor =20505,
///// <summary>
///// 入库。。把物品放入叉子上,轴2( 上下) 至P7( 进料口取料缓冲点),压紧物品(有压紧轴的才需要此步骤),轴4( 压紧) 至P2(压紧点)
///// </summary>
//SI_06_DoorWarToDevice =20506,
SO_08_ToShelfPosition
=
2008
,
///// <summary>
///// 入库。。叉子 从入料口抽出,轴3( 叉子) 至P1( 待机点)
///// </summary>
//SI_07_DeviceBackFromDoor =20507,
///// <summary>
///// 入库。。,定位气缸伸出 (有压紧轴的不需要此步骤)
///// </summary>
//SI_08_LocationCylinder_Up =20508,
///// <summary>
///// 入库。。移动到库位点,轴1( 转盘) 至P2( 库位点)轴2(上下) 至P3(库位入库前点)
///// </summary>
//SI_09_MoveToBag =20509,
///// <summary>
///// 入库。。定位气缸退回 (有压紧轴的不需要此步骤)
///// </summary>
//SI_10_LocationCylinder_Down =20510,
///// <summary>
///// 入库。。叉子进入库位中,轴3( 叉子) 至P3(库位取放料点)
///// </summary>
//SI_11_DeviceToBag =20511,
///// <summary>
///// 入库。。放下物品,轴2( 上下) 至P4( 库位入料缓冲点)轴4( 压紧) 至P3( 压紧前点)
///// </summary>
//SI_12_PutWareToBag =20512,
///// <summary>
///// 入库。。叉子从库位中返回,轴3( 叉子) 动作至P1( 待机点)
///// </summary>
//SI_13_DeviceBackFromBag =20513,
///// <summary>
///// 入库。。返回待机点,轴2/轴1/轴4动作至P1( 待机点))开始
///// </summary>
//SI_14_GoBack =20514,
#
endregion
#
region
料架入库步骤,
20001
开始
/// <summary>
/// 料
架入库:检测到线体入料口信号
/// 料
仓出库,定位气缸退回(有压紧轴的不需要此步骤),,定位气缸退回(Y104-1/PCI5O1-84) (Y104-2/PCI5O1-91) (Y104-2/PCI5O1-96) 退回到位
/// </summary>
BI_01_LineIn_Check
=
20001
,
SO_09_LocationCylinder_Down
=
2009
,
/// <summary>
///
料架入库:入料口移门打开
///
等待门口无料盘
/// </summary>
BI_02_DoorOpen
=
20002
,
SO_10_WaitNoTray
=
2010
,
/// <summary>
/// 料架入库:线体正转
/// </summary>
BI_03_LineRun
=
20003
,
/// <summary>
/// 料架入库:取料位检测到信号,停止线体正转
/// </summary>
BI_04_LineStop
=
20004
,
/// 料仓出库,叉子到料架,进出轴至P20
/// /// </summary>
SO_11_DeviceToShelf
=
2011
,
/// <summary>
/// 料
架入库:入料口移门关闭
/// 料
仓出库,,把物品放下,压紧轴到P1,升降轴至P20
/// </summary>
BI_05_DoorClose
=
20005
,
SO_12_DevicePutWare
=
2012
,
/// <summary>
/// 料
架入库:定位装置上升
/// 料
仓出库,,叉子从出料口返回,,轴3( 叉子) 动作至P1( 待机点)
/// </summary>
BI_06_LocationUp
=
20006
,
SO_13_DeviceOutFromDoor
=
2013
,
/// <summary>
/// 料
架入库:顶升装置上升
/// 料
仓出库,,升降轴返回,, 轴2至P1( 待机点)
/// </summary>
BI_07_TopCylinderUp
=
20007
,
SO_14_GoBack
=
2044
,
#
endregion
#
region
料架入库步骤,
3000
开始
/// <summary>
/// 料架入库:开始循环从第一个空位逐个取料盘,扫码入库
/// </summary>
BI_08_StartGetTray
=
20008
,
BI_08_StartGetTray
=
20008
,
/// <summary>
/// 料架取料:叉子后退到待机点P1
/// </summary>
BI_11_InoutToP1
=
201
11
,
BI_11_InoutToP1
=
30
11
,
/// <summary>
/// 料架取料:升降轴移动到P101低点,旋转轴移动到P101点,压紧轴到压紧前点
/// </summary>
BI_12_MoveToShelf
=
201
12
,
BI_12_MoveToShelf
=
30
12
,
/// <summary>
/// 料架取料:叉子前进到P101点
/// </summary>
BI_13_InoutToP101
=
201
13
,
BI_13_InoutToP101
=
30
13
,
/// <summary>
/// 料架取料:升降轴上升到P102点
/// </summary>
BI_14_UpdownToP102
=
201
14
,
BI_14_UpdownToP102
=
30
14
,
/// <summary>
/// 料架取料:压紧轴开始缓慢压紧
/// </summary>
BI_15_StartCompress
=
201
15
,
BI_15_StartCompress
=
30
15
,
/// <summary>
/// 料架取料:检测到料叉压紧确认信号,再次向下压紧指定的值
/// </summary>
BI_16_ComAxisDownMove
=
201
16
,
BI_16_ComAxisDownMove
=
30
16
,
/// <summary>
/// 料架取料:记录压紧高度,叉子后退到扫码点
/// </summary>
BI_17_InoutBack
=
201
17
,
BI_17_InoutBack
=
30
17
,
/// <summary>
/// 料架取料:记录宽度,开始扫码
/// </summary>
BI_18_ScanCode
=
201
18
,
BI_18_ScanCode
=
30
18
,
/// <summary>
/// 料架取料:扫码成功,从服务器获取库位号
/// </summary>
BI_19_GetPosId
=
201
19
,
BI_19_GetPosId
=
30
19
,
/// <summary>
/// 料架取料: 获取库位号完成,设置位置参数,开始入库
/// </summary>
BI_20_SetInstoreParam
=
201
20
,
BI_20_SetInstoreParam
=
30
20
,
/// <summary>
/// 入库。。移动到库位点,轴1( 转盘) 至P2( 库位点)轴2(上下) 至P3(库位入库前点)
/// </summary>
BI_21_MoveToBag
=
201
21
,
BI_21_MoveToBag
=
30
21
,
/// <summary>
/// 入库。。叉子进入库位中,轴3( 叉子) 至P3(库位取放料点)
/// </summary>
BI_22_DeviceToBag
=
201
22
,
BI_22_DeviceToBag
=
30
22
,
/// <summary>
/// 入库。。放下物品,轴2( 上下) 至P4( 库位入料缓冲点)轴4( 压紧) 至P3( 压紧前点)
/// </summary>
BI_23_PutWareToBag
=
201
23
,
BI_23_PutWareToBag
=
30
23
,
/// <summary>
/// 入库。。叉子从库位中返回,轴3( 叉子) 动作至P1( 待机点)
/// </summary>
BI_24_DeviceBackFromBag
=
201
24
,
BI_24_DeviceBackFromBag
=
30
24
,
/// <summary>
/// 入库。。返回待机点,轴2/轴1/轴4动作至P1( 待机点))开始
/// </summary>
BI_25_GoBack
=
201
25
,
BI_25_GoBack
=
30
25
,
/// <summary>
/// 送出料盘:扫码或获取库位失败,升降轴移动到NG料门口上端,旋转轴移动到NG料门口
/// </summary>
BI_31_ToNGDoor
=
201
31
,
BI_31_ToNGDoor
=
30
31
,
/// <summary>
/// 送出料盘:NG料口升降门上升
/// </summary>
BI_32_NGDoorUp
=
201
32
,
BI_32_NGDoorUp
=
30
32
,
/// <summary>
/// 送出料盘:进出轴前进到NG料门口位置
/// </summary>
BI_33_InoutToNGDoor
=
201
33
,
BI_33_InoutToNGDoor
=
30
33
,
/// <summary>
/// 送出料盘:升降轴缓慢下降,放下料盘
/// </summary>
BI_34_UpdownDown
=
201
34
,
BI_34_UpdownDown
=
30
34
,
/// <summary>
/// 送出料盘:叉子后退到P1
/// </summary>
BI_35_InoutToP1
=
201
35
,
BI_35_InoutToP1
=
30
35
,
/// <summary>
/// 送出料盘:关门NG料门,送出料盘结束
/// </summary>
BI_36_NGDoorDown
=
201
36
,
BI_36_NGDoorDown
=
30
36
,
#
endregion
#
region
把料架送出步骤
21
000
开始
#
region
把料架送出步骤
4
000
开始
/// <summary>
/// 送出料架:顶升气缸下降
/// 送出
空
料架:顶升气缸下降
/// </summary>
BS_01_TopCylinder_Down
=
21
001
,
BS_01_TopCylinder_Down
=
4
001
,
/// <summary>
/// 送出料架:定位气缸下降
/// 送出
空
料架:定位气缸下降
/// </summary>
BS_02_LocatinCylinder_Down
=
21
002
,
BS_02_LocatinCylinder_Down
=
4
002
,
/// <summary>
/// 送出料架:打开仓门
/// 送出
空
料架:打开仓门
/// </summary>
BS_03_DoorOpen
=
21
003
,
BS_03_DoorOpen
=
4
003
,
/// <summary>
/// 送出料架:线体反转
/// 送出
空
料架:线体反转
/// </summary>
BS_04_LineBack
=
21
004
,
BS_04_LineBack
=
4
004
,
/// <summary>
/// 送出料架:等待取料工位无信号,入料口有信号
/// 送出
空
料架:等待取料工位无信号,入料口有信号
/// </summary>
BS_05_WaitInLineSingle
=
21
005
,
BS_05_WaitInLineSingle
=
4
005
,
/// <summary>
/// 送出料架:再转动300时间
/// 送出
空
料架:再转动300时间
/// </summary>
BS_06_WaitTime
=
21
006
,
BS_06_WaitTime
=
4
006
,
///// <summary>
///// 送出料架:停止转动
///// 送出
空
料架:停止转动
///// </summary>
//BS_07_LineStop=
21
007,
//BS_07_LineStop=
4
007,
///// <summary>
///// 送出料架:通知调度系统拿走
///// 送出
空
料架:通知调度系统拿走
///// </summary>
//BS_08_CallAGV =
21
008,
//BS_08_CallAGV =
4
008,
///// <summary>
///// 送出料架:关闭仓门
///// 送出
空
料架:关闭仓门
///// </summary>
//BS_09_CloseDoor=
21
009,
//BS_09_CloseDoor=
4
009,
#
endregion
}
...
...
source/DeviceLibrary/store/model/StoreMoveInfo.cs
查看文件 @
3b0cd38
...
...
@@ -156,88 +156,81 @@ namespace OnlineStore.DeviceLibrary
{
private
WaitResultInfo
()
{
IsEnd
=
false
;
CanWhileMoveCount
=
0
;
}
public
static
WaitResultInfo
WaitIO
(
string
ioType
,
IO_VALUE
ioValue
)
{
WaitResultInfo
wait
=
new
WaitResultInfo
();
wait
.
CanWhileMoveCount
=
0
;
wait
.
WaitType
=
2
;
WaitResultInfo
wait
=
new
WaitResultInfo
();
wait
.
WaitType
=
WaitEnum
.
W002_IOValue
;
wait
.
IoType
=
ioType
;
wait
.
IoValue
=
ioValue
;
wait
.
IsEnd
=
false
;
wait
.
IoValue
=
ioValue
;
return
wait
;
}
public
static
WaitResultInfo
WaitAxis
(
ConfigMoveAxis
axis
,
int
targetPosition
,
int
targetSpeed
)
{
WaitResultInfo
wait
=
new
WaitResultInfo
();
wait
.
CanWhileMoveCount
=
0
;
wait
.
WaitType
=
1
;
WaitResultInfo
wait
=
new
WaitResultInfo
();
wait
.
WaitType
=
WaitEnum
.
W001_AxisMove
;
wait
.
AxisInfo
=
axis
;
wait
.
IsHomeMove
=
false
;
wait
.
TargetPosition
=
targetPosition
;
wait
.
TargetSpeed
=
targetSpeed
;
wait
.
IsEnd
=
false
;
wait
.
TargetSpeed
=
targetSpeed
;
return
wait
;
}
public
static
WaitResultInfo
WaitAxis
(
ConfigMoveAxis
axis
,
bool
isHomeMove
)
{
WaitResultInfo
wait
=
new
WaitResultInfo
();
wait
.
CanWhileMoveCount
=
0
;
wait
.
WaitType
=
1
;
WaitResultInfo
wait
=
new
WaitResultInfo
();
wait
.
WaitType
=
WaitEnum
.
W001_AxisMove
;
wait
.
AxisInfo
=
axis
;
wait
.
IsHomeMove
=
true
;
wait
.
IsEnd
=
false
;
return
wait
;
}
public
static
WaitResultInfo
WaitStell
(
byte
slvAddr
,
int
targetPosition
,
int
speed
)
{
WaitResultInfo
wait
=
new
WaitResultInfo
();
wait
.
CanWhileMoveCount
=
10
;
wait
.
WaitType
=
4
;
wait
.
SlvAddr
=
slvAddr
;
wait
.
IsHomeMove
=
false
;
wait
.
TargetPosition
=
targetPosition
;
wait
.
TargetSpeed
=
speed
;
wait
.
IsEnd
=
false
;
return
wait
;
}
public
static
WaitResultInfo
WaitStellHome
(
byte
slvAddr
,
int
targetPosition
,
int
speed
)
{
WaitResultInfo
wait
=
new
WaitResultInfo
();
wait
.
CanWhileMoveCount
=
10
;
wait
.
WaitType
=
4
;
wait
.
SlvAddr
=
slvAddr
;
wait
.
IsHomeMove
=
true
;
wait
.
TargetPosition
=
0
;
wait
.
TargetSpeed
=
speed
;
wait
.
IsEnd
=
false
;
wait
.
IsHomeMove
=
true
;
return
wait
;
}
public
static
WaitResultInfo
WaitShuoKe
(
int
slvAddr
,
int
targetPosition
,
bool
isHome
)
{
WaitResultInfo
wait
=
new
WaitResultInfo
();
wait
.
CanWhileMoveCount
=
0
;
wait
.
WaitType
=
5
;
wait
.
SlvAddr
=(
byte
)
slvAddr
;
wait
.
TargetPosition
=
targetPosition
;
wait
.
IsHomeMove
=
isHome
;
return
wait
;
}
//public static WaitResultInfo WaitStell(byte slvAddr, int targetPosition, int speed)
//{
// WaitResultInfo wait = new WaitResultInfo();
// wait.CanWhileMoveCount =10;
// wait.WaitType = WaitEnum.W004_StellMove;
// wait.SlvAddr = slvAddr;
// wait.IsHomeMove = false;
// wait.TargetPosition = targetPosition;
// wait.TargetSpeed = speed;
// return wait;
//}
// public static WaitResultInfo WaitStellHome(byte slvAddr, int targetPosition, int speed)
//{
// WaitResultInfo wait = new WaitResultInfo();
// wait.CanWhileMoveCount = 10;
// wait.WaitType = WaitEnum.W004_StellMove;
// wait.SlvAddr = slvAddr;
// wait.IsHomeMove = true;
// wait.TargetPosition = 0;
// wait.TargetSpeed = speed;
// return wait;
//}
//public static WaitResultInfo WaitShuoKe(int slvAddr, int targetPosition, bool isHome)
//{
// WaitResultInfo wait = new WaitResultInfo();
// wait.CanWhileMoveCount = 0;
// wait.WaitType = WaitEnum.W005_ShuoKe;
// wait.SlvAddr =(byte) slvAddr;
// wait.TargetPosition = targetPosition;
// wait.IsHomeMove = isHome;
// return wait;
//}
public
static
WaitResultInfo
WaitTime
(
int
MScends
)
{
WaitResultInfo
wait
=
new
WaitResultInfo
();
wait
.
CanWhileMoveCount
=
0
;
wait
.
WaitType
=
3
;
wait
.
WaitType
=
WaitEnum
.
W003_Time
;
wait
.
TimeMSeconds
=
MScends
;
wait
.
IsEnd
=
false
;
return
wait
;
}
public
static
WaitResultInfo
WaitAxisOrg
(
ConfigMoveAxis
axis
,
IO_VALUE
value
)
{
WaitResultInfo
wait
=
new
WaitResultInfo
();
wait
.
CanWhileMoveCount
=
0
;
wait
.
WaitType
=
6
;
WaitResultInfo
wait
=
new
WaitResultInfo
();
wait
.
WaitType
=
WaitEnum
.
W006_AxisOrg
;
wait
.
AxisInfo
=
axis
;
wait
.
IsHomeMove
=
true
;
wait
.
IoValue
=
value
;
...
...
@@ -246,77 +239,73 @@ namespace OnlineStore.DeviceLibrary
}
public
static
WaitResultInfo
WaitComAxis
(
ConfigMoveAxis
axis
,
int
targetPosition
,
int
targetSpeed
)
{
WaitResultInfo
wait
=
new
WaitResultInfo
();
wait
.
CanWhileMoveCount
=
0
;
wait
.
WaitType
=
8
;
WaitResultInfo
wait
=
new
WaitResultInfo
();
wait
.
WaitType
=
WaitEnum
.
W008_Compress
;
wait
.
AxisInfo
=
axis
;
wait
.
IsHomeMove
=
false
;
wait
.
TargetPosition
=
targetPosition
;
wait
.
TargetSpeed
=
targetSpeed
;
wait
.
IsEnd
=
false
;
wait
.
TargetSpeed
=
targetSpeed
;
return
wait
;
}
internal
static
WaitResultInfo
WaitCode
()
{
WaitResultInfo
wait
=
new
WaitResultInfo
();
wait
.
CanWhileMoveCount
=
0
;
wait
.
WaitType
=
9
;
wait
.
IsHomeMove
=
false
;
wait
.
IsEnd
=
false
;
WaitResultInfo
wait
=
new
WaitResultInfo
();
wait
.
WaitType
=
WaitEnum
.
W009_ScanCode
;
wait
.
IsHomeMove
=
false
;
return
wait
;
}
public
static
WaitResultInfo
WaitAgvAction
(
int
arrive
)
{
WaitResultInfo
wait
=
new
WaitResultInfo
();
wait
.
CanWhileMoveCount
=
0
;
wait
.
WaitType
=
10
;
wait
.
TargetPosition
=
arrive
;
wait
.
IsEnd
=
false
;
WaitResultInfo
wait
=
new
WaitResultInfo
();
wait
.
WaitType
=
WaitEnum
.
W010_AgvStatus
;
wait
.
TargetPosition
=
arrive
;
return
wait
;
}
public
string
ToStr
()
{
if
(
WaitType
==
1
)
if
(
WaitType
.
Equals
(
WaitEnum
.
W001_AxisMove
)
)
{
if
(
IsHomeMove
)
{
return
"轴【"
+
AxisInfo
.
DisplayStr
+
"】原点返回"
;
return
"轴【"
+
AxisInfo
.
DisplayStr
+
"】原点返回"
;
}
else
{
return
"轴【"
+
AxisInfo
.
DisplayStr
+
"】绝对运动,目标位置【"
+
TargetPosition
+
"】"
;
}
}
else
if
(
WaitType
==
2
)
else
if
(
WaitType
.
Equals
(
WaitEnum
.
W002_IOValue
)
)
{
return
"
IO信号等待,IO类型【"
+
IoType
+
"】,等待值
【"
+
IoValue
+
"】"
;
return
"
等待【"
+
IoType
+
"】=
【"
+
IoValue
+
"】"
;
}
else
if
(
WaitType
==
3
)
else
if
(
WaitType
.
Equals
(
WaitEnum
.
W003_Time
)
)
{
return
"时间等待:【"
+
TimeMSeconds
+
"】毫秒"
;
}
else
if
(
WaitType
==
4
)
else
if
(
WaitType
.
Equals
(
WaitEnum
.
W004_StellMove
)
)
{
return
"电钢目标位置:【"
+
TargetPosition
+
"】 "
;
}
else
if
(
WaitType
==
5
)
else
if
(
WaitType
.
Equals
(
WaitEnum
.
W005_ShuoKe
)
)
{
return
"硕科电机目标位置:【"
+
TargetPosition
+
"】 "
;
}
else
if
(
WaitType
==
6
)
else
if
(
WaitType
.
Equals
(
WaitEnum
.
W006_AxisOrg
)
)
{
return
"轴【"
+
AxisInfo
.
DisplayStr
+
"】ORG信号:【"
+
IoValue
+
"】 "
;
}
else
if
(
WaitType
==
7
)
return
"轴【"
+
AxisInfo
.
DisplayStr
+
"】ORG信号:【"
+
IoValue
+
"】 "
;
}
else
if
(
WaitType
.
Equals
(
WaitEnum
.
W007_ReelHeight
))
{
return
"料盘高度【"
+
TargetPosition
+
"】 "
;
}
else
if
(
WaitType
.
Equals
(
8
))
}
else
if
(
WaitType
.
Equals
(
WaitEnum
.
W008_Compress
))
{
return
"压紧轴压紧到位"
;
}
else
if
(
WaitType
.
Equals
(
9
))
}
else
if
(
WaitType
.
Equals
(
WaitEnum
.
W009_ScanCode
))
{
return
"扫码完成"
;
}
else
if
(
WaitType
.
Equals
(
10
))
}
else
if
(
WaitType
.
Equals
(
WaitEnum
.
W010_AgvStatus
))
{
return
"agv小车状态:"
+
(
Asa
.
Actions
)
TargetPosition
;
}
...
...
@@ -370,8 +359,51 @@ namespace OnlineStore.DeviceLibrary
/// 是否已经结束
/// </summary>
public
bool
IsEnd
{
get
;
set
;
}
}
internal
class
WaitEnum
{
/// <summary>
/// 伺服运动
/// </summary>
internal
static
int
W001_AxisMove
=
1
;
/// <summary>
/// 信号到达
/// </summary>
internal
static
int
W002_IOValue
=
2
;
/// <summary>
/// 时间等待
/// </summary>
internal
static
int
W003_Time
=
3
;
/// <summary>
/// 电钢运动
/// </summary>
internal
static
int
W004_StellMove
=
4
;
/// <summary>
/// 硕科电机
/// </summary>
internal
static
int
W005_ShuoKe
=
5
;
/// <summary>
/// 轴原点信号
/// </summary>
internal
static
int
W006_AxisOrg
=
6
;
/// <summary>
/// 料盘高度
/// </summary>
internal
static
int
W007_ReelHeight
=
7
;
/// <summary>
/// 压紧轴压紧到位
/// </summary>
internal
static
int
W008_Compress
=
8
;
/// <summary>
/// 扫码完成
/// </summary>
internal
static
int
W009_ScanCode
=
9
;
/// <summary>
/// agv小车状态
/// </summary>
internal
static
int
W010_AgvStatus
=
10
;
}
public
enum
StoreMoveType
{
...
...
source/LoadCVSLibrary/storeConfig/ConfigItemBase.cs
查看文件 @
3b0cd38
...
...
@@ -64,7 +64,7 @@ namespace OnlineStore.LoadCSVLibrary
{
if
(
String
.
IsNullOrEmpty
(
ProType
)
||
String
.
IsNullOrEmpty
(
ProName
)
||
String
.
IsNullOrEmpty
(
ProValue
))
{
throw
new
CVSFieldNotMatchingExection
(
ToString
()
+
",【类型
:ProType】【名称:ProName】【属性值:ProVale
】必须配置值!"
);
throw
new
CVSFieldNotMatchingExection
(
ToString
()
+
",【类型
】【名称】【属性值
】必须配置值!"
);
}
}
}
...
...
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论