Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
张东亮
/
NS100
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit 026477d4
由
刘韬
编写于
2025-02-27 11:57:17 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
1
1 个父辈
0de8eabe
显示空白字符变更
内嵌
并排
正在显示
5 个修改的文件
包含
30 行增加
和
10 行删除
BLL/MatchAnalysis.cs
BLL/MaterialEdit.cs
SmartScan/PlusSettingFrm/FrmSetPlus.cs
SmartScan/WebCallWork.cs
SmartScan/WebService.cs
BLL/MatchAnalysis.cs
查看文件 @
026477d
...
@@ -66,13 +66,13 @@ namespace BLL
...
@@ -66,13 +66,13 @@ namespace BLL
static
Dictionary
<
string
,
TemplateCollection
>
MatchTemplateList
;
static
Dictionary
<
string
,
TemplateCollection
>
MatchTemplateList
;
public
static
void
ShowResult
()
public
static
void
ShowResult
()
{
{
return
;
//
return;
foreach
(
var
tp
in
MatchTemplateList
)
{
foreach
(
var
tp
in
MatchTemplateList
)
{
LogNet
.
log
.
Info
(
$
"开始解析模版:{tp.Key}"
);
LogNet
.
log
.
Info
(
$
"开始解析模版:{tp.Key}"
);
foreach
(
var
m
in
tp
.
Value
.
MatchCollections
)
{
foreach
(
var
m
in
tp
.
Value
.
MatchCollections
)
{
LogNet
.
log
.
Info
(
$
"开始解析关键字:{m.Key}"
);
LogNet
.
log
.
Info
(
$
"开始解析关键字:{m.Key}"
);
LogNet
.
log
.
Info
(
$
"匹配到关键字:{m.Key}"
);
//
LogNet.log.Info($"匹配到关键字:{m.Key}");
string
matchlist
=
m
.
Value
.
barcodeInfo
.
Text
+
"\t"
;
string
matchlist
=
m
.
Value
.
barcodeInfo
.
Text
+
"\t"
;
foreach
(
var
item
in
m
.
Value
.
Matchs
)
foreach
(
var
item
in
m
.
Value
.
Matchs
)
{
{
...
...
BLL/MaterialEdit.cs
查看文件 @
026477d
...
@@ -414,6 +414,7 @@ namespace BLL
...
@@ -414,6 +414,7 @@ namespace BLL
for
(
int
i
=
0
;
i
<
id
.
Length
;
i
++)
for
(
int
i
=
0
;
i
<
id
.
Length
;
i
++)
{
{
MatchAnalysis
.
SetTemplatename
(
mateTemp
[
index
].
Name
);
MatchAnalysis
.
SetTemplatename
(
mateTemp
[
index
].
Name
);
LogNet
.
log
.
Info
(
$
"开始匹配模版: {mateTemp[index].Name}"
);
List
<
MaterialCodeMatch
>
codeMatch
=
mateTemp
[
index
].
Match
.
FindAll
(
match
=>
match
.
CodeID
==
id
[
i
]
&&
match
.
Keyword
!=
""
);
List
<
MaterialCodeMatch
>
codeMatch
=
mateTemp
[
index
].
Match
.
FindAll
(
match
=>
match
.
CodeID
==
id
[
i
]
&&
match
.
Keyword
!=
""
);
if
(
codeMatch
.
Count
==
0
)
continue
;
if
(
codeMatch
.
Count
==
0
)
continue
;
matchCount
+=
codeMatch
.
Count
;
matchCount
+=
codeMatch
.
Count
;
...
@@ -613,7 +614,7 @@ namespace BLL
...
@@ -613,7 +614,7 @@ namespace BLL
string
code
,
text
;
string
code
,
text
;
int
index
,
count
;
int
index
,
count
;
Identification
=
false
;
Identification
=
false
;
LogNet
.
log
.
Info
(
$
"开始匹配条码 [{codeinfo.Text}]"
);
for
(
int
i
=
0
;
i
<
codeMatch
.
Count
;
i
++)
for
(
int
i
=
0
;
i
<
codeMatch
.
Count
;
i
++)
{
{
int
matchCount
=
0
;
int
matchCount
=
0
;
...
@@ -623,6 +624,8 @@ namespace BLL
...
@@ -623,6 +624,8 @@ namespace BLL
MatchAnalysis
.
SetBarcode
(
codeinfo
);
MatchAnalysis
.
SetBarcode
(
codeinfo
);
code
=
codeMatch
[
i
].
CaseSensitive
?
codeText
:
codeText
.
ToUpper
();
code
=
codeMatch
[
i
].
CaseSensitive
?
codeText
:
codeText
.
ToUpper
();
bool
ismatch
=
true
;
bool
ismatch
=
true
;
LogNet
.
log
.
Info
(
$
"开始匹配规则 [{codeMatch[i].Keyword}]"
);
//匹配CodeType
//匹配CodeType
if
(
codeMatch
[
i
].
CheckCodeType
&&
!
string
.
IsNullOrEmpty
(
codeMatch
[
i
].
CodeType
)
&&
!
string
.
IsNullOrEmpty
(
codeinfo
.
CodeType
))
if
(
codeMatch
[
i
].
CheckCodeType
&&
!
string
.
IsNullOrEmpty
(
codeMatch
[
i
].
CodeType
)
&&
!
string
.
IsNullOrEmpty
(
codeinfo
.
CodeType
))
{
{
...
...
SmartScan/PlusSettingFrm/FrmSetPlus.cs
查看文件 @
026477d
...
@@ -22,7 +22,7 @@ namespace SmartScan
...
@@ -22,7 +22,7 @@ namespace SmartScan
//this.Height = 738;
//this.Height = 738;
this
.
Top
=
15
;
this
.
Top
=
15
;
this
.
Left
=
0
;
this
.
Left
=
0
;
WebService
.
Open
();
//启动条码匹配服务
WebService
.
Open
(
BLLCommon
.
config
.
WebService
);
//启动条码匹配服务
LogNet
.
log
=
log4net
.
LogManager
.
GetLogger
(
"SmartScan"
);
LogNet
.
log
=
log4net
.
LogManager
.
GetLogger
(
"SmartScan"
);
}
}
...
...
SmartScan/WebCallWork.cs
查看文件 @
026477d
...
@@ -229,6 +229,7 @@ namespace SmartScan
...
@@ -229,6 +229,7 @@ namespace SmartScan
Dictionary
<
string
,
string
>
workCodeKeyword
;
Dictionary
<
string
,
string
>
workCodeKeyword
;
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
();
var
point
=
new
Point
(-
1
,
-
1
);
var
point
=
new
Point
(-
1
,
-
1
);
int
angle
=
0
;
int
angle
=
0
;
LogNet
.
log
.
Info
(
"模板匹配结果:"
+
rtn
);
LogNet
.
log
.
Info
(
"模板匹配结果:"
+
rtn
);
...
...
SmartScan/WebService.cs
查看文件 @
026477d
using
BLL
;
using
BLL
;
using
Microsoft.Win32
;
using
System
;
using
System
;
using
System.ServiceModel
;
using
System.ServiceModel.Web
;
using
System.ServiceModel.Web
;
namespace
SmartScan
namespace
SmartScan
...
@@ -9,23 +11,37 @@ namespace SmartScan
...
@@ -9,23 +11,37 @@ namespace SmartScan
private
static
WebServiceHost
_serviceHost
;
private
static
WebServiceHost
_serviceHost
;
public
static
bool
IsOpen
{
private
set
;
get
;
}
public
static
bool
IsOpen
{
private
set
;
get
;
}
static
int
errcount
=
0
;
public
static
void
Open
()
public
static
void
Open
(
string
url
)
{
try
{
{
string
url
=
BLLCommon
.
config
.
WebService
;
if
(
string
.
IsNullOrWhiteSpace
(
url
))
if
(
string
.
IsNullOrWhiteSpace
(
url
))
{
{
Model
.
LogNet
.
log
.
Info
(
"WebService没有配置,不开启"
);
Model
.
LogNet
.
log
.
Info
(
"WebService没有配置,不开启"
);
return
;
return
;
}
}
var
u
=
new
Uri
(
url
);
try
{
WebCallWork
service
=
new
();
WebCallWork
service
=
new
();
_serviceHost
=
new
(
service
,
new
Uri
(
url
)
);
_serviceHost
=
new
(
service
,
u
);
_serviceHost
.
Open
();
_serviceHost
.
Open
();
Registry
.
SetValue
(
"HKEY_LOCAL_MACHINE\\SOFTWARE\\NS100\\"
,
"port"
,
u
.
Port
);
Model
.
LogNet
.
log
.
Info
(
"Web服务已开启,URL="
+
url
);
Model
.
LogNet
.
log
.
Info
(
"Web服务已开启,URL="
+
url
);
IsOpen
=
true
;
IsOpen
=
true
;
}
}
catch
(
AddressAlreadyInUseException
ex
)
{
Model
.
LogNet
.
log
.
Info
(
"端口:"
+
u
.
Port
+
" 被占用"
);
errcount
++;
if
(
errcount
>
20
)
{
Environment
.
Exit
(
99
);
return
;
}
Random
a
=
new
Random
((
int
)
DateTime
.
Now
.
Ticks
);
var
nu
=
"http://0.0.0.0:"
+
a
.
Next
(
40000
,
60000
)
+
"/"
;
Open
(
nu
);
}
catch
(
Exception
ex
)
catch
(
Exception
ex
)
{
{
Model
.
LogNet
.
log
.
Error
(
"Open"
,
ex
);
Model
.
LogNet
.
log
.
Error
(
"Open"
,
ex
);
...
...
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论