Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
张东亮
/
NS100
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit 7a8e3a3a
由
刘韬
编写于
2026-02-11 14:07:24 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
后天模式 reelid转换异常的问题
1 个父辈
f9bd0599
隐藏空白字符变更
内嵌
并排
正在显示
5 个修改的文件
包含
64 行增加
和
42 行删除
BLL/Extension/Item_General.cs
BLL/MaterialEdit.cs
SmartScan/PlusSettingFrm/FrmSetPlus.cs
SmartScan/PlusSettingFrm/UsrKeywordlabeling.cs
SmartScan/WebCallWork.cs
BLL/Extension/Item_General.cs
查看文件 @
7a8e3a3
using
Asa.FaceControl
;
using
DocumentFormat.OpenXml.Drawing.Charts
;
using
Model
;
using
Newtonsoft.Json
;
using
System
;
...
...
@@ -98,11 +97,12 @@ namespace BLL
// 定义事件
protected
virtual
void
OnKeySet
(
string
templateName
,
string
[]
originalCode
,
Dictionary
<
string
,
string
>
key
,
bool
hasMatch
)
protected
virtual
void
OnKeySet
(
string
templateName
,
string
[]
originalCode
,
Dictionary
<
string
,
string
>
key
,
bool
hasMatch
)
{
extension
.
set
(
templateName
,
originalCode
,
key
,
hasMatch
);
extension
.
set
(
templateName
,
originalCode
,
key
,
hasMatch
);
}
public
Dictionary
<
string
,
string
>
GetUIKeywords
()
{
public
Dictionary
<
string
,
string
>
GetUIKeywords
()
{
return
extension
.
GetUIKeywords
();
}
protected
virtual
void
CheckText
(
string
text
)
...
...
@@ -280,7 +280,7 @@ namespace BLL
if
(
findOk
)
{
// 添加或替换自增ID
if
(!
string
.
IsNullOrEmpty
(
config
.
ReelIDKeyWord
)
&&
isdisplay
)
{
var
Reelidstr
=
GetReelid
();
...
...
@@ -335,9 +335,9 @@ namespace BLL
// }
if
(
extensions
!=
null
&&
!
extensions
[
0
].
Control
.
InvokeRequired
)
if
(
extensions
!=
null
&&
extensions
.
Count
>
0
&&
!
extensions
[
0
].
Control
.
InvokeRequired
)
{
LogNet
.
log
.
Info
(
$
"OnKeySet3"
);
OnKeySet
(
templateName
,
originalCode
,
key
,
hasMatch
);
...
...
@@ -424,7 +424,7 @@ namespace BLL
LogNet
.
log
.
Error
(
"GetHttpReelID:"
+
errmsg
);
return
false
;
}
LogNet
.
log
.
Error
(
"GetHttpReelID:true"
);
LogNet
.
log
.
Error
(
"GetHttpReelID:true"
);
//key["ReelID"] = newid;
}
if
(
extensions
!=
null
&&
extensions
.
Count
>
0
&&
!
extensions
[
0
].
Control
.
InvokeRequired
)
...
...
@@ -484,12 +484,12 @@ namespace BLL
private
string
GetReelid
()
{
LogNet
.
log
.
Debug
(
"Enter GetReelid Method"
);
if
(
extensions
!=
null
)
{
int
idIndex
=
extensions
.
FindIndex
(
match
=>
match
.
Key
==
config
.
ReelIDKeyWord
);
if
(
idIndex
==
-
1
)
return
""
;
}
LogNet
.
log
.
Info
(
"Enter GetReelid Method"
);
//
if (extensions != null)
//
{
//
int idIndex = extensions.FindIndex(match => match.Key == config.ReelIDKeyWord);
//
if (idIndex == -1) return "";
//
}
// 读取参数
string
matchPattern
=
config
.
ReelIDMatch
;
...
...
@@ -498,7 +498,7 @@ namespace BLL
// 处理字符类型关键字
List
<
string
>
characterTypeKeywords
=
ParseCharacterTypeKeywords
();
LogNet
.
log
.
Debug
(
$
"字符类型关键字: {string.Join("
,
", characterTypeKeywords)}"
);
LogNet
.
log
.
Info
(
$
"字符类型关键字: {string.Join("
,
", characterTypeKeywords)}"
);
// 解析模板中的所有关键字
string
[]
keys
=
ObjConversion
.
StrGetKey
(
matchPattern
);
...
...
@@ -618,14 +618,14 @@ namespace BLL
}
return
reelID
;
}
private
void
GetHttpReelID
(
object
sender
,
EventArgs
e
)
{
updatereelid
(
lastkey
,
out
_
);
LogNet
.
log
.
Info
(
$
"updatereelid GetHttpReelID"
);
}
private
void
BtnSkip_Click
(
object
sender
,
EventArgs
e
)
{
{
string
title
=
Language
.
Dialog
(
"Notice"
,
"提示"
);
string
msg
=
Language
.
Dialog
(
"SkipOperation"
,
"是否跳过此操作?"
);
bool
result
=
MessageboxNeo
.
Show
(
title
,
msg
,
"NEO SCAN"
,
true
);
...
...
@@ -633,7 +633,7 @@ namespace BLL
{
lastKeys
=
null
;
BLLCommon
.
extension
.
labelText
=
Language
.
Dialog
(
"Waiting"
,
"等待中"
);
}
}
}
public
void
CheckClear
()
{
...
...
@@ -665,9 +665,9 @@ namespace BLL
}
return
keyValues
;
}
private
void
PrintLabel
(
Dictionary
<
string
,
string
>
printKey
)
{
LogNet
.
log
.
Info
(
"Enter PrintLabel Method: "
+
JsonConvert
.
SerializeObject
(
printKey
));
private
void
PrintLabel
(
Dictionary
<
string
,
string
>
printKey
)
{
LogNet
.
log
.
Info
(
"Enter PrintLabel Method: "
+
JsonConvert
.
SerializeObject
(
printKey
));
if
(
printKey
==
null
)
return
;
...
...
@@ -722,7 +722,7 @@ namespace BLL
}
}
#
endregion
Printing
?.
Invoke
(
printKey
);
bool
close
=
ConfigHelper
.
Config
.
Get
(
"isprinclose"
,
false
);
...
...
@@ -852,7 +852,7 @@ namespace BLL
{
LogNet
.
log
.
Error
(
$
"替换数据时出错:{ex.Message}"
);
}
}
}
//private void GetDataButtonClick(object sender, EventArgs e)
//{
...
...
BLL/MaterialEdit.cs
查看文件 @
7a8e3a3
...
...
@@ -145,10 +145,10 @@ namespace BLL
mateName
=
""
;
keyword
=
new
Dictionary
<
string
,
string
>();
LogNet
.
log
.
Info
(
$
"
code
数量:{code.Count}"
);
LogNet
.
log
.
Info
(
$
"
读取到条码
数量:{code.Count}"
);
code
.
ForEach
((
c
)
=>
{
LogNet
.
log
.
Info
(
$
"
扫描到 {c.Angle}, {c.CodeType},
{c.Text}"
);
LogNet
.
log
.
Info
(
$
"
读取到条码 [{c.Center},R:{c.Angle}]{c.CodeType}:
{c.Text}"
);
});
MatchAnalysis
.
StartNewAnalysis
(
code
);
if
(
Config
.
Func_EnabledOCR
)
...
...
SmartScan/PlusSettingFrm/FrmSetPlus.cs
查看文件 @
7a8e3a3
...
...
@@ -22,7 +22,7 @@ namespace SmartScan
//this.Height = 738;
this
.
Top
=
15
;
this
.
Left
=
0
;
WebService
.
Open
(
BLLCommon
.
config
.
WebService
);
//启动条码匹配服务
//
WebService.Open(BLLCommon.config.WebService);//启动条码匹配服务
LogNet
.
log
=
log4net
.
LogManager
.
GetLogger
(
"SmartScan"
);
}
...
...
SmartScan/PlusSettingFrm/UsrKeywordlabeling.cs
查看文件 @
7a8e3a3
...
...
@@ -310,28 +310,42 @@ namespace SmartScan.PlusSettingFrm
if
(
isvaor
)
{
bool
isbarcode
=
true
;
if
(
codeType
.
StartsWith
(
"QR Code"
))
{
int
deg
=
Angle
;
deg
+=
90
;
if
(
deg
>
360
)
deg
=
deg
-
360
;
angle
=
ScanningCameraAngle
(
deg
,
0
);
angle
=
ScanningCameraAngle
(
deg
,
0
);
isbarcode
=
false
;
LogUtil
.
info
(
$
"QR Code转换后角度,Angle:{Angle}, deg:{angle}"
);
Angle
=
angle
;
}
else
if
(
codeType
.
StartsWith
(
"Data Matrix"
))
{
angle
=
ScanningCameraAngle
(
Angle
,
0
);
int
deg
=
Angle
;
angle
=
ScanningCameraAngle
(
deg
,
0
);
isbarcode
=
false
;
LogUtil
.
info
(
$
"Data Matrix转换后角度,Angle:{Angle}, deg:{angle}"
);
Angle
=
angle
;
}
//Angle = Angle + 270;
if
(
isbarcode
)
{
var
dc1
=
LabelingPosition
.
distance
(
LabelingPosition
.
PointWithAngle
(
lable
,
Angle
,
50
),
centrality
);
var
dc2
=
LabelingPosition
.
distance
(
LabelingPosition
.
PointWithAngle
(
lable
,
Angle
+
180
,
50
),
centrality
);
if
(
dc2
>
dc1
)
Angle
=
Angle
+
180
;
if
(
Angle
>
360
)
Angle
=
Angle
-
360
;
LogUtil
.
info
(
$
"结合盘心计算后, dc1:{dc1}, dc2:{dc2}, deg:{Angle}"
);
}
else
{
LogUtil
.
info
(
$
"二维码转换后角度, deg:{Angle}"
);
}
Angle
=
Angle
+
270
;
var
dc1
=
LabelingPosition
.
distance
(
LabelingPosition
.
PointWithAngle
(
lable
,
Angle
,
50
),
centrality
);
var
dc2
=
LabelingPosition
.
distance
(
LabelingPosition
.
PointWithAngle
(
lable
,
Angle
+
180
,
50
),
centrality
);
//if (dc2 > dc1)
// Angle = Angle + 180;
if
(
Angle
>
360
)
Angle
=
Angle
-
360
;
LogUtil
.
info
(
$
"结合盘心计算后, dc1:{dc1}, dc2:{dc2}, deg:{Angle}"
);
angle
=
Angle
+
83
+
labelangle
;
if
(
angle
>
360
)
...
...
@@ -362,7 +376,7 @@ namespace SmartScan.PlusSettingFrm
{
angle
=
360
-
angles
+
rotationAngle
;
}
angle
+
=
90
;
angle
-
=
90
;
if
(
angle
>=
360
)
{
angle
-=
360
;
...
...
SmartScan/WebCallWork.cs
查看文件 @
7a8e3a3
...
...
@@ -267,7 +267,7 @@ namespace SmartScan
BLLCommon
.
mateEdit
.
CurrntBitmap
=
DeepClone
(
bitmap
);
bool
rtn
=
BLLCommon
.
mateEdit
.
MatchingTemplate
(
workCodeInfo
,
BLLCommon
.
config
.
DefaultMaterialName
,
false
,
out
string
mateName
,
out
workCodeKeyword
,
out
AMatch
aMatch
);
LogNet
.
log
.
Info
(
"模板匹配结果:"
+
rtn
);
LogNet
.
log
.
Info
(
"模板匹配结果
1
:"
+
rtn
);
WebResultCode
webResultCode
=
null
;
Dictionary
<
string
,
string
>
keys
=
new
Dictionary
<
string
,
string
>(
StringComparer
.
OrdinalIgnoreCase
);
foreach
(
var
item
in
workCodeKeyword
)
...
...
@@ -278,6 +278,7 @@ namespace SmartScan
if
(!
BLLCommon
.
extension
.
SetKey
(
mateName
,
null
,
keys
,
rtn
,
out
string
errmsg
))
{
webResultCode
=
new
WebResultCode
()
{
ErrorCode
=
-
2
,
Msg
=
errmsg
};
LogNet
.
log
.
Info
(
"模板匹配结果2:"
+
JsonConvert
.
SerializeObject
(
webResultCode
));
}
if
(
webResultCode
!=
null
||
!
rtn
)
...
...
@@ -326,7 +327,9 @@ namespace SmartScan
{
result
.
Add
(
new
KeyValuePair
<
string
,
string
>(
wc
.
Key
,
wc
.
Value
));
}
return
new
WebResultCode
()
{
workCodeKeyword
=
result
,
workCodeInfo
=
workCodeInfo
};
webResultCode
=
new
WebResultCode
()
{
workCodeKeyword
=
result
,
workCodeInfo
=
workCodeInfo
};
LogNet
.
log
.
Info
(
"模板匹配结果2:"
+
JsonConvert
.
SerializeObject
(
webResultCode
));
return
webResultCode
;
}
catch
(
Exception
ex
)
{
...
...
@@ -360,6 +363,7 @@ namespace SmartScan
}
public
WebResultCode
ProcessBitmaps
(
BitmapData
bitmapData
)
{
LogNet
.
log
.
Info
(
"====开始WebCall匹配========================="
);
BLLCommon
.
mateEdit
.
CurrntBitmap
?.
Dispose
();
Bitmap
bitmap
=
null
;
MemoryStream
stream
=
null
;
...
...
@@ -450,7 +454,9 @@ namespace SmartScan
}
if
(!
BLLCommon
.
extension
.
SetKey
(
mateName
,
null
,
keys
,
rtn
,
out
string
errmsg
))
{
return
new
WebResultCode
()
{
ErrorCode
=
-
2
,
Msg
=
errmsg
};
var
webResultCode1
=
new
WebResultCode
()
{
ErrorCode
=
-
2
,
Msg
=
errmsg
};
LogNet
.
log
.
Info
(
"模板匹配结果: "
+
JsonConvert
.
SerializeObject
(
webResultCode1
));
return
webResultCode1
;
}
List
<
KeyValuePair
<
string
,
string
>>
result
=
new
List
<
KeyValuePair
<
string
,
string
>>();
workCodeKeyword
=
WebserverReplaceData
(
keys
);
...
...
@@ -466,7 +472,9 @@ namespace SmartScan
IsCodeUsed
=
aMatch
.
IsCodeUsed
};
LogNet
.
log
.
Info
(
$
"返回坐标及角度X={newPosition.X};Y={newPosition.Y};角度={newPosition.Angle}"
);
return
new
WebResultCode
()
{
workCodeKeyword
=
result
,
workCodeInfo
=
workCodeInfo
,
PositionAngle
=
newPosition
};
var
webResultCode
=
new
WebResultCode
()
{
workCodeKeyword
=
result
,
workCodeInfo
=
workCodeInfo
,
PositionAngle
=
newPosition
};
LogNet
.
log
.
Info
(
"模板匹配结果: "
+
JsonConvert
.
SerializeObject
(
webResultCode
));
return
webResultCode
;
}
catch
(
Exception
ex
)
{
...
...
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论