Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
张东亮
/
NS100
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit eb5f893d
由
张东亮
编写于
2023-08-28 10:30:56 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
打开图片前先选择模板
1 个父辈
7eb17a14
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
10 行增加
和
9 行删除
SmartScan/SetControl/UsrMaterialTemplate.cs
SmartScan/SetControl/UsrMaterialTemplate.cs
查看文件 @
eb5f893
...
@@ -232,6 +232,7 @@ namespace SmartScan
...
@@ -232,6 +232,7 @@ namespace SmartScan
private
void
BtnLocalImage_Click
(
object
sender
,
EventArgs
e
)
private
void
BtnLocalImage_Click
(
object
sender
,
EventArgs
e
)
{
{
if
(
mateIndex
<
0
)
return
;
using
OpenFileDialog
dlg
=
new
()
{
Filter
=
"Image Files|*.jpg;*.jpeg;*.png;*.bmp;*.gif|All Files|*.*"
};
using
OpenFileDialog
dlg
=
new
()
{
Filter
=
"Image Files|*.jpg;*.jpeg;*.png;*.bmp;*.gif|All Files|*.*"
};
if
(
dlg
.
ShowDialog
()
!=
DialogResult
.
OK
)
return
;
if
(
dlg
.
ShowDialog
()
!=
DialogResult
.
OK
)
return
;
...
@@ -473,7 +474,7 @@ namespace SmartScan
...
@@ -473,7 +474,7 @@ namespace SmartScan
var
curMatch
=
mateCopy
[
mateIndex
];
var
curMatch
=
mateCopy
[
mateIndex
];
List
<
BarcodeInfo
>
code
=
new
List
<
BarcodeInfo
>();
List
<
BarcodeInfo
>
code
=
new
List
<
BarcodeInfo
>();
curMatch
.
Code
.
ForEach
(
s
=>
{
code
.
Add
(
new
BarcodeInfo
()
{
Text
=
s
.
Text
,
CodeType
=
s
.
CodeType
});
});
curMatch
.
Code
.
ForEach
(
s
=>
{
code
.
Add
(
new
BarcodeInfo
()
{
Text
=
s
.
Text
,
CodeType
=
s
.
CodeType
});
});
ismatch
=
TemplateExtract
(
curMatch
,
code
,
out
Dictionary
<
string
,
string
>
keyword
,
out
List
<
string
>
allkeys
);
ismatch
=
TemplateExtract
(
curMatch
,
code
,
out
Dictionary
<
string
,
string
>
keyword
,
out
List
<
string
>
allkeys
);
var
codeMatch
=
curMatch
.
Match
.
FindAll
(
s
=>
!
string
.
IsNullOrEmpty
(
s
.
Keyword
));
var
codeMatch
=
curMatch
.
Match
.
FindAll
(
s
=>
!
string
.
IsNullOrEmpty
(
s
.
Keyword
));
if
(
codeMatch
!=
null
)
if
(
codeMatch
!=
null
)
{
{
...
@@ -482,8 +483,8 @@ namespace SmartScan
...
@@ -482,8 +483,8 @@ namespace SmartScan
StringBuilder
sb
=
new
StringBuilder
();
StringBuilder
sb
=
new
StringBuilder
();
foreach
(
var
key
in
keyword
.
Keys
)
foreach
(
var
key
in
keyword
.
Keys
)
{
{
var
dul
=
allkeys
.
FindAll
(
s
=>
s
.
Equals
(
key
));
var
dul
=
allkeys
.
FindAll
(
s
=>
s
.
Equals
(
key
));
if
(
dul
!=
null
&&
dul
.
Count
>
1
)
if
(
dul
!=
null
&&
dul
.
Count
>
1
)
{
{
sb
.
AppendLine
(
key
);
sb
.
AppendLine
(
key
);
}
}
...
@@ -511,7 +512,7 @@ namespace SmartScan
...
@@ -511,7 +512,7 @@ namespace SmartScan
}
}
if
(!
ismatch
)
if
(!
ismatch
)
{
{
if
(
codeMatch
.
Count
==
0
)
if
(
codeMatch
.
Count
==
0
)
{
{
string
text
=
Language
.
Dialog
(
LanguageDialogKey
.
TEMPLATE_UN_SET_MATCHING
,
"[name] 模板不匹配,未设置匹配规则"
);
string
text
=
Language
.
Dialog
(
LanguageDialogKey
.
TEMPLATE_UN_SET_MATCHING
,
"[name] 模板不匹配,未设置匹配规则"
);
text
=
text
.
Replace
(
"[name]"
,
curMatch
.
Name
);
text
=
text
.
Replace
(
"[name]"
,
curMatch
.
Name
);
...
@@ -537,17 +538,17 @@ namespace SmartScan
...
@@ -537,17 +538,17 @@ namespace SmartScan
StringBuilder
sb
=
new
StringBuilder
();
StringBuilder
sb
=
new
StringBuilder
();
for
(
int
i
=
0
;
i
<
mateCopy
.
Count
;
i
++)
for
(
int
i
=
0
;
i
<
mateCopy
.
Count
;
i
++)
{
{
if
(
mateIndex
==
i
)
continue
;
if
(
mateIndex
==
i
)
continue
;
var
othMatch
=
mateCopy
[
i
];
var
othMatch
=
mateCopy
[
i
];
bool
ismatch
=
TemplateExtract
(
othMatch
,
code
,
out
Dictionary
<
string
,
string
>
keyword
,
out
List
<
string
>
allkeys
);
bool
ismatch
=
TemplateExtract
(
othMatch
,
code
,
out
Dictionary
<
string
,
string
>
keyword
,
out
List
<
string
>
allkeys
);
if
(
ismatch
)
if
(
ismatch
)
{
{
sb
.
AppendLine
(
othMatch
.
Name
);
sb
.
AppendLine
(
othMatch
.
Name
);
LogNet
.
log
.
Info
(
$
"【{othMatch.Name}】模板与当前模板【{curMatch.Name}】匹配冲突"
);
LogNet
.
log
.
Info
(
$
"【{othMatch.Name}】模板与当前模板【{curMatch.Name}】匹配冲突"
);
}
}
}
}
string
templates
=
sb
.
ToString
();
string
templates
=
sb
.
ToString
();
if
(
templates
.
Length
>
0
)
if
(
templates
.
Length
>
0
)
{
{
string
text
=
Language
.
Dialog
(
LanguageDialogKey
.
TEMPLATE_MATCHING_CONFLICT
,
"[name] 与以下的模板匹配冲突"
);
string
text
=
Language
.
Dialog
(
LanguageDialogKey
.
TEMPLATE_MATCHING_CONFLICT
,
"[name] 与以下的模板匹配冲突"
);
text
=
text
.
Replace
(
"[name]"
,
curMatch
.
Name
);
text
=
text
.
Replace
(
"[name]"
,
curMatch
.
Name
);
...
@@ -560,7 +561,7 @@ namespace SmartScan
...
@@ -560,7 +561,7 @@ namespace SmartScan
}
}
return
true
;
return
true
;
}
}
private
bool
TemplateExtract
(
MaterialTemplate
materialTemplate
,
List
<
BarcodeInfo
>
code
,
out
Dictionary
<
string
,
string
>
keyword
,
out
List
<
string
>
allKeywords
)
private
bool
TemplateExtract
(
MaterialTemplate
materialTemplate
,
List
<
BarcodeInfo
>
code
,
out
Dictionary
<
string
,
string
>
keyword
,
out
List
<
string
>
allKeywords
)
{
{
keyword
=
new
(
StringComparer
.
OrdinalIgnoreCase
);
keyword
=
new
(
StringComparer
.
OrdinalIgnoreCase
);
allKeywords
=
new
List
<
string
>();
allKeywords
=
new
List
<
string
>();
...
...
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论