Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
孙克
/
RC1250-AssemblyLine
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit 4ba25353
由
LN
编写于
2020-03-13 17:09:49 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
扫码问题调整
1 个父辈
9c775eb9
隐藏空白字符变更
内嵌
并排
正在显示
6 个修改的文件
包含
51 行增加
和
19 行删除
dll/CodeLibrary - 副本.dll
dll/CodeLibrary.dll
source/DeviceLibrary/assemblyLine/DischargeLine.cs
source/DeviceLibrary/assemblyLine/DischargeLine_Partial.cs
source/DeviceLibrary/assemblyLine/OutTrayLineBean.cs
source/DeviceLibrary/deviceLibrary/halcon/CodeManager.cs
dll/CodeLibrary - 副本.dll
0 → 100644
查看文件 @
4ba2535
此文件类型无法预览
dll/CodeLibrary.dll
查看文件 @
4ba2535
此文件类型无法预览
source/DeviceLibrary/assemblyLine/DischargeLine.cs
查看文件 @
4ba2535
...
...
@@ -109,6 +109,7 @@ namespace OnlineStore.DeviceLibrary
LogInfo
(
"StartReset: 重置灯状态,关闭所有皮带线,定位气缸下降 开始;"
);
//复位时默认为有托盘
IsInScanCode
=
false
;
TrayLine1
.
LastTrayPosition
=
1
;
TrayLine2
.
LastTrayPosition
=
1
;
Line3LastTrayP
=
1
;
...
...
@@ -276,7 +277,7 @@ namespace OnlineStore.DeviceLibrary
else
{
//皮带线3出口有料,分盘定位装置无料
if
(
Line3TurnIsStop
()
&&
IOValue
(
IO_Type
.
SeparateDevice_Check
).
Equals
(
IO_VALUE
.
LOW
)
&&
StationInfo_NG
.
TrayValue
.
Equals
(
IO_VALUE
.
HIGH
)&&
IsInScanCode
.
Equals
(
false
))
if
(
Line3TurnIsStop
()
&&
IOValue
(
IO_Type
.
SeparateDevice_Check
).
Equals
(
IO_VALUE
.
LOW
)
&&
StationInfo_NG
.
TrayValue
.
Equals
(
IO_VALUE
.
HIGH
)&&
ScanIsEnd
(
))
{
StartOutStoreMove
(
new
InOutParam
());
}
...
...
@@ -369,7 +370,7 @@ namespace OnlineStore.DeviceLibrary
TrayLine2
.
Line3CanRun
&&
ngNoTray
&&
Line3HasTray
()
&&
(
IsInScanCode
.
Equals
(
false
))
&&
(
ScanIsEnd
(
))
)
{
//判断皮带三还有料盘,需要转动一个工位
...
...
@@ -435,9 +436,28 @@ namespace OnlineStore.DeviceLibrary
NewTypeScan
();
}
}
private
bool
ScanIsEnd
()
{
TimeSpan
span
=
DateTime
.
Now
-
LastScanTime
;
if
(
IsInScanCode
&&
span
.
TotalMinutes
<
1
)
{
return
false
;
}
return
true
;
}
private
DateTime
LastScanTime
=
DateTime
.
Now
;
private
void
NewTypeScan
(
bool
isfirst
=
false
)
{
TimeSpan
span
=
DateTime
.
Now
-
LastScanTime
;
if
(!
ScanIsEnd
())
{
LogInfo
(
"NewTypeScan return "
);
return
;
}
IsInScanCode
=
true
;
LastScanTime
=
DateTime
.
Now
;
string
LastCode
=
""
;
Task
.
Factory
.
StartNew
(
delegate
{
...
...
@@ -463,18 +483,23 @@ namespace OnlineStore.DeviceLibrary
{
try
{
L
ogUtil
.
info
(
hengyiName
+
"扫码工位:开始扫码,IsInScanCode="
+
IsInScanCode
)
;
List
<
string
>
LastCodeList
=
CodeManager
.
CameraScan
(
Config
.
GetCameraList
(),
Nam
e
);
if
(
LastCodeList
.
Count
<=
0
)
L
astCode
=
""
;
StationInfo_Scan
=
new
StationTrayInfo
(
IO_VALUE
.
HIGH
,
LastCod
e
);
if
(
DeviceID
.
Equals
(
301
)
)
{
Thread
.
Sleep
(
300
);
LastCodeList
=
CodeManager
.
CameraScan
(
Config
.
GetCameraList
(),
Name
);
StationInfo_NG
=
new
StationTrayInfo
(
StationInfo_Scan
.
TrayValue
,
StationInfo_Scan
.
CodeStr
);
}
LogUtil
.
info
(
hengyiName
+
"扫码工位:开始扫码,IsInScanCode="
+
IsInScanCode
);
List
<
string
>
LastCodeList
=
CodeManager
.
CameraScan
(
Config
.
GetCameraList
(),
hengyiName
);
if
(
LastCodeList
.
Count
<=
0
)
{
Thread
.
Sleep
(
300
);
LastCodeList
=
CodeManager
.
CameraScan
(
Config
.
GetCameraList
(),
Name
);
LastCodeList
=
CodeManager
.
CameraScan
(
Config
.
GetCameraList
(),
hengyiName
);
}
//if (LastCodeList.Count <= 0)
//{
// Thread.Sleep(300);
// LastCodeList = CodeManager.CameraScan(Config.GetCameraList(), Name);
//}
LastCode
=
SServerManager
.
ProcessCodeList
(
LastCodeList
);
// Thread.Sleep(5000);
}
...
...
@@ -547,9 +572,9 @@ namespace OnlineStore.DeviceLibrary
{
msg
+=
"Move:"
+
MoveInfo
.
MoveType
+
" "
+
MoveInfo
.
MoveStep
+
" "
+
LastWidth
+
"="
+
StationInfo_Move
.
CodeStr
+
"\n"
;
}
msg
+=
"扫码工位:"
+
StationInfo_Scan
.
ToStr
+
"\n"
;
msg
+=
"NG 工位:"
+
StationInfo_NG
.
ToStr
+
"\n"
;
msg
+=
"IsInScanCode:"
+
IsInScanCode
;
//msg += "NG 工位:" + StationInfo_NG
.ToStr + "\n";
//msg += "扫码工位:" + StationInfo_Scan
.ToStr + "\n";
//
msg += "IsInScanCode:" + IsInScanCode;
// msg += "LastWidth:" + LastWidth + "\n";
return
msg
;
...
...
source/DeviceLibrary/assemblyLine/DischargeLine_Partial.cs
查看文件 @
4ba2535
...
...
@@ -87,7 +87,7 @@ namespace OnlineStore.DeviceLibrary
&&
Line3TurnIsStop
()
&&
Line3Turn
.
CanStart
()
&&
ScanNgIsBack
()
&&
(
IsInScanCode
.
Equals
(
false
))
&&
(
ScanIsEnd
(
))
)
{
return
true
;
...
...
source/DeviceLibrary/assemblyLine/OutTrayLineBean.cs
查看文件 @
4ba2535
...
...
@@ -399,6 +399,7 @@ namespace OnlineStore.DeviceLibrary
{
Thread
.
Sleep
(
50
);
TimeSpan
span
=
DateTime
.
Now
-
startTime
;
bool
isRestart
=
false
;
if
(
span
.
TotalSeconds
>
2
&&
IOManager
.
IOValue
(
moveDO
,
subType
).
Equals
(
IO_VALUE
.
LOW
))
{
LogUtil
.
error
(
subType
+
" LineRunAndWait2 转动["
+
moveDO
+
"]["
+
checkDI
+
"],已等待["
+
FormUtil
.
GetSpanStr
(
span
)
+
"],重写IO:"
+
moveDO
);
...
...
@@ -419,6 +420,7 @@ namespace OnlineStore.DeviceLibrary
{
if
(
canWhileCount
>
0
&&
span
.
TotalMilliseconds
<
800
)
{
isRestart
=
true
;
canWhileCount
--;
LogUtil
.
info
(
subType
+
" 异常停止,重新开始转动:["
+
moveDO
+
"] ["
+
checkDI
+
"] 耗时 ["
+
FormUtil
.
GetSpanStr
(
span
)
+
"]["
+
canWhileCount
+
"]"
);
LineRunAndWait
(
moveDO
,
checkDI
,
timeOutMS
);
...
...
@@ -444,10 +446,13 @@ namespace OnlineStore.DeviceLibrary
}
LastEndTime
=
DateTime
.
Now
;
IOManager
.
IOMove
(
moveDO
,
IO_VALUE
.
LOW
,
subType
);
Task
.
Factory
.
StartNew
(
delegate
if
(!
isRestart
)
{
turnEnd
?.
Invoke
(
result
.
Equals
(
""
));
});
Task
.
Factory
.
StartNew
(
delegate
{
turnEnd
?.
Invoke
(
result
.
Equals
(
""
));
});
}
InTurn
=
false
;
return
result
;
}
...
...
source/DeviceLibrary/deviceLibrary/halcon/CodeManager.cs
查看文件 @
4ba2535
...
...
@@ -104,6 +104,7 @@ namespace OnlineStore.DeviceLibrary
try
{
bitm
=
Camera
.
_cam
.
GrabOneImage
(
cameraName
);
//Camera._cam.Close(cameraName);
}
catch
(
Exception
ex
)
{
...
...
@@ -144,11 +145,12 @@ namespace OnlineStore.DeviceLibrary
}
LogUtil
.
info
(
deviceName
+
" 【"
+
cameraName
+
"】取图片完成,开始转换并扫码"
);
System
.
Threading
.
Thread
.
Sleep
(
1
);
//
System.Threading.Thread.Sleep(1);
//转换托盘大概100-150ms,不打印日志
Bitmap
bit
=
new
Bitmap
(
bitmap
);
LogUtil
.
info
(
deviceName
+
" 【"
+
cameraName
+
"】new Bitmap(bitmap);完成"
);
HalconDotNet
.
HObject
ho_Image
=
HDCodeHelper
.
Bitmap2HObjectBpp24
(
bit
);
// LogUtil.info(" 相机
【" + cameraName + "】转换图片完成,开始扫码");
LogUtil
.
info
(
deviceName
+
"
【"
+
cameraName
+
"】转换图片完成,开始扫码"
);
List
<
CodeInfo
>
cc
=
new
List
<
CodeInfo
>();
string
r
=
""
;
foreach
(
string
codeType
in
codeTypeList
)
...
...
@@ -187,7 +189,7 @@ namespace OnlineStore.DeviceLibrary
catch
(
AccessViolationException
e
)
{
LogUtil
.
error
(
deviceName
+
" 扫码出现AccessViolationException异常:"
+
e
.
ToString
());
GC
.
Collect
();
//
GC.Collect();
}
catch
(
Exception
ex
)
{
...
...
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论