Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
孙克
/
ACSingleStore
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit 43eeaace
由
几米阳光
编写于
2019-04-10 11:18:37 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
增加调试屏蔽功能
1 个父辈
d404a67a
全部展开
隐藏空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
79 行增加
和
38 行删除
source/ACSingleStore/FrmStoreBox.Designer.cs
source/ACSingleStore/FrmStoreBox.cs
source/ACSingleStore/记录.txt
source/DeviceLibrary/halcon/CodeManager.cs
source/ACSingleStore/FrmStoreBox.Designer.cs
查看文件 @
43eeaac
此文件的差异被折叠,
点击展开。
source/ACSingleStore/FrmStoreBox.cs
查看文件 @
43eeaac
...
...
@@ -1472,5 +1472,30 @@ namespace OnlineStore.ACSingleStore
store
.
KNDIOMove
(
IO_Type
.
Door_Up
,
IO_VALUE
.
LOW
);
store
.
KNDIOMove
(
IO_Type
.
Door_Down
,
IO_VALUE
.
HIGH
);
}
private
void
DebugStatus
(
bool
status
)
{
if
(
status
)
{
btnDebug
.
Text
=
"禁用调试"
;
}
else
{
btnDebug
.
Text
=
"启用调试"
;
}
groupAxis
.
Enabled
=
status
;
groupComAxis
.
Enabled
=
status
;
groupInout
.
Enabled
=
status
;
}
private
void
btnDebug_Click
(
object
sender
,
EventArgs
e
)
{
if
(
btnDebug
.
Text
.
Equals
(
"启用调试"
))
{
DebugStatus
(
true
);
}
else
{
DebugStatus
(
false
);
}
}
}
}
source/ACSingleStore/记录.txt
查看文件 @
43eeaac
...
...
@@ -66,7 +66,8 @@ statusBean.addServerData("needInAfterOut",needInAfterOut);
为true时,盘点出库后需要接着扫码入库
2.Data中增加数据:"inTimeout","alarm" 盘点入库超时报警
20190319
增加调试屏蔽的功能。
...
...
source/DeviceLibrary/halcon/CodeManager.cs
查看文件 @
43eeaac
...
...
@@ -12,9 +12,9 @@ using System.Windows.Forms;
namespace
OnlineStore.DeviceLibrary
{
public
class
CodeManager
public
class
CodeManager
{
public
static
List
<
string
>
cameraNameList
=
new
List
<
string
>();
public
static
List
<
string
>
codeTypeList
=
new
List
<
string
>();
...
...
@@ -31,9 +31,8 @@ namespace OnlineStore.DeviceLibrary
{
cameraNameList
=
new
List
<
string
>();
codeTypeList
=
new
List
<
string
>();
HDLogUtil
.
LogName
=
"RollingLogFileAppender"
;
try
{
{
string
[]
nameArray
=
nameStr
.
Split
(
spiltChar
);
foreach
(
string
str
in
nameArray
)
{
...
...
@@ -47,30 +46,40 @@ namespace OnlineStore.DeviceLibrary
codeTypeList
.
Add
(
str
.
Trim
());
}
string
[]
names
=
CodeLibrary
.
HIKCamera
.
Instance
.
CameraName
;
hikNameList
.
AddRange
(
names
);
foreach
(
string
str
in
names
)
{
LogUtil
.
info
(
"加载到HIK相机:"
+
str
.
Trim
());
}
names
=
CodeLibrary
.
BaslerCamera
.
Instance
.
CameraName
;
balserNameList
.
AddRange
(
names
);
foreach
(
string
str
in
names
)
{
LogUtil
.
info
(
"加载到Balser相机:"
+
str
.
Trim
());
}
LoadCamera
();
CodeLibrary
.
HDCodeLearnHelper
.
LoadConfig
(
nameStr
,
codeStr
);
}
catch
(
Exception
ex
)
{
LogUtil
.
error
(
"解析摄像机配置出错:"
+
ex
.
ToString
());
}
}
}
private
static
void
LoadCamera
()
{
string
[]
names
=
CodeLibrary
.
HIKCamera
.
Instance
.
CameraName
;
hikNameList
.
AddRange
(
names
);
names
=
CodeLibrary
.
BaslerCamera
.
Instance
.
CameraName
;
balserNameList
.
AddRange
(
names
);
foreach
(
string
name
in
hikNameList
)
{
LogUtil
.
info
(
"加载到HIK相机:"
+
name
);
}
foreach
(
string
name
in
balserNameList
)
{
LogUtil
.
info
(
"加载到Balser相机:"
+
name
);
}
}
public
static
Bitmap
GetCamerImage
(
string
cameraName
)
{
Bitmap
bitm
=
null
;
//若未加载到相机,需要重新加载相机
if
(
balserNameList
.
Count
<=
0
&&
hikNameList
.
Count
<=
0
)
{
LogUtil
.
error
(
"获取图片时发现未加载到相机,重新加载相机"
);
LoadCamera
();
}
if
(
balserNameList
.
Contains
(
cameraName
))
{
BaslerCamera
.
Instance
.
Open
(
cameraName
);
...
...
@@ -78,7 +87,7 @@ namespace OnlineStore.DeviceLibrary
bitm
=
BaslerCamera
.
Instance
.
Image
;
BaslerCamera
.
Instance
.
Close
();
}
else
if
(
hikNameList
.
Contains
(
cameraName
))
else
if
(
hikNameList
.
Contains
(
cameraName
))
{
HIKCamera
.
Instance
.
Open
(
cameraName
);
HIKCamera
.
Instance
.
GrabOne
();
...
...
@@ -87,10 +96,11 @@ namespace OnlineStore.DeviceLibrary
}
else
{
LogUtil
.
info
(
"未找到摄像机【"
+
cameraName
+
"】无法获取图片"
);
LogUtil
.
info
(
"未找到摄像机【"
+
cameraName
+
"】无法获取图片"
);
}
return
bitm
;
}
[
HandleProcessCorruptedStateExceptions
]
public
static
List
<
string
>
CameraScan
()
{
...
...
@@ -101,14 +111,18 @@ namespace OnlineStore.DeviceLibrary
{
foreach
(
string
cameraName
in
cameraNameList
)
{
Bitmap
bitmap
=
GetCamerImage
(
cameraName
);
if
(
bitmap
==
null
)
{
LogUtil
.
info
(
" 摄像机【"
+
cameraName
+
"】获取图片失败"
);
}
else
using
(
Bitmap
bitmap
=
GetCamerImage
(
cameraName
))
{
if
(
bitmap
==
null
)
{
LogUtil
.
info
(
" 摄像机【"
+
cameraName
+
"】获取图片失败"
);
continue
;
}
LogUtil
.
debug
(
" 摄像机【"
+
cameraName
+
"】获取图片完成"
);
System
.
Threading
.
Thread
.
Sleep
(
1
);
HObject
ho_Image
=
HDCodeHelper
.
Bitmap2HObjectBpp24
(
bitmap
);
LogUtil
.
debug
(
" 摄像机【"
+
cameraName
+
"】转换图片完成,开始扫码"
);
List
<
CodeInfo
>
cc
=
new
List
<
CodeInfo
>();
foreach
(
string
codeType
in
codeTypeList
)
{
...
...
@@ -121,10 +135,10 @@ namespace OnlineStore.DeviceLibrary
{
cc
=
HDCodeHelper
.
DecodeCode
(
ho_Image
,
1
,
GetCodeParamFilePath
(
codeType
),
codeType
);
}
//LogUtil.info(" 摄像机【" + cameraName + "】【"+ codeType + "】扫码完成");
allCodeList
.
AddRange
(
cc
);
}
allCodeList
.
AddRange
(
cc
);
}
bitmap
.
Dispose
();
}
}
catch
(
AccessViolationException
e
)
...
...
@@ -142,7 +156,7 @@ namespace OnlineStore.DeviceLibrary
}
return
codeList
;
}
public
static
string
GetCodeParamFilePath
(
string
codePath
)
{
...
...
@@ -158,13 +172,13 @@ namespace OnlineStore.DeviceLibrary
return
""
;
}
}
public
static
string
ProcessBarcode
(
List
<
string
>
codeList
,
int
height
)
public
static
string
ProcessBarcode
(
List
<
string
>
codeList
,
int
height
)
{
// 条码前面字母去掉之后用分号分割,最后不加分号
//P; H; Q
//code = "=1+0x0-7x" + height + "=" + code;
string
split
=
";"
;
string
split
=
";"
;
string
result
=
""
;
try
{
...
...
@@ -183,7 +197,7 @@ namespace OnlineStore.DeviceLibrary
}
else
{
result
=
result
+
split
+
s
;
result
=
result
+
split
+
s
;
}
}
}
...
...
@@ -191,14 +205,15 @@ namespace OnlineStore.DeviceLibrary
{
return
"=1+0x0-13x"
+
height
+
"="
+
result
;
}
}
catch
(
Exception
ex
)
}
catch
(
Exception
ex
)
{
LogUtil
.
error
(
"处理二维码出错:"
+
ex
.
ToString
());
LogUtil
.
error
(
"处理二维码出错:"
+
ex
.
ToString
());
}
return
result
;
}
private
static
string
GetCodeByStart
(
List
<
string
>
codeList
,
string
start
)
private
static
string
GetCodeByStart
(
List
<
string
>
codeList
,
string
start
)
{
List
<
string
>
pCode
=
(
from
m
in
codeList
where
m
.
StartsWith
(
start
)
select
m
).
ToList
<
string
>();
if
(
pCode
.
Count
>
0
)
...
...
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论