Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
孙克
/
RC1250-AssemblyLine
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit 253ddc3c
由
LN
编写于
2022-11-18 09:10:36 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
1.皮带线未检测料盘时增加视觉检测标签。
2.出料机构放料到皮带线的报警发给服务器。 3.出料3阻挡2下降需要等待进仓17前阻挡无信号。 4.入料机构升降盘定位气缸前进10次。
1 个父辈
234c7c1f
显示空白字符变更
内嵌
并排
正在显示
8 个修改的文件
包含
348 行增加
和
24 行删除
source/AssemblyLineClient/记录.txt
source/DeviceLibrary/assemblyLine/DischargeLine.cs
source/DeviceLibrary/assemblyLine/FeedingEquip.cs
source/DeviceLibrary/assemblyLine/FeedingEquip_InStore.cs
source/DeviceLibrary/assemblyLine/FeedingEquip_OutStore.cs
source/DeviceLibrary/assemblyLine/LineBean.cs
source/DeviceLibrary/assemblyLine/ProvidingEquip_Partial.cs
source/DeviceLibrary/deviceLibrary/halcon/CodeManager.cs
source/AssemblyLineClient/记录.txt
查看文件 @
253ddc3
...
@@ -595,3 +595,15 @@ PRO,0,是否存放的大料盘,IsBigTray,1,,,,,
...
@@ -595,3 +595,15 @@ PRO,0,是否存放的大料盘,IsBigTray,1,,,,,
3. 修改相机配置:\Config\Camera.json文件:修改相机IP,用户名,密码
3. 修改相机配置:\Config\Camera.json文件:修改相机IP,用户名,密码
20221117 修改:
1.皮带线未检测料盘时增加视觉检测标签。
2.出料机构放料到皮带线的报警发给服务器。
3.出料3阻挡2下降需要等待进仓17前阻挡无信号。
4.入料机构升降盘定位气缸逻辑修改。
需要修改:
需要关机时,先判断所有横移都无托盘时再关机。
横移先记录状态,需要关机时横移不移托盘,等所有横移都无托盘时关机
\ No newline at end of file
\ No newline at end of file
source/DeviceLibrary/assemblyLine/DischargeLine.cs
查看文件 @
253ddc3
...
@@ -536,15 +536,41 @@ namespace OnlineStore.DeviceLibrary
...
@@ -536,15 +536,41 @@ namespace OnlineStore.DeviceLibrary
if
(
IOValue
(
IO_Type
.
ExitTray_Check3
).
Equals
(
IO_VALUE
.
LOW
))
if
(
IOValue
(
IO_Type
.
ExitTray_Check3
).
Equals
(
IO_VALUE
.
LOW
))
{
{
UpdateScanInfo
(
IO_VALUE
.
LOW
,
""
);
UpdateScanInfo
(
IO_VALUE
.
LOW
,
""
);
(
bool
hasReel
,
List
<
string
>
LastCodeList
)
=
CodeManager
.
CameraCheckAndScan
(
Config
.
GetCameraList
(),
hengyiName
,
true
);
if
(
hasReel
)
{
LastCode
=
SServerManager
.
ProcessCodeList
(
LastCodeList
);
if
(
LastCodeList
.
Count
>
0
)
{
UpdateScanInfo
(
IO_VALUE
.
HIGH
,
LastCode
);
LogUtil
.
info
(
hengyiName
+
"ExitTray_Check3不亮,但视觉识别有料,且扫到条码,更改为有料: "
+
LastCode
);
}
else
{
UpdateScanInfo
(
IO_VALUE
.
HIGH
,
LastCode
);
LogUtil
.
info
(
hengyiName
+
"ExitTray_Check3不亮,但视觉识别有料,未扫到条码,更改为有料: "
+
LastCode
);
}
if
(
DeviceID
.
Equals
(
301
))
{
if
(
Line3LastTrayP
>
Line3MaxPosition
)
{
Line3LastTrayP
=
Line3MaxPosition
;
}
// StationInfo_NG = new StationTrayInfo(StationInfo_Scan.TrayValue, StationInfo_Scan.CodeStr);
}
else
{
if
(
Line3LastTrayP
>
Line3MaxPosition
-
1
)
{
Line3LastTrayP
=
Line3MaxPosition
-
1
;
}
}
}
IsInScanCode
=
false
;
IsInScanCode
=
false
;
}
}
else
else
{
{
string
resStr
=
""
;
string
resStr
=
""
;
bool
hasR
=
false
;
bool
hasR
=
false
;
bool
hasReel
=
false
;
bool
hasReel
=
false
;
if
(
IOValue
(
IO_Type
.
ExitTray_Check3
).
Equals
(
IO_VALUE
.
HIGH
))
if
(
IOValue
(
IO_Type
.
ExitTray_Check3
).
Equals
(
IO_VALUE
.
HIGH
))
{
{
hasReel
=
true
;
hasReel
=
true
;
resStr
+=
"信号检测到有料盘,"
;
resStr
+=
"信号检测到有料盘,"
;
...
@@ -573,7 +599,7 @@ namespace OnlineStore.DeviceLibrary
...
@@ -573,7 +599,7 @@ namespace OnlineStore.DeviceLibrary
LogUtil
.
info
(
hengyiName
+
"扫码工位:开始扫码,IsInScanCode="
+
IsInScanCode
);
LogUtil
.
info
(
hengyiName
+
"扫码工位:开始扫码,IsInScanCode="
+
IsInScanCode
);
List
<
string
>
LastCodeList
=
CodeManager
.
CameraScan
(
Config
.
GetCameraList
(),
hengyiName
,
true
);
List
<
string
>
LastCodeList
=
CodeManager
.
CameraScan
(
Config
.
GetCameraList
(),
hengyiName
,
true
);
hasR
=
CodeManager
.
HasRightCode
(
LastCodeList
.
ToArray
());
hasR
=
CodeManager
.
HasRightCode
(
LastCodeList
.
ToArray
());
if
(
LastCodeList
.
Count
>
0
)
if
(
LastCodeList
.
Count
>
0
)
{
{
hasReel
=
true
;
hasReel
=
true
;
resStr
+=
"第一次扫到条码,"
;
resStr
+=
"第一次扫到条码,"
;
...
@@ -606,7 +632,7 @@ namespace OnlineStore.DeviceLibrary
...
@@ -606,7 +632,7 @@ namespace OnlineStore.DeviceLibrary
finally
finally
{
{
if
(
hasReel
)
if
(
hasReel
)
{
{
UpdateScanInfo
(
IO_VALUE
.
HIGH
,
LastCode
);
UpdateScanInfo
(
IO_VALUE
.
HIGH
,
LastCode
);
}
}
...
...
source/DeviceLibrary/assemblyLine/FeedingEquip.cs
查看文件 @
253ddc3
...
@@ -598,6 +598,21 @@ namespace OnlineStore.DeviceLibrary
...
@@ -598,6 +598,21 @@ namespace OnlineStore.DeviceLibrary
}
}
return
false
;
return
false
;
}
}
/// <summary>
/// 升降盘是否在前进端
/// </summary>
public
bool
IsTrayLCylinderBefore
()
{
if
(
IOValue
(
IO_Type
.
SL_TrayLocation1_After
).
Equals
(
IO_VALUE
.
LOW
)
&&
IOValue
(
IO_Type
.
SL_TrayLocation1_Before
).
Equals
(
IO_VALUE
.
HIGH
)
&&
IOValue
(
IO_Type
.
SL_TrayLocation2_After
).
Equals
(
IO_VALUE
.
LOW
)
&&
IOValue
(
IO_Type
.
SL_TrayLocation2_Before
).
Equals
(
IO_VALUE
.
HIGH
))
{
return
true
;
}
return
false
;
}
/// <summary>
/// <summary>
/// 判断上料横移机构是否可以横移运动
/// 判断上料横移机构是否可以横移运动
...
...
source/DeviceLibrary/assemblyLine/FeedingEquip_InStore.cs
查看文件 @
253ddc3
...
@@ -812,24 +812,48 @@ namespace OnlineStore.DeviceLibrary
...
@@ -812,24 +812,48 @@ namespace OnlineStore.DeviceLibrary
InLog
(
"料架入库"
+
MoveInfo
.
SLog
+
":升降盘定位气缸第一次前进 2秒,清空条码信息"
);
InLog
(
"料架入库"
+
MoveInfo
.
SLog
+
":升降盘定位气缸第一次前进 2秒,清空条码信息"
);
LastCodeList
=
new
List
<
string
>();
LastCodeList
=
new
List
<
string
>();
NextCodeList
=
new
List
<
string
>();
NextCodeList
=
new
List
<
string
>();
TrayLCylinderMoveCount
=
1
;
TrayLCylinderBefore
(
null
);
TrayLCylinderBefore
(
null
);
MoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitTime
(
2000
));
MoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitTime
(
2000
));
}
}
else
if
(
MoveInfo
.
MoveStep
.
Equals
(
LineMoveStep
.
FI_07_TrayLocation_Before
))
else
if
(
MoveInfo
.
MoveStep
.
Equals
(
LineMoveStep
.
FI_07_TrayLocation_Before
))
{
{
//判断信号是否到位,到位的话直接下一步,
if
(
IsTrayLCylinderBefore
())
{
LoopCount
=
0
;
MoveInfo
.
NextMoveStep
(
LineMoveStep
.
FI_10_AxisUpMove
);
InLog
(
"料架入库"
+
MoveInfo
.
SLog
+
":升降盘前进次数:"
+
TrayLCylinderMoveCount
+
"已到位,上料轴开始慢速上升到P3点,等待检测到料盘,设置LoopCount = 0"
);
MoveInfo
.
ShelfNoTray
=
false
;
BatchAxisToP3
();
}
else
{
// 信号不到位,后退,再次循环
MoveInfo
.
NextMoveStep
(
LineMoveStep
.
FI_08_TrayLocation_Back
);
MoveInfo
.
NextMoveStep
(
LineMoveStep
.
FI_08_TrayLocation_Back
);
InLog
(
"料架入库"
+
MoveInfo
.
SLog
+
":升降盘定位气缸
后退,等待再次前进"
);
InLog
(
"料架入库"
+
MoveInfo
.
SLog
+
":升降盘定位气缸第"
+
TrayLCylinderMoveCount
+
"次
后退,等待再次前进"
);
TrayLCylinderAfter
(
MoveInfo
);
TrayLCylinderAfter
(
MoveInfo
);
}
}
}
else
if
(
MoveInfo
.
MoveStep
.
Equals
(
LineMoveStep
.
FI_08_TrayLocation_Back
))
else
if
(
MoveInfo
.
MoveStep
.
Equals
(
LineMoveStep
.
FI_08_TrayLocation_Back
))
{
{
TrayLCylinderMoveCount
++;
if
(
TrayLCylinderMoveCount
<
10
)
{
MoveInfo
.
NextMoveStep
(
LineMoveStep
.
FI_07_TrayLocation_Before
);
InLog
(
"料架入库"
+
MoveInfo
.
SLog
+
":升降盘定位气缸第"
+
TrayLCylinderMoveCount
+
"次前进 2秒"
);
TrayLCylinderBefore
(
null
);
MoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitTime
(
2000
));
}
else
{
MoveInfo
.
NextMoveStep
(
LineMoveStep
.
FI_09_TrayLocation_Before
);
MoveInfo
.
NextMoveStep
(
LineMoveStep
.
FI_09_TrayLocation_Before
);
InLog
(
"料架入库"
+
MoveInfo
.
SLog
+
":升降盘定位气缸
前进,清空条码信息"
);
InLog
(
"料架入库"
+
MoveInfo
.
SLog
+
":升降盘定位气缸第"
+
TrayLCylinderMoveCount
+
"次
前进,清空条码信息"
);
LastCodeList
=
new
List
<
string
>();
LastCodeList
=
new
List
<
string
>();
NextCodeList
=
new
List
<
string
>();
NextCodeList
=
new
List
<
string
>();
TrayLCylinderBefore
(
MoveInfo
);
TrayLCylinderBefore
(
MoveInfo
);
}
}
}
else
if
(
MoveInfo
.
MoveStep
.
Equals
(
LineMoveStep
.
FI_09_TrayLocation_Before
))
else
if
(
MoveInfo
.
MoveStep
.
Equals
(
LineMoveStep
.
FI_09_TrayLocation_Before
))
{
{
LoopCount
=
0
;
LoopCount
=
0
;
...
@@ -1640,6 +1664,8 @@ namespace OnlineStore.DeviceLibrary
...
@@ -1640,6 +1664,8 @@ namespace OnlineStore.DeviceLibrary
private
int
LastWidth
=
0
;
private
int
LastWidth
=
0
;
private
List
<
string
>
LastCodeList
=
new
List
<
string
>();
private
List
<
string
>
LastCodeList
=
new
List
<
string
>();
private
List
<
string
>
NextCodeList
=
new
List
<
string
>();
private
List
<
string
>
NextCodeList
=
new
List
<
string
>();
private
int
TrayLCylinderMoveCount
=
0
;
//升降盘气缸已运动次数
private
int
GetHeight
()
private
int
GetHeight
()
{
{
LastHeight
=
0
;
LastHeight
=
0
;
...
...
source/DeviceLibrary/assemblyLine/FeedingEquip_OutStore.cs
查看文件 @
253ddc3
...
@@ -363,21 +363,42 @@ namespace OnlineStore.DeviceLibrary
...
@@ -363,21 +363,42 @@ namespace OnlineStore.DeviceLibrary
{
{
MoveInfo
.
NextMoveStep
(
LineMoveStep
.
FO_07_TrayLocation_Before
);
MoveInfo
.
NextMoveStep
(
LineMoveStep
.
FO_07_TrayLocation_Before
);
OutLog
(
"准备出库料架 "
+
MoveInfo
.
SLog
+
" :升降盘定位气缸第一次前进 2秒"
);
OutLog
(
"准备出库料架 "
+
MoveInfo
.
SLog
+
" :升降盘定位气缸第一次前进 2秒"
);
TrayLCylinderMoveCount
=
1
;
TrayLCylinderBefore
(
null
);
TrayLCylinderBefore
(
null
);
MoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitTime
(
2000
));
MoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitTime
(
2000
));
}
}
else
if
(
MoveInfo
.
MoveStep
.
Equals
(
LineMoveStep
.
FO_07_TrayLocation_Before
))
else
if
(
MoveInfo
.
MoveStep
.
Equals
(
LineMoveStep
.
FO_07_TrayLocation_Before
))
{
//判断信号是否到位,到位的话直接下一步,
if
(
IsTrayLCylinderBefore
())
{
MoveInfo
.
NextMoveStep
(
LineMoveStep
.
FO_10_AxisUpMove
);
OutLog
(
"准备出库料架 "
+
MoveInfo
.
SLog
+
" :第"
+
TrayLCylinderMoveCount
+
"次上升到位,上料轴开始慢速上升到P3点,等待检测到料盘"
);
BatchAxisToP3
();
}
else
{
{
MoveInfo
.
NextMoveStep
(
LineMoveStep
.
FO_08_TrayLocation_Back
);
MoveInfo
.
NextMoveStep
(
LineMoveStep
.
FO_08_TrayLocation_Back
);
OutLog
(
"准备出库料架 "
+
MoveInfo
.
SLog
+
" :升降盘定位气缸
后退,等待再次前进"
);
OutLog
(
"准备出库料架 "
+
MoveInfo
.
SLog
+
" :升降盘定位气缸第"
+
TrayLCylinderMoveCount
+
"次
后退,等待再次前进"
);
TrayLCylinderAfter
(
MoveInfo
);
TrayLCylinderAfter
(
MoveInfo
);
}
}
}
else
if
(
MoveInfo
.
MoveStep
.
Equals
(
LineMoveStep
.
FO_08_TrayLocation_Back
))
else
if
(
MoveInfo
.
MoveStep
.
Equals
(
LineMoveStep
.
FO_08_TrayLocation_Back
))
{
{
TrayLCylinderMoveCount
++;
if
(
TrayLCylinderMoveCount
<
10
)
{
MoveInfo
.
NextMoveStep
(
LineMoveStep
.
FO_07_TrayLocation_Before
);
OutLog
(
"准备出库料架 "
+
MoveInfo
.
SLog
+
" :升降盘定位气缸第"
+
TrayLCylinderMoveCount
+
"次前进 2秒"
);
TrayLCylinderBefore
(
null
);
MoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitTime
(
2000
));
}
else
{
MoveInfo
.
NextMoveStep
(
LineMoveStep
.
FO_09_TrayLocation_Before
);
MoveInfo
.
NextMoveStep
(
LineMoveStep
.
FO_09_TrayLocation_Before
);
OutLog
(
"准备出库料架 "
+
MoveInfo
.
SLog
+
" :升降盘定位气缸
前进"
);
OutLog
(
"准备出库料架 "
+
MoveInfo
.
SLog
+
" :升降盘定位气缸第"
+
TrayLCylinderMoveCount
+
"次
前进"
);
TrayLCylinderBefore
(
MoveInfo
);
TrayLCylinderBefore
(
MoveInfo
);
}
}
}
else
if
(
MoveInfo
.
MoveStep
.
Equals
(
LineMoveStep
.
FO_09_TrayLocation_Before
))
else
if
(
MoveInfo
.
MoveStep
.
Equals
(
LineMoveStep
.
FO_09_TrayLocation_Before
))
{
{
MoveInfo
.
NextMoveStep
(
LineMoveStep
.
FO_10_AxisUpMove
);
MoveInfo
.
NextMoveStep
(
LineMoveStep
.
FO_10_AxisUpMove
);
...
...
source/DeviceLibrary/assemblyLine/LineBean.cs
查看文件 @
253ddc3
...
@@ -1125,7 +1125,24 @@ namespace OnlineStore.DeviceLibrary
...
@@ -1125,7 +1125,24 @@ namespace OnlineStore.DeviceLibrary
//}
//}
foreach
(
EquipBase
equip
in
AllEquipMap
.
Values
)
foreach
(
EquipBase
equip
in
AllEquipMap
.
Values
)
{
{
if
(
equip
.
alarmType
.
Equals
(
LineAlarmType
.
None
)
||
equip
.
WarnMsg
.
Contains
(
"获取库位号超时"
)
||
if
(
equip
.
alarmType
.
Equals
(
LineAlarmType
.
IoSingleTimeOut
))
{
if
(
equip
is
ProvidingEquip
&&
equip
.
MoveInfo
.
MoveStep
.
Equals
(
LineMoveStep
.
PO_09_CylinderRelax
))
{
alarmList
.
Add
(
new
AlarmMsg
(
equip
.
Name
,
"line."
+
equip
.
Name
+
"_"
+
equip
.
alarmType
,
equip
.
WarnMsg
));
}
else
if
(
equip
is
FeedingEquip
&&
equip
.
MoveInfo
.
MoveStep
.
Equals
(
LineMoveStep
.
FI_09_TrayLocation_Before
))
{
alarmList
.
Add
(
new
AlarmMsg
(
equip
.
Name
,
"line."
+
equip
.
Name
+
"_"
+
equip
.
alarmType
,
equip
.
WarnMsg
));
}
else
if
(
equip
is
FeedingEquip
&&
equip
.
MoveInfo
.
MoveStep
.
Equals
(
LineMoveStep
.
FO_09_TrayLocation_Before
))
{
alarmList
.
Add
(
new
AlarmMsg
(
equip
.
Name
,
"line."
+
equip
.
Name
+
"_"
+
equip
.
alarmType
,
equip
.
WarnMsg
));
}
}
//出料机构->皮带线放料,等待夹爪信号灭的报警也发给服务器
else
if
(
equip
.
alarmType
.
Equals
(
LineAlarmType
.
None
)
||
equip
.
WarnMsg
.
Contains
(
"获取库位号超时"
)
||
equip
.
alarmType
.
Equals
(
LineAlarmType
.
IoSingleTimeOut
))
equip
.
alarmType
.
Equals
(
LineAlarmType
.
IoSingleTimeOut
))
{
{
continue
;
continue
;
...
...
source/DeviceLibrary/assemblyLine/ProvidingEquip_Partial.cs
查看文件 @
253ddc3
...
@@ -313,10 +313,11 @@ namespace OnlineStore.DeviceLibrary
...
@@ -313,10 +313,11 @@ namespace OnlineStore.DeviceLibrary
}
}
else
else
{
{
SecondMoveInfo
.
NextMoveStep
(
LineMoveStep
.
MO_16_Stop2Down
);
MO_16_Stop2Down
();
CheckLog
(
"托盘放行 "
+
SecondMoveInfo
.
SLog
+
" ,阻挡2下降"
);
//SecondMoveInfo.NextMoveStep(LineMoveStep.MO_16_Stop2Down);
IOMove
(
IO_Type
.
StopCylinder_Down2
,
IO_VALUE
.
HIGH
);
//CheckLog("托盘放行 " + SecondMoveInfo.SLog + " ,阻挡2下降");
SecondMoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitIO
(
IO_Type
.
StopCylinder_Down2
,
IO_VALUE
.
HIGH
));
//IOMove(IO_Type.StopCylinder_Down2, IO_VALUE.HIGH);
//SecondMoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.StopCylinder_Down2, IO_VALUE.HIGH));
}
}
}
}
else
else
...
@@ -668,19 +669,36 @@ namespace OnlineStore.DeviceLibrary
...
@@ -668,19 +669,36 @@ namespace OnlineStore.DeviceLibrary
//SecondMoveInfo.NextMoveStep(LineMoveStep.MO_15_WaitCanGo);
//SecondMoveInfo.NextMoveStep(LineMoveStep.MO_15_WaitCanGo);
//CheckLog("托盘放行 " + SecondMoveInfo.SLog + " ,等待 NextStopCheck=0");
//CheckLog("托盘放行 " + SecondMoveInfo.SLog + " ,等待 NextStopCheck=0");
// SecondMoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.NextStopCheck, IO_VALUE.LOW));
// SecondMoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.NextStopCheck, IO_VALUE.LOW));
SecondMoveInfo
.
NextMoveStep
(
LineMoveStep
.
MO_16_Stop2Down
);
MO_16_Stop2Down
();
CheckLog
(
"托盘放行 "
+
SecondMoveInfo
.
SLog
+
" ,阻挡2下降"
);
//SecondMoveInfo.NextMoveStep(LineMoveStep.MO_16_Stop2Down);
IOMove
(
IO_Type
.
StopCylinder_Down2
,
IO_VALUE
.
HIGH
);
//CheckLog("托盘放行 " + SecondMoveInfo.SLog + " ,阻挡2下降");
SecondMoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitIO
(
IO_Type
.
StopCylinder_Down2
,
IO_VALUE
.
HIGH
));
//IOMove(IO_Type.StopCylinder_Down2, IO_VALUE.HIGH);
//SecondMoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.StopCylinder_Down2, IO_VALUE.HIGH));
}
}
}
}
else
if
(
SecondMoveInfo
.
MoveStep
.
Equals
(
LineMoveStep
.
MO_15_WaitCanGo
))
else
if
(
SecondMoveInfo
.
MoveStep
.
Equals
(
LineMoveStep
.
MO_15_WaitCanGo
))
{
{
SecondMoveInfo
.
NextMoveStep
(
LineMoveStep
.
MO_16_Stop2Down
);
if
(
DeviceID
.
Equals
(
203
)){
CheckLog
(
"托盘放行 "
+
SecondMoveInfo
.
SLog
+
" ,阻挡2下降"
);
IOMove
(
IO_Type
.
StopCylinder_Down2
,
IO_VALUE
.
HIGH
);
MoveEquip
moveEquip
=
LineManager
.
Line
.
GetMoveByDId
(
17
);
SecondMoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitIO
(
IO_Type
.
StopCylinder_Down2
,
IO_VALUE
.
HIGH
));
if
(
moveEquip
.
IOValue
(
IO_Type
.
StopCylinder_Check1
).
Equals
(
IO_VALUE
.
LOW
))
{
MO_16_Stop2Down
();
}
else
if
(
SecondMoveInfo
.
IsTimeOut
(
60
))
{
MoveTimeoutAlarm
(
MoveInfo
,
"等待进仓17前阻挡信号X51=LOW超时"
);
}
}
else
{
MO_16_Stop2Down
();
}
//SecondMoveInfo.NextMoveStep(LineMoveStep.MO_16_Stop2Down);
//CheckLog("托盘放行 " + SecondMoveInfo.SLog + " ,阻挡2下降");
//IOMove(IO_Type.StopCylinder_Down2, IO_VALUE.HIGH);
//SecondMoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.StopCylinder_Down2, IO_VALUE.HIGH));
}
}
else
if
(
SecondMoveInfo
.
MoveStep
.
Equals
(
LineMoveStep
.
MO_16_Stop2Down
))
else
if
(
SecondMoveInfo
.
MoveStep
.
Equals
(
LineMoveStep
.
MO_16_Stop2Down
))
{
{
...
@@ -713,6 +731,27 @@ namespace OnlineStore.DeviceLibrary
...
@@ -713,6 +731,27 @@ namespace OnlineStore.DeviceLibrary
}
}
#
endregion
#
endregion
}
}
private
void
MO_16_Stop2Down
()
{
if
(
DeviceID
.
Equals
(
203
))
{
MoveEquip
move17
=
LineManager
.
Line
.
GetMoveByDId
(
17
);
if
(
move17
.
IOValue
(
IO_Type
.
StopCylinder_Check1
).
Equals
(
IO_VALUE
.
HIGH
))
{
SecondMoveInfo
.
NextMoveStep
(
LineMoveStep
.
MO_15_WaitCanGo
);
SecondMoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitTime
(
500
));
LogUtil
.
info
(
Name
+
"托盘放行 "
+
SecondMoveInfo
.
SLog
+
" ,当前出料3,进仓17前阻挡有料,暂不放行托盘"
);
return
;
}
}
SecondMoveInfo
.
NextMoveStep
(
LineMoveStep
.
MO_16_Stop2Down
);
CheckLog
(
"托盘放行 "
+
SecondMoveInfo
.
SLog
+
" ,阻挡2下降"
);
IOMove
(
IO_Type
.
StopCylinder_Down2
,
IO_VALUE
.
HIGH
);
SecondMoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitIO
(
IO_Type
.
StopCylinder_Down2
,
IO_VALUE
.
HIGH
));
}
private
void
MO_14_TopDown
()
private
void
MO_14_TopDown
()
{
{
SecondMoveInfo
.
NextMoveStep
(
LineMoveStep
.
MO_14_TopDown
);
SecondMoveInfo
.
NextMoveStep
(
LineMoveStep
.
MO_14_TopDown
);
...
...
source/DeviceLibrary/deviceLibrary/halcon/CodeManager.cs
查看文件 @
253ddc3
...
@@ -548,5 +548,173 @@ namespace OnlineStore.DeviceLibrary
...
@@ -548,5 +548,173 @@ namespace OnlineStore.DeviceLibrary
}
}
return
ReplaceCode
(
code
);
return
ReplaceCode
(
code
);
}
}
[
HandleProcessCorruptedStateExceptions
]
public
static
(
bool
,
List
<
string
>)
CameraCheckAndScan
(
List
<
string
>
cameraList
,
string
deviceName
,
bool
findRightCodeBreak
=
false
,
int
timeOut
=
1500
)
{
bool
isPreScan
=
deviceName
.
EndsWith
(
"预扫码"
);
List
<
string
>
codeList
=
new
List
<
string
>();
bool
hasReel
=
false
;
if
(
cameraList
==
null
||
cameraList
.
Count
<=
0
)
{
return
(
false
,
codeList
);
}
try
{
foreach
(
string
cameraName
in
cameraList
)
{
if
(
cameraName
.
Trim
().
Equals
(
""
))
{
continue
;
}
ScanCount
++;
DateTime
startTime
=
DateTime
.
Now
;
if
(
deviceName
!=
""
)
{
LogUtil
.
debug
(
deviceName
+
" 【"
+
cameraName
+
"】开始取图片"
);
}
Bitmap
bmp
=
null
;
HalconDotNet
.
HObject
ho_Image
=
null
;
bool
findRightCode
=
false
;
try
{
//取照片完成,先检测是否有料,有料才需要扫码,否则直接返回
hasReel
=
EyemManager
.
ReelCheck
(
bmp
);
if
(!
hasReel
)
{
return
(
false
,
codeList
);
}
LogUtil
.
info
(
deviceName
+
" 【"
+
cameraName
+
"】视觉识别有料【"
+
FormUtil
.
GetSpanStr
(
DateTime
.
Now
-
startTime
)
+
"】,开始扫码"
);
ho_Image
=
Camera
.
_cam
.
CaptureOnImage
(
cameraName
,
out
bmp
);
if
(
ho_Image
==
null
)
{
LogUtil
.
error
(
deviceName
+
" 【"
+
cameraName
+
"】取图片失败["
+
Camera
.
_cam
.
ErrInfo
+
"],关闭相机"
);
CloseCamera
(
cameraName
);
continue
;
}
string
r
=
""
;
bool
eyemNoCode
=
false
;
Task
eyemtask
=
Task
.
Factory
.
StartNew
(
delegate
{
List
<
CodeInfo
>
tlci
=
EyemDecode
.
ModelDecoder
(
ref
bmp
);
foreach
(
CodeInfo
code
in
tlci
)
{
LogUtil
.
info
(
deviceName
+
" 【"
+
cameraName
+
"】[eyemDecode]"
+
code
.
CodeType
+
"(X: "
+
code
.
X
+
",Y: "
+
code
.
Y
+
") "
+
code
.
CodeStr
);
string
str
=
CodeManager
.
ReplaceCode
(
code
.
CodeStr
);
if
(!
codeList
.
Contains
(
str
))
{
codeList
.
Add
(
str
);
r
=
r
+
"##eyem|"
+
code
.
CodeType
+
"|"
+
str
;
if
(!
findRightCode
)
{
findRightCode
=
HasRightCode
(
str
);
}
}
}
});
//最多等待60秒
bool
taskResult
=
eyemtask
.
Wait
(
60000
);
if
(!
taskResult
)
{
LogUtil
.
error
(
deviceName
+
" 【"
+
cameraName
+
"】eyem扫码超时"
);
eyemNoCode
=
true
;
}
if
(!
findRightCode
)
{
try
{
List
<
CodeInfo
>
cc
=
new
List
<
CodeInfo
>();
eyemNoCode
=
true
;
RemoteDecodeHelper
.
RemoteDecodeParam
remoteDecodeParam
=
new
RemoteDecodeHelper
.
RemoteDecodeParam
{
codeTypeList
=
allCodeTypeList
.
ToArray
(),
codeCount
=
3
,
timeout
=
3000
};
cc
=
RemoteDecodeHelper
.
DecodeRequest
(
ho_Image
,
remoteDecodeParam
);
if
(
cc
!=
null
)
{
foreach
(
CodeInfo
c
in
cc
)
{
string
str
=
CodeManager
.
ReplaceCode
(
c
.
CodeStr
);
if
(!
codeList
.
Contains
(
str
))
{
codeList
.
Add
(
str
);
r
=
r
+
"##halcon|"
+
c
.
CodeType
+
"|"
+
str
;
if
(!
findRightCode
)
{
findRightCode
=
HasRightCode
(
str
);
}
}
}
}
}
catch
(
Exception
ex
)
{
LogUtil
.
error
(
deviceName
+
" RemoteDecodeHelper扫码出错:"
+
ex
.
ToString
());
}
}
//if (!findRightCode && SaveErrorImageToFile.Equals(1))
if
(
SaveImage
||
(((!
findRightCode
)
||
eyemNoCode
)
&&
(!
isPreScan
)))
{
//如果halcon没扫出的,
string
nameStr
=
""
;
if
(
findRightCode
&&
eyemNoCode
)
{
nameStr
=
"eyem"
;
}
SaveImageToFile
(
deviceName
,
cameraName
+
nameStr
,
bmp
);
}
if
(
deviceName
!=
""
||
r
!=
""
)
{
LogUtil
.
info
(
deviceName
+
" 【"
+
cameraName
+
"】识别扫码完成【"
+
FormUtil
.
GetSpanStr
(
DateTime
.
Now
-
startTime
)
+
"】["
+
findRightCode
+
"]"
+
ScanCount
+
" :"
+
r
);
}
}
catch
(
AccessViolationException
e
)
{
LogUtil
.
error
(
deviceName
+
" 扫码出现AccessViolationException异常,关闭相机【"
+
cameraName
+
"】:"
+
e
.
ToString
());
Camera
.
_cam
.
Close
(
cameraName
);
// GC.Collect();
}
catch
(
Exception
ex
)
{
LogUtil
.
error
(
deviceName
+
" 扫码出错:"
+
ex
.
ToString
());
}
finally
{
if
(
ho_Image
!=
null
)
{
ho_Image
.
Dispose
();
ho_Image
=
null
;
}
// GC.Collect();
Task
.
Delay
(
10
);
}
}
}
catch
(
AccessViolationException
e
)
{
LogUtil
.
error
(
deviceName
+
" 扫码出现AccessViolationException异常,关闭所有相机:"
+
e
.
ToString
());
Camera
.
_cam
.
CloseAll
();
//GC.Collect();
}
catch
(
Exception
ex
)
{
LogUtil
.
error
(
deviceName
+
" 扫码出错:"
+
ex
.
ToString
());
}
return
(
hasReel
,
codeList
);
}
}
}
}
}
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论