Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
张东亮
/
NS100
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit a372778e
由
贾鹏旭
编写于
2023-09-22 13:38:03 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
1.提取功能显示白底黑字
2.隐藏字符的转换ascii
1 个父辈
76c15bc5
显示空白字符变更
内嵌
并排
正在显示
8 个修改的文件
包含
226 行增加
和
32 行删除
BLL/AsciiToCharReplacer.cs
BLL/BLL.csproj
SmartScan/Form/FrmCodeExtract.Designer.cs
SmartScan/Form/FrmCodeExtract.cs
SmartScan/Form/FrmCodeOCR.cs
SmartScan/Program.cs
SmartScan/SetControl/UsrCodeExtractList.cs
SmartScan/SetControl/UsrMaterialTemplate.cs
BLL/AsciiToCharReplacer.cs
0 → 100644
查看文件 @
a372778
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Text
;
using
System.Threading.Tasks
;
namespace
BLL
{
public
class
AsciiToCharReplacer
{
Dictionary
<
int
,
string
>
asciiToMCS
=
new
Dictionary
<
int
,
string
>
{
{
0
,
"NUL"
},
// 空字符(Null)
{
1
,
"SOH"
},
// 报头开始(Start of Heading)
{
2
,
"STX"
},
// 正文开始(Start of Text)
{
3
,
"ETX"
},
// 正文结束(End of Text)
{
4
,
"EOT"
},
// 传输结束(End of Transmission)
{
5
,
"ENQ"
},
// 请求(Enquiry)
{
6
,
"ACK"
},
// 确认(Acknowledge)
{
7
,
"BEL"
},
// 响铃(Bell)
{
8
,
"BS"
},
// 退格(Backspace)
{
9
,
"HT"
},
// 水平制表符(Horizontal Tab)
{
10
,
"LF"
},
// 换行符(Line Feed)
{
11
,
"VT"
},
// 垂直制表符(Vertical Tab)
{
12
,
"FF"
},
// 换页符(Form Feed)
{
13
,
"CR"
},
// 回车符(Carriage Return)
{
14
,
"SO"
},
// 转义开始(Shift Out)
{
15
,
"SI"
},
// 转义结束(Shift In)
{
16
,
"DLE"
},
// 数据链路转义(Data Link Escape)
{
17
,
"DC1"
},
// 设备控制1(Device Control 1)
{
18
,
"DC2"
},
// 设备控制2(Device Control 2)
{
19
,
"DC3"
},
// 设备控制3(Device Control 3)
{
20
,
"DC4"
},
// 设备控制4(Device Control 4)
{
21
,
"NAK"
},
// 拒绝接收(Negative Acknowledgment)
{
22
,
"SYN"
},
// 同步空闲(Synchronous Idle)
{
23
,
"ETB"
},
// 传输块结束(End of Transmission Block)
{
24
,
"CAN"
},
// 取消(Cancel)
{
25
,
"EM"
},
// 媒介结束(End of Medium)
{
26
,
"SUB"
},
// 替代(Substitute)
{
27
,
"ESC"
},
// 转义(Escape)
{
28
,
"FS"
},
// 文件分隔符(File Separator)
{
29
,
"GS"
},
// 组分隔符(Group Separator)
{
30
,
"RS"
},
// 记录分隔符(Record Separator)
{
31
,
"US"
},
// 单元分隔符(Unit Separator)
{
32
,
"SP"
},
// 空格(Space)
{
33
,
"!"
},
// 感叹号
{
34
,
"\""
},
// 双引号
{
35
,
"#"
},
// 井号
{
36
,
"$"
},
// 美元符号
{
37
,
"%"
},
// 百分号
{
38
,
"&"
},
// 和号
{
39
,
"'"
},
// 单引号
{
40
,
"("
},
// 左括号
{
41
,
")"
},
// 右括号
{
42
,
"*"
},
// 星号
{
43
,
"+"
},
// 加号
{
44
,
","
},
// 逗号
{
45
,
"-"
},
// 减号
{
46
,
"."
},
// 句号
{
47
,
"/"
},
// 斜杠
{
48
,
"0"
},
// 数字0
{
49
,
"1"
},
// 数字1
{
50
,
"2"
},
// 数字2
{
51
,
"3"
},
// 数字3
{
52
,
"4"
},
// 数字4
{
53
,
"5"
},
// 数字5
{
54
,
"6"
},
// 数字6
{
55
,
"7"
},
// 数字7
{
56
,
"8"
},
// 数字8
{
57
,
"9"
},
// 数字9
{
58
,
":"
},
// 冒号
{
59
,
";"
},
// 分号
{
60
,
"<"
},
// 小于号
{
61
,
"="
},
// 等于号
{
62
,
">"
},
// 大于号
{
63
,
"?"
}
// 问号
};
/// <summary>
/// 将string字符中的隐藏字符显示为ascii码
/// </summary>
/// <returns></returns>
public
string
StringToAscii
(
string
str
,
out
string
[]
strings
)
{
List
<
string
>
result
=
new
List
<
string
>();
foreach
(
var
kvp
in
asciiToMCS
)
{
string
formattedValue
=
$
"[{kvp.Value}]"
;
result
.
Add
(
formattedValue
);
}
// 将结果转换为字符串数组
strings
=
result
.
ToArray
();
string
output
=
""
;
foreach
(
char
car
in
str
)
{
if
(
char
.
IsControl
(
car
))
{
int
i
=
car
;
output
+=
$
"[{asciiToMCS[i]}]"
;
}
else
{
output
+=
car
.
ToString
();
}
}
return
output
;
}
public
string
AsciiToString
(
string
str
)
{
string
outup
=
str
;
foreach
(
var
kvp
in
asciiToMCS
)
{
outup
=
outup
.
Replace
(
$
"[{kvp.Value}]"
,
((
char
)
kvp
.
Key
).
ToString
());
}
return
outup
;
}
}
}
BLL/BLL.csproj
查看文件 @
a372778
...
@@ -97,6 +97,7 @@
...
@@ -97,6 +97,7 @@
</Reference>
</Reference>
</ItemGroup>
</ItemGroup>
<ItemGroup>
<ItemGroup>
<Compile Include="AsciiToCharReplacer.cs" />
<Compile Include="BLLCommon.cs" />
<Compile Include="BLLCommon.cs" />
<Compile Include="Config.cs" />
<Compile Include="Config.cs" />
<Compile Include="ConvertBarcode.cs" />
<Compile Include="ConvertBarcode.cs" />
...
...
SmartScan/Form/FrmCodeExtract.Designer.cs
查看文件 @
a372778
...
@@ -29,7 +29,6 @@ namespace SmartScan
...
@@ -29,7 +29,6 @@ namespace SmartScan
/// </summary>
/// </summary>
private
void
InitializeComponent
()
private
void
InitializeComponent
()
{
{
this
.
LblCode
=
new
Asa
.
FaceControl
.
FaceLabel
();
this
.
BtnOK
=
new
Asa
.
FaceControl
.
FaceButton
();
this
.
BtnOK
=
new
Asa
.
FaceControl
.
FaceButton
();
this
.
BtnCancel
=
new
Asa
.
FaceControl
.
FaceButton
();
this
.
BtnCancel
=
new
Asa
.
FaceControl
.
FaceButton
();
this
.
PnlTemp
=
new
Asa
.
FaceControl
.
FacePanel
();
this
.
PnlTemp
=
new
Asa
.
FaceControl
.
FacePanel
();
...
@@ -53,6 +52,7 @@ namespace SmartScan
...
@@ -53,6 +52,7 @@ namespace SmartScan
this
.
tableLayoutPanel2
=
new
System
.
Windows
.
Forms
.
TableLayoutPanel
();
this
.
tableLayoutPanel2
=
new
System
.
Windows
.
Forms
.
TableLayoutPanel
();
this
.
tableLayoutPanel3
=
new
System
.
Windows
.
Forms
.
TableLayoutPanel
();
this
.
tableLayoutPanel3
=
new
System
.
Windows
.
Forms
.
TableLayoutPanel
();
this
.
tableLayoutPanel4
=
new
System
.
Windows
.
Forms
.
TableLayoutPanel
();
this
.
tableLayoutPanel4
=
new
System
.
Windows
.
Forms
.
TableLayoutPanel
();
this
.
richTextBox1
=
new
System
.
Windows
.
Forms
.
RichTextBox
();
this
.
pnlMatch
.
SuspendLayout
();
this
.
pnlMatch
.
SuspendLayout
();
this
.
tableLayoutPanel1
.
SuspendLayout
();
this
.
tableLayoutPanel1
.
SuspendLayout
();
this
.
pnlRawCode
.
SuspendLayout
();
this
.
pnlRawCode
.
SuspendLayout
();
...
@@ -62,26 +62,6 @@ namespace SmartScan
...
@@ -62,26 +62,6 @@ namespace SmartScan
this
.
tableLayoutPanel4
.
SuspendLayout
();
this
.
tableLayoutPanel4
.
SuspendLayout
();
this
.
SuspendLayout
();
this
.
SuspendLayout
();
//
//
// LblCode
//
this
.
LblCode
.
Anchor
=
((
System
.
Windows
.
Forms
.
AnchorStyles
)((((
System
.
Windows
.
Forms
.
AnchorStyles
.
Top
|
System
.
Windows
.
Forms
.
AnchorStyles
.
Bottom
)
|
System
.
Windows
.
Forms
.
AnchorStyles
.
Left
)
|
System
.
Windows
.
Forms
.
AnchorStyles
.
Right
)));
this
.
LblCode
.
AutoScroll
=
true
;
this
.
LblCode
.
AutoSize
=
true
;
this
.
LblCode
.
BackColor
=
System
.
Drawing
.
Color
.
FromArgb
(((
int
)(((
byte
)(
20
)))),
((
int
)(((
byte
)(
20
)))),
((
int
)(((
byte
)(
20
)))));
this
.
LblCode
.
BorderStyle
=
Asa
.
FaceControl
.
ControlShape
.
Rectangle
;
this
.
LblCode
.
BorderWidth
=
2
;
this
.
LblCode
.
Font
=
new
System
.
Drawing
.
Font
(
"宋体"
,
11F
);
this
.
LblCode
.
ForeColor
=
System
.
Drawing
.
Color
.
FromArgb
(((
int
)(((
byte
)(
230
)))),
((
int
)(((
byte
)(
230
)))),
((
int
)(((
byte
)(
230
)))));
this
.
LblCode
.
Location
=
new
System
.
Drawing
.
Point
(
3
,
38
);
this
.
LblCode
.
Name
=
"LblCode"
;
this
.
LblCode
.
Padding
=
new
System
.
Windows
.
Forms
.
Padding
(
3
);
this
.
LblCode
.
Size
=
new
System
.
Drawing
.
Size
(
691
,
453
);
this
.
LblCode
.
TabIndex
=
6
;
this
.
LblCode
.
Text
=
"faceLabel1"
;
this
.
LblCode
.
TextAlign
=
System
.
Drawing
.
ContentAlignment
.
TopLeft
;
//
// BtnOK
// BtnOK
//
//
this
.
BtnOK
.
Anchor
=
((
System
.
Windows
.
Forms
.
AnchorStyles
)((
System
.
Windows
.
Forms
.
AnchorStyles
.
Bottom
|
System
.
Windows
.
Forms
.
AnchorStyles
.
Right
)));
this
.
BtnOK
.
Anchor
=
((
System
.
Windows
.
Forms
.
AnchorStyles
)((
System
.
Windows
.
Forms
.
AnchorStyles
.
Bottom
|
System
.
Windows
.
Forms
.
AnchorStyles
.
Right
)));
...
@@ -416,7 +396,7 @@ namespace SmartScan
...
@@ -416,7 +396,7 @@ namespace SmartScan
this
.
pnlRawCode
.
BackColor
=
System
.
Drawing
.
Color
.
FromArgb
(((
int
)(((
byte
)(
20
)))),
((
int
)(((
byte
)(
20
)))),
((
int
)(((
byte
)(
20
)))));
this
.
pnlRawCode
.
BackColor
=
System
.
Drawing
.
Color
.
FromArgb
(((
int
)(((
byte
)(
20
)))),
((
int
)(((
byte
)(
20
)))),
((
int
)(((
byte
)(
20
)))));
this
.
pnlRawCode
.
BorderStyle
=
Asa
.
FaceControl
.
ControlShape
.
Rectangle
;
this
.
pnlRawCode
.
BorderStyle
=
Asa
.
FaceControl
.
ControlShape
.
Rectangle
;
this
.
pnlRawCode
.
BorderWidth
=
2
;
this
.
pnlRawCode
.
BorderWidth
=
2
;
this
.
pnlRawCode
.
Controls
.
Add
(
this
.
LblCode
);
this
.
pnlRawCode
.
Controls
.
Add
(
this
.
richTextBox1
);
this
.
pnlRawCode
.
Dock
=
System
.
Windows
.
Forms
.
DockStyle
.
Fill
;
this
.
pnlRawCode
.
Dock
=
System
.
Windows
.
Forms
.
DockStyle
.
Fill
;
this
.
pnlRawCode
.
ForeColor
=
System
.
Drawing
.
Color
.
FromArgb
(((
int
)(((
byte
)(
230
)))),
((
int
)(((
byte
)(
230
)))),
((
int
)(((
byte
)(
230
)))));
this
.
pnlRawCode
.
ForeColor
=
System
.
Drawing
.
Color
.
FromArgb
(((
int
)(((
byte
)(
230
)))),
((
int
)(((
byte
)(
230
)))),
((
int
)(((
byte
)(
230
)))));
this
.
pnlRawCode
.
Location
=
new
System
.
Drawing
.
Point
(
3
,
3
);
this
.
pnlRawCode
.
Location
=
new
System
.
Drawing
.
Point
(
3
,
3
);
...
@@ -492,6 +472,18 @@ namespace SmartScan
...
@@ -492,6 +472,18 @@ namespace SmartScan
this
.
tableLayoutPanel4
.
Size
=
new
System
.
Drawing
.
Size
(
703
,
777
);
this
.
tableLayoutPanel4
.
Size
=
new
System
.
Drawing
.
Size
(
703
,
777
);
this
.
tableLayoutPanel4
.
TabIndex
=
33
;
this
.
tableLayoutPanel4
.
TabIndex
=
33
;
//
//
// richTextBox1
//
this
.
richTextBox1
.
BackColor
=
System
.
Drawing
.
Color
.
FromArgb
(((
int
)(((
byte
)(
20
)))),
((
int
)(((
byte
)(
20
)))),
((
int
)(((
byte
)(
20
)))));
this
.
richTextBox1
.
Dock
=
System
.
Windows
.
Forms
.
DockStyle
.
Fill
;
this
.
richTextBox1
.
Font
=
new
System
.
Drawing
.
Font
(
"宋体"
,
10.8F
,
System
.
Drawing
.
FontStyle
.
Regular
,
System
.
Drawing
.
GraphicsUnit
.
Point
,
((
byte
)(
134
)));
this
.
richTextBox1
.
ForeColor
=
System
.
Drawing
.
SystemColors
.
Menu
;
this
.
richTextBox1
.
Location
=
new
System
.
Drawing
.
Point
(
3
,
3
);
this
.
richTextBox1
.
Name
=
"richTextBox1"
;
this
.
richTextBox1
.
Size
=
new
System
.
Drawing
.
Size
(
691
,
488
);
this
.
richTextBox1
.
TabIndex
=
7
;
this
.
richTextBox1
.
Text
=
"weqw"
;
//
// FrmCodeExtract
// FrmCodeExtract
//
//
this
.
AutoScaleDimensions
=
new
System
.
Drawing
.
SizeF
(
8F
,
15F
);
this
.
AutoScaleDimensions
=
new
System
.
Drawing
.
SizeF
(
8F
,
15F
);
...
@@ -510,7 +502,6 @@ namespace SmartScan
...
@@ -510,7 +502,6 @@ namespace SmartScan
this
.
pnlMatch
.
ResumeLayout
(
false
);
this
.
pnlMatch
.
ResumeLayout
(
false
);
this
.
tableLayoutPanel1
.
ResumeLayout
(
false
);
this
.
tableLayoutPanel1
.
ResumeLayout
(
false
);
this
.
pnlRawCode
.
ResumeLayout
(
false
);
this
.
pnlRawCode
.
ResumeLayout
(
false
);
this
.
pnlRawCode
.
PerformLayout
();
this
.
pnlKeywords
.
ResumeLayout
(
false
);
this
.
pnlKeywords
.
ResumeLayout
(
false
);
this
.
tableLayoutPanel2
.
ResumeLayout
(
false
);
this
.
tableLayoutPanel2
.
ResumeLayout
(
false
);
this
.
tableLayoutPanel3
.
ResumeLayout
(
false
);
this
.
tableLayoutPanel3
.
ResumeLayout
(
false
);
...
@@ -520,8 +511,6 @@ namespace SmartScan
...
@@ -520,8 +511,6 @@ namespace SmartScan
}
}
#
endregion
#
endregion
private
Asa
.
FaceControl
.
FaceLabel
LblCode
;
private
Asa
.
FaceControl
.
FaceButton
BtnOK
;
private
Asa
.
FaceControl
.
FaceButton
BtnOK
;
private
Asa
.
FaceControl
.
FaceButton
BtnCancel
;
private
Asa
.
FaceControl
.
FaceButton
BtnCancel
;
private
Asa
.
FaceControl
.
FacePanel
PnlTemp
;
private
Asa
.
FaceControl
.
FacePanel
PnlTemp
;
...
@@ -545,5 +534,6 @@ namespace SmartScan
...
@@ -545,5 +534,6 @@ namespace SmartScan
private
System
.
Windows
.
Forms
.
TableLayoutPanel
tableLayoutPanel2
;
private
System
.
Windows
.
Forms
.
TableLayoutPanel
tableLayoutPanel2
;
private
System
.
Windows
.
Forms
.
TableLayoutPanel
tableLayoutPanel3
;
private
System
.
Windows
.
Forms
.
TableLayoutPanel
tableLayoutPanel3
;
private
System
.
Windows
.
Forms
.
TableLayoutPanel
tableLayoutPanel4
;
private
System
.
Windows
.
Forms
.
TableLayoutPanel
tableLayoutPanel4
;
private
System
.
Windows
.
Forms
.
RichTextBox
richTextBox1
;
}
}
}
}
\ No newline at end of file
\ No newline at end of file
SmartScan/Form/FrmCodeExtract.cs
查看文件 @
a372778
...
@@ -23,7 +23,9 @@ namespace SmartScan
...
@@ -23,7 +23,9 @@ namespace SmartScan
int
windowHeight
=
0
;
int
windowHeight
=
0
;
MaterialCodeMatch
matchShared
=
new
MaterialCodeMatch
();
MaterialCodeMatch
matchShared
=
new
MaterialCodeMatch
();
public
FrmCodeExtract
(
string
codeText
,
int
codeID
,
string
codeType
,
List
<
MaterialCodeMatch
>
match
)
string
[]
myStringArray
=
null
;
public
FrmCodeExtract
(
string
codeText
,
int
codeID
,
string
codeType
,
List
<
MaterialCodeMatch
>
match
,
string
[]
strings
)
{
{
InitializeComponent
();
InitializeComponent
();
windowHeight
=
this
.
Height
;
windowHeight
=
this
.
Height
;
...
@@ -60,6 +62,8 @@ namespace SmartScan
...
@@ -60,6 +62,8 @@ namespace SmartScan
Btn_Click
(
matchButton
.
ElementAt
(
0
).
Key
,
EventArgs
.
Empty
);
Btn_Click
(
matchButton
.
ElementAt
(
0
).
Key
,
EventArgs
.
Empty
);
else
else
BtnAddMatch_Click
(
null
,
EventArgs
.
Empty
);
BtnAddMatch_Click
(
null
,
EventArgs
.
Empty
);
myStringArray
=
strings
;
}
}
public
List
<
MaterialCodeMatch
>
CodeMatch
{
get
;
private
set
;
}
public
List
<
MaterialCodeMatch
>
CodeMatch
{
get
;
private
set
;
}
...
@@ -297,12 +301,71 @@ namespace SmartScan
...
@@ -297,12 +301,71 @@ namespace SmartScan
{
{
DialogResult
=
DialogResult
.
Cancel
;
DialogResult
=
DialogResult
.
Cancel
;
}
}
private
void
FrmCodeExtract_Load
(
object
sender
,
EventArgs
e
)
private
void
FrmCodeExtract_Load
(
object
sender
,
EventArgs
e
)
{
{
LblCode
.
Text
=
codeText
;
//LblCode.Text = codeText;
richTextBox1
.
Text
=
codeText
;
//ColorizeText(myStringArray, Color.Red);
ColorizeText
(
myStringArray
);
}
//修改richTextBox1 字体颜色
private
void
ColorizeText
(
string
[]
keywords
,
Color
color
)
{
// 清除已经存在的颜色标记
//richTextBox1.SelectAll();
//richTextBox1.SelectionColor = Color.Black;
foreach
(
string
keyword
in
keywords
)
{
int
startIndex
=
0
;
while
(
startIndex
<
richTextBox1
.
TextLength
)
{
int
wordStartIndex
=
richTextBox1
.
Find
(
keyword
,
startIndex
,
RichTextBoxFinds
.
None
);
if
(
wordStartIndex
==
-
1
)
{
break
;
}
richTextBox1
.
SelectionStart
=
wordStartIndex
;
richTextBox1
.
SelectionLength
=
keyword
.
Length
;
richTextBox1
.
SelectionColor
=
color
;
// 设置关键字的颜色
startIndex
=
wordStartIndex
+
keyword
.
Length
;
}
}
}
}
//将匹配的字符修改为白底黑字
private
void
ColorizeText
(
string
[]
keywords
)
{
foreach
(
string
keyword
in
keywords
)
{
int
startIndex
=
0
;
while
(
startIndex
<
richTextBox1
.
TextLength
)
{
int
wordStartIndex
=
richTextBox1
.
Find
(
keyword
,
startIndex
,
RichTextBoxFinds
.
None
);
if
(
wordStartIndex
==
-
1
)
{
break
;
}
richTextBox1
.
SelectionStart
=
wordStartIndex
;
richTextBox1
.
SelectionLength
=
keyword
.
Length
;
richTextBox1
.
SelectionBackColor
=
Color
.
AliceBlue
;
// 设置关键字的背景颜色
// 使用稍浅的白色作为背景颜色
//Color slightlyLighterWhite = ControlPaint.Light(Color.White);
//richTextBox1.SelectionBackColor = slightlyLighterWhite;
richTextBox1
.
SelectionColor
=
Color
.
Black
;
// 设置关键字的字体颜色
startIndex
=
wordStartIndex
+
keyword
.
Length
;
}
}
}
private
void
matchChanged
(
object
sender
,
EventArgs
e
)
private
void
matchChanged
(
object
sender
,
EventArgs
e
)
{
{
lblMatchRes
.
Invoke
(
new
Action
(()
=>
lblMatchRes
.
Invoke
(
new
Action
(()
=>
...
...
SmartScan/Form/FrmCodeOCR.cs
查看文件 @
a372778
...
@@ -367,7 +367,8 @@ namespace SmartScan
...
@@ -367,7 +367,8 @@ namespace SmartScan
{
{
if
(
ocrRectIndex
==
-
1
)
return
;
if
(
ocrRectIndex
==
-
1
)
return
;
List
<
MaterialCodeMatch
>
match
=
codeMatch
.
FindAll
(
s
=>
s
.
CodeID
==
codeOcr
[
ocrRectIndex
].
ID
);
List
<
MaterialCodeMatch
>
match
=
codeMatch
.
FindAll
(
s
=>
s
.
CodeID
==
codeOcr
[
ocrRectIndex
].
ID
);
FrmCodeExtract
frm
=
new
(
codeOcr
[
ocrRectIndex
].
Text
,
codeOcr
[
ocrRectIndex
].
ID
,
"OCR"
,
match
);
//codeOcr[ocrRectIndex].Text
string
[]
stringq
=
null
;
FrmCodeExtract
frm
=
new
(
codeOcr
[
ocrRectIndex
].
Text
,
codeOcr
[
ocrRectIndex
].
ID
,
"OCR"
,
match
,
stringq
);
//codeOcr[ocrRectIndex].Text
DialogResult
dr
=
frm
.
ShowDialog
();
DialogResult
dr
=
frm
.
ShowDialog
();
if
(
dr
==
DialogResult
.
OK
)
if
(
dr
==
DialogResult
.
OK
)
{
{
...
...
SmartScan/Program.cs
查看文件 @
a372778
SmartScan/SetControl/UsrCodeExtractList.cs
查看文件 @
a372778
using
Asa.FaceControl
;
using
Asa.FaceControl
;
using
BLL
;
using
BLL
;
using
DocumentFormat.OpenXml.EMMA
;
using
Model
;
using
Model
;
using
System
;
using
System
;
using
System.Collections.Generic
;
using
System.Windows.Forms
;
using
System.Windows.Forms
;
namespace
SmartScan
namespace
SmartScan
...
@@ -94,7 +96,9 @@ namespace SmartScan
...
@@ -94,7 +96,9 @@ namespace SmartScan
public
void
ShowPreview
(
string
txt
=
""
)
public
void
ShowPreview
(
string
txt
=
""
)
{
{
if
(
changed
)
return
;
if
(
changed
)
return
;
string
text
=
codeText
;
AsciiToCharReplacer
asciiToChar
=
new
AsciiToCharReplacer
();
string
text
=
asciiToChar
.
AsciiToString
(
codeText
);
//if (ChkMatchingMiddle.Checked) {
//if (ChkMatchingMiddle.Checked) {
// int textcount=1;
// int textcount=1;
...
@@ -123,7 +127,13 @@ namespace SmartScan
...
@@ -123,7 +127,13 @@ namespace SmartScan
if
(
ChkMatchingSplit
.
Checked
)
if
(
ChkMatchingSplit
.
Checked
)
{
{
string
str
=
Model
.
MaterialAsciiCode
.
GetAsciiCode
(
CboMatchingSplit
.
Text
);
string
str
=
Model
.
MaterialAsciiCode
.
GetAsciiCode
(
CboMatchingSplit
.
Text
);
string
[]
arr
=
codeText
.
Split
(
new
string
[]
{
str
},
StringSplitOptions
.
RemoveEmptyEntries
);
//string outup = codeText;
//AsciiToCharReplacer asciiToChar = new AsciiToCharReplacer();
//outup= asciiToChar.AsciiToString(outup);
string
[]
arr
=
text
.
Split
(
new
string
[]
{
str
},
StringSplitOptions
.
RemoveEmptyEntries
);
//string[] arr = codeText.Split(new string[] { str }, StringSplitOptions.RemoveEmptyEntries);
int
index
=
Convert
.
ToInt32
(
NudSplitPart
.
Value
)
-
1
;
int
index
=
Convert
.
ToInt32
(
NudSplitPart
.
Value
)
-
1
;
if
(
index
<
arr
.
Length
)
if
(
index
<
arr
.
Length
)
text
=
arr
[
index
];
text
=
arr
[
index
];
...
...
SmartScan/SetControl/UsrMaterialTemplate.cs
查看文件 @
a372778
...
@@ -307,8 +307,16 @@ namespace SmartScan
...
@@ -307,8 +307,16 @@ namespace SmartScan
}
}
MaterialCode
code
=
mateCopy
[
mateIndex
].
Code
[
codeIndex
];
MaterialCode
code
=
mateCopy
[
mateIndex
].
Code
[
codeIndex
];
AsciiToCharReplacer
asciiControl
=
new
AsciiToCharReplacer
();
string
[]
strings
=
null
;
string
codestring
=
asciiControl
.
StringToAscii
(
code
.
Text
,
out
strings
);
List
<
MaterialCodeMatch
>
match
=
mateCopy
[
mateIndex
].
Match
.
FindAll
(
s
=>
s
.
CodeID
==
code
.
ID
);
List
<
MaterialCodeMatch
>
match
=
mateCopy
[
mateIndex
].
Match
.
FindAll
(
s
=>
s
.
CodeID
==
code
.
ID
);
FrmCodeExtract
frm
=
new
(
code
.
Text
.
Replace
(
" "
,
""
),
code
.
ID
,
code
.
CodeType
,
match
);
//如果使用新方法识别ocr,去除空格
if
(
code
.
CodeType
==
"OCR"
&&
codestring
==
"http://localhost:8090/paddle/SelectOcrMethod"
)
{
codestring
=
code
.
Text
.
Replace
(
" "
,
""
);
}
FrmCodeExtract
frm
=
new
(
codestring
,
code
.
ID
,
code
.
CodeType
,
match
,
strings
);
DialogResult
dr
=
frm
.
ShowDialog
();
DialogResult
dr
=
frm
.
ShowDialog
();
if
(
dr
==
DialogResult
.
OK
)
if
(
dr
==
DialogResult
.
OK
)
{
{
...
...
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论