Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
张东亮
/
NS100
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit 00474f0d
由
lailai.xing
编写于
2025-07-08 16:21:24 +0800
浏览文件
选项
浏览文件
标签
下载
差异文件
Merge branch 'NS100_WPF' of
http://106.15.194.121:8083/zdl/NS100
into NS100_WPF
2 个父辈
dbd5ddb2
7e4f909c
显示空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
46 行增加
和
63 行删除
BLL/Extension/Item_General.cs
SmartScan/SetControl/WPF/WPF_MaterialTemplate.xaml.cs
BLL/Extension/Item_General.cs
查看文件 @
00474f0
using
System
;
using
Asa.FaceControl
;
using
System.Net
;
using
System.Text
;
using
System.Collections.Generic
;
using
System.Web.Script.Serialization
;
using
Model
;
using
Model
;
using
Asa
;
using
Newtonsoft.Json
;
using
Newtonsoft.Json
;
using
System.Windows.Forms
;
using
System
;
using
System.Collections.Generic
;
using
System.IO
;
using
System.IO
;
using
static
BLL
.
Extension
;
using
System.Web.UI
;
using
Asa.FaceControl
;
using
System.Configuration
;
using
System.Linq
;
using
System.Linq
;
using
System.Web.Script.Serialization
;
using
System.Windows.Forms
;
using
static
BLL
.
BLLCommon
;
using
static
BLL
.
Replacekeywords
;
using
static
BLL
.
Replacekeywords
;
using
RestSharp
;
using
System.Web
;
using
Http
=
Model
.
Http
;
using
Http
=
Model
.
Http
;
using
System.Drawing
;
using
DocumentFormat.OpenXml.Spreadsheet
;
using
static
System
.
Windows
.
Forms
.
VisualStyles
.
VisualStyleElement
.
ToolTip
;
using
DocumentFormat.OpenXml.Wordprocessing
;
using
DocumentFormat.OpenXml.Presentation
;
using
static
BLL
.
BLLCommon
;
using
TcpKPIO
;
namespace
BLL
namespace
BLL
{
{
...
@@ -44,19 +30,19 @@ namespace BLL
...
@@ -44,19 +30,19 @@ namespace BLL
string
[]
lines
=
System
.
IO
.
File
.
ReadAllLines
(
FilePath
.
CONFIG_MACRO_KEY
);
string
[]
lines
=
System
.
IO
.
File
.
ReadAllLines
(
FilePath
.
CONFIG_MACRO_KEY
);
macroKey
.
AddRange
(
lines
);
macroKey
.
AddRange
(
lines
);
}
}
macroKeyValue
=
new
();
macroKeyValue
=
new
();
if
(
System
.
IO
.
File
.
Exists
(
FilePath
.
CONFIG_MACRO_Value
))
if
(
System
.
IO
.
File
.
Exists
(
FilePath
.
CONFIG_MACRO_Value
))
{
{
string
[]
lines
=
System
.
IO
.
File
.
ReadAllLines
(
FilePath
.
CONFIG_MACRO_Value
);
string
[]
lines
=
System
.
IO
.
File
.
ReadAllLines
(
FilePath
.
CONFIG_MACRO_Value
);
macroKeyValue
.
AddRange
(
lines
);
macroKeyValue
.
AddRange
(
lines
);
}
}
}
}
private
DebounceHelper
<
FaceComboBox
,
string
>
debounceHelper
;
private
DebounceHelper
<
FaceComboBox
,
string
>
debounceHelper
;
public
General
(
Config
config
)
public
General
(
Config
config
)
{
{
this
.
config
=
config
;
this
.
config
=
config
;
ReadMacro
();
ReadMacro
();
debounceHelper
=
new
DebounceHelper
<
FaceComboBox
,
string
>(
500
);
// 设置抗抖动的间隔,单位为毫秒
debounceHelper
=
new
DebounceHelper
<
FaceComboBox
,
string
>(
500
);
// 设置抗抖动的间隔,单位为毫秒
debounceHelper
.
DebouncedTextChanged
+=
DebounceHelper_DebouncedTextChanged
;
debounceHelper
.
DebouncedTextChanged
+=
DebounceHelper_DebouncedTextChanged
;
}
}
...
@@ -102,7 +88,7 @@ namespace BLL
...
@@ -102,7 +88,7 @@ namespace BLL
}
}
static
bool
mesResult
=
false
;
static
bool
mesResult
=
false
;
bool
islast
=
false
;
bool
islast
=
false
;
Dictionary
<
string
,
string
>
lastkey
=
null
;
Dictionary
<
string
,
string
>
lastkey
=
null
;
// 用于存储上一次的 key
// 用于存储上一次的 key
...
@@ -112,7 +98,7 @@ namespace BLL
...
@@ -112,7 +98,7 @@ namespace BLL
protected
virtual
void
OnKeySet
(
string
[]
originalCode
,
Dictionary
<
string
,
string
>
key
,
bool
hasMatch
)
protected
virtual
void
OnKeySet
(
string
[]
originalCode
,
Dictionary
<
string
,
string
>
key
,
bool
hasMatch
)
{
{
extension
.
set
(
originalCode
,
key
,
hasMatch
);
extension
.
set
(
originalCode
,
key
,
hasMatch
);
}
}
protected
virtual
void
CheckText
(
string
text
)
protected
virtual
void
CheckText
(
string
text
)
{
{
...
@@ -148,7 +134,7 @@ namespace BLL
...
@@ -148,7 +134,7 @@ namespace BLL
var
now
=
DateTime
.
Now
;
var
now
=
DateTime
.
Now
;
// 比较当前 key 和上次的 key
// 比较当前 key 和上次的 key
bool
isSame
=
false
;
bool
isSame
=
false
;
bool
isFirstCapture
=
lastKeys
==
null
;
bool
isFirstCapture
=
lastKeys
==
null
;
try
try
{
{
...
@@ -202,23 +188,7 @@ namespace BLL
...
@@ -202,23 +188,7 @@ namespace BLL
}
}
}
}
#
endregion
#
endregion
// 添加或替换自增ID
string
reelIdKeyWord
=
config
.
ReelIDKeyWord
;
if
(!
string
.
IsNullOrEmpty
(
config
.
ReelIDKeyWord
)
&&
isdisplay
)
{
var
Reelidstr
=
GetReelid
();
if
(
key
.
ContainsKey
(
config
.
ReelIDKeyWord
))
{
key
[
config
.
ReelIDKeyWord
]
=
Reelidstr
;
}
else
{
key
.
Add
(
config
.
ReelIDKeyWord
,
Reelidstr
);
}
}
//客户定制key
//客户定制key
...
@@ -353,7 +323,20 @@ namespace BLL
...
@@ -353,7 +323,20 @@ namespace BLL
}
}
// 添加或替换自增ID
string
reelIdKeyWord
=
config
.
ReelIDKeyWord
;
if
(!
string
.
IsNullOrEmpty
(
config
.
ReelIDKeyWord
)
&&
isdisplay
)
{
var
Reelidstr
=
GetReelid
();
if
(
key
.
ContainsKey
(
config
.
ReelIDKeyWord
))
{
key
[
config
.
ReelIDKeyWord
]
=
Reelidstr
;
}
else
{
key
.
Add
(
config
.
ReelIDKeyWord
,
Reelidstr
);
}
}
...
@@ -555,7 +538,7 @@ namespace BLL
...
@@ -555,7 +538,7 @@ namespace BLL
}
}
}
}
string
finalText
=
processedPattern
;
string
finalText
=
processedPattern
;
LogNet
.
log
.
Info
(
string
.
Format
(
"GetReelid pattern={0}, id={1}, text={2}"
,
matchPattern
,
reelID
,
finalText
));
LogNet
.
log
.
Info
(
string
.
Format
(
"GetReelid pattern={0}, id={1}, text={2}"
,
matchPattern
,
reelID
,
finalText
));
...
@@ -677,14 +660,15 @@ namespace BLL
...
@@ -677,14 +660,15 @@ namespace BLL
{
{
if
(
BLLCommon
.
config
.
Language
.
Equals
(
"English"
))
if
(
BLLCommon
.
config
.
Language
.
Equals
(
"English"
))
{
{
bool
result
=
MessageboxNeo
.
Show
(
""
,
"Whether to skip this operation?"
,
"NEO SCAN"
,
true
);
bool
result
=
MessageboxNeo
.
Show
(
""
,
"Whether to skip this operation?"
,
"NEO SCAN"
,
true
);
if
(
result
)
if
(
result
)
{
{
lastKeys
=
null
;
lastKeys
=
null
;
BLLCommon
.
extension
.
labelText
=
"Waiting"
;
BLLCommon
.
extension
.
labelText
=
"Waiting"
;
}
}
}
else
if
(
BLLCommon
.
config
.
Language
.
Equals
(
"日语"
))
}
else
if
(
BLLCommon
.
config
.
Language
.
Equals
(
"日语"
))
{
{
bool
result
=
MessageboxNeo
.
Show
(
""
,
bool
result
=
MessageboxNeo
.
Show
(
""
,
"この操作をスキップしますか?"
,
"この操作をスキップしますか?"
,
...
@@ -701,7 +685,7 @@ namespace BLL
...
@@ -701,7 +685,7 @@ namespace BLL
}
}
else
else
{
{
bool
result
=
MessageboxNeo
.
Show
(
""
,
bool
result
=
MessageboxNeo
.
Show
(
""
,
"是否跳过此操作?"
,
"是否跳过此操作?"
,
"NEO SCAN"
,
"NEO SCAN"
,
true
);
true
);
...
@@ -725,22 +709,22 @@ namespace BLL
...
@@ -725,22 +709,22 @@ namespace BLL
private
void
ComboBoxTextChanged
(
object
sender
,
EventArgs
e
)
private
void
ComboBoxTextChanged
(
object
sender
,
EventArgs
e
)
{
{
var
txt
=
((
FaceComboBox
)
sender
).
Text
;
var
txt
=
((
FaceComboBox
)
sender
).
Text
;
debounceHelper
.
HandleTextChanged
((
FaceComboBox
)
sender
,
txt
);
debounceHelper
.
HandleTextChanged
((
FaceComboBox
)
sender
,
txt
);
}
}
private
Dictionary
<
string
,
string
>
UpdateLastKey
(
Dictionary
<
string
,
string
>
lastkey
)
private
Dictionary
<
string
,
string
>
UpdateLastKey
(
Dictionary
<
string
,
string
>
lastkey
)
{
{
Dictionary
<
string
,
string
>
keyValues
=
new
Dictionary
<
string
,
string
>();
Dictionary
<
string
,
string
>
keyValues
=
new
Dictionary
<
string
,
string
>();
if
(
lastkey
==
null
)
if
(
lastkey
==
null
)
return
null
;
return
null
;
foreach
(
var
temp
in
lastkey
.
Keys
)
foreach
(
var
temp
in
lastkey
.
Keys
)
{
{
keyValues
.
Add
(
temp
,
lastkey
[
temp
]);
keyValues
.
Add
(
temp
,
lastkey
[
temp
]);
if
(
temp
.
Contains
(
":"
))
if
(
temp
.
Contains
(
":"
))
{
{
string
date
=
temp
.
Split
(
':'
)[
1
];
string
date
=
temp
.
Split
(
':'
)[
1
];
if
(
int
.
TryParse
(
date
,
out
int
value
)&&
value
==
0
&&
int
.
TryParse
(
lastkey
[
temp
],
out
int
value2
))
if
(
int
.
TryParse
(
date
,
out
int
value
)
&&
value
==
0
&&
int
.
TryParse
(
lastkey
[
temp
],
out
int
value2
))
{
{
keyValues
[
temp
]
=
value2
.
ToString
(
$
"D{date.Length}"
);
keyValues
[
temp
]
=
value2
.
ToString
(
$
"D{date.Length}"
);
}
}
...
@@ -763,7 +747,7 @@ namespace BLL
...
@@ -763,7 +747,7 @@ namespace BLL
else
else
lastkey
.
Add
(
extensions
[
i
].
Key
,
extensions
[
i
].
Control
.
Text
);
lastkey
.
Add
(
extensions
[
i
].
Key
,
extensions
[
i
].
Control
.
Text
);
}
}
lastkey
=
UpdateLastKey
(
lastkey
);
lastkey
=
UpdateLastKey
(
lastkey
);
LogNet
.
log
.
Info
(
"lastkey:"
+
JsonConvert
.
SerializeObject
(
lastkey
));
LogNet
.
log
.
Info
(
"lastkey:"
+
JsonConvert
.
SerializeObject
(
lastkey
));
#
region
判断指定关键字是否存在内容
#
region
判断指定关键字是否存在内容
List
<
string
>
strings
=
new
List
<
string
>();
List
<
string
>
strings
=
new
List
<
string
>();
...
@@ -781,7 +765,7 @@ namespace BLL
...
@@ -781,7 +765,7 @@ namespace BLL
}
}
}
}
}
}
LogNet
.
log
.
Info
(
"DataSource_ForceMatching:"
+
string
.
Join
(
","
,
strings
));
LogNet
.
log
.
Info
(
"DataSource_ForceMatching:"
+
string
.
Join
(
","
,
strings
));
#
endregion
#
endregion
for
(
int
i
=
0
;
i
<
extensions
.
Count
;
i
++)
for
(
int
i
=
0
;
i
<
extensions
.
Count
;
i
++)
{
{
...
@@ -831,7 +815,7 @@ namespace BLL
...
@@ -831,7 +815,7 @@ namespace BLL
/// <param name="errmsg"></param>
/// <param name="errmsg"></param>
/// <param name="dic">返回请求后,替换完成的键值对</param>
/// <param name="dic">返回请求后,替换完成的键值对</param>
/// <returns></returns>
/// <returns></returns>
private
bool
GetHttpReelID
(
Dictionary
<
string
,
string
>
key
,
out
string
errmsg
,
out
Dictionary
<
string
,
object
>
dic
)
private
bool
GetHttpReelID
(
Dictionary
<
string
,
string
>
key
,
out
string
errmsg
,
out
Dictionary
<
string
,
object
>
dic
)
{
{
errmsg
=
""
;
errmsg
=
""
;
dic
=
null
;
dic
=
null
;
...
@@ -841,7 +825,7 @@ namespace BLL
...
@@ -841,7 +825,7 @@ namespace BLL
{
{
errmsg
=
"Api error"
;
errmsg
=
"Api error"
;
if
(
extensions
!=
null
&&
!
extensions
[
0
].
Control
.
InvokeRequired
)
if
(
extensions
!=
null
&&
!
extensions
[
0
].
Control
.
InvokeRequired
)
MessageboxNeo
.
Show
(
"BoxReelIDInfoMaintain"
,
errmsg
,
"NEO SCAN"
,
true
);
MessageboxNeo
.
Show
(
"BoxReelIDInfoMaintain"
,
errmsg
,
"NEO SCAN"
,
true
);
// new FaceMessageBox("BoxReelIDInfoMaintain", errmsg, System.Windows.Forms.MessageBoxButtons.OK, true).ShowDialog();
// new FaceMessageBox("BoxReelIDInfoMaintain", errmsg, System.Windows.Forms.MessageBoxButtons.OK, true).ShowDialog();
return
false
;
return
false
;
...
@@ -946,7 +930,7 @@ namespace BLL
...
@@ -946,7 +930,7 @@ namespace BLL
var
data
=
ExtraFileData
.
AllData
[
value
];
var
data
=
ExtraFileData
.
AllData
[
value
];
foreach
(
var
item
in
data
)
foreach
(
var
item
in
data
)
{
{
var
ext
=
extensions
.
Where
(
a
=>
(
a
.
Type
==
"TextBox"
||
a
.
Type
==
"ComboBox"
)
&&
a
.
Key
==
item
.
Key
).
ToList
();
var
ext
=
extensions
.
Where
(
a
=>
(
a
.
Type
==
"TextBox"
||
a
.
Type
==
"ComboBox"
)
&&
a
.
Key
==
item
.
Key
).
ToList
();
foreach
(
var
Control
in
ext
)
foreach
(
var
Control
in
ext
)
{
{
Control
.
Control
.
Text
=
item
.
Value
;
Control
.
Control
.
Text
=
item
.
Value
;
...
@@ -964,7 +948,7 @@ namespace BLL
...
@@ -964,7 +948,7 @@ namespace BLL
}
}
public
void
DrawTextBackground
(
Dictionary
<
string
,
string
>
key
)
public
void
DrawTextBackground
(
Dictionary
<
string
,
string
>
key
)
{
{
if
(
extensions
!=
null
&&
extensions
.
Count
>
0
&&
!
extensions
[
0
].
Control
.
InvokeRequired
)
if
(
extensions
!=
null
&&
extensions
.
Count
>
0
&&
!
extensions
[
0
].
Control
.
InvokeRequired
)
{
{
bool
focused
=
false
;
// 用于跟踪是否已经聚焦到第一个匹配的文本框
bool
focused
=
false
;
// 用于跟踪是否已经聚焦到第一个匹配的文本框
for
(
int
i
=
0
;
i
<
extensions
.
Count
;
i
++)
for
(
int
i
=
0
;
i
<
extensions
.
Count
;
i
++)
...
@@ -1007,12 +991,12 @@ namespace BLL
...
@@ -1007,12 +991,12 @@ namespace BLL
public
Dictionary
<
string
,
string
>
ReplaceData
(
Dictionary
<
string
,
string
>
key
)
public
Dictionary
<
string
,
string
>
ReplaceData
(
Dictionary
<
string
,
string
>
key
)
{
{
string
err
=
null
;
string
err
=
null
;
Dictionary
<
string
,
object
>
dic
=
new
Dictionary
<
string
,
object
>();
Dictionary
<
string
,
object
>
dic
=
new
Dictionary
<
string
,
object
>();
if
(!
GetHttpReelID
(
key
,
out
err
,
out
dic
))
if
(!
GetHttpReelID
(
key
,
out
err
,
out
dic
))
{
{
return
key
;
return
key
;
}
}
return
dic
?.
ToDictionary
(
a
=>
a
.
Key
,
a
=>
a
.
Value
.
ToString
());
return
dic
?.
ToDictionary
(
a
=>
a
.
Key
,
a
=>
a
.
Value
.
ToString
());
}
}
}
}
}
}
...
...
SmartScan/SetControl/WPF/WPF_MaterialTemplate.xaml.cs
查看文件 @
00474f0
...
@@ -94,10 +94,6 @@ namespace SmartScan.SetControl.WPF
...
@@ -94,10 +94,6 @@ namespace SmartScan.SetControl.WPF
var
bitMap
=
(
Bitmap
)
ObjConversion
.
ReadImageFile
(
iamgepath
);
var
bitMap
=
(
Bitmap
)
ObjConversion
.
ReadImageFile
(
iamgepath
);
int
contenI
=
1
;
int
contenI
=
1
;
//给条码加上识别数字
//kmon
//2025-6-25
mateCopy
[
mateIndex
].
Code
.
ForEach
(
codeInfo
=>
mateCopy
[
mateIndex
].
Code
.
ForEach
(
codeInfo
=>
{
{
PointF
ConterPoint
;
PointF
ConterPoint
;
...
@@ -124,6 +120,9 @@ namespace SmartScan.SetControl.WPF
...
@@ -124,6 +120,9 @@ namespace SmartScan.SetControl.WPF
data3
.
SelectedIndex
=
-
1
;
data3
.
SelectedIndex
=
-
1
;
bmp
=
(
Bitmap
)
ImgShow
.
Image
;
bmp
=
(
Bitmap
)
ImgShow
.
Image
;
//给条码加上识别数字
//kmon
//2025-6-25
}
}
else
else
...
...
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论