Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
孙克
/
RC1250-AssemblyLine
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit 0a2f94ec
由
LN
编写于
2020-07-10 14:06:47 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
当未找到有效码时重新扫码
1 个父辈
dc9b6c0a
隐藏空白字符变更
内嵌
并排
正在显示
5 个修改的文件
包含
37 行增加
和
33 行删除
source/AssemblyLineClient/FrmDischargeLine.cs
source/AssemblyLineClient/FrmFeedingEquip.cs
source/DeviceLibrary/assemblyLine/DischargeLine.cs
source/DeviceLibrary/assemblyLine/FeedingEquip_InStore.cs
source/DeviceLibrary/deviceLibrary/halcon/CodeManager.cs
source/AssemblyLineClient/FrmDischargeLine.cs
查看文件 @
0a2f94e
...
@@ -399,7 +399,7 @@ namespace OnlineStore.AssemblyLine
...
@@ -399,7 +399,7 @@ namespace OnlineStore.AssemblyLine
private
void
btnScan_Click
(
object
sender
,
EventArgs
e
)
private
void
btnScan_Click
(
object
sender
,
EventArgs
e
)
{
{
List
<
string
>
camers
=
equipBean
.
Config
.
GetCameraList
();
List
<
string
>
camers
=
equipBean
.
Config
.
GetCameraList
();
List
<
string
>
LastCodeList
=
CodeManager
.
CameraScan
(
camers
,
equipBean
.
Name
,
true
);
List
<
string
>
LastCodeList
=
CodeManager
.
CameraScan
(
camers
,
equipBean
.
Name
.
Trim
()+
"测试"
,
true
);
string
cameraStr
=
""
;
string
cameraStr
=
""
;
foreach
(
string
ca
in
camers
)
foreach
(
string
ca
in
camers
)
{
{
...
...
source/AssemblyLineClient/FrmFeedingEquip.cs
查看文件 @
0a2f94e
...
@@ -566,7 +566,7 @@ namespace OnlineStore.AssemblyLine
...
@@ -566,7 +566,7 @@ namespace OnlineStore.AssemblyLine
private
void
btnScan_Click
(
object
sender
,
EventArgs
e
)
private
void
btnScan_Click
(
object
sender
,
EventArgs
e
)
{
{
List
<
string
>
camers
=
equipBean
.
Config
.
GetCameraList
();
List
<
string
>
camers
=
equipBean
.
Config
.
GetCameraList
();
List
<
string
>
LastCodeList
=
CodeManager
.
CameraScan
(
camers
,
equipBean
.
Name
);
List
<
string
>
LastCodeList
=
CodeManager
.
CameraScan
(
camers
,
equipBean
.
Name
.
Trim
()+
"测试"
);
string
cameraStr
=
""
;
string
cameraStr
=
""
;
foreach
(
string
ca
in
camers
)
foreach
(
string
ca
in
camers
)
{
{
...
...
source/DeviceLibrary/assemblyLine/DischargeLine.cs
查看文件 @
0a2f94e
...
@@ -559,7 +559,7 @@ namespace OnlineStore.DeviceLibrary
...
@@ -559,7 +559,7 @@ namespace OnlineStore.DeviceLibrary
if
(
DeviceID
.
Equals
(
301
))
if
(
DeviceID
.
Equals
(
301
))
{
{
if
(
Line3LastTrayP
>
Line3MaxPosition
)
{
Line3LastTrayP
=
Line3MaxPosition
;
}
if
(
Line3LastTrayP
>
Line3MaxPosition
)
{
Line3LastTrayP
=
Line3MaxPosition
;
}
// StationInfo_NG = new StationTrayInfo(StationInfo_Scan.TrayValue, StationInfo_Scan.CodeStr);
// StationInfo_NG = new StationTrayInfo(StationInfo_Scan.TrayValue, StationInfo_Scan.CodeStr);
}
}
else
else
{
{
...
@@ -570,9 +570,10 @@ namespace OnlineStore.DeviceLibrary
...
@@ -570,9 +570,10 @@ 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
);
if
(
LastCodeList
.
Count
<=
0
)
bool
hasR
=
CodeManager
.
HasRightCode
(
LastCodeList
.
ToArray
());
if
(!
hasR
)
{
{
LastCodeList
=
CodeManager
.
CameraScan
(
Config
.
GetCameraList
(),
hengyiName
,
true
);
LastCodeList
=
CodeManager
.
CameraScan
(
Config
.
GetCameraList
(),
hengyiName
,
true
,
3000
);
}
}
LastCode
=
SServerManager
.
ProcessCodeList
(
LastCodeList
);
LastCode
=
SServerManager
.
ProcessCodeList
(
LastCodeList
);
}
}
...
@@ -582,7 +583,7 @@ namespace OnlineStore.DeviceLibrary
...
@@ -582,7 +583,7 @@ namespace OnlineStore.DeviceLibrary
}
}
finally
finally
{
{
UpdateScanInfo
(
IO_VALUE
.
HIGH
,
LastCode
);
UpdateScanInfo
(
IO_VALUE
.
HIGH
,
LastCode
);
IsInScanCode
=
false
;
IsInScanCode
=
false
;
LogUtil
.
info
(
hengyiName
+
" 扫码工位 : 扫码结束 ,"
+
StationInfo_Scan
.
ToStr
+
" IsInScanCode = "
+
IsInScanCode
);
LogUtil
.
info
(
hengyiName
+
" 扫码工位 : 扫码结束 ,"
+
StationInfo_Scan
.
ToStr
+
" IsInScanCode = "
+
IsInScanCode
);
...
...
source/DeviceLibrary/assemblyLine/FeedingEquip_InStore.cs
查看文件 @
0a2f94e
...
@@ -1195,12 +1195,8 @@ namespace OnlineStore.DeviceLibrary
...
@@ -1195,12 +1195,8 @@ namespace OnlineStore.DeviceLibrary
{
{
Task
<
List
<
string
>>
scanTask
=
Task
.
Factory
.
StartNew
(
delegate
Task
<
List
<
string
>>
scanTask
=
Task
.
Factory
.
StartNew
(
delegate
{
{
Thread
.
Sleep
(
500
);
NextCodeList
=
CodeManager
.
CameraScan
(
Config
.
GetCameraList
(),
Name
);
NextCodeList
=
CodeManager
.
CameraScan
(
Config
.
GetCameraList
(),
Name
.
Trim
()+
"预扫码"
);
//if (NextCodeList.Count <= 0)
//{
// NextCodeList = CodeManager.CameraScan(Config.GetCameraList(), Name);
//}
bool
isCanUse
=
true
;
bool
isCanUse
=
true
;
//判断是否可用
//判断是否可用
foreach
(
string
nC
in
NextCodeList
)
foreach
(
string
nC
in
NextCodeList
)
...
@@ -1214,11 +1210,15 @@ namespace OnlineStore.DeviceLibrary
...
@@ -1214,11 +1210,15 @@ namespace OnlineStore.DeviceLibrary
break
;
break
;
}
}
}
}
}
}
if
(!
isCanUse
)
if
(!
isCanUse
)
{
{
NextCodeList
=
new
List
<
string
>();
NextCodeList
=
new
List
<
string
>();
}
}
if
(!
CodeManager
.
HasRightCode
(
NextCodeList
.
ToArray
()))
{
NextCodeList
=
new
List
<
string
>();
}
return
NextCodeList
;
return
NextCodeList
;
});
});
}
}
...
@@ -1268,16 +1268,16 @@ namespace OnlineStore.DeviceLibrary
...
@@ -1268,16 +1268,16 @@ namespace OnlineStore.DeviceLibrary
InLog
(
"料盘移栽"
+
MoveInfo
.
SLog
+
":开始扫码"
);
InLog
(
"料盘移栽"
+
MoveInfo
.
SLog
+
":开始扫码"
);
MoveInfo
.
OneWaitCanEndStep
=
true
;
MoveInfo
.
OneWaitCanEndStep
=
true
;
MoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitFeedScanCode
());
MoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitFeedScanCode
());
MoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitTime
(
6
000
));
MoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitTime
(
7
000
));
try
try
{
{
Task
<
List
<
string
>>
scanTask
=
Task
.
Factory
.
StartNew
(
delegate
Task
<
List
<
string
>>
scanTask
=
Task
.
Factory
.
StartNew
(
delegate
{
{
LastCodeList
=
CodeManager
.
CameraScan
(
Config
.
GetCameraList
(),
Name
);
LastCodeList
=
CodeManager
.
CameraScan
(
Config
.
GetCameraList
(),
Name
);
bool
hasRightCode
=
CodeManager
.
HasRightCode
(
LastCodeList
.
ToArray
()
);
if
(
LastCodeList
.
Count
<=
0
)
if
(
!
hasRightCode
)
{
{
LastCodeList
=
CodeManager
.
CameraScan
(
Config
.
GetCameraList
(),
Name
);
LastCodeList
=
CodeManager
.
CameraScan
(
Config
.
GetCameraList
(),
Name
,
false
,
3000
);
}
}
return
LastCodeList
;
return
LastCodeList
;
});
});
...
...
source/DeviceLibrary/deviceLibrary/halcon/CodeManager.cs
查看文件 @
0a2f94e
...
@@ -98,7 +98,7 @@ namespace OnlineStore.DeviceLibrary
...
@@ -98,7 +98,7 @@ namespace OnlineStore.DeviceLibrary
private
static
int
ScanCount
=
0
;
private
static
int
ScanCount
=
0
;
private
static
int
codeCount
=
ConfigAppSettings
.
GetIntValue
(
Setting_Init
.
CodeCount
);
private
static
int
codeCount
=
ConfigAppSettings
.
GetIntValue
(
Setting_Init
.
CodeCount
);
[
HandleProcessCorruptedStateExceptions
]
[
HandleProcessCorruptedStateExceptions
]
public
static
List
<
string
>
CameraScan
(
List
<
string
>
cameraList
,
string
deviceName
,
bool
findRightCodeBreak
=
false
)
public
static
List
<
string
>
CameraScan
(
List
<
string
>
cameraList
,
string
deviceName
,
bool
findRightCodeBreak
=
false
,
int
timeOut
=
2000
)
{
{
List
<
string
>
codeList
=
new
List
<
string
>();
List
<
string
>
codeList
=
new
List
<
string
>();
if
(
cameraList
==
null
||
cameraList
.
Count
<=
0
)
if
(
cameraList
==
null
||
cameraList
.
Count
<=
0
)
...
@@ -143,7 +143,7 @@ namespace OnlineStore.DeviceLibrary
...
@@ -143,7 +143,7 @@ namespace OnlineStore.DeviceLibrary
}
}
else
else
{
{
cc
=
HDCodeHelper
.
DecodeCode
(
ho_Image
,
code
Count
,
GetCodeParamFilePath
(
codeType
),
codeType
);
cc
=
HDCodeHelper
.
DecodeCode
(
ho_Image
,
code
Type
,
GetCodeParamFilePath
(
codeType
),
codeCount
,
timeOut
);
}
}
foreach
(
CodeInfo
c
in
cc
)
foreach
(
CodeInfo
c
in
cc
)
{
{
...
@@ -154,7 +154,7 @@ namespace OnlineStore.DeviceLibrary
...
@@ -154,7 +154,7 @@ namespace OnlineStore.DeviceLibrary
r
=
r
+
"##"
+
str
;
r
=
r
+
"##"
+
str
;
if
(!
findRightCode
)
if
(!
findRightCode
)
{
{
findRightCode
=
I
sRightCode
(
str
);
findRightCode
=
Ha
sRightCode
(
str
);
}
}
}
}
}
}
...
@@ -226,7 +226,7 @@ namespace OnlineStore.DeviceLibrary
...
@@ -226,7 +226,7 @@ namespace OnlineStore.DeviceLibrary
}
}
private
static
void
SaveImageToFile
(
string
deviceName
,
string
cameraName
,
Bitmap
bitmap
)
private
static
void
SaveImageToFile
(
string
deviceName
,
string
cameraName
,
Bitmap
bitmap
)
{
{
string
date
=
DateTime
.
Now
.
ToString
(
"HH-mm-ss-"
)
+
DateTime
.
Now
.
Millisecond
;
string
date
=
deviceName
.
Trim
().
Replace
(
'_'
,
'-'
)
+
"-"
+
DateTime
.
Now
.
ToString
(
"HH-mm-ss-"
)
+
DateTime
.
Now
.
Millisecond
;
string
dire
=
@"D:\image\" + deviceName.Trim().Replace('_', '-') + @"
\
" + cameraName.Trim().Replace('_', '-').Replace(':', '-') + @"
\
";
string
dire
=
@"D:\image\" + deviceName.Trim().Replace('_', '-') + @"
\
" + cameraName.Trim().Replace('_', '-').Replace(':', '-') + @"
\
";
string
iamgeName
=
date
+
".bmp"
;
string
iamgeName
=
date
+
".bmp"
;
try
try
...
@@ -245,25 +245,28 @@ namespace OnlineStore.DeviceLibrary
...
@@ -245,25 +245,28 @@ namespace OnlineStore.DeviceLibrary
}
}
}
}
p
rivate
static
bool
IsRightCode
(
string
code
)
p
ublic
static
bool
HasRightCode
(
params
string
[]
codes
)
{
{
//分号分割后长度=4,L,E,B,R
//分号分割后长度=4,L,E,B,R
try
try
{
{
string
[]
strarray
=
code
.
Split
(
';'
);
foreach
(
string
code
in
codes
)
if
(
strarray
.
Length
==
4
)
{
{
string
[]
strarray
=
code
.
Split
(
';'
);
if
(
strarray
[
0
].
StartsWith
(
"L"
)
&&
if
(
strarray
.
Length
==
4
)
strarray
[
1
].
StartsWith
(
"E"
)
&&
strarray
[
2
].
StartsWith
(
"B"
)
&&
strarray
[
3
].
StartsWith
(
"R"
))
{
{
return
true
;
if
(
strarray
[
0
].
StartsWith
(
"L"
)
&&
}
strarray
[
1
].
StartsWith
(
"E"
)
&&
strarray
[
2
].
StartsWith
(
"B"
)
&&
strarray
[
3
].
StartsWith
(
"R"
))
{
return
true
;
}
}
}
}
}
}
catch
(
Exception
ex
)
catch
(
Exception
ex
)
{
{
}
}
return
false
;
return
false
;
}
}
...
...
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论