Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
张东亮
/
NS100
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit 37eab955
由
贾鹏旭
编写于
2023-08-31 17:32:47 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
tmp
1 个父辈
8e47d0b4
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
55 行增加
和
47 行删除
BLL/Extension.cs
BLL/Extension/Item_General.cs
SmartScan/ScanWork.cs
BLL/Extension.cs
查看文件 @
37eab95
...
...
@@ -244,7 +244,10 @@ namespace BLL
{
return
currentExtension
.
SetKey
(
originalCode
,
key
,
hasMatch
,
out
errmsg
);
}
public
void
Print
()
{
//currentExtension.Printing
}
public
void
DrawTextBackground
(
Dictionary
<
string
,
string
>
key
)
{
currentExtension
.
DrawTextBackground
(
key
);
...
...
BLL/Extension/Item_General.cs
查看文件 @
37eab95
...
...
@@ -147,19 +147,20 @@ namespace BLL
return
false
;
Application
.
DoEvents
();
if
(
extensions
!=
null
&&
!
extensions
[
0
].
Control
.
InvokeRequired
)
{
if
(
config
.
AutoPrint
&&
hasMatch
)
{
//if (CanPrint())
PrintLabel
(
null
,
EventArgs
.
Empty
);
}
}
else
{
//PrintLabel(null, EventArgs.Empty);
}
SaveRetrospect
?.
Invoke
(
key
);
//if (extensions != null && !extensions[0].Control.InvokeRequired)
//{
// if ( && hasMatch)
// {
// //if (CanPrint())
// PrintLabel(null, EventArgs.Empty);
// }
//}
//else
//{
// //PrintLabel(null, EventArgs.Empty);
//}
SaveRetrospect
?.
Invoke
(
key
);
return
true
;
}
bool
updatereelid
(
Dictionary
<
string
,
string
>
key
,
out
string
errmsg
)
...
...
@@ -248,7 +249,7 @@ namespace BLL
try
{
var
reelidfile
=
FilePath
.
CONFIG_REELID
;
if
(
Config
.
REEL_ID_AutoResetStrategy
==
1
)
if
(
Config
.
REEL_ID_AutoResetStrategy
==
1
)
{
Directory
.
CreateDirectory
(
reelidfile
+
"_dir"
);
reelidfile
=
Path
.
Combine
(
FilePath
.
CONFIG_REELID
+
"_dir"
,
DateTime
.
Now
.
ToString
(
"yyyyMMdd"
));
...
...
@@ -285,8 +286,9 @@ namespace BLL
{
updatereelid
(
lastkey
,
out
_
);
}
p
rivate
void
PrintLabel
(
object
sender
,
EventArgs
e
)
p
ublic
void
PrintLabel
(
object
sender
,
EventArgs
e
)
{
if
(!
config
.
AutoPrint
)
return
;
LogNet
.
log
.
Debug
(
"Enter PrintLabel Method"
);
if
(
lastkey
==
null
)
return
;
//Dictionary<string, string> key = new();
...
...
@@ -368,7 +370,7 @@ namespace BLL
// 定义动态按钮点击事件处理方法
private
void
DynamicButtonClick
(
object
sender
,
EventArgs
e
)
{
var
listexten
=
extensions
.
Where
(
a
=>
a
.
Type
==
"TextBox"
).
ToDictionary
(
kvp
=>
kvp
.
Key
,
kvp
=>
kvp
.
Control
.
Text
);
var
listexten
=
extensions
.
Where
(
a
=>
a
.
Type
==
"TextBox"
).
ToDictionary
(
kvp
=>
kvp
.
Key
,
kvp
=>
kvp
.
Control
.
Text
);
string
jsondata
=
Replacekeywordss
(
listexten
);
ResponseDatas
lists
=
JsonConvert
.
DeserializeObject
<
ResponseDatas
>(
jsondata
);
foreach
(
var
responseItems
in
lists
.
Items
)
...
...
@@ -383,7 +385,7 @@ namespace BLL
}
//items.Control.Text = item.Value.ToString();
}
}
}
}
}
...
...
@@ -532,7 +534,7 @@ namespace BLL
//}
#
endregion
public
void
DrawTextBackground
(
Dictionary
<
string
,
string
>
key
)
public
void
DrawTextBackground
(
Dictionary
<
string
,
string
>
key
)
{
if
(
extensions
!=
null
&&
!
extensions
[
0
].
Control
.
InvokeRequired
)
{
...
...
@@ -544,7 +546,7 @@ namespace BLL
if
(
key
[
extensions
[
i
].
Key
].
StartsWith
(
"<OCR>"
))
{
extensions
[
i
].
Control
.
ForeColor
=
Color
.
Yellow
;
}
}
if
(!
focused
&&
key
[
extensions
[
i
].
Key
].
StartsWith
(
"<OCR>"
))
{
extensions
[
i
].
Control
.
Focus
();
...
...
SmartScan/ScanWork.cs
查看文件 @
37eab95
...
...
@@ -74,12 +74,13 @@ namespace SmartScan
if
(!
isRun
)
return
;
if
(
isTouch
)
return
;
isTouch
=
true
;
btnMatchedName
.
Invoke
(
delegate
()
{
btnMatchedName
.
Invoke
(
delegate
()
{
if
(!
BLL
.
Config
.
Backgrounder
)
btnMatchedName
.
Visible
=
false
;
BLLCommon
.
extension
.
Clear
();
});
});
var
t
=
Task
.
Run
(()
=>
{
try
...
...
@@ -88,7 +89,7 @@ namespace SmartScan
workCodeKeyword
=
new
(
StringComparer
.
OrdinalIgnoreCase
);
originalCodeText
=
null
;
originalCodeIsUsed
=
null
;
Common
.
frmMain
.
SetWaittingMsg
(
Language
.
Dialog
(
"MaterialScanning"
));
//拍照识别...
if
(!
GetCodeInfo
())
{
...
...
@@ -106,17 +107,29 @@ namespace SmartScan
Common
.
frmMain
.
Invoke
(
delegate
()
{
SetKey
(
hasMatch
);
Common
.
frmMain
.
Invoke
(
delegate
()
{
if
(
workCodeKeyword
.
Any
(
a
=>
a
.
Value
.
StartsWith
(
"<OCR>"
)))
{
FrmDrawText
frmDraw
=
new
FrmDrawText
();
if
(
frmDraw
.
ShowDialog
()
==
DialogResult
.
OK
)
{
BLLCommon
.
extension
.
pri
BLLCommon
.
extension
.
DrawTextBackground
(
workCodeKeyword
);
}
}
});
});
isTouch
=
false
;
LogNet
.
log
.
Info
(
"Work scan is done"
);
}
catch
(
Exception
ex
)
{
LogNet
.
log
.
Error
(
"Scan"
,
ex
);
}
finally
{
finally
{
isTouch
=
false
;
Common
.
frmMain
.
CloseWaittingDialog
();
}
...
...
@@ -125,11 +138,11 @@ namespace SmartScan
{
Common
.
frmMain
.
ShowWaittingDialog
();
});
}
public
void
Scan
(
string
[]
code
)
{
try
...
...
@@ -236,7 +249,7 @@ namespace SmartScan
else
{
string
filename
=
""
;
Common
.
frmMain
.
Invoke
(
delegate
()
Common
.
frmMain
.
Invoke
(
delegate
()
{
OpenFileDialog
dlg
=
new
()
{
Filter
=
"图片文件|*.jpg;*.png;*.bmp;*.jpeg"
};
DialogResult
dr
=
dlg
.
ShowDialog
();
...
...
@@ -285,20 +298,10 @@ namespace SmartScan
LogNet
.
log
.
Info
(
"Work MatchingTemplate"
);
if
(
workCodeInfo
.
Count
==
0
)
return
false
;
originalCodeText
=
BLLCommon
.
cameraVision
.
GetBarCodeText
(
workCodeInfo
);
bool
rtn
=
BLLCommon
.
mateEdit
.
MatchingTemplate
(
workCodeInfo
,
BLLCommon
.
config
.
DefaultMaterialName
,
false
,
out
string
mateName
,
out
workCodeKeyword
,
out
originalCodeIsUsed
);
bool
rtn
=
BLLCommon
.
mateEdit
.
MatchingTemplate
(
workCodeInfo
,
BLLCommon
.
config
.
DefaultMaterialName
,
false
,
out
string
mateName
,
out
workCodeKeyword
,
out
originalCodeIsUsed
);
BLL
.
MatchAnalysis
.
ShowResult
();
Common
.
frmMain
.
Invoke
(
delegate
()
{
if
(
workCodeKeyword
.
Any
(
a
=>
a
.
Value
.
StartsWith
(
"<OCR>"
)))
{
FrmDrawText
frmDraw
=
new
FrmDrawText
();
if
(
frmDraw
.
ShowDialog
()
==
DialogResult
.
OK
)
{
BLLCommon
.
extension
.
DrawTextBackground
(
workCodeKeyword
);
}
}
});
Common
.
frmMain
.
Invoke
(
delegate
()
{
if
(
rtn
)
...
...
@@ -321,14 +324,14 @@ namespace SmartScan
fm
.
ShowDialog
(
Common
.
frmMain
);
}
}
});
});
return
rtn
;
}
private
void
SetKey
(
bool
hasMatch
)
{
LogNet
.
log
.
Info
(
"Work SetKey hasMatch:"
+
hasMatch
);
BLLCommon
.
extension
.
SetKey
(
originalCodeText
,
workCodeKeyword
,
hasMatch
,
out
_
);
LogNet
.
log
.
Info
(
"Work SetKey hasMatch:"
+
hasMatch
);
BLLCommon
.
extension
.
SetKey
(
originalCodeText
,
workCodeKeyword
,
hasMatch
,
out
_
);
if
(
workCodeKeyword
.
Count
==
0
)
return
;
if
(
BLLCommon
.
config
.
PromptAfterPrinting
&&
!
BLL
.
Config
.
Backgrounder
)
...
...
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论