Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
张东亮
/
NS100
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit 5a451c88
由
夏萍
编写于
2024-11-08 10:53:56 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
1
1 个父辈
595d6703
隐藏空白字符变更
内嵌
并排
正在显示
6 个修改的文件
包含
64 行增加
和
10 行删除
BLL/Extension/Item_General.cs
BLL/MaterialEdit.cs
Model/AMatch.cs
SmartScan/PlusSettingFrm/UsrKeywordlabeling.cs
SmartScan/SetControl/UsrCodeExtractList.cs
SmartScan/WebCallWork.cs
BLL/Extension/Item_General.cs
查看文件 @
5a451c8
...
...
@@ -368,6 +368,26 @@ namespace BLL
debounceHelper
.
HandleTextChanged
((
FaceComboBox
)
sender
,
txt
);
}
private
Dictionary
<
string
,
string
>
UpdateLastKey
(
Dictionary
<
string
,
string
>
lastkey
)
{
Dictionary
<
string
,
string
>
keyValues
=
new
Dictionary
<
string
,
string
>();
if
(
lastkey
==
null
)
return
null
;
foreach
(
var
temp
in
lastkey
.
Keys
)
{
keyValues
.
Add
(
temp
,
lastkey
[
temp
]);
if
(
temp
.
Contains
(
":"
))
{
string
date
=
temp
.
Split
(
':'
)[
1
];
if
(
int
.
TryParse
(
date
,
out
int
value
)&&
value
==
0
&&
int
.
TryParse
(
lastkey
[
temp
],
out
int
value2
))
{
keyValues
[
temp
]
=
value2
.
ToString
(
$
"D{date.Length}"
);
}
}
}
return
keyValues
;
}
private
void
PrintLabel
(
object
sender
,
EventArgs
e
)
{
LogNet
.
log
.
Info
(
"Enter PrintLabel Method"
);
...
...
@@ -383,6 +403,7 @@ namespace BLL
else
lastkey
.
Add
(
extensions
[
i
].
Key
,
extensions
[
i
].
Control
.
Text
);
}
lastkey
=
UpdateLastKey
(
lastkey
);
LogNet
.
log
.
Info
(
"lastkey:"
+
JsonConvert
.
SerializeObject
(
lastkey
));
#
region
判断指定关键字是否存在内容
List
<
string
>
strings
=
new
List
<
string
>();
...
...
BLL/MaterialEdit.cs
查看文件 @
5a451c8
...
...
@@ -432,7 +432,8 @@ namespace BLL
Islable
=
false
;
aMatch
.
IsCodeUsed
[
j
]
=
true
;
aMatch
.
Points
=
new
Point
((
int
)
code
[
j
].
Center
.
X
,
(
int
)
code
[
j
].
Center
.
Y
);
aMatch
.
Angle
=
(
int
)
code
[
j
].
Angle
;
aMatch
.
Angle
=
(
int
)
code
[
j
].
Angle
;
aMatch
.
CodeType
=
code
[
j
].
CodeType
;
}
MatchCodeIndex
.
Add
(
j
);
keyword
.
Add
(
key
,
matchKey
[
key
]);
...
...
@@ -516,6 +517,7 @@ namespace BLL
//aMatch.IsCodeUsed[0] = true;
aMatch
.
Points
=
new
Point
((
int
)
code
[
0
].
Center
.
X
,
(
int
)
code
[
0
].
Center
.
Y
);
aMatch
.
Angle
=
(
int
)
code
[
0
].
Angle
;
aMatch
.
CodeType
=
code
[
0
].
CodeType
;
}
return
true
;
}
...
...
Model/AMatch.cs
查看文件 @
5a451c8
...
...
@@ -2,6 +2,7 @@
using
System.Collections.Generic
;
using
System.Drawing
;
using
System.Linq
;
using
System.Runtime.Serialization
;
using
System.Text
;
using
System.Threading.Tasks
;
...
...
@@ -21,6 +22,11 @@ namespace Model
/// 第一个匹配条码的角度
/// </summary>
public
int
Angle
{
get
;
set
;
}
=
0
;
//
// 摘要:
// 条码类型
[
DataMember
]
public
string
CodeType
{
get
;
set
;
}
}
/// <summary>
...
...
SmartScan/PlusSettingFrm/UsrKeywordlabeling.cs
查看文件 @
5a451c8
...
...
@@ -14,6 +14,7 @@ using System.Data;
using
System.Drawing
;
using
System.IO
;
using
System.Linq
;
using
System.Security.Cryptography
;
using
System.Text
;
using
System.Threading.Tasks
;
using
System.Windows.Forms
;
...
...
@@ -259,7 +260,7 @@ namespace SmartScan.PlusSettingFrm
item
.
key
=
""
;
}
}
public
static
Point
LabelingAngle
(
string
keyvalue
,
AMatch
aMatch
,
System
.
Drawing
.
Point
centrality
,
bool
isvaor
,
int
PlateW
,
out
int
angle
)
public
static
Point
LabelingAngle
(
string
keyvalue
,
AMatch
aMatch
,
System
.
Drawing
.
Point
centrality
,
bool
isvaor
,
int
PlateW
,
out
int
angle
,
bool
isQRCode
)
{
Point
lable
=
aMatch
.
Points
;
Point
newpoint
=
aMatch
.
Points
;
...
...
@@ -276,7 +277,7 @@ namespace SmartScan.PlusSettingFrm
//X += Data.X; Y += Data.Y;
LogUtil
.
info
(
$
"关键字{Data.key}={Data.value};顺时针旋转角度={Data.ClockwiseAngle};xy偏移{Data.X};{Data.Y};标签角度:{Data.LabelAngle}"
);
}
newpoint
=
Overwritelabel
(
centrality
,
aMatch
.
Points
,
isvaor
,
PlateW
,
aMatch
.
Angle
,
RotateAngle
,
out
angle
);
newpoint
=
Overwritelabel
(
centrality
,
aMatch
.
Points
,
isvaor
,
PlateW
,
aMatch
.
Angle
,
RotateAngle
,
out
angle
,
isQRCode
);
//if (Data != null&&Data.LabelAngle > 0)
//{
// angle = Data.LabelAngle;
...
...
@@ -291,12 +292,23 @@ namespace SmartScan.PlusSettingFrm
LogUtil
.
info
(
$
"处理后角度={angle};处理后贴标位置:{newpoint};标签变换角度:{Data.LabelAngle}"
);
return
new
Point
(
newpoint
.
X
,
newpoint
.
Y
);
}
public
static
Point
Overwritelabel
(
Point
centrality
,
Point
lable
,
bool
isvaor
,
int
PlateW
,
int
Angle
,
int
RotateAngle
,
out
int
angle
)
public
static
Point
Overwritelabel
(
Point
centrality
,
Point
lable
,
bool
isvaor
,
int
PlateW
,
int
Angle
,
int
RotateAngle
,
out
int
angle
,
bool
isQRCode
)
{
Point
Points
=
LabelingPosition
.
ClockwiseRotation
(
lable
,
centrality
,
RotateAngle
);
if
(
isvaor
)
{
angle
=
ScanningCameraAngle
(
Angle
,
RotateAngle
);
if
(
isQRCode
)
{
int
deg
=
Angle
;
deg
+=
90
;
if
(
deg
>
360
)
deg
=
deg
-
360
;
angle
=
ScanningCameraAngle
(
deg
,
RotateAngle
);
}
else
{
angle
=
ScanningCameraAngle
(
Angle
,
RotateAngle
);
}
}
else
{
...
...
@@ -309,7 +321,7 @@ namespace SmartScan.PlusSettingFrm
{
//ID MVS相机, 右侧为正角度, 左侧为负角度
int
angle
;
int
rotationAngle
=
RotateAngle
+
8
3
;
// 83;
int
rotationAngle
=
RotateAngle
+
8
0
;
// 83;
if
(
angles
<
0
)
{
angle
=
angles
*
-
1
+
rotationAngle
;
...
...
SmartScan/SetControl/UsrCodeExtractList.cs
查看文件 @
5a451c8
...
...
@@ -26,9 +26,6 @@ namespace SmartScan
changed
=
true
;
Language
.
SetLanguage
(
this
);
//var name = LblSplitPart.Text.Trim();
//LblSplitPart.Text= "Field";
//LblSplitPart.Text = "获取分割部分";
this
.
codeText
=
codeText
;
this
.
codeType
=
codeType
;
CboKeyword
.
Items
.
AddRange
(
BLLCommon
.
macroKey
.
ToArray
());
...
...
SmartScan/WebCallWork.cs
查看文件 @
5a451c8
...
...
@@ -168,6 +168,7 @@ namespace SmartScan
BLLCommon
.
mateEdit
.
CurrntBitmap
?.
Dispose
();
Bitmap
bitmap
=
null
;
MemoryStream
stream
=
null
;
bool
isQRCode
=
false
;
try
{
if
(
bitmapData
==
null
)
...
...
@@ -194,6 +195,7 @@ namespace SmartScan
{
return
new
WebResultCode
()
{
ErrorCode
=
-
1
,
Msg
=
"扫码相机未传来条码数据;"
};
}
if
(
bitmapData
.
IsIDCamera
)
{
bitmapData
.
BarCodeList
.
ForEach
(
barcode
=>
...
...
@@ -207,7 +209,14 @@ namespace SmartScan
CodeType
=
barcode
.
CodeType
,
Distance
=
barcode
.
Distance
,
});
//LogNet.log.Info($"条码数据类型为{barcode.CodeType}");
});
//LogNet.log.Info($"条码数据[0]类型为{bitmapData.BarCodeList[0].CodeType}");
//if (bitmapData.BarCodeList[0].CodeType== "QR Code")
//{
// isQRCode = true;
// LogNet.log.Info("条码数据为QR Code");
//}
}
else
{
...
...
@@ -225,10 +234,17 @@ namespace SmartScan
LogNet
.
log
.
Info
(
"模板匹配结果:"
+
rtn
);
if
(
rtn
)
{
if
(
aMatch
.
CodeType
==
"QR Code"
)
{
isQRCode
=
true
;
LogNet
.
log
.
Info
(
"条码数据为QR Code"
);
}
LogNet
.
log
.
Info
(
$
"条码数据类型为{aMatch.CodeType}"
);
string
key
=
ConfigHelper
.
Config
.
Get
(
"Label_Key"
,
""
);
workCodeKeyword
.
TryGetValue
(
key
,
out
String
Value
);
LogNet
.
log
.
Info
(
"模板匹配结果:"
+
rtn
+
$
";关键字{key}:{Value};匹配成功条码xy:X={aMatch.Points.X};Y={aMatch.Points.Y},中心点x={bitmapData.X};y={bitmapData.Y},角度={aMatch.Angle},料盘尺寸={bitmapData.PlateW};匹配成功条码:{string.Join("
,
", aMatch.IsCodeUsed)}"
);
point
=
UsrKeywordlabeling
.
LabelingAngle
(
Value
,
aMatch
,
new
Point
(
bitmapData
.
X
,
bitmapData
.
Y
),
bitmapData
.
IsIDCamera
,
bitmapData
.
PlateW
,
out
angle
);
point
=
UsrKeywordlabeling
.
LabelingAngle
(
Value
,
aMatch
,
new
Point
(
bitmapData
.
X
,
bitmapData
.
Y
),
bitmapData
.
IsIDCamera
,
bitmapData
.
PlateW
,
out
angle
,
isQRCode
);
//point =UsrCustomlabeling.LabelingAngle_New(mateName, aMatch, new Point(bitmapData.X, bitmapData.Y), bitmapData.IsIDCamera, bitmapData.PlateW, out angle);
}
Dictionary
<
string
,
string
>
keys
=
new
Dictionary
<
string
,
string
>();
...
...
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论