Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
张东亮
/
NS100
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit 93e26866
由
张东亮
编写于
2023-04-23 16:15:59 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
重新获取条码时添加提示信息:清除模板
1 个父辈
a291af67
全部展开
显示空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
68 行增加
和
44 行删除
Model/LanguageDialogKey.cs
SharedDll/halcondotnet.dll
SmartScan/SetControl/UsrMaterialTemplate.Designer.cs
SmartScan/SetControl/UsrMaterialTemplate.cs
Model/LanguageDialogKey.cs
查看文件 @
93e2686
...
@@ -16,6 +16,6 @@ namespace Model
...
@@ -16,6 +16,6 @@ namespace Model
public
const
string
MATERIAL_TEMPLATE_DEL
=
"MaterialTemplateDel"
;
public
const
string
MATERIAL_TEMPLATE_DEL
=
"MaterialTemplateDel"
;
public
const
string
MATERIAL_TEMPLATE_RENAME
=
"MaterialTemplateRename"
;
public
const
string
MATERIAL_TEMPLATE_RENAME
=
"MaterialTemplateRename"
;
public
const
string
SAVE_SUCCEED
=
"SaveSucceed"
;
public
const
string
SAVE_SUCCEED
=
"SaveSucceed"
;
public
const
string
REMIND_CLEARTEMPLATE
=
"RemindClearTemplate"
;
}
}
}
}
SharedDll/halcondotnet.dll
0 → 100644
查看文件 @
93e2686
此文件类型无法预览
SmartScan/SetControl/UsrMaterialTemplate.Designer.cs
查看文件 @
93e2686
此文件的差异被折叠,
点击展开。
SmartScan/SetControl/UsrMaterialTemplate.cs
查看文件 @
93e2686
...
@@ -18,7 +18,7 @@ namespace SmartScan
...
@@ -18,7 +18,7 @@ namespace SmartScan
public
UsrMaterialTemplate
()
public
UsrMaterialTemplate
()
{
{
InitializeComponent
();
InitializeComponent
();
BtnOcrCode
.
Enabled
=
Config
.
Func_EnabledOCR
;
//
BtnOcrCode.Enabled = Config.Func_EnabledOCR;
LstMate
.
Items
.
AddRange
(
Common
.
mateEdit
.
Name
);
LstMate
.
Items
.
AddRange
(
Common
.
mateEdit
.
Name
);
mateCopy
=
Common
.
mateEdit
.
ToCopy
();
mateCopy
=
Common
.
mateEdit
.
ToCopy
();
Language
.
SetLanguage
(
this
);
Language
.
SetLanguage
(
this
);
...
@@ -241,7 +241,14 @@ namespace SmartScan
...
@@ -241,7 +241,14 @@ namespace SmartScan
private
void
BtnScanCode_Click
(
object
sender
,
EventArgs
e
)
private
void
BtnScanCode_Click
(
object
sender
,
EventArgs
e
)
{
{
if
(
bmp
==
null
)
return
;
if
(
bmp
==
null
)
return
;
string
text
=
Language
.
Dialog
(
LanguageDialogKey
.
REMIND_CLEARTEMPLATE
,
"Recognizing code will reset the template.Are you sure to perform the action?"
);
DialogResult
dialogResult
=
new
FaceMessageBox
(
mateCopy
[
mateIndex
].
Name
,
text
,
MessageBoxButtons
.
YesNo
).
ShowDialog
();
if
(
dialogResult
==
DialogResult
.
No
)
{
return
;
}
List
<
CameraVisionLib
.
Model
.
BarcodeInfo
>
info
=
Common
.
cameraVision
.
GetBarCode
(
bmp
);
List
<
CameraVisionLib
.
Model
.
BarcodeInfo
>
info
=
Common
.
cameraVision
.
GetBarCode
(
bmp
);
LstCode
.
Items
.
Clear
();
LstCode
.
Items
.
Clear
();
ImgShow
.
CodeCenterClear
();
ImgShow
.
CodeCenterClear
();
...
@@ -252,13 +259,6 @@ namespace SmartScan
...
@@ -252,13 +259,6 @@ namespace SmartScan
mateCopy
[
mateIndex
].
State
=
TemplateState
.
Unsaved
;
mateCopy
[
mateIndex
].
State
=
TemplateState
.
Unsaved
;
Common
.
mateMaxCodeID
=
info
.
Count
;
Common
.
mateMaxCodeID
=
info
.
Count
;
if
(
info
.
Count
==
0
)
{
string
text
=
Language
.
Dialog
(
LanguageDialogKey
.
CODE_COUNT
);
new
FaceMessageBox
(
""
,
text
,
MessageBoxButtons
.
OK
).
ShowDialog
();
return
;
}
PointF
[]
lst
=
new
PointF
[
info
.
Count
];
PointF
[]
lst
=
new
PointF
[
info
.
Count
];
for
(
int
i
=
0
;
i
<
info
.
Count
;
i
++)
for
(
int
i
=
0
;
i
<
info
.
Count
;
i
++)
{
{
...
@@ -279,10 +279,34 @@ namespace SmartScan
...
@@ -279,10 +279,34 @@ namespace SmartScan
mateCopy
[
mateIndex
].
Code
.
Add
(
code
);
mateCopy
[
mateIndex
].
Code
.
Add
(
code
);
lst
[
i
]
=
info
[
i
].
Center
;
lst
[
i
]
=
info
[
i
].
Center
;
}
}
if
(
Config
.
Func_EnabledOCR
)
{
//保存需要识别ocr的区域
bmp
?.
Save
(
@"ocrt.jpg"
,
System
.
Drawing
.
Imaging
.
ImageFormat
.
Jpeg
);
string
[]
regOcrCodes
=
PaddleOCRHelper
.
StartTest
(
"..\\ocrt.jpg"
).
Split
(
';'
);
int
startidx
=
Common
.
mateMaxCodeID
+
1
;
foreach
(
var
ocr
in
regOcrCodes
)
{
if
(
string
.
IsNullOrEmpty
(
ocr
))
continue
;
MaterialCode
code
=
new
()
{
ID
=
startidx
,
Text
=
ocr
,
CodeType
=
Setting_Str
.
OCR
};
mateCopy
[
mateIndex
].
Code
.
Add
(
code
);
startidx
++;
}
}
if
(
mateCopy
[
mateIndex
].
Code
.
Count
==
0
)
{
text
=
Language
.
Dialog
(
LanguageDialogKey
.
CODE_COUNT
);
new
FaceMessageBox
(
""
,
text
,
MessageBoxButtons
.
OK
).
ShowDialog
();
return
;
}
ImgShow
.
AddCodeCenter
(
lst
);
LstCode
.
Items
.
AddRange
(
FormatCode
());
LstCode
.
Items
.
AddRange
(
FormatCode
());
LstCode
.
SelectedIndex
=
codeIndex
=
-
1
;
LstCode
.
SelectedIndex
=
codeIndex
=
-
1
;
ImgShow
.
AddCodeCenter
(
lst
);
}
}
private
void
BtnExtractCode_Click
(
object
sender
,
EventArgs
e
)
private
void
BtnExtractCode_Click
(
object
sender
,
EventArgs
e
)
...
@@ -308,40 +332,40 @@ namespace SmartScan
...
@@ -308,40 +332,40 @@ namespace SmartScan
private
void
BtnOcrCode_Click
(
object
sender
,
EventArgs
e
)
private
void
BtnOcrCode_Click
(
object
sender
,
EventArgs
e
)
{
{
if
(
bmp
==
null
)
return
;
if
(
bmp
==
null
)
return
;
//保存需要识别ocr的区域
//
//
保存需要识别ocr的区域
bmp
?.
Save
(
@"ocrt.jpg"
,
System
.
Drawing
.
Imaging
.
ImageFormat
.
Jpeg
);
//
bmp?.Save(@"ocrt.jpg", System.Drawing.Imaging.ImageFormat.Jpeg);
string
[]
regOcrCodes
=
PaddleOCRHelper
.
StartTest
(
"..\\ocrt.jpg"
).
Split
(
';'
);
//
string[] regOcrCodes = PaddleOCRHelper.StartTest("..\\ocrt.jpg").Split(';');
LstCode
.
Items
.
Clear
();
//
LstCode.Items.Clear();
var
ocrs
=
mateCopy
[
mateIndex
].
Code
.
FindAll
(
s
=>
s
.
CodeType
.
Equals
(
Setting_Str
.
OCR
));
//
var ocrs = mateCopy[mateIndex].Code.FindAll(s => s.CodeType.Equals(Setting_Str.OCR));
foreach
(
var
code
in
ocrs
)
//
foreach (var code in ocrs)
{
//
{
mateCopy
[
mateIndex
].
Code
.
Remove
(
code
);
//
mateCopy[mateIndex].Code.Remove(code);
}
//
}
mateCopy
[
mateIndex
].
Match
.
Clear
();
//
mateCopy[mateIndex].Match.Clear();
mateCopy
[
mateIndex
].
Ocr
.
Clear
();
//
mateCopy[mateIndex].Ocr.Clear();
if
(
regOcrCodes
.
Length
==
0
)
//
if (regOcrCodes.Length == 0)
{
//
{
string
text
=
Language
.
Dialog
(
LanguageDialogKey
.
CODE_COUNT
);
//
string text = Language.Dialog(LanguageDialogKey.CODE_COUNT);
new
FaceMessageBox
(
""
,
text
,
MessageBoxButtons
.
OK
).
ShowDialog
();
//
new FaceMessageBox("", text, MessageBoxButtons.OK).ShowDialog();
return
;
//
return;
}
//
}
mateCopy
[
mateIndex
].
State
=
TemplateState
.
Unsaved
;
//
mateCopy[mateIndex].State = TemplateState.Unsaved;
int
startidx
=
Common
.
mateMaxCodeID
+
1
;
//
int startidx = Common.mateMaxCodeID + 1;
foreach
(
var
ocr
in
regOcrCodes
)
//
foreach (var ocr in regOcrCodes)
{
//
{
if
(
string
.
IsNullOrEmpty
(
ocr
))
continue
;
//
if (string.IsNullOrEmpty(ocr)) continue;
MaterialCode
code
=
new
()
//
MaterialCode code = new()
{
//
{
ID
=
startidx
,
//
ID = startidx,
Text
=
ocr
,
//
Text = ocr,
CodeType
=
Setting_Str
.
OCR
//
CodeType = Setting_Str.OCR
};
//
};
mateCopy
[
mateIndex
].
Code
.
Add
(
code
);
//
mateCopy[mateIndex].Code.Add(code);
startidx
++;
//
startidx++;
}
//
}
LstCode
.
Items
.
AddRange
(
FormatCode
());
//
LstCode.Items.AddRange(FormatCode());
LstCode
.
SelectedIndex
=
codeIndex
=
-
1
;
//
LstCode.SelectedIndex = codeIndex = -1;
//if (codeIndex == -1) return;
//if (codeIndex == -1) return;
//var m = mateCopy[mateIndex].Match.Find(m=>m.CodeID==codeIndex);
//var m = mateCopy[mateIndex].Match.Find(m=>m.CodeID==codeIndex);
...
...
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论