Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
张东亮
/
NS100
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit 505fe44b
由
刘韬
编写于
2025-08-06 14:57:37 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
修正不显示匹配成功模板名称的问题
1 个父辈
1a150e20
显示空白字符变更
内嵌
并排
正在显示
15 个修改的文件
包含
86 行增加
和
47 行删除
BLL/Extension.cs
BLL/Extension/Item_Alcoelectro.cs
BLL/Extension/Item_General.cs
BLL/Extension/Item_Inventec.cs
BLL/Extension/Item_KaiFa.cs
BLL/Extension/Item_NanRui.cs
BLL/Extension/Item_PanaCIM.cs
Model/IExtension.cs
SmartScan/Form/FrmMain.cs
SmartScan/ScanWork.cs
SmartScan/SetControl/UsrDataSource.cs
SmartScan/SetControl/WPF/NS_KetRight.xaml.cs
SmartScan/SetControl/WPF/UserControl1.xaml
SmartScan/SetControl/WPF/WPF_CodeExtract.xaml.cs
SmartScan/WebCallWork.cs
BLL/Extension.cs
查看文件 @
505fe44
...
@@ -20,8 +20,9 @@ namespace BLL
...
@@ -20,8 +20,9 @@ namespace BLL
{
{
public
class
Extension
:
IDisposable
public
class
Extension
:
IDisposable
{
{
public
delegate
void
KeySet
(
string
[]
originalCode
,
Dictionary
<
string
,
string
>
key
,
bool
hasMatch
);
public
delegate
void
KeySet
(
string
templateName
,
string
[]
originalCode
,
Dictionary
<
string
,
string
>
key
,
bool
hasMatch
);
public
event
KeySet
KeySets
;
public
event
KeySet
KeySets
;
public
event
Func
<
Dictionary
<
string
,
string
>>
GetUIKeyWords
;
public
delegate
void
Check1
(
string
text
);
public
delegate
void
Check1
(
string
text
);
public
event
Check1
Checks
;
public
event
Check1
Checks
;
public
event
IExtension
.
PrintDelegate
Printing
;
public
event
IExtension
.
PrintDelegate
Printing
;
...
@@ -106,9 +107,9 @@ namespace BLL
...
@@ -106,9 +107,9 @@ namespace BLL
currentExtension
.
Dispose
();
currentExtension
.
Dispose
();
}
}
public
string
labelText
=
"等待中"
;
public
string
labelText
=
"等待中"
;
public
void
set
(
string
[]
originalCode
,
Dictionary
<
string
,
string
>
key
,
bool
hasMatch
)
public
void
set
(
string
templateName
,
string
[]
originalCode
,
Dictionary
<
string
,
string
>
key
,
bool
hasMatch
)
{
{
KeySets
?.
Invoke
(
originalCode
,
key
,
hasMatch
);
KeySets
?.
Invoke
(
templateName
,
originalCode
,
key
,
hasMatch
);
}
}
public
void
Check
(
string
text
)
public
void
Check
(
string
text
)
{
{
...
@@ -646,9 +647,9 @@ namespace BLL
...
@@ -646,9 +647,9 @@ namespace BLL
General
.
CheckClear
();
General
.
CheckClear
();
}
}
public
bool
SetKey
(
string
[]
originalCode
,
Dictionary
<
string
,
string
>
key
,
bool
hasMatch
,
out
string
errmsg
)
public
bool
SetKey
(
string
templateName
,
string
[]
originalCode
,
Dictionary
<
string
,
string
>
key
,
bool
hasMatch
,
out
string
errmsg
)
{
{
return
currentExtension
.
SetKey
(
originalCode
,
key
,
hasMatch
,
out
errmsg
);
return
currentExtension
.
SetKey
(
templateName
,
originalCode
,
key
,
hasMatch
,
out
errmsg
);
}
}
public
void
Print
(
bool
hasMatch
,
Dictionary
<
string
,
string
>
key
)
public
void
Print
(
bool
hasMatch
,
Dictionary
<
string
,
string
>
key
)
{
{
...
@@ -797,7 +798,9 @@ namespace BLL
...
@@ -797,7 +798,9 @@ namespace BLL
System
.
Windows
.
Forms
.
HorizontalAlignment
alignment
=
(
System
.
Windows
.
Forms
.
HorizontalAlignment
)
Enum
.
Parse
(
typeof
(
System
.
Windows
.
Forms
.
HorizontalAlignment
),
obj
.
ToString
());
System
.
Windows
.
Forms
.
HorizontalAlignment
alignment
=
(
System
.
Windows
.
Forms
.
HorizontalAlignment
)
Enum
.
Parse
(
typeof
(
System
.
Windows
.
Forms
.
HorizontalAlignment
),
obj
.
ToString
());
info
.
SetValue
(
ctl
,
alignment
);
info
.
SetValue
(
ctl
,
alignment
);
}
}
public
Dictionary
<
string
,
string
>
GetUIKeywords
()
{
return
GetUIKeyWords
?.
Invoke
();
}
}
}
}
}
BLL/Extension/Item_Alcoelectro.cs
查看文件 @
505fe44
...
@@ -73,7 +73,7 @@ namespace BLL
...
@@ -73,7 +73,7 @@ namespace BLL
Update
();
Update
();
}
}
public
bool
SetKey
(
string
[]
originalCode
,
Dictionary
<
string
,
string
>
key
,
bool
hasMatch
,
out
string
errmsg
)
public
bool
SetKey
(
string
templateName
,
string
[]
originalCode
,
Dictionary
<
string
,
string
>
key
,
bool
hasMatch
,
out
string
errmsg
)
{
{
errmsg
=
""
;
errmsg
=
""
;
LogNet
.
log
.
Info
(
"SetKey()"
);
LogNet
.
log
.
Info
(
"SetKey()"
);
...
...
BLL/Extension/Item_General.cs
查看文件 @
505fe44
using
Asa.FaceControl
;
using
Asa.FaceControl
;
using
DocumentFormat.OpenXml.Drawing.Charts
;
using
Model
;
using
Model
;
using
Newtonsoft.Json
;
using
Newtonsoft.Json
;
using
System
;
using
System
;
...
@@ -7,6 +8,7 @@ using System.IO;
...
@@ -7,6 +8,7 @@ using System.IO;
using
System.Linq
;
using
System.Linq
;
using
System.Web.Script.Serialization
;
using
System.Web.Script.Serialization
;
using
System.Windows.Forms
;
using
System.Windows.Forms
;
using
System.Windows.Threading
;
using
static
BLL
.
BLLCommon
;
using
static
BLL
.
BLLCommon
;
using
static
BLL
.
Replacekeywords
;
using
static
BLL
.
Replacekeywords
;
using
Http
=
Model
.
Http
;
using
Http
=
Model
.
Http
;
...
@@ -96,9 +98,12 @@ namespace BLL
...
@@ -96,9 +98,12 @@ namespace BLL
// 定义事件
// 定义事件
protected
virtual
void
OnKeySet
(
string
[]
originalCode
,
Dictionary
<
string
,
string
>
key
,
bool
hasMatch
)
protected
virtual
void
OnKeySet
(
string
templateName
,
string
[]
originalCode
,
Dictionary
<
string
,
string
>
key
,
bool
hasMatch
)
{
{
extension
.
set
(
originalCode
,
key
,
hasMatch
);
extension
.
set
(
templateName
,
originalCode
,
key
,
hasMatch
);
}
public
Dictionary
<
string
,
string
>
GetUIKeywords
()
{
return
extension
.
GetUIKeywords
();
}
}
protected
virtual
void
CheckText
(
string
text
)
protected
virtual
void
CheckText
(
string
text
)
{
{
...
@@ -127,7 +132,7 @@ namespace BLL
...
@@ -127,7 +132,7 @@ namespace BLL
//读码后第一步
//读码后第一步
//
//
public
bool
SetKey
(
string
[]
originalCode
,
Dictionary
<
string
,
string
>
key
,
bool
hasMatch
,
out
string
errmsg
)
public
bool
SetKey
(
string
templateName
,
string
[]
originalCode
,
Dictionary
<
string
,
string
>
key
,
bool
hasMatch
,
out
string
errmsg
)
{
{
errmsg
=
""
;
errmsg
=
""
;
mesResult
=
false
;
mesResult
=
false
;
...
@@ -240,6 +245,7 @@ namespace BLL
...
@@ -240,6 +245,7 @@ namespace BLL
var
extraData
=
ExtraFileData
.
AllData
[
CleanData
];
var
extraData
=
ExtraFileData
.
AllData
[
CleanData
];
foreach
(
var
d
in
extraData
)
foreach
(
var
d
in
extraData
)
{
{
if
(!
string
.
IsNullOrEmpty
(
d
.
Value
))
key
[
d
.
Key
]
=
d
.
Value
;
key
[
d
.
Key
]
=
d
.
Value
;
}
}
}
}
...
@@ -322,7 +328,8 @@ namespace BLL
...
@@ -322,7 +328,8 @@ namespace BLL
}
}
LogNet
.
log
.
Info
(
$
"OnKeySet1"
);
OnKeySet
(
templateName
,
originalCode
,
key
,
hasMatch
);
// 添加或替换自增ID
// 添加或替换自增ID
string
reelIdKeyWord
=
config
.
ReelIDKeyWord
;
string
reelIdKeyWord
=
config
.
ReelIDKeyWord
;
if
(!
string
.
IsNullOrEmpty
(
config
.
ReelIDKeyWord
)
&&
isdisplay
)
if
(!
string
.
IsNullOrEmpty
(
config
.
ReelIDKeyWord
)
&&
isdisplay
)
...
@@ -341,9 +348,8 @@ namespace BLL
...
@@ -341,9 +348,8 @@ namespace BLL
// 如果有字段更新,则再次调用OnKeySet更新WPF界面
// 如果有字段更新,则再次调用OnKeySet更新WPF界面
LogNet
.
log
.
Info
(
$
"OnKeySet"
);
LogNet
.
log
.
Info
(
$
"OnKeySet2"
);
OnKeySet
(
originalCode
,
key
,
hasMatch
);
OnKeySet
(
templateName
,
originalCode
,
key
,
hasMatch
);
if
(
lastKeys
==
null
&&
!
islast
&&
BLLCommon
.
config
.
CheckFunction
)
if
(
lastKeys
==
null
&&
!
islast
&&
BLLCommon
.
config
.
CheckFunction
)
{
{
...
@@ -424,6 +430,21 @@ namespace BLL
...
@@ -424,6 +430,21 @@ namespace BLL
return
true
;
return
true
;
}
}
public
static
void
DoEvents
()
{
var
frame
=
new
DispatcherFrame
();
Dispatcher
.
CurrentDispatcher
.
BeginInvoke
(
DispatcherPriority
.
Background
,
new
DispatcherOperationCallback
(
ExitFrame
),
frame
);
Dispatcher
.
PushFrame
(
frame
);
}
private
static
object
ExitFrame
(
object
frame
)
{
((
DispatcherFrame
)
frame
).
Continue
=
false
;
return
null
;
}
bool
updatereelid
(
Dictionary
<
string
,
string
>
key
,
out
string
errmsg
)
bool
updatereelid
(
Dictionary
<
string
,
string
>
key
,
out
string
errmsg
)
{
{
errmsg
=
""
;
errmsg
=
""
;
...
@@ -532,14 +553,17 @@ namespace BLL
...
@@ -532,14 +553,17 @@ namespace BLL
// 对于字符类型,直接保留不替换
// 对于字符类型,直接保留不替换
continue
;
continue
;
}
}
var
uikey
=
GetUIKeywords
();
if
(
uikey
.
ContainsKey
(
key
))
processedPattern
=
processedPattern
.
Replace
(
keyPlaceholder
,
uikey
[
key
]);
// 3. 处理普通关键字(从UI控件获取值)
//
//
3. 处理普通关键字(从UI控件获取值)
if
(
extensions
!=
null
)
//
if (extensions != null)
{
//
{
int
index
=
extensions
.
FindIndex
(
match
=>
match
.
Key
==
key
);
//
int index = extensions.FindIndex(match => match.Key == key);
if
(
index
==
-
1
)
continue
;
//
if (index == -1) continue;
processedPattern
=
processedPattern
.
Replace
(
keyPlaceholder
,
extensions
[
index
].
Control
.
Text
);
//
processedPattern = processedPattern.Replace(keyPlaceholder, extensions[index].Control.Text);
}
//
}
}
}
string
finalText
=
processedPattern
;
string
finalText
=
processedPattern
;
...
@@ -878,7 +902,7 @@ namespace BLL
...
@@ -878,7 +902,7 @@ namespace BLL
}
}
}
}
if
(!
string
.
IsNullOrEmpty
(
key
[
"ReelID"
]))
if
(
key
.
ContainsKey
(
"ReelID"
)
&&
!
string
.
IsNullOrEmpty
(
key
[
"ReelID"
]))
{
{
return
true
;
return
true
;
}
}
...
...
BLL/Extension/Item_Inventec.cs
查看文件 @
505fe44
...
@@ -63,7 +63,7 @@ namespace BLL
...
@@ -63,7 +63,7 @@ namespace BLL
}
}
}
}
public
bool
SetKey
(
string
[]
originalCode
,
Dictionary
<
string
,
string
>
key
,
bool
hasMatch
,
out
string
errmsg
)
public
bool
SetKey
(
string
templateName
,
string
[]
originalCode
,
Dictionary
<
string
,
string
>
key
,
bool
hasMatch
,
out
string
errmsg
)
{
{
errmsg
=
""
;
errmsg
=
""
;
for
(
int
i
=
0
;
i
<
extensions
.
Count
;
i
++)
for
(
int
i
=
0
;
i
<
extensions
.
Count
;
i
++)
...
...
BLL/Extension/Item_KaiFa.cs
查看文件 @
505fe44
...
@@ -52,7 +52,7 @@ namespace BLL
...
@@ -52,7 +52,7 @@ namespace BLL
}
}
static
bool
mesResult
=
false
;
static
bool
mesResult
=
false
;
public
bool
SetKey
(
string
[]
originalCode
,
Dictionary
<
string
,
string
>
key
,
bool
hasMatch
,
out
string
errmsg
)
public
bool
SetKey
(
string
templateName
,
string
[]
originalCode
,
Dictionary
<
string
,
string
>
key
,
bool
hasMatch
,
out
string
errmsg
)
{
{
errmsg
=
""
;
errmsg
=
""
;
mesResult
=
false
;
mesResult
=
false
;
...
...
BLL/Extension/Item_NanRui.cs
查看文件 @
505fe44
...
@@ -45,7 +45,7 @@ namespace BLL
...
@@ -45,7 +45,7 @@ namespace BLL
//mesConn = Http.Ping(mesIP);
//mesConn = Http.Ping(mesIP);
}
}
public
bool
SetKey
(
string
[]
originalCode
,
Dictionary
<
string
,
string
>
key
,
bool
hasMatch
,
out
string
errmsg
)
public
bool
SetKey
(
string
templateName
,
string
[]
originalCode
,
Dictionary
<
string
,
string
>
key
,
bool
hasMatch
,
out
string
errmsg
)
{
{
errmsg
=
""
;
errmsg
=
""
;
return
true
;
return
true
;
...
...
BLL/Extension/Item_PanaCIM.cs
查看文件 @
505fe44
...
@@ -78,7 +78,7 @@ namespace BLL
...
@@ -78,7 +78,7 @@ namespace BLL
}
}
}
}
public
bool
SetKey
(
string
[]
originalCode
,
Dictionary
<
string
,
string
>
key
,
bool
hasMatch
,
out
string
errmsg
)
public
bool
SetKey
(
string
templateName
,
string
[]
originalCode
,
Dictionary
<
string
,
string
>
key
,
bool
hasMatch
,
out
string
errmsg
)
{
{
errmsg
=
""
;
errmsg
=
""
;
for
(
int
i
=
0
;
i
<
extensions
.
Count
;
i
++)
for
(
int
i
=
0
;
i
<
extensions
.
Count
;
i
++)
...
...
Model/IExtension.cs
查看文件 @
505fe44
...
@@ -15,7 +15,7 @@ namespace Model
...
@@ -15,7 +15,7 @@ namespace Model
public
void
Load
(
List
<
ExtensionControl
>
extensions
);
public
void
Load
(
List
<
ExtensionControl
>
extensions
);
public
bool
SetKey
(
string
[]
originalCode
,
Dictionary
<
string
,
string
>
key
,
bool
hasMatch
,
out
string
errmsg
);
public
bool
SetKey
(
string
templateName
,
string
[]
originalCode
,
Dictionary
<
string
,
string
>
key
,
bool
hasMatch
,
out
string
errmsg
);
public
void
Update
();
public
void
Update
();
public
void
Dispose
();
public
void
Dispose
();
...
...
SmartScan/Form/FrmMain.cs
查看文件 @
505fe44
...
@@ -975,6 +975,8 @@ namespace SmartScan
...
@@ -975,6 +975,8 @@ namespace SmartScan
scanWork
=
new
();
scanWork
=
new
();
scanWork
.
generals
=
new
General
(
BLLCommon
.
config
);
scanWork
.
generals
=
new
General
(
BLLCommon
.
config
);
BLLCommon
.
extension
.
KeySets
+=
OnBllKeySet
;
BLLCommon
.
extension
.
KeySets
+=
OnBllKeySet
;
BLLCommon
.
extension
.
GetUIKeyWords
+=
Extension_GetUIKeyWords
;
BLLCommon
.
extension
.
Checks
+=
Extension_Checks
;
;
BLLCommon
.
extension
.
Checks
+=
Extension_Checks
;
;
scanWork
.
Check2s
+=
Extension_Checks
;
scanWork
.
Check2s
+=
Extension_Checks
;
...
@@ -1027,6 +1029,11 @@ namespace SmartScan
...
@@ -1027,6 +1029,11 @@ namespace SmartScan
changeBtnStartText
();
changeBtnStartText
();
}
}
private
Dictionary
<
string
,
string
>
Extension_GetUIKeyWords
()
{
return
wpfControl
.
GetRecognitionData
();
}
private
void
Extension_Checks
(
string
text
)
private
void
Extension_Checks
(
string
text
)
{
{
...
@@ -1060,9 +1067,10 @@ namespace SmartScan
...
@@ -1060,9 +1067,10 @@ namespace SmartScan
}
}
private
void
OnBllKeySet
(
string
[]
originalCode
,
Dictionary
<
string
,
string
>
key
,
bool
hasMatch
)
private
void
OnBllKeySet
(
string
templateName
,
string
[]
originalCode
,
Dictionary
<
string
,
string
>
key
,
bool
hasMatch
)
{
{
LogNet
.
log
.
Info
(
$
"OnBllKeySet hasMatch:{hasMatch}, key:"
+
JsonConvert
.
SerializeObject
(
key
));
LogNet
.
log
.
Info
(
$
"OnBllKeySet templateName:{templateName}, hasMatch:{hasMatch}, key:"
+
JsonConvert
.
SerializeObject
(
key
));
wpfControl
.
templateName
=
templateName
;
// 1. 更新UI显示原始码
// 1. 更新UI显示原始码
wpfControl
.
UpdateOriginalCodeDisplay
(
originalCode
);
wpfControl
.
UpdateOriginalCodeDisplay
(
originalCode
);
...
...
SmartScan/ScanWork.cs
查看文件 @
505fe44
...
@@ -205,14 +205,14 @@ namespace SmartScan
...
@@ -205,14 +205,14 @@ namespace SmartScan
}
}
Check2s
?.
Invoke
(
"text"
);
Check2s
?.
Invoke
(
"text"
);
bool
hasMatch
=
MatchingTemplate
();
bool
hasMatch
=
MatchingTemplate
(
out
string
templateName
);
LogNet
.
log
.
Info
(
$
"模板匹配耗时{reckontime.ElapsedMilliseconds}ms"
);
LogNet
.
log
.
Info
(
$
"模板匹配耗时{reckontime.ElapsedMilliseconds}ms"
);
reckontime
.
Restart
();
reckontime
.
Restart
();
//Common.frmMain.SetWaittingMsg(Language.Dialog("MaterialProcessing"),5);//计算结果...
//Common.frmMain.SetWaittingMsg(Language.Dialog("MaterialProcessing"),5);//计算结果...
Common
.
frmMain
.
Invoke
(
delegate
()
Common
.
frmMain
.
Invoke
(
delegate
()
{
{
SetKey
(
hasMatch
);
SetKey
(
hasMatch
,
templateName
);
});
});
Common
.
frmMain
.
Showlogs
(
""
);
Common
.
frmMain
.
Showlogs
(
""
);
...
@@ -296,8 +296,8 @@ namespace SmartScan
...
@@ -296,8 +296,8 @@ namespace SmartScan
originalCodeText
=
code
;
originalCodeText
=
code
;
originalCodeIsUsed
=
null
;
originalCodeIsUsed
=
null
;
var
hasMatch
=
MatchingTemplate
();
var
hasMatch
=
MatchingTemplate
(
out
string
templateName
);
SetKey
(
hasMatch
);
SetKey
(
hasMatch
,
templateName
);
isTouch
=
true
;
isTouch
=
true
;
LogNet
.
log
.
Info
(
"Work scan code is done"
);
LogNet
.
log
.
Info
(
"Work scan code is done"
);
...
@@ -705,8 +705,9 @@ namespace SmartScan
...
@@ -705,8 +705,9 @@ namespace SmartScan
}
}
public
bool
MatchingTemplate
()
public
bool
MatchingTemplate
(
out
string
templateName
)
{
{
templateName
=
""
;
LogNet
.
log
.
Info
(
"Work MatchingTemplate"
);
LogNet
.
log
.
Info
(
"Work MatchingTemplate"
);
//没有条码也继续进行模板匹配
//没有条码也继续进行模板匹配
//if (workCodeInfo.Count == 0) return false;
//if (workCodeInfo.Count == 0) return false;
...
@@ -714,7 +715,7 @@ namespace SmartScan
...
@@ -714,7 +715,7 @@ namespace SmartScan
bool
rtn
=
BLLCommon
.
mateEdit
.
MatchingTemplate
(
workCodeInfo
,
BLLCommon
.
config
.
DefaultMaterialName
,
false
,
out
string
mateName
,
out
workCodeKeyword
,
out
AMatch
aMatch
);
bool
rtn
=
BLLCommon
.
mateEdit
.
MatchingTemplate
(
workCodeInfo
,
BLLCommon
.
config
.
DefaultMaterialName
,
false
,
out
string
mateName
,
out
workCodeKeyword
,
out
AMatch
aMatch
);
BLL
.
MatchAnalysis
.
ShowResult
();
BLL
.
MatchAnalysis
.
ShowResult
();
templateName
=
mateName
;
Common
.
frmMain
.
Invoke
(
delegate
()
Common
.
frmMain
.
Invoke
(
delegate
()
{
{
if
(
rtn
)
if
(
rtn
)
...
@@ -724,6 +725,7 @@ namespace SmartScan
...
@@ -724,6 +725,7 @@ namespace SmartScan
{
{
btnMatchedName
.
Visible
=
true
;
btnMatchedName
.
Visible
=
true
;
btnMatchedName
.
Text
=
mateName
;
btnMatchedName
.
Text
=
mateName
;
}
}
}
}
else
else
...
@@ -744,13 +746,13 @@ namespace SmartScan
...
@@ -744,13 +746,13 @@ namespace SmartScan
}
}
public
bool
Ispring
=
true
;
public
bool
Ispring
=
true
;
public
bool
needPrint
=
false
;
public
bool
needPrint
=
false
;
public
void
SetKey
(
bool
hasMatch
)
public
void
SetKey
(
bool
hasMatch
,
string
templateName
)
{
{
LogNet
.
log
.
Info
(
"Work SetKey hasMatch:"
+
hasMatch
);
LogNet
.
log
.
Info
(
"Work SetKey hasMatch:"
+
hasMatch
);
//if (workCodeKeyword.Count == 0){ return;}
//if (workCodeKeyword.Count == 0){ return;}
//if(hasMatch)
//if(hasMatch)
Ispring
=
true
;
Ispring
=
true
;
bool
a
=
BLLCommon
.
extension
.
SetKey
(
originalCodeText
,
workCodeKeyword
,
hasMatch
,
out
_
);
bool
a
=
BLLCommon
.
extension
.
SetKey
(
templateName
,
originalCodeText
,
workCodeKeyword
,
hasMatch
,
out
_
);
LoadingScreen
.
Instance
.
Hide
();
LoadingScreen
.
Instance
.
Hide
();
Common
.
frmMain
.
Showlogs
(
""
);
Common
.
frmMain
.
Showlogs
(
""
);
// 通过检查结果状态来判断是否需要打印
// 通过检查结果状态来判断是否需要打印
...
...
SmartScan/SetControl/UsrDataSource.cs
查看文件 @
505fe44
...
@@ -22,8 +22,8 @@ namespace SmartScan
...
@@ -22,8 +22,8 @@ namespace SmartScan
CboDataType
.
Items
.
Add
(
"Excel/CSV"
);
CboDataType
.
Items
.
Add
(
"Excel/CSV"
);
CboDataType
.
SelectedIndex
=
0
;
CboDataType
.
SelectedIndex
=
0
;
TxtDataSource
.
TextChanged
+=
TxtDataSource_TextChanged
;
TxtDataSource
.
TextChanged
+=
TxtDataSource_TextChanged
;
TxtDataSource
.
Text
=
Config
.
DataSource_FilePath
;
//
TxtDataSource.Text = Config.DataSource_FilePath;
ChkRecursive
.
Checked
=
Config
.
DataSource_Recursive
;
//
ChkRecursive.Checked= Config.DataSource_Recursive;
Asa
.
FaceControl
.
Language
.
SetLanguage
(
this
);
Asa
.
FaceControl
.
Language
.
SetLanguage
(
this
);
}
}
...
@@ -99,6 +99,7 @@ namespace SmartScan
...
@@ -99,6 +99,7 @@ namespace SmartScan
}
}
TxtDataSource
.
Text
=
Config
.
DataSource_FilePath
;
TxtDataSource
.
Text
=
Config
.
DataSource_FilePath
;
ChkRecursive
.
Checked
=
Config
.
DataSource_Recursive
;
return
but_StartService
;
return
but_StartService
;
}
}
...
...
SmartScan/SetControl/WPF/NS_KetRight.xaml.cs
查看文件 @
505fe44
...
@@ -32,6 +32,7 @@ namespace SmartScan.SetControl.WPF
...
@@ -32,6 +32,7 @@ namespace SmartScan.SetControl.WPF
// 识别数据
// 识别数据
private
Dictionary
<
string
,
string
>
recognizedData
=
new
Dictionary
<
string
,
string
>();
private
Dictionary
<
string
,
string
>
recognizedData
=
new
Dictionary
<
string
,
string
>();
public
string
templateName
=
""
;
// 事件
// 事件
public
event
EventHandler
<
string
>
DataUpdated
;
public
event
EventHandler
<
string
>
DataUpdated
;
public
event
EventHandler
PrintLabelRequested
;
public
event
EventHandler
PrintLabelRequested
;
...
@@ -427,7 +428,7 @@ namespace SmartScan.SetControl.WPF
...
@@ -427,7 +428,7 @@ namespace SmartScan.SetControl.WPF
if
(
key
.
Contains
(
"\t"
))
if
(
key
.
Contains
(
"\t"
))
{
{
string
[]
parts
=
key
.
Split
(
'\t'
);
string
[]
parts
=
key
.
Split
(
'\t'
);
if
(
parts
.
Length
>
2
)
if
(
parts
.
Length
>
2
&&
!
string
.
IsNullOrWhiteSpace
(
parts
[
1
])
)
return
$
"{parts[0]} ({parts[1]})"
;
return
$
"{parts[0]} ({parts[1]})"
;
else
return
$
"{parts[0]}"
;
else
return
$
"{parts[0]}"
;
}
}
...
@@ -894,7 +895,7 @@ namespace SmartScan.SetControl.WPF
...
@@ -894,7 +895,7 @@ namespace SmartScan.SetControl.WPF
TextBlock
titleBlock
=
new
TextBlock
TextBlock
titleBlock
=
new
TextBlock
{
{
// Text = YU == "zh-CN" ? "识别结果" : (YU == "ja-JP" ? "認識結果" : "Recognition Result"),
// Text = YU == "zh-CN" ? "识别结果" : (YU == "ja-JP" ? "認識結果" : "Recognition Result"),
Text
=
Asa
.
FaceControl
.
Language
.
Dialog
(
"NS_KetRight_TextBlock"
,
"识别结果"
),
Text
=
Asa
.
FaceControl
.
Language
.
Dialog
(
"NS_KetRight_TextBlock"
,
"识别结果"
)
+
" : "
+
templateName
,
FontSize
=
16
,
FontSize
=
16
,
Margin
=
new
Thickness
(
0
,
0
,
0
,
10
),
Margin
=
new
Thickness
(
0
,
0
,
0
,
10
),
Foreground
=
new
SolidColorBrush
((
Color
)
ColorConverter
.
ConvertFromString
(
"#f0f0f0"
))
Foreground
=
new
SolidColorBrush
((
Color
)
ColorConverter
.
ConvertFromString
(
"#f0f0f0"
))
...
...
SmartScan/SetControl/WPF/UserControl1.xaml
查看文件 @
505fe44
...
@@ -333,7 +333,7 @@
...
@@ -333,7 +333,7 @@
<StackPanel Grid.Column="1" Orientation="Horizontal" Margin="15 0 0 0">
<StackPanel Grid.Column="1" Orientation="Horizontal" Margin="15 0 0 0">
<Button Content="−" Style="{StaticResource NavigationButtonStyle}" Click="DecreaseButton_Click" Tag="TxtSplitIndex"/>
<Button Content="−" Style="{StaticResource NavigationButtonStyle}" Click="DecreaseButton_Click" Tag="TxtSplitIndex"/>
<Border Background="#333333" BorderBrush="#555555" BorderThickness="1" Width="25" Height="25" Margin="5" CornerRadius="2">
<Border Background="#333333" BorderBrush="#555555" BorderThickness="1" Width="25" Height="25" Margin="5" CornerRadius="2">
<TextBlock x:Name="TxtSplitIndex" Text="
0
" FontFamily="微软雅黑" FontSize="14" Foreground="White"
<TextBlock x:Name="TxtSplitIndex" Text="
1
" FontFamily="微软雅黑" FontSize="14" Foreground="White"
HorizontalAlignment="Center" VerticalAlignment="Center"/>
HorizontalAlignment="Center" VerticalAlignment="Center"/>
</Border>
</Border>
<Button Content="+" Style="{StaticResource NavigationButtonStyle}" Click="IncreaseButton_Click" Tag="TxtSplitIndex"/>
<Button Content="+" Style="{StaticResource NavigationButtonStyle}" Click="IncreaseButton_Click" Tag="TxtSplitIndex"/>
...
...
SmartScan/SetControl/WPF/WPF_CodeExtract.xaml.cs
查看文件 @
505fe44
...
@@ -323,7 +323,7 @@ namespace SmartScan.SetControl.WPF
...
@@ -323,7 +323,7 @@ namespace SmartScan.SetControl.WPF
if
(
target
!=
null
)
if
(
target
!=
null
)
{
{
int
value
;
int
value
;
if
(
int
.
TryParse
(
target
.
Text
,
out
value
)
&&
value
>
0
)
if
(
int
.
TryParse
(
target
.
Text
,
out
value
)
&&
value
>
1
)
{
{
target
.
Text
=
(
value
-
1
).
ToString
();
target
.
Text
=
(
value
-
1
).
ToString
();
CheckMatchForUserControl
(
match
,
userControl
);
CheckMatchForUserControl
(
match
,
userControl
);
...
@@ -650,7 +650,7 @@ namespace SmartScan.SetControl.WPF
...
@@ -650,7 +650,7 @@ namespace SmartScan.SetControl.WPF
if
(
userControl
.
ChkSplitBarcode
.
IsChecked
==
true
&&
userControl
.
CboSplitChar
.
SelectedItem
!=
null
)
if
(
userControl
.
ChkSplitBarcode
.
IsChecked
==
true
&&
userControl
.
CboSplitChar
.
SelectedItem
!=
null
)
{
{
string
splitChar
=
userControl
.
CboSplitChar
.
SelectedItem
.
ToString
();
string
splitChar
=
userControl
.
CboSplitChar
.
SelectedItem
.
ToString
();
string
[]
parts
=
result
.
Split
(
new
string
[]
{
splitChar
},
StringSplitOptions
.
RemoveEmptyEntries
);
string
[]
parts
=
result
.
Split
(
splitChar
.
ToCharArray
()
);
int
splitIndex
=
int
.
Parse
(
userControl
.
TxtSplitIndex
.
Text
)
-
1
;
// UI显示从1开始,数组从0开始
int
splitIndex
=
int
.
Parse
(
userControl
.
TxtSplitIndex
.
Text
)
-
1
;
// UI显示从1开始,数组从0开始
if
(
splitIndex
>=
0
&&
splitIndex
<
parts
.
Length
)
if
(
splitIndex
>=
0
&&
splitIndex
<
parts
.
Length
)
...
...
SmartScan/WebCallWork.cs
查看文件 @
505fe44
...
@@ -190,7 +190,7 @@ namespace SmartScan
...
@@ -190,7 +190,7 @@ namespace SmartScan
try
try
{
{
//bool hasMatch = scanWork.MatchingTemplate();
//bool hasMatch = scanWork.MatchingTemplate();
BLLCommon
.
extension
.
SetKey
(
scanWork
.
originalCodeText
,
aaa
,
true
,
out
_
);
BLLCommon
.
extension
.
SetKey
(
"AI"
,
scanWork
.
originalCodeText
,
aaa
,
true
,
out
_
);
BLLCommon
.
extension
.
Print
(
true
,
aaa
);
BLLCommon
.
extension
.
Print
(
true
,
aaa
);
}
}
catch
(
Exception
ex
)
catch
(
Exception
ex
)
...
@@ -275,7 +275,7 @@ namespace SmartScan
...
@@ -275,7 +275,7 @@ namespace SmartScan
// workCodeKeyword[item.Key]= item.Value.Replace("<OCR>", "");
// workCodeKeyword[item.Key]= item.Value.Replace("<OCR>", "");
keys
.
Add
(
item
.
Key
,
item
.
Value
.
Replace
(
"<OCR>"
,
""
));
keys
.
Add
(
item
.
Key
,
item
.
Value
.
Replace
(
"<OCR>"
,
""
));
}
}
if
(!
BLLCommon
.
extension
.
SetKey
(
null
,
keys
,
rtn
,
out
string
errmsg
))
if
(!
BLLCommon
.
extension
.
SetKey
(
mateName
,
null
,
keys
,
rtn
,
out
string
errmsg
))
{
{
webResultCode
=
new
WebResultCode
()
{
ErrorCode
=
-
2
,
Msg
=
errmsg
};
webResultCode
=
new
WebResultCode
()
{
ErrorCode
=
-
2
,
Msg
=
errmsg
};
}
}
...
@@ -448,7 +448,7 @@ namespace SmartScan
...
@@ -448,7 +448,7 @@ namespace SmartScan
{
{
keys
.
Add
(
item
.
Key
,
item
.
Value
.
Replace
(
"<OCR>"
,
""
));
keys
.
Add
(
item
.
Key
,
item
.
Value
.
Replace
(
"<OCR>"
,
""
));
}
}
if
(!
BLLCommon
.
extension
.
SetKey
(
null
,
keys
,
rtn
,
out
string
errmsg
))
if
(!
BLLCommon
.
extension
.
SetKey
(
mateName
,
null
,
keys
,
rtn
,
out
string
errmsg
))
{
{
return
new
WebResultCode
()
{
ErrorCode
=
-
2
,
Msg
=
errmsg
};
return
new
WebResultCode
()
{
ErrorCode
=
-
2
,
Msg
=
errmsg
};
}
}
...
...
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论