Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
张东亮
/
NS100
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit 2f575419
由
刘韬
编写于
2025-01-09 13:44:37 +0800
浏览文件
选项
浏览文件
标签
下载
差异文件
Merge branch 'master' of
http://106.15.194.121:8083/zdl/NS100
2 个父辈
f313cbeb
4bbefe4a
全部展开
隐藏空白字符变更
内嵌
并排
正在显示
19 个修改的文件
包含
94 行增加
和
23 行删除
BLL/Extension/Item_General.cs
BLL/MaterialEdit.cs
IDHIKCamera/IDHIK.cs
Model/AMatch.cs
SmartScan/Form/FrmCodeExtract.Designer.cs
SmartScan/Form/FrmDrawText.Designer.cs
SmartScan/Form/FrmRetrospect.Designer.cs
SmartScan/Form/FrmRetrospect.cs
SmartScan/Language/en-US.lngres
SmartScan/Language/zh-CN.lngres
SmartScan/PlusSettingFrm/UsrKeywordlabeling.cs
SmartScan/ScanWork.cs
SmartScan/SetControl/FrmDataFilePreview.Designer.cs
SmartScan/SetControl/FrmDataFilePreview.cs
SmartScan/SetControl/UsrCodeExtractList.Designer.cs
SmartScan/SetControl/UsrCodeExtractList.cs
SmartScan/SetControl/UsrDataSource.Designer.cs
SmartScan/SetControl/UsrPrintTemplate.Designer.cs
SmartScan/WebCallWork.cs
BLL/Extension/Item_General.cs
查看文件 @
2f57541
...
...
@@ -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
查看文件 @
2f57541
...
...
@@ -144,6 +144,7 @@ namespace BLL
mateName
=
""
;
keyword
=
null
;
LogNet
.
log
.
Info
(
$
"code数量:{code.Count}"
);
code
.
ForEach
((
c
)
=>
{
LogNet
.
log
.
Info
(
$
"扫描到 {c.Angle}, {c.CodeType},{c.Text}"
);
...
...
@@ -431,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
]);
...
...
@@ -515,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
;
}
...
...
IDHIKCamera/IDHIK.cs
查看文件 @
2f57541
using
MvCodeReaderSDKNet
;
using
MVIDCodeReaderNet
;
using
MvCodeReaderSDKNet
;
using
System
;
using
System.Collections.Generic
;
using
System.Drawing
;
...
...
@@ -430,9 +429,9 @@ namespace IDHIKCamera
MvCodeReader
.
MV_CODEREADER_IMAGE_OUT_INFO_EX2
stFrameInfoEx2
=
new
MvCodeReader
.
MV_CODEREADER_IMAGE_OUT_INFO_EX2
();
pstFrameInfoEx2
=
Marshal
.
AllocHGlobal
(
Marshal
.
SizeOf
(
typeof
(
MvCodeReader
.
MV_CODEREADER_IMAGE_OUT_INFO_EX2
)));
Marshal
.
StructureToPtr
(
stFrameInfoEx2
,
pstFrameInfoEx2
,
false
);
for
(
int
i
=
0
;
i
<
10
;
i
++)
for
(
int
i
=
0
;
i
<
4
;
i
++)
{
nRet
=
cameraCurr
[
index
].
MV_CODEREADER_GetOneFrameTimeoutEx2_NET
(
ref
pData
,
pstFrameInfoEx2
,
2
000
);
nRet
=
cameraCurr
[
index
].
MV_CODEREADER_GetOneFrameTimeoutEx2_NET
(
ref
pData
,
pstFrameInfoEx2
,
1
000
);
if
(
nRet
==
MvCodeReader
.
MV_CODEREADER_OK
)
{
...
...
@@ -442,7 +441,7 @@ namespace IDHIKCamera
else
{
LibLogUtil
.
Error
(
" Can not grab one : "
+
nRet
);
Thread
.
Sleep
(
10
0
);
Thread
.
Sleep
(
5
0
);
}
}
List
<
Point
[
]>
pts
=
new
List
<
Point
[
]>
();
...
...
Model/AMatch.cs
查看文件 @
2f57541
...
...
@@ -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/Form/FrmCodeExtract.Designer.cs
查看文件 @
2f57541
此文件的差异被折叠,
点击展开。
SmartScan/Form/FrmDrawText.Designer.cs
查看文件 @
2f57541
...
...
@@ -72,7 +72,7 @@
this
.
Controls
.
Add
(
this
.
faceButton1
);
this
.
Icon
=
((
System
.
Drawing
.
Bitmap
)(
resources
.
GetObject
(
"$this.Icon"
)));
this
.
Name
=
"FrmDrawText"
;
this
.
Text
=
"Using OCR
r
esult"
;
this
.
Text
=
"Using OCR
R
esult"
;
this
.
Controls
.
SetChildIndex
(
this
.
faceButton1
,
0
);
this
.
Controls
.
SetChildIndex
(
this
.
faceButton2
,
0
);
this
.
ResumeLayout
(
false
);
...
...
SmartScan/Form/FrmRetrospect.Designer.cs
查看文件 @
2f57541
此文件的差异被折叠,
点击展开。
SmartScan/Form/FrmRetrospect.cs
查看文件 @
2f57541
...
...
@@ -125,6 +125,8 @@ namespace SmartScan
private
void
FrmRetrospect_Load
(
object
sender
,
EventArgs
e
)
{
int
SH
=
Screen
.
PrimaryScreen
.
Bounds
.
Height
;
//1080
int
SW
=
Screen
.
PrimaryScreen
.
Bounds
.
Width
;
//1920
...
...
@@ -137,11 +139,12 @@ namespace SmartScan
DtpUpper
.
Value
=
DateTime
.
Now
.
Date
;
tableLayoutPanel1
.
Width
=
this
.
Width
-
20
;
tableLayoutPanel1
.
Height
=
this
.
Height
-
60
;
if
(
ConfigHelper
.
Config
.
Get
(
"Display_EnableGetData"
,
"1181"
)
==
"1181"
)
if
(
ConfigHelper
.
Config
.
Get
(
"Display_EnableGetData"
,
"1181"
)
==
"1181"
)
{
butt_startserver
.
Visible
=
true
;
}
this
.
StartPosition
=
FormStartPosition
.
CenterScreen
;
}
private
void
BtnSelect_Click
(
object
sender
,
EventArgs
e
)
...
...
SmartScan/Language/en-US.lngres
查看文件 @
2f57541
...
...
@@ -22,7 +22,7 @@ Dialog_RepeatPrint 该料盘标签已打印 The Label Has Been Printed
Dialog_MaterialScanning 拍照识别... In Recognition...
Dialog_MaterialTemplateMatching 模版匹配... Template Matching...
Dialog_MaterialProcessing 计算结果... Processing Results...
Dialog_PleaseWaiting 请稍后... Please Wait
ing
...
Dialog_PleaseWaiting 请稍后... Please Wait...
Dialog_MatchType_max 匹配数量至多 Match Times At Most
Dialog_MatchType_equals 匹配数量等于 Match Times Equals
Dialog_MatchType_min 匹配数量至少 Match Times At Least
...
...
@@ -158,11 +158,11 @@ UsrMaterialTemplate_pnlCodeOp 条码操作 Barcode Operation Arial,12,,
UsrMaterialTemplate_pnlImg 图片 Image Arial,12,,
UsrMaterialTemplate_pnlImgOp 图片操作 Image Operation Arial,12,,
UsrDataSource_UsrDataSource
UsrDataSource_ChkRecursive 遍历同目录
Traversal Same Catalogue
Arial,12,,
UsrDataSource_groupBox_lblkey 标签可用字段
Label Available Fields
Arial,12,,
UsrDataSource_ChkRecursive 遍历同目录
All files under current folder
Arial,12,,
UsrDataSource_groupBox_lblkey 标签可用字段
Data string in the label
Arial,12,,
UsrDataSource_BtnSelectFile 选择文件 Select File Arial,12,,
UsrDataSource_faceLabel2 关键字匹配数据标题 Keyword
Matches The Data Title
Arial,12,,
UsrDataSource_faceLabel1 识别关键词
Identify Keywor
d Arial,12,,
UsrDataSource_faceLabel2 关键字匹配数据标题 Keyword
s head
Arial,12,,
UsrDataSource_faceLabel1 识别关键词
Keywords capture
d Arial,12,,
UsrDataSource_LblFilestatus 文件状态: File Status: Arial,12,,
UsrDataSource_LblContent 标签数据源 Label Data Source Arial,12,,
UsrMacro_UsrMacro
...
...
@@ -264,3 +264,7 @@ UsrKeywordlabeling_UpdateLabel 修改关键字 Modify keywords Arial,12,,
UsrKeywordlabeling_SaveLabel 确认 Confirm Arial,12,,
FrmKeyCollection_FrmKeyCollection 选择关键字 Select keywords Arial,12,,
FrmKeyCollection_faceButton1 确认 Confirm Arial,12,,
FrmDataFilePreview_BtnCancel 取消 Cancel 微软雅黑,12,,
FrmDataFilePreview_BtnOK 确认 OK 微软雅黑,12,,
FrmDataFilePreview_LblEncoding 编码格式 Encoding Format 微软雅黑,12,,
FrmDataFilePreview_FrmDataFilePreview 文件预览 File Preview 微软雅黑,12,,
SmartScan/Language/zh-CN.lngres
查看文件 @
2f57541
...
...
@@ -263,3 +263,8 @@ UsrKeywordlabeling_UpdateLabel 修改关键字 修改关键字 微软雅黑,12,,
UsrKeywordlabeling_SaveLabel 确认 确认 微软雅黑,12,,
FrmKeyCollection_FrmKeyCollection 选择关键字 选择关键字 微软雅黑,12,,
FrmKeyCollection_faceButton1 确认 确认 微软雅黑,12,,
FrmDataFilePreview_BtnCancel 取消 取消 微软雅黑,12,,
FrmDataFilePreview_BtnOK 确认 确认 微软雅黑,12,,
FrmDataFilePreview_LblEncoding 编码格式 编码格式 微软雅黑,12,,
FrmDataFilePreview_FrmDataFilePreview 文件预览 文件预览 微软雅黑,12,,
SmartScan/PlusSettingFrm/UsrKeywordlabeling.cs
查看文件 @
2f57541
...
...
@@ -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/ScanWork.cs
查看文件 @
2f57541
...
...
@@ -338,7 +338,8 @@ namespace SmartScan
private
void
SetKey
(
bool
hasMatch
)
{
LogNet
.
log
.
Info
(
"Work SetKey hasMatch:"
+
hasMatch
);
//if (workCodeKeyword.Count == 0){ return;}
//if (workCodeKeyword.Count == 0){ return;}
//if(hasMatch)
BLLCommon
.
extension
.
SetKey
(
originalCodeText
,
workCodeKeyword
,
hasMatch
,
out
_
);
if
(
workCodeKeyword
.
Any
(
a
=>
a
.
Value
.
StartsWith
(
"<OCR>"
)))
{
...
...
SmartScan/SetControl/FrmDataFilePreview.Designer.cs
查看文件 @
2f57541
...
...
@@ -87,10 +87,10 @@ namespace SmartScan
this
.
LblEncoding
.
BorderStyle
=
Asa
.
FaceControl
.
ControlShape
.
Rectangle
;
this
.
LblEncoding
.
BorderWidth
=
0
;
this
.
LblEncoding
.
ForeColor
=
System
.
Drawing
.
Color
.
FromArgb
(((
int
)(((
byte
)(
230
)))),
((
int
)(((
byte
)(
230
)))),
((
int
)(((
byte
)(
230
)))));
this
.
LblEncoding
.
Location
=
new
System
.
Drawing
.
Point
(
354
,
44
);
this
.
LblEncoding
.
Location
=
new
System
.
Drawing
.
Point
(
211
,
44
);
this
.
LblEncoding
.
Name
=
"LblEncoding"
;
this
.
LblEncoding
.
Padding
=
new
System
.
Windows
.
Forms
.
Padding
(
3
);
this
.
LblEncoding
.
Size
=
new
System
.
Drawing
.
Size
(
139
,
35
);
this
.
LblEncoding
.
Size
=
new
System
.
Drawing
.
Size
(
282
,
35
);
this
.
LblEncoding
.
TabIndex
=
22
;
this
.
LblEncoding
.
Text
=
"编码格式"
;
this
.
LblEncoding
.
TextAlign
=
System
.
Drawing
.
ContentAlignment
.
MiddleRight
;
...
...
SmartScan/SetControl/FrmDataFilePreview.cs
查看文件 @
2f57541
...
...
@@ -25,6 +25,8 @@ namespace SmartScan
FrmDataFilePreview
frmDataFile
=
new
FrmDataFilePreview
();
frmDataFile
.
Filename
=
filename
;
Encodingtxt
=
frmDataFile
.
EncodingTxt
;
Asa
.
FaceControl
.
Language
.
SetLanguage
(
frmDataFile
);
if
(
frmDataFile
.
ShowDialog
()
!=
DialogResult
.
OK
)
return
false
;
...
...
SmartScan/SetControl/UsrCodeExtractList.Designer.cs
查看文件 @
2f57541
此文件的差异被折叠,
点击展开。
SmartScan/SetControl/UsrCodeExtractList.cs
查看文件 @
2f57541
...
...
@@ -26,7 +26,6 @@ namespace SmartScan
changed
=
true
;
Language
.
SetLanguage
(
this
);
this
.
codeText
=
codeText
;
this
.
codeType
=
codeType
;
CboKeyword
.
Items
.
AddRange
(
BLLCommon
.
macroKey
.
ToArray
());
...
...
SmartScan/SetControl/UsrDataSource.Designer.cs
查看文件 @
2f57541
此文件的差异被折叠,
点击展开。
SmartScan/SetControl/UsrPrintTemplate.Designer.cs
查看文件 @
2f57541
此文件的差异被折叠,
点击展开。
SmartScan/WebCallWork.cs
查看文件 @
2f57541
...
...
@@ -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
请
注册
或
登录
后发表评论